本文整理汇总了PHP中updatesettings函数的典型用法代码示例。如果您正苦于以下问题:PHP updatesettings函数的具体用法?PHP updatesettings怎么用?PHP updatesettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updatesettings函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runcron
function runcron($cronid = 0)
{
global $timestamp, $db, $tablepre, $_DCACHE;
$query = $db->query("SELECT * FROM {$tablepre}crons WHERE " . ($cronid ? "cronid='{$cronid}'" : "available>'0' AND nextrun<='{$timestamp}'") . " ORDER BY nextrun LIMIT 1");
if ($cron = $db->fetch_array($query)) {
$lockfile = DISCUZ_ROOT . './forumdata/runcron_' . $cron['cronid'] . '.lock';
$cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
$cronfile = DISCUZ_ROOT . './include/crons/' . $cron['filename'];
if (is_writable($lockfile) && filemtime($lockfile) > $timestamp - 600) {
return NULL;
} else {
@touch($lockfile);
}
@set_time_limit(1000);
@ignore_user_abort(TRUE);
$cron['minute'] = explode("\t", $cron['minute']);
cronnextrun($cron);
extract($GLOBALS, EXTR_SKIP);
if (!@(include $cronfile)) {
errorlog('CRON', $cron['name'] . ' : Cron script(' . $cron['filename'] . ') not found or syntax error', 0);
}
@unlink($lockfile);
}
$query = $db->query("SELECT nextrun FROM {$tablepre}crons WHERE available>'0' ORDER BY nextrun LIMIT 1");
$nextrun = $db->result($query, 0);
if (!$nextrun === FALSE) {
require_once DISCUZ_ROOT . './include/cache.func.php';
$_DCACHE['settings']['cronnextrun'] = $db->result($query, 0);
updatesettings();
}
}
示例2: insenz_onlinestats
function insenz_onlinestats()
{
global $timestamp, $db, $tablepre, $_DCACHE;
require_once DISCUZ_ROOT . './include/cache.func.php';
$_DCACHE['settings']['insenz']['statsnextrun'] = $timestamp + 3600;
updatesettings();
$onlinenum = $db->result($db->query("SELECT COUNT(*) FROM {$tablepre}sessions WHERE lastactivity>=({$timestamp}-900)"), 0);
$db->query("REPLACE INTO {$tablepre}statvars (type, variable, value) VALUES ('houronlines', '" . gmdate('ymdH', $timestamp + 8 * 3600) . "', '{$onlinenum}')");
}
示例3: insenz_cronnextrun
function insenz_cronnextrun($cronnextrun)
{
global $_DCACHE;
if (empty($_DCACHE['settings']['insenz']['cronnextrun']) || $cronnextrun < $_DCACHE['settings']['insenz']['cronnextrun']) {
require_once DISCUZ_ROOT . './include/cache.func.php';
$_DCACHE['settings']['insenz']['cronnextrun'] = $cronnextrun;
updatesettings();
}
}
示例4: unset
$catlist[0]['type'] = 'group';
$catlist[0]['name'] = $bbname;
$catlist[0]['collapseimg'] = 'collapsed_no.gif';
} else {
unset($catlist[0]);
}
if ($whosonlinestatus == 1 || $whosonlinestatus == 3) {
$whosonlinestatus = 1;
$onlineinfo = explode("\t", $onlinerecord);
if (empty($_DCOOKIE['onlineusernum'])) {
$onlinenum = $db->result_first("SELECT COUNT(*) FROM {$tablepre}sessions");
if ($onlinenum > $onlineinfo[0]) {
$_DCACHE['settings']['onlinerecord'] = $onlinerecord = "{$onlinenum}\t{$timestamp}";
$db->query("UPDATE {$tablepre}settings SET value='{$onlinerecord}' WHERE variable='onlinerecord'");
require_once DISCUZ_ROOT . './include/cache.func.php';
updatesettings();
$onlineinfo = array($onlinenum, $timestamp);
}
dsetcookie('onlineusernum', intval($onlinenum), 300);
} else {
$onlinenum = intval($_DCOOKIE['onlineusernum']);
}
$onlineinfo[1] = gmdate($dateformat, $onlineinfo[1] + $timeoffset * 3600);
$detailstatus = $showoldetails == 'yes' || (!isset($_DCOOKIE['onlineindex']) && !$whosonline_contract || $_DCOOKIE['onlineindex']) && $onlinenum < 500 && !$showoldetails;
if ($detailstatus) {
@(include language('actions'));
$discuz_uid && updatesession();
$membercount = $invisiblecount = 0;
$whosonline = array();
$maxonlinelist = $maxonlinelist ? $maxonlinelist : 500;
$query = $db->query("SELECT uid, username, groupid, invisible, action, lastactivity, fid FROM {$tablepre}sessions " . (isset($_DCACHE['onlinelist'][7]) ? '' : 'WHERE uid <> 0') . " ORDER BY uid DESC LIMIT " . $maxonlinelist);
示例5: updatecreditsettings
function updatecreditsettings($get, $post)
{
global $_DCACHE;
if (!API_UPDATECREDITSETTINGS) {
return API_RETURN_FORBIDDEN;
}
$credit = $get['credit'];
$outextcredits = array();
if ($credit) {
foreach ($credit as $appid => $credititems) {
if ($appid == UC_APPID) {
foreach ($credititems as $value) {
$outextcredits[] = array('appiddesc' => $value['appiddesc'], 'creditdesc' => $value['creditdesc'], 'creditsrc' => $value['creditsrc'], 'title' => $value['title'], 'unit' => $value['unit'], 'ratiosrc' => $value['ratiosrc'], 'ratiodesc' => $value['ratiodesc'], 'ratio' => $value['ratio']);
}
}
}
}
require_once $this->appdir . './forumdata/cache/cache_settings.php';
require_once $this->appdir . './include/cache.func.php';
$this->db->query("REPLACE INTO " . $this->tablepre . "settings (variable, value) VALUES ('outextcredits', '" . addslashes(serialize($outextcredits)) . "');", 'UNBUFFERED');
$tmp = array();
foreach ($outextcredits as $value) {
$key = $value['appiddesc'] . '|' . $value['creditdesc'];
if (!isset($tmp[$key])) {
$tmp[$key] = array('title' => $value['title'], 'unit' => $value['unit']);
}
$tmp[$key]['ratiosrc'][$value['creditsrc']] = $value['ratiosrc'];
$tmp[$key]['ratiodesc'][$value['creditsrc']] = $value['ratiodesc'];
$tmp[$key]['creditsrc'][$value['creditsrc']] = $value['ratio'];
}
$_DCACHE['settings']['outextcredits'] = $tmp;
updatesettings();
return API_RETURN_SUCCEED;
}
示例6: updateapps
function updateapps($get, $post)
{
global $_DCACHE;
if (!API_UPDATEAPPS) {
return API_RETURN_FORBIDDEN;
}
$UC_API = $post['UC_API'];
if (empty($post) || empty($UC_API)) {
return API_RETURN_SUCCEED;
}
$cachefile = $this->appdir . './uc_client/data/cache/apps.php';
$fp = fopen($cachefile, 'w');
$s = "<?php\r\n";
$s .= '$_CACHE[\'apps\'] = ' . var_export($post, TRUE) . ";\r\n";
fwrite($fp, $s);
fclose($fp);
if (is_writeable($this->appdir . './config.inc.php')) {
$configfile = trim(file_get_contents($this->appdir . './config.inc.php'));
$configfile = substr($configfile, -2) == '?>' ? substr($configfile, 0, -2) : $configfile;
$configfile = preg_replace("/define\\('UC_API',\\s*'.*?'\\);/i", "define('UC_API', '{$UC_API}');", $configfile);
if ($fp = @fopen($this->appdir . './config.inc.php', 'w')) {
@fwrite($fp, trim($configfile));
@fclose($fp);
}
}
global $_DCACHE;
require_once $this->appdir . './forumdata/cache/cache_settings.php';
require_once $this->appdir . './include/cache.func.php';
foreach ($post as $appid => $app) {
$_DCACHE['settings']['ucapp'][$appid]['viewprourl'] = $app['url'] . $app['viewprourl'];
}
updatesettings();
return API_RETURN_SUCCEED;
}
示例7: ModifyCacheSettings
/**
* 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);
}
示例8: explode
<!DOCTYPE html>
<?php
require "functions/admincheck.php";
require "functions/cmum.php";
$counters = explode(";", counter());
if (isset($_POST["bsave"]) && $_POST["bsave"] == "Save Changes") {
if (!isset($_POST["def_profiles"])) {
$def_profiles = "";
} else {
$def_profiles = $_POST["def_profiles"];
}
$updnotice = updatesettings($_POST["servername"], $_POST["timeout"], $_POST["rndstring"], $_POST["rndstringlength"], $_POST["loglogins"], $_POST["logactivity"], $_POST["cleanlogin"], $_POST["genxmlkey"], $_POST["genxmllogreq"], $_POST["genxmlusrgrp"], $_POST["genxmldateformat"], $_POST["genxmlintstrexp"], $_POST["def_autoload"], $_POST["def_ipmask"], $def_profiles, $_POST["def_maxconn"], $_POST["def_admin"], $_POST["def_enabled"], $_POST["def_mapexc"], $_POST["def_debug"], $_POST["def_custcspval"], $_POST["def_ecmrate"], $_POST["fetchcsp"], $_POST["cspsrv_ip"], $_POST["cspsrv_port"], $_POST["cspsrv_user"], $_POST["cspsrv_pass"], $_POST["cspsrv_protocol"], $_POST["comptables"], $_POST["extrausrtbl"], $_POST["notstartusrorder"], $_POST["expusrorder"], $_POST["soonexpusrorder"], $_POST["autoupdcheck"], $_POST["usrorderby"], $_POST["usrorder"]);
if ($updnotice == "0") {
$notice = "toastr.success('Settings saved successfully');";
}
}
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if (mysqli_connect_errno()) {
errorpage("MYSQL DATABASE ERROR", mysqli_connect_error(), $charset, CMUM_TITLE, $_SERVER["REQUEST_URI"], CMUM_VERSION, CMUM_BUILD, CMUM_MOD);
exit;
}
$sqls = $mysqli->query("SELECT * FROM settings WHERE id='1'");
$setres = $sqls->fetch_array();
?>
<html>
<head>
<meta charset="<?php
print $charset;
?>
">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
示例9: action_cacheSettings_display
/**
* Cache settings editing and submission.
*
* This method handles the display, allows to edit, and saves the result
* for _cacheSettings form.
*/
public function action_cacheSettings_display()
{
global $context, $scripturl, $txt, $cache_accelerator, $modSettings;
// Initialize the form
$this->_initCacheSettingsForm();
// Some javascript to enable / disable certain settings if the option is not selected
addInlineJavascript('
var cache_type = document.getElementById(\'cache_accelerator\');
createEventListener(cache_type);
cache_type.addEventListener("change", toggleCache);
toggleCache();', true);
$context['settings_message'] = $txt['caching_information'];
// Let them know if they may have problems
if ($cache_accelerator === 'filebased' && !empty($modSettings['cache_enable']) && extension_loaded('Zend OPcache')) {
// The opcache will cache the filebased user data files, updating them based on opcache.revalidate_freq
// which can cause delays (or prevent) the invalidation of file cache files
$opcache_config = @opcache_get_configuration();
if (!empty($opcache_config['directives']['opcache.enable'])) {
$context['settings_message'] = $txt['cache_conflict'];
}
}
// Saving again?
if (isset($_GET['save'])) {
call_integration_hook('integrate_save_cache_settings');
$this->_cacheSettingsForm->save();
// 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']);
}
loadLanguage('Maintenance');
createToken('admin-maint');
Template_Layers::getInstance()->add('clean_cache_button');
$context['post_url'] = $scripturl . '?action=admin;area=serversettings;sa=cache;save';
$context['settings_title'] = $txt['caching_settings'];
// Prepare the template.
createToken('admin-ssc');
// Prepare settings for display in the template.
$this->_cacheSettingsForm->prepare_file();
}