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

PHP loadPermissions函数代码示例

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

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



在下文中一共展示了loadPermissions函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: login_func

function login_func()
{
    global $context, $user_info, $modSettings, $user_profile, $settings, $scripturl, $modSettings, $smcFunc;
    $user_info['permissions'] = array();
    loadPermissions();
    $pm_read = !$user_info['is_guest'] && allowedTo('pm_read');
    $pm_send = !$user_info['is_guest'] && allowedTo('pm_send');
    $login_status = $context['user']['is_guest'] || isset($context['disable_login_hashing']) && $context['disable_login_hashing'] ? false : true;
    $result_text = !$login_status && isset($context['login_errors'][0]) ? $context['login_errors'][0] . ' ' . (isset($context['login_errors'][1]) ? basic_clean($context['login_errors'][1]) : '') : '';
    $usergroup_id = array();
    foreach ($user_info['groups'] as $group_id) {
        $usergroup_id[] = new xmlrpcval($group_id);
    }
    if (!$modSettings['attachmentSizeLimit']) {
        $modSettings['attachmentSizeLimit'] = 5120;
    }
    if (!$modSettings['attachmentNumPerPostLimit']) {
        $modSettings['attachmentNumPerPostLimit'] = 10;
    }
    loadMemberData($user_info['id'], false, 'profile');
    $profile = $user_profile[$user_info['id']];
    if (!empty($settings['show_user_images']) && empty($profile['options']['show_no_avatars'])) {
        $avatar = $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename'] : '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']);
    } else {
        $avatar = '';
    }
    $user_type = 'normal';
    if (is_numeric($profile['id_group'])) {
        if ($profile['id_group'] == 0) {
            $user_type = 'normal';
        } elseif ($profile['id_group'] == 1) {
            $user_type = 'admin';
        } elseif ($profile['id_group'] == 2 || $profile['id_group'] == 3) {
            $user_type = 'mod';
        }
    }
    if (checkIfUserIsBanned($user_info['id'])) {
        $user_type = 'banned';
    }
    $response = new xmlrpcval(array('result' => new xmlrpcval($login_status, 'boolean'), 'result_text' => new xmlrpcval($result_text, 'base64'), 'can_pm' => new xmlrpcval($pm_read, 'boolean'), 'can_send_pm' => new xmlrpcval($pm_send, 'boolean'), 'icon_url' => new xmlrpcval($avatar, 'string'), 'post_count' => new xmlrpcval($profile['posts'], 'int'), 'user_id' => new xmlrpcval($user_info['id'], 'string'), 'username' => new xmlrpcval(basic_clean($profile['real_name']), 'base64'), 'login_name' => new xmlrpcval(basic_clean($profile['member_name']), 'base64'), 'user_type' => new xmlrpcval($user_type, 'base64'), 'email' => new xmlrpcval($profile['email_address'], 'base64'), 'usergroup_id' => new xmlrpcval($usergroup_id, 'array'), 'ignored_uids' => new xmlrpcval($profile['pm_ignore_list'], 'string'), 'register' => new xmlrpcval(isset($_POST['emailActivate']) && $_POST['emailActivate'], 'boolean'), 'max_attachment' => new xmlrpcval($modSettings['attachmentNumPerPostLimit'], 'int'), 'max_png_size' => new xmlrpcval($modSettings['attachmentSizeLimit'] * 1024, 'int'), 'max_jpg_size' => new xmlrpcval($modSettings['attachmentSizeLimit'] * 1024, 'int'), 'max_avatar_width' => new xmlrpcval($modSettings['avatar_max_width_upload'] ? $modSettings['avatar_max_width_upload'] : 10000, 'int'), 'max_avatar_height' => new xmlrpcval($modSettings['avatar_max_height_upload'] ? $modSettings['avatar_max_height_upload'] : 10000, 'int'), 'can_moderate' => new xmlrpcval($user_info['mod_cache']['bq'] != '0=1' && allowedTo('access_mod_center'), 'boolean'), 'can_upload_avatar' => new xmlrpcval(allowedTo('profile_upload_avatar'), 'boolean'), 'can_search' => new xmlrpcval(allowedTo('search_posts'), 'boolean'), 'can_whosonline' => new xmlrpcval(allowedTo('who_view'), 'boolean'), 'post_countdown' => new xmlrpcval(allowedTo('moderate_board') ? 0 : $modSettings['spamWaitTime'], 'int')), 'struct');
    return new xmlrpcresp($response);
}
开发者ID:keweiliu6,项目名称:test-smf2,代码行数:42,代码来源:xmlrpcresp.php


示例2: loadBoard

function loadBoard()
{
    global $txt, $db_prefix, $scripturl, $context, $modSettings;
    global $board_info, $board, $topic, $ID_MEMBER, $user_info;
    // Assume they are not a moderator.
    $user_info['is_mod'] = false;
    $context['user']['is_mod'] =& $user_info['is_mod'];
    // Start the linktree off empty..
    $context['linktree'] = array();
    // Load this board only if the it is specified.
    if (empty($board) && empty($topic)) {
        $board_info = array('moderators' => array());
        return;
    }
    if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] == 3)) {
        // !!! SLOW?
        if (!empty($topic)) {
            $temp = cache_get_data('topic_board-' . $topic, 120);
        } else {
            $temp = cache_get_data('board-' . $board, 120);
        }
        if (!empty($temp)) {
            $board_info = $temp;
            $board = $board_info['id'];
        }
    }
    if (empty($temp)) {
        $request = db_query("\n\t\t\tSELECT\n\t\t\t\tc.ID_CAT, b.name AS bname, b.description, b.numTopics, b.memberGroups,\n\t\t\t\tb.ID_PARENT, c.name AS cname, IFNULL(mem.ID_MEMBER, 0) AS ID_MODERATOR,\n\t\t\t\tmem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,\n\t\t\t\tb.ID_THEME, b.override_theme, b.permission_mode, b.countPosts\n\t\t\tFROM ({$db_prefix}boards AS b" . (!empty($topic) ? ", {$db_prefix}topics AS t" : '') . ")\n\t\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)\n\t\t\t\tLEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = " . (empty($topic) ? $board : 't.ID_BOARD') . ")\n\t\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = mods.ID_MEMBER)\n\t\t\tWHERE b.ID_BOARD = " . (empty($topic) ? $board : "t.ID_BOARD\n\t\t\t\tAND t.ID_TOPIC = {$topic}"), __FILE__, __LINE__);
        // If there aren't any, skip.
        if (mysql_num_rows($request) > 0) {
            $row = mysql_fetch_assoc($request);
            // Set the current board.
            if (!empty($row['ID_BOARD'])) {
                $board = $row['ID_BOARD'];
            }
            // Basic operating information. (globals... :/)
            $board_info = array('id' => $board, 'moderators' => array(), 'cat' => array('id' => $row['ID_CAT'], 'name' => $row['cname']), 'name' => $row['bname'], 'description' => $row['description'], 'num_topics' => $row['numTopics'], 'parent_boards' => getBoardParents($row['ID_PARENT']), 'parent' => $row['ID_PARENT'], 'child_level' => $row['childLevel'], 'theme' => $row['ID_THEME'], 'override_theme' => !empty($row['override_theme']), 'use_local_permissions' => !empty($modSettings['permission_enable_by_board']) && $row['permission_mode'] == 1, 'permission_mode' => empty($modSettings['permission_enable_by_board']) ? empty($row['permission_mode']) ? 'normal' : ($row['permission_mode'] == 2 ? 'no_polls' : ($row['permission_mode'] == 3 ? 'reply_only' : 'read_only')) : 'normal', 'posts_count' => empty($row['countPosts']));
            // Load the membergroups allowed, and check permissions.
            $board_info['groups'] = $row['memberGroups'] == '' ? array() : explode(',', $row['memberGroups']);
            do {
                if (!empty($row['ID_MODERATOR'])) {
                    $board_info['moderators'][$row['ID_MODERATOR']] = array('id' => $row['ID_MODERATOR'], 'name' => $row['realName'], 'href' => $scripturl . '?action=profile;u=' . $row['ID_MODERATOR'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row['realName'] . '</a>');
                }
            } while ($row = mysql_fetch_assoc($request));
            if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] == 3)) {
                // !!! SLOW?
                if (!empty($topic)) {
                    cache_put_data('topic_board-' . $topic, $board_info, 120);
                }
                cache_put_data('board-' . $board, $board_info, 120);
            }
        } else {
            // Otherwise the topic is invalid, there are no moderators, etc.
            $board_info = array('moderators' => array(), 'error' => 'exist');
            $topic = null;
            $board = 0;
        }
        mysql_free_result($request);
    }
    if (!empty($topic)) {
        $_GET['board'] = (int) $board;
    }
    if (!empty($board)) {
        // Now check if the user is a moderator.
        $user_info['is_mod'] = isset($board_info['moderators'][$ID_MEMBER]);
        if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin']) {
            $board_info['error'] = 'access';
        }
        // Build up the linktree.
        $context['linktree'] = array_merge($context['linktree'], array(array('url' => $scripturl . '#' . $board_info['cat']['id'], 'name' => $board_info['cat']['name'])), array_reverse($board_info['parent_boards']), array(array('url' => $scripturl . '?board=' . $board . '.0', 'name' => $board_info['name'])));
    }
    // Set the template contextual information.
    $context['user']['is_mod'] =& $user_info['is_mod'];
    $context['current_topic'] = $topic;
    $context['current_board'] = $board;
    // Hacker... you can't see this topic, I'll tell you that. (but moderators can!)
    if (!empty($board_info['error']) && ($board_info['error'] != 'access' || !$user_info['is_mod'])) {
        // The permissions and theme need loading, just to make sure everything goes smoothly.
        loadPermissions();
        loadTheme();
        $_GET['board'] = '';
        $_GET['topic'] = '';
        // If it's a prefetching agent, just make clear they're not allowed.
        if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') {
            ob_end_clean();
            header('HTTP/1.1 403 Forbidden');
            die;
        } elseif ($user_info['is_guest']) {
            loadLanguage('Errors');
            is_not_guest($txt['topic_gone']);
        } else {
            fatal_lang_error('topic_gone', false);
        }
    }
    if ($user_info['is_mod']) {
        $user_info['groups'][] = 3;
    }
}
开发者ID:alencarmo,项目名称:OCF,代码行数:98,代码来源:Load.php


示例3: loadBoard

function loadBoard()
{
    global $txt, $scripturl, $context, $modSettings;
    global $board_info, $board, $topic, $user_info, $db_show_debug;
    // Assume they are not a moderator.
    $user_info['is_mod'] = false;
    $context['user']['is_mod'] =& $user_info['is_mod'];
    // Start the linktree off empty..
    $context['linktree'] = array();
    // Have they by chance specified a message id but nothing else?
    if (empty($_REQUEST['action']) && empty($topic) && empty($board) && !empty($_REQUEST['msg'])) {
        // Make sure the message id is really an int.
        $_REQUEST['msg'] = (int) $_REQUEST['msg'];
        // Looking through the message table can be slow, so try using the cache first.
        if (($topic = CacheAPI::getCache('msg_topic-' . $_REQUEST['msg'], 120)) === NULL) {
            $request = smf_db_query('
				SELECT id_topic
				FROM {db_prefix}messages
				WHERE id_msg = {int:id_msg}
				LIMIT 1', array('id_msg' => $_REQUEST['msg']));
            // So did it find anything?
            if (mysql_num_rows($request)) {
                list($topic) = mysql_fetch_row($request);
                mysql_free_result($request);
                // Save save save.
                CacheAPI::putCache('msg_topic-' . $_REQUEST['msg'], $topic, 120);
            }
        }
        // Remember redirection is the key to avoiding fallout from your bosses.
        if (!empty($topic)) {
            if (isset($_REQUEST['perma'])) {
                redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . ';perma' . (isset($_REQUEST['xml']) ? ';xml' : ''));
            } else {
                redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']);
            }
        } else {
            loadPermissions();
            loadTheme();
            EoS_Smarty::init($db_show_debug);
            fatal_lang_error('topic_gone', false);
        }
    }
    // Load this board only if it is specified.
    if (empty($board) && empty($topic)) {
        $board_info = array('moderators' => array());
        return;
    }
    if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3)) {
        // !!! SLOW?
        if (!empty($topic)) {
            $temp = CacheAPI::getCache('topic_board-' . $topic, 120);
        } else {
            $temp = CacheAPI::getCache('board-' . $board, 120);
        }
        if (!empty($temp)) {
            $board_info = $temp;
            $board = $board_info['id'];
        }
    }
    if (empty($temp)) {
        $request = smf_db_query('
			SELECT
				c.id_cat, b.name AS bname, b.description, b.num_topics, b.member_groups,
				b.id_parent, c.name AS cname, IFNULL(mem.id_member, 0) AS id_moderator,
				mem.real_name' . (!empty($topic) ? ', b.id_board' : '') . ', b.child_level,
				b.id_theme, b.override_theme, b.count_posts, b.id_profile, b.redirect, b.allow_topics,
				b.unapproved_topics, b.unapproved_posts' . (!empty($topic) ? ', t.approved, t.id_member_started' : '') . '
			FROM {db_prefix}boards AS b' . (!empty($topic) ? '
				INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})' : '') . '
				LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
				LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = {raw:board_link})
				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = mods.id_member)
			WHERE b.id_board = {raw:board_link}', array('current_topic' => $topic, 'board_link' => empty($topic) ? smf_db_quote('{int:current_board}', array('current_board' => $board)) : 't.id_board'));
        // If there aren't any, skip.
        if (mysql_num_rows($request) > 0) {
            $row = mysql_fetch_assoc($request);
            // Set the current board.
            if (!empty($row['id_board'])) {
                $board = $row['id_board'];
            }
            // Basic operating information. (globals... :/)
            $board_info = array('id' => $board, 'moderators' => array(), 'cat' => array('id' => $row['id_cat'], 'name' => $row['cname'], 'is_root' => $row['cname'][0] === '!' ? true : false), 'name' => $row['bname'], 'allow_topics' => $row['allow_topics'], 'description' => $row['description'], 'num_topics' => $row['num_topics'], 'unapproved_topics' => $row['unapproved_topics'], 'unapproved_posts' => $row['unapproved_posts'], 'unapproved_user_topics' => 0, 'parent_boards' => getBoardParents($row['id_parent']), 'parent' => $row['id_parent'], 'child_level' => $row['child_level'], 'theme' => $row['id_theme'], 'override_theme' => !empty($row['override_theme']), 'profile' => $row['id_profile'], 'redirect' => $row['redirect'], 'posts_count' => empty($row['count_posts']), 'cur_topic_approved' => empty($topic) || $row['approved'], 'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started']);
            // Load the membergroups allowed, and check permissions.
            $board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);
            do {
                if (!empty($row['id_moderator'])) {
                    $board_info['moderators'][$row['id_moderator']] = array('id' => $row['id_moderator'], 'name' => $row['real_name'], 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>');
                }
            } while ($row = mysql_fetch_assoc($request));
            // If the board only contains unapproved posts and the user isn't an approver then they can't see any topics.
            // If that is the case do an additional check to see if they have any topics waiting to be approved.
            if ($board_info['num_topics'] == 0 && $modSettings['postmod_active'] && !allowedTo('approve_posts')) {
                mysql_free_result($request);
                // Free the previous result
                $request = smf_db_query('
					SELECT COUNT(id_topic)
					FROM {db_prefix}topics
					WHERE id_member_started={int:id_member}
						AND approved = {int:unapproved}
						AND id_board = {int:board}', array('id_member' => $user_info['id'], 'unapproved' => 0, 'board' => $board));
//.........这里部分代码省略.........
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Load.php


示例4: elk_main

/**
 * The main dispatcher.
 * This delegates to each area.
 */
function elk_main()
{
    global $modSettings, $user_info, $topic, $board_info, $context;
    // Special case: session keep-alive, output a transparent pixel.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        header('Content-Type: image/gif');
        die("GIF89a€!ù,D;");
    }
    // We should set our security headers now.
    frameOptionsHeader();
    securityOptionsHeader();
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current user's permissions.
    loadPermissions();
    // Load BadBehavior before we go much further
    loadBadBehavior();
    // Attachments don't require the entire theme to be loaded.
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest'])) {
        detectBrowser();
    } else {
        loadTheme();
    }
    // Check if the user should be disallowed access.
    is_not_banned();
    // If we are in a topic and don't have permission to approve it then duck out now.
    if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
        fatal_lang_error('not_a_topic', false);
    }
    $no_stat_actions = array('dlattach', 'findmember', 'jsoption', 'requestmembers', 'jslocale', 'xmlpreview', 'suggest', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewadminfile');
    call_integration_hook('integrate_pre_log_stats', array(&$no_stat_actions));
    // Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], $no_stat_actions)) {
        // I see you!
        writeLog();
        // Track forum statistics and hits...?
        if (!empty($modSettings['hitStats'])) {
            trackStats(array('hits' => '+'));
        }
    }
    unset($no_stat_actions);
    // What shall we do?
    require_once SOURCEDIR . '/SiteDispatcher.class.php';
    $dispatcher = new Site_Dispatcher();
    // Show where we came from, and go
    $context['site_action'] = $dispatcher->site_action();
    $context['site_action'] = !empty($context['site_action']) ? $context['site_action'] : (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');
    $dispatcher->dispatch();
}
开发者ID:Ralkage,项目名称:Elkarte,代码行数:55,代码来源:index.php


示例5: smf_main

function smf_main()
{
    global $modSettings, $settings, $user_info, $board, $topic, $board_info, $maintenance, $sourcedir;
    // Special case: session keep-alive, output a transparent pixel.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        header('Content-Type: image/gif');
        die("GIF89a€!ù,D;");
    }
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current user's permissions.
    loadPermissions();
    // Attachments don't require the entire theme to be loaded.
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest'])) {
        detectBrowser();
    } else {
        loadTheme();
    }
    // Check if the user should be disallowed access.
    is_not_banned();
    // If we are in a topic and don't have permission to approve it then duck out now.
    if (!empty($topic) && empty($board_info['cur_topic_approved']) && !allowedTo('approve_posts') && ($user_info['id'] != $board_info['cur_topic_starter'] || $user_info['is_guest'])) {
        fatal_lang_error('not_a_topic', false);
    }
    // Do some logging, unless this is an attachment, avatar, toggle of editor buttons, theme option, XML feed etc.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'findmember', 'jseditor', 'jsoption', 'requestmembers', 'smstats', '.xml', 'xmlhttp', 'verificationcode', 'viewquery', 'viewsmfile'))) {
        // Log this user as online.
        writeLog();
        // Don't track stats of portal xml actions.
        if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'portal' || !isset($_GET['xml'])) {
            // Track forum statistics and hits...?
            if (!empty($modSettings['hitStats'])) {
                trackStats(array('hits' => '+'));
            }
        }
    }
    // Load SimplePortal.
    sportal_init();
    // Is the forum in maintenance mode? (doesn't apply to administrators.)
    if (!empty($maintenance) && !allowedTo('admin_forum')) {
        // You can only login.... otherwise, you're getting the "maintenance mode" display.
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout')) {
            require_once $sourcedir . '/LogInOut.php';
            return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
        } else {
            require_once $sourcedir . '/Subs-Auth.php';
            return 'InMaintenance';
        }
    } elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', 'smstats', 'mailq', 'verificationcode', 'openidreturn')))) {
        require_once $sourcedir . '/Subs-Auth.php';
        return 'KickGuest';
    } elseif (empty($_REQUEST['action'])) {
        // Go catch it boy! Catch it!
        $sp_action = sportal_catch_action();
        if ($sp_action) {
            return $sp_action;
        }
        // Action and board are both empty... BoardIndex!
        if (empty($board) && empty($topic)) {
            require_once $sourcedir . '/BoardIndex.php';
            return 'BoardIndex';
        } elseif (empty($topic)) {
            require_once $sourcedir . '/MessageIndex.php';
            return 'MessageIndex';
        } else {
            require_once $sourcedir . '/Display.php';
            return 'Display';
        }
    }
    // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
    $actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'AdminMain'), 'announce' => array('Post.php', 'AnnounceTopic'), 'attachapprove' => array('ManageAttachments.php', 'ApproveAttach'), 'buddy' => array('Subs-Members.php', 'BuddyListToggle'), 'calendar' => array('Calendar.php', 'CalendarMain'), 'clock' => array('Calendar.php', 'clock'), 'collapse' => array('BoardIndex.php', 'CollapseCategory'), 'coppa' => array('Register.php', 'CoppaForm'), 'credits' => array('Who.php', 'Credits'), 'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'), 'display' => array('Display.php', 'Display'), 'dlattach' => array('Display.php', 'Download'), 'editpoll' => array('Poll.php', 'EditPoll'), 'editpoll2' => array('Poll.php', 'EditPoll2'), 'emailuser' => array('SendTopic.php', 'EmailUser'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), 'forum' => array('BoardIndex.php', 'BoardIndex'), 'portal' => array('PortalMain.php', 'sportal_main'), 'groups' => array('Groups.php', 'Groups'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), 'im' => array('PersonalMessage.php', 'MessageMain'), 'jseditor' => array('Subs-Editor.php', 'EditorMain'), 'jsmodify' => array('Post.php', 'JavaScriptModify'), 'jsoption' => array('Themes.php', 'SetJavaScript'), 'lock' => array('LockTopic.php', 'LockTopic'), 'lockvoting' => array('Poll.php', 'LockVoting'), 'login' => array('LogInOut.php', 'Login'), 'login2' => array('LogInOut.php', 'Login2'), 'logout' => array('LogInOut.php', 'Logout'), 'markasread' => array('Subs-Boards.php', 'MarkRead'), 'mergetopics' => array('SplitTopics.php', 'MergeTopics'), 'mlist' => array('Memberlist.php', 'Memberlist'), 'moderate' => array('ModerationCenter.php', 'ModerationMain'), 'modifycat' => array('ManageBoards.php', 'ModifyCat'), 'modifykarma' => array('Karma.php', 'ModifyKarma'), 'movetopic' => array('MoveTopic.php', 'MoveTopic'), 'movetopic2' => array('MoveTopic.php', 'MoveTopic2'), 'notify' => array('Notify.php', 'Notify'), 'notifyboard' => array('Notify.php', 'BoardNotify'), 'openidreturn' => array('Subs-OpenID.php', 'smf_openID_return'), 'pm' => array('PersonalMessage.php', 'MessageMain'), 'post' => array('Post.php', 'Post'), 'post2' => array('Post.php', 'Post2'), 'printpage' => array('Printpage.php', 'PrintTopic'), 'profile' => array('Profile.php', 'ModifyProfile'), 'quotefast' => array('Post.php', 'QuoteFast'), 'quickmod' => array('MessageIndex.php', 'QuickModeration'), 'quickmod2' => array('Display.php', 'QuickInTopicModeration'), 'recent' => array('Recent.php', 'RecentPosts'), 'register' => array('Register.php', 'Register'), 'register2' => array('Register.php', 'Register2'), 'reminder' => array('Reminder.php', 'RemindMe'), 'removepoll' => array('Poll.php', 'RemovePoll'), 'removetopic2' => array('RemoveTopic.php', 'RemoveTopic2'), 'reporttm' => array('SendTopic.php', 'ReportToModerator'), 'requestmembers' => array('Subs-Auth.php', 'RequestMembers'), 'restoretopic' => array('RemoveTopic.php', 'RestoreTopic'), 'search' => array('Search.php', 'PlushSearch1'), 'search2' => array('Search.php', 'PlushSearch2'), 'sendtopic' => array('SendTopic.php', 'EmailUser'), 'smstats' => array('Stats.php', 'SMStats'), 'suggest' => array('Subs-Editor.php', 'AutoSuggestHandler'), 'spellcheck' => array('Subs-Post.php', 'SpellCheck'), 'splittopics' => array('SplitTopics.php', 'SplitTopics'), 'stats' => array('Stats.php', 'DisplayStats'), 'sticky' => array('LockTopic.php', 'Sticky'), 'theme' => array('Themes.php', 'ThemesMain'), 'trackip' => array('Profile-View.php', 'trackIP'), 'about:mozilla' => array('Karma.php', 'BookOfUnknown'), 'about:unknown' => array('Karma.php', 'BookOfUnknown'), 'unread' => array('Recent.php', 'UnreadTopics'), 'unreadreplies' => array('Recent.php', 'UnreadTopics'), 'verificationcode' => array('Register.php', 'VerificationCode'), 'viewprofile' => array('Profile.php', 'ModifyProfile'), 'vote' => array('Poll.php', 'Vote'), 'viewquery' => array('ViewQuery.php', 'ViewQuery'), 'viewsmfile' => array('Admin.php', 'DisplayAdminFile'), 'who' => array('Who.php', 'Who'), '.xml' => array('News.php', 'ShowXmlFeed'), 'xmlhttp' => array('Xml.php', 'XMLhttpMain'));
    // Allow modifying $actionArray easily.
    call_integration_hook('integrate_actions', array(&$actionArray));
    if (!empty($context['disable_sp'])) {
        unset($actionArray['portal'], $actionArray['forum']);
    }
    // Get the function and file to include - if it's not there, do the board index.
    if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {
        // Catch the action with the theme?
        if (!empty($settings['catch_action'])) {
            require_once $sourcedir . '/Themes.php';
            return 'WrapAction';
        }
        // Fall through to the board index then...
        require_once $sourcedir . '/BoardIndex.php';
        return 'BoardIndex';
    }
    // Otherwise, it was set - so let's go to that action.
    require_once $sourcedir . '/' . $actionArray[$_REQUEST['action']][0];
    return $actionArray[$_REQUEST['action']][1];
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:93,代码来源:index.php


示例6: shd_init

/**
 *	Initialises key values for SimpleDesk.
 *
 *	This function initialises certain key constructs for SimpleDesk, such as constants, that are used throughout
 *	SimpleDesk. It should be called first right up in Load.php anyway.
 *
 *	Calling multiple times is not significantly detrimental to performance; the function is aware if it has been
 *	called previously.
 *
 *	@since 2.0
*/
function shd_init()
{
    global $modSettings, $sourcedir, $user_info, $context, $smcFunc;
    static $called = null;
    if (!empty($called)) {
        return;
    }
    $called = true;
    $context['shd_home'] = 'action=helpdesk;sa=main';
    // What SD version are we on? It's now here!
    define('SHD_VERSION', 'SimpleDesk 2.0 Anatidae');
    // This isn't the SMF way. But for something like this, it's way way more logical and readable.
    define('TICKET_STATUS_NEW', 0);
    define('TICKET_STATUS_PENDING_STAFF', 1);
    define('TICKET_STATUS_PENDING_USER', 2);
    define('TICKET_STATUS_CLOSED', 3);
    define('TICKET_STATUS_WITH_SUPERVISOR', 4);
    define('TICKET_STATUS_ESCALATED', 5);
    define('TICKET_STATUS_DELETED', 6);
    define('TICKET_URGENCY_LOW', 0);
    define('TICKET_URGENCY_MEDIUM', 1);
    define('TICKET_URGENCY_HIGH', 2);
    define('TICKET_URGENCY_VHIGH', 3);
    define('TICKET_URGENCY_SEVERE', 4);
    define('TICKET_URGENCY_CRITICAL', 5);
    define('MSG_STATUS_NORMAL', 0);
    define('MSG_STATUS_DELETED', 1);
    // Relationship types
    define('RELATIONSHIP_LINKED', 0);
    define('RELATIONSHIP_DUPLICATED', 1);
    define('RELATIONSHIP_ISPARENT', 2);
    define('RELATIONSHIP_ISCHILD', 3);
    // Custom fields, their types, positions, content type
    define('CFIELD_TICKET', 1);
    define('CFIELD_REPLY', 2);
    define('CFIELD_PLACE_DETAILS', 1);
    define('CFIELD_PLACE_INFO', 2);
    define('CFIELD_PLACE_PREFIX', 3);
    define('CFIELD_PLACE_PREFIXFILTER', 4);
    define('CFIELD_TYPE_TEXT', 1);
    define('CFIELD_TYPE_LARGETEXT', 2);
    define('CFIELD_TYPE_INT', 3);
    define('CFIELD_TYPE_FLOAT', 4);
    define('CFIELD_TYPE_SELECT', 5);
    define('CFIELD_TYPE_CHECKBOX', 6);
    define('CFIELD_TYPE_RADIO', 7);
    define('CFIELD_TYPE_MULTI', 8);
    // Ticket notification options
    define('NOTIFY_PREFS', 0);
    define('NOTIFY_ALWAYS', 1);
    define('NOTIFY_NEVER', 2);
    // Roles and permissions
    define('ROLE_USER', 1);
    define('ROLE_STAFF', 2);
    //define('ROLE_SUPERVISOR', 3);
    define('ROLE_ADMIN', 4);
    define('ROLEPERM_DISALLOW', 0);
    define('ROLEPERM_ALLOW', 1);
    define('ROLEPERM_DENY', 2);
    // How many digits should we show for ticket numbers? Normally we pad to 5 digits, e.g. 00001 - this is how we set that width.
    if (empty($modSettings['shd_zerofill']) || $modSettings['shd_zerofill'] < 0) {
        $modSettings['shd_zerofill'] = 0;
    }
    // Load some stuff
    shd_load_language('sd_language/SimpleDesk');
    require_once $sourcedir . '/sd_source/Subs-SimpleDeskPermissions.php';
    // Set up defaults
    $defaults = array('shd_attachments_mode' => 'ticket', 'shd_ticketnav_style' => 'sd', 'shd_staff_badge' => 'nobadge', 'shd_privacy_display' => 'smart');
    foreach ($defaults as $var => $val) {
        if (empty($modSettings[$var])) {
            $modSettings[$var] = $val;
        }
    }
    $modSettings['helpdesk_active'] = isset($modSettings['admin_features']) ? in_array('shd', explode(',', $modSettings['admin_features'])) : false;
    if ($modSettings['helpdesk_active']) {
        shd_load_plugin_files('init');
        shd_load_plugin_langfiles('init');
    }
    shd_load_user_perms();
    if (!empty($modSettings['shd_maintenance_mode'])) {
        if (!empty($modSettings['shd_helpdesk_only']) && !$user_info['is_admin'] && !shd_allowed_to('admin_helpdesk', 0)) {
            // You can only login.... otherwise, you're getting the "maintenance mode" display. Except we have to boot up a decent amount of SMF.
            if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'login2' && $_REQUEST['action'] != 'logout') {
                $_GET['action'] = '';
                $_REQUEST['action'] = '';
                $context['shd_maintenance_mode'] = true;
                loadBoard();
                loadPermissions();
                loadTheme();
//.........这里部分代码省略.........
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:101,代码来源:Subs-SimpleDesk.php


示例7: time

    $upcontext['started'] = time();
    $upcontext['updated'] = 0;
    $upcontext['user'] = array('id' => 0, 'name' => 'Guest', 'pass' => 0, 'started' => $upcontext['started'], 'updated' => $upcontext['updated']);
}
// Load up some essential data...
loadEssentialData();
// Are we going to be mimicking SSI at this point?
if (isset($_GET['ssi'])) {
    require_once SOURCEDIR . '/Subs.php';
    require_once SOURCEDIR . '/Errors.php';
    require_once SOURCEDIR . '/Logging.php';
    require_once SOURCEDIR . '/Load.php';
    require_once SUBSDIR . '/Cache.subs.php';
    require_once SOURCEDIR . '/Security.php';
    loadUserSettings();
    loadPermissions();
}
// We may need this later
require_once SUBSDIR . '/Package.subs.php';
// All the non-SSI stuff.
loadEssentialFunctions();
// Don't do security check if on Yabbse or SMF
if (!isset($modSettings['elkVersion'])) {
    $disable_security = true;
}
// We should have the database easily at this point
$db = database();
// Does this exist?
if (isset($modSettings['elkVersion'])) {
    $request = $db->query('', '
		SELECT variable, value
开发者ID:joshuaadickerson,项目名称:Elkarte,代码行数:31,代码来源:upgrade.php


示例8: loadBoard

/**
 * Check for moderators and see if they have access to the board.
 *
 * What it does:
 * - sets up the $board_info array for current board information.
 * - if cache is enabled, the $board_info array is stored in cache.
 * - redirects to appropriate post if only message id is requested.
 * - is only used when inside a topic or board.
 * - determines the local moderators for the board.
 * - adds group id 3 if the user is a local moderator for the board they are in.
 * - prevents access if user is not in proper group nor a local moderator of the board.
 */
function loadBoard()
{
    global $txt, $scripturl, $context, $modSettings;
    global $board_info, $board, $topic, $user_info;
    $db = database();
    // Assume they are not a moderator.
    $user_info['is_mod'] = false;
    $context['user']['is_mod'] =& $user_info['is_mod'];
    // @since 1.0.5 - is_mod takes into account only local (board) moderators,
    // and not global moderators, is_moderator is meant to take into account both.
    $user_info['is_moderator'] = false;
    $context['user']['is_moderator'] =& $user_info['is_moderator'];
    // Start the linktree off empty..
    $context['linktree'] = array();
    // Have they by chance specified a message id but nothing else?
    if (empty($_REQUEST['action']) && empty($topic) && empty($board) && !empty($_REQUEST['msg'])) {
        // Make sure the message id is really an int.
        $_REQUEST['msg'] = (int) $_REQUEST['msg'];
        // Looking through the message table can be slow, so try using the cache first.
        if (($topic = cache_get_data('msg_topic-' . $_REQUEST['msg'], 120)) === null) {
            require_once SUBSDIR . '/Messages.subs.php';
            $topic = associatedTopic($_REQUEST['msg']);
            // So did it find anything?
            if ($topic !== false) {
                // Save save save.
                cache_put_data('msg_topic-' . $_REQUEST['msg'], $topic, 120);
            }
        }
        // Remember redirection is the key to avoiding fallout from your bosses.
        if (!empty($topic)) {
            redirectexit('topic=' . $topic . '.msg' . $_REQUEST['msg'] . '#msg' . $_REQUEST['msg']);
        } else {
            loadPermissions();
            loadTheme();
            fatal_lang_error('topic_gone', false);
        }
    }
    // Load this board only if it is specified.
    if (empty($board) && empty($topic)) {
        $board_info = array('moderators' => array());
        return;
    }
    if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3)) {
        // @todo SLOW?
        if (!empty($topic)) {
            $temp = cache_get_data('topic_board-' . $topic, 120);
        } else {
            $temp = cache_get_data('board-' . $board, 120);
        }
        if (!empty($temp)) {
            $board_info = $temp;
            $board = $board_info['id'];
        }
    }
    if (empty($temp)) {
        $select_columns = array();
        $select_tables = array();
        // Wanna grab something more from the boards table or another table at all?
        call_integration_hook('integrate_load_board_query', array(&$select_columns, &$select_tables));
        $request = $db->query('', '
			SELECT
				c.id_cat, b.name AS bname, b.description, b.num_topics, b.member_groups, b.deny_member_groups,
				b.id_parent, c.name AS cname, IFNULL(mem.id_member, 0) AS id_moderator,
				mem.real_name' . (!empty($topic) ? ', b.id_board' : '') . ', b.child_level,
				b.id_theme, b.override_theme, b.count_posts, b.id_profile, b.redirect,
				b.unapproved_topics, b.unapproved_posts' . (!empty($topic) ? ', t.approved, t.id_member_started' : '') . (!empty($select_columns) ? ', ' . implode(', ', $select_columns) : '') . '
			FROM {db_prefix}boards AS b' . (!empty($topic) ? '
				INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})' : '') . (!empty($select_tables) ? '
				' . implode("\n\t\t\t\t", $select_tables) : '') . '
				LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
				LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = {raw:board_link})
				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = mods.id_member)
			WHERE b.id_board = {raw:board_link}', array('current_topic' => $topic, 'board_link' => empty($topic) ? $db->quote('{int:current_board}', array('current_board' => $board)) : 't.id_board'));
        // If there aren't any, skip.
        if ($db->num_rows($request) > 0) {
            $row = $db->fetch_assoc($request);
            // Set the current board.
            if (!empty($row['id_board'])) {
                $board = $row['id_board'];
            }
            // Basic operating information. (globals... :/)
            $board_info = array('id' => $board, 'moderators' => array(), 'cat' => array('id' => $row['id_cat'], 'name' => $row['cname']), 'name' => $row['bname'], 'description' => $row['description'], 'num_topics' => $row['num_topics'], 'unapproved_topics' => $row['unapproved_topics'], 'unapproved_posts' => $row['unapproved_posts'], 'unapproved_user_topics' => 0, 'parent_boards' => getBoardParents($row['id_parent']), 'parent' => $row['id_parent'], 'child_level' => $row['child_level'], 'theme' => $row['id_theme'], 'override_theme' => !empty($row['override_theme']), 'profile' => $row['id_profile'], 'redirect' => $row['redirect'], 'posts_count' => empty($row['count_posts']), 'cur_topic_approved' => empty($topic) || $row['approved'], 'cur_topic_starter' => empty($topic) ? 0 : $row['id_member_started']);
            // Load the membergroups allowed, and check permissions.
            $board_info['groups'] = $row['member_groups'] == '' ? array() : explode(',', $row['member_groups']);
            $board_info['deny_groups'] = $row['deny_member_groups'] == '' ? array() : explode(',', $row['deny_member_groups']);
            do {
                if (!empty($row['id_moderator'])) {
                    $board_info['moderators'][$row['id_moderator']] = array('id' => $row['id_moderator'], 'name' => $row['real_name'], 'href' => $scripturl . '?action=profile;u=' . $row['id_moderator'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_moderator'] . '">' . $row['real_name'] . '</a>');
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:Load.php


示例9: mob_m_merge_topic

function mob_m_merge_topic($rpcmsg)
{
    global $mobdb, $func, $board, $topic, $context;
    // Get the topics
    $topic_1 = $rpcmsg->getScalarValParam(1);
    $topic_2 = $rpcmsg->getScalarValParam(0);
    if ($topic_1 == $topic_2) {
        mob_error('same topic');
    }
    $topicinfo_1 = get_topicinfo($topic_1);
    $topicinfo_2 = get_topicinfo($topic_2);
    if (empty($topicinfo_1) || empty($topicinfo_2)) {
        mob_error('topics not found');
    }
    $topic = $topic_1;
    $board = $topicinfo_1['id_board'];
    loadBoard();
    loadPermissions();
    // do_merge will check for our permissions
    do_merge(array($topic_1, $topic_2));
    // Return a true response
    return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean')), 'struct'));
}
开发者ID:keweiliu6,项目名称:test_smf1,代码行数:23,代码来源:moderation.php


示例10: build_board

function build_board($boards, $is_cat = false)
{
    global $settings, $context, $user_info, $smcFunc, $boardurl, $boarddir, $modSettings, $board;
    $response = array();
    foreach ($boards as $id => $tt_board) {
        if (empty($tt_board['id'])) {
            continue;
        }
        $new_post = false;
        if ($tt_board['new'] || $tt_board['children_new']) {
            $new_post = true;
            $logo_url = $settings['images_url'] . '/' . $context['theme_variant_url'] . 'on' . ($tt_board['new'] ? '' : '2') . '.png';
        } elseif ($tt_board['redirect']) {
            $logo_url = $settings['images_url'] . '/' . $context['theme_variant_url'] . 'redirect.png';
        } else {
            $logo_url = $settings['images_url'] . '/' . $context['theme_variant_url'] . 'off.png';
        }
        $logo_dir = str_replace($boardurl, $boarddir, $logo_url);
        if (!file_exists($logo_dir) && file_exists(preg_replace('/png$/', 'gif', $logo_dir))) {
            $logo_url = preg_replace('/png$/', 'gif', $logo_url);
        }
        $is_link_forum = isset($tt_board['redirect']) && !empty($tt_board['redirect']);
        if (!$is_cat && !$user_info['is_guest']) {
            $can_subscribe = allowedTo('mark_notify', $tt_board['id']);
            $request = $smcFunc['db_query']('', '
                SELECT sent
                FROM {db_prefix}log_notify
                WHERE id_board = {int:current_board}
                    AND id_member = {int:current_member}
                LIMIT 1', array('current_board' => $tt_board['id'], 'current_member' => $user_info['id']));
            $is_subscribed = $smcFunc['db_num_rows']($request) != 0;
            $smcFunc['db_free_result']($request);
            $board = $tt_board['id'];
            loadBoard();
            loadPermissions();
            $can_post_new = (allowedTo('post_new') || $modSettings['postmod_active'] && allowedTo('post_unapproved_topics')) && !$is_link_forum;
            $mobiquo_can_post = true;
            if (isset($modSettings['boards_disable_new_topic']) && !empty($modSettings['boards_disable_new_topic'])) {
                $dis_new_topic_boards = explode(',', $modSettings['boards_disable_new_topic']);
                $mobiquo_can_post = !in_array($tt_board['id'], $dis_new_topic_boards);
            }
            $can_post = $can_post_new && $mobiquo_can_post ? true : false;
        } else {
            $can_subscribe = false;
            $is_subscribed = false;
            $can_post = false;
        }
        $tp_board_id = $is_cat ? preg_replace('/c/', '', $tt_board['id']) : $tt_board['id'];
        $logo_url = ($tp_logo_url = tp_get_forum_icon($tp_board_id, $is_link_forum ? 'link' : ($is_cat ? 'category' : 'forum'), false, $new_post)) ? $tp_logo_url : $logo_url;
        $xmlrpc_forum = array('forum_id' => new xmlrpcval($tt_board['id'], 'string'), 'forum_name' => new xmlrpcval(basic_clean($tt_board['name']), 'base64'), 'parent_id' => new xmlrpcval($tt_board['id_parent'] ? $tt_board['id_parent'] : 'c' . $tt_board['id_cat'], 'string'), 'logo_url' => new xmlrpcval($logo_url, 'string'), 'new_post' => new xmlrpcval($new_post, 'boolean'), 'url' => new xmlrpcval($tt_board['redirect'], 'string'), 'sub_only' => new xmlrpcval($is_cat, 'boolean'), 'can_subscribe' => new xmlrpcval($can_subscribe, 'boolean'), 'is_subscribed' => new xmlrpcval($is_subscribed, 'boolean'), 'is_protected' => new xmlrpcval(false, 'boolean'), 'can_post' => new xmlrpcval($can_post, 'boolean'));
        if ($_GET['return_description']) {
            $xmlrpc_forum['description'] = new xmlrpcval(basic_clean($tt_board['description']), 'base64');
        }
        if (isset($_GET['forum_id']) && (!empty($_GET['forum_id']) || $_GET['forum_id'] === 0)) {
            $xmlrpc_forum['has_child'] = new xmlrpcval($tt_board['has_child'], 'boolean');
        }
        if (isset($tt_board['boards']) && !empty($tt_board['boards'])) {
            $xmlrpc_forum['child'] = new xmlrpcval(build_board($tt_board['boards']), 'array');
        }
        $response[] = new xmlrpcval($xmlrpc_forum, 'struct');
    }
    return $response;
}
开发者ID:keweiliu6,项目名称:test-smf2,代码行数:63,代码来源:mobiquo_action.php


示例11: smf_main

function smf_main()
{
    global $modSettings, $settings, $user_info, $board, $topic, $maintenance, $sourcedir;
    // Special case: session keep-alive.
    if (isset($_GET['action']) && $_GET['action'] == 'keepalive') {
        die;
    }
    // Load the user's cookie (or set as guest) and load their settings.
    loadUserSettings();
    // Load the current board's information.
    loadBoard();
    // Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
    loadTheme();
    // Check if the user should be disallowed access.
    //	is_not_banned();
    // Load the current user's permissions.
    loadPermissions();
    // Do some logging, unless this is an attachment, avatar, theme option or XML feed.
    if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml'))) {
        // Log this user as online.
        writeLog();
        // Track forum statistics and hits...?
        if (!empty($modSettings['hitStats'])) {
            trackStats(array('hits' => '+'));
        }
    }
    // Is the forum in maintenance mode? (doesn't apply to administrators.)
    if (!empty($maintenance) && !allowedTo('admin_forum')) {
        // You can only login.... otherwise, you're getting the "maintenance mode" display.
        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'login2' || $_REQUEST['action'] == 'logout')) {
            require_once $sourcedir . '/LogInOut.php';
            return $_REQUEST['action'] == 'login2' ? 'Login2' : 'Logout';
        } else {
            require_once $sourcedir . '/Subs-Auth.php';
            return 'InMaintenance';
        }
    } elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'register', 'register2', 'reminder', 'activate', 'smstats', 'help', 'verificationcode')))) {
        require_once $sourcedir . '/Subs-Auth.php';
        return 'KickGuest';
    } elseif (empty($_REQUEST['action'])) {
        // Action and board are both empty... BoardIndex!
        if (empty($board) && empty($topic)) {
            require_once $sourcedir . '/BoardIndex.php';
            return 'BoardIndex';
        } elseif (empty($topic)) {
            require_once $sourcedir . '/MessageIndex.php';
            return 'MessageIndex';
        } else {
            require_once $sourcedir . '/Display.php';
            return 'Display';
        }
    }
    // Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
    $actionArray = array('activate' => array('Register.php', 'Activate'), 'admin' => array('Admin.php', 'Admin'), 'announce' => array('Post.php', 'AnnounceTopic'), 'ban' => array('ManageBans.php', 'Ban'), 'boardrecount' => array('Admin.php', 'AdminBoardRecount'), 'buddy' => array('Subs-Mem 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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