Exemple #1
0
function ewiki_trigger_spam_watchonly($id, &$data, &$action, $pf_i)
{
    #-- fetch list of tracked pages
    if ($d = ewiki_db::GET("WatchSpam")) {
        (array) ($ewiki_config["watchspam"] += explode("\n", trim($d["refs"])));
    }
    #-- disable all bot-blocking plugins?
    if (!ewiki_in_array($id, $ewiki_config["watchspam"])) {
        $GLOBALS["ewiki_no_bot"] = 1;
    } elseif ($action == "edit") {
        ewiki_log("someone is {$action}ing specifically watched page '{$id}'", 2);
    }
}
function ewiki_page_orphanedpages($id, $data, $action)
{
    global $ewiki_links;
    $o = ewiki_make_title($id, ewiki_t($id), 2);
    $pages = array();
    $refs = array();
    $orphaned = array();
    #-- read database
    $db = ewiki_database("GETALL", array("refs", "flags"));
    $n = 0;
    while ($row = $db->get()) {
        $p = $row["id"];
        #-- remove self-reference
        $row["refs"] = str_replace("\n{$p}\n", "\n", $row["refs"]);
        #-- add to list of referenced pages
        $rf = explode("\n", trim($row["refs"]));
        $refs = array_merge($refs, $rf);
        if ($n++ > 299) {
            $refs = array_unique($refs);
            $n = 0;
        }
        // (clean-up only every 300th loop)
        #-- add page name
        if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
            $pages[] = $row["id"];
        }
    }
    $refs = array_unique($refs);
    #-- check pages to be referenced from somewhere
    foreach ($pages as $p) {
        if (!ewiki_in_array($p, $refs)) {
            if (!EWIKI_PROTECTED_MODE || EWIKI_PROTECTED_MODE_HIDING || ewiki_auth($p, $uu, "view")) {
                $orphaned[] = $p;
            }
        }
    }
    #-- output
    $o .= ewiki_list_pages($orphaned, 0);
    return $o;
}
Exemple #3
0
   This feature is also known as MeatBall:KeptPages.
*/
// define("DELETEPAGES", 1);
#-- proceed
if (defined("DELETEPAGES") && DELETEPAGES && $keptpages) {
    echo "[{$cron}]: Scanning for pages to kill...\n";
    $triggers = array("delete", "deleted", "del", "remove", "removed", "kill", "unlink", "unlink()", "unlink();", "trash", "rm", "rm -f", "DeletePage", "DeletedPage", "RemovePage", "KillPage", "UnlinkPage", "TrashCan");
    #-- list all
    $all = ewiki_db::GETALL("id", "version", "lastmodified");
    while ($row = $all->get()) {
        #-- check that it wasn't modified lately
        if (time() >= $row["lastmodified"] + $keptpages) {
            #-- check page content for trigger words
            $id = $row["id"];
            $row = ewiki_db::GET($id);
            $text = strtolower(trim($row["content"]));
            $refs = trim($row["refs"]);
            if (in_array($text, $triggers) or ewiki_in_array($refs, $triggers)) {
                #-- purge it, no mercy!!!!!
                echo "   {$id}";
                for ($v = $row["version"]; $v >= 1; $v--) {
                    if (ewiki_db::GET($id, $v)) {
                        echo " [{$v}]";
                        ewiki_db::DELETE($id, $v);
                    }
                }
                echo "\n";
            }
        }
    }
}
Exemple #4
0
#-- read database
$db = ewiki_db::GETALL(array("refs", "flags"));
$n = 0;
while ($row = $db->get()) {
    $p = $row["id"];
    #-- remove self-reference
    $row["refs"] = str_replace("\n{$p}\n", "\n", $row["refs"]);
    #-- add to list of referenced pages
    $rf = explode("\n", trim($row["refs"]));
    $refs = array_merge($refs, $rf);
    if ($n++ > 299) {
        $refs = array_unique($refs);
        $n = 0;
    }
    // (clean-up only every 300th loop)
    #-- add page name
    if (($row["flags"] & EWIKI_DB_F_TYPE) == EWIKI_DB_F_TEXT) {
        $pages[] = $row["id"];
    }
}
$refs = array_unique($refs);
#-- check pages to be referenced from somewhere
foreach ($pages as $p) {
    if (!ewiki_in_array($p, $refs)) {
        if (!EWIKI_PROTECTED_MODE || !EWIKI_PROTECTED_MODE_HIDING || ewiki_auth($p, $uu, "view")) {
            $orphaned[] = $p;
        }
    }
}
#-- output
echo ewiki_list_pages($orphaned, 0);