function set_setting($name, $setting) { $cur = get_settings(); $new = array($name => $setting); if ($cur) { $joined = $new + $cur; } else { $joined = $new; } return save_settings($joined); }
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; }
/** 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); }
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"]."();";}
} } } } // 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']}"; } }
/** * Save changes */ function save() { save_settings($this->conf); $this->setMessage(array("type" => "[SETTINGS_UPDATED]")); }
} $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']);
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 $ || #################################################################### \*======================================================================*/
} $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":
$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;
$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();
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 {
<?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()");
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); $command = str_replace("%%trailing%%", $trailing, $command); echo "/IRC :" . get_bot_nick() . " {$cmd} {$channel} :{$command}\n"; } } return; } } } }
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; }
/** * Save all settings. * The function gets a list of all setting categories from database, iterates thru them, * and saves changes for every category. */ function save_settings_all() { // Get a list of categories. $q_str = 'SELECT `ID` FROM `GlParamsKateg` WHERE `ID` <> ' . WATERMARK_CATEGORY; $res = db_res($q_str); // Iterate thru categories. while ($row = mysql_fetch_array($res)) { save_settings($row['ID']); } }
enable_phpini($_GET[user], $_GET[path], $_GET[domain]); } if ($_GET[action] == "update_all") { update_all(); } if ($_GET[action] == "self_update") { self_update(); } if ($_GET[action] == "appconfig_update") { appconfig_update(); } if ($_GET[action] == "settings") { settings(); } if ($_POST[action] == "save_settings") { save_settings(); } if ($_GET[action] == "edit") { edit_custom($_GET[path], $_GET[username]); } if ($_POST[action] == "save") { save_custom($_POST[path], $_POST[username], $_POST[custom]); } print_footer(); // FUNCTIONS function checkacl($acl) { $user = $_ENV['REMOTE_USER']; if ($user == "root") { return 1; }
$database_crossref = ''; $failed = ''; if (isset($_GET['database_pubmed'])) { $database_pubmed = $_GET['database_pubmed']; } if (isset($_GET['database_nasaads'])) { $database_nasaads = $_GET['database_nasaads']; } if (isset($_GET['database_crossref'])) { $database_crossref = $_GET['database_crossref']; } if (isset($_GET['failed'])) { $failed = $_GET['failed']; } database_connect(IL_USER_DATABASE_PATH, 'users'); save_settings($dbHandle, array('batchimport_database_pubmed' => $database_pubmed, 'batchimport_database_nasaads' => $database_nasaads, 'batchimport_database_crossref' => $database_crossref, 'batchimport_failed' => $failed)); $dbHandle = null; $user_dir = IL_TEMP_PATH . DIRECTORY_SEPARATOR . 'lib_' . session_id(); session_write_close(); $order = array("\r\n", "\n", "\r"); $i = 0; if (isset($_FILES['Filedata']) && is_uploaded_file($_FILES['Filedata']['tmp_name'])) { $file = $_FILES['Filedata']['tmp_name']; $orig_filename = $_FILES['Filedata']['name']; if (isset($_FILES['Filedata'])) { $file_extension = pathinfo($orig_filename, PATHINFO_EXTENSION); } if (in_array($file_extension, array('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp'))) { $move = move_uploaded_file($file, IL_TEMP_PATH . DIRECTORY_SEPARATOR . $orig_filename); if (PHP_OS == 'Linux' || PHP_OS == 'Darwin') { putenv('HOME=' . IL_TEMP_PATH);
function load_settings($fp, $default_theme, $def_Display_Hidden, $numeric_val) { $personal = array(); // grab the users settings file $tp = tmpfile(); $result = @ftp_fget($fp, $tp, ".wfmrc", FTP_BINARY); // if the user has a personal settings file if ($result) { rewind($tp); // grab the first line $buffer = fgets($tp, 4096); // while not at the end of the file while (!feof($tp)) { // if the line isn't a comment if (substr($buffer, 0, 1) != "#") { // rip the setting apart $command = explode("=", $buffer); // check the setting for errors if (trim($command[0]) != "") { // if the value is supposed to be an integer if (strpos($numeric_val, trim($command[0]))) { $command[1] = intval(trim($command[1])); } // if its the hidden setting check for TRUE/FALSE if (trim($command[0]) == "show_hidden") { if (trim($command[1]) == "TRUE") { $personal[trim($command[0])] = TRUE; } else { $personal[trim($command[0])] = FALSE; } } else { $personal[trim($command[0])] = trim($command[1]); } } } // grab the next line $buffer = fgets($tp, 4096); } // close the temp file fclose($tp); } else { // if the theme exists if (is_readable("themes/" . $default_theme . ".thm")) { // open the file $tp = fopen("themes/" . $default_theme . ".thm", 'r'); // grab the theme $personal = load_theme($tp); $personal["theme"] = $default_theme; $personal["start_dir"] = ""; $personal["show_hidden"] = $def_Display_Hidden; $personal["language"] = $default_lang; // close the file fclose($tp); save_settings($fp, $personal, $personal); } } // return the updated theme return $personal; }
function save_locations(&$locations) { return save_settings($locations, LOCATIONS_FILE); }