4 This file holds utility functions (not core, but required by multiple
5 plugins) for use with the EWIKI_PROTECTED_MODE.
8 //Set to pass binary data to auth plugins
9 define('EWIKI_BINARY_DATA_SAFE_AUTH',0);
11 $ewiki_plugins["handler_binary"][0] = "ewiki2_binary_page_handler";
14 /* this function reimplements some of the ewiki_page() functionality and
15 is automatically invoked for pages with the _BINARY flag set
17 function ewiki2_binary_page_handler($id, &$data, $action) {
19 global $ewiki_plugins, $ewiki_errmsg;
21 //echo("running handler");
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))
28 return(ewiki_t("DISABLED"));
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);
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));
44 #-- else let ?binary= return the requested 'page' entry
45 //Consider binary view here