Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / wiki / ewiki / plugins / page / pageindex.php
blob87039a5b1bf5404150699633a1f959869dbd97e6
1 <?php
3 # this plugins provides the internal page "PageIndex", which lists all
4 # pages alphabetically
7 define("EWIKI_PAGE_PAGEINDEX", "PageIndex");
8 $ewiki_plugins["page"][EWIKI_PAGE_PAGEINDEX] = "ewiki_page_index";
11 function ewiki_page_index($id=0, $data=0, $action=0, $args=array()) {
13 global $ewiki_plugins;
15 $o = ewiki_make_title($id, $id, 2);
17 $sorted = array();
18 $sorted = array_merge($sorted, array_keys($ewiki_plugins["page"]));
20 $exclude = "\n" . implode("\n",
21 preg_split("/\s*[,;:\|]\s*/", $args["exclude"])) .
22 "\n";
24 $result = ewiki_database("GETALL", array("flags"));
25 while ($row = $result->get()) {
26 if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) {
27 continue;
29 if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
30 if (!stristr($exclude, "\n".$row["id"]."\n")) {
31 $sorted[] = $row["id"];
36 natcasesort($sorted);
38 $o .= ewiki_list_pages($sorted, 0, 0, $ewiki_plugins["list_dict"][0]);
40 return($o);