Преглед изворни кода

修改数据库连接函数 增删sqlite字符串

visuddhinanda пре 5 година
родитељ
комит
862b4145d4
56 измењених фајлова са 238 додато и 241 уклоњено
  1. 1 1
      app/dict/redis_refresh_first_mean.php
  2. 2 2
      app/dict_builder/get_one_word.php
  3. 1 1
      app/install/db_insert_templet.php
  4. 1 1
      app/install/page_index.php
  5. 3 0
      app/pcdl/change.php
  6. 2 2
      app/pcdl/get_best.php
  7. 1 2
      app/pcdl/get_res_index.php
  8. 1 2
      app/pcdl/getfilelist.php
  9. 1 2
      app/pcdl/pc_get_book_index.php
  10. 5 5
      app/pcdl/reader.php
  11. 7 7
      app/pcdl/reader_old.php
  12. 3 6
      app/pcdl/search.php
  13. 1 2
      app/pcdl/tag_search.php
  14. 1 2
      app/pcdl/tran_text.php
  15. 1 2
      app/pcdl/update_index.php
  16. 2 4
      app/pcdl/update_translate.php
  17. 82 53
      app/reader/index.php
  18. 5 0
      app/reader/reader.js
  19. 6 12
      app/search/bold_search.php
  20. 9 16
      app/search/dict_find3.php
  21. 7 8
      app/search/paliword_sc.php
  22. 1 2
      app/search/paliword_sc_pre.php
  23. 7 12
      app/search/paliword_search.php
  24. 8 16
      app/search/search.php
  25. 6 8
      app/search/title_search.php
  26. 5 6
      app/search/word_function.php
  27. 1 2
      app/search/word_list.php
  28. 1 2
      app/search/word_statistics.php
  29. 3 4
      app/studio/dict_find3.php
  30. 1 2
      app/studio/dict_updata_wbw.php
  31. 1 1
      app/studio/dom_http.php
  32. 1 1
      app/studio/file_index.php
  33. 1 1
      app/studio/file_index_refresh.php
  34. 3 6
      app/studio/get_res_json.php
  35. 1 1
      app/studio/getfilelist.php
  36. 2 2
      app/studio/message.php
  37. 1 2
      app/studio/pc_db_analysis.php
  38. 1 1
      app/studio/pc_get_book_index.php
  39. 1 1
      app/studio/pc_get_pali_text.php
  40. 1 1
      app/studio/pc_get_word_num.php
  41. 16 22
      app/studio/project.php
  42. 1 1
      app/studio/project_load.php
  43. 1 1
      app/studio/project_load_article.php
  44. 1 1
      app/studio/project_load_db.php
  45. 2 2
      app/studio/sent/sent.php
  46. 1 0
      app/studio/setting.php
  47. 1 0
      app/studio/updatadict.php
  48. 1 1
      app/term/channal_list.php
  49. 1 1
      app/term/get_term_index.php
  50. 1 2
      app/term/my_dict_list.php
  51. 1 1
      app/term/new.php
  52. 18 0
      app/term/note.js
  53. 1 1
      app/term/note.php
  54. 2 3
      app/term/related_para.php
  55. 1 2
      app/tools/pc_word_analysis.php
  56. 1 2
      app/udict/my_dict_list.php

+ 1 - 1
app/dict/redis_refresh_first_mean.php

@@ -35,7 +35,7 @@ if (PHP_SAPI == "cli") {
 				# code...
 				$redis->hSet("ref_first_mean://com",$mean["word"],$mean["mean"]);
 			}
-			echo $thisLang.":".$redis->hLen("ref_first_mean://com")."\n";
+			echo "com:".$redis->hLen("ref_first_mean://com")."\n";
 		}
 
 	}

+ 2 - 2
app/dict_builder/get_one_word.php

@@ -10,11 +10,11 @@ include "../public/_pdo.php";
 			exit;
 		}
 						
-		$dictFileName=_FILE_DB_REF_;
-		PDO_Connect("$dictFileName");
+		PDO_Connect(_FILE_DB_REF_);
 		$query = "SELECT * from dict where id = ? ";
 		$Fetch = PDO_FetchAll($query,array($word_id));
 		
+		#Todo 可疑代码带修补
 		$dictFileName=$dir_dict_3rd."all.db3";
 		PDO_Connect("$dictFileName");
 		

+ 1 - 1
app/install/db_insert_templet.php

@@ -80,7 +80,7 @@ $log = $log . "$from,$FileName,open\r\n";
 $arrInserString = array();
 
 $db_file = _DIR_PALICANON_TEMPLET_ . "/" . $bookId . '_tpl.db3';
-PDO_Connect("$db_file");
+PDO_Connect("sqlite:{$db_file}");
 
 PDO_Execute("DROP TABLE IF EXISTS main;");
 $query = "CREATE TABLE 'main' ( 'id' TEXT PRIMARY KEY NOT NULL,

+ 1 - 1
app/install/page_index.php

@@ -80,7 +80,7 @@ $log = $log . "$from,$FileName,open\r\n";
 
 $arrInserString = array();
 $db_file = $dirDb . "/" . $bookId . '_tpl.db3';
-PDO_Connect("$db_file");
+PDO_Connect("sqlite:{$db_file}");
 
 PDO_Execute("DROP TABLE IF EXISTS main;");
 $query = "CREATE TABLE 'main' ( 'id' TEXT PRIMARY KEY NOT NULL,

+ 3 - 0
app/pcdl/change.php

@@ -5,6 +5,9 @@
 <body>
 <h2>Change DB</h2>
 <?php
+
+#废弃代码
+
 include "./_pdo.php";
 include "../app/public.inc";
 

+ 2 - 2
app/pcdl/get_best.php

@@ -21,8 +21,8 @@ if (isset($_GET["op"])) {
     echo "no op";
     exit;
 }
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 switch ($op) {
     case "all":
         //查热门

+ 1 - 2
app/pcdl/get_res_index.php

@@ -400,8 +400,7 @@ if ($album == -1) {
                 case 1:
                 case 2:
                 case 6:
-                    $db_file = _FILE_DB_PALITEXT_;
-                    PDO_Connect("$db_file");
+                    PDO_Connect(_FILE_DB_PALITEXT_);
                     $query = "select * from 'pali_text' where book = '{$book}' and level>'0' and level<8 and paragraph>=$paragraph ";
                     break;
                 case 3:

+ 1 - 2
app/pcdl/getfilelist.php

@@ -21,8 +21,7 @@ if (isset($_GET["order"])) {
 
 //获取服务器端文件列表
 
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 /*
 $files = scandir($dir);
 $arrlength=count($files);

+ 1 - 2
app/pcdl/pc_get_book_index.php

@@ -9,9 +9,8 @@ $wordlist = array();
 $outXml = "<index>";
 echo $outXml;
 
-$db_file = _FILE_DB_PALITEXT_;
 //open database
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_PALITEXT_);
 $query = "select * FROM pali_text where \"book\"=" . $PDO->quote($currBook);
 
 $Fetch = PDO_FetchAll($query);

+ 5 - 5
app/pcdl/reader.php

@@ -428,7 +428,7 @@ if (isset($_GET["display"])) {
 $tocList = array();
 $FetchChannal = array();
 if ($_view == "chapter" || $_view == "para" || $_view == "sent") {
-    PDO_Connect("" . _FILE_DB_PALITEXT_);
+    PDO_Connect( _FILE_DB_PALITEXT_);
     //生成目录
     $htmlToc2 = "<div><a href='#page_head'>页首</a></div>";
     //找到该位置对应的书
@@ -645,7 +645,7 @@ if ($currParaLevel == 1 || $currParaParentLevel == 1) {
     }
     echo "</div>";
     //生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去
-    PDO_Connect("" . _FILE_DB_PALI_SENTENCE_);
+    PDO_Connect(_FILE_DB_PALI_SENTENCE_);
 
     if ($_display == "sent") {
         //逐句显示
@@ -743,8 +743,8 @@ if ($currParaLevel == 1 || $currParaParentLevel == 1) {
     //查询编辑者数量
 
     //查询句子译文内容
-    PDO_Connect("" . _FILE_DB_SENTENCE_);
-    $dbh = new PDO("" . _FILE_DB_PALI_SENTENCE_, "", "");
+    PDO_Connect(_FILE_DB_SENTENCE_);
+    $dbh = new PDO(_FILE_DB_PALI_SENTENCE_, "", "");
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     //查询channal数量
     switch ($_view) {
@@ -982,7 +982,7 @@ if (strtolower(mb_substr($par_title, mb_strlen($par_title, "UTF-8") - 7, null, "
     $searchToc = strtolower(mb_substr($par_title, 0, -1, "UTF-8"));
 }
 
-PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 $query = "select book, paragraph,title from 'index' where  \"title\" like " . $PDO->quote($searchToc . '%') . "  limit 0,50";
 $Fetch = PDO_FetchAll($query);
 foreach ($Fetch as $key => $value) {

+ 7 - 7
app/pcdl/reader_old.php

@@ -473,7 +473,7 @@ if (isset($_GET["paragraph"])) {
 		<div id="main_text_view" style="padding-bottom: 10em;">
 <?php
 
-PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+PDO_Connect( _FILE_DB_RESRES_INDEX_);
 if (isset($album)) {
     //更新点击
     $query = "select * from 'index' where book='$book' and paragraph='$paragraph' and album=$album";
@@ -513,8 +513,8 @@ for ($iPar = $par_begin; $iPar <= $par_end; $iPar++) {
 }
 
 //先查pali text 因为要获取段落标题级别
-$db_file = _FILE_DB_PALITEXT_;
-PDO_Connect("" . _FILE_DB_PALITEXT_);
+
+PDO_Connect(_FILE_DB_PALITEXT_);
 
 if ($par_begin == -1) {
     $query = "SELECT * FROM \"pali_text\" WHERE book = '{$book}' ";
@@ -568,7 +568,7 @@ if (isset($album)) {
     ////自动逐词译结束
      */
 
-    PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+    PDO_Connect(_FILE_DB_RESRES_INDEX_);
     $query = "select * from 'album' where id='$album'";
     $Fetch = PDO_FetchAll($query);
     $iFetch = count($Fetch);
@@ -578,7 +578,7 @@ if (isset($album)) {
                 break;
             case 2: //逐词译
                 $db_file = _DIR_PALICANON_WBW_ . "/p{$book}_wbw.db3";
-                PDO_Connect("$db_file");
+                PDO_Connect("sqlite:{$db_file}");
                 for ($iPar = $par_begin; $iPar <= $par_end; $iPar++) {
                     $table = "p{$book}_wbw_data";
                     $query = "SELECT * FROM \"{$table}\" WHERE (\"paragraph\" = " . $PDO->quote($iPar) . " ) and album_id={$album} ";
@@ -609,7 +609,7 @@ if (isset($album)) {
                 $tocHtml = "";
                 //打开翻译数据文件
                 $db_file = _DIR_PALICANON_TRAN_ . "/p{$book}_translate.db3";
-                PDO_Connect("{$db_file}");
+                PDO_Connect("sqlite:{$db_file}");
                 $this_album_id = $album;
                 $table = "p{$book}_translate_info";
                 if ($par_begin == -1) {
@@ -670,7 +670,7 @@ if (isset($album)) {
         }
     }
     //添加注解
-    PDO_Connect("" . _FILE_DB_COMMENTS_);
+    PDO_Connect( _FILE_DB_COMMENTS_);
 
     if ($par_begin == -1) {
         $query = "SELECT * FROM \"comments\" WHERE album='$album'  order by id DESC";

+ 3 - 6
app/pcdl/search.php

@@ -16,8 +16,7 @@ if (isset($_GET["word"])) {
     exit;
 }
 _load_book_index();
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 switch ($op) {
     case "pre":
         //查作者
@@ -42,8 +41,7 @@ switch ($op) {
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
         if ($iFetch > 0) {
-            $dictFileName = _FILE_DB_PALITEXT_;
-            PDO_Connect("$dictFileName");
+            PDO_Connect(_FILE_DB_PALITEXT_);
             $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
             echo "<div class='search_list_div'><div class='search_type'>标题({$count})</div></div>";
             for ($i = 0; $i < $iFetch; $i++) {
@@ -94,8 +92,7 @@ switch ($op) {
                 echo "</div>";
             }
         }
-        $db_file = _FILE_DB_RESRES_INDEX_;
-        PDO_Connect("$db_file");
+        PDO_Connect(_FILE_DB_RESRES_INDEX_);
         //查标签
         $query = "select count(*) from 'index' where tag like '%$word%'";
         $count = PDO_FetchOne($query);

+ 1 - 2
app/pcdl/tag_search.php

@@ -14,8 +14,7 @@ if (isset($_POST["order"])) {
     $order = "";
 }
 
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 $tag_string = '{' . $tag . '}';
 $query = "select * from 'index' where tag like '%$tag_string%' ";
 $Fetch = PDO_FetchAll($query);

+ 1 - 2
app/pcdl/tran_text.php

@@ -17,8 +17,7 @@ if (isset($_POST["data"])) {
 
 $log = "";
 
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 $query = "select * from 'album' where id='$album'";
 $Fetch = PDO_FetchAll($query);
 $iFetch = count($Fetch);

+ 1 - 2
app/pcdl/update_index.php

@@ -336,8 +336,7 @@ switch ($res_type) {
 
         break;
     case "album":
-        $db_file = _FILE_DB_RESRES_INDEX_;
-        PDO_Connect("$db_file");
+        PDO_Connect(_FILE_DB_RESRES_INDEX_);
         $query = "select * from album where 1";
         $search_album = PDO_FetchAll($query);
         foreach ($search_album as $oneAlbum) {

+ 2 - 4
app/pcdl/update_translate.php

@@ -39,8 +39,7 @@ echo "<h2>$from</h2>";
             $edition1 = $Fetch[$i]["edition1"];
             $type = $Fetch[$i]["type"];
 
-            $db_file = _FILE_DB_PALITEXT_;
-            PDO_Connect("$db_file");
+            PDO_Connect(_FILE_DB_PALITEXT_);
 
             $query = "select * from pali_text where book = '{$book}' and level > 0 and level < 8";
             $title_data = PDO_FetchAll($query);
@@ -57,8 +56,7 @@ echo "<h2>$from</h2>";
             echo $query . "<br>";
             $paragraph_list = PDO_FetchAll($query);
 
-            $db_file = _FILE_DB_RESRES_INDEX_;
-            PDO_Connect("$db_file");
+            PDO_Connect(_FILE_DB_RESRES_INDEX_);
             $query = "select * from album where guid = '$guid'";
             $search_album = PDO_FetchAll($query);
             if (count($search_album) == 0) {

+ 82 - 53
app/reader/index.php

@@ -86,6 +86,7 @@ require_once "../pcdl/html_head.php";
 
 	.main_view{
 		padding: 0 1em;
+		padding-top: 7em;
 		max-width: 1280px;
 		margin-left: auto;
 		margin-right: auto;
@@ -164,6 +165,10 @@ require_once "../pcdl/html_head.php";
 	}
 	.active{
 		background-color: var(--btn-hover-bg-color);
+		
+	}
+	.active a{
+		color:white;
 	}
 	.icon_btn a {
 	color: var(--main-color);
@@ -224,6 +229,32 @@ require_once "../pcdl/html_head.php";
 	#para_path_next_level{
 		display:inline-block;
 	}
+
+
+	#right_float_pannal{
+		position: fixed;
+		height: calc(100% - 7.5em);
+		top: 7.5em;
+		left: 100%;
+		width: 28em;
+		min-width:20em;
+		color: var(--btn-color);
+		background-color: var(--tool-bg-color);
+		z-index: 20;
+		-webkit-transition-duration: 0.4s;
+		transition-duration: 0.4s;
+		-webkit-contain: strict;
+		contain: strict;
+		z-index: 51;
+	}
+	#right_float_pannal>iframe{
+		width:100%;
+		height:100%;
+	}
+
+	.right_float_min #right_float_pannal{
+		left: calc(100% - 28em);
+	}
 	</style>
 
 <style media="screen and (max-width:800px)">
@@ -326,79 +357,77 @@ require_once "../pcdl/html_head.php";
 
 		?>
 			<button class='icon_btn'><a href="#"><?php echo $_local->gui->help; ?></a></button>
+			<button class='icon_btn' onclick="show_dict(this)"><a href="#"><?php echo $_local->gui->dict; ?></a></button>
 		</span>
 	</div>
 </div>
 
-<div id="main_view" class="main_view">
-	<div id="article_head" style="border-bottom: 1px solid gray;">
-		<div id="article_title" class="term_word_head_pali"><?php echo $_local->gui->title; ?></div>
-		<div  id='path_div' style="display:flex;justify-content: space-between;">
-			<div id="article_path">
-			<span id="para_path"></span>
-			<span class="case_dropdown" id="para_path_next_level">
-			……
-			<div id="toc_next_menu" class="case_dropdown-content">
-			</div>
-			</span>
-			</div>
-			<div id="article_lang">
-				<div class="click_dropdown_div">
-					<div class="click_dropdown_button">语言</div>
-					<div class="click_dropdown_content">
-						<div class="click_dropdown_content_inner">
-							<a>简体中文</a>
-						</div>
-					</div>
+<div id="main_view_shell">
+	<div id="main_view" class="main_view">
+		<div id="article_head" style="border-bottom: 1px solid gray;">
+			<div id="article_title" class="term_word_head_pali"><?php echo $_local->gui->title; ?></div>
+			<div  id='path_div' style="display:flex;justify-content: space-between;">
+				<div id="article_path">
+				<span id="para_path"></span>
+				<span class="case_dropdown" id="para_path_next_level">
+				……
+				<div id="toc_next_menu" class="case_dropdown-content">
 				</div>
-			</div>
-		</div>
-	</div>
-	<div id="contents_view">
-		<div id="contents_div" style="padding: 0 1em 0 30px;width:70vw;">
-			<div id="contents">
-			<?php echo $_local->gui->loading; ?>...
-			</div>
-			<div id="contents_toc">
-			</div>
-			<div id="contents_foot">
-				<div id="contents_nav" style="display:flex;justify-content: space-between;">
-					<div id="contents_nav_left"></div>
-					<div id="contents_nav_right"></div>
+				</span>
 				</div>
-				<div id="contents_dicuse">
-				
+				<div id="article_lang">
+					<div class="click_dropdown_div">
+						<div class="click_dropdown_button">语言</div>
+						<div class="click_dropdown_content">
+							<div class="click_dropdown_content_inner">
+								<a>简体中文</a>
+							</div>
+						</div>
+					</div>
 				</div>
 			</div>
 		</div>
-		<div id="right_pannal">
-			<div class="fun_frame">
-				<div id = "collect_title" class="title"><?php echo $_local->gui->contents; ?></div>
-				<div id = "toc_content" class="content" style="max-height:25vw;">
+		<div id="contents_view">
+			<div id="contents_div" style="padding: 0 1em 0 30px;width:70vw;">
+				<div id="contents"><?php echo $_local->gui->loading; ?>...</div>
+				<div id="contents_toc"></div>
+				<div id="contents_foot">
+					<div id="contents_nav" style="display:flex;justify-content: space-between;">
+						<div id="contents_nav_left"></div>
+						<div id="contents_nav_right"></div>
+					</div>
+					<div id="contents_dicuse"></div>
 				</div>
 			</div>
-			<div class="fun_frame">
-				<div style="display:flex;justify-content: space-between;">
-					<div class="title"><?php echo $_local->gui->contributor; ?></div>
-					<div class="click_dropdown_div">
-						<div class="channel_select_button" onclick="onChannelMultiSelectStart()"><?php echo $_local->gui->select; ?></div>
+			<div id="right_pannal">
+				<div class="fun_frame">
+					<div id = "collect_title" class="title"><?php echo $_local->gui->contents; ?></div>
+					<div id = "toc_content" class="content" style="max-height:25vw;">
 					</div>
 				</div>
-				<div class='channel_select'>
-				<button onclick='onChannelChange()'><?php echo $_local->gui->confirm; ?></button>
-					<button onclick='onChannelMultiSelectCancel()'><?php echo $_local->gui->cancel; ?></button>
-				</div>
-				<div id="channal_list" class="content" style="max-height:25vw;">
+				<div class="fun_frame">
+					<div style="display:flex;justify-content: space-between;">
+						<div class="title"><?php echo $_local->gui->contributor; ?></div>
+						<div class="click_dropdown_div">
+							<div class="channel_select_button" onclick="onChannelMultiSelectStart()"><?php echo $_local->gui->select; ?></div>
+						</div>
+					</div>
+					<div class='channel_select'>
+					<button onclick='onChannelChange()'><?php echo $_local->gui->confirm; ?></button>
+						<button onclick='onChannelMultiSelectCancel()'><?php echo $_local->gui->cancel; ?></button>
+					</div>
+					<div id="channal_list" class="content" style="max-height:25vw;">
+					</div>
 				</div>
 			</div>
 		</div>
 	</div>
 
+	<div id="right_float_pannal">
+		<iframe id="dict" src="../dict/index.php?builtin=true" name="dict" title="wikipali"></iframe>
+	</div>
 </div>
 
-<div id="dict_pannal">
-	<iframe src="../dict/index.php?builtin=true" name="dict" title="W3Schools Free Online Web Tutorials"></iframe>
-</div>
 <script>
 	$(document).ready(function(){
 	ntf_init();				

+ 5 - 0
app/reader/reader.js

@@ -250,3 +250,8 @@ function set_channal(channalid) {
 function edit_wbw(book, para) {
 	wbw_channal_list_open(book, [para]);
 }
+
+function show_dict(obj) {
+	$("#main_view_shell").toggleClass("right_float_min");
+	$(obj).toggleClass("active");
+}

+ 6 - 12
app/search/bold_search.php

@@ -19,8 +19,7 @@ global $PDO;
 
 switch ($op) {
     case "pre": //预查询
-        $dictFileName = _FILE_DB_REF_INDEX_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_REF_INDEX_);
         echo "<div>";
         $query = "select word,count from dict where \"eword\" like " . $PDO->quote($word . '%') . " OR \"word\" like " . $PDO->quote($word . '%') . "  limit 0,20";
 
@@ -82,8 +81,7 @@ switch ($op) {
             $strQueryWord = "('{$word}')";
         }
 
-        $dictFileName = _FILE_DB_BOLD_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_BOLD_);
         //查询符合的记录数
         $query = "select count(*) as co from bold where \"word2\" in  $strQueryWord";
         $Fetch = PDO_FetchOne($query);
@@ -152,8 +150,7 @@ switch ($op) {
             $Fetch = PDO_FetchAll($query);
             $iFetch = count($Fetch);
             if ($iFetch > 0) {
-                $dictFileName = _FILE_DB_PALITEXT_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALITEXT_);
                 for ($i = 0; $i < $iFetch; $i++) {
                     $paliword = $Fetch[$i]["word"];
                     $book = $Fetch[$i]["book"];
@@ -170,8 +167,7 @@ switch ($op) {
                     if (strlen($pali) > 1) {
                         echo "<div class='mean'>$pali</div>";
                     } else {
-                        $dictFileName = _FILE_DB_PALITEXT_;
-                        PDO_Connect("$dictFileName");
+                        PDO_Connect(_FILE_DB_PALITEXT_);
                         $query = "select * from pali_text where \"book\" = '{$book}' and \"paragraph\" = '{$paragraph}' limit 0,20";
                         $FetchPaliText = PDO_FetchAll($query);
                         $countPaliText = count($FetchPaliText);
@@ -265,8 +261,7 @@ switch ($op) {
         switch ($target) {
             case "bold";
                 $arrBookName = json_decode(file_get_contents("../public/book_name/sc.json"));
-                $dictFileName = _FILE_DB_BOLD_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_BOLD_);
                 $wordlist = $_GET["wordlist"];
                 $booklist = $_GET["booklist"];
                 $aBookList = ltrim($booklist, "(");
@@ -328,8 +323,7 @@ switch ($op) {
                         if (strlen($pali) > 1) {
                             echo "<div class='mean'>$pali</div>";
                         } else {
-                            $dictFileName = _FILE_DB_PALITEXT_;
-                            PDO_Connect("$dictFileName");
+                            PDO_Connect(_FILE_DB_PALITEXT_);
                             $query = "select * from pali_text where \"book\" = '{$book}' and \"paragraph\" = '{$paragraph}' limit 0,20";
                             $FetchPaliText = PDO_FetchAll($query);
                             $countPaliText = count($FetchPaliText);

+ 9 - 16
app/search/dict_find3.php

@@ -32,8 +32,7 @@ global $PDO;
 
 switch ($op) {
     case "pre": //预查询
-        $dictFileName = _FILE_DB_WORD_INDEX_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_WORD_INDEX_);
         echo "<div>";
         $query = "select word,count from wordindex where \"word_en\" like " . $PDO->quote($word . '%') . " OR \"word\" like " . $PDO->quote($word . '%') . " limit 0,50";
         echo $query;
@@ -104,8 +103,7 @@ switch ($op) {
         /*查找实际出现的拼写
 
          */
-        $dictFileName = _FILE_DB_WORD_INDEX_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_WORD_INDEX_);
         $query = "select id,word,count from wordindex where \"word\" in  $strQueryWord";
         $arrRealWordList = PDO_FetchAll($query);
         $countWord = count($arrRealWordList);
@@ -142,8 +140,7 @@ switch ($op) {
         echo "</div>";
 
         //查找这些词出现在哪些书中
-        $dictFileName = _FILE_DB_BOOK_WORD_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_BOOK_WORD_);
         $query = "SELECT book,sum(count) as co FROM bookword WHERE \"wordindex\" IN $strQueryWordId  GROUP BY book LIMIT 0,217";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
@@ -177,15 +174,14 @@ switch ($op) {
         //黑体字主显示区右侧开始
         echo "<div id=\"dict_bold_right\" style='flex:7;'>";
         //前20条记录
-        $dictFileName = _FILE_DB_WORD_INDEX_;
-        PDO_Connect("$dictFileName");
+
+        PDO_Connect(_FILE_DB_WORD_INDEX_);
 
         $query = "SELECT book,paragraph, wordindex FROM word WHERE \"wordindex\" in $strQueryWordId LIMIT 0,20";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
         if ($iFetch > 0) {
-            $dictFileName = _FILE_DB_PALITEXT_;
-            PDO_Connect("$dictFileName");
+            PDO_Connect(_FILE_DB_PALITEXT_);
             for ($i = 0; $i < $iFetch; $i++) {
                 $paliwordid = $Fetch[$i]["wordindex"];
                 $paliword = $aQueryWordList["{$paliwordid}"];
@@ -230,8 +226,7 @@ switch ($op) {
             case "bold";
                 $arrBookName = json_decode(file_get_contents("../public/book_name/sc.json"));
                 $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-                $dictFileName = _FILE_DB_BOOK_WORD_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_BOOK_WORD_);
                 $wordlist = $_GET["wordlist"];
                 $booklist = $_GET["booklist"];
                 $aBookList = ltrim($booklist, "(");
@@ -310,15 +305,13 @@ switch ($op) {
                 }
                 //查找这些词出现在哪些书中结束
                 //前20条记录
-                $dictFileName = _FILE_DB_WORD_INDEX_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_WORD_INDEX_);
 
                 $query = "select * from word where \"wordindex\" in $wordlist and \"book\" in $booklist group by book,paragraph  limit 0,20";
                 $Fetch = PDO_FetchAll($query);
                 $iFetch = count($Fetch);
                 if ($iFetch > 0) {
-                    $dictFileName = _FILE_DB_PALITEXT_;
-                    PDO_Connect("$dictFileName");
+                    PDO_Connect(_FILE_DB_PALITEXT_);
                     for ($i = 0; $i < $iFetch; $i++) {
                         $paliword = $Fetch[$i]["wordindex"];
 

+ 7 - 8
app/search/paliword_sc.php

@@ -38,8 +38,7 @@ if (isset($_GET["page"])) {
 }
 
 if (count($arrWordList) > 1) {
-    $dictFileName = _FILE_DB_PALITEXT_;
-    PDO_Connect("$dictFileName");
+    PDO_Connect(_FILE_DB_PALITEXT_);
     # 首先精确匹配
     $words = implode(" ", $arrWordList);
     $query = "SELECT book,paragraph, text FROM pali_text WHERE text like ?  LIMIT ? , ?";
@@ -90,8 +89,8 @@ $countWord = count($arrRealWordList);
 $result["time"][] = array("event" => "计算某词在三藏中出现的次数", "time" => microtime(true) - $_start);
 if ($countWord == 0) {
     #没查到 模糊查询
-    $dictFileName = _FILE_DB_PALITEXT_;
-    PDO_Connect("$dictFileName");
+
+    PDO_Connect(_FILE_DB_PALITEXT_);
     $query = "SELECT book,paragraph, text FROM pali_text WHERE text like ?  LIMIT ? , ?";
     $Fetch = PDO_FetchAll($query, array("%{$word}%", $_page * $_pagesize, $_pagesize));
 
@@ -193,8 +192,8 @@ if (isset($_GET["book"])) {
 $result["time"][] = array("event" => "准备查询", "time" => microtime(true) - $_start);
 //前20条记录
 $time_start = microtime_float();
-$dictFileName = _FILE_DB_PALI_INDEX_;
-PDO_Connect("$dictFileName");
+
+PDO_Connect(_FILE_DB_PALI_INDEX_);
 $query = "SELECT count(*) from (SELECT book FROM word WHERE \"wordindex\" in $strQueryWordId  $strQueryBookId group by book,paragraph) where 1 ";
 $result["record_count"] = PDO_FetchOne($query);
 $result["time"][] = array("event" => "查询记录数", "time" => microtime(true) - $_start);
@@ -206,8 +205,8 @@ $out_data = array();
 $queryTime = (microtime_float() - $time_start) * 1000;
 $iFetch = count($Fetch);
 if ($iFetch > 0) {
-    $dictFileName = _FILE_DB_PALITEXT_;
-    PDO_Connect("$dictFileName");
+
+    PDO_Connect(_FILE_DB_PALITEXT_);
     for ($i = 0; $i < $iFetch; $i++) {
         $newRecode = array();
 

+ 1 - 2
app/search/paliword_sc_pre.php

@@ -11,8 +11,7 @@ $word = mb_strtolower($_GET["key"], 'UTF-8');
 $arrWordList = str_getcsv($word, " ");
 
 $searching = $arrWordList[count($arrWordList) - 1];
-$dbfile = _FILE_DB_WORD_INDEX_;
-PDO_Connect("" . $dbfile);
+PDO_Connect(_FILE_DB_WORD_INDEX_);
 
 if (count($arrWordList) > 1) {
     //echo "<div>";

+ 7 - 12
app/search/paliword_search.php

@@ -33,8 +33,7 @@ switch ($op) {
             $time_start = microtime_float();
 
             $searching = $arrWordList[count($arrWordList) - 1];
-            $dbfile = _FILE_DB_WORD_INDEX_;
-            PDO_Connect("" . $dbfile);
+            PDO_Connect(_FILE_DB_WORD_INDEX_);
 
             if (count($arrWordList) > 1) {
                 echo "<div>";
@@ -69,8 +68,7 @@ switch ($op) {
                     $strQuery .= "\"text\" like \"% {$oneword} %\" AND";
                 }
                 $strQuery = substr($strQuery, 0, -3);
-                $dictFileName = _FILE_DB_PALITEXT_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALITEXT_);
                 $query = "SELECT book,paragraph, html FROM pali_text WHERE {$strQuery}  LIMIT 0,20";
                 $Fetch = PDO_FetchAll($query);
                 echo "<div>$query</div>";
@@ -162,16 +160,15 @@ switch ($op) {
             echo "<div id=\"dict_bold_right\" style='flex:7;padding-left:1em;'>";
             //前20条记录
             $time_start = microtime_float();
-            $dictFileName = _FILE_DB_PALI_INDEX_;
-            PDO_Connect("$dictFileName");
+
+            PDO_Connect(_FILE_DB_PALI_INDEX_);
             $query = "SELECT book,paragraph, wordindex FROM word WHERE \"wordindex\" in $strQueryWordId and book in $strFirstBookList group by book,paragraph LIMIT 0,20";
             $Fetch = PDO_FetchAll($query);
             //echo "<div>$query</div>";
             $queryTime = (microtime_float() - $time_start) * 1000;
             $iFetch = count($Fetch);
             if ($iFetch > 0) {
-                $dictFileName = _FILE_DB_PALITEXT_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALITEXT_);
                 for ($i = 0; $i < $iFetch; $i++) {
                     $paliwordid = $Fetch[$i]["wordindex"];
                     $paliword = $aQueryWordList["{$paliwordid}"];
@@ -267,8 +264,7 @@ switch ($op) {
 
                 //前20条记录
                 $time_start = microtime_float();
-                $dictFileName = _FILE_DB_PALI_INDEX_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALI_INDEX_);
 
                 $query = "select * from word where \"wordindex\" in $wordlist and \"book\" in $booklist group by book,paragraph  limit 0,20";
                 $Fetch = PDO_FetchAll($query);
@@ -279,8 +275,7 @@ switch ($op) {
                 }
                 $iFetch = count($Fetch);
                 if ($iFetch > 0) {
-                    $dictFileName = _FILE_DB_PALITEXT_;
-                    PDO_Connect("$dictFileName");
+                    PDO_Connect(_FILE_DB_PALITEXT_);
                     for ($i = 0; $i < $iFetch; $i++) {
                         $paliword = $Fetch[$i]["wordindex"];
                         //$paliword=$wordlist["{$paliwordid}"];

+ 8 - 16
app/search/search.php

@@ -29,8 +29,7 @@ function render_book_list($strWordlist, $booklist = null)
 {
     //查找这些词出现在哪些书中
     $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-    $dictFileName = _FILE_DB_BOOK_WORD_;
-    PDO_Connect("$dictFileName");
+    PDO_Connect(_FILE_DB_BOOK_WORD_);
     if (isset($booklist)) {
         foreach ($booklist as $oneBook) {
             $aInputBook["{$oneBook}"] = 1;
@@ -119,8 +118,7 @@ switch ($op) {
             $time_start = microtime_float();
 
             $searching = $arrWordList[count($arrWordList) - 1];
-            $dictFileName = _FILE_DB_WORD_INDEX_;
-            PDO_Connect("$dictFileName");
+            PDO_Connect(_FILE_DB_WORD_INDEX_);
 
             if (count($arrWordList) > 1) {
                 echo "<div>";
@@ -156,8 +154,7 @@ switch ($op) {
                     $strQuery .= "\"text\" like \"% {$oneword} %\" AND";
                 }
                 $strQuery = substr($strQuery, 0, -3);
-                $dictFileName = _FILE_DB_PALITEXT_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALITEXT_);
                 $query = "SELECT book,paragraph, html FROM pali_text WHERE {$strQuery}  LIMIT 0,20";
                 $Fetch = PDO_FetchAll($query);
                 echo "<div>$query</div>";
@@ -213,8 +210,7 @@ switch ($op) {
             //查找实际出现的拼写
 
             $time_start = microtime_float();
-            $dictFileName = _FILE_DB_WORD_INDEX_;
-            PDO_Connect("$dictFileName");
+            PDO_Connect(_FILE_DB_WORD_INDEX_);
             $query = "select id,word,count from wordindex where \"word\" in  $strQueryWord";
             $arrRealWordList = PDO_FetchAll($query);
             $countWord = count($arrRealWordList);
@@ -289,16 +285,14 @@ switch ($op) {
             echo "<div id=\"dict_bold_right\" style='flex:7;'>";
             //前20条记录
             $time_start = microtime_float();
-            $dictFileName = _FILE_DB_PALI_INDEX_;
-            PDO_Connect("$dictFileName");
+            PDO_Connect(_FILE_DB_PALI_INDEX_);
             $query = "SELECT book,paragraph, wordindex FROM word WHERE \"wordindex\" in $strQueryWordId and book in $strFirstBookList group by book,paragraph LIMIT 0,20";
             $Fetch = PDO_FetchAll($query);
             //echo "<div>$query</div>";
             $queryTime = (microtime_float() - $time_start) * 1000;
             $iFetch = count($Fetch);
             if ($iFetch > 0) {
-                $dictFileName = _FILE_DB_PALITEXT_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALITEXT_);
                 for ($i = 0; $i < $iFetch; $i++) {
                     $paliwordid = $Fetch[$i]["wordindex"];
                     $paliword = $aQueryWordList["{$paliwordid}"];
@@ -389,8 +383,7 @@ switch ($op) {
 
                 //前20条记录
                 $time_start = microtime_float();
-                $dictFileName = _FILE_DB_PALI_INDEX_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALI_INDEX_);
 
                 $query = "select * from word where \"wordindex\" in $wordlist and \"book\" in $booklist group by book,paragraph  limit 0,20";
                 $Fetch = PDO_FetchAll($query);
@@ -399,8 +392,7 @@ switch ($op) {
                 echo "<div >搜索时间:$queryTime </div>";
                 $iFetch = count($Fetch);
                 if ($iFetch > 0) {
-                    $dictFileName = _FILE_DB_PALITEXT_;
-                    PDO_Connect("$dictFileName");
+                    PDO_Connect(_FILE_DB_PALITEXT_);
                     for ($i = 0; $i < $iFetch; $i++) {
                         $paliword = $Fetch[$i]["wordindex"];
                         //$paliword=$wordlist["{$paliwordid}"];

+ 6 - 8
app/search/title_search.php

@@ -28,7 +28,7 @@ function render_book_list($strWord, $booklist = null)
 {
     //查找这些词出现在哪些书中
     $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-    PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+    PDO_Connect(_FILE_DB_RESRES_INDEX_);
     if (isset($booklist)) {
         foreach ($booklist as $oneBook) {
             $aInputBook["{$oneBook}"] = 1;
@@ -119,7 +119,7 @@ switch ($op) {
 
             $searching = $arrWordList[count($arrWordList) - 1];
 
-            PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+            PDO_Connect( _FILE_DB_RESRES_INDEX_);
 
             if (count($arrWordList) > 1) {
                 echo "<div>";
@@ -179,7 +179,7 @@ switch ($op) {
             //前20条记录
             $time_start = microtime_float();
 
-            PDO_Connect("" . _FILE_DB_RESRES_INDEX_);
+            PDO_Connect( _FILE_DB_RESRES_INDEX_);
             if (isset($_GET["booklist"])) {
                 $query = "select * from 'index' where (\"title_en\" like " . $PDO->quote("%" . $_GET["word"] . '%') . " OR \"title\" like " . $PDO->quote("%" . $_GET["word"] . '%') . ") and book in {$_GET["booklist"]} limit 0,50";
             } else {
@@ -189,7 +189,7 @@ switch ($op) {
             $queryTime = (microtime_float() - $time_start) * 1000;
             $iFetch = count($Fetch);
             if ($iFetch > 0) {
-                PDO_Connect("" . _FILE_DB_PALITEXT_);
+                PDO_Connect( _FILE_DB_PALITEXT_);
                 for ($i = 0; $i < $iFetch; $i++) {
                     $title = $Fetch[$i]["title"];
                     $book = $Fetch[$i]["book"];
@@ -266,8 +266,7 @@ switch ($op) {
                 //前20条记录
                 $time_start = microtime_float();
 
-                $dictFileName = _FILE_DB_PALI_INDEX_;
-                PDO_Connect("$dictFileName");
+                PDO_Connect(_FILE_DB_PALI_INDEX_);
 
                 $query = "select * from word where \"wordindex\" in $wordlist and \"book\" in $booklist group by book,paragraph  limit 0,20";
                 $Fetch = PDO_FetchAll($query);
@@ -276,8 +275,7 @@ switch ($op) {
                 echo "<div >搜索时间:$queryTime </div>";
                 $iFetch = count($Fetch);
                 if ($iFetch > 0) {
-                    $dictFileName = _FILE_DB_PALITEXT_;
-                    PDO_Connect("$dictFileName");
+                    PDO_Connect(_FILE_DB_PALITEXT_);
                     for ($i = 0; $i < $iFetch; $i++) {
                         $paliword = $Fetch[$i]["wordindex"];
                         //$paliword=$wordlist["{$paliwordid}"];

+ 5 - 6
app/search/word_function.php

@@ -10,8 +10,7 @@ function get_new_book_list($strWordlist, $booklist = null)
 {
     //查找这些词出现在哪些书中
     $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-    $dictFileName = _FILE_DB_BOOK_WORD_;
-    PDO_Connect("$dictFileName");
+    PDO_Connect(_FILE_DB_BOOK_WORD_);
     if (isset($booklist)) {
         foreach ($booklist as $oneBook) {
             $aInputBook["{$oneBook}"] = 1;
@@ -63,8 +62,8 @@ function get_book_tag($strWordlist, $booklist = null)
 {
     //查找这些词出现在哪些书中
     $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-    $dictFileName = _FILE_DB_BOOK_WORD_;
-    PDO_Connect("$dictFileName");
+
+    PDO_Connect(_FILE_DB_BOOK_WORD_);
     if (isset($booklist)) {
         foreach ($booklist as $oneBook) {
             $aInputBook["{$oneBook}"] = 1;
@@ -123,8 +122,8 @@ function render_book_list($strWordlist, $booklist = null)
 {
     //查找这些词出现在哪些书中
     $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-    $dictFileName = _FILE_DB_BOOK_WORD_;
-    PDO_Connect("$dictFileName");
+
+    PDO_Connect(_FILE_DB_BOOK_WORD_);
     if (isset($booklist)) {
         foreach ($booklist as $oneBook) {
             $aInputBook["{$oneBook}"] = 1;

+ 1 - 2
app/search/word_list.php

@@ -73,8 +73,7 @@ $resulte["wordlist"] = $wordlist;
 
 //查找这些词出现在哪些书中
 $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-$dictFileName = _FILE_DB_BOOK_WORD_;
-PDO_Connect("$dictFileName");
+PDO_Connect(_FILE_DB_BOOK_WORD_);
 if (isset($booklist)) {
     foreach ($booklist as $oneBook) {
         $aInputBook["{$oneBook}"] = 1;

+ 1 - 2
app/search/word_statistics.php

@@ -79,8 +79,7 @@ foreach ($aShowWordList as $x => $x_value) {
 
 //查找这些词出现在哪些书中
 $arrBookType = json_decode(file_get_contents("../public/book_name/booktype.json"));
-$dictFileName = _FILE_DB_BOOK_WORD_;
-PDO_Connect("$dictFileName");
+PDO_Connect(_FILE_DB_BOOK_WORD_);
 if (isset($booklist)) {
     foreach ($booklist as $oneBook) {
         $aInputBook["{$oneBook}"] = 1;

+ 3 - 4
app/studio/dict_find3.php

@@ -170,8 +170,7 @@ function mySplit2($strWord)
 
 switch ($op) {
     case "pre": //预查询
-        $dictFileName = _FILE_DB_REF_INDEX_;
-        PDO_Connect("$dictFileName");
+        PDO_Connect(_FILE_DB_REF_INDEX_);
         echo "<wordlist>";
         $query = "select word,count from dict where \"eword\" like " . $PDO->quote($word . '%') . " OR \"word\" like " . $PDO->quote($word . '%') . "  limit 0,100";
         $Fetch = PDO_FetchAll($query);
@@ -189,8 +188,8 @@ switch ($op) {
         echo "</wordlist>";
         break;
     case "search":
-        $dictFileName = _FILE_DB_REF_;
-        PDO_Connect("$dictFileName");
+
+        PDO_Connect(_FILE_DB_REF_);
 
         //直接查询
         $query = "select dict.dict_id,dict.mean,info.shortname from dict LEFT JOIN info ON dict.dict_id = info.id where \"word\" = " . $PDO->quote($word) . " limit 0,30";

+ 1 - 2
app/studio/dict_updata_wbw.php

@@ -10,8 +10,7 @@ $serverMsg = "";
 
 $xml = simplexml_load_string($input);
 
-$db_file = _FILE_DB_WBW_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_WBW_);
 PDO_Execute("PRAGMA synchronous = OFF");
 PDO_Execute("PRAGMA journal_mode = WAL");
 PDO_Execute("PRAGMA foreign_keys = ON");

+ 1 - 1
app/studio/dom_http.php

@@ -18,7 +18,7 @@ if (isset($_POST["xmldata"])) {
     return;
 }
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect( _FILE_DB_FILEINDEX_);
 $query = "select file_name from fileindex where user_id='{$_COOKIE["uid"]}' AND  id='{$fileid}'";
 $Fetch = PDO_FetchOne($query);
 $purefilename = $Fetch;

+ 1 - 1
app/studio/file_index.php

@@ -29,7 +29,7 @@ if ($_COOKIE["uid"]) {
     exit;
 }
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect( _FILE_DB_FILEINDEX_);
 
 switch ($op) {
     case "list":

+ 1 - 1
app/studio/file_index_refresh.php

@@ -5,7 +5,7 @@ include "./_pdo.php";
 //获取服务器端文件列表
 $dir = _DIR_USER_DOC_ . '/' . $_COOKIE["userid"] . '/' . _DIR_MYDOCUMENT_ . "/";
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect( _FILE_DB_FILEINDEX_);
 
 $files = scandir($dir);
 $arrlength = count($files);

+ 3 - 6
app/studio/get_res_json.php

@@ -39,8 +39,7 @@ function format_file_size($size)
     return ($str_size);
 }
 
-$db_file = _FILE_DB_RESRES_INDEX_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 
 $res = array();
 //查书
@@ -72,8 +71,7 @@ if ($paragraph == -1) {
     //相关专辑结束
 } else {
     //查书中的一个段
-    $db_file = _FILE_DB_RESRES_INDEX_;
-    PDO_Connect("$db_file");
+    PDO_Connect(_FILE_DB_RESRES_INDEX_);
     $query = "select * from 'index' where book='{$book}' and paragraph='{$paragraph}' and type < '5' ";
     $Fetch = PDO_FetchAll($query);
     $iFetch = count($Fetch);
@@ -108,8 +106,7 @@ if ($paragraph == -1) {
         }
     }
     //查共享文档
-    $db_file = _FILE_DB_FILEINDEX_;
-    PDO_Connect("$db_file");
+    PDO_Connect(_FILE_DB_FILEINDEX_);
     $query = "select * from fileindex where book='$book' and paragraph=$paragraph  and status>0 and share>0 order by create_time";
     $Fetch = PDO_FetchAll($query);
     $iFetch = count($Fetch);

+ 1 - 1
app/studio/getfilelist.php

@@ -38,7 +38,7 @@ if ($_COOKIE["uid"]) {
     exit;
 }
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect( _FILE_DB_FILEINDEX_);
 
 switch ($order_by) {
     case "accese_time":

+ 2 - 2
app/studio/message.php

@@ -47,8 +47,8 @@ if (isset($_COOKIE["username"]) && !empty($_COOKIE["username"])) {
     echo "not login";
     exit;
 }
-$db_file = _FILE_DB_MESSAGE_; //消息轉入user文件夾,方便升級
-PDO_Connect("$db_file");
+//消息轉入user文件夾,方便升級
+PDO_Connect(_FILE_DB_MESSAGE_);
 
 if ($op == "send") {
     // 开始一个事务,关闭自动提交

+ 1 - 2
app/studio/pc_db_analysis.php

@@ -8,7 +8,6 @@ $boolList = str_getcsv($get_book, ','); /*生成書名數組*/
 $countInsert = 0;
 $wordlist = array();
 
-$db_file = _FILE_DB_RESRES_INDEX_;
 $bookstring = "";
 for ($i = 0; $i < count($boolList); $i++) {
     $bookstring .= "'" . $boolList[$i] . "'";
@@ -18,7 +17,7 @@ for ($i = 0; $i < count($boolList); $i++) {
 }
 
 //open database
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_RESRES_INDEX_);
 $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (" . $bookstring . ") and author='PCDS') group by book,par_num ) T"; /*查總數,并分類匯總*/
 $allpar = PDO_FetchOne($query);
 $query = "select count(*) from (SELECT count() FROM \"toc\" WHERE (book in (" . $bookstring . ") and author<>'PCDS') group by book,par_num ) T"; /*查有譯文的段落,并分類匯總——已完成*/

+ 1 - 1
app/studio/pc_get_book_index.php

@@ -11,7 +11,7 @@ if (substr($currBook, 0, 1) == "p") {
 echo "<index>";
 
 //open database
-PDO_Connect("" . _FILE_DB_PALITEXT_);
+PDO_Connect(_FILE_DB_PALITEXT_);
 $query = "select * FROM pali_text where \"book\"=" . $PDO->quote($currBook);
 
 $Fetch = PDO_FetchAll($query);

+ 1 - 1
app/studio/pc_get_pali_text.php

@@ -13,7 +13,7 @@ if (substr($get_book, 0, 1) == "p") {
 echo "book:$get_book<br />";
 
 //open database
-PDO_Connect("" . _FILE_DB_PALITEXT_);
+PDO_Connect(_FILE_DB_PALITEXT_);
 
 $query = "SELECT paragraph,html FROM pali_text WHERE book = ?";
 $Fetch = PDO_FetchAll($query, array($get_book));

+ 1 - 1
app/studio/pc_get_word_num.php

@@ -10,7 +10,7 @@ $get_par_end = $_GET["end"];
 $db_file = _DIR_PALICANON_TEMPLET_ . "/p" . $get_book . "_tpl.db3";
 
 //open database
-PDO_Connect("$db_file");
+PDO_Connect("sqlite:{$db_file}");
 if ($get_par_end == -1 || ($get_par_end - $get_par_begin) > 500) {
     echo "0,0,0,0";
     exit;

+ 16 - 22
app/studio/project.php

@@ -56,7 +56,7 @@ switch ($op) {
         $paraList = rtrim($paraList, ",");
         $strQueryParaList = str_replace(",", "','", $paraList);
         $strQueryParaList = "('" . $strQueryParaList . "')";
-        PDO_Connect("" . _FILE_DB_PALITEXT_);
+        PDO_Connect(_FILE_DB_PALITEXT_);
         $query = "SELECT sum(lenght) as sum_str FROM pali_text WHERE \"book\" = " . $PDO->quote($res_book) . " AND (\"paragraph\" in {$strQueryParaList} ) ";
         $Fetch = PDO_FetchAll($query);
         if (count($Fetch) > 0) {
@@ -110,8 +110,7 @@ switch ($op) {
                 $language = $res[$iRes]->language;
                 $author = $res[$iRes]->author;
 
-                $db_file = _FILE_DB_RESRES_INDEX_;
-                PDO_Connect("$db_file");
+                PDO_Connect(_FILE_DB_RESRES_INDEX_);
                 $query = "select guid,owner from 'album' where id='{$res_album_id}'";
                 $Fetch = PDO_FetchAll($query);
                 if (count($Fetch) > 0) {
@@ -202,7 +201,7 @@ switch ($op) {
                             //写入数据库
                             // 开始一个事务,关闭自动提交
 
-                            PDO_Connect("" . _FILE_DB_USER_WBW_);
+                            PDO_Connect(_FILE_DB_USER_WBW_);
                             $PDO->beginTransaction();
                             $query = "INSERT INTO wbw_block ('id','parent_id','channal','owner','book','paragraph','style','lang','status','modify_time','receive_time') VALUES (?,?,?,?,?,?,?,?,?,?,?)";
                             $stmt = $PDO->prepare($query);
@@ -238,8 +237,7 @@ switch ($op) {
                             }
 
                             //服务器端文件列表
-                            $db_file = _FILE_DB_FILEINDEX_;
-                            PDO_Connect("$db_file");
+                            PDO_Connect(_FILE_DB_FILEINDEX_);
                             $query = "INSERT INTO fileindex ('id',
 												'parent_id',
 												'channal',
@@ -340,7 +338,7 @@ switch ($op) {
                 echo "<fieldset>";
                 echo "<legend>{$_local->gui->channel} ({$_local->gui->required})</legend>";
                 echo "<div>";
-                PDO_Connect("" . _FILE_DB_CHANNAL_);
+                PDO_Connect(_FILE_DB_CHANNAL_);
                 $query = "select * from channal where owner = '{$_COOKIE["userid"]}'   limit 0,100";
                 $Fetch = PDO_FetchAll($query);
                 $i = 0;
@@ -357,7 +355,7 @@ switch ($op) {
                     echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["name"] . '</div>';
                     echo '<div class="title" style="flex:3;padding-bottom:5px;">' . $row["lang"] . '</div>';
                     echo '<div class="title" style="flex:2;padding-bottom:5px;">';
-                    PDO_Connect("" . _FILE_DB_USER_WBW_);
+                    PDO_Connect( _FILE_DB_USER_WBW_);
                     $query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
                     $FetchWBW = PDO_FetchOne($query);
                     echo '</div>';
@@ -372,7 +370,7 @@ switch ($op) {
                     echo '</div>';
 
                     echo '<div class="title" style="flex:2;padding-bottom:5px;">';
-                    PDO_Connect("" . _FILE_DB_SENTENCE_);
+                    PDO_Connect( _FILE_DB_SENTENCE_);
                     $query = "select count(*) from sentence where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
                     $FetchWBW = PDO_FetchOne($query);
                     echo '</div>';
@@ -454,8 +452,7 @@ switch ($op) {
                 $language = $res[$iRes]->language;
                 $author = $res[$iRes]->author;
 
-                $db_file = _FILE_DB_RESRES_INDEX_;
-                PDO_Connect("$db_file");
+                PDO_Connect(_FILE_DB_RESRES_INDEX_);
                 $query = "select guid,owner from 'album' where id='{$res_album_id}'";
                 $Fetch = PDO_FetchAll($query);
                 if (count($Fetch) > 0) {
@@ -469,7 +466,7 @@ switch ($op) {
                 switch ($get_res_type) {
                     case "1": //pali text
                         {
-                            PDO_Connect("" . _FILE_DB_PALITEXT_);
+                            PDO_Connect(_FILE_DB_PALITEXT_);
                             $query = "SELECT * FROM pali_text WHERE \"book\" = " . $PDO->quote($res_book) . " AND (\"paragraph\" in {$strQueryParaList} ) ";
 
                             $sth = $PDO->prepare($query);
@@ -593,6 +590,7 @@ switch ($op) {
                         }
                     case "3": //translate
                         {
+							#已经废弃
                             //打开翻译数据文件
                             $db_file = _DIR_PALICANON_TRAN_ . "/p{$book}_translate.db3";
                             PDO_Connect("$db_file");
@@ -666,7 +664,7 @@ switch ($op) {
                             $album_type = $get_res_type;
                             //获取段落层级和标题
                             $para_title = array();
-                            PDO_Connect("" . _FILE_DB_PALITEXT_);
+                            PDO_Connect(_FILE_DB_PALITEXT_);
                             $query = "SELECT * FROM pali_text WHERE \"book\" = " . $PDO->quote($res_book) . " AND (\"paragraph\" in {$strQueryParaList} ) AND level>0 AND level<9";
                             $sth = $PDO->prepare($query);
                             $sth->execute();
@@ -677,7 +675,7 @@ switch ($op) {
                             }
 
                             $db_file = _DIR_PALICANON_TEMPLET_ . "/p" . $res_book . "_tpl.db3";
-                            PDO_Connect("$db_file");
+                            PDO_Connect("sqlite:{$db_file}");
                             foreach ($aParaList as $iPar) {
                                 $query = "SELECT * FROM 'main' WHERE (\"paragraph\" = " . $PDO->quote($iPar) . " ) ";
 
@@ -779,8 +777,7 @@ switch ($op) {
             echo "<p>save ok</p>";
             $filesize = filesize($sFullFileName);
             //服务器端文件列表
-            $db_file = _FILE_DB_FILEINDEX_;
-            PDO_Connect("$db_file");
+            PDO_Connect(_FILE_DB_FILEINDEX_);
 
             $query = "INSERT INTO fileindex ('id',
 												'parent_id',
@@ -848,8 +845,7 @@ switch ($op) {
                 echo "<h3><a href='../ucenter/index.php?op=login'>{$_local->gui->login}</a>后才可以打开文档</h3>";
                 exit;
             }
-            $db_file = _FILE_DB_FILEINDEX_;
-            PDO_Connect("$db_file");
+            PDO_Connect(_FILE_DB_FILEINDEX_);
             if (isset($_GET["doc_id"])) {
                 $doc_id = $_GET["doc_id"];
                 $query = "select * from fileindex where id='$doc_id' ";
@@ -926,8 +922,7 @@ exit;
                             if ($open_in == "editor") {
                                 //获取文件路径
                                 echo "共享的文档,复制并打开...";
-                                $db_file = _FILE_DB_USERINFO_;
-                                PDO_Connect("$db_file");
+                                PDO_Connect(_FILE_DB_USERINFO_);
                                 $query = "select userid from user where id='$owner'";
                                 $FetchUid = PDO_FetchOne($query);
                                 if ($FetchUid) {
@@ -942,8 +937,7 @@ exit;
                                     //插入记录到文件索引
                                     $filesize = filesize($dest);
                                     //服务器端文件列表
-                                    $db_file = _FILE_DB_FILEINDEX_;
-                                    PDO_Connect("$db_file");
+                                    PDO_Connect(_FILE_DB_FILEINDEX_);
 
                                     //$query="INSERT INTO fileindex ('id','userid','parent_id','doc_id','book','paragraph','file_name','title','tag','create_time','modify_time','accese_time','file_size')
                                     //                VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?)";

+ 1 - 1
app/studio/project_load.php

@@ -3,7 +3,7 @@ require_once 'checklogin.inc';
 require_once "../path.php";
 require_once "../public/_pdo.php";
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect(_FILE_DB_FILEINDEX_);
 $query = "select file_name from fileindex where user_id='{$_COOKIE["uid"]}' AND  id='{$_GET["id"]}'";
 $Fetch = PDO_FetchOne($query);
 $FileName = _DIR_USER_DOC_ . "/" . $userid . _DIR_MYDOCUMENT_ . "/" . $Fetch;

+ 1 - 1
app/studio/project_load_article.php

@@ -8,7 +8,7 @@ require_once "../public/function.php";
 
 $id = $_GET["id"];
 
-PDO_Connect("" . _FILE_DB_USER_ARTICLE_);
+PDO_Connect( _FILE_DB_USER_ARTICLE_);
 $query = "select * from article where id=" . $PDO->quote($id);
 $Fetch = PDO_FetchAll($query);
 if (count($Fetch) > 0) {

+ 1 - 1
app/studio/project_load_db.php

@@ -8,7 +8,7 @@ require_once "../public/function.php";
 
 $id = $_GET["id"];
 
-PDO_Connect("" . _FILE_DB_FILEINDEX_);
+PDO_Connect( _FILE_DB_FILEINDEX_);
 $query = "select * from fileindex where id=" . $PDO->quote($id);
 $Fetch = PDO_FetchAll($query);
 if (count($Fetch) > 0) {

+ 2 - 2
app/studio/sent/sent.php

@@ -62,8 +62,8 @@ if (isset($_POST["block_id"])) {
 }
 
 global $PDO;
-$db_file = _FILE_DB_SENTENCE_;
-PDO_Connect("$db_file");
+
+PDO_Connect(_FILE_DB_SENTENCE_);
 
 switch ($op) {
     case "save":

+ 1 - 0
app/studio/setting.php

@@ -1,4 +1,5 @@
 <?php
+#已经废弃
 require_once "../path.php";
 require_once 'checklogin.inc';
 require_once "../public/load_lang.php";

+ 1 - 0
app/studio/updatadict.php

@@ -1,6 +1,7 @@
 <html>
 <body>
 <?php
+#已经废弃
 function inputWordIsEmpty($inWord)
 {
 

+ 1 - 1
app/term/channal_list.php

@@ -31,7 +31,7 @@ $channal = array();
 #查询有阅读权限的channel
 $channal_list = array();
 if (isset($_COOKIE["userid"])) {
-    PDO_Connect("" . _FILE_DB_CHANNAL_);
+    PDO_Connect(_FILE_DB_CHANNAL_);
     $query = "SELECT id from channal where owner = ?   limit 0,100";
     $Fetch_my = PDO_FetchAll($query, array($_COOKIE["userid"]));
     foreach ($Fetch_my as $key => $value) {

+ 1 - 1
app/term/get_term_index.php

@@ -10,7 +10,7 @@ require_once "../public/_pdo.php";
 $output["status"] = 0;
 $output["error"] = "";
 
-PDO_Connect("" . _FILE_DB_TERM_);
+PDO_Connect(_FILE_DB_TERM_);
 
 if (isset($_POST["lang"])) {
     $lang = $_POST["lang"];

+ 1 - 2
app/term/my_dict_list.php

@@ -74,8 +74,7 @@ if (isset($_GET["page"])) {
 }
 $iOnePage = 300;
 
-$dictFileName = _FILE_DB_TERM_;
-PDO_Connect("$dictFileName");
+PDO_Connect(_FILE_DB_TERM_);
 
 $query = "select count(*) as co  from term where owner= ? ";
 

+ 1 - 1
app/term/new.php

@@ -7,7 +7,7 @@ require_once '../public/load_lang.php';
 require_once '../public/function.php';
 
 global $PDO;
-PDO_Connect("" . _FILE_DB_TERM_);
+PDO_Connect(_FILE_DB_TERM_);
 
 $query = "select word,meaning , owner from term where 1  order by create_time DESC limit 0,4";
 $Fetch = PDO_FetchAll($query);

+ 18 - 0
app/term/note.js

@@ -987,6 +987,24 @@ function set_pali_script(pos, script) {
 		$("pl" + pos).html(function (index, oldcontent) {
 			return roman_to_my(oldcontent);
 		});
+		/*
+		$("pali")
+			.contents()
+			.filter(function () {
+				return this.nodeType != 1;
+			})
+			.wrap("<pl></pl>");
+			
+		$("pl").each(function () {
+			let html = $(this).html();
+			$(this).html("<w>" + html.replace(/\s/g, "</w> <w>") + "</w>");
+		});
+		
+		$("w").click(function () {
+			let word = $(this).text();
+			window.open("../dict/index.php?buildin=true&key=" + word, "dict");
+		});
+		*/
 	}
 }
 

+ 1 - 1
app/term/note.php

@@ -52,7 +52,7 @@ $output = array();
 #查询有阅读权限的channel
 $channal_list = array();
 if (isset($_COOKIE["userid"])) {
-    PDO_Connect("" . _FILE_DB_CHANNAL_);
+    PDO_Connect( _FILE_DB_CHANNAL_);
     $query = "SELECT id from channal where owner = ?   limit 0,100";
     $Fetch_my = PDO_FetchAll($query, array($_COOKIE["userid"]));
     foreach ($Fetch_my as $key => $value) {

+ 2 - 3
app/term/related_para.php

@@ -24,7 +24,7 @@ if (isset($_GET["para"])) {
     exit;
 }
 
-PDO_Connect("" . _FILE_DB_PAGE_INDEX_);
+PDO_Connect(_FILE_DB_PAGE_INDEX_);
 $query = "SELECT bookid,cspara ,book_name FROM cs6_para where book = ? and para= ? ";
 $fetch = PDO_FetchAll($query, array($book, $para));
 if (count($fetch) > 0) {
@@ -45,8 +45,7 @@ if (count($fetch) > 0) {
 
     //获取书名 列表
     $book_list = array();
-    $db_file = _FILE_DB_PALITEXT_;
-    PDO_Connect("$db_file");
+    PDO_Connect(_FILE_DB_PALITEXT_);
 
     foreach ($aBookid as $bookkey => $bookvalue) {
         # code...

+ 1 - 2
app/tools/pc_word_analysis.php

@@ -79,7 +79,6 @@ echo "</br>";
 $countInsert = 0;
 $wordlist = array();
 
-$db_file = _FILE_DB_STATISTICS_;
 $bookstring = "";
 for ($i = 0; $i < count($boolList); $i++) {
     $bookstring .= "'" . $boolList[$i] . "'";
@@ -89,7 +88,7 @@ for ($i = 0; $i < count($boolList); $i++) {
 }
 
 //open database
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_STATISTICS_);
 if ($col == "parent") {
     $query = "SELECT count(*) FROM \"word\" WHERE (bookid in (" . $bookstring . ")) "; /*查總數,并分類匯總*/
     $count_word = PDO_FetchOne($query);

+ 1 - 2
app/udict/my_dict_list.php

@@ -74,8 +74,7 @@ if (isset($_GET["page"])) {
 }
 $iOnePage = 300;
 
-$db_file = _FILE_DB_WBW_;
-PDO_Connect("$db_file");
+PDO_Connect(_FILE_DB_WBW_);
 $query = "select count(word_index) as co  from user_index where user_id={$UID}";
 $allWord = PDO_FetchOne($query);
 $iCountWords = $allWord;