"; $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); $iFetch=count($Fetch); if($iFetch>0){ for($i=0;$i<$iFetch;$i++){ $outXml = ""; $word=$Fetch[$i]["word"]; $outXml = $outXml."$word"; $outXml = $outXml."".$Fetch[$i]["count"].""; $outXml = $outXml.""; echo $outXml; } } echo ""; break; case "my": $query = "select guid,word,meaning,other_meaning from term where owner= ".$PDO->quote($username); $Fetch = PDO_FetchAll($query); $iFetch=count($Fetch); if($iFetch>0){ echo json_encode($Fetch, JSON_UNESCAPED_UNICODE); } break; case "allpali": $query = "select word from term where 1 group by word"; $Fetch = PDO_FetchAll($query); $iFetch=count($Fetch); if($iFetch>0){ echo json_encode($Fetch, JSON_UNESCAPED_UNICODE); } break; case "allmean": $query = "select meaning from term where \"word\" = ".$PDO->quote($word)." group by meaning"; $Fetch = PDO_FetchAll($query); foreach($Fetch as $one){ echo "".$one["meaning"]." "; } //echo json_encode($Fetch, JSON_UNESCAPED_UNICODE); break; case "load_id": if(isset($_GET["id"])){ $id=$_GET["id"]; $query = "select * from term where \"guid\" = ".$PDO->quote($id); $Fetch = PDO_FetchAll($query); echo json_encode($Fetch, JSON_UNESCAPED_UNICODE); } else{ echo "{}"; } break; case "search": //查本人数据 echo "
".$module_gui_str['editor']['1122']."
";//My Term $query = "select * from term where \"word\" = ".$PDO->quote($word)." AND \"owner\"= ".$PDO->quote($username)." 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"]; $guid=$Fetch[$i]["guid"]; $dict_list[$guid]=$Fetch[$i]["owner"]; echo "
"; echo ""; echo "
$word
"; echo "
"; echo "
".$mean."
"; echo "
".$Fetch[$i]["other_meaning"]."
"; echo "
".$Fetch[$i]["note"]."
"; echo "
"; //编辑词条表单 echo ""; echo "
"; echo "";//Apply echo "";//Edit echo "
"; echo ""; echo "
"; } } //新建词条 echo "
"; echo "
".$_local->gui->new_technic_term."
";//New Techinc Term echo "
"; echo "".$_local->gui->spell.":"; echo ""; echo "
";//'拼写' echo "
"; echo "".$_local->gui->g_mean.":"; echo ""; echo "
";//'意思' echo "
"; echo "".$_local->gui->other_meaning.":"; echo ""; echo "
";//'备选意思(可选项)' echo "
"; echo "".$_local->gui->tag.":"; echo ""; echo "
";//'标签' echo "
"; echo "".$_local->gui->note.":"; echo ""; echo "
";//'注解' echo "";//保存 echo "
"; //查他人数据 $query = "select * from term where \"word\" = ".$PDO->quote($word)."AND \"owner\" <> ".$PDO->quote($username)." 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"]; $guid=$Fetch[$i]["guid"]; $dict_list[$guid]=$Fetch[$i]["owner"]; echo "
"; echo ""; echo "
".$Fetch[$i]["owner"]."
"; echo "
".$mean."
"; echo "
".$Fetch[$i]["other_meaning"]."
"; echo "
".$Fetch[$i]["note"]."
"; echo "";//复制 echo "
"; } } //查内容 if($count_return<2){ $word1=$org_word; $wordInMean="%$org_word%"; echo $module_gui_str['editor']['1124'].":$org_word
"; $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$mid$end"; $outXml = "
"; $outXml = $outXml."
".$Fetch[$i]["owner"]."
"; $outXml = $outXml."
".$Fetch[$i]["word"]."
"; $outXml = $outXml."
".$heigh_light_mean."
"; $outXml = $outXml."
{$Fetch[$i]["note"]}
"; $outXml = $outXml."
"; echo $outXml; } } } //查内容结束 echo "
"; foreach($dict_list as $x=>$x_value) { echo "$x_value
"; } echo "
"; break; case "save": if($_GET["guid"]!=""){ $mean=$_GET["mean"]; $query="UPDATE term SET meaning='$mean' , other_meaning='".$_GET["mean2"]."' , note='".$_GET["note"]."' where guid='".$_GET["guid"]."'"; } else{ $newGuid=GUIDv4(); $newGuid=str_replace("-","",$newGuid); $word=$_GET["word"]; $worden=pali2english($word); $mean=$_GET["mean"]; $mean2=$_GET["mean2"]; $note=$_GET["note"]; $tag=$_GET["tag"]; $time=time(); $query="INSERT INTO term VALUES (NULL, '$newGuid', '$word', '$worden', '$mean', '$mean2', '$note', '$tag', '$time', '$username', '1', 'zh', '0', '0', '0')"; } $stmt = @PDO_Execute($query); $respond=array("status"=>0,"message"=>""); if (!$stmt || ($stmt && $stmt->errorCode() != 0)) { $error = PDO_ErrorInfo(); $respond['status']=1; $respond['message']=$error[2]; } else{ $respond['status']=0; $respond['message']=$word; } echo json_encode($respond, JSON_UNESCAPED_UNICODE); break; case "copy"://拷贝到我的字典 $query = "select * from term where \"guid\" = ".$PDO->quote($_GET["wordid"]); $Fetch = PDO_FetchAll($query); $iFetch=count($Fetch); if($iFetch>0){ /* 开始一个事务,关闭自动提交 */ $PDO->beginTransaction(); $query="INSERT INTO term ('id','guid','word','word_en','meaning','other_meaning','note','tag','create_time','owner','hit') VALUES (null,?,?,?,?,?,?,?,".time().",'$username',1)"; $stmt = $PDO->prepare($query); { $stmt->execute(array(GUIDv4(false), $Fetch[0]["word"], $Fetch[0]["word_en"], $Fetch[0]["meaning"], $Fetch[0]["other_meaning"], $Fetch[0]["note"], $Fetch[0]["tag"], )); } /* 提交更改 */ $PDO->commit(); if (!$stmt || ($stmt && $stmt->errorCode() != 0)) { $error = PDO_ErrorInfo(); echo "error - $error[2]
"; } else{ echo "updata ok."; } } break; case "extract": $query = "select * from term where \"guid\" in ($list) limit 0,1000"; $Fetch = PDO_FetchAll($query); $iFetch=count($Fetch); if($iFetch>0){ echo json_encode($Fetch, JSON_UNESCAPED_UNICODE); } break; } ?>