• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP updateSettings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中updateSettings函数的典型用法代码示例。如果您正苦于以下问题:PHP updateSettings函数的具体用法?PHP updateSettings怎么用?PHP updateSettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了updateSettings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:68,代码来源:ManagePosts.php


示例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');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:12,代码来源:Notepad2.php


示例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');
     }
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:13,代码来源:admin.php


示例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;
    }
}
开发者ID:albertlast,项目名称:SMF2.1,代码行数:59,代码来源:RepairBoards.php


示例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()));
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:15,代码来源:Subs-Charset.php


示例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
     }
 }
开发者ID:norv,项目名称:EosAlpha,代码行数:17,代码来源:Plugins.php


示例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');
            }
        }
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:18,代码来源:admin-notepad.php


示例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');
            }
        }
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:19,代码来源:admin-notepad.php


示例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()));
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:22,代码来源:Charset.subs.php


示例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');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:22,代码来源:WelcomeTopic2.php


示例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');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:39,代码来源:ShopAdmin.php


示例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();
        }
    }
}
开发者ID:chunga668,项目名称:reddit.tv,代码行数:23,代码来源:functions.php


示例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');
    }
}
开发者ID:juanitotaveras,项目名称:Polyphasic.xyz,代码行数:23,代码来源:global-hf.php


示例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));
}
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Load.php


示例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');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:39,代码来源:ManageCalendar.php


示例16: GroupRequests

function GroupRequests()
{
    global $txt, $context, $scripturl, $user_info, $sourcedir, $smcFunc, $modSettings, $language;
    // Set up the template stuff...
    $context['page_title'] = $txt['mc_group_requests'];
    $context['sub_template'] = 'show_list';
    // Verify we can be here.
    if ($user_info['mod_cache']['gq'] == '0=1') {
        isAllowedTo('manage_membergroups');
    }
    // Normally, we act normally...
    $where = $user_info['mod_cache']['gq'] == '1=1' || $user_info['mod_cache']['gq'] == '0=1' ? $user_info['mod_cache']['gq'] : 'lgr.' . $user_info['mod_cache']['gq'];
    $where_parameters = array();
    // We've submitted?
    if (isset($_POST[$context['session_var']]) && !empty($_POST['groupr']) && !empty($_POST['req_action'])) {
        checkSession('post');
        // Clean the values.
        foreach ($_POST['groupr'] as $k => $request) {
            $_POST['groupr'][$k] = (int) $request;
        }
        // If we are giving a reason (And why shouldn't we?), then we don't actually do much.
        if ($_POST['req_action'] == 'reason') {
            // Different sub template...
            $context['sub_template'] = 'group_request_reason';
            // And a limitation. We don't care that the page number bit makes no sense, as we don't need it!
            $where .= ' AND lgr.id_request IN ({array_int:request_ids})';
            $where_parameters['request_ids'] = $_POST['groupr'];
            $context['group_requests'] = list_getGroupRequests(0, $modSettings['defaultMaxMessages'], 'lgr.id_request', $where, $where_parameters);
            // Let obExit etc sort things out.
            obExit();
        } else {
            // Get the details of all the members concerned...
            $request = $smcFunc['db_query']('', '
				SELECT lgr.id_request, lgr.id_member, lgr.id_group, mem.email_address, mem.id_group AS primary_group,
					mem.additional_groups AS additional_groups, mem.lngfile, mem.member_name, mem.notify_types,
					mg.hidden, mg.group_name
				FROM {db_prefix}log_group_requests AS lgr
					INNER JOIN {db_prefix}members AS mem ON (mem.id_member = lgr.id_member)
					INNER JOIN {db_prefix}membergroups AS mg ON (mg.id_group = lgr.id_group)
				WHERE ' . $where . '
					AND lgr.id_request IN ({array_int:request_list})
				ORDER BY mem.lngfile', array('request_list' => $_POST['groupr']));
            $email_details = array();
            $group_changes = array();
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                $row['lngfile'] = empty($row['lngfile']) || empty($modSettings['userLanguage']) ? $language : $row['lngfile'];
                // If we are approving work out what their new group is.
                if ($_POST['req_action'] == 'approve') {
                    // For people with more than one request at once.
                    if (isset($group_changes[$row['id_member']])) {
                        $row['additional_groups'] = $group_changes[$row['id_member']]['add'];
                        $row['primary_group'] = $group_changes[$row['id_member']]['primary'];
                    } else {
                        $row['additional_groups'] = explode(',', $row['additional_groups']);
                    }
                    // Don't have it already?
                    if ($row['primary_group'] == $row['id_group'] || in_array($row['id_group'], $row['additional_groups'])) {
                        continue;
                    }
                    // Should it become their primary?
                    if ($row['primary_group'] == 0 && $row['hidden'] == 0) {
                        $row['primary_group'] = $row['id_group'];
                    } else {
                        $row['additional_groups'][] = $row['id_group'];
                    }
                    // Add them to the group master list.
                    $group_changes[$row['id_member']] = array('primary' => $row['primary_group'], 'add' => $row['additional_groups']);
                }
                // Add required information to email them.
                if ($row['notify_types'] != 4) {
                    $email_details[] = array('rid' => $row['id_request'], 'member_id' => $row['id_member'], 'member_name' => $row['member_name'], 'group_id' => $row['id_group'], 'group_name' => $row['group_name'], 'email' => $row['email_address'], 'language' => $row['lngfile']);
                }
            }
            $smcFunc['db_free_result']($request);
            // Remove the evidence...
            $smcFunc['db_query']('', '
				DELETE FROM {db_prefix}log_group_requests
				WHERE id_request IN ({array_int:request_list})', array('request_list' => $_POST['groupr']));
            // Ensure everyone who is online gets their changes right away.
            updateSettings(array('settings_updated' => time()));
            if (!empty($email_details)) {
                require_once $sourcedir . '/Subs-Post.php';
                // They are being approved?
                if ($_POST['req_action'] == 'approve') {
                    // Make the group changes.
                    foreach ($group_changes as $id => $groups) {
                        // Sanity check!
                        foreach ($groups['add'] as $key => $value) {
                            if ($value == 0 || trim($value) == '') {
                                unset($groups['add'][$key]);
                            }
                        }
                        $smcFunc['db_query']('', '
							UPDATE {db_prefix}members
							SET id_group = {int:primary_group}, additional_groups = {string:additional_groups}
							WHERE id_member = {int:selected_member}', array('primary_group' => $groups['primary'], 'selected_member' => $id, 'additional_groups' => implode(',', $groups['add'])));
                    }
                    $lastLng = $user_info['language'];
                    foreach ($email_details as $email) {
                        $replacements = array('USERNAME' => $email['member_name'], 'GROUPNAME' => $email['group_name']);
//.........这里部分代码省略.........
开发者ID:Kheros,项目名称:MMOver,代码行数:101,代码来源:Groups.php


示例17: findCity

    $pageTitle .= ' :: ' . $userDetails['fullname'];
}
if (!empty($userDetails) && !empty($uid) && !empty($_GET['city_id']) && !empty($_GET['from_date']) && !empty($_GET['no_days'])) {
    //$horo = new Models_Horo();
    $city = findCity($_GET['city_id']);
    //clearing user sql
    $modelGeneral->clearCache($userSql);
    //updating the city
    if ($uid == $_SESSION['user']['id']) {
        $data = array();
        $md5Check = md5($userDetails['horo_cities']);
        $horo_cities[$city['id']] = $city['name'];
        $data['horo_cities'] = json_encode($horo_cities);
        $md5Check2 = md5($data['horo_cities']);
        if ($md5Check != $md5Check2) {
            updateSettings($_SESSION['user']['id'], $data);
        }
    }
    $fromDate = getDateTime($_GET['from_date']);
    $date = $fromDate['year'] . '-' . $fromDate['month'] . '-' . $fromDate['day'];
    $past = '';
    $returnResult = array();
    for ($counter = 0; $counter < $_GET['no_days']; $counter++) {
        $day = date('d', strtotime("{$date} +{$counter} day"));
        $month = date('m', strtotime("{$date} +{$counter} day"));
        $year = date('Y', strtotime("{$date} +{$counter} day"));
        for ($j = 0; $j < 24; $j = $j + 1) {
            $hour = $j;
            $dob = $year . '-' . $month . '-' . $day . ' ' . $hour . ':00:00';
            $data2 = array_merge($city, array('dob' => $dob));
            $result = $horo->match($userDetails, $data2);
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:31,代码来源:main.php


示例18: execute


//.........这里部分代码省略.........
                    continue;
                }
                foreach ($table as $column) {
                    if (preg_match('~^[A-Za-z0-9_]+$~', $column)) {
                        $execute['columns'][$table_name][] = $column;
                    }
                }
            }
        }
        if (!empty($_POST['indexes'])) {
            foreach ($_POST['indexes'] as $table_name => $table) {
                if (!preg_match('~^[A-Za-z0-9_]+$~', $table_name)) {
                    continue;
                }
                foreach ($table as $index) {
                    if (preg_match('~^[A-Za-z0-9_]+$~', $index)) {
                        $execute['indexes'][$table_name][] = $index;
                    }
                }
            }
        }
        if (!empty($_POST['tables'])) {
            foreach ($_POST['tables'] as $table) {
                if (preg_match('~^[A-Za-z0-9_]+$~', $table)) {
                    $execute['tables'][] = $table;
                }
            }
        }
        if (!empty($_POST['settings'])) {
            foreach ($_POST['settings'] as $table) {
                if (preg_match('~^[A-Za-z0-9_]+$~', $table)) {
                    $execute['settings'][] = $table;
                }
            }
        }
        // Step 1: build the remove data for extra index's
        foreach ($execute['indexes'] as $table_name => $table) {
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP updateSettingsFile函数代码示例发布时间:2022-05-23
下一篇:
PHP updateSetting函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap