function ewiki_page_wantedpages($id, $data, $action) { #-- collect referenced pages $result = ewiki_db::GETALL(array("refs")); while ($row = $result->get()) { if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) { continue; } $refs .= $row["refs"]; } #-- build array $refs = array_unique(explode("\n", $refs)); #-- strip existing pages from array $refs = ewiki_db::FIND($refs); foreach ($refs as $id => $exists) { if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) { continue; } if (!$exists && !strstr($id, "://") && strlen(trim($id))) { $wanted[] = $id; } } #-- print out $o .= "<ul>\n"; foreach ($wanted as $page) { $o .= " <li>" . ewiki_link($page) . "</li>\n"; } $o .= "<ul>\n"; return $o; }
function ewiki_aview_pagetrail($id, &$data, $action) { if ($m = $data["meta"]["meta"]) { #-- check for parent page $top = $m["top"] or $top = $m["parent"] or $top = $m["group"]; if ($top) { $t = ewiki_db::GET($top); $t = explode("\n", trim($t["refs"])); $n = array_search(ewiki_array($top), strtolower($t)); $prev = $t[$n - 1]; $next = $t[$n + 1]; $o = "<div class=\"page-trail\"><< " . ($prev ? ewiki_link($prev) : "") . " | " . ewiki_link($top) . " | " . ($prev ? ewiki_link($prev) : "") . " >%gt;</div>\n"; return $o; } } }
function ewiki_xpi_plugin_control_centre() { ewiki_xpi_load_registry($registry, $registry_hash); #-- title $o = '<div class="xpi-settings"><h4>plugin control</h4>'; #-- delete plugins if ($access && ($uu = $_REQUEST["xpi_rm"])) { foreach ($uu as $id => $del) { if ($del) { $id = rawurldecode($id); $dat = ewiki_db::GET($id); $vZ = $dat["version"]; for ($v = 1; $v <= $vZ; $v++) { ewiki_db::DELETE($id, $v); } unset($registry[$id]); $vZ += 0; $o .= "<b>i</b>: Purged {$vZ} versions of '{$id}' and removed xpi registry entry.<br /><br />"; ewiki_log("uninstalled .xpi/.jpi plugin '{$id}'", 0); } } $_REQUEST["setup_xpi"] = 1; } #-- update config settings if ($_REQUEST["setup_xpi"]) { if ($access) { foreach ($registry as $id => $uu) { $registry[$id]["state"] = $_REQUEST["xpi_set"][rawurlencode($id)] ? 1 : 0; } $registry_hash["content"] = serialize($registry); ewiki_data_update($registry_hash); $registry_hash["version"]++; ewiki_db::WRITE($registry_hash); } else { $o .= "You have no privileges to change the status of installed .xpi plugins.<br />\n"; } } #-- enable/disable checkboxes $o .= '<table border="0" cellspacing="1" cellpadding="2">'; foreach ($registry as $dat) { $enabled = $dat["state"] == 1; $hard = $dat["type"] == "page"; $title = $hard ? ewiki_link($dat["id"]) : $dat["id"]; $o .= '<tr>' . '<td><tt>' . $dat["type"] . '</tt></td>' . '<td class="xs-check"><input type="checkbox" name="xpi_set[' . rawurlencode($dat["id"]) . ']" value="1"' . ($enabled ? " checked" : "") . ($hard ? " disabled" : "") . '></td>' . '<td class="xs-id">' . $title . '</td>' . '<td><small>' . htmlentities($dat["description"]) . '</small></td>' . '<td>' . $dat["author"] . ", " . $dat["license"] . '</td>' . '<td class="xs-check"><input type="submit" name="xpi_rm[' . rawurlencode($dat["id"]) . ']" value="rm" title="uninstall plugin"' . ($access ? "" : " disabled") . '></td>' . '</tr>'; } $o .= '</table>'; $o .= '<br /><input type="submit" name="setup_xpi" value="configure"' . ($access ? "" : " disabled") . '>'; $o .= '</form></div>'; return $o; }
<?php /* lists pages which are referenced but not yet written (AKA "DanglingSymlinks") */ #-- title echo ewiki_make_title($id, $id, 2); #-- collect referenced pages $result = ewiki_db::GETALL(array("refs")); while ($row = $result->get()) { if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $uu, "view")) { continue; } $refs .= $row["refs"]; } #-- build array $refs = array_unique(explode("\n", $refs)); #-- strip existing pages from array $refs = ewiki_db::FIND($refs); foreach ($refs as $id => $exists) { if (!$exists && !strstr($id, "://") && strlen(trim($id))) { $wanted[] = $id; } } #-- print out echo "<ul>\n"; foreach ($wanted as $page) { echo " <li>" . ewiki_link($page) . "</li>\n"; } echo "<ul>\n";