本文整理汇总了PHP中save_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP save_settings函数的具体用法?PHP save_settings怎么用?PHP save_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_setting
function set_setting($name, $setting)
{
$cur = get_settings();
$new = array($name => $setting);
if ($cur) {
$joined = $new + $cur;
} else {
$joined = $new;
}
return save_settings($joined);
}
示例2: set_setting
function set_setting($name, $setting)
{
global $sql;
$cur = get_settings();
$new = array($name => $setting);
if ($cur) {
$joined = $new + $cur;
} else {
$joined = $new;
}
$set = save_settings($joined);
return $set;
}
示例3: set_new_option
/** This sets an option. It should rarely used. Its primary use is for temporarily
* storing the version number from which this upgrade started. Any other use should be
* carefully considered as to why you don't just put in the XML file.
*
*
* @param string
* @param string //we actually don't currently use this parameter
* @param string
****/
protected function set_new_option($varname, $grouptitle, $value, $datatype, $default_value = false, $optioncode = '', $product = 'vbulletin')
{
$row = $this->db->query_first("\n\t\t\tSELECT value\n\t\t\tFROM " . TABLE_PREFIX . "setting\n\t\t\tWHERE varname = '" . $this->db->escape_string($varname) . "';");
if (!$row) {
$sql = "REPLACE INTO " . TABLE_PREFIX . "setting\n\t\t\t\t\t(product, varname, grouptitle, value, datatype, optioncode, volatile " . ($default_value ? ',defaultvalue' : '') . ")VALUES('" . $this->db->escape_string($product) . "', '" . $this->db->escape_string($varname) . "', '" . $this->db->escape_string($grouptitle) . "', '" . $this->db->escape_string($value) . "',\n\t\t\t\t'{$datatype}', '" . $this->db->escape_string($optioncode) . "', 1 " . ($default_value ? ",'" . $this->db->escape_string($default_value) . "'" : '') . ")";
$this->db->query_write($sql);
}
include_once DIR . '/includes/adminfunctions_options.php';
$values = array($varname => $value);
if ($default_value) {
$values[$varname]['default_value'] = $default_value;
}
save_settings($values);
}
示例4: usersMenus
include_once('ressources/class.ini.inc');
include_once('ressources/class.squid.inc');
include_once('ressources/class.system.network.inc');
$user=new usersMenus();
if($user->SQUID_INSTALLED==false){die('not allowed');}
if($user->AsSquidAdministrator==false){die('not allowed');}
if($_GET["main"]=="index"){echo index();exit;}
if($_GET["main"]=="daemons"){echo daemons();exit;}
if($_GET["main"]=="clamav"){echo clamav();exit;}
if($_GET["main"]=="logs"){echo logs();exit;}
if(isset($_GET["MaxKeepAliveRequests"])){save_settings();exit;}
if(isset($_GET["srv_clamav_SendPercentData"])){save_settings();exit;}
js();
function js(){
$tpl=new templates();
$page=CurrentPageName();
$title=$tpl->_ENGINE_parse_body('{cicap_title}');
$title1=$tpl->_ENGINE_parse_body('{clamav_settings}');
$title2=$tpl->_ENGINE_parse_body('{clamav_settings}');
$start="loadcicap();";
if(isset($_GET["runthis"])){$start=$_GET["runthis"]."();";}
示例5: each
}
}
}
}
// grab the next setting
$item = each($pref);
}
if ($submit == gettext("Preview")) {
$location = "Location: preferences.php?SID={$SID}";
$sess_Data["warn"] = sprintf("%s: %s \"%s\". \"%s\" %s.", gettext("Info"), gettext("Changes will not be saved until you click"), gettext("Save"), gettext("Cancel"), gettext("will load last saved settings"));
$sess_Data["level"] = "info";
} else {
// go back to the users home dir to save the file
@ftp_chdir($fp, $home_Dir);
// save the theme to the users .wfmrc file
save_settings($fp, $personal, $theme);
}
break;
case gettext("Cancel"):
// load users theme if allow_custom setting is on
if ($allow_custom) {
// go back to the users home dir to save the file
@ftp_chdir($fp, $home_Dir);
// load the .wfmrc file, then load the appropriate theme
// overwrites default settings set earlier
$personal = array_merge($personal, load_settings($fp, $default_theme, $def_Display_Hidden, $numeric_val));
// if the user specified to start in a different dir from his home dir
if (compat_array_key_exists("start_dir", $personal) && $personal["start_dir"] != "") {
$location = "Location: crossover.php?SID=" . session_id() . "&submit=CD&CHDIR={$personal['start_dir']}";
}
}
示例6: save
/**
* Save changes
*/
function save()
{
save_settings($this->conf);
$this->setMessage(array("type" => "[SETTINGS_UPDATED]"));
}
示例7: database_connect
}
$new_settings['global_proxy_username'] = '';
if (isset($_GET['proxy_username']) && isset($new_settings['global_proxy_name'])) {
$new_settings['global_proxy_username'] = $_GET['proxy_username'];
}
$new_settings['global_proxy_password'] = '';
if (isset($_GET['proxy_password']) && isset($new_settings['global_proxy_name'])) {
$new_settings['global_proxy_password'] = $_GET['proxy_password'];
}
$new_settings['global_zone'] = '';
if (isset($_GET['zone'])) {
$new_settings['global_zone'] = $_GET['zone'];
}
}
$dbHandle = database_connect(IL_USER_DATABASE_PATH, 'users');
save_settings($dbHandle, $new_settings);
$dbHandle = null;
}
// Clear setting values.
$limit = '';
unset($_SESSION['limit']);
$display = '';
unset($_SESSION['display']);
$orderby = '';
unset($_SESSION['orderby']);
$remove_pubmed = '';
unset($_SESSION['remove_pubmed']);
$remove_pmc = '';
unset($_SESSION['remove_pmc']);
$remove_nasaads = '';
unset($_SESSION['remove_nasaads']);
示例8: print_description_row
print_description_row($vbphrase['are_you_sure_you_want_to_delete_this_question']);
print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']);
}
// ###################### Kill Answer #######################
if ($_POST['do'] == 'killquestion') {
$question = $db->query_first_slave("\r\n\t\tSELECT questionid\r\n\t\tFROM " . TABLE_PREFIX . "hvquestion AS question\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "phrase AS phrase ON (phrase.varname = CONCAT('question', question.questionid) AND phrase.fieldname = 'hvquestion' and languageid = 0)\r\n\t\tWHERE questionid = " . $vbulletin->GPC['questionid'] . "\r\n\t");
if (!$question) {
print_stop_message('invalid_x_specified', $vbphrase['question']);
}
$db->query_write("\r\n\t\tDELETE FROM " . TABLE_PREFIX . "hvanswer\r\n\t\tWHERE questionid = {$question['questionid']}\r\n\t");
$db->query_write("\r\n\t\tDELETE FROM " . TABLE_PREFIX . "hvquestion\r\n\t\tWHERE questionid = {$question['questionid']}\r\n\t");
$db->query_write("\r\n\t\tDELETE FROM " . TABLE_PREFIX . "phrase\r\n\t\tWHERE fieldname = 'hvquestion' AND\r\n\t\t\tvarname = 'question" . $question[questionid] . "'\r\n\t");
require_once DIR . '/includes/adminfunctions_language.php';
build_language();
define('CP_REDIRECT', 'verify.php');
print_stop_message('deleted_question_successfully');
}
// ###################### Intro Screen #######################
if ($_POST['do'] == 'updateoptions') {
$vbulletin->input->clean_array_gpc('p', array('setting' => TYPE_ARRAY));
save_settings($vbulletin->GPC['setting']);
define('CP_REDIRECT', 'verify.php');
print_stop_message('saved_settings_successfully');
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 23:48, Wed Mar 24th 2010
|| # CVS: $RCSfile$ - $Revision: 32878 $
|| ####################################################################
\*======================================================================*/
示例9: explode
}
$parts = explode(" ", $trailing);
delete_empty_elements($parts);
$pref = $parts[0];
array_shift($parts);
$trailing = trim(implode(" ", $parts));
$prefs = load_settings(WEATHER_PREFS_FILE);
if ($prefs === False) {
$prefs = array();
}
if (isset($prefs[$nick]) == True) {
$nick_prefs = unserialize($prefs[$nick]);
}
$nick_prefs[$pref] = $trailing;
$prefs[$nick] = serialize($nick_prefs);
if (save_settings($prefs, WEATHER_PREFS_FILE) == True) {
privmsg(" successfully saved prefs");
}
break;
case "~weather-del":
if (del_location($trailing) == True) {
privmsg("location \"{$trailing}\" deleted");
} else {
if (trim($trailing) != "") {
privmsg("location for \"{$trailing}\" not found");
} else {
privmsg("syntax: ~weather-del <name>");
}
}
break;
case "~weather-add":
示例10: privmsg
$filter["pattern"] = $pattern;
privmsg(" comments feed filter " . chr(3) . "04{$id}" . chr(3) . " added [target={$target}, field={$field}, pattern=\"{$pattern}\"]");
}
$filters[$id] = base64_encode(serialize($filter));
save_settings($filters, COMMENTS_FILTERS_FILE, " ");
return;
case "filter-delete":
# ~comments filter-delete %id%
$id = trim($trailing);
if ($id == "") {
privmsg(" syntax: ~comments filter-delete %id%");
return;
}
if (isset($filters[$id]) == True) {
unset($filters[$id]);
save_settings($filters, COMMENTS_FILTERS_FILE, " ");
privmsg(" comments feed filter " . chr(3) . "04{$id}" . chr(3) . " deleted");
} else {
privmsg(" comments feed filter " . chr(3) . "04{$id}" . chr(3) . " not found");
}
return;
default:
return;
}
}
foreach ($filters as $id => $filter) {
$filters[$id] = unserialize(base64_decode($filter));
}
$host = "soylentnews.org";
$feed_uri = "/index.xml";
$port = 443;
示例11: addslashes
$old_value = $row['value'];
$post_name = 'search_' . $row['name'];
$value = $admin->get_post($post_name);
// hold old value if post is empty
if (isset($value)) {
// check search template
$value = $value == '' && $setting_name == 'template' ? $settings['default_template'] : $admin->get_post($post_name);
$value = $admin->get_post($post_name) == '' && $setting_name != 'template' ? $value : $admin->get_post($post_name);
$value = addslashes($value);
$sql = 'UPDATE `' . TABLE_PREFIX . 'search` ';
$sql .= 'SET `value` = "' . $value . '" ';
$sql .= 'WHERE `name` = "' . $row['name'] . '" ';
$sql .= 'AND `extra` = ""';
$database->query($sql);
}
}
}
return sizeof($err_msg) > 0 ? implode('<br />', $err_msg) : '';
}
if ($submit == 'advanced') {
// if Javascript is disabled
$admin->print_success($TEXT['REDIRECT_AFTER'] . ' ' . $MENU['SETTINGS'], $js_back);
exit;
}
$retval = save_settings($admin, $database);
if ($retval == '') {
$admin->print_success($MESSAGE['SETTINGS_SAVED'], $js_back);
} else {
$admin->print_error($retval, $js_back);
}
$admin->print_footer();
示例12: privmsg
privmsg(" └─ deleted " . $parts[0]);
} else {
privmsg(" └─ " . $parts[0] . " not found");
}
} else {
$id = $parts[0];
array_shift($parts);
$content = implode(" ", $parts);
if (strpos($id, "|") === False and strpos($content, "|") === False) {
$list[$id] = $content;
privmsg(" └─ {$id} => " . $list[$id]);
} else {
privmsg(" └─ error: can't contain pipe (|) character");
}
}
save_settings($list, DATA_PATH . "links", "|");
} else {
$results = array_merge(match_keys($trailing, $list), match_values($trailing, $list));
$n = count($results);
if ($n > 0) {
$w = max_key_len($results);
$i = 0;
foreach ($results as $key => $value) {
if ($i == $n - 1) {
privmsg(" └─ " . str_pad($key, $w) . " => {$value}");
} else {
privmsg(" ├─ " . str_pad($key, $w) . " => {$value}");
}
$i++;
}
} else {
示例13: formatBytes
<?php
include_once 'data.php';
include_once 'functions.php';
function formatBytes($size, $precision = 1)
{
$base = log($size) / log(1024);
$suffixes = array('', 'k', 'M', 'G', 'T');
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
}
if (isset($_SESSION['auth']) && isset($_SESSION['permissions']) && $_SESSION['permissions'] == 'A') {
// Save Libre Office path.
if (!empty($_GET['soffice_path'])) {
database_connect(IL_USER_DATABASE_PATH, 'users');
save_settings($dbHandle, array('global_soffice_path' => $_GET['soffice_path']));
$dbHandle = null;
die;
}
session_write_close();
include_once 'functions.php';
print '<b> Installation Details:</b>';
print '<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">';
if ($hosted == false) {
print "<tr><td class=\"details alternating_row\" style=\"width: 100%\" colspan=4>Required software:</td></tr>";
print "<tr><td class=\"details\" style=\"white-space: nowrap\">PHP version</td>";
print "<td class=\"details\">>5.4.0</td><td class=\"details\">" . PHP_VERSION . "</td>";
print "<td class=\"details\">";
print version_compare(PHP_VERSION, "5.4.0", "<") ? "<span style=\" font-weight: bold\">!!!</span>" : "<span style=\" font-weight: bold\">OK</span>";
print "</td></tr>";
database_connect(IL_DATABASE_PATH, 'library');
$sqlite_version = $dbHandle->query("SELECT sqlite_version()");
示例14: handle_macros
function handle_macros($nick, $channel, $trailing)
{
$reserved_triggers = array(".macro", ".macro-list");
$reserved_commands = array("~restart-internal", "~q", "~ps", "~kill", "~killall", "~restart", "~rehash", "~dest-override", "~dest-clear", "~ignore", "~unignore", "~ignore-list", "~buckets-dump", "~eval", "~say", "~bucket", "~buckets-save", "~buckets-load", "~buckets-flush", "~buckets-list", "~exec-conflicts", "~exec-list", "~exec-timers", "~exec-errors", "~op", "~deop", "~voice", "~devoice", "~invite", "~kick", "~topic", "~exec-add", "~exec-del", "~exec-save", "<init>", "<quit>", "<startup>");
$allowed = array("crutchy", "chromas", "TheMightyBuzzard", "Bytram", "arti", "paulej72", "mrcoolbp", "juggs");
if ($nick == "" or $channel == "" or $trailing == "") {
return;
}
if ($trailing == ".macro") {
pm($channel, chr(3) . "02" . " syntax to add: .macro <trigger> <chanlist> PRIVMSG|INTERNAL <command_template>");
pm($channel, chr(3) . "02" . " syntax to delete: .macro <trigger> -");
#pm($channel,chr(3)."02"." <chanlist> is comma-separated or * for any");
}
$macro_file = DATA_PATH . "exec_macros.txt";
$macros = load_settings($macro_file, "=");
if ($macros !== False and $trailing == ".macro-list") {
foreach ($macros as $trigger => $data) {
$data = unserialize($data);
$cmd = "INTERNAL";
if (isset($data["cmd"]) == True) {
$cmd = $data["cmd"];
}
pm($channel, chr(3) . "13" . " {$trigger} [" . $data["chanlist"] . "] {$cmd} " . $data["command"]);
}
}
if ($macros === False) {
$macros = array();
}
$parts = explode(" ", $trailing);
delete_empty_elements($parts);
if (count($parts) == 0) {
return;
}
if (trim($parts[0]) == ".macro" and count($parts) > 2) {
$account = users_get_account($nick);
if (in_array($account, $allowed) == False) {
return;
}
$trigger = trim($parts[1]);
if (in_array($trigger, $reserved_triggers) == True) {
privmsg(chr(3) . "02" . " *** macro with trigger \"{$trigger}\" not permitted");
return;
}
if (in_array($trigger, $reserved_commands) == True) {
privmsg(chr(3) . "02" . " *** macro with trigger \"{$trigger}\" not permitted");
return;
}
$exec_list = unserialize(base64_decode(trim(get_bucket("<<EXEC_LIST>>"))));
if (isset($exec_list[$trigger]) == True) {
privmsg(chr(3) . "02" . " *** error: macro with trigger that is the same as existing alias is not permitted");
return;
}
$chanlist = trim($parts[2]);
if ($chanlist == "-") {
unset($macros[$trigger]);
privmsg(chr(3) . "02" . " *** macro with trigger \"{$trigger}\" deleted");
} elseif (count($parts) >= 5) {
array_shift($parts);
array_shift($parts);
array_shift($parts);
$cmd = strtoupper(trim($parts[0]));
if ($cmd != "PRIVMSG" and $cmd != "INTERNAL") {
privmsg(chr(3) . "02" . " *** error: invalid cmd (must be either INTERNAL or PRIVMSG)");
return;
}
array_shift($parts);
if (isset($macros[$parts[0]]) == True) {
privmsg(chr(3) . "02" . " *** error: triggering other macros is not permitted");
return;
}
$command = implode(" ", $parts);
for ($i = 0; $i < count($reserved_commands); $i++) {
if (strtolower(substr($command, 0, strlen($reserved_commands[$i]))) == strtolower($reserved_commands[$i])) {
privmsg(chr(3) . "02" . " *** macro with command \"{$command}\" not permitted");
return;
}
}
$data = array();
$data["chanlist"] = $chanlist;
$data["command"] = $command;
$data["cmd"] = $cmd;
$macros[$trigger] = serialize($data);
privmsg(chr(3) . "02" . " *** macro with trigger \"{$trigger}\" and {$cmd} command template \"{$command}\" saved");
}
save_settings($macros, $macro_file, "=");
} else {
foreach ($macros as $trigger => $data) {
if (trim($parts[0]) == $trigger) {
$data = unserialize($data);
if ($data["chanlist"] == "*" or in_array(strtolower($channel), explode(",", strtolower($data["chanlist"]))) == True) {
$account = users_get_account($nick);
if ($account != "") {
$cmd = "INTERNAL";
if (isset($data["cmd"]) == True) {
$cmd = $data["cmd"];
}
$trailing = trim(substr($trailing, strlen($trigger)));
# TODO: MAKE MORE TRAILING PARSING REPLACE ARGS
$command = str_replace("%%channel%%", $channel, $data["command"]);
$command = str_replace("%%nick%%", $nick, $command);
//.........这里部分代码省略.........
示例15: save_custom_settings
function save_custom_settings()
{
global $all_settings;
$new_settings = array();
$search_result_items = max(1, intval($_POST['search-result-items']));
$public_html_dir = $_POST['public-html-dir'];
$search_indexes_folder = $_POST['search-indexes-folder'];
$search_display_meta_tag = $_POST['search-display-meta-tag'];
$search_dynamic_pages = encode_dynamic_urls($_POST['search-dynamic-pages']);
$search_exclude_from_indexing = encode_dynamic_urls($_POST['search-exclude-from-indexing']);
check_public_html_existence($public_html_dir);
if (get_setting('public_html_dir', $all_settings) != $public_html_dir) {
$new_settings['public_html_dir'] = $public_html_dir;
}
if (get_setting('search_result_items', $all_settings) != $search_result_items) {
$new_settings['search_result_items'] = $search_result_items;
}
if (get_setting('search_indexes_folder', $all_settings) != $search_indexes_folder) {
$new_settings['search_indexes_folder'] = $search_indexes_folder;
}
if (get_setting('search_display_meta_tag', $all_settings) != $search_display_meta_tag) {
$new_settings['search_display_meta_tag'] = $search_display_meta_tag;
}
if (get_setting('search_dynamic_pages', $all_settings) != $search_dynamic_pages) {
$new_settings['search_dynamic_pages'] = $search_dynamic_pages;
}
if (get_setting('search_exclude_from_indexing', $all_settings) != $search_exclude_from_indexing) {
$new_settings['search_exclude_from_indexing'] = $search_exclude_from_indexing;
}
save_settings($new_settings);
$return_array = array();
foreach ($all_settings as $key => $value) {
$return_array[$key] = $value;
}
foreach ($new_settings as $key => $value) {
$return_array[$key]['custom_value'] = $value;
}
return $return_array;
}