Procházet zdrojové kódy

:bug: _TABLE_RES_INDEX_表名加引号

visuddhinanda před 4 roky
rodič
revize
88d896f5c1

+ 2 - 2
app/install/db_update_toc.php

@@ -115,13 +115,13 @@ $book = $from + 1;
 
 //删除已有标题
 PDO_Connect(_FILE_DB_RESRES_INDEX_);
-$query = "DELETE FROM "._TABLE_RES_INDEX_." WHERE book = ?  AND  language = ?  ";
+$query = "DELETE FROM \""._TABLE_RES_INDEX_."\" WHERE book = ?  AND  language = ?  ";
 PDO_Execute($query, array($book,$_lang));
 
 
 // 开始一个事务,关闭自动提交
 $PDO->beginTransaction();
-$query = "INSERT INTO "._TABLE_RES_INDEX_." (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+$query = "INSERT INTO \""._TABLE_RES_INDEX_."\" (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
 $stmt = $PDO->prepare($query);
 if ($_lang == "pali") {
     $type = 1;

+ 2 - 2
app/install/db_update_toc_cli.php

@@ -88,13 +88,13 @@ for ($from=$_from-1; $from < $_to; $from++) {
     
     //删除已有标题
     
-    $query = "DELETE FROM "._TABLE_RES_INDEX_." WHERE book = ?  AND  language = ?  ";
+    $query = "DELETE FROM \""._TABLE_RES_INDEX_."\" WHERE book = ?  AND  language = ?  ";
     PDO_Execute($query, array($book,$_lang));
     
     
     // 开始一个事务,关闭自动提交
     $PDO->beginTransaction();
-    $query = "INSERT INTO "._TABLE_RES_INDEX_." (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+    $query = "INSERT INTO \""._TABLE_RES_INDEX_."\" (book , paragraph, title, title_en , level, type , language , author , share , create_time , update_time  ) VALUES (  ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
     $stmt = $PDO->prepare($query);
     if ($_lang == "pali") {
         $type = 1;

+ 1 - 1
app/palicanon/book_tag.php

@@ -72,7 +72,7 @@ foreach ($output as $key => $value) {
 
             #查标题
             if (isset($_GET["lang"])) {
-                $query = "SELECT title from "._TABLE_RES_INDEX_." where book=? and paragraph=? and language=?";
+                $query = "SELECT title from \""._TABLE_RES_INDEX_."\" where book=? and paragraph=? and language=?";
                 $stmt = $dbh_res->prepare($query);
                 $sth_title = $dbh_res->prepare($query);
                 $sth_title->execute(array($book, $para, $_GET["lang"]));

+ 1 - 1
app/palicanon/get_chapter_children.php

@@ -66,7 +66,7 @@ if ($paraInfo) {
 
             #查标题
             if (isset($_GET["lang"])) {
-                $query = "SELECT title from "._TABLE_RES_INDEX_." where book=? and paragraph=? and language=?";
+                $query = "SELECT title from \""._TABLE_RES_INDEX_."\" where book=? and paragraph=? and language=?";
                 $stmt = $dbh_res->prepare($query);
                 $sth_title = $dbh_res->prepare($query);
                 $sth_title->execute(array($value["book"], $value["para"], $_GET["lang"]));

+ 1 - 1
app/palicanon/get_chapter_info.php

@@ -55,7 +55,7 @@ if ($paraInfo) {
 
     #查标题
     if (isset($_GET["lang"])) {
-        $query = "SELECT title from "._TABLE_RES_INDEX_." where book=? and paragraph=? and language=?";
+        $query = "SELECT title from \""._TABLE_RES_INDEX_."\" where book=? and paragraph=? and language=?";
         $stmt = $dbh_res->prepare($query);
         $sth_title = $dbh_res->prepare($query);
         $sth_title->execute(array($book, $para, $_GET["lang"]));

+ 2 - 2
app/pcdl/get_res_index.php

@@ -149,7 +149,7 @@ if ($album == -1) {
         echo "</div>";
 
         PDO_Connect(_FILE_DB_RESRES_INDEX_);
-        $query = "SELECT resindex.id,resindex.title,resindex.type,resindex.album,author.name from "._TABLE_RES_INDEX_." as resindex LEFT JOIN author ON resindex.author = author.id where resindex.book='$book' and resindex.paragraph=$paragraph and resindex.type<>7 group by resindex.album";
+        $query = "SELECT resindex.id,resindex.title,resindex.type,resindex.album,author.name from \""._TABLE_RES_INDEX_."\" as resindex LEFT JOIN author ON resindex.author = author.id where resindex.book='$book' and resindex.paragraph=$paragraph and resindex.type<>7 group by resindex.album";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
         if ($iFetch > 0) {
@@ -188,7 +188,7 @@ if ($album == -1) {
 
         //目录
         PDO_Connect(_FILE_DB_PALITEXT_);
-        $query = "SELECT * from "._TABLE_RES_INDEX_." where book = ? and level>'0' and level<8 and paragraph >= ? ";
+        $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where book = ? and level>'0' and level<8 and paragraph >= ? ";
         $Fetch_Toc = PDO_FetchAll($query,array($book,$paragraph));
         $iFetchToc = count($Fetch_Toc);
         if ($iFetchToc > 1) {

+ 6 - 6
app/pcdl/search.php

@@ -35,9 +35,9 @@ switch ($op) {
         }
 
         //查标题
-        $query = "select count(*) from "._TABLE_RES_INDEX_."  where  title_en like '%$word%' or title like '%$word%'";
+        $query = "select count(*) from \""._TABLE_RES_INDEX_."\"  where  title_en like '%$word%' or title like '%$word%'";
         $count = PDO_FetchOne($query);
-        $query = "select * from "._TABLE_RES_INDEX_."  where  title_en like '%$word%' or title like '%$word%' limit 0,20";
+        $query = "select * from \""._TABLE_RES_INDEX_."\"  where  title_en like '%$word%' or title like '%$word%' limit 0,20";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
         if ($iFetch > 0) {
@@ -94,10 +94,10 @@ switch ($op) {
         }
         PDO_Connect(_FILE_DB_RESRES_INDEX_);
         //查标签
-        $query = "SELECT count(*) from "._TABLE_RES_INDEX_." where tag like '%$word%'";
+        $query = "SELECT count(*) from \""._TABLE_RES_INDEX_."\" where tag like '%$word%'";
         $count = PDO_FetchOne($query);
 
-        $query = "SELECT * from "._TABLE_RES_INDEX_." where tag like '%$word%' limit 10";
+        $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where tag like '%$word%' limit 10";
         $Fetch = PDO_FetchAll($query);
         $iFetch = count($Fetch);
         if ($iFetch > 0) {
@@ -139,10 +139,10 @@ switch ($op) {
         }
 
         //查资源
-        $query = "SELECT count(*) from "._TABLE_RES_INDEX_." where author = '$author_id'";
+        $query = "SELECT count(*) from \""._TABLE_RES_INDEX_."\" where author = '$author_id'";
         $count = PDO_FetchOne($query);
         if ($count > 0) {
-            $query = "SELECT * from "._TABLE_RES_INDEX_." where author = '$author_id' limit 0,10";
+            $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where author = '$author_id' limit 0,10";
 
             $Fetch = PDO_FetchAll($query);
             $iFetch = count($Fetch);

+ 1 - 1
app/pcdl/tag_search.php

@@ -16,7 +16,7 @@ if (isset($_POST["order"])) {
 
 PDO_Connect(_FILE_DB_RESRES_INDEX_);
 $tag_string = '{' . $tag . '}';
-$query = "SELECT * from "._TABLE_RES_INDEX_." where tag like '%$tag_string%' ";
+$query = "SELECT * from \""._TABLE_RES_INDEX_."\" where tag like '%$tag_string%' ";
 $Fetch = PDO_FetchAll($query);
 $iFetch = count($Fetch);
 if ($iFetch > 0) {

+ 6 - 6
app/pcdl/update_index.php

@@ -211,12 +211,12 @@ switch ($res_type) {
                 //开始更新索引
                 foreach ($title_data as $oneTitle) {
                     if ($oneTitle["level"] > 0 && $oneTitle["level"] < 8) {
-                        $query = "SELECT * FROM "._TABLE_RES_INDEX_." where album = '$album_index' and book='" . $oneTitle["book"] . "' and paragraph='" . $oneTitle["paragraph"] . "'";
+                        $query = "SELECT * FROM \""._TABLE_RES_INDEX_."\" where album = '$album_index' and book='" . $oneTitle["book"] . "' and paragraph='" . $oneTitle["paragraph"] . "'";
                         $search_title = PDO_FetchAll($query);
                         $title_en = pali2english($oneTitle["text"]);
                         //找到已有的记录  更新
                         if (count($search_title) != 0) {
-                            $query = "UPDATE "._TABLE_RES_INDEX_." SET title = '" . $oneTitle["text"] . "' ,
+                            $query = "UPDATE \""._TABLE_RES_INDEX_."\" SET title = '" . $oneTitle["text"] . "' ,
 												 title_en = '" . $title_en . "' ,
 												 language = '1' ,
 												 type = '$type',
@@ -237,7 +237,7 @@ switch ($res_type) {
                             if (substr($book, 0, 1) == "b") {
                                 $book = substr($book, 1);
                             }
-                            $query = "INSERT INTO "._TABLE_RES_INDEX_." (id,
+                            $query = "INSERT INTO \""._TABLE_RES_INDEX_."\" (id,
 						book,
 						paragraph,
 						title,
@@ -340,7 +340,7 @@ switch ($res_type) {
         $query = "select * from album where 1";
         $search_album = PDO_FetchAll($query);
         foreach ($search_album as $oneAlbum) {
-            $query = "SELECT id FROM "._TABLE_RES_INDEX_." where album = '{$oneAlbum["id"]}' and
+            $query = "SELECT id FROM \""._TABLE_RES_INDEX_."\" where album = '{$oneAlbum["id"]}' and
 													   book='{$oneAlbum["book"]}' and
 													   paragraph='-1'";
             $id = PDO_FetchAll($query);
@@ -348,7 +348,7 @@ switch ($res_type) {
             //找到已有的记录  更新
             $title_en = pali2english($oneAlbum["title"]);
             if (count($id) > 0) {
-                $query = "UPDATE "._TABLE_RES_INDEX_." SET title = '{$oneAlbum["title"]}' ,
+                $query = "UPDATE \""._TABLE_RES_INDEX_."\" SET title = '{$oneAlbum["title"]}' ,
 										 title_en = '{$title_en}' ,
 										 language = '{$oneAlbum["language"]}' ,
 										 type = '{$oneAlbum["type"]}',
@@ -368,7 +368,7 @@ switch ($res_type) {
             } else {
                 /*未找到 插入*/
                 $book = $oneAlbum["book"];
-                $query = "INSERT INTO "._TABLE_RES_INDEX_." (id,
+                $query = "INSERT INTO \""._TABLE_RES_INDEX_."\" (id,
 				book,
 				paragraph,
 				title,

+ 3 - 3
app/pcdl/update_translate.php

@@ -123,13 +123,13 @@ echo "<h2>$from</h2>";
             //开始更新索引
             for ($iPar = 0; $iPar < count($paragraph_list); $iPar++) {
                 $oneTitle = $paragraph_list[$iPar];
-                $query = "select * from "._TABLE_RES_INDEX_." where album = '$album_index' and book='" . $book . "' and paragraph='" . $paragraph_list[$iPar]["paragraph"] . "'";
+                $query = "select * from \""._TABLE_RES_INDEX_."\" where album = '$album_index' and book='" . $book . "' and paragraph='" . $paragraph_list[$iPar]["paragraph"] . "'";
                 $search_title = PDO_FetchAll($query);
                 $title_en = $oneTitle["text"];
 
                 //找到已有的记录  更新
                 if (count($search_title) != 0) {
-                    $query = "UPDATE "._TABLE_RES_INDEX_." SET title = '" . $oneTitle["text"] . "' ,
+                    $query = "UPDATE \""._TABLE_RES_INDEX_."\" SET title = '" . $oneTitle["text"] . "' ,
 					                         title_en = '" . $title_en . "' ,
 											 language = '1' ,
 											 type = '$type',
@@ -149,7 +149,7 @@ echo "<h2>$from</h2>";
                     if (substr($book, 0, 1) == "b") {
                         $book = substr($book, 1);
                     }
-                    $query = "INSERT INTO "._TABLE_RES_INDEX_." 
+                    $query = "INSERT INTO \""._TABLE_RES_INDEX_."\" 
 					(id,
 					book,
 					paragraph,

+ 4 - 4
app/search/title_search.php

@@ -34,7 +34,7 @@ function render_book_list($strWord, $booklist = null)
             $aInputBook["{$oneBook}"] = 1;
         }
     }
-    $query = "SELECT book,count(book) as co FROM "._TABLE_RES_INDEX_." where title_en like '%{$strWord}%' or title like '%{$strWord}%' group by book order by co DESC";
+    $query = "SELECT book,count(book) as co FROM \""._TABLE_RES_INDEX_."\" where title_en like '%{$strWord}%' or title like '%{$strWord}%' group by book order by co DESC";
     $Fetch = PDO_FetchAll($query);
     $iFetch = count($Fetch);
     $newBookList = array();
@@ -128,7 +128,7 @@ switch ($op) {
                 }
                 echo "</div>";
             }
-            $query = "SELECT title from "._TABLE_RES_INDEX_." where (title_en like " . $PDO->quote("%" . $searching . '%') . " OR title like " . $PDO->quote("%" . $searching . '%') . ") group by title limit 20";
+            $query = "SELECT title from \""._TABLE_RES_INDEX_."\" where (title_en like " . $PDO->quote("%" . $searching . '%') . " OR title like " . $PDO->quote("%" . $searching . '%') . ") group by title limit 20";
             $Fetch = PDO_FetchAll($query);
             $queryTime = (microtime_float() - $time_start) * 1000;
             $iFetch = count($Fetch);
@@ -181,9 +181,9 @@ switch ($op) {
 
             PDO_Connect( _FILE_DB_RESRES_INDEX_);
             if (isset($_GET["booklist"])) {
-                $query = "SELECT * from "._TABLE_RES_INDEX_." where (title_en like " . $PDO->quote("%" . $_GET["word"] . '%') . " OR title like " . $PDO->quote("%" . $_GET["word"] . '%') . ") and book in {$_GET["booklist"]} limit 50";
+                $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where (title_en like " . $PDO->quote("%" . $_GET["word"] . '%') . " OR title like " . $PDO->quote("%" . $_GET["word"] . '%') . ") and book in {$_GET["booklist"]} limit 50";
             } else {
-                $query = "SELECT * from "._TABLE_RES_INDEX_." where title_en like " . $PDO->quote("%" . $_GET["word"] . '%') . " OR title like " . $PDO->quote("%" . $_GET["word"] . '%') . " limit 50";
+                $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where title_en like " . $PDO->quote("%" . $_GET["word"] . '%') . " OR title like " . $PDO->quote("%" . $_GET["word"] . '%') . " limit 50";
             }
             $Fetch = PDO_FetchAll($query);
             $queryTime = (microtime_float() - $time_start) * 1000;

+ 1 - 1
app/studio/get_res_json.php

@@ -72,7 +72,7 @@ if ($paragraph == -1) {
 } else {
     //查书中的一个段
     PDO_Connect(_FILE_DB_RESRES_INDEX_);
-    $query = "SELECT * from "._TABLE_RES_INDEX_." where book='{$book}' and paragraph='{$paragraph}' and type < '5' ";
+    $query = "SELECT * from \""._TABLE_RES_INDEX_."\" where book='{$book}' and paragraph='{$paragraph}' and type < '5' ";
     $Fetch = PDO_FetchAll($query);
     $iFetch = count($Fetch);
     if ($iFetch > 0) {