dict_lookup.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <?php
  2. //查询参考字典
  3. include("../log/pref_log.php");
  4. require_once '../path.php';
  5. require_once '../public/casesuf.inc';
  6. require_once '../public/union.inc';
  7. require_once "../public/_pdo.php";
  8. require_once "../public/load_lang.php"; //语言文件
  9. require_once "../public/function.php";
  10. require_once "../search/word_function.php";
  11. require_once "../ucenter/active.php";
  12. require_once "../ucenter/function.php";
  13. require_once "../dict/p_ending.php";
  14. require_once "../redis/function.php";
  15. require_once "../dict/grm_abbr.php";
  16. global $redis;
  17. $redis = redis_connect();
  18. global $count_return;
  19. $count_return = 0;
  20. $word = mb_strtolower($_GET["word"], 'UTF-8');
  21. $org_word = $word;
  22. global $dict_list;
  23. $dict_list = array();
  24. $right_word_list = "";
  25. add_edit_event(_DICT_LOOKUP_, $word);
  26. echo "<div id='dict_ref'>";
  27. #先查原词
  28. echo "<div class='pali_spell'><a name='{word_$word}'></a>" . $word . "</div>";
  29. $dict_list_a = [];
  30. //社区字典开始
  31. echo lookup_user($word);
  32. //社区字典结束
  33. echo lookup_term($word);
  34. PDO_Connect("" . _FILE_DB_REF_);
  35. //直接查询
  36. $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,100";
  37. $Fetch = PDO_FetchAll($query, array($word));
  38. $iFetch = count($Fetch);
  39. echo "<div>直接查询{$iFetch}</div>";
  40. $count_return += $iFetch;
  41. if ($iFetch > 0) {
  42. for ($i = 0; $i < $iFetch; $i++) {
  43. $mean = $Fetch[$i]["mean"];
  44. $dictid = $Fetch[$i]["dict_id"];
  45. $dict_list[$dictid] = $Fetch[$i]["shortname"];
  46. $dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
  47. $outXml = "<div class='dict_word'>";
  48. $outXml = $outXml . "<a name='ref_dict_$dictid'></a>";
  49. $outXml = $outXml . "<div class='dict'>" . $Fetch[$i]["shortname"] . "</div>";
  50. $mean = GrmAbbr($mean,$dictid);
  51. $outXml = $outXml . "<div class='mean'>" . $mean . "</div>";
  52. $outXml = $outXml . "</div>";
  53. echo $outXml;
  54. }
  55. }
  56. //去格位除尾查
  57. echo "<div>去格位除尾查</div>";
  58. $newWord = array();
  59. for ($row = 0; $row < count($case); $row++) {
  60. $len = mb_strlen($case[$row][1], "UTF-8");
  61. $end = mb_substr($word, 0 - $len, null, "UTF-8");
  62. if ($end == $case[$row][1]) {
  63. $base = mb_substr($word, 0, mb_strlen($word, "UTF-8") - $len, "UTF-8") . $case[$row][0];
  64. if ($base != $word) {
  65. $thiscase = "";
  66. $arrCase = explode('$', $case[$row][2]);
  67. foreach ($arrCase as $value) {
  68. $caseid = "grammar_" . str_replace('.', '', $value);
  69. $thiscase .= "<guide gid='$caseid'>$value</guide>";
  70. }
  71. if (isset($newWord[$base])) {
  72. $newWord[$base] .= "<br />" . $thiscase;
  73. } else {
  74. $newWord[$base] = $thiscase;
  75. }
  76. }
  77. }
  78. }
  79. $base_list = array();
  80. if (count($newWord) > 0) {
  81. foreach ($newWord as $x => $x_value) {
  82. $titleHas = false;
  83. $userDictStr = lookup_user($x);
  84. $termDictStr = lookup_term($x);
  85. if(!empty($userDictStr) || !empty($termDictStr)){
  86. echo "<div class='pali_spell'><a name='word_$x'></a>" . $x . "</div>";
  87. $titleHas = true;
  88. }
  89. $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
  90. $Fetch = PDO_FetchAll($query, array($x));
  91. $iFetch = count($Fetch);
  92. $count_return += $iFetch;
  93. if ($iFetch > 0) {
  94. $base_list[] = $x;
  95. $dict_list_a[] = array("word_$x", $x);
  96. if(!$titleHas){
  97. echo "<div class='pali_spell'><a name='word_$x'></a>" . $x . "</div>";
  98. }
  99. //语法信息
  100. foreach ($_local->grammastr as $gr) {
  101. $x_value = str_replace($gr->id, $gr->value, $x_value);
  102. }
  103. echo "<div class='dict_find_gramma'>" . $x_value . "</div>";
  104. echo $userDictStr;
  105. echo $termDictStr;
  106. for ($i = 0; $i < $iFetch; $i++) {
  107. $mean = $Fetch[$i]["mean"];
  108. $dictid = $Fetch[$i]["dict_id"];
  109. $dict_list[$dictid] = $Fetch[$i]["shortname"];
  110. $dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
  111. echo "<div class='dict_word'>";
  112. echo "<a name='ref_dict_$dictid'></a>";
  113. echo "<div class='dict'>" . $Fetch[$i]["shortname"] . "</div>";
  114. $mean = GrmAbbr($mean,$dictid);
  115. echo "<div class='mean'>" . $mean . "</div>";
  116. echo "</div>";
  117. }
  118. }
  119. }
  120. }
  121. //去除尾查结束
  122. //去分词除尾查
  123. echo "<div>去分词除尾查</div>";
  124. $arrBase = array();
  125. if (count($newWord) > 0) {
  126. foreach ($newWord as $base => $grammar){
  127. for ($row = 0; $row < count($p_ending); $row++) {
  128. $len = mb_strlen($p_ending[$row][1], "UTF-8");
  129. $end = mb_substr($base, 0 - $len, null, "UTF-8");
  130. if ($end == $p_ending[$row][1]) {
  131. $newbase = mb_substr($base, 0, mb_strlen($base, "UTF-8") - $len, "UTF-8") . $p_ending[$row][0];
  132. if ($newbase != $base) {
  133. $thiscase = "";
  134. $arrCase = explode('$', $p_ending[$row][2]);
  135. foreach ($arrCase as $value) {
  136. $caseid = "grammar_" . str_replace('.', '', $value);
  137. $thiscase .= "<guide gid='$caseid'>$value</guide>";
  138. }
  139. if (isset($arrBase[$newbase])) {
  140. $arrBase[$newbase]['grammar'] .= "<br />" . $thiscase;
  141. } else {
  142. $arrBase[$newbase]['grammar'] = $thiscase;
  143. $arrBase[$newbase]['parent'] = $base;
  144. }
  145. }
  146. }
  147. }
  148. }
  149. $base_list = array();
  150. if (count($arrBase) > 0) {
  151. foreach ($arrBase as $x => $x_value) {
  152. $query = "SELECT dict.dict_id,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where word = ? limit 0,30";
  153. $Fetch = PDO_FetchAll($query, array($x));
  154. $iFetch = count($Fetch);
  155. $count_return += $iFetch;
  156. if ($iFetch > 0) {
  157. $base_list[] = $x;
  158. $dict_list_a[] = array("word_$x", $x);
  159. echo "<div class='pali_spell'><a name='word_$x'></a>" . $x . "</div>";
  160. echo "<div style='color:gray;'>{$x}➡{$x_value["parent"]}➡{$word}</div>";
  161. //替换为本地语法信息
  162. foreach ($_local->grammastr as $gr) {
  163. $x_value['grammar'] = str_replace($gr->id, $gr->value, $x_value['grammar']);
  164. }
  165. echo "<div class='dict_find_gramma'>" . $x_value['grammar'] . "</div>";
  166. for ($i = 0; $i < $iFetch; $i++) {
  167. $mean = $Fetch[$i]["mean"];
  168. $dictid = $Fetch[$i]["dict_id"];
  169. $dict_list[$dictid] = $Fetch[$i]["shortname"];
  170. $dict_list_a[] = array("ref_dict_$dictid", $Fetch[$i]["shortname"]);
  171. echo "<div class='dict_word'>";
  172. echo "<a name='ref_dict_$dictid'></a>";
  173. echo "<div class='dict'>" . $Fetch[$i]["shortname"] . "</div>";
  174. $mean = GrmAbbr($mean,$dictid);
  175. echo "<div class='mean'>" . $mean . "</div>";
  176. echo "</div>";
  177. }
  178. }
  179. }
  180. }
  181. }
  182. //去除尾查结束
  183. echo "<div id='search_summary'>";
  184. echo "查询{$word} 共{$count_return}条 ";
  185. if(count($base_list)>0){
  186. echo "找到可能的拼写: ";
  187. foreach ($base_list as $key => $value) {
  188. # code...
  189. echo "<a>{$value}</a> ";
  190. }
  191. }
  192. echo "<a>查询内文</a>";
  193. echo "</div>";
  194. echo "<input type='hidden' id='word_count' value='{$count_return}' />";
  195. //查连读词
  196. /*
  197. if ($count_return < 2) {
  198. echo "<div>Junction</div>";
  199. $newWord = array();
  200. for ($row = 0; $row < count($un); $row++) {
  201. $len = mb_strlen($un[$row][1], "UTF-8");
  202. $end = mb_substr($word, 0 - $len, null, "UTF-8");
  203. if ($end == $un[$row][1]) {
  204. $base = mb_substr($word, 0, mb_strlen($word, "UTF-8") - $len, "UTF-8") . $un[$row][0];
  205. $arr_un = explode("+", $base);
  206. foreach ($arr_un as $oneword) {
  207. echo "<a onclick='dict_pre_word_click(\"$oneword\")'>$oneword</a> + ";
  208. }
  209. echo "<br />";
  210. }
  211. }
  212. }
  213. */
  214. //拆复合词
  215. echo "<div id='auto_split'></div>";
  216. //查内容
  217. if ($count_return < 4) {
  218. $word1 = $org_word;
  219. $wordInMean = "%$org_word%";
  220. echo "包含 $org_word 的:<br />";
  221. $query = "SELECT dict.dict_id,dict.word,dict.mean,info.shortname from " . _TABLE_DICT_REF_ . " LEFT JOIN info ON dict.dict_id = info.id where mean like ? limit 0,30";
  222. $Fetch = PDO_FetchAll($query, array($wordInMean));
  223. $iFetch = count($Fetch);
  224. $count_return += $iFetch;
  225. if ($iFetch > 0) {
  226. for ($i = 0; $i < $iFetch; $i++) {
  227. $mean = $Fetch[$i]["mean"];
  228. $pos = mb_stripos($mean, $word, 0, "UTF-8");
  229. if ($pos) {
  230. if ($pos > 20) {
  231. $start = $pos - 20;
  232. } else {
  233. $start = 0;
  234. }
  235. $newmean = mb_substr($mean, $start, 100, "UTF-8");
  236. } else {
  237. $newmean = $mean;
  238. }
  239. $pos = mb_stripos($newmean, $word1, 0, "UTF-8");
  240. $head = mb_substr($newmean, 0, $pos, "UTF-8");
  241. $mid = mb_substr($newmean, $pos, mb_strlen($word1, "UTF-8"), "UTF-8");
  242. $end = mb_substr($newmean, $pos + mb_strlen($word1, "UTF-8"), null, "UTF-8");
  243. $heigh_light_mean = "$head<hl>$mid</hl>$end";
  244. echo "<div class='dict_word'>";
  245. echo "<div class='pali'><a href='index.php?key={$Fetch[$i]["word"]}'>" . $Fetch[$i]["word"] . "</a></div>";
  246. echo "<div class='dict'>" . $Fetch[$i]["shortname"] . "</div>";
  247. echo "<div class='mean'>" . $heigh_light_mean . "</div>";
  248. echo "<div><a href='index.php?key={$Fetch[$i]["word"]}&hightlight={$org_word}'>详情</a></div>";
  249. echo "</div>";
  250. }
  251. }
  252. }
  253. else{
  254. }
  255. echo "<div id='dictlist'>";
  256. foreach ($dict_list_a as $x_value) {
  257. if (substr($x_value[0], 0, 4) == "word") {
  258. echo "<div class='pali_spell'>";
  259. echo "<a href='#{$x_value[0]}'>$x_value[1]</a></div>";
  260. } else {
  261. echo "<div><a href='#{$x_value[0]}'>$x_value[1]</a></div>";
  262. }
  263. }
  264. echo "<div>";
  265. $arrWords = countWordInPali($word, true);
  266. $weight = 0;
  267. foreach ($arrWords as $oneword) {
  268. $weight += $oneword["count"] * $oneword["len"];
  269. }
  270. //echo "<div>{$_local->gui->word_weight}:$weight {$_local->gui->characters}</div>";
  271. //echo "<div>{$_local->gui->real_declension}:".count($arrWords)." {$_local->gui->forms}</div>";
  272. $right_word_list .= "<div>{$_local->gui->word_weight}:$weight {$_local->gui->characters}</div>";
  273. $right_word_list .= "<div>{$_local->gui->real_declension}:" . count($arrWords) . " {$_local->gui->forms}</div>";
  274. foreach ($arrWords as $oneword) {
  275. if ($oneword["bold"] > 0) {
  276. //echo "<div><b>{$oneword["word"]}</b> {$oneword["count"]} {$_local->gui->times}</div>";
  277. $right_word_list .= "<div><b>{$oneword["word"]}</b> {$oneword["count"]} {$_local->gui->times}</div>";
  278. } else {
  279. //echo "<div>{$oneword["word"]} {$oneword["count"]}{$_local->gui->times}</div>";
  280. $right_word_list .= "<div>{$oneword["word"]} {$oneword["count"]}{$_local->gui->times}</div>";
  281. }
  282. }
  283. echo "</div>";
  284. echo "</div>";
  285. echo "</div>";
  286. //参考字典查询结束
  287. //用户词典编辑窗口
  288. echo "<div id='dict_user' >";
  289. echo "<div><a href='word_statistics.php?word={$word}'>";
  290. echo "<svg t='1596783175334' class='icon' style='font-size: xxx-large; fill: var(--link-hover-color); margin: 5px;' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='7755' width='200' height='200'><path d='M1019.904 450.56L536.576 557.056l417.792 208.896C999.424 692.224 1024 606.208 1024 512c0-20.48 0-40.96-4.096-61.44z m-12.288-61.44C958.464 184.32 786.432 28.672 573.44 4.096L446.464 512l561.152-122.88zM737.28 970.752c73.728-36.864 139.264-90.112 188.416-159.744L507.904 602.112l229.376 368.64zM512 0C229.376 0 0 229.376 0 512s229.376 512 512 512c61.44 0 118.784-12.288 172.032-28.672L385.024 512 512 0z' p-id='7756'></path></svg>";
  291. echo "<span>{$_local->gui->click_to_chart}</span></a></div>";
  292. echo $right_word_list;
  293. /*
  294. echo "<div class='dict_word' ><b>{$_local->gui->undone_function}</b>";
  295. echo "<div class='' onclick=\"dict_show_edit()\">{$_local->gui->edit}</div>";
  296. echo "<div class='pali'>{$word}</div>";
  297. if ($iFetch > 0) {
  298. echo "<div id='user_word_edit' style='display:none'>";
  299. } else {
  300. echo "<div id='user_word_edit'>";
  301. }
  302. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->wordtype}</legend>";
  303. echo "<select id=\"id_type\" name=\"type\" >";
  304. foreach ($_local->type_str as $type) {
  305. echo "<option value=\"{$type->id}\" >{$type->value}</option>";
  306. }
  307. echo "</select>";
  308. echo "</fieldset>";
  309. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->gramma}</legend><input type='input' value=''/></fieldset>";
  310. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->parent}</legend><input type='input' value=''/></fieldset>";
  311. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->g_mean}</legend><input type='input' value=''/></fieldset>";
  312. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->note}</legend><textarea></textarea></fieldset>";
  313. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->factor}</legend><input type='input' value=''/></fieldset>";
  314. echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->f_mean}</legend><input type='input' value=''/></fieldset>";
  315. echo "<div class=''><button>{$_local->gui->add_to} {$_local->gui->my_dictionary}</button></div>";
  316. echo "</div>";
  317. echo "</div>";
  318. */
  319. echo "</div>";
  320. //查用户词典结束
  321. PrefLog();
  322. function lookup_user($word){
  323. global $dict_list;
  324. global $redis;
  325. global $_local;
  326. global $PDO;
  327. global $count_return;
  328. $output ="";
  329. $Fetch=array();
  330. if($redis){
  331. $wordData = $redis->hGet("dict://user",$word);
  332. if($wordData){
  333. if(!empty($wordData)){
  334. $arrWord = json_decode($wordData,true);
  335. foreach ($arrWord as $one) {
  336. # code...
  337. $Fetch[] = array("id"=>$one[0],
  338. "pali"=>$one[1],
  339. "type"=>$one[2],
  340. "gramma"=>$one[3],
  341. "parent"=>$one[4],
  342. "mean"=>$one[5],
  343. "note"=>$one[6],
  344. "factors"=>$one[7],
  345. "factormean"=>$one[8],
  346. "status"=>$one[9],
  347. "confidence"=>$one[10],
  348. "creator"=>$one[11],
  349. "dict_name"=>$one[12],
  350. "lang"=>$one[13],
  351. );
  352. }
  353. }
  354. }
  355. else{
  356. # 没找到就不找了
  357. }
  358. }
  359. else{
  360. PDO_Connect("" . _FILE_DB_WBW_);
  361. $query = "SELECT * from " . _TABLE_DICT_REF_ . " where pali = ? limit 0,100";
  362. $Fetch = PDO_FetchAll($query, array($word));
  363. }
  364. $iFetch = count($Fetch);
  365. if ($iFetch > 0) {
  366. $count_return++;
  367. $userlist = array();
  368. foreach ($Fetch as $value) {
  369. if (isset($userlist[$value["creator"]])) {
  370. $userlist[$value["creator"]] += 1;
  371. } else {
  372. $userlist[$value["creator"]] = 1;
  373. }
  374. $userwordcase = $value["type"] . "#" . $value["gramma"];
  375. $parent = $value["parent"];
  376. if(empty($parent)){
  377. $parent = "_null_";
  378. }
  379. if (isset($userdict["{$parent}"])) {
  380. $userdict["{$parent}"]["mean"] .= "$". $value["mean"] ;
  381. $userdict["{$parent}"]["factors"] .= "@". $value["factors"];
  382. $userdict["{$parent}"]["case"] .= "@".$userwordcase;
  383. } else {
  384. $userdict["{$parent}"]["mean"] = $value["mean"];
  385. $userdict["{$parent}"]["factors"] = $value["factors"];
  386. $userdict["{$parent}"]["case"] = $userwordcase;
  387. }
  388. }
  389. $output .= "<div class='dict_word'>";
  390. $output .= "<div class='dict'>{$_local->gui->com_dict}</div><a name='net'></a>";
  391. $dict_list_a[] = array("net", $_local->gui->com_dict);
  392. foreach ($userdict as $key => $value) {
  393. #语法信息查重
  394. $thiscase = array();
  395. $strCase = "";
  396. $arrCase = explode("@",$value["case"]);
  397. foreach ($arrCase as $case) {
  398. # code...
  399. $thiscase[$case] = 1;
  400. }
  401. foreach ($thiscase as $case => $casevalue) {
  402. # code...
  403. $strCase .=$case . "; ";
  404. }
  405. #语法信息替换为本地字符串
  406. foreach ($_local->grammastr as $gr) {
  407. $strCase = str_replace($gr->id, $gr->value, $strCase);
  408. }
  409. #拆分查重复
  410. $thispart = array();
  411. $strPart = "";
  412. $arrPart = explode("@",$value["factors"]);
  413. foreach ($arrPart as $part) {
  414. # code...
  415. $thispart[$part] = 1;
  416. }
  417. foreach ($thispart as $part => $partvalue) {
  418. # code...
  419. $strPart .=$part . "; ";
  420. }
  421. #意思查重复
  422. $thismean = array();
  423. $strMean = "";
  424. $arrMean = explode("$",$value["mean"]);
  425. foreach ($arrMean as $mean) {
  426. # code...
  427. $thismean[$mean] = 1;
  428. }
  429. foreach ($thismean as $mean => $meanvalue) {
  430. # code...
  431. $strMean .=$mean . "; ";
  432. }
  433. $output .= "<div class='mean'><b>{$_local->gui->gramma}</b>:{$strCase}</div>";
  434. if($key!=="_null_"){
  435. $output .= "<div class='mean'><b>{$_local->gui->parent}</b>:<a href='index.php?key={$key}'>{$key}</a></div>";
  436. }
  437. $output .= "<div class='mean'><b>{$_local->gui->g_mean}</b>:{$strMean}</div>";
  438. $output .= "<div class='mean'><b>{$_local->gui->factor}</b>:{$strPart}</div>";
  439. }
  440. $output .= "<div><span>{$_local->gui->contributor}:</span>";
  441. $userinfo = new UserInfo();
  442. foreach ($userlist as $key => $value) {
  443. $user = $userinfo->getName($key);
  444. $output .= $user["nickname"] . " ";
  445. }
  446. $output .= "</div>";
  447. $output .= "</div>";
  448. }
  449. return $output;
  450. }
  451. function lookup_term($word){
  452. global $dict_list;
  453. global $redis;
  454. global $_local;
  455. global $PDO;
  456. global $count_return;
  457. $output ="";
  458. $Fetch=array();
  459. if($redis){
  460. $wordData = $redis->hGet("dict://term",$word);
  461. if($wordData){
  462. if(!empty($wordData)){
  463. $arrWord = json_decode($wordData,true);
  464. foreach ($arrWord as $one) {
  465. # code...
  466. $Fetch[] = array("id"=>$one[0],
  467. "pali"=>$one[1],
  468. "type"=>$one[2],
  469. "gramma"=>$one[3],
  470. "parent"=>$one[4],
  471. "mean"=>$one[5],
  472. "note"=>$one[6],
  473. "factors"=>$one[7],
  474. "factormean"=>$one[8],
  475. "status"=>$one[9],
  476. "confidence"=>$one[10],
  477. "creator"=>$one[11],
  478. "dict_name"=>$one[12],
  479. "lang"=>$one[13],
  480. );
  481. }
  482. }
  483. }
  484. else{
  485. # 没找到就不找了
  486. }
  487. }
  488. else{
  489. PDO_Connect("" . _FILE_DB_WBW_);
  490. $query = "SELECT * from " . _TABLE_DICT_REF_ . " where pali = ? limit 0,100";
  491. $Fetch = PDO_FetchAll($query, array($word));
  492. }
  493. $iFetch = count($Fetch);
  494. $count_return += $iFetch;
  495. if ($iFetch > 0) {
  496. $userlist = array();
  497. foreach ($Fetch as $value) {
  498. if (isset($userlist[$value["creator"]])) {
  499. $userlist[$value["creator"]] += 1;
  500. } else {
  501. $userlist[$value["creator"]] = 1;
  502. }
  503. $userwordcase = $value["type"] . "#" . $value["gramma"];
  504. if (isset($userdict["{$userwordcase}"])) {
  505. $userdict["{$userwordcase}"]["mean"] .= $value["mean"] . ";";
  506. $userdict["{$userwordcase}"]["factors"] .= $value["factors"];
  507. } else {
  508. $userdict["{$userwordcase}"]["mean"] = $value["mean"];
  509. $userdict["{$userwordcase}"]["factors"] = $value["factors"];
  510. }
  511. }
  512. $output .= "<div class='dict_word'>";
  513. $output .= "<div class='dict'>{$_local->gui->wiki_term}</div><a name='net'></a>";
  514. $dict_list_a[] = array("net", $_local->gui->wiki_term);
  515. foreach ($userdict as $key => $value) {
  516. $output .= "<div class='mean'>{$key}:{$value["mean"]}</div>";
  517. }
  518. $output .= "<div><span>{$_local->gui->contributor}:</span>";
  519. $userinfo = new UserInfo();
  520. foreach ($userlist as $key => $value) {
  521. $user = $userinfo->getName($key);
  522. $output .= $user["nickname"] . " ";
  523. }
  524. $output .= "</div>";
  525. $output .= "</div>";
  526. }
  527. return $output;
  528. }
  529. function GrmAbbr($input,$dictid){
  530. $mean = $input;
  531. foreach (GRM_ABBR as $key => $value) {
  532. # code...
  533. if($value["dictid"]==$dictid ){
  534. $mean = str_replace($value["abbr"],"<guide gid='grammar_{$value["replace"]}' class='grammar_tag' style='display:unset;'>{$value["abbr"]}</guide>",$mean);
  535. }
  536. }
  537. return $mean;
  538. }