changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / lib / protmode.php
1 <?php
2
3 /*
4    This file holds utility functions (not core, but required by multiple
5    plugins) for use with the EWIKI_PROTECTED_MODE.
6 */
7
8 //Set to pass binary data to auth plugins
9 define('EWIKI_BINARY_DATA_SAFE_AUTH',0);
10
11 $ewiki_plugins["handler_binary"][0] = "ewiki2_binary_page_handler";
12
13
14 /*  this function reimplements some of the ewiki_page() functionality and
15     is automatically invoked for pages with the _BINARY flag set
16 */
17 function ewiki2_binary_page_handler($id, &$data, $action) {
18
19    global $ewiki_plugins, $ewiki_errmsg;
20
21     //echo("running handler");
22
23    #-- however we do not handle _DISABLED or _SYSTEM entries
24    if (empty($data["flags"]) || !($data["flags"] & EWIKI_DB_F_BINARY)
25    || ($data["flags"] & EWIKI_DB_F_SYSTEM)
26    || ($data["flags"] & EWIKI_DB_F_DISABLED))
27    {
28       return(ewiki_t("DISABLED"));
29    }
30
31    #-- _PROTECTED_MODE
32    # (Andy: can we print a login <form> once we reached here???)   
33    if (!ewiki_auth($id, $data, $action, $ring=false, $force=EWIKI_AUTO_LOGIN)) {
34        //echo("not authenticated id".$id." action ".$action);   
35       return($ewiki_errmsg);
36    }
37    //echo("authenticated  id:".$id." action ".$action);
38    #-- chain to one of the action_BINARY plugins
39    if ($pf = $ewiki_plugins["action_binary"][$action]) {
40        //echo("running ".$pf."()");
41       return($pf($id, $data, $action));
42    }
43
44    #-- else let ?binary= return the requested 'page' entry
45    //Consider binary view here
46    //ewiki_binary($id);
47 }
48
49 ?>