function __cleanup() { if (isset($_ENV['SOFTHOOKS']['SHUTDOWN'])) { foreach ($_ENV['SOFTHOOKS']['SHUTDOWN'] as $hook) { executeUserParams($hook["FUNC"], $hook["OBJ"]); } } if (function_exists("runHooks")) { runHooks("shutdown"); } if (function_exists("saveSettings")) { saveSettings(); } if (function_exists("saveSiteSettings")) { saveSiteSettings(); } if (function_exists("saveSession")) { saveSession(); } if (class_exists("LogiksCache")) { MetaCache::getInstance()->dumpAllCache(); DataCache::getInstance()->dumpAllCache(); } if (class_exists("Database")) { Database::closeAll(); } // $error = error_get_last(); // if ($error['type'] == 1) { // header('HTTP/1.1 500 Internal Server Error'); // $errorMsg = htmlspecialchars_decode(strip_tags($error['message'])); // exit($errorMsg); // } }
function processSettings($calID) { //get settings from calendar $dbSet = getSettings(); if (!empty($dbSet)) { echo "<li>Calendar settings retrieved from database.</li>\n"; } //convert 2.7.1 date settings to new settings $ds = isset($dbSet['dateSep']) ? $dbSet['dateSep'] : '.'; //dateSep: LuxCal 2.7.1 if (isset($dbSet['dateFormat'])) { switch ($dbSet['dateFormat']) { //dateSep: LuxCal 2.7.1 format case '1': $dbSet['dateFormat'] = 'd' . $ds . 'm' . $ds . 'y'; break; case '2': $dbSet['dateFormat'] = 'm' . $ds . 'd' . $ds . 'y'; break; case '3': $dbSet['dateFormat'] = 'y' . $ds . 'm' . $ds . 'd'; } } if (empty($dbSet['MdFormat'])) { $dbSet['MdFormat'] = empty($dbSet['dateUSorEU']) ? 'M d' : 'd M'; } //dateUSorEU: LuxCal 2.7.1 if (empty($dbSet['MdyFormat'])) { $dbSet['MdyFormat'] = empty($dbSet['dateUSorEU']) ? 'M d, y' : 'd M y'; } if (empty($dbSet['MyFormat'])) { $dbSet['MyFormat'] = empty($dbSet['dateUSorEU']) ? 'M y' : 'M y'; } if (empty($dbSet['DMdFormat'])) { $dbSet['DMdFormat'] = empty($dbSet['dateUSorEU']) ? 'WD, M d' : 'WD d M'; } if (empty($dbSet['DMdyFormat'])) { $dbSet['DMdyFormat'] = empty($dbSet['dateUSorEU']) ? 'WD, M d, y' : 'WD d M y'; } if (empty($dbSet['timeFormat'])) { $dbSet['timeFormat'] = empty($dbSet['time24']) ? 'h:ma' : 'h.m'; } //time24: LuxCal 2.7.1 //check and complete settings checkSettings($dbSet); //if $dbSet['x'] empty, set to default value echo "<li>Calendar settings verified/completed.</li>\n"; //save calendar settings to calendar $result = saveSettings($calID, $dbSet, true); if ($result === false) { exit('Error: Unable to save settings in database. Check database credentials.'); } echo "<li>Calendar settings saved to database.</li>\n"; return $result; }
<?php include "../universal/config.php"; //---sendValidation---// if (isset($_POST["sendNewValidation"])) { include "sendNewValidation.php"; $result = sendNewValidation($_POST["newEmail"]); echo $result; } elseif (isset($_POST["validateNewEmail"])) { include "validateNewEmail.php"; $result = validateNewEmail($_POST["key"], $_POST["newEmail"]); echo $result; } elseif (isset($_POST["saveSettings"])) { include "saveSettings.php"; $result = saveSettings($_POST["newUsername"], $_POST["newPassword"], $_POST["emailNotifications"], $_POST["newAbout"], $_POST["newPicture"]); echo $result; } elseif (isset($_POST["showSettings"])) { include "showSettings.php"; $result = showSettings(); echo $result; } elseif (isset($_POST["killSessions"])) { include "killSessions.php"; $result = killSessions(); echo $result; }
showError($db, $sql); // Test and setup some paths for the TF settings $pythonCmd = $cfg["pythonCmd"]; $btphpbin = getcwd() . "/TF_BitTornado/btphptornado.py"; $tfQManager = getcwd() . "/TF_BitTornado/tfQManager.py"; $maketorrent = getcwd() . "/TF_BitTornado/btmakemetafile.py"; $btshowmetainfo = getcwd() . "/TF_BitTornado/btshowmetainfo.py"; $tfPath = getcwd() . "/downloads/"; if (!isFile($cfg["pythonCmd"])) { $pythonCmd = trim(shell_exec("which python")); if ($pythonCmd == "") { $pythonCmd = $cfg["pythonCmd"]; } } $settings = array("pythonCmd" => $pythonCmd, "btphpbin" => $btphpbin, "tfQManager" => $tfQManager, "btmakemetafile" => $maketorrent, "btshowmetainfo" => $btshowmetainfo, "path" => $tfPath, "btclient_tornado_bin" => $btphpbin); saveSettings($settings); AuditAction($cfg["constants"]["update"], "Initial Settings Updated for first login."); $next_loc = "admin.php?op=configSettings"; } $sql = "SELECT uid, hits, hide_offline, theme, language_file FROM tf_users WHERE user_id=" . $db->qstr($user) . " AND password="******"hide_offline"], $cfg["theme"], $cfg["language_file"]) = $result->FetchRow(); if (!array_key_exists("shutdown", $cfg)) { $cfg['shutdown'] = ''; } if (!array_key_exists("upload_rate", $cfg)) { $cfg['upload_rate'] = ''; } if ($result->RecordCount() == 1) { // suc. auth.
function buildSearchEngineLinks($selectedEngine = 'TorrentSpy') { global $cfg; $settingsNeedsSaving = false; $settings['searchEngineLinks'] = array(); $output = ''; if (!array_key_exists('searchEngineLinks', $cfg) || !is_array($cfg['searchEngineLinks'])) { saveSettings($settings); } $handle = opendir("./searchEngines"); while ($entry = readdir($handle)) { $entrys[] = $entry; } natcasesort($entrys); foreach ($entrys as $entry) { if ($entry != "." && $entry != ".." && substr($entry, 0, 1) != ".") { if (strpos($entry, "Engine.php")) { $tmpEngine = str_replace("Engine", '', substr($entry, 0, strpos($entry, "."))); if (array_key_exists($tmpEngine, $cfg['searchEngineLinks'])) { $hreflink = $cfg['searchEngineLinks'][$tmpEngine]; $settings['searchEngineLinks'][$tmpEngine] = $hreflink; } else { $hreflink = getEngineLink($tmpEngine); $settings['searchEngineLinks'][$tmpEngine] = $hreflink; $settingsNeedsSaving = true; } if (strlen($hreflink) > 0) { $output .= "<a href=\"http://" . $hreflink . "/\" target=\"_blank\">"; if ($selectedEngine == $tmpEngine) { $output .= "<b>" . $hreflink . "</b>"; } else { $output .= $hreflink; } $output .= "</a><br>\n"; } } } } if (count($settings['searchEngineLinks'], COUNT_RECURSIVE) != count($cfg['searchEngineLinks'], COUNT_RECURSIVE)) { $settingsNeedsSaving = true; } if ($settingsNeedsSaving) { natcasesort($settings['searchEngineLinks']); saveSettings($settings); } return $output; }
$settings = $_POST['settings']; try { saveSettings($settings); writeSettingsCache(); succeedFlag(); } catch (Exception $e) { echo $e; } break; case "savemail": case "savefunopen": case "savecopyright": case "saveattachset": $settings = $_POST['settings']; try { saveSettings($settings, 0); writeGlobalCache(); succeedFlag(); } catch (Exception $e) { echo $e; } break; case "savecontact": $settings = $_POST['settings']; try { $db->row_delete("contact", "langid={$_SYS['alangid']}"); $settings['langid'] = $_SYS['alangid']; $db->row_insert("contact", $settings); writeContactCache(); printRes("{$_AL['main.ct.setsucceed']}<script>setTimeout(function(){reloadSelf('admin.php?inc=main&action=contact');},2000);</script>"); } catch (Exception $e) {
$i++; if (!fieldsValid($pSet['popFieldsMcal'])) { $errors[$i] = " class='inputError'"; } $i++; if (!fieldsValid($pSet['popFieldsSbar'])) { $errors[$i] = " class='inputError'"; } $i++; if ($pSet['sideBarDays'] < 1 or $pSet['sideBarDays'] > 365) { $errors[$i] = " class='inputError'"; } $i++; //no errors, save settings in database if (!in_array(" class='inputError'", $errors)) { $result = saveSettings($calID, $pSet, true); if ($result) { $msg = $ax['set_settings_saved']; } else { $msg = $ax['set_save_error']; } } else { //errors found $msg .= $ax['set_missing_invalid']; } } echo "<br><p class=\"error noPrint\">" . ($msg ? $msg : $ax['hover_for_details']) . "</p>\n"; ?> <!-- display form fields --> <form action='index.php?lc' method='post'> <div class='scrollBoxSe'>
$settings['SET_SHORT_URL_ON'] = cl($_POST['setShortUrl']) == 1 ? 1 : 0; $settings['SET_PRIVATE_IMG_ON'] = cl($_POST['setPrivateImg']) == 1 ? 1 : 0; $settings['SET_DIS_UPLOAD'] = cl($_POST['setDisUpload']) == 1 ? 1 : 0; $settings['SET_LANGUAGE'] = cl($_POST['setLanguage']); $settings['SET_IMAGE_WIDGIT'] = cl($_POST['setImageWidgit']) == 1 ? 1 : 0; $settings['SET_NODUPLICATE'] = cl($_POST['setNoDuplicate']) == 1 ? 1 : 0; $settings['SET_RESIZE_IMG_ON'] = cl($_POST['setResizeImg']) == 1 ? 1 : 0; $settings['SET_ADDTHIS'] = cl($_POST['setAddThis']); //Short url settings $settings['SET_SHORT_URL_API'] = cl($_POST['setSUrlApi']); $settings['SET_SHORT_URL_API_URL'] = cl($_POST['setSUrlApiUrl']); $settings['SET_SHORT_URL_PASS'] = cl($_POST['setSUrlApiPass']); $settings['SET_SHORT_URL_USER'] = cl($_POST['setSUrlApiUesr']); // save settings if (!is_feedback('error')) { if (saveSettings(CFINCPATH . 'set.php', $settings)) { user_feedback('success', _T("admin_set_suc_update"), 'saveing_settings'); cl_cache_folder(); } else { user_feedback('error', _T("admin_set_err_saveing_settings"), 'admin_set_saveing_settings'); } } } // page settings $page['id'] = 'set'; $page['title'] = 'Admin Settings page'; $page['description'] = ''; $page['tipsy'] = true; $page['fancybox'] = true; require CFROOTPATH . 'admin/admin_page_header.php'; ?>
case "restore2": restore2ChronoContact(0, $option); break; case "backexcel": BackupExcel($id, $option); break; case "backcsv": BackupCSV($id, $option); break; ////// config ////// config case 'config': showConfig($option); break; case 'saveconfig': saveSettings($option); break; case 'cancelconfig': cancelSettings($option); break; case 'save_conf': save_conf($option); break; ////// wizard ////// wizard case 'form_wizard': form_wizard('', $option); break; case 'wizardedit': form_wizard($cid[0], $option); break;
/** * first Login * * @param $username * @param $password */ function firstLogin($username = '', $password = '') { global $cfg, $db; if (!isset($username)) { return 0; } if (!isset($password)) { return 0; } if ($username == '') { return 0; } if ($password == '') { return 0; } $create_time = time(); // This user is first in DB. Make them super admin. // this is The Super USER, add them to the user table $record = array('user_id' => strtolower($username), 'password' => md5($password), 'hits' => 1, 'last_visit' => $create_time, 'time_created' => $create_time, 'user_level' => 2, 'hide_offline' => 0, 'theme' => $cfg["default_theme"], 'language_file' => $cfg["default_language"], 'state' => 1); $sTable = 'tf_users'; $sql = $db->GetInsertSql($sTable, $record); $result = $db->Execute($sql); if ($db->ErrorNo() != 0) { dbError($sql); } // Test and setup some paths for the TF settings // path $tfPath = $cfg["path"]; if (!is_dir($cfg["path"])) { $tfPath = getcwd() . "/downloads/"; } // settings $settings = array("path" => $tfPath, "pythonCmd" => $cfg["pythonCmd"], "perlCmd" => $cfg["perlCmd"], "bin_php" => $cfg["bin_php"], "bin_grep" => $cfg["bin_grep"], "bin_awk" => $cfg["bin_awk"], "bin_du" => $cfg["bin_du"], "bin_wget" => $cfg["bin_wget"], "bin_unrar" => $cfg["bin_unrar"], "bin_unzip" => $cfg["bin_unzip"], "bin_cksfv" => $cfg["bin_cksfv"], "bin_vlc" => $cfg["bin_vlc"], "bin_uudeview" => $cfg["bin_uudeview"], "btclient_transmission_bin" => $cfg["btclient_transmission_bin"], "bin_netstat" => $cfg["bin_netstat"], "bin_sockstat" => $cfg["bin_sockstat"]); // binaries to test $binaries = array("pythonCmd" => $cfg["pythonCmd"], "perlCmd" => $cfg["perlCmd"], "bin_php" => $cfg["bin_php"], "bin_grep" => $cfg["bin_grep"], "bin_awk" => $cfg["bin_awk"], "bin_du" => $cfg["bin_du"], "bin_wget" => $cfg["bin_wget"], "bin_unrar" => $cfg["bin_unrar"], "bin_unzip" => $cfg["bin_unzip"], "bin_cksfv" => $cfg["bin_cksfv"], "bin_vlc" => $cfg["bin_vlc"], "bin_uudeview" => $cfg["bin_uudeview"], "btclient_transmission_bin" => $cfg["btclient_transmission_bin"], "bin_netstat" => $cfg["bin_netstat"], "bin_sockstat" => $cfg["bin_sockstat"]); // bins for which $bins = array("pythonCmd" => "python", "perlCmd" => "perl", "bin_php" => "php", "bin_grep" => "grep", "bin_awk" => "awk", "bin_du" => "du", "bin_wget" => "wget", "bin_unrar" => "unrar", "bin_unzip" => "unzip", "bin_cksfv" => "cksfv", "bin_vlc" => "vlc", "bin_uudeview" => "uudeview", "btclient_transmission_bin" => "transmissioncli", "bin_netstat" => "netstat", "bin_sockstat" => "sockstat"); // check foreach ($binaries as $key => $value) { if (!is_file($value)) { $bin = ""; $bin = @trim(shell_exec("which " . $bins[$key])); if ($bin != "") { $settings[$key] = $bin; } } } // save saveSettings('tf_settings', $settings); AuditAction($cfg["constants"]["update"], "Initial Settings Updated for first login."); }
function register() { global $SETTINGS, $APP; # NOTE: Disabling or modifying licensing or registration code violates your license agreement and is willful copyright infringement. # NOTE: Copyright infringement can be very expensive: http://en.wikipedia.org/wiki/Statutory_damages_for_copyright_infringement # NOTE: Please do not steal our software. // get filepath $caller = array_pop(@debug_backtrace()); $filepath = realpath($caller['file']); ### Build registration query $hostname = getFirstDefinedValue($_SERVER["HTTP_HOST"], $_SERVER["SERVER_NAME"], @$_SERVER["SERVER_ADDR"]); $url = $_SERVER["SCRIPT_NAME"]; $reginfo = 'reg1=' . urlencode($SETTINGS['licenseCompanyName']); # Company Name $reginfo .= '®2=' . urlencode($SETTINGS['licenseDomainName']); # Domain Name $reginfo .= '&lnum=' . isValidProductId($SETTINGS['licenseProductId']); # License Number $reginfo .= '&prog=' . $APP['id']; # Program Id $reginfo .= '&ver=' . $APP['version']; # Program Version $reginfo .= '&url=' . urlencode("{$hostname}{$url}"); # script url $reginfo .= '&filepath=' . urlencode($filepath); # script filepath # get license status list($response, $statusCode) = getPage("http://www.registerSoftware.to/register/register.cgi?{$reginfo}"); if (preg_match('/license.invalid/', $response)) { $isDisabled = 1; } else { if (preg_match('/license.valid/', $response)) { $isDisabled = 0; } else { $isDisabled = $SETTINGS['isDisabled']; } } # on unrecognized response do nothing # save settings $SETTINGS['installPath'] = _getInstallPath(); $SETTINGS['isDisabled'] = $isDisabled; $SETTINGS['dateRegistered'] = time(); saveSettings(); // return !$isDisabled; }
<?php include_once '../../../wp-load.php'; global $wpdb; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $data = verifyData(); saveSettings($data); } else { echo json_encode(array("status" => "error", "message" => "Bad HTTP method")); die("Incorret HTTP Method"); } function verifyData() { if (strlen($_POST["account_sid"]) != 34) { echo json_encode(array("status" => "error", "message" => "AccountSID must be 34 characters")); die; } if (strlen($_POST["account_auth"]) != 32) { echo json_encode(array("status" => "error", "message" => "AccountAuth must be 32 characters")); die; } if (strlen($_POST["service_sid"]) != 34) { echo json_encode(array("status" => "error", "message" => "ServiceSID must be 34 characters")); die; } $phone = $_POST["phone"]; $phone = str_replace("(", "", $phone); $phone = str_replace(")", "", $phone); $phone = str_replace("-", "", $phone); $phone = str_replace("+", "", $phone); $phone = str_replace(" ", "", $phone);
} else { $idGroupe = $groupe; } if ($versionUrl == '') { $versionUrl = '-'; } if ($versionPass == '') { $versionPass = '******'; } $blog = array('groupe' => $idGroupe, 'name' => $name, 'url' => $url, 'version_url' => $versionUrl, 'version_pass' => $versionPass); if ($idSite != '') { $gSettings['sites']['site'][$idSite] = $blog; } else { $gSettings['sites']['site'][] = $blog; } saveSettings($gSettings); cacheDel(md5($url)); redirectInterne('./'); } } if ($eSite['version_url'] == '-') { $eSite['version_url'] = ''; } if ($eSite['version_pass'] == '-') { $eSite['version_pass'] = ''; } $metaTitle = 'PWD - Ajouter / modifier un blog'; include 'includes/header.inc.php'; include 'includes/navigation.inc.php'; ?> <div id="page-wrapper">
$setting['timeoffset'] = '8'; $setting['humantime'] = '0'; $setting['isgzip'] = '0'; $setting['isoff'] = '0'; $setting['metakeywords'] = $_AL['lang.sys.keyword']; $setting['metadescription'] = $_AL['lang.sys.desc']; $setting['urlrewrite'] = '0'; $setting['template'] = '6kzz'; $setting['templatelang'] = 'zh_cn.php'; $setting['perpagepro'] = '12'; $setting['perpageart'] = '15'; $setting['perpagemsg'] = '10'; $setting['signupsecuritycode'] = '0'; $setting['loginsecuritycode'] = '0'; $setting['msgsecuritycode'] = '0'; saveSettings($setting); //Contact $contact['company'] = $_AL['lang.ct.contact']; $contact['contact'] = $_AL['lang.ct.contact']; $contact['email'] = $_AL['lang.ct.email']; $contact['qq'] = $_AL['lang.ct.qq']; $contact['phone'] = $_AL['lang.ct.phone']; $db->row_delete("contact", "langid={$_SYS['alangid']}"); $contact['langid'] = $_SYS['alangid']; $db->row_insert("contact", $contact); } } writeLangsCache(); reBuildLang(); succeedFlag(); } catch (Exception $e) {
if (!fieldsValid($pSet['popFieldsSbar'])) { $errors[$i] = " class='inputError'"; } $i++; if ($pSet['sideBarDays'] < 1 or $pSet['sideBarDays'] > 365) { $errors[$i] = " class='inputError'"; } $i++; //no errors, save settings in database if (!in_array(" class='inputError'", $errors)) { if ($calMenu != $dbSel) { $dbSel = $calMenu; saveConfig(); //save config data } $result = saveSettings($pSet); if ($result) { $msg = $ax['set_settings_saved']; } else { $msg = $ax['set_save_error']; } } else { //errors found $msg .= $ax['set_missing_invalid']; } } echo "<br><p class=\"error noPrint\">" . ($msg ? $msg : $ax['hover_for_details']) . "</p>\n"; //display form fields echo "<form action='index.php?lc' method='post'>\n\t<input type='hidden' name='token' value='{$_SESSION['token']}'>\n\t<input class='button saveSettings noPrint' type='submit' name='save' value='{$ax['set_save_settings']}'>\n\t<div class='scrollBoxSe'>\n\t<div class='centerBoxFix'>"; $selected = " selected='selected'"; $i = 0;
/** * **/ function saveGroup($backend, $group) { global $groups; $settings = array(); $val = CAT_Helper_Validate::getInstance(); foreach ($groups[$group] as $key) { $settings[$key] = $val->sanitizePost($key); } saveSettings($settings); }
$resMsg[] = "Into calendar '{$selCal}'"; $resMsg[] = "<br>"; $resMsg[] = "- Table events: {$count['eve']} records inserted"; $resMsg[] = "- Table users: {$count['use']} records inserted"; $resMsg[] = "- Table groups: {$count['gro']} records inserted"; $resMsg[] = "- Table categories: {$count['cat']} records inserted"; $resMsg[] = "- Table settings: {$count['set']} records inserted"; $lcVUpg = upgradeDb(); //upgrade db schema $resMsg[] = "<br>"; $resMsg[] = "Imported database upgraded from V{$lcVUpg} to V" . substr($lcV, 0, 3); $dbSet = getSettings(); //get imported settings checkSettings($dbSet); //check & complete settings saveSettings($dbSet); //save completed settings $resMsg[] = "<br>"; $resMsg[] = "Imported settings verified/completed"; } else { $errMsg[] = "The selected backup file could not be imported"; } $stH = null; //release statement handle $dbH = null; //close db } //end of case session_unset(); //force retrieve of settings and selection of default calendar //display Action result
function cron_logErrorsOnDieOrExit() { if (!@$GLOBALS['CRON_JOB_LOG_NUM']) { return; } $summary = t("Returned errors"); $output = ob_get_clean(); $runtime = sprintf("%0.2f", microtime(true) - $GLOBALS['CRON_JOB_START']); // update job log entry mysql_update('_cron_log', $GLOBALS['CRON_JOB_LOG_NUM'], null, array('summary' => $summary, 'output' => $output, 'runtime' => $runtime)); // send email $secondsAgo = time() - $GLOBALS['SETTINGS']['bgtasks_lastEmail']; if ($secondsAgo >= 60 * 60) { // don't email more than once an hour // get email placeholders $cronLog = mysql_get('_cron_log', $GLOBALS['CRON_JOB_LOG_NUM']); $placeholders = array('bgtask.date' => $cronLog['createdDate'], 'bgtask.activity' => $cronLog['activity'], 'bgtask.summary' => nl2br(htmlencode($cronLog['summary'])), 'bgtask.completed' => $cronLog['completed'], 'bgtask.function' => $cronLog['function'], 'bgtask.output' => nl2br(htmlencode($cronLog['output'])), 'bgtask.runtime' => $cronLog['runtime'], 'bgtask.function' => $cronLog['function'], 'bgtasks.logsUrl' => realUrl("?menu=_cron_log", $GLOBALS['SETTINGS']['adminUrl']), 'bgtasks.settingsUrl' => realUrl("?menu=admin&action=general#background-tasks", $GLOBALS['SETTINGS']['adminUrl'])); // send message $errors = sendMessage(emailTemplate_loadFromDB(array('template_id' => 'CMS-BGTASK-ERROR', 'placeholders' => $placeholders))); if ($errors) { die("Mail Error: {$errors}"); } // update last emailed time $GLOBALS['SETTINGS']['bgtasks_lastEmail'] = time(); saveSettings(); } }
/** * Ajoute un groupe et retourne l'id correspondant * Si le groupe existe déjà, l'id de ce groupe est retourné et aucun groupe n'est ajouté * @param string $groupe */ function addNewGroupe($groupe = '') { global $gSettings; if (isset($gSettings['options']['groupes']['groupe']) === TRUE) { foreach ($gSettings['options']['groupes']['groupe'] as $id => $eGroupe) { if ($eGroupe['name'] == $groupe) { return $id; } } } $groupeNew = array('id' => createIdFromGroupe($groupe), 'name' => $groupe); $gSettings['options']['groupes']['groupe'][] = $groupeNew; saveSettings($gSettings); return $groupeNew['id']; }
/** * updateSearchSettings */ function admin_updateSearchSettings() { global $cfg; $settings = array(); foreach ($_POST as $key => $value) { if ($key != "searchEngine") { $settings[$key] = $value; } } if (count($settings) > 0) { saveSettings('tf_settings', $settings); AuditAction($cfg["constants"]["admin"], "Updating Search Settings"); } $searchEngine = tfb_getRequestVar('searchEngine'); if (empty($searchEngine)) { $searchEngine = $cfg["searchEngine"]; } @header("location: admin.php?op=searchSettings&searchEngine=" . $searchEngine); exit; }
<form action="admin.php" method="post"> <?php if (isset($_POST['save'])) { if (!isset($_POST['debug_mode'])) { $_POST['debug_mode'] = 'false'; } if ($_POST['debug_mode'] != 'true') { $_POST['debug_mode'] = 'false'; } if (!isset($_POST['imdb_mode'])) { $_POST['imdb_mode'] = 'false'; } if ($_POST['imdb_mode'] != 'true') { $_POST['imdb_mode'] = 'false'; } $replace_with = array('title' => $_POST['title'], 'fp_display' => $_POST['fp_display'], 'page_display' => $_POST['page_display'], 'm_display' => $_POST['m_display'], 'debug_mode' => $_POST['debug_mode'], 'movie_order' => $_POST['movie_order'], 'language' => $_POST['language'], 'info_photos' => $_POST['info_photos'], 'tvshow_season_order' => $_POST['tvshow_season_order'], 'tvshow_episode_order' => $_POST['tvshow_episode_order'], 'player_type' => $_POST['player_type'], 'google_domain' => $_POST['google_domain'], 'directories' => saveSettings($_POST['directories']), 'mobile' => saveSettings($_POST['mobile']), 'extensions' => saveSettings($_POST['extensions']), 'genres' => saveSettings($_POST['genres']), 'garbage' => saveSettings($_POST['garbage'])); $fh = fopen($settings_file, 'w'); foreach ($settings_data as $key => $value) { if (!empty($replace_with[$key])) { $value = $replace_with[$key]; } fwrite($fh, "{$key}={$value}" . PHP_EOL); } fclose($fh); ?> <script type="text/javascript"> window.location = "admin.php" </script><?php } ?> <div style="float:left;"> <table> <tr>
/** * Simply modifying cache functions * * @param bool $return_config = false */ function ModifyCacheSettings($return_config = false) { global $context, $scripturl, $txt, $helptxt, $cache_enable; // Detect all available optimizers $detected = array(); if (function_exists('eaccelerator_put')) { $detected['eaccelerator'] = $txt['eAccelerator_cache']; } if (function_exists('mmcache_put')) { $detected['mmcache'] = $txt['mmcache_cache']; } if (function_exists('apc_store')) { $detected['apc'] = $txt['apc_cache']; } if (function_exists('output_cache_put') || function_exists('zend_shm_cache_store')) { $detected['zend'] = $txt['zend_cache']; } if (function_exists('memcache_set') || function_exists('memcached_set')) { $detected['memcached'] = $txt['memcached_cache']; } if (function_exists('xcache_set')) { $detected['xcache'] = $txt['xcache_cache']; } // set a message to show what, if anything, we found if (empty($detected)) { $txt['cache_settings_message'] = $txt['detected_no_caching']; } else { $txt['cache_settings_message'] = sprintf($txt['detected_accelerators'], implode(', ', $detected)); } // This is always an option $detected['smf'] = $txt['default_cache']; // Define the variables we want to edit. $config_vars = array(array('', $txt['cache_settings_message'], '', 'desc'), array('cache_enable', $txt['cache_enable'], 'file', 'select', array($txt['cache_off'], $txt['cache_level1'], $txt['cache_level2'], $txt['cache_level3']), 'cache_enable'), array('cache_accelerator', $txt['cache_accelerator'], 'file', 'select', $detected), array('cache_memcached', $txt['cache_memcached'], 'file', 'text', $txt['cache_memcached'], 'cache_memcached'), array('cachedir', $txt['cachedir'], 'file', 'text', 36, 'cache_cachedir')); // some javascript to enable / disable certain settings if the option is not selected $context['settings_post_javascript'] = ' var cache_type = document.getElementById(\'cache_accelerator\'); createEventListener(cache_type); cache_type.addEventListener("change", toggleCache); toggleCache();'; call_integration_hook('integrate_modify_cache_settings', array(&$config_vars)); if ($return_config) { return $config_vars; } // Saving again? if (isset($_GET['save'])) { call_integration_hook('integrate_save_cache_settings'); saveSettings($config_vars); // we need to save the $cache_enable to $modSettings as well updatesettings(array('cache_enable' => (int) $_POST['cache_enable'])); // exit so we reload our new settings on the page redirectexit('action=admin;area=serversettings;sa=cache;' . $context['session_var'] . '=' . $context['session_id']); } // if its off, allow them to clear it as well // @todo why only when its off ? if (empty($cache_enable)) { loadLanguage('ManageMaintenance'); createToken('admin-maint'); $context['template_layers'][] = 'clean_cache_button'; } $context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cache;save'; $context['settings_title'] = $txt['caching_settings']; $context['settings_message'] = $txt['caching_information']; // Prepare the template. createToken('admin-ssc'); prepareServerSettingsContext($config_vars); }
function updateUiSettings() { global $cfg; $settings = processSettingsParams(); saveSettings($settings); AuditAction($cfg["constants"]["admin"], " Updating TorrentFlux UI Settings"); header("location: admin.php?op=uiSettings"); }
function _init_loadSettings() { // get settings filenames and paths (either) list($hostnameWithoutPort) = explode(':', strtolower(@$_SERVER['HTTP_HOST'])); $hostnameWithoutPort = preg_replace('/[^\\w\\-\\.]/', '', $hostnameWithoutPort); // security: HTTP_HOST is user defined - remove non-filename chars to prevent ../ attacks $hostnameWithoutPort = preg_replace('/^www\\./i', '', $hostnameWithoutPort); // v2.50 - usability: don't require www. prefix so www.example.com and example.com both check for settings.example.com.php $settings_fileName = 'settings.' . preg_replace('/[^\\w\\-\\.]/', '', $hostnameWithoutPort) . '.php'; $settings_filePath = DATA_DIR . '/' . $settings_fileName; // supports host based settings files such as: /data/settings.localhost.php define('SETTINGS_DEV_FILENAME', $settings_fileName); define('SETTINGS_DEV_FILEPATH', DATA_DIR . '/' . SETTINGS_DEV_FILENAME); // set settings name and path for this server $useDev = is_file(SETTINGS_DEV_FILEPATH); define('SETTINGS_FILENAME', $useDev ? SETTINGS_DEV_FILENAME : 'settings.dat.php'); define('SETTINGS_FILEPATH', $useDev ? SETTINGS_DEV_FILEPATH : DATA_DIR . '/settings.dat.php'); // Require hostname-based settings files on development server domains (this section to be expanded) if (isInstalled() && isDevServer() && !is_file(SETTINGS_DEV_FILEPATH)) { header("Content-type: text/plain"); die("Development server requires custom settings files. Delete /data/isInstalled.php and re-install to create one."); } // load settings global $SETTINGS; if (!is_file(SETTINGS_FILEPATH)) { renameOrRemoveDefaultFiles(); } // rename settings.dat.php.default to settings.dat.php $SETTINGS = loadStructOrINI(SETTINGS_FILEPATH); // legacy support $SETTINGS['advanced']['encryptPasswords'] = 1; // added in 2.08, removed in 2.62 (force on for legacy support since encryption is always required now) ### set defaults (if not already defined in settings file - this happens when a user upgrades) // NOTE: Do this here for future instead of _upgradeSettings() $defaults = array('language' => '', 'adminEmail' => '', 'adminUrl' => '', 'cookiePrefix' => substr(md5(mt_rand()), 0, 5) . '_', 'activePlugins' => '', 'headerImageUrl' => '', 'footerHTML' => '', 'dateFormat' => '', 'cssTheme' => 'blue.css', 'webRootDir' => @$_SERVER['DOCUMENT_ROOT'], 'wysiwyg' => array(), 'advanced' => array(), 'bgtasks_lastRun' => '0', 'bgtasks_lastEmail' => '0', 'webPrefixUrl' => ''); $wysiwygDefaults = array('wysiwygLang' => 'en', 'includeDomainInLinks' => '0'); $advancedDefaults = array('imageResizeQuality' => 80, 'showExpandedMenu' => 0, 'disableFlashUploader' => 0, 'codeGeneratorExpertMode' => 0, 'hideLanguageSettings' => 0, 'session_cookie_domain' => '', 'session_save_path' => '', 'useDatepicker' => 0, 'requireHTTPS' => 0, 'httpProxyServer' => '', 'allowRelatedRecordsDragSorting' => 0, 'outgoingMail' => 'sendOnly', 'languageDeveloperMode' => 0, 'login_expiry_limit' => '30', 'login_expiry_unit' => 'minutes', 'restrictByIP' => 0, 'restrictByIP_allowed' => '', 'smtp_method' => 'php', 'smtp_hostname' => '', 'smtp_port' => '', 'smtp_username' => '', 'smtp_password' => '', 'phpHideErrors' => '0', 'phpEmailErrors' => '0', 'checkReferer' => '1', 'disableAutocomplete' => '0'); foreach ($defaults as $key => $value) { if (!array_key_exists($key, $SETTINGS)) { $SETTINGS[$key] = $value; } } foreach ($wysiwygDefaults as $key => $value) { if (!array_key_exists($key, $SETTINGS['wysiwyg'])) { $SETTINGS['wysiwyg'][$key] = $value; } } foreach ($advancedDefaults as $key => $value) { if (!array_key_exists($key, $SETTINGS['advanced'])) { $SETTINGS['advanced'][$key] = $value; } } ### custom defaults // adminUrl - update if url path has changed if (defined('IS_CMS_ADMIN')) { $hasAdminPathChanged = parse_url(thisPageUrl(), PHP_URL_PATH) != parse_url(@$SETTINGS['adminUrl'], PHP_URL_PATH); if ($hasAdminPathChanged) { // only update adminUrl when in the CMS admin $SETTINGS['adminUrl'] = @array_shift(explode('?', thisPageUrl())); // added in 2.12 - this must be set when admin.php is being access directly so we get the right URL saveSettings(); alert(sprintf(t("Updating Program Url to: %s") . "<br/>\n", $SETTINGS['adminUrl'])); } } // set default uploadDir and uploadUrl (do this here as above defaults code only runs when keys are undefined, not when they are blank) if (!$SETTINGS['uploadDir']) { $SETTINGS['uploadDir'] = 'uploads/'; // previously: /../uploads/ } if (!$SETTINGS['uploadUrl'] && !inCLI()) { // SCRIPT_NAME is set to filepath not web path when running in CLI, giving us incorrect values $SETTINGS['uploadUrl'] = dirname($_SERVER['SCRIPT_NAME']) . "/uploads/"; // previously: /../uploads/ $SETTINGS['uploadUrl'] = realUrl($SETTINGS['uploadUrl']); // remove ../ parent reference $SETTINGS['uploadUrl'] = parse_url($SETTINGS['uploadUrl'], PHP_URL_PATH); // remove scheme://hostname and leave /url/path } // remove old settings $removeKeys = array('vendorPoweredBy', 'timezoneOffsetAddMinus', 'timezoneOffsetHours', 'timezoneOffsetMinutes'); $removeCount = 0; foreach ($removeKeys as $key) { if (array_key_exists($key, $SETTINGS)) { unset($SETTINGS[$key]); $removeCount++; } } if ($removeCount) { saveSettings(); } // remove/convert old 'isInstalled' setting (from v2.09) if (array_key_exists('isInstalled', $SETTINGS)) { isInstalled(true); // set new installed status (semaphore file) unset($SETTINGS['isInstalled']); saveSettings(); } // Update PHP config with SMTP values from settings (only effects users who call mail() explicitly) if ($GLOBALS['SETTINGS']['advanced']['smtp_hostname']) { ini_set('SMTP', $GLOBALS['SETTINGS']['advanced']['smtp_hostname']); } if ($GLOBALS['SETTINGS']['advanced']['smtp_port']) { ini_set('smtp_port', $GLOBALS['SETTINGS']['advanced']['smtp_port']); } // Note: We don't need to return $SETTINGS because we're modifying the global. }
if (User::isAdmin()) { $arr_users = User::getAdminUsers(true); // users of this admin $obj_smarty->assign('users', $arr_users); } } else { $obj_smarty->display(FULLCAL_DIR . '/login.html'); exit; } if (isset($_GET['action'])) { switch ($_GET['action']) { case 'get_settings': getSettings(); break; case 'save_settings': saveSettings(); break; default: die('no such action available'); } exit; } else { $arr_user = User::getUser(); $obj_smarty->assign('active', 'settings'); $obj_smarty->assign('settings', Settings::getSettings($arr_user['user_id'])); $obj_smarty->assign('user_id', $arr_user['user_id']); $obj_smarty->display(FULLCAL_DIR . '/view/admin_panel.tpl'); } function saveSettings() { global $error;
function deactivatePlugin($file) { global $SETTINGS; // remove plugin from list $activePluginFiles = array(); foreach (preg_split('/,\\s+/', $SETTINGS['activePlugins']) as $activeFile) { $activePluginFiles[$activeFile] = 1; } unset($activePluginFiles[$file]); // save settings $GLOBALS['SETTINGS']['activePlugins'] = join(', ', array_keys($activePluginFiles)); saveSettings(); doAction('plugin_deactivate', $file); }
function ModifyLanguageSettings($return_config = false) { global $scripturl, $context, $txt, $boarddir, $settings, $smcFunc; // Warn the user if the backup of Settings.php failed. $settings_not_writable = !is_writable($boarddir . '/Settings.php'); $settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php'); /* If you're writing a mod, it's a bad idea to add things here.... For each option: variable name, description, type (constant), size/possible values, helptext. OR an empty string for a horizontal rule. OR a string for a titled section. */ $config_vars = array('language' => array('language', $txt['default_language'], 'file', 'select', array(), null, 'disabled' => $settings_not_writable), array('userLanguage', $txt['userLanguage'], 'db', 'check', null, 'userLanguage')); if ($return_config) { return $config_vars; } // Get our languages. No cache and use utf8. getLanguages(false, false); foreach ($context['languages'] as $lang) { $config_vars['language'][4][$lang['filename']] = array($lang['filename'], strtr($lang['name'], array('-utf8' => ' (UTF-8)'))); } // Saving settings? if (isset($_REQUEST['save'])) { checkSession(); saveSettings($config_vars); redirectexit('action=admin;area=languages;sa=settings'); } // Setup the template stuff. $context['post_url'] = $scripturl . '?action=admin;area=languages;sa=settings;save'; $context['settings_title'] = $txt['language_settings']; $context['save_disabled'] = $settings_not_writable; if ($settings_not_writable) { $context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br />'; } elseif ($settings_backup_fail) { $context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br />'; } // Fill the config array. prepareServerSettingsContext($config_vars); }
} else { user_feedback('error', _T("admin_log_forgot_password_err"), 'admin_log_forgot_password_2'); } } // FORGOT YOUR PASSWORD - NEW PASSWORD if (isset($_POST['action']) && $_POST['action'] == 'reset') { //check reset code if (file_exists(CFDATAPATH . 'rs.cf')) { $reset_db2 = loadfile(CFDATAPATH . 'rs.cf'); if ($reset_db2['id'] == $_SESSION['reset_password'] && $reset_db2['date'] + 3600 > time()) { //Password if (!empty($_POST['newPassword']) && !empty($_POST['newConfirm'])) { if (cl($_POST['newPassword']) == cl($_POST['newConfirm'])) { $settings['SET_PASSWORD'] = md5(md5(cl($_POST['newPassword'])) . $settings['SET_SALTING']); // save settings if (saveSettings('inc/set.php', $settings)) { user_feedback('success', _T("admin_log_forgot_password_update"), 'password_update'); @unlink(CFDATAPATH . 'rs.cf'); } else { user_feedback('error', _T("admin_set_err_saveing_settings"), 'admin_log_password_update'); $reset_password = true; } } else { user_feedback('error', _T("admin_set_err_password_wrong"), 'admin_log_password_wrong'); $reset_password = true; } } else { user_feedback('error', _T("admin_set_err_password_both"), 'admin_log_password_both'); $reset_password = true; } } else {
function _upgradeSettings() { global $SETTINGS, $APP; // NOTE: These are now set in _init_loadSettings() // save INI (do this once when upgrading to make sure any new settings are saved) saveSettings(); }
function updateSearchSettings() { global $cfg; foreach ($_POST as $key => $value) { if ($key != "searchEngine") { $settings[$key] = $value; } } saveSettings($settings); AuditAction($cfg["constants"]["admin"], " Updating TorrentFlux Search Settings"); $searchEngine = getRequestVar('searchEngine'); if (empty($searchEngine)) { $searchEngine = $cfg["searchEngine"]; } header("location: admin.php?op=searchSettings&searchEngine=" . $searchEngine); }