function ewiki_mpi_survey($action, &$args, &$iii, &$s) { global $ewiki_id, $ewiki_plugins; $o = ""; #-- load data page if (!($df = $args["data"])) { return; } unset($args["data"]); unset($args["_"]); unset($args[""]); $data = ewiki_db::GET($df); if (!$data["version"]) { $data = ewiki_new_data($df, EWIKI_DB_F_BINARY); $data["version"]--; } if ($data["flags"] != EWIKI_DB_F_BINARY) { return; } $survey = unserialize($data["content"]); #-- operation $vote = @$_REQUEST[EWIKI_UP_SURVEY]; if ($vote == "\$") { $action = "show"; } if ($action == "html") { #-- show entries if (!$vote) { $o = "\n" . '<form action="' . $_SERVER["REQUEST_URI"] . '" method="POST" enctype="multipart/form-data">' . '<input type="hidden" name="id" value="' . htmlentities($ewiki_id) . '">' . "\n"; foreach ($args as $name => $text) { if (!$name || !$text || $name == "data") { continue; } $o .= '<input type="radio" name="' . EWIKI_UP_SURVEY . '" value="' . htmlentities($name) . '"> ' . $text . "<br />\n"; } $o .= '<input type="submit" value="vote">'; $o .= "\n</form>\n<br /><br />\n"; $o .= '<a href="' . ewiki_script("", $ewiki_id, array(EWIKI_UP_SURVEY => "\$")) . '">show results</a><br />'; } #-- store an entry if ($vote) { $survey[$vote]++; $data["content"] = serialize($survey); $data["version"]++; $data["lastmodified"] = time(); $data["author"] = ewiki_author(); ewiki_db::WRITE($data); #-- show it $action = "show"; } } if ($action == "show") { $o .= $ewiki_plugins["view_stat"][0]($survey, $args); } return $o; }
function ewiki_xpi_load_registry(&$registry, &$registry_hash) { $registry_hash = ewiki_db::GET(XPI_DB); if (!$registry_hash || !($registry_hash["flags"] & EWIKI_DB_F_SYSTEM)) { $registry_hash = ewiki_new_data(XPI_DB, EWIKI_DB_F_SYSTEM); $registry_hash["version"] = 0; $registry = array(); } else { $registry = unserialize($registry_hash["content"]); } }