本文整理汇总了PHP中phorum_db_update_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP phorum_db_update_settings函数的具体用法?PHP phorum_db_update_settings怎么用?PHP phorum_db_update_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phorum_db_update_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
示例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;
}
?>
示例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");
示例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));
}
示例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.");
示例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;
示例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"]);
示例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>");
示例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") {
示例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;
}