Example #1
0
/**
 * Rebuild the cached wordfilters file (in unlinked/filters.php)
 */
function rebuild_filters()
{
    $to = array();
    $from = array();
    // Load stuff from the DB
    $db = new ThornModDBI();
    $db_filters = $db->fetchBCW(THbcw_filter);
    foreach ($db_filters as $row_item) {
        $to[] = $row_item['filterto'];
        $from[] = $row_item['filterfrom'];
    }
    // And write it to the wordfilter cache file.
    $fp_cache = fopen(THpath . "unlinked/filters.php", "w");
    if ($fp_cache) {
        fprintf($fp_cache, "<?php\n" . '$to' . " =\n");
        $string = var_export($to, true);
        fprintf($fp_cache, "%s;\n\n" . '$from' . " =\n", $string);
        $string = var_export($from, true);
        fprintf($fp_cache, "%s;\n?>", $string);
    } else {
        die("Could not open unlinked/filters.php for writing!");
    }
    fclose($fp_cache);
}
Example #2
0
     include "recentpics.php";
 } elseif ($_GET['a'] == "q") {
     include "recentposts.php";
 } elseif ($_GET['a'] == "r") {
     include "reports.php";
 } elseif ($_GET['a'] == "l") {
     include "lookups.php";
 } elseif ($_GET['a'] == "lv") {
     include "logviewer.php";
 } elseif ($_GET['a'] == "c") {
     if (THdbtype == null) {
         THdie("ADdbfirst");
     }
     // Retrieve capcodes
     $capcodes = array();
     $capcodes = $db->fetchBCW(THbcw_capcode);
     if (count($capcodes) <= 0) {
         $capcodes = null;
     }
     $sm->assign("capcodes", $capcodes);
     $sm->display("admincapcodes.tpl");
 } elseif ($_GET['a'] == "w") {
     if (THdbtype == null) {
         THdie("ADdbfirst");
     }
     // Retrieve wordfilters
     $filters = array();
     $filters = $db->fetchBCW(THbcw_filter);
     if (count($filters) <= 0) {
         $filters = null;
     }