• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phorum_db_update_settings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中phorum_db_update_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_db_update_settings函数的具体用法?PHP phorum_db_update_settings怎么用?PHP phorum_db_update_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了phorum_db_update_settings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: event_logging_db_install

/**
 * This function will check if an upgrade of the database scheme is needed.
 * It is generic for all database layers.
 */
function event_logging_db_install()
{
    $PHORUM = $GLOBALS["PHORUM"];
    $version = isset($PHORUM["mod_event_logging_installed"]) ? $PHORUM["mod_event_logging_installed"] : 0;
    while ($version < EVENT_LOGGING_DB_VERSION) {
        // Initialize the settings array that we will be saving.
        $version++;
        $settings = array("mod_event_logging_installed" => $version);
        $sqlfile = "./mods/event_logging/db/" . $PHORUM["DBCONFIG"]["type"] . "/{$version}.php";
        if (!file_exists($sqlfile)) {
            print "<b>Unexpected situation on installing " . "the Event Logging module</b>: " . "unable to find the database schema setup script " . htmlspecialchars($sqlfile);
            return false;
        }
        $sqlqueries = array();
        include $sqlfile;
        if (count($sqlqueries) == 0) {
            print "<b>Unexpected situation on installing " . "the Event Logging module</b>: could not read any SQL " . "queries from file " . htmlspecialchars($sqlfile);
            return false;
        }
        $err = phorum_db_run_queries($sqlqueries);
        if ($err) {
            print "<b>Unexpected situation on installing " . "the Event Logging module</b>: running the " . "install queries from file " . htmlspecialchars($sqlfile) . " failed. The error was " . htmlspecialchars($err);
            return false;
        }
        // Save our settings.
        if (!phorum_db_update_settings($settings)) {
            print "<b>Unexpected situation on installing " . "the Event Logging module</b>: updating the " . "mod_event_logging_installed setting failed";
            return false;
        }
    }
    return true;
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:36,代码来源:db.php


示例2: spamhurdles_db_install

function spamhurdles_db_install()
{
    $version = isset($GLOBALS["PHORUM"]["mod_spamhurdles_installed"]) ? $GLOBALS["PHORUM"]["mod_spamhurdles_installed"] : 0;
    while ($version < SPAMHURDLES_DB_VERSION) {
        // Initialize the settings array that we will be saving.
        $version++;
        $settings = array("mod_spamhurdles_installed" => $version);
        $sqlfile = "./mods/spamhurdles/db/" . $GLOBALS["PHORUM"]["DBCONFIG"]["type"] . "/{$version}.php";
        if (!file_exists($sqlfile)) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: unable to find the database " . "scheme setup script " . htmlspecialchars($sqlfile);
            return false;
        }
        $sqlqueries = array();
        include $sqlfile;
        if (count($sqlqueries) == 0) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: could not read any SQL " . "queries from file " . htmlspecialchars($sqlfile);
            return false;
        }
        $err = phorum_db_run_queries($sqlqueries);
        if ($err) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: running the " . "install queries from file " . htmlspecialchars($sqlfile) . " failed: " . htmlspecialchars($err);
            return false;
        }
        // Save our settings.
        if (!phorum_db_update_settings($settings)) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: updating the " . "mod_spamhurdles_installed setting failed";
            return false;
        }
    }
    return true;
}
开发者ID:sheldon,项目名称:dejavu,代码行数:31,代码来源:db.php


示例3: phorum_htmlpurifier_migrate_sigs_check

function phorum_htmlpurifier_migrate_sigs_check()
{
    global $PHORUM;
    $offset = 0;
    if (!empty($_POST['migrate-sigs'])) {
        if (!isset($_POST['confirmation']) || strtolower($_POST['confirmation']) !== 'yes') {
            echo 'Invalid confirmation code.';
            exit;
        }
        $PHORUM['mod_htmlpurifier']['migrate-sigs'] = TRUE;
        phorum_db_update_settings(array("mod_htmlpurifier" => $PHORUM["mod_htmlpurifier"]));
        $offset = 1;
    } elseif (!empty($_GET['migrate-sigs']) && $PHORUM['mod_htmlpurifier']['migrate-sigs']) {
        $offset = (int) $_GET['migrate-sigs'];
    }
    return $offset;
}
开发者ID:gitanton,项目名称:cono-rest,代码行数:17,代码来源:migrate-sigs.php


示例4: spamhurdles_db_init

function spamhurdles_db_init()
{
    global $PHORUM;
    $layerpath = "./mods/spamhurdles/db/{$PHORUM["DBCONFIG"]["type"]}";
    // Allow db layers to provide an initialization script of their own.
    // The main goal for this script is to allow a db layer to override the
    // $PHORUM['spamhurdles_table'] variable.
    if (file_exists("{$layerpath}/db.php")) {
        require_once "{$layerpath}/db.php";
    }
    $version = isset($PHORUM["mod_spamhurdles_installed"]) ? $PHORUM["mod_spamhurdles_installed"] : 0;
    while ($version < SPAMHURDLES_DB_VERSION) {
        // Initialize the settings array that we will be saving.
        $version++;
        $settings = array("mod_spamhurdles_installed" => $version);
        $sqlfile = "{$layerpath}/{$version}.php";
        if (!file_exists($sqlfile)) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: unable to find the database " . "scheme setup script " . htmlspecialchars($sqlfile);
            return false;
        }
        $sqlqueries = array();
        include $sqlfile;
        if (count($sqlqueries) == 0) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: could not read any SQL " . "queries from file " . htmlspecialchars($sqlfile);
            return false;
        }
        $err = phorum_db_run_queries($sqlqueries);
        if ($err) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: running the " . "install queries from file " . htmlspecialchars($sqlfile) . " failed: " . htmlspecialchars($err);
            return false;
        }
        // Save our settings.
        if (!phorum_db_update_settings($settings)) {
            print "<b>Unexpected situation on installing " . "the Spam Hurdles module</b>: updating the " . "mod_spamhurdles_installed setting failed";
            return false;
        }
    }
    return true;
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:39,代码来源:db.php


示例5: phorum_api_modules_check_updated_info

/**
 * Check if there are modules for which the module information is updated.
 *
 * @param boolean $do_reset
 *     If this parameter has a true value, then the active status for
 *     the module information is stored in the database.
 *
 * @return array
 *     An array of module names for which the module information was updated.
 */
function phorum_api_modules_check_updated_info($do_reset = FALSE)
{
    global $PHORUM;
    $existing = empty($PHORUM['mod_info_timestamps']) ? array() : $PHORUM['mod_info_timestamps'];
    $new = array();
    $need_update = array();
    if (!empty($PHORUM['mods'])) {
        foreach ($PHORUM['mods'] as $mod => $active) {
            if (!$active) {
                continue;
            }
            $info = "./mods/{$mod}/info.txt";
            $filemod = "./mods/{$mod}.php";
            if (file_exists($info)) {
                $time = @filemtime($info);
            } elseif (file_exists($filemod)) {
                $time = @filemtime($filemod);
            } else {
                continue;
            }
            if (!isset($existing[$mod]) || $existing[$mod] != $time) {
                $need_update[] = $mod;
            }
            $new[$mod] = $time;
        }
    }
    $PHORUM['mod_info_timestamps'] = $new;
    // Store the settings in the database if a reset is requested.
    if ($do_reset) {
        phorum_db_update_settings(array("mod_info_timestamps" => $new));
    }
    return $need_update;
}
开发者ID:sheldon,项目名称:dejavu,代码行数:43,代码来源:modules.php


示例6: unset

                }
                $_POST[$field] = $private_key;
                break;
            case "display_name_source":
                if ($_POST[$field] != $PHORUM["display_name_source"]) {
                    $need_display_name_updates = TRUE;
                }
                break;
        }
        if ($error) {
            break;
        }
    }
    if (empty($error)) {
        unset($_POST["module"]);
        if (phorum_db_update_settings($_POST)) {
            $redir = $PHORUM["admin_http_path"];
            if ($need_display_name_updates) {
                $redir .= "?module=update_display_names";
            }
            phorum_redirect_by_url($redir);
            exit;
        } else {
            $error = "Database error while updating settings.";
        }
    }
}
if ($error) {
    phorum_admin_error($error);
}
// create the time zone drop down array
开发者ID:sheldon,项目名称:dejavu,代码行数:31,代码来源:settings.php


示例7: flush



    $upgradefile=$upgradepath.$file;

    if(file_exists($upgradefile)) {
        echo "Upgrading from db-version $fromversion to $pure_version ... \n";
        flush();

        if (! is_readable($upgradefile))
        die("$upgradefile is not readable. Make sure the file has got the neccessary permissions and try again.");


        $upgrade_queries=array();
        include($upgradefile);
        $err=phorum_db_run_queries($upgrade_queries);
        if($err){
            echo "an error occured: $err ... try to continue.\n";
        } else {
            echo "done.\n";
        }
        $GLOBALS["PHORUM"]["internal_version"]=$pure_version;
        phorum_db_update_settings(array("internal_version"=>$pure_version));
    } else {
        echo "Ooops, the upgradefile is missing. How could this happen?\n";
    }

    $fromversion=$pure_version;

}
?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:28,代码来源:console_upgrade.php


示例8: array

//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
if (!defined("PHORUM_ADMIN")) {
    return;
}
$error = "";
if (count($_POST)) {
    // some sanity checking would be nice ;)
    $PHORUM["smtp_mail"] = array('host' => $_POST['host'], 'port' => empty($_POST['port']) ? "25" : $_POST['port'], 'auth' => $_POST['auth'], 'username' => $_POST['auth_username'], 'password' => $_POST['auth_password'], 'conn' => $_POST['conn'], 'log_successful' => $_POST['log_successful'], 'show_errors' => $_POST['show_errors']);
    if (empty($error)) {
        phorum_db_update_settings(array("smtp_mail" => $PHORUM["smtp_mail"]));
        phorum_admin_okmsg("Settings updated");
    }
}
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm("", "post", "Save");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "smtp_mail");
$frm->addbreak("Settings for the SMTP Mail Module");
$frm->addrow("Hostname of mailserver", $frm->text_box("host", $PHORUM['smtp_mail']['host'], 50));
$frm->addrow("Port of mailserver", $frm->text_box("port", $PHORUM['smtp_mail']['port'], 5) . " (Default Port is 25, unencrypted. Encrypted Port is usually 465)");
$frm->addrow("Connection Type", $frm->select_tag("conn", array('plain' => 'Plain Connection', 'ssl' => 'SSL-Encryption', 'tls' => 'TLS-Encryption'), $PHORUM['smtp_mail']['conn']) . " (e.g. Google-Mail connection needs TLS)");
$frm->addrow("Use SMTP Auth", $frm->select_tag("auth", array(1 => 'Yes', 0 => 'No'), $PHORUM['smtp_mail']['auth']));
$frm->addrow("SMTP Auth Username", $frm->text_box("auth_username", $PHORUM['smtp_mail']['username'], 50));
$frm->addrow("SMTP Auth Password", $frm->text_box("auth_password", $PHORUM['smtp_mail']['password'], 50, 0, true));
$frm->addsubbreak("Logging / Errorhandling");
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:settings.php


示例9: phorum_db_update_settings

<?php

if (!defined("PHORUM_ADMIN")) {
    return;
}
// initialize the "allow_pm_email_notify" setting
if (!isset($PHORUM["allow_pm_email_notify"])) {
    phorum_db_update_settings(array("allow_pm_email_notify" => 1));
}
开发者ID:mgs2,项目名称:kw-forum,代码行数:9,代码来源:2007092900.php


示例10: PhorumInputForm

<?php

if(!defined("PHORUM_ADMIN")) return;

// save settings
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.");
开发者ID:nistormihai,项目名称:Newscoop,代码行数:30,代码来源:settings.php


示例11: phorum_db_update_settings

<?php

////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//   Copyright (C) 2007  Phorum Development Team                              //
//   http://www.phorum.org                                                    //
//                                                                            //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of either the current Phorum License (viewable at     //
//   phorum.org) or the Phorum License that was distributed with this file    //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////
if (!defined("PHORUM_ADMIN")) {
    return;
}
phorum_db_update_settings(array("status" => $_POST["status"]));
phorum_redirect_by_url($PHORUM["admin_http_path"]);
exit;
开发者ID:sheldon,项目名称:dejavu,代码行数:24,代码来源:status.php


示例12: unset

         $_POST["inherit_id"] = "NULL";
         unset($_POST["pub_perms"]);
         unset($_POST["reg_perms"]);
     }
 }
 if (defined("PHORUM_EDIT_FORUM") || defined("PHORUM_DEFAULT_OPTIONS")) {
     $forum_settings = $_POST;
     if (defined("PHORUM_DEFAULT_OPTIONS")) {
         // these two will not be set if no options were checked
         if (empty($forum_settings["pub_perms"])) {
             $forum_settings["pub_perms"] = 0;
         }
         if (empty($forum_settings["reg_perms"])) {
             $forum_settings["reg_perms"] = 0;
         }
         $res = phorum_db_update_settings(array("default_forum_options" => $forum_settings));
     } else {
         $res = phorum_db_update_forum($forum_settings);
         // set/build the forum_path
         $cur_forum_id = $forum_settings['forum_id'];
         $built_paths = phorum_admin_build_path_array($cur_forum_id);
         phorum_db_update_forum(array('forum_id' => $cur_forum_id, 'forum_path' => $built_paths[$cur_forum_id]));
     }
     // setting the current settings to all forums/folders inheriting from this forum/default settings
     $forum_inherit_settings = phorum_db_get_forums(false, false, false, intval($_POST["forum_id"]));
     foreach ($forum_inherit_settings as $inherit_setting) {
         $forum_settings["forum_id"] = $inherit_setting["forum_id"];
         // We don't need to inherit this settings
         unset($forum_settings["name"]);
         unset($forum_settings["description"]);
         unset($forum_settings["active"]);
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:newforum.php


示例13: isset

<?php

if (!defined("PHORUM_ADMIN")) {
    return;
}
// For shorter writing.
$settings =& $GLOBALS["PHORUM"]["mod_event_logging"];
$eventtypes =& $GLOBALS["PHORUM"]["DATA"]["MOD_EVENT_LOGGING"]["EVENT_TYPES"];
if (count($_POST)) {
    $settings["resolve_hostnames"] = isset($_POST["resolve_hostnames"]) ? 1 : 0;
    $settings["max_log_entries"] = (int) $_POST["max_log_entries"];
    $settings["min_log_level"] = (int) $_POST["min_log_level"];
    foreach ($eventtypes as $type => $desc) {
        $settings["do_log_{$type}"] = isset($_POST["do_log_{$type}"]) ? 1 : 0;
    }
    phorum_db_update_settings(array("mod_event_logging" => $settings));
    phorum_admin_okmsg("The settings were successfully saved.");
}
// Create the settings form.
include_once "./include/admin/PhorumInputForm.php";
$frm = new PhorumInputForm("", "post", "Save settings");
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "event_logging");
$frm->hidden("el_action", "settings");
$frm->addbreak("General Settings");
$row = $frm->addrow("Minimum log level", $frm->select_tag("min_log_level", $GLOBALS["PHORUM"]["DATA"]["MOD_EVENT_LOGGING"]["LOGLEVELS"], $settings["min_log_level"]));
$frm->addhelp($row, "Minimum log level", "This option configures the minimum log level for which log messages are written to the event log. Events with a lower log level will not be written.<br/><br/>\"Debug\" is the lowest log level and \"Alert\" the highest, so to log all events, set this option to \"Debug\".");
$row = $frm->addrow("Maximum amount of stored event logs (0 = unlimited)", $frm->text_box("max_log_entries", $settings["max_log_entries"], 5));
$frm->addhelp($row, "Maximum amount of stored event logs", "This option configures the maximum amount of event logs that can be stored in the database at a given time. If the amount of event logs grows larger than this configured maximum, then old entries will be automatically cleaned up.<br/><br/>If you do not want a limit on the number of event logs, then set this option to 0 (zero).");
$row = $frm->addrow("Resolve IP addresses to host names when writing the event log", $frm->checkbox("resolve_hostnames", "1", "", $settings["resolve_hostnames"]));
$frm->addhelp($row, "Resolve IP addresses", "If this option is enabled, the IP address of the visitor will immediately be resolved into its hostname. Enabling this option can result in delays for the user, in case hostname lookups are slow for some reason.<br/><br/><b>Because of the performance penalty, we do not recommend enabling this option, unless you really need it and know what you are doing.</b>");
开发者ID:sheldon,项目名称:dejavu,代码行数:31,代码来源:settings.php


示例14: array

$curr = "NEW";
$ban_types = array(PHORUM_BAD_IPS => "IP Address/Hostname", PHORUM_BAD_NAMES => "Name/User Name", PHORUM_BAD_EMAILS => "Email Address", PHORUM_BAD_USERID => "User-Id (registered User)", PHORUM_BAD_SPAM_WORDS => "Illegal Words (SPAM)");
$match_types = array("String", "PCRE");
$forum_list = phorum_get_forum_info(2);
$forum_list[0] = "GLOBAL";
if (count($_POST) && $_POST["string"] != "") {
    if ($_POST["curr"] != "NEW") {
        $ret = phorum_db_mod_banlists($_POST['type'], $_POST['pcre'], $_POST['string'], $_POST['forum_id'], $_POST['comments'], $_POST['curr']);
        if (isset($PHORUM['cache_banlists']) && $PHORUM['cache_banlists']) {
            // we need to increase the version in that case to
            // invalidate them all in the cache.
            // TODO: I think I have to work out a way to make the same
            // work with vroots
            if ($_POST['forum_id'] == 0) {
                $PHORUM['banlist_version'] = $PHORUM['banlist_version'] + 1;
                phorum_db_update_settings(array('banlist_version' => $PHORUM['banlist_version']));
            } else {
                // remove the one for that forum
                phorum_cache_remove('banlist', $_POST['forum_id']);
            }
        }
    } else {
        $ret = phorum_db_mod_banlists($_POST['type'], $_POST['pcre'], $_POST['string'], $_POST['forum_id'], $_POST['comments'], 0);
    }
    if (!$ret) {
        $error = "Database error while updating settings.";
    } else {
        phorum_admin_okmsg("Ban Item Updated");
    }
}
if (isset($_POST["curr"]) && isset($_POST["delete"]) && $_POST["confirm"] == "Yes") {
开发者ID:mgs2,项目名称:kw-forum,代码行数:31,代码来源:banlist.php


示例15: phorum_check_bans

/**
 * This function can perform multiple banlist checks at once and will
 * automatically generate an appropriate error message when a banlist
 * match is found.
 * @param bans - an array of bans to check. Each element in this array is an
 *               array itself with two elements: the value to check and the
 *               type of banlist to check against. One special case:
 *               if the type if PHORUM_BAD_IPS, the value may be NULL.
 *               In that case the IP/hostname of the client will be checked.
 * @return - An error message in case a banlist match was found or NULL
 *           if no match was found.
 */
function phorum_check_bans($bans)
{
    $PHORUM = $GLOBALS["PHORUM"];
    // A mapping from bantype -> error message to return on match.
    $phorum_bantype2error = array(PHORUM_BAD_NAMES => "ErrBannedName", PHORUM_BAD_EMAILS => "ErrBannedEmail", PHORUM_BAD_USERID => "ErrBannedUser", PHORUM_BAD_IPS => "ErrBannedIP", PHORUM_BAD_SPAM_WORDS => "ErrBannedContent");
    // These language strings are set dynamically, so the language
    // tool won't recognize them automatically. Therefore they are
    // mentioned here.
    // $PHORUM["DATA"]["LANG"]["ErrBannedName"]
    // $PHORUM["DATA"]["LANG"]["ErrBannedEmail"]
    // $PHORUM["DATA"]["LANG"]["ErrBannedUser"]
    // $PHORUM["DATA"]["LANG"]["ErrBannedIP"]
    // $PHORUM["DATA"]["LANG"]["ErrBannedContent"]
    $cache_key = $PHORUM['forum_id'];
    // Load the ban lists.
    if (!isset($GLOBALS["PHORUM"]["banlists"])) {
        if (!empty($PHORUM['cache_banlists']) && !empty($PHORUM['banlist_version'])) {
            $GLOBALS["PHORUM"]["banlists"] = phorum_cache_get('banlist', $cache_key, $PHORUM['banlist_version']);
            if (!is_array($GLOBALS["PHORUM"]["banlists"]) || !count($GLOBALS["PHORUM"]["banlists"])) {
                unset($GLOBALS["PHORUM"]["banlists"]);
            }
        }
        // not found or no caching enabled
        if (!isset($GLOBALS["PHORUM"]["banlists"])) {
            $GLOBALS["PHORUM"]["banlists"] = phorum_db_get_banlists();
            if (isset($GLOBALS["PHORUM"]["banlists"]) && isset($PHORUM['cache_banlists']) && $PHORUM['cache_banlists']) {
                if (!isset($PHORUM['banlist_version'])) {
                    $PHORUM['banlist_version'] = 1;
                    phorum_db_update_settings(array('banlist_version' => 1));
                }
                phorum_cache_put('banlist', $cache_key, $GLOBALS["PHORUM"]["banlists"], 7200, $PHORUM['banlist_version']);
            }
        }
    }
    if (!isset($GLOBALS['PHORUM']['banlists'])) {
        return NULL;
    }
    // Run the checks.
    for (;;) {
        // An array for adding ban checks on the fly.
        $add_bans = array();
        foreach ($bans as $ban) {
            // Checking IP/hostname, but no value set? Then add the IP-address
            // and hostname (if DNS lookups are enabled) to the end of the checking
            // queue and continue with the next check.
            if ($ban[1] == PHORUM_BAD_IPS && $ban[0] == NULL) {
                $add_bans[] = array($_SERVER["REMOTE_ADDR"], PHORUM_BAD_IPS);
                if ($PHORUM["dns_lookup"]) {
                    $resolved = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
                    if (!empty($resolved) && $resolved != $_SERVER["REMOTE_ADDR"]) {
                        $add_bans[] = array($resolved, PHORUM_BAD_IPS);
                    }
                }
                continue;
            }
            // Do a single banlist check. Return an error if we find a match.
            if (!phorum_check_ban_lists($ban[0], $ban[1])) {
                $msg = $PHORUM["DATA"]["LANG"][$phorum_bantype2error[$ban[1]]];
                // Replace %name% with the blocked string.
                $msg = str_replace('%name%', htmlspecialchars($ban[0]), $msg);
                return $msg;
            }
        }
        // Bans added on the fly? Then restart the loop.
        if (count($add_bans) == 0) {
            break;
        } else {
            $bans = $add_bans;
        }
    }
    return NULL;
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:84,代码来源:profile_functions.php


示例16: phorum_api_custom_profile_field_checkconfig

/**
 * Check and fix the custom profile field configuration.
 *
 * This function has mainly been implemented for fixing problems that
 * are introduced by modules that create custom profile fields on their
 * own. Besides that, it was also written to upgrade the profile field
 * configuration, because Phorum 5.2 introduced some new fields in
 * the config.
 */
function phorum_api_custom_profile_field_checkconfig()
{
    global $PHORUM;
    // Used to find the real maximum used field id.
    $max_id = isset($PHORUM['PROFILE_FIELDS']['num_fields']) ? (int) $PHORUM['PROFILE_FIELDS']['num_fields'] : 0;
    foreach ($PHORUM['PROFILE_FIELDS'] as $id => $config) {
        // Keep track of the highest id that we see.
        if ($id > $max_id) {
            $max_id = $id;
        }
        // The least that should be in the config, is the name of the
        // field. If there is no name, then we don't bother at all.
        if (!isset($config['name']) || $config['name'] == '') {
            continue;
        }
        // 5.2 includes the id in the field configuration.
        if (empty($config['id'])) {
            $PHORUM['PROFILE_FIELDS'][$id]['id'] = $id;
        }
        // Some default values.
        if (!array_key_exists('length', $config)) {
            $PHORUM['PROFILE_FIELDS'][$id]['length'] = 255;
        }
        if (!array_key_exists('html_disabled', $config)) {
            $PHORUM['PROFILE_FIELDS'][$id]['html_disabled'] = TRUE;
        }
        if (!array_key_exists('show_in_admin', $config)) {
            $PHORUM['PROFILE_FIELDS'][$id]['show_in_admin'] = FALSE;
        }
        // Some typecasting won't hurt.
        settype($PHORUM['PROFILE_FIELDS'][$id]['id'], 'int');
        settype($PHORUM['PROFILE_FIELDS'][$id]['name'], 'string');
        settype($PHORUM['PROFILE_FIELDS'][$id]['length'], 'int');
        settype($PHORUM['PROFILE_FIELDS'][$id]['html_disabled'], 'bool');
        settype($PHORUM['PROFILE_FIELDS'][$id]['show_in_admin'], 'bool');
    }
    // Set the maximum field id that we've seen.
    $PHORUM['PROFILE_FIELDS']['num_fields'] = $max_id;
    // Save the custom profile field settings to the database.
    phorum_db_update_settings(array('PROFILE_FIELDS' => $PHORUM['PROFILE_FIELDS']));
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:50,代码来源:custom_profile_fields.php


示例17: foreach

    $error="";
    $curr="NEW";

    // retrieving the forum-info
    $forum_list=phorum_get_forum_info(2);

    $forum_list[0]="GLOBAL";

    // conversion of old data if existing
    if(isset($PHORUM["bad_words"]) && count($PHORUM['bad_words'])) {
    print "upgrading badwords<br>";
        foreach($PHORUM['bad_words'] as $key => $data) {
            phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$data ,0 ,0);
            unset($PHORUM["bad_words"][$key]);
        }
        phorum_db_update_settings(array("bad_words"=>$PHORUM["bad_words"]));
    }

    if(count($_POST) && $_POST["string"]!=""){
        if($_POST["curr"]!="NEW"){
            $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,$_POST['curr']);
        } else {
            $ret=phorum_db_mod_banlists(PHORUM_BAD_WORDS ,0 ,$_POST["string"] ,$_POST['forumid'] ,0);
        }

        if(!$ret){
            $error="Database error while updating badwords.";
        } else {
            echo "Bad Word Added<br />";
        }
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:badwords.php


示例18: phorum_upgrade_tables

    function phorum_upgrade_tables($fromversion,$toversion) {

          $PHORUM=$GLOBALS['PHORUM'];

          if(empty($fromversion) || empty($toversion)){
              die("Something is wrong with the upgrade script.  Please contact the Phorum Dev Team. ($fromversion,$toversion)");
          }

          $msg="";
          $upgradepath="./include/db/upgrade/{$PHORUM['DBCONFIG']['type']}/";

          // read in all existing files
          $dh=opendir($upgradepath);
          $upgradefiles=array();
          while ($file = readdir ($dh)) {
              if (substr($file,-4,4) == ".php") {
                  $upgradefiles[]=$file;
              }
          }
          unset($file);
          closedir($dh);

          // sorting by number
          sort($upgradefiles,SORT_NUMERIC);
          reset($upgradefiles);

          // advance to current version
          while(list($key,$val)=each($upgradefiles)) {
              if($val == $fromversion.".php")
              break;
          }



          // get the file for the next version (which we will upgrade to)
          list($dump,$file) = each($upgradefiles);

          // extract the pure version, needed as internal version
          $pure_version = basename($file,".php");

          if(empty($pure_version)){
              die("Something is wrong with the upgrade script.  Please contact the Phorum Dev Team. ($fromversion,$toversion)");
          }


          $upgradefile=$upgradepath.$file;

          if(file_exists($upgradefile)) {
              if (! is_readable($upgradefile))
                die("$upgradefile is not readable. Make sure the file has got the neccessary permissions and try again.");

              $msg.="Upgrading from db-version $fromversion to $pure_version ... ";
              $upgrade_queries=array();
              include($upgradefile);
              $err=phorum_db_run_queries($upgrade_queries);
              if($err){
                  $msg.= "an error occured: $err ... try to continue.<br />\n";
              } else {
                  $msg.= "done.<br />\n";
              }
              $GLOBALS["PHORUM"]["internal_version"]=$pure_version;
              phorum_db_update_settings(array("internal_version"=>$pure_version));
          } else {
              $msg="Ooops, the upgradefile is missing. How could this happen?";
          }

          return $msg;
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:68,代码来源:admin.php


示例19: phorum_dbupgrade_run

/**
 * Perform the upgrade for a single upgrade file.
 *
 * @param $upgrades - An upgrade description. One element from the array
 *                    as returned by phorum_dbupgrade_getupgrades().
 * @param $update_internal_version - whether to update the internal version
 *                    for Phorum or not. This one is TRUE by default.
 *                    It can be used by scripts that have to re-run an old
 *                    single upgrade file and for which the internal version
 *                    should not be put back to an old value.
 * @return $msg - Describes the results of the upgrade.
 */
function phorum_dbupgrade_run($upgrade, $update_internal_version = TRUE)
{
    $PHORUM = $GLOBALS["PHORUM"];
    $version = $upgrade["version"];
    $type = $upgrade["type"];
    $upgradefile = $upgrade["file"];
    $versionvar = $type == 'patch' ? 'internal_patchlevel' : 'internal_version';
    // Find the version from which we're upgrading.
    $fromversion = $PHORUM[$versionvar];
    // Executing large, long running scripts can result in problems,
    // in case the script hits PHP resource boundaries. Here we try
    // to prepare the PHP environment for the upgrade. Unfortunately,
    // if the server is running with safe_mode enabled, we cannot
    // change the execution time and memory limits.
    if (!ini_get('safe_mode')) {
        set_time_limit(0);
        ini_set("memory_limit", "64M");
    }
    // Check if the upgradefile is readable.
    if (file_exists($upgradefile) && is_readable($upgradefile)) {
        // Initialize the return message.
        if (!$update_internal_version) {
            $msg = "Installing patch {$version} ...<br/>\n";
        } elseif ($fromversion == '1111111111') {
            $msg = "Upgrading to patch level {$version} ...<br/>\n";
        } else {
            $msg = "Upgrading from " . ($type == "patch" ? "patch level " : "database version ") . "{$fromversion} to {$version} ...<br/>\n";
        }
        // Load the upgrade file. The upgrade file should fill the
        // $upgrade_queries array with the necessary queries to run.
        $upgrade_queries = array();
        include $upgradefile;
        // Run the upgrade queries.
        $err = phorum_db_run_queries($upgrade_queries);
        if ($err !== NULL) {
            $msg .= "An error occured during this upgrade:<br/><br/>\n" . "<span style=\"color:red\">{$err}</span><br/><br/>\n" . "Please make note of this error and contact the " . "Phorum Dev Team for help.\nYou can try to continue " . "with the rest of the upgrade.<br/>\n";
        } else {
            $msg .= "The upgrade was successful.<br/>\n";
        }
        // Update the upgrade version info.
        if ($update_internal_version) {
            $GLOBALS["PHORUM"][$versionvar] = $version;
            phorum_db_update_settings(array($versionvar => $version));
        }
        return $msg;
    } else {
        return "The upgrade file " . htmlspecialchars($upgradefile) . " " . "cannot be opened by Phorum for reading. Please check " . "the file permissions for this file and try again.";
    }
}
开发者ID:mgs2,项目名称:kw-forum,代码行数:61,代码来源:version_functions.php


示例20: unset

            }

            if(!phorum_db_update_settings(array(&q 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phorum_get_file_name函数代码示例发布时间:2022-05-15
下一篇:
PHP phorum_db_get_message函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap