Jelajahi Sumber

Merge pull request #123 from visuddhinanda/master

百科语言过滤
visuddhinanda 5 tahun lalu
induk
melakukan
51cbc4914a
2 mengubah file dengan 30 tambahan dan 50 penghapusan
  1. 13 0
      app/term/note.js
  2. 17 50
      app/term/term.php

+ 13 - 0
app/term/note.js

@@ -89,6 +89,19 @@ function note_refresh_new() {
               let strHtml = note_json_html(iterator);
               let strHtml = note_json_html(iterator);
               $("#" + id).html(strHtml);
               $("#" + id).html(strHtml);
             }
             }
+            $(".palitext").click(function () {
+              let sentid = $(this).parent().attr("info").split("-");
+              window.open(
+                "../pcdl/reader.php?view=sent&book=" +
+                  sentid[0] +
+                  "&para=" +
+                  sentid[1] +
+                  "&begin=" +
+                  sentid[2] +
+                  "&end=" +
+                  sentid[3]
+              );
+            });
             note_ref_init();
             note_ref_init();
             term_get_dict();
             term_get_dict();
             note_channal_list();
             note_channal_list();

+ 17 - 50
app/term/term.php

@@ -3,7 +3,7 @@
 
 
 require_once "../path.php";
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once "../public/_pdo.php";
-require_once '../public/load_lang.php';
+//require_once '../public/load_lang.php';
 require_once '../public/function.php';
 require_once '../public/function.php';
 
 
 //is login
 //is login
@@ -13,6 +13,17 @@ if(isset($_COOKIE["username"])){
 else{
 else{
 	$username = "";
 	$username = "";
 }
 }
+if(isset($_GET["language"])){
+	$currLanguage=$_GET["language"];
+}
+else{
+	if(isset($_COOKIE["language"])){
+		$currLanguage=$_COOKIE["language"];
+	}
+	else{
+		$currLanguage="en";
+	}
+}
 
 
 if(isset($_GET["op"])){
 if(isset($_GET["op"])){
 	$op=$_GET["op"];
 	$op=$_GET["op"];
@@ -230,51 +241,6 @@ switch($op){
 			}
 			}
 		}
 		}
 
 
-	
-		//查内容
-		/*
-		if($count_return<2){
-			$word1=$org_word;
-			$wordInMean="%$org_word%";
-			echo $module_gui_str['editor']['1124'].":$org_word<br />";
-			$query = "select * from term  where \"meaning\" like ".$PDO->quote($word)." limit 0,30";
-			$Fetch = PDO_FetchAll($query);
-			$iFetch=count($Fetch);
-			$count_return+=$iFetch;
-			if($iFetch>0){
-				for($i=0;$i<$iFetch;$i++){
-					$mean=$Fetch[$i]["meaning"];
-					$pos=mb_stripos($mean,$word,0,"UTF-8");
-					if($pos){
-						if($pos>20){
-							$start=$pos-20;
-						}
-						else{
-							$start=0;
-						}
-						$newmean=mb_substr($mean,$start,100,"UTF-8");
-					}
-					else{
-						$newmean=$mean;
-					}
-					$pos=mb_stripos($newmean,$word1,0,"UTF-8");
-					$head=mb_substr($newmean,0,$pos,"UTF-8");
-					$mid=mb_substr($newmean,$pos,mb_strlen($word1,"UTF-8"),"UTF-8");
-					$end=mb_substr($newmean,$pos+mb_strlen($word1,"UTF-8"),NULL,"UTF-8");
-					$heigh_light_mean="$head<hl>$mid</hl>$end";
-					$outXml = "<div class='dict_word'>";
-					$outXml = $outXml."<div class='dict'>".$Fetch[$i]["owner"]."</div>";					
-					$outXml = $outXml."<div class='pali'>".$Fetch[$i]["word"]."</div>";
-					$outXml = $outXml."<div class='mean'>".$heigh_light_mean."</div>";
-					$outXml = $outXml."<div class='note'>{$Fetch[$i]["note"]}</div>";
-					$outXml = $outXml."</div>";
-					echo $outXml;
-				}
-			}		
-		}
-		*/
-		//查内容结束
-
 		echo "<div id='dictlist'>";
 		echo "<div id='dictlist'>";
 		echo "</div>";
 		echo "</div>";
 		
 		
@@ -377,9 +343,10 @@ switch($op){
 		}
 		}
 		if(isset($_POST["authors"])){
 		if(isset($_POST["authors"])){
 			$authors=str_getcsv($_POST["authors"]);
 			$authors=str_getcsv($_POST["authors"]);
-		}		
-		$query = "select * from term  where \"word\" in {$words}  limit 0,1000";
-		$Fetch = PDO_FetchAll($query);
+		}
+		$queryLang = $currLanguage."%";
+		$query = "SELECT * from term  where \"word\" in {$words} AND language like ?  limit 0,1000";
+		$Fetch = PDO_FetchAll($query,array($queryLang));
 		$iFetch=count($Fetch);
 		$iFetch=count($Fetch);
 		echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
 		echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
 		break;
 		break;
@@ -387,7 +354,7 @@ switch($op){
 	case "sync":
 	case "sync":
 	{
 	{
 		$time=$_GET["time"];
 		$time=$_GET["time"];
-		$query = "select guid,modify_time from term  where receive_time>'{$time}' limit 0,1000";
+		$query = "SELECT guid,modify_time from term  where receive_time>'{$time}'   limit 0,1000";
 		$Fetch = PDO_FetchAll($query);
 		$Fetch = PDO_FetchAll($query);
 		$iFetch=count($Fetch);
 		$iFetch=count($Fetch);
 		echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
 		echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);