本文整理汇总了PHP中updateSettings函数的典型用法代码示例。如果您正苦于以下问题:PHP updateSettings函数的具体用法?PHP updateSettings怎么用?PHP updateSettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateSettings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetCensor
/**
* Shows an interface to set and test censored words.
* It uses the censor_vulgar, censor_proper, censorWholeWord, and censorIgnoreCase
* settings.
* Requires the admin_forum permission.
* Accessed from ?action=admin;area=postsettings;sa=censor.
*
* @uses the Admin template and the edit_censored sub template.
*/
function SetCensor()
{
global $txt, $modSettings, $context, $smcFunc, $sourcedir;
if (!empty($_POST['save_censor'])) {
// Make sure censoring is something they can do.
checkSession();
validateToken('admin-censor');
$censored_vulgar = array();
$censored_proper = array();
// Rip it apart, then split it into two arrays.
if (isset($_POST['censortext'])) {
$_POST['censortext'] = explode("\n", strtr($_POST['censortext'], array("\r" => '')));
foreach ($_POST['censortext'] as $c) {
list($censored_vulgar[], $censored_proper[]) = array_pad(explode('=', trim($c)), 2, '');
}
} elseif (isset($_POST['censor_vulgar'], $_POST['censor_proper'])) {
if (is_array($_POST['censor_vulgar'])) {
foreach ($_POST['censor_vulgar'] as $i => $value) {
if (trim(strtr($value, '*', ' ')) == '') {
unset($_POST['censor_vulgar'][$i], $_POST['censor_proper'][$i]);
}
}
$censored_vulgar = $_POST['censor_vulgar'];
$censored_proper = $_POST['censor_proper'];
} else {
$censored_vulgar = explode("\n", strtr($_POST['censor_vulgar'], array("\r" => '')));
$censored_proper = explode("\n", strtr($_POST['censor_proper'], array("\r" => '')));
}
}
// Set the new arrays and settings in the database.
$updates = array('censor_vulgar' => implode("\n", $censored_vulgar), 'censor_proper' => implode("\n", $censored_proper), 'censorWholeWord' => empty($_POST['censorWholeWord']) ? '0' : '1', 'censorIgnoreCase' => empty($_POST['censorIgnoreCase']) ? '0' : '1');
call_integration_hook('integrate_save_censors', array(&$updates));
updateSettings($updates);
}
if (isset($_POST['censortest'])) {
require_once $sourcedir . '/Subs-Post.php';
$censorText = htmlspecialchars($_POST['censortest'], ENT_QUOTES);
preparsecode($censorText);
$context['censor_test'] = strtr(censorText($censorText), array('"' => '"'));
}
// Set everything up for the template to do its thang.
$censor_vulgar = explode("\n", $modSettings['censor_vulgar']);
$censor_proper = explode("\n", $modSettings['censor_proper']);
$context['censored_words'] = array();
for ($i = 0, $n = count($censor_vulgar); $i < $n; $i++) {
if (empty($censor_vulgar[$i])) {
continue;
}
// Skip it, it's either spaces or stars only.
if (trim(strtr($censor_vulgar[$i], '*', ' ')) == '') {
continue;
}
$context['censored_words'][htmlspecialchars(trim($censor_vulgar[$i]))] = isset($censor_proper[$i]) ? htmlspecialchars($censor_proper[$i]) : '';
}
call_integration_hook('integrate_censors');
$context['sub_template'] = 'edit_censored';
$context['page_title'] = $txt['admin_censored_words'];
createToken('admin-censor');
}
示例2: SaveNote
function SaveNote()
{
global $smcFunc;
// Check if they are allowed to admin forum.
isAllowedTo('admin_forum');
// Make the html safe if used so it does not mess up the page
$anotes = htmlspecialchars($_POST['txtnotes'], ENT_QUOTES);
// Insert the admin notes into the database
updateSettings(array('adminnotes' => $anotes));
// Redirect to the main admin page to see the changed notes
redirectexit('action=admin');
}
示例3: settings
public function settings()
{
if ($_POST) {
$settings = $this->input->post('settings');
updateSettings($settings);
showMessage(lang('Settings was successfully updated', 'translator', FALSE));
if ($this->input->post('action') == 'exit') {
pjax(site_url('admin/components/init_window/translator'));
}
} else {
\CMSFactory\assetManager::create()->registerScript('admin')->registerStyle('admin')->setData('settings', getSettings())->setData('languages_names', get_language_names())->renderAdmin('settings');
}
}
示例4: RepairBoards
/**
* Finds or repairs errors in the database to fix possible problems.
* Requires the admin_forum permission.
* Calls createSalvageArea() to create a new board, if necesary.
* Accessed by ?action=admin;area=repairboards.
*
* @uses raw_data sub-template.
*/
function RepairBoards()
{
global $txt, $context, $sourcedir, $salvageBoardID;
isAllowedTo('admin_forum');
// Try secure more memory.
setMemoryLimit('128M');
// Print out the top of the webpage.
$context['page_title'] = $txt['admin_repair'];
$context['sub_template'] = 'repair_boards';
$context[$context['admin_menu_name']]['current_subsection'] = 'general';
// Load the language file.
loadLanguage('ManageMaintenance');
// Make sure the tabs stay nice.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['maintain_title'], 'help' => '', 'description' => $txt['maintain_info'], 'tabs' => array());
// Start displaying errors without fixing them.
if (isset($_GET['fixErrors'])) {
checkSession('get');
}
// Will want this.
loadForumTests();
// Giant if/else. The first displays the forum errors if a variable is not set and asks
// if you would like to continue, the other fixes the errors.
if (!isset($_GET['fixErrors'])) {
$context['error_search'] = true;
$context['repair_errors'] = array();
$context['to_fix'] = findForumErrors();
if (!empty($context['to_fix'])) {
$_SESSION['repairboards_to_fix'] = $context['to_fix'];
$_SESSION['repairboards_to_fix2'] = null;
if (empty($context['repair_errors'])) {
$context['repair_errors'][] = '???';
}
}
} else {
$context['error_search'] = false;
$context['to_fix'] = isset($_SESSION['repairboards_to_fix']) ? $_SESSION['repairboards_to_fix'] : array();
require_once $sourcedir . '/Subs-Boards.php';
// Actually do the fix.
findForumErrors(true);
// Note that we've changed everything possible ;)
updateSettings(array('settings_updated' => time()));
updateStats('message');
updateStats('topic');
updateSettings(array('calendar_updated' => time()));
if (!empty($salvageBoardID)) {
$context['redirect_to_recount'] = true;
}
$_SESSION['repairboards_to_fix'] = null;
$_SESSION['repairboards_to_fix2'] = null;
}
}
示例5: fix_serialized_columns
function fix_serialized_columns()
{
global $db_prefix;
$request = db_query("\n\t\tSELECT ID_ACTION, extra\n\t\tFROM {$db_prefix}log_actions\n\t\tWHERE action IN ('remove', 'delete')", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\\d+;s:7:"subject";s:)(\\d+):"(.+)"(;s:6:"member";s:5:"\\d+";})$~', $row['extra'], $matches) === 1) {
db_query("\n\t\t\t\tUPDATE {$db_prefix}log_actions\n\t\t\t\tSET extra = '{$matches['1']}" . strlen($matches[3]) . ":\"{$matches['3']}\"{$matches['4']}'\n\t\t\t\tWHERE ID_ACTION = {$row['ID_ACTION']}\n\t\t\t\tLIMIT 1", __FILE__, __LINE__);
}
}
mysql_free_result($request);
// Refresh some serialized strings stored in the settings table.
updateStats('calendar');
// The memberlist cache needs to be recalculated too.
updateSettings(array('memberlist_updated' => time()));
}
示例6: uninstall
public static function uninstall($product)
{
global $modSettings;
$pluginMain = HookAPI::getAddonsDir() . $product . '/main.php';
require_once $pluginMain;
$autoloader = $product . '_autoloader';
$pluginInstance = $autoloader();
if (is_callable($autoloader)) {
$installedPlugins = @unserialize($modSettings['plugins']);
$pluginInstance->removeHooks();
unset($installedPlugins[$product]);
updateSettings(array('plugins' => @serialize($installedPlugins)));
return true;
} else {
// todo error handling
}
}
示例7: AdminNotepad
function AdminNotepad()
{
loadLanguage('smfhacks_languages/admin-notepad');
loadTemplate('smfhacks_templates/admin-notepad', array('smfhacks_css/admin-notepad'));
if (allowedTo('admin_forum')) {
global $modSettings, $smcFunc;
if (isset($_POST['admin_notes'])) {
if (!empty($modSettings['admin_notes']) && $_POST['admin_notes'] == $modSettings['admin_notes']) {
return;
} elseif (empty($modSettings['admin_notes']) && empty($_POST['admin_notes'])) {
return;
} else {
updateSettings(array('admin_notes' => $smcFunc['htmlspecialchars']($_POST['admin_notes'], ENT_QUOTES)));
redirectexit('action=admin;notes_saved');
}
}
}
}
示例8: AdminNotepad
function AdminNotepad()
{
if (allowedTo('admin_forum')) {
global $context, $modSettings, $settings;
loadLanguage('smfhacks_languages/admin-notepad');
loadTemplate('smfhacks_templates/admin-notepad');
$context['html_headers'] .= "\n" . '<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/smfhacks_css/admin-notepad.css" />';
if (isset($_POST['admin_notes'])) {
if (!empty($modSettings['admin_notes']) && $_POST['admin_notes'] == $modSettings['admin_notes']) {
return;
} elseif (empty($modSettings['admin_notes']) && empty($_POST['admin_notes'])) {
return;
} else {
updateSettings(array('admin_notes' => htmlspecialchars($_POST['admin_notes'], ENT_QUOTES)));
redirectexit('action=admin;notes_saved');
}
}
}
}
示例9: fix_serialized_columns
/**
* Fixes corrupted serialized strings after a character set conversion.
*/
function fix_serialized_columns()
{
$db = database();
$request = $db->query('', '
SELECT id_action, extra
FROM {db_prefix}log_actions
WHERE action IN ({string:remove}, {string:delete})', array('remove' => 'remove', 'delete' => 'delete'));
while ($row = $db->fetch_assoc($request)) {
if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\\d+;s:7:"subject";s:)(\\d+):"(.+)"(;s:6:"member";s:5:"\\d+";})$~', $row['extra'], $matches) === 1) {
$db->query('', '
UPDATE {db_prefix}log_actions
SET extra = {string:extra}
WHERE id_action = {int:current_action}', array('current_action' => $row['id_action'], 'extra' => $matches[1] . strlen($matches[3]) . ':"' . $matches[3] . '"' . $matches[4]));
}
}
$db->free_result($request);
// Refresh some cached data.
updateSettings(array('memberlist_updated' => time()));
}
示例10: WelcomeTopicSettings2
function WelcomeTopicSettings2()
{
global $smcFunc;
$boardselect = (int) $_REQUEST['boardselect'];
$welcome_postername = str_replace('"', '', $_REQUEST['welcome_postername']);
$welcome_postername = str_replace("'", '', $welcome_postername);
$welcome_postername = str_replace('\\', '', $welcome_postername);
$welcome_postername = htmlspecialchars($welcome_postername, ENT_QUOTES);
// Get the topic name
// Lookup the Memeber ID of the postername
$memid = 0;
$dbresult = $smcFunc['db_query']('', "\n\tSELECT \n\t\treal_name, ID_MEMBER \n\tFROM {db_prefix}members \n\tWHERE real_name = '{$welcome_postername}' OR member_name = '{$welcome_postername}' LIMIT 1");
$row = $smcFunc['db_fetch_assoc']($dbresult);
$smcFunc['db_free_result']($dbresult);
if ($smcFunc['db_affected_rows']() != 0) {
$memid = $row['ID_MEMBER'];
}
// Save the setting information
updateSettings(array('welcome_boardid' => $boardselect, 'welcome_membername' => $welcome_postername, 'welcome_memberid' => $memid));
// Redirect to Welcome Topic settings page
redirectexit('action=admin;area=welcome;sa=admin');
}
示例11: ShopGeneral
function ShopGeneral()
{
global $context, $modSettings, $txt;
// The admin menu on the side, and other stuff
adminIndex('shop_general');
// We haven't saved yet (this is for the 'Settings Saved' message' on the admin page)
$context['shop_saved'] = false;
// If they've pressed the 'Save' button
if (isset($_GET['save'])) {
// Put all the settings into an array, to save
$newSettings['shopCurrencyPrefix'] = $_POST['prefix'];
$newSettings['shopCurrencySuffix'] = $_POST['suffix'];
$newSettings['shopPointsPerTopic'] = (double) $_POST['pertopic'];
$newSettings['shopPointsPerPost'] = (double) $_POST['perpost'];
$newSettings['shopImageWidth'] = (int) $_POST['image_width'];
$newSettings['shopImageHeight'] = (int) $_POST['image_height'];
$newSettings['shopInterest'] = (double) $_POST['interest'];
$newSettings['shopItemsPerPage'] = (int) $_POST['itemspage'];
$newSettings['shopMinDeposit'] = (double) $_POST['minDeposit'];
$newSettings['shopMinWithdraw'] = (double) $_POST['minWithdraw'];
$newSettings['shopFeeDeposit'] = (double) $_POST['feeDeposit'];
$newSettings['shopFeeWithdraw'] = (double) $_POST['feeWithdraw'];
$newSettings['shopRegAmount'] = (int) $_POST['regamount'];
$newSettings['shopBankEnabled'] = isset($_POST['bankenabled']) ? '1' : '0';
$newSettings['shopTradeEnabled'] = isset($_POST['tradeenabled']) ? '1' : '0';
// Bonuses
$newSettings['shopPointsPerChar'] = (double) $_POST['perchar'];
$newSettings['shopPointsPerWord'] = (double) $_POST['perword'];
$newSettings['shopPointsLimit'] = (double) $_POST['limit'];
// Save all these settings
updateSettings($newSettings);
// We've saved, tell the user that it was successful
$context['shop_saved'] = true;
}
// Set the page title
$context['page_title'] = $txt['shop'] . ' - ' . $txt['shop_admin_general'];
// Load the template
loadTemplate('ShopAdmin');
}
示例12: ajaxFunc
function ajaxFunc()
{
global $db_name;
if (!isset($_REQUEST['type'])) {
return;
}
$db_names = array('videos' => 'sponsoredvideo', 'skins' => 'sponsoredskin', 'channels' => 'sponsoredchannel', 'settings' => 'settings');
$db_name = $db_names[$_REQUEST['type']];
$funcs = array('videos', 'skins', 'channels', 'settings');
if (!in_array($_REQUEST['type'], $funcs)) {
jsonError('Invalid action.');
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'get') {
jsonQuery();
} else {
checkCsrfToken();
if ($_REQUEST['type'] == 'settings') {
updateSettings();
} else {
addEdit();
}
}
}
示例13: GlobalHFCheckSaving
function GlobalHFCheckSaving()
{
if (isset($_POST['global_head'])) {
checkSession();
global $smcFunc, $boarddir;
$file_fields = array('global_head', 'global_header', 'global_footer');
foreach ($file_fields as $key => $value) {
if (isset($_POST[$value])) {
$_POST[$value] = $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST[$value], ENT_QUOTES));
file_put_contents($boarddir . '/smfhacks_resources/global-hf-' . str_replace('global_', '', $value) . '.txt', $_POST[$value]);
}
}
$bbc_fields = array('global_header_bbc', 'global_footer_bbc');
foreach ($bbc_fields as $key => $value) {
if (isset($_POST[$value])) {
$_POST[$value] = (int) $_POST[$value];
$final_arr[$value] = $_POST[$value];
}
}
updateSettings($final_arr);
redirectexit('action=admin;area=globalhf;success=saved');
}
}
示例14: loadUserSettings
//.........这里部分代码省略.........
$user_info = array('groups' => array(-1));
$user_settings = array();
if (isset($_COOKIE[$cookiename])) {
$_COOKIE[$cookiename] = '';
}
// Do we perhaps think this is a search robot? Check every five minutes just in case...
if ((!empty($modSettings['spider_mode']) || !empty($modSettings['spider_group'])) && (!isset($_SESSION['robot_check']) || $_SESSION['robot_check'] < time() - 300)) {
$user_info['possibly_robot'] = SpiderCheck();
} elseif (!empty($modSettings['spider_mode'])) {
$user_info['possibly_robot'] = isset($_SESSION['id_robot']) ? $_SESSION['id_robot'] : 0;
} else {
$ci_user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$user_info['possibly_robot'] = strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla') === false && strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') === false || strpos($ci_user_agent, 'googlebot') !== false || strpos($ci_user_agent, 'slurp') !== false || strpos($ci_user_agent, 'crawl') !== false;
}
$user_info['time_offset'] = isset($_SESSION['tzoffset']) ? $_SESSION['tzoffset'] : 0;
$user_info['guest_need_tzoffset'] = !isset($_SESSION['tzoffset']);
// don't have it yet, embed the js to determine tz offset for *guests only*
}
// Set up the $user_info array.
$user_info += array('id' => $id_member, 'username' => $username, 'name' => isset($user_settings['real_name']) ? $user_settings['real_name'] : '', 'email' => isset($user_settings['email_address']) ? $user_settings['email_address'] : '', 'passwd' => isset($user_settings['passwd']) ? $user_settings['passwd'] : '', 'language' => empty($user_settings['lngfile']) || empty($modSettings['userLanguage']) ? $language : $user_settings['lngfile'], 'is_guest' => $id_member == 0, 'is_admin' => in_array(1, $user_info['groups']), 'theme' => empty($user_settings['id_theme']) ? 0 : $user_settings['id_theme'], 'last_login' => empty($user_settings['last_login']) ? 0 : $user_settings['last_login'], 'ip' => $_SERVER['REMOTE_ADDR'], 'ip2' => $_SERVER['BAN_CHECK_IP'], 'posts' => empty($user_settings['posts']) ? 0 : $user_settings['posts'], 'time_format' => empty($user_settings['time_format']) ? $modSettings['time_format'] : $user_settings['time_format'], 'avatar' => array('url' => isset($user_settings['avatar']) ? $user_settings['avatar'] : '', 'filename' => empty($user_settings['filename']) ? '' : $user_settings['filename'], 'custom_dir' => !empty($user_settings['attachment_type']) && $user_settings['attachment_type'] == 1, 'id_attach' => isset($user_settings['id_attach']) ? $user_settings['id_attach'] : 0), 'smiley_set' => isset($user_settings['smiley_set']) ? $user_settings['smiley_set'] : '', 'messages' => empty($user_settings['instant_messages']) ? 0 : $user_settings['instant_messages'], 'unread_messages' => empty($user_settings['unread_messages']) ? 0 : $user_settings['unread_messages'], 'total_time_logged_in' => empty($user_settings['total_time_logged_in']) ? 0 : $user_settings['total_time_logged_in'], 'buddies' => !empty($modSettings['enable_buddylist']) && !empty($user_settings['buddy_list']) ? explode(',', $user_settings['buddy_list']) : array(), 'ignoreboards' => !empty($user_settings['ignore_boards']) && !empty($modSettings['allow_ignore_boards']) ? explode(',', $user_settings['ignore_boards']) : array(), 'ignoreusers' => !empty($user_settings['pm_ignore_list']) ? explode(',', $user_settings['pm_ignore_list']) : array(), 'warning' => isset($user_settings['warning']) ? $user_settings['warning'] : 0, 'likesgiven' => isset($user_settings['likes_given']) ? $user_settings['likes_given'] : 0, 'likesreceived' => isset($user_settings['likes_received']) ? $user_settings['likes_received'] : 0, 'permissions' => array(), 'act_optout' => isset($user_settings['act_optout']) ? $user_settings['act_optout'] : '', 'notify_optout' => isset($user_settings['notify_optout']) ? $user_settings['notify_optout'] : '', 'meta' => !empty($user_settings['meta']) ? @unserialize($user_settings['meta']) : array());
$user_info['smf_sidebar_disabled'] = 0;
$user_info['groups'] = array_unique($user_info['groups']);
// Make sure that the last item in the ignore boards array is valid. If the list was too long it could have an ending comma that could cause problems.
if (!empty($user_info['ignoreboards']) && empty($user_info['ignoreboards'][$tmp = count($user_info['ignoreboards']) - 1])) {
unset($user_info['ignoreboards'][$tmp]);
}
// Do we have any languages to validate this?
if (!empty($modSettings['userLanguage']) && (!empty($_GET['language']) || !empty($_SESSION['language']))) {
$languages = getLanguages();
}
// Allow the user to change their language if its valid.
if (!empty($modSettings['userLanguage']) && !empty($_GET['language']) && isset($languages[strtr($_GET['language'], './\\:', '____')])) {
$user_info['language'] = strtr($_GET['language'], './\\:', '____');
$_SESSION['language'] = $user_info['language'];
} elseif (!empty($modSettings['userLanguage']) && !empty($_SESSION['language']) && isset($languages[strtr($_SESSION['language'], './\\:', '____')])) {
$user_info['language'] = strtr($_SESSION['language'], './\\:', '____');
}
// map language to a numeric id
$n = 0;
if (isset($context['languages'])) {
foreach ($context['languages'] as $key => $lang) {
if ($key == $user_info['language']) {
break;
}
$n++;
}
}
$user_info['language_id'] = $n + 1;
// Just build this here, it makes it easier to change/use - administrators can see all boards.
if ($user_info['is_admin']) {
$user_info['query_see_board'] = '1=1';
} else {
$user_info['query_see_board'] = '(FIND_IN_SET(' . implode(', b.member_groups) != 0 OR FIND_IN_SET(', $user_info['groups']) . ', b.member_groups) != 0' . (isset($user_info['mod_cache']) ? ' OR ' . $user_info['mod_cache']['mq'] : '') . ')';
}
// Build the list of boards they WANT to see.
// This will take the place of query_see_boards in certain spots, so it better include the boards they can see also
// If they aren't ignoring any boards then they want to see all the boards they can see
if (empty($user_info['ignoreboards'])) {
$user_info['query_wanna_see_board'] = $user_info['query_see_board'];
} else {
$user_info['query_wanna_see_board'] = '(' . $user_info['query_see_board'] . ' AND b.id_board NOT IN (' . implode(',', $user_info['ignoreboards']) . '))';
}
/*
* figure out unread notifications
*
* the reason why this is here in an extra query is that we need query_see_board.
* e.g. when a user gets a notification for a topic that has been moved to a board he
* is not permitted to access, we want to filter out the notifications.
*/
if ($id_member != 0 && (!isset($user_settings['notify_count']) || $_reload)) {
// this is actually cached, unless $user_settings was re-fetched from the db.
$_to_cache = true;
$request = smf_db_query('
SELECT COUNT(n.id_act) AS notify_count FROM {db_prefix}log_notifications AS n
LEFT JOIN {db_prefix}log_activities AS a ON (a.id_act = n.id_act)
LEFT JOIN {db_prefix}boards AS b ON(b.id_board = a.id_board)
WHERE n.id_member = {int:id_member} AND n.unread = 1 AND ' . (!empty($user_info['ignoreusers']) ? 'a.id_member NOT IN({array_int:ignoredusers}) AND ' : '') . ' ({query_wanna_see_board} OR a.id_board = 0)', array('id_member' => $id_member, 'ignoredusers' => $user_info['ignoreusers']));
if (mysql_num_rows($request) > 0) {
list($unread) = mysql_fetch_row($request);
$user_settings['notify_count'] = $unread;
} else {
$user_settings['notify_count'] = 0;
}
mysql_free_result($request);
}
if ($modSettings['cache_enable'] >= 2 && $id_member != 0 && $_to_cache) {
CacheAPI::putCache('user_settings-' . $id_member, $user_settings, 600);
}
$user_info['notify_count'] = isset($user_settings['notify_count']) ? $user_settings['notify_count'] : 0;
if ($user_info['unread_messages'] && $user_info['notify_count'] == 0) {
$user_info['notify_count']++;
}
// record the user in the list of users who were online today. todo: there should be an option for this feature.
if (!empty($modSettings['who_track_daily_visitors']) && $user_info['id'] > 0 && !isset($modSettings['online_today'][$user_info['id']])) {
$modSettings['online_today'][$user_info['id']] = array('name' => $user_info['name'], 'show_online' => $user_info['show_online'], 'link' => '<a class="member group_' . (empty($user_settings['id_group']) ? $user_settings['id_post_group'] : $user_settings['id_group']) . '" href="' . URL::user($user_info['id'], $user_info['name']) . '">' . $user_info['name'] . '</a>');
updateSettings(array('log_online_today' => @serialize($modSettings['online_today'])));
}
$user_info['font_class'] = isset($_COOKIE['EOS_Fontstyle']) ? $_COOKIE['EOS_Fontstyle'] : '0';
HookAPI::callHook('load_userdata', array(&$user_info, &$user_settings));
}
示例15: ModifySettings
function ModifySettings()
{
global $modSettings, $context, $settings, $db_prefix, $txt, $boarddir, $sourcedir;
loadTemplate('ManageCalendar');
$context['page_title'] = $txt['calendar_settings'];
$context['sub_template'] = 'modify_settings';
// A file we need to show permissions inline.
require_once $sourcedir . '/ManagePermissions.php';
$calendarPermissions = array('calendar_view', 'calendar_post', 'calendar_edit_own', 'calendar_edit_any');
// A form was submitted.
if (isset($_POST['sc'], $_POST['cal_days_for_index'])) {
checkSession();
// Although the display settings are combined to the user, they are seperate to the database.
$toSet['cal_showholidaysonindex'] = $_POST['cal_showholidays'] == 'index' || $_POST['cal_showholidays'] == 'all' ? '1' : '0';
$toSet['cal_showbdaysonindex'] = $_POST['cal_showbdays'] == 'index' || $_POST['cal_showbdays'] == 'all' ? '1' : '0';
$toSet['cal_showeventsonindex'] = $_POST['cal_showevents'] == 'index' || $_POST['cal_showevents'] == 'all' ? '1' : '0';
$toSet['cal_showholidaysoncalendar'] = $_POST['cal_showholidays'] == 'cal' || $_POST['cal_showholidays'] == 'all' ? '1' : '0';
$toSet['cal_showbdaysoncalendar'] = $_POST['cal_showbdays'] == 'cal' || $_POST['cal_showbdays'] == 'all' ? '1' : '0';
$toSet['cal_showeventsoncalendar'] = $_POST['cal_showevents'] == 'cal' || $_POST['cal_showevents'] == 'all' ? '1' : '0';
updateSettings(array('cal_enabled' => isset($_POST['cal_enabled']) ? '1' : '0', 'cal_daysaslink' => isset($_POST['cal_daysaslink']) ? '1' : '0', 'cal_showweeknum' => isset($_POST['cal_showweeknum']) ? '1' : '0', 'cal_days_for_index' => (int) $_POST['cal_days_for_index'], 'cal_showholidaysonindex' => $toSet['cal_showholidaysonindex'], 'cal_showbdaysonindex' => $toSet['cal_showbdaysonindex'], 'cal_showeventsonindex' => $toSet['cal_showeventsonindex'], 'cal_showholidaysoncalendar' => $toSet['cal_showholidaysoncalendar'], 'cal_showbdaysoncalendar' => $toSet['cal_showbdaysoncalendar'], 'cal_showeventsoncalendar' => $toSet['cal_showeventsoncalendar'], 'cal_defaultboard' => (int) $_POST['cal_defaultboard'], 'cal_allow_unlinked' => isset($_POST['cal_allow_unlinked']) ? '1' : '0', 'cal_minyear' => (int) $_POST['cal_minyear'], 'cal_maxyear' => (int) $_POST['cal_maxyear'], 'cal_bdaycolor' => $_POST['cal_bdaycolor'], 'cal_eventcolor' => $_POST['cal_eventcolor'], 'cal_holidaycolor' => $_POST['cal_holidaycolor'], 'cal_allowspan' => isset($_POST['cal_allowspan']) ? '1' : '0', 'cal_maxspan' => (int) $_POST['cal_maxspan'], 'cal_showInTopic' => isset($_POST['cal_showInTopic']) ? '1' : '0'));
save_inline_permissions($calendarPermissions);
updateStats('calendar');
// Ensure we redirect incase the change in settings means the tabs are outdated.
redirectexit('action=managecalendar;sa=settings');
}
// Load the boards list.
$context['cal_boards'] = array('');
$request = db_query("\n\t\tSELECT b.ID_BOARD, b.name AS bName, c.name AS cName\n\t\tFROM {$db_prefix}boards AS b\n\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
$context['cal_boards'][$row['ID_BOARD']] = $row['cName'] . ' - ' . $row['bName'];
}
mysql_free_result($request);
// Initialize the inline permission settings.
init_inline_permissions($calendarPermissions);
// Setup the display settings, just for better UI ;)
$context['cal_showholidays'] = empty($modSettings['cal_showholidaysonindex']) ? empty($modSettings['cal_showholidaysoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showholidaysoncalendar']) ? 'index' : 'all');
$context['cal_showbdays'] = empty($modSettings['cal_showbdaysonindex']) ? empty($modSettings['cal_showbdaysoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showbdaysoncalendar']) ? 'index' : 'all');
$context['cal_showevents'] = empty($modSettings['cal_showeventsonindex']) ? empty($modSettings['cal_showeventsoncalendar']) ? 'never' : 'cal' : (empty($modSettings['cal_showeventsoncalendar']) ? 'index' : 'all');
}