Пример #1
0
if (!defined("PHORUM_ADMIN")) {
    return;
}
include_once "./include/format_functions.php";
include_once "./include/api/file_storage.php";
// Execute file purging for real?
if (count($_POST)) {
    $deleted = phorum_api_file_purge_stale(TRUE);
    phorum_admin_okmsg("Purged " . count($deleted) . " files");
}
// Retrieve a list of stale files.
$purge_files = phorum_api_file_purge_stale(FALSE);
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm("", "post", count($purge_files) ? "Purge stale files now" : "Refresh screen");
$frm->hidden("module", "file_purge");
$frm->addbreak("Purging stale files...");
$frm->addmessage("It's possible that there are files stored in the Phorum system,\n         which no longer are linked to anything. For example, if users\n         write messages with attachments, but do not post them in the end,\n         the attachment files will be left behind in the database.\n         Using this maintenance tool, you can purge those stale files\n         from the system.");
$prev_reason = '';
if (count($purge_files)) {
    $frm->addbreak("There are currently " . count($purge_files) . " stale files in the database");
    foreach ($purge_files as $id => $file) {
        if ($file['reason'] != $prev_reason) {
            $prev_reason = $file['reason'];
            $frm->addsubbreak("Reason: " . $file['reason']);
        }
        $frm->addrow(htmlspecialchars($file["filename"]), phorum_filesize($file["filesize"]));
    }
} else {
    $frm->addmessage("There are currently no stale files in the database");
}
$frm->show();
Пример #2
0
        if(!$ret){
            $error="No messages deleted.<br />";
        } else {
            echo "$ret Messages deleted.<br />";
        }
    }

    if($error){
        phorum_admin_error($error);
    }

    include_once "./include/admin/PhorumInputForm.php";
        

    $frm = new PhorumInputForm ("", "post", "Delete messages");

    $frm->hidden("module", "message_prune");

    $frm->addbreak("Pruning old threads ...");
    $frm->addmessage("ATTENTION!<br />This script deletes quickly A LOT of messages. Use it on your own risk.<br />There is no further confirmation message after sending this form!");

    $frm->addrow("older than (days from today)",$frm->text_box("days", "365", 10));
    $frm->addrow("in Forum", $frm->select_tag("forumid", $forum_list,0));
    $frm->addrow("Check for", $frm->select_tag("mode", array(1=>"When the thread was started",2=>"When the last answer to the thread was posted"),0));    

    $frm->show();


?>
Пример #3
0
        $full_purge = isset($_POST["purge_all"]) && $_POST["purge_all"];
        $report = phorum_cache_purge($full_purge);
        print $report . "<br/>";
    }
    // Cleanup compiled templates.
    $purged = 0;
    $dh = opendir($PHORUM["cache"]);
    if (!$dh) {
        die("Can't opendir " . htmlspecialchars($PHORUM["cache"]));
    }
    while ($entry = readdir($dh)) {
        if (preg_match('/^tpl-.*[a-f0-9]{32}\\.php(-stage2)?$/', $entry)) {
            $compiled_tpl = $PHORUM["cache"] . "/{$entry}";
            $size = filesize($compiled_tpl);
            if (@unlink($compiled_tpl)) {
                $purged += $size;
            }
        }
    }
    require_once "./include/format_functions.php";
    print "Finished purging compiled Phorum templates<br/>\n" . "Purged " . phorum_filesize($purged) . "<br/>";
    print "<br/>";
    print "DONE<br/><br/>";
}
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm("", "post", "Purge cache");
$frm->hidden("module", "cache_purge");
$frm->addbreak("Purging the Phorum cache");
$frm->addmessage("For improving performance, Phorum uses caching techniques for taking some load of the database and webserver. After running Phorum for some time, the amount of cached data will grow though. Using this maintenance tool, you can purge stale data from the Phorum cache to bring it back in size. Purging the cache will also cleanup all compiled template files.");
$frm->addrow("Cleanup all cache items, not only the expired ones", $frm->select_tag("purge_all", array("No", "Yes"), 0));
$frm->show();
Пример #4
0
function phorum_generate_language_file($lang, $displayname, $generate_new)
{
    global $fullfile;
    $basename = preg_replace('/-.*$/', '', $lang);
    $fullfile = $basename . '-' . PHORUM . '.php';
    // Get our default language file.
    $DEFAULT = phorum_get_language(PHORUM_DEFAULT_LANGUAGE);
    // Get the languagefile to update, unless generating a new language.
    $CURRENT = array();
    if (!$generate_new) {
        $CURRENT = phorum_get_language($lang);
    } else {
        $CURRENT['STORE']['language_hide'] = 0;
        $CURRENT['STORE']['language'] = urlencode("'" . addslashes($displayname) . "'");
    }
    // Keep a copy of the languagefile.
    $CURRENT_COPY = $CURRENT;
    // Collect all language strings from the distribution files.
    $language_strings = phorum_extract_language_strings();
    $frm = new PhorumInputForm("", "post", "Download new " . htmlspecialchars($fullfile) . " language file");
    $frm->hidden("module", "manage_languages");
    $frm->hidden("action", "download_lang");
    $frm->hidden("filename", $lang);
    if (!$generate_new) {
        $frm->addmessage("<h2>Update language: " . htmlspecialchars($displayname) . "</h2>" . "Below you will see all the things that have been updated " . "to get to the new version of the language file. At the " . "bottom of the page you will find a download button to download " . "the updated language file. This language file has to be placed " . "in <b>include/lang/" . htmlspecialchars($lang) . ".php</b> to make it " . "available to Phorum (backup your old file first of course!). " . "If new language strings have been added, " . "they will be marked with '***' in the language file, so it's " . "easy for you to find them.");
        $frm->addbreak("Updates for the new language file");
    } else {
        $frm->addmessage("<h2>Generate new language: " . htmlspecialchars($displayname) . "</h2>" . "A new language file has been generated. Below you will find " . "a download button to download the new file. In this file, you " . "can replace all language strings by strings which apply to " . "\"" . htmlspecialchars($displayname) . "\". After updating the new " . "file, you will have to place it in " . "<b>include/lang/" . htmlspecialchars($basename) . ".php</b>, " . "so Phorum can use it (backup your old file first of course!).");
    }
    $notifies = 0;
    // Check for language strings that are missing.
    $missing = array();
    $count_missing = 0;
    foreach ($language_strings as $string => $data) {
        // This one is special.
        if ($string == 'TIME') {
            continue;
        }
        // Multi-dimentional string? That must be a module lang string
        // (cut at PHORUM->LANG->myarray-|>word).
        if (preg_match('/-$/', $string)) {
            continue;
        }
        if (!isset($CURRENT["DATA"]["LANG"][$string])) {
            array_push($missing, $string);
            $translation = urlencode("'" . addslashes($string) . "'");
            if (isset($DEFAULT["DATA"]["LANG"][$string])) {
                $translation = $DEFAULT["DATA"]["LANG"][$string];
            }
            $CURRENT_COPY["DATA"]["LANG"][$string] = urlencode("'***'. " . urldecode($translation));
            $count_missing++;
            if (!$generate_new) {
                $frm->addrow("MISSING ({$count_missing})", $string);
                $notifies++;
            }
        } else {
            unset($CURRENT["DATA"]["LANG"][$string]);
        }
    }
    // Check for language strings that are deprecated.
    $deprecated = array();
    $count_deprecated = 0;
    if (!$generate_new) {
        foreach ($CURRENT["DATA"]["LANG"] as $string => $translation) {
            if ($string == 'TIME') {
                continue;
            }
            // This one is special.
            $count_deprecated++;
            $deprecated[$string] = true;
            // Only notify the deprecation if not already in deprecated state.
            if (!isset($CURRENT['STORE']['DEPRECATED'][$string])) {
                $frm->addrow("DEPRECATED ({$count_deprecated})", htmlspecialchars($string));
                $notifies++;
            }
        }
    }
    $CURRENT_COPY['STORE']['DEPRECATED'] = $deprecated;
    // Restore our full current language data from the copy.
    $CURRENT = $CURRENT_COPY;
    // Copy values from our default language to the current language.
    $copyfields = array('long_date', 'long_date_time', 'short_date', 'short_date_time', 'locale', 'thous_sep', 'dec_sep');
    foreach ($copyfields as $f) {
        if (!isset($CURRENT[$f])) {
            $CURRENT[$f] = $DEFAULT[$f];
            if (!$generate_new) {
                $frm->addrow("MISSING VARIABLE", "{$f} set to default " . htmlspecialchars(urldecode($DEFAULT[$f])));
                $notifies++;
            }
        }
    }
    // Copy default values beneath DATA to the current language.
    $datafields = array('CHARSET', 'HCHARSET', 'MAILENCODING', 'LANG_META');
    foreach ($datafields as $f) {
        if (!isset($CURRENT['DATA'][$f]) || $CURRENT['DATA'][$f] == '') {
            $CURRENT['DATA'][$f] = $DEFAULT['DATA'][$f];
            if (!$generate_new) {
                $frm->addrow("MISSING VARIABLE", "DATA->{$f} set to default " . htmlspecialchars(urldecode($DEFAULT['DATA'][$f])));
                $notifies++;
            }
        }
    }
    // Copy default values for timezone information to the current language.
    foreach ($DEFAULT['DATA']['LANG']['TIME'] as $key => $val) {
        if (!isset($CURRENT['DATA']['LANG']['TIME'][$key])) {
            $CURRENT['DATA']['LANG']['TIME'][$key] = $val;
            if (!$generate_new) {
                $dflt = htmlspecialchars(urldecode($DEFAULT['DATA']['LANG']['TIME'][$key]));
                $frm->addrow("MISSING TZINFO", "TZ {$key} set to default<br/>{$dflt}");
                $notifies++;
            }
        }
    }
    if ($generate_new) {
        $frm->addrow("COMPLETED", "A new language file has been generated for you");
    } elseif (!$notifies) {
        $frm->addrow("NONE", "There were no updates for the current \"{$lang}\" language file");
    }
    $frm->show();
    phorum_write_language_file($lang, $CURRENT);
}
Пример #5
0
                <input type="submit" name="confirm" value="Yes" />&nbsp;<input type="submit" name="confirm" value="No" />
            </form>
        </div>

        <?php 
} else {
    // load bad-words-list
    $banlists = phorum_db_get_banlists();
    $bad_words = $banlists[PHORUM_BAD_WORDS];
    include_once "./include/admin/PhorumInputForm.php";
    $frm = new PhorumInputForm("", "post", $submit);
    $frm->hidden("module", "badwords");
    $frm->hidden("curr", "{$curr}");
    $row = $frm->addbreak($title);
    if ($curr == 'NEW') {
        $frm->addmessage("This feature can be used to mask bad words in forum messages\n             with \"" . PHORUM_BADWORD_REPLACE . "\". All bad words will\n             automatically be replaced by that string. If you want to use\n             a different string (e.g. \"CENSORED\" or \"*****\"), then you\n             can change the definition of the constant\n             \"PHORUM_BADWORD_REPLACE\" in the Phorum file\n             include/constants.php.");
    }
    $row = $frm->addrow("Bad Word", $frm->text_box("string", $string, 50));
    $frm->addhelp($row, "Bad Word", "The word that you want to mask in forum messages.\n             Rules that apply to the matching are:\n             <ul>\n               <li><b>Only the full word</b> is matched, so \"foo\" would\n                   not mask (part of) \"foobar\";</li>\n               <li>The match is <b>case insensitive</b>, so \"foo\" would also\n                   mask \"FoO\".</li>\n             </ul>");
    $frm->addrow("Valid for Forum", $frm->select_tag("forum_id", $forum_list, $forum_id));
    $row = $frm->addrow('Comments', $frm->textarea('comments', $comments, 50, 7));
    $frm->addhelp($row, "Comments", "This field can be used to add some comments to the ban (why you\n             created it, when you did this, when the ban can be deleted, etc.)\n             These comments will only be shown on this page and are meant as\n             a means for the administrator to do some bookkeeping.");
    $frm->show();
    echo "<hr class=\"PhorumAdminHR\" />";
    if (count($bad_words)) {
        echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"PhorumAdminTable\" width=\"100%\">\n";
        echo "<tr>\n";
        echo "    <td class=\"PhorumAdminTableHead\">Word</td>\n";
        echo "    <td class=\"PhorumAdminTableHead\">Valid for Forum</td>\n";
        echo "    <td class=\"PhorumAdminTableHead\">&nbsp;</td>\n";
        echo "</tr>\n";
Пример #6
0
        }

        // Purge stale files from the database.
        phorum_db_file_purge_stale_files(true);
    }

    // Get a list of stale files.
    $purge_files = phorum_db_file_purge_stale_files();

    include_once "./include/admin/PhorumInputForm.php";
    $frm = new PhorumInputForm ("", "post", count($purge_files) ? "Purge stale files now" : "Refresh screen");

    $frm->hidden("module", "file_purge");

    $frm->addbreak("Purging stale files...");
    $frm->addmessage("If users write messages with attachments, but do not post them in the end, the attachment files will be left behind in the database. Using this maintenance tool, you can purge those stale files from your database.");

    if (count($purge_files)) {
        $frm->addbreak("There are currently " . count($purge_files) . 
                       " stale files in the database");
        foreach($purge_files as $id => $file) {
            $frm->addrow(htmlspecialchars($file["filename"]), phorum_filesize($file["filesize"]));
        }
    } else {
        $frm->addmessage("There are currently no stale files in the database");
    }

    $frm->show();


?>
Пример #7
0
// Retrieve a list of available modules.
$list = phorum_api_modules_list();
// ----------------------------------------------------------------------
// Process posted form data
// ----------------------------------------------------------------------
// Request for module information file?
if (isset($_GET['info']) && isset($_GET['mod'])) {
    $mod = basename($_GET['mod']);
    $file = basename($_GET['info']);
    if (($file == 'README' || $file == 'INSTALL' || $file == 'Changelog') && file_exists("./mods/{$mod}/{$file}")) {
        include_once "./include/admin/PhorumInputForm.php";
        $frm = new PhorumInputForm("", "post", "Back to Modules admin");
        $frm->hidden('module', 'mods');
        $frm->addbreak("{$file} for module {$mod}:");
        $info = file_get_contents("./mods/{$mod}/{$file}");
        $frm->addmessage("<pre>" . htmlspecialchars($info) . "</pre>");
        $frm->show();
    } else {
        phorum_admin_error("Denied access to illegal module information file request!");
    }
    return;
}
if (!empty($_POST['do_module_updates'])) {
    foreach ($list['modules'] as $mod => $info) {
        $key = base64_encode('mods_' . $mod);
        if (isset($_POST[$key])) {
            phorum_api_modules_enable($mod);
        } else {
            phorum_api_modules_disable($mod);
        }
    }
Пример #8
0
    $PHORUM["SANITY_CHECKS"]["CHECKS"][] = array('id' => $check["id"], 'description' => $check["description"], 'status' => $status, 'error' => $error, 'solution' => $solution);
    $PHORUM["SANITY_CHECKS"]["COUNTERS"][$status]++;
}
// If the sanity checks are called from the installation,
// the we're done.
if ($module == "install") {
    return;
}
// ========================================================================
// Build the sanity checking admin page.
// ========================================================================
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm("", "post", "Restart sanity checks");
$frm->hidden("module", "sanity_checks");
$frm->addbreak("Phorum System Sanity Checks");
$frm->addmessage("Below you will find the results for a number of sanity checks\n     that have been performed on your system. If you see any\n     warnings or errors, then read the comments for them and \n     try to resolve the issues.");
// Show sanity check results.
foreach ($PHORUM["SANITY_CHECKS"]["CHECKS"] as $check) {
    if ($check["status"] != PHORUM_SANITY_SKIP) {
        if (isset($check["error"])) {
            $check["error"] = str_replace("\n", " ", $check["error"]);
        }
        if (isset($check["solution"])) {
            $check["solution"] = str_replace("\n", " ", $check["solution"]);
        }
        $display = $status2display[$check["status"]];
        $block = "<div style=\"color:{$display[1]};background-color:{$display[0]};text-align:center;border:1px solid black;\">{$display[2]}</div>";
        $row = $frm->addrow($check['description'], $block);
        if (!empty($check["error"])) {
            if (!empty($check["solution"])) {
                $check["error"] .= "<br/><br/>" . "<strong>Possible solution:</strong>" . "<br/><br/>" . $check["solution"];
Пример #9
0
    ?>
" />
                <input type="hidden" name="delete" value="1" />
                <input type="submit" name="confirm" value="Yes" />&nbsp;<input type="submit" name="confirm" value="No" />
            </form>
        </div>

        <?php 
} else {
    include_once "./include/admin/PhorumInputForm.php";
    $frm = new PhorumInputForm("", "post", $submit);
    $frm->hidden("module", "banlist");
    $frm->hidden("curr", "{$curr}");
    $frm->addbreak($title);
    if ($curr == "NEW") {
        $frm->addmessage("Ban items can be used to deny new user registrations and\n             posting of (private) messages, based on various criteria.\n             If a ban item applies to a user action, then this action\n             will be fully blocked by Phorum. This can for example be used\n             to block user registrations and postings from certain IP\n             addresses or to prevent certain words from being used in\n             forum messages.<br />\n             <br />\n             If you want to fully ban a user, then it's best to\n             set \"Active\" to \"No\" for the user in the\n             \"Edit Users\" interface.");
    }
    $frm->addrow("String To Match", $frm->text_box("string", $string, 50));
    $row = $frm->addrow("Field To Match", $frm->select_tag("type", $ban_types, $type));
    $frm->addhelp($row, "Field To Match", "\n            Below, you will find an overview of what\n            ban items are used by what Phorum actions:<br/>\n            <br/>\n            <b>User registration</b>:<br/>\n            \"Name/User Name\" checks the new username<br/>\n            \"Email Address\" checks the new email address<br/>\n            \"IP Address/Hostname\" checks the visitor's IP<br/>\n            <br/>\n            <b>Posting forum messages by anonymous users</b><br/>\n            \"Name/User Name\" checks the author's name<br/>\n            \"Email Address\" checks the author's email address<br/>\n            \"Illegal Words (SPAM)\" checks the subject and body<br/>\n            \"IP Address/Hostname\" checks the author's IP<br/>\n            <br/>\n            <b>Posting forum messages by registered users</b><br/>\n            \"Name/User Name\" checks the author's username<br/>\n            \"User-Id (registered User)\" checks the author's user id<br/>\n            \"Email Address\" checks the author's email address<br/>\n            \"IP Address/Hostname\" checks the author's IP<br/>\n            \"Illegal Words (SPAM)\" checks the subject and body<br/>\n            <br/>\n            <b>Posting private messages</b><br/>\n            \"Name/User Name\" checks the sender's username<br/>\n            \"User-Id (registered User)\" checks the sender's user id<br/>\n            \"Email Address\" checks the sender's email address<br/>\n            \"IP Address/Hostname\" checks the sender's IP\n        ");
    $row = $frm->addrow("Compare As", $frm->select_tag("pcre", $match_types, $pcre) . "<div style=\"font-size:x-small\">If using PCRE for comparison, \"String To Match\" should be a valid PCRE expression.<br/>See <a href=\"http://php.net/pcre\" target=\"_blank\">the PHP manual</a> for more information about PCRE.</div>");
    $frm->addhelp($row, "Compare As", "\n            This setting can be used to specify the matching method\n            that has to be used for the ban item. There are two options:<br/>\n            <br/>\n            <ul>\n              <li><b>String</b><br/>\n                  The exact string from the \"String To Match\" field\n                  will be used for matching. Wildcards are not available\n                  for the String field type.<br/><br/></li>\n\n              <li><b>PCRE</b><br/>\n                  The \"String To Match\" field will be treated as\n                  a <a href=\"http://www.php.net/pcre\">Perl Compatible\n                  Regular Expression</a>.</li>\n            </ul>\n        ");
    $frm->addrow("Valid for Forum", $frm->select_tag("forum_id", $forum_list, $forum_id));
    $row = $frm->addrow('Comments', $frm->textarea('comments', $comments, 50, 7));
    $frm->addhelp($row, "Comments", "This field can be used to add some comments to the ban (why you\n             created it, when you did this, when the ban can be deleted, etc.)\n             These comments will only be shown on this page and are meant as\n             a means for the administrator to do some bookkeeping.");
    $frm->show();
    if ($curr == "NEW") {
        $PHORUM['banlists'] = phorum_db_get_banlists(true);
        unset($PHORUM['banlists'][PHORUM_BAD_WORDS]);
        echo "<hr class=\"PhorumAdminHR\" />";
        if (count($PHORUM['banlists'])) {
Пример #10
0
        list($dummy, $upgrade) = each($upgrades);
        $message = phorum_dbupgrade_run($upgrade);
        // Show the results.
        $frm = new PhorumInputForm("", "post", "Continue -&gt;");
        $frm->addbreak("Upgrading Phorum (multiple steps possible) ...");
        $w = floor($index / $count * 100);
        $frm->addmessage('<table><tr><td>' . '<div style="height:20px;width:300px; border:1px solid black">' . '<div style="height:20px;width:' . $w . '%; background-color:green">' . '</div></div></td><td style="padding-left:10px">' . 'upgrade ' . $index . " of " . $count . '</td></tr></table>');
        $frm->addmessage($message);
        $frm->hidden("step", 1);
        $frm->hidden("module", "upgrade");
        $frm->hidden("is_module_upgrade", $is_module_upgrade);
        $frm->hidden("upgradeindex", $index);
        $frm->hidden("upgradecount", $count);
        $frm->show();
        break;
        // Step 2: the upgrade has been completed.
    // Step 2: the upgrade has been completed.
    case 2:
        // Show the results.
        $base_url = phorum_admin_build_url();
        $frm = new PhorumInputForm("", "post", "Finish");
        $frm->addbreak("The upgrade is complete");
        $frm->addmessage("You may want to look through the " . "<a href=\"{$base_url}\">the admin interface</a> " . "for any new features in this version.");
        $frm->show();
        break;
        // Safety net for illegal step values.
    // Safety net for illegal step values.
    default:
        print "Internal error: illegal upgrading step " . htmlspecialchars($step) . " requested.";
        return;
}
Пример #11
0
        $updated = 0;
        while ($user = phorum_db_fetch_row($res, DB_RETURN_ASSOC)) {
            $updated++;
            // We save an empty user, to make sure that the display name in the
            // database is up-to-date. This will already run needed updates in
            // case the display name changed ...
            phorum_api_user_save(array("user_id" => $user["user_id"]));
            // ... but still we run the name updates here, so inconsitencies
            // are flattened out.
            $user = phorum_api_user_get($user["user_id"]);
            phorum_db_user_display_name_updates(array("user_id" => $user["user_id"], "display_name" => $user["display_name"]));
        }
        if ($updated == 0) {
            $frm = new PhorumInputForm("", "post", "Finish");
            $frm->addbreak("Display names updated");
            $frm->addmessage("The display names are all updated successfully.");
            $frm->show();
            return;
        }
    }
    // Retrieve user count.
    $user_count = isset($_REQUEST['user_count']) ? (int) $_REQUEST['user_count'] : phorum_db_user_count();
    $perc = floor(($batch + 1) * $batchsize / $user_count * 100);
    if ($perc > 100) {
        $perc = 100;
    }
    ?>

    <strong>Running display name updates.</strong><br/>
    <strong>This might take a while ...</strong><br/><br/>
    <table><tr><td>
Пример #12
0
if(count($_POST)){
    $PHORUM["fsattachments"]["path"]=$_POST["path"];

    if(!phorum_db_update_settings(array("fsattachments"=>$PHORUM["fsattachments"]))){
        $error="Database error while updating settings.";
    }
    else {
        echo "Settings Updated<br />";
    }
}

include_once "./include/admin/PhorumInputForm.php";

$frm = new PhorumInputForm ("", "post", "Save");

$frm->hidden("module", "modsettings");
$frm->hidden("mod", "fsattachments"); // this is the directory name that the Settings file lives in

if (!empty($error)){
    echo "$error<br />";
}

$frm->addbreak("Edit settings for the Filesystem Attachment Storage module");

$frm->addmessage("This is the directory where files will be stored on disk.  You need to enter a full path to the directory.  It is up to you to ensure that the web server daemon can write to this directory.");

$frm->addrow("Directory where files are kept: ", $frm->text_box("path", $PHORUM["fsattachments"]["path"], 50));

$frm->show();

?>
Пример #13
0
        if(!phorum_db_update_settings(array("mod_bb_code"=>$PHORUM["mod_bb_code"]))){
            $error="Database error while updating settings.";
        }
        else {
            echo "Settings Updated<br />";
        }
    }

    include_once "./include/admin/PhorumInputForm.php";
    $frm = new PhorumInputForm ("", "post", "Save");
    $frm->hidden("module", "modsettings");
    $frm->hidden("mod", "bbcode"); // this is the directory name that the Settings file lives in

    if (!empty($error)){
        echo "$error<br />";
    }
    $frm->addbreak("Edit settings for the BBCode module");
    $frm->addmessage("When users post links on your forum, you can choose whether they open in a new window.");
    $frm->addrow("Open links in new window: ", $frm->checkbox("links_in_new_window", "1", "", $PHORUM["mod_bb_code"]["links_in_new_window"]));
    $frm->addmessage("Enable <a href=\"http://en.wikipedia.org/wiki/Blog_spam\" target=\"_blank\">
        Google's new anti-spam protocol</a> for links posted on your forums.
        <br/>
        Note, this doesn't stop spam links being posted, but it does mean that
        spammers don't get credit from Google from that link.");
    $frm->addrow("Use 'rel=nofollow' anti-spam tag: ", $frm->checkbox("rel_no_follow", "1", "", $PHORUM["mod_bb_code"]["rel_no_follow"]));
    $frm->addmessage("As of Phorum 5.1, there is the option to have quoted text altered by modules.  Since it only makes sense to have one module modifying the quoted text, you can disable this one part of this module.");

    $frm->addrow("Enable quote hook", $frm->checkbox("quote_hook", "1", "", $PHORUM["mod_bb_code"]["quote_hook"]));
    $frm->show();
?>
Пример #14
0
$frm->addbreak("Interactive CAPTCHA");
$row = $frm->addrow("Let visitors solve a CAPTCHA when registering a new account?", $frm->checkbox("register_captcha", 1, "Yes", $PHORUM["mod_spamhurdles"]["register_captcha"]));
$frm->addhelp($row, "Registering CAPTCHA", "If this option is enabled, a CAPTCHA (Completely Automated Public Turing-test to tell Computers and Humans Apart) will be used when visitors are registering a new user account. A check is added to the registering process, where the user has to prove that he/she is a human, by solving a simple puzzle. Below you can specify which type of CAPTCHA to use for this.<br/><br/><b>User impact:</b><br/>The user will have to solve the CAPTCHA before a new account can be registered. So this will require an extra action by the user. The exact user impact depends on the type of CAPTCHA that is used.");
$row = $frm->addrow("Let visitors solve a CAPTCHA when posting a new message", $frm->select_tag("posting_captcha", $userspec, $PHORUM["mod_spamhurdles"]["posting_captcha"]));
$frm->addhelp($row, "Posting CAPTCHA", "If this option is enabled, a CAPTCHA (Completely Automated Public Turing-test to tell Computers and Humans Apart) will be used when posting a new message. A check is added to the posting process, where the user has to prove that he/she is a human, by solving a simple puzzle. Below you can specify which type of CAPTCHA to use for this.<br/><br/><b>User impact:</b><br/>The user will have to solve the CAPTCHA before a message can be posted. So this will require an extra action by the user. The exact user impact depends on the type of CAPTCHA that is used.");
$captchaspec = array('javascript' => 'Code, drawn using JavaScript', 'image' => 'Code, drawn using a GIF image', 'asciiart' => 'Code, drawn using ASCII art', 'plaintext' => 'Code, plain text format', 'maptcha' => 'Solve a simple math question', 'recaptcha' => 'Code, using the reCAPTCHA service');
$row = $frm->addrow("Which type of CAPTCHA?", $frm->select_tag("captcha_type", $captchaspec, $PHORUM["mod_spamhurdles"]["captcha_type"], "id=\"captcha_select\" onchange=\"handle_captcha_select()\""));
$frm->addhelp($row, "Type of CAPTCHA", "This module supports a wide range of CAPTCHA types. See the README that was bundled with this module for detailed information on these types and for deciding which one you want to use for your site.");
$row = $frm->addrow("Enable spoken CAPTCHA? You will need the program \"Flite\" for this.", $frm->checkbox("spoken_captcha", 1, "Yes", $PHORUM["mod_spamhurdles"]["spoken_captcha"]));
$frm->addhelp($row, "Enable spoken CAPTCHA", 'Vision impaired people can have trouble reading and thus solving a CAPTCHA. For those people, you can supply a spoken CAPTCHA code. To be able to use this option, the program "Flite" (Festival-Lite) has to be installed on the webserver. For information on this, see http://www.speech.cs.cmu.edu/flite/');
$warn = '';
if (!empty($PHORUM["mod_spamhurdles"]["flite_location"]) && !file_exists($PHORUM["mod_spamhurdles"]["flite_location"])) {
    $warn = '<div style="color:red">The flite program does not exist at the specified location</div>';
}
$row = $frm->addrow("What is full path of the \"flite\" executable? (e.g. /usr/bin/flite){$warn}", $frm->text_box("flite_location", $PHORUM["mod_spamhurdles"]["flite_location"], 30));
$frm->addmessage("<div id=\"settings_recaptcha\" class=\"input-form-td\"\n           style=\"margin:0; padding:10px; border: 1px solid navy\">\n      For using reCAPTCHA, you need a (free) public and private key.\n      Please signup at <a href=\"http://recaptcha.net\" target=\"_new\">the\n      reCAPTCHA</a> web site and enter the public and private key for your\n      web site's domain in the fields below.<br/><br/>\n      <table><tr><td>public key</td><td>" . $frm->text_box("recaptcha_pubkey", $PHORUM["mod_spamhurdles"]["recaptcha_pubkey"], 40) . "</td></tr>" . "<tr><td>private key</td><td>" . $frm->text_box("recaptcha_prvkey", $PHORUM["mod_spamhurdles"]["recaptcha_prvkey"], 40) . "</td></tr></table>\n      </div>");
$frm->show();
?>

<script type="text/javascript">
//<![CDATA[
function handle_captcha_select()
{
    if (! document.getElementById) return;
    sel = document.getElementById("captcha_select");
    set = document.getElementById("settings_recaptcha");
    captcha_id = sel.options[sel.selectedIndex].value;

    set.style.display = (captcha_id == 'recaptcha' ? 'block' : 'none');
}
//]]>
Пример #15
0
                    $err = true;
                }
                elseif ($fp = fopen($PHORUM["cache"] . "/phorum-install-test", "w+")) {
                    unlink($PHORUM["cache"] . "/phorum-install-test");
                }
                else {
                    $err = true;
                }

            }
            error_reporting(E_WARN);
            if ($message == "") {
                if($err){
                    $message.="Your cache directory is not writable. Please change the permissions on '/cache' inside the Phorum directory to allow writing. In Unix, you may have to use this command: chmod 777 cache<br /><br />If you want to continue anyway and set a cache directory manually, press continue. Note that you must do this, Phorum will not work without a valid cache.";
                } else {
                    $message.="Cache directory set.  Next we will create a user with administrator privileges.  Press continue when ready.";
                }
            }

            $frm = new PhorumInputForm ("", "post", "Continue ->");
            $frm->hidden("module", "install");
            $frm->addbreak("Checking cache....");
            $frm->addmessage($message);
            $frm->hidden("step", "4");
            $frm->show();

            break;
    }

?>
Пример #16
0
if (!isset($PHORUM["mod_example_settings"]["displaytext"])) {
    $PHORUM["mod_example_settings"]["displaytext"] = "";
}
if (!isset($PHORUM["mod_example_settings"]["displaycount"])) {
    $PHORUM["mod_example_settings"]["displaycount"] = 1;
}
// We build the settings form by using the PhorumInputForm object. When
// creating your own settings screen, you'll only have to change the
// "mod" hidden parameter to the name of your own module.
require_once './include/admin/PhorumInputForm.php';
$frm = new PhorumInputForm("", "post", "Save");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "example_settings");
// Here we display an error in case one was set by saving
// the settings before.
if (!empty($error)) {
    echo "{$error}<br />";
}
// This adds a break line to your form, with a description on it.
// You can use this to separate your form into multiple sections.
$frm->addbreak("Edit settings for the example_settings module");
// This adds a text message to your form. You can use this to
// explain things to the user.
$frm->addmessage("This is the settings screen for the example_settings module. This module is only written for demonstrating the use of a settings screen for you own modules. The module itself will display a configurable text for a configurable number of times on screen.");
// This adds a row with a form field for entering the display text.
$frm->addrow("Text to display (default: Hello, world!)", $frm->text_box('displaytext', $PHORUM["mod_example_settings"]["displaytext"], 50));
// This adds another row with a form field for entering the display count.
$frm->addrow("Number of times to display", $frm->text_box('displaycount', $PHORUM["mod_example_settings"]["displaycount"], 5));
// We are done building the settings screen.
// By calling show(), the screen will be displayed.
$frm->show();
Пример #17
0
 case "done":
     $cont_url = phorum_admin_build_url();
     $PHORUM['DB']->update_settings(array("installed" => 1));
     echo "The setup is complete.  You can now go to <a href=\"{$cont_url}\">the admin</a> and start making Phorum all your own.<br /><br /><strong>Here are some things you will want to look at:</strong><br /><br /><a href=\"{$_SERVER['PHP_SELF']}?module=settings\">The General Settings page</a><br /><br /><a href=\"{$_SERVER['PHP_SELF']}?module=mods\">Pre-installed modules</a><br /><br /><a href=\"docs/faq.txt\">The FAQ</a><br /><br /><a href=\"docs/performance.txt\">How to get peak performance from Phorum</a><br /><br /><strong>For developers:</strong><br /><br /><a href=\"docs/creating_mods.txt\">Module Creation</a><br /><br /><a href=\"docs/permissions.txt\">How Phorum permisssions work</a><br /><br /><a href=\"docs/CODING-STANDARDS\">The Phorum Team's codings standards</a>";
     break;
 case "modules":
     // Retrieve a list of available modules.
     require_once './include/api/modules.php';
     $list = phorum_api_modules_list();
     $frm = new PhorumInputForm("", "post", "Continue ->");
     $frm->addbreak("Optional modules");
     $frm->hidden("module", "install");
     $frm->hidden("sanity_checks_done", "1");
     $frm->hidden("step", "modules");
     $frm->hidden("do_modules_update", "1");
     $frm->addmessage("Phorum has a very robust module system.  The following modules are\n             included with the distribution.  You can find more modules at the\n             Phorum web site.  Some modules may have additional configuration\n             options, which are not available during install.  To configure the\n             modules, click the \"Modules\" menu item in the admin interface\n             after installation is done.");
     foreach ($list['modules'] as $name => $info) {
         // Skip the compatibility modules.
         // These are enabled automatically by Phorum when required.
         if (!empty($info['compat'])) {
             continue;
         }
         // Should not happen.
         if ($info['version_disabled']) {
             continue;
         }
         $text = $info["title"];
         if (isset($info["desc"])) {
             $text .= "<div class=\"small\">" . wordwrap($info["desc"], 90, "<br />") . "</div>";
         }
         $frm->addrow($text, $frm->select_tag(base64_encode("mods_{$name}"), array("Off", "On"), $info['enabled']));
Пример #18
0
        }
        // Run the first upgrade from the list of available upgrades.
        list($dummy, $upgrade) = each($upgrades);
        $message = phorum_dbupgrade_run($upgrade);
        // Show the results.
        $frm = new PhorumInputForm("", "post", "Continue -&gt;");
        $frm->addbreak("Upgrading tables (multiple steps possible) ...");
        $w = floor($index / $count * 100);
        $frm->addmessage('<table><tr><td>' . '<div style="height:20px;width:300px; border:1px solid black">' . '<div style="height:20px;width:' . $w . '%; background-color:green">' . '</div></div></td><td style="padding-left:10px">' . 'upgrade ' . $index . " of " . $count . '</td></tr></table>');
        $frm->addmessage($message);
        $frm->hidden("step", 1);
        $frm->hidden("module", "upgrade");
        $frm->hidden("upgradeindex", $index);
        $frm->hidden("upgradecount", $count);
        $frm->show();
        break;
        // Step 2: the upgrade has been completed.
    // Step 2: the upgrade has been completed.
    case 2:
        // Show the results.
        $frm = new PhorumInputForm("", "post", "Finish");
        $frm->addbreak("The upgrade is complete");
        $frm->addmessage("You may want to look through the " . "<a href=\"{$PHORUM["admin_http_path"]}\">the admin interface</a> " . "for any new features in this version.");
        $frm->show();
        break;
        // Safety net for illegal step values.
    // Safety net for illegal step values.
    default:
        print "Internal error: illegal upgrading step " . htmlspecialchars($step) . " requested.";
        return;
}