4 This plugin provides the run-time part of the xpi feature, thus keeping
5 all installed plugins active, if you use it to replace the big xpi.php
6 plugin (the version with the built-in PlugInstall page).
10 define("XPI_DB", "system/xpi/registry");
12 $ewiki_plugins["handler"][] = "xpi_exec";
13 $ewiki_plugins["init"][] = "xpi_init_plugins";
16 #-- executes pages with the _EXEC flag set
17 function xpi_exec($id, $data, $action) {
19 global $ewiki_id, $ewiki_title, $ewiki_action, $ewiki_data,
20 $ewiki_config, $ewiki_t, $ewiki_plugins, $_EWIKI;
22 if ($data["flags"] & EWIKI_DB_F_EXEC) {
23 eval($data["content"]);
29 #-- runs plugins at init time
30 function xpi_init_plugins() {
32 global $ewiki_id, $ewiki_title, $ewiki_action, $ewiki_data,
33 $ewiki_config, $ewiki_t, $ewiki_plugins, $_EWIKI;
36 $conf = ewiki_db::GET(XPI_DB);
37 if ($conf && ($conf["flags"] & EWIKI_DB_F_SYSTEM)
38 && ($conf = unserialize($conf["content"]))) {
40 #-- collect xpi code, execute it
42 foreach ($conf as $xpi) {
43 if ($xpi["state"] && ($xpi["type"] != "page")) {
44 $d = ewiki_db::GET($xpi["id"]);
45 if ($d && ($d["flags"] & EWIKI_DB_F_EXEC)) {
46 $eval_this .= $d["content"];