e6ba00e20ab8a064d3112f72e30d3053c3dcd131
[atutor.git] / mods / wiki / spages / WordIndex.php
1 <?php
2
3 /*
4    Lists all used words inside WikiPageNames and shows a list of them
5    (similar to PageIndex) - but it redirects the words to PowerSearch,
6    which also needs to be installed therefore!
7 */
8
9  global $ewiki_plugins;
10  echo ewiki_make_title($id, $id, 2);
11
12  $result = ewiki_db::GETALL(array("flags"));
13  $src = "";
14  while ($row = $result->get(0, 0x0037, EWIKI_DB_F_TEXT)) {
15     $src .= " " . $row["id"];
16  }
17
18  $src = ewiki_split_title($src, "SPLIT", 0);
19  $chars = strtr(EWIKI_CHARS_U.EWIKI_CHARS_L, "_", " ");
20  $src = preg_replace("/[^$chars]/", " ", $src);
21  $src = explode(" ", $src);
22  $src = array_unique($src);   //@ADD: word counting
23  unset($src[""]);
24
25  natcasesort($src);
26
27  $sorted = array();
28  foreach ($src as $i => $word) {
29
30     if (strlen($word) >= 2) {
31
32        $sorted[] = array(
33           EWIKI_PAGE_POWERSEARCH,
34           array("where"=>"id", "q"=>$word),
35           $word, ""          //@ADD: display word count
36        );
37
38     }
39  }
40  unset($src);
41
42  $pf_list_pages = $ewiki_plugins["list_dict"][0];
43  echo ewiki_list_pages($sorted, $limit=0, $vat=1, $pf_list_pages);
44
45
46 ?>