f7a9003af510f26627feb5a2d4687a0e1101e189
[atutor.git] / mods / wiki / plugins / mpi / mpi_phpwiki.php
1 <?php
2
3 /*
4    fake PhpWiki plugins
5    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
6    following stuff mimics some of the plugins found in PhpWiki v1.3,
7    to make use of them you must first explicitly include() this plugin
8    (as opposed to all real mpi plugins).
9
10    Unlike the others, you must include() this mpi plugin on its own,
11    because it has a file name which does not match the plugin name(s).
12 */
13
14
15 #-- glue
16 $ewiki_plugins["mpi"]["allusers"]       = "ewiki_mpi_phpwiki_allusers";
17 $ewiki_plugins["mpi"]["allauthors"]     = "ewiki_mpi_phpwiki_allusers";
18 $ewiki_plugins["mpi"]["allpages"]       = "ewiki_format_mpi_phpwiki_allpages";
19
20
21
22
23 #-- mimics phpwiki AllUsers plugin ----------------------------------------
24 # - fetches user names from the 'author' column of all pages,
25 #   but not from a user registry
26 function ewiki_mpi_phpwiki_allusers($action, &$args, &$iii, &$s) {
27    $authors = array();
28
29    $result = ewiki_db::GETALL(array("author"));
30    while ($row = $result->get()) {
31       if ($uu = strtok($row["author"], "(")) {
32          $authors[trim($uu)] = 1;
33       }
34    }
35    $authors = array_keys($authors);
36    natcasesort($authors);
37
38    foreach ($authors as $a) {
39       $o .= "· " . ewiki_link_regex_callback(array($a)) . "<br />\n";
40    }
41    return($o);
42 }
43
44
45
46
47 #-- mimics the phpwiki "AllPages" plugin --------------------------------
48 function ewiki_format_mpi_phpwiki_allpages($action, &$args, &$iii, &$s) {
49    if ($action=="html") {
50       return(ewiki_page_index(0,0,0,$args));
51    }
52 }
53
54
55
56 ?>