当前位置: 首页>>代码示例>>PHP>>正文


PHP is_not_guest函数代码示例

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


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

示例1: currentMemberID

/**
 * Find the ID of the "current" member
 *
 * @param boolean $fatal if the function ends in a fatal error in case of problems (default true)
 * @param boolean $reload_id if true the already set value is ignored (default false)
 *
 * @return mixed and integer if no error, false in case of problems if $fatal is false
 */
function currentMemberID($fatal = true, $reload_id = false)
{
    global $user_info;
    static $memID;
    // If we already know who we're dealing with
    if (isset($memID) && !$reload_id) {
        return $memID;
    }
    // Did we get the user by name...
    if (isset($_REQUEST['user'])) {
        $memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
    } elseif (!empty($_REQUEST['u'])) {
        $memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
    } else {
        $memberResult = loadMemberData($user_info['id'], false, 'profile');
    }
    // Check if loadMemberData() has returned a valid result.
    if (!is_array($memberResult)) {
        // Members only...
        is_not_guest('', $fatal);
        if ($fatal) {
            fatal_lang_error('not_a_user', false);
        } else {
            return false;
        }
    }
    // If all went well, we have a valid member ID!
    list($memID) = $memberResult;
    return $memID;
}
开发者ID:scripple,项目名称:Elkarte,代码行数:38,代码来源:Profile.subs.php

示例2: ENotifyMain

function ENotifyMain()
{
    global $modSettings;
    // Guests can't have unread things, we don't know anything about them.
    is_not_guest();
    // Update our unread replies log
    if (!empty($modSettings['enotify_replies'])) {
        ENotifyUpdateUnreadReplies();
    }
    // Update our personal messages log
    if (!empty($modSettings['enotify_pms'])) {
        ENotifyUpdatePms();
    }
    // Load up the notifications at last :)
    ENotifyLoad();
    // Run our garbage collection randomly (setting 0.05% chance for it to run)
    $random = rand(1, 5000);
    if ($random == '1987') {
        ENotifyGarbageCollect();
    }
    // Load the language and the template file.
    loadLanguage('ENotify');
    loadTemplate('ENotify');
    template_enotify_main();
    // We use this to deactivate the SMF Wrapping Templates
    die;
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:27,代码来源:ENotify.php

示例3: action_index

 /**
  * Subaction handler - manages the action and delegates control to the proper
  * sub-action.
  *
  * What it does:
  * - It loads both the Themes and Settings language files.
  * - Checks the session by GET or POST to verify the sent data.
  * - Requires the user to not be a guest.
  * - Accessed via ?action=admin;area=theme.
  *
  * @see Action_Controller::action_index()
  */
 public function action_index()
 {
     global $txt, $context;
     if (isset($_REQUEST['api'])) {
         return $this->action_index_api();
     }
     // Load the important language files...
     loadLanguage('ManageThemes');
     loadLanguage('Settings');
     require_once SUBSDIR . '/Action.class.php';
     // No guests in here.
     is_not_guest();
     // Theme administration, removal, choice, or installation...
     $subActions = array('admin' => array($this, 'action_admin', 'permission' => 'admin_forum'), 'list' => array($this, 'action_list', 'permission' => 'admin_forum'), 'reset' => array($this, 'action_options', 'permission' => 'admin_forum'), 'options' => array($this, 'action_options', 'permission' => 'admin_forum'), 'install' => array($this, 'action_install', 'permission' => 'admin_forum'), 'remove' => array($this, 'action_remove', 'permission' => 'admin_forum'), 'pick' => array($this, 'action_pick'), 'edit' => array($this, 'action_edit', 'permission' => 'admin_forum'), 'copy' => array($this, 'action_copy', 'permission' => 'admin_forum'), 'themelist' => array($this, 'action_themelist', 'permission' => 'admin_forum'), 'browse' => array($this, 'action_browse', 'permission' => 'admin_forum'));
     // Action controller
     $action = new Action('manage_themes');
     // @todo Layout Settings?
     if (!empty($context['admin_menu_name'])) {
         $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['themeadmin_title'], 'description' => $txt['themeadmin_description'], 'tabs' => array('admin' => array('description' => $txt['themeadmin_admin_desc']), 'list' => array('description' => $txt['themeadmin_list_desc']), 'reset' => array('description' => $txt['themeadmin_reset_desc']), 'edit' => array('description' => $txt['themeadmin_edit_desc']), 'themelist' => array('description' => $txt['themeadmin_edit_desc']), 'browse' => array('description' => $txt['themeadmin_edit_desc'])));
     }
     // Follow the sa or just go to administration, call integrate_sa_manage_themes
     $subAction = $action->initialize($subActions, 'admin');
     // Default the page title to Theme Administration by default.
     $context['page_title'] = $txt['themeadmin_title'];
     $context['sub_action'] = $subAction;
     // Go to the action, if you have permissions
     $action->dispatch($subAction);
 }
开发者ID:scripple,项目名称:Elkarte,代码行数:40,代码来源:ManageThemes.controller.php

示例4: action_index

 /**
  * This is the main function for markasread file.
  *
  * @see Action_Controller::action_index()
  */
 public function action_index()
 {
     // These checks have been moved here.
     // Do NOT call the specific handlers directly.
     // Guests can't mark things.
     is_not_guest();
     checkSession('get');
     $redir = $this->_dispatch();
     redirectexit($redir);
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:15,代码来源:Markasread.controller.php

示例5: shd_ticket_unread

/**
 *	Marks a ticket unread.
 *
 *	There are no permission checks made; other than that the user is who they claim to be. If a ticket is marked unread
 *	but they can't see it anyway, the consequence is that the database gets lighter.
 *
 *	Invoked through ?action=helpdesk;sa=unreadticket;ticket=x;sessvar=sessid before redirecting back to the main helpdesk page.
 *
 *	@since 1.0
*/
function shd_ticket_unread()
{
    global $smcFunc, $user_info, $context;
    is_not_guest();
    checkSession('get');
    if (!empty($context['ticket_id'])) {
        call_integration_hook('shd_hook_markunread');
        $result = shd_db_query('', '
			DELETE FROM {db_prefix}helpdesk_log_read
			WHERE id_ticket = {int:current_ticket}
				AND id_member = {int:user}', array('current_ticket' => $context['ticket_id'], 'user' => $user_info['id']));
    }
    redirectexit($context['shd_home'] . $context['shd_dept_link']);
}
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:24,代码来源:SimpleDesk-MiscActions.php

示例6: BoardNotify

function BoardNotify()
{
    global $scripturl, $txt, $board, $user_info, $context, $smcFunc;
    // Permissions are an important part of anything ;).
    is_not_guest();
    isAllowedTo('mark_notify');
    // You have to specify a board to turn notifications on!
    if (empty($board)) {
        fatal_lang_error('no_board', false);
    }
    // No subaction: find out what to do.
    if (empty($_GET['sa'])) {
        // We're gonna need the notify template...
        loadTemplate('Notify');
        // Find out if they have notification set for this topic already.
        $request = $smcFunc['db_query']('', '
			SELECT id_member
			FROM {db_prefix}log_notify
			WHERE id_member = {int:current_member}
				AND id_board = {int:current_board}
			LIMIT 1', array('current_board' => $board, 'current_member' => $user_info['id']));
        $context['notification_set'] = $smcFunc['db_num_rows']($request) != 0;
        $smcFunc['db_free_result']($request);
        // Set the template variables...
        $context['board_href'] = $scripturl . '?board=' . $board . '.' . $_REQUEST['start'];
        $context['start'] = $_REQUEST['start'];
        $context['page_title'] = $txt['notification'];
        $context['sub_template'] = 'notify_board';
        return;
    } elseif ($_GET['sa'] == 'on') {
        checkSession('get');
        // Turn notification on.  (note this just blows smoke if it's already on.)
        $smcFunc['db_insert']('ignore', '{db_prefix}log_notify', array('id_member' => 'int', 'id_board' => 'int'), array($user_info['id'], $board), array('id_member', 'id_board'));
    } else {
        checkSession('get');
        // Turn notification off for this board.
        $smcFunc['db_query']('', '
			DELETE FROM {db_prefix}log_notify
			WHERE id_member = {int:current_member}
				AND id_board = {int:current_board}', array('current_board' => $board, 'current_member' => $user_info['id']));
    }
    // Back to the board!
    redirectexit('board=' . $board . '.' . $_REQUEST['start']);
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:44,代码来源:Notify.php

示例7: ThemesMain

/**
 * Subaction handler - manages the action and delegates control to the proper
 * sub-action.
 * It loads both the Themes and Settings language files.
 * Checks the session by GET or POST to verify the sent data.
 * Requires the user not be a guest. (@todo what?)
 * Accessed via ?action=admin;area=theme.
 */
function ThemesMain()
{
    global $txt, $context, $scripturl;
    // Load the important language files...
    loadLanguage('Themes');
    loadLanguage('Settings');
    // No funny business - guests only.
    is_not_guest();
    // Default the page title to Theme Administration by default.
    $context['page_title'] = $txt['themeadmin_title'];
    // Theme administration, removal, choice, or installation...
    $subActions = array('admin' => 'ThemeAdmin', 'list' => 'ThemeList', 'reset' => 'SetThemeOptions', 'options' => 'SetThemeOptions', 'install' => 'ThemeInstall', 'remove' => 'RemoveTheme', 'pick' => 'PickTheme', 'edit' => 'EditTheme', 'copy' => 'CopyTemplate');
    // @todo Layout Settings?
    if (!empty($context['admin_menu_name'])) {
        $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['themeadmin_title'], 'help' => 'themes', 'description' => $txt['themeadmin_description'], 'tabs' => array('admin' => array('description' => $txt['themeadmin_admin_desc']), 'list' => array('description' => $txt['themeadmin_list_desc']), 'reset' => array('description' => $txt['themeadmin_reset_desc']), 'edit' => array('description' => $txt['themeadmin_edit_desc'])));
    }
    // Follow the sa or just go to administration.
    if (isset($_GET['sa']) && !empty($subActions[$_GET['sa']])) {
        $subActions[$_GET['sa']]();
    } else {
        $subActions['admin']();
    }
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:31,代码来源:Themes.php

示例8: UnreadTopics

function UnreadTopics()
{
    global $board, $txt, $scripturl, $db_prefix, $sourcedir;
    global $ID_MEMBER, $user_info, $context, $settings, $modSettings, $func;
    // Guests can't have unread things, we don't know anything about them.
    is_not_guest();
    // Prefetching + lots of MySQL work = bad mojo.
    if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch') {
        ob_end_clean();
        header('HTTP/1.1 403 Forbidden');
        die;
    }
    $context['showing_all_topics'] = isset($_GET['all']);
    if ($_REQUEST['action'] == 'unread') {
        $context['page_title'] = $context['showing_all_topics'] ? $txt['unread_topics_all'] : $txt['unread_topics_visit'];
    } else {
        $context['page_title'] = $txt['unread_replies'];
    }
    if ($context['showing_all_topics'] && !empty($context['load_average']) && !empty($modSettings['loadavg_allunread']) && $context['load_average'] >= $modSettings['loadavg_allunread']) {
        fatal_lang_error('loadavg_allunread_disabled', false);
    } elseif ($_REQUEST['action'] != 'unread' && !empty($context['load_average']) && !empty($modSettings['loadavg_unreadreplies']) && $context['load_average'] >= $modSettings['loadavg_unreadreplies']) {
        fatal_lang_error('loadavg_unreadreplies_disabled', false);
    }
    // Are we specifying any specific board?
    if (!empty($board)) {
        $query_this_board = 'ID_BOARD = ' . $board;
        $context['querystring_board_limits'] = ';board=' . $board . '.%d';
    } elseif (!empty($_REQUEST['boards'])) {
        $_REQUEST['boards'] = explode(',', $_REQUEST['boards']);
        foreach ($_REQUEST['boards'] as $i => $b) {
            $_REQUEST['boards'][$i] = (int) $b;
        }
        $request = db_query("\n\t\t\tSELECT b.ID_BOARD\n\t\t\tFROM {$db_prefix}boards AS b\n\t\t\tWHERE {$user_info['query_see_board']}\n\t\t\t\tAND b.ID_BOARD IN (" . implode(', ', $_REQUEST['boards']) . ")", __FILE__, __LINE__);
        $boards = array();
        while ($row = mysql_fetch_assoc($request)) {
            $boards[] = $row['ID_BOARD'];
        }
        mysql_free_result($request);
        if (empty($boards)) {
            fatal_lang_error('error_no_boards_selected');
        }
        $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
        $context['querystring_board_limits'] = ';boards=' . implode(',', $boards) . ';start=%d';
    } elseif (!empty($_REQUEST['c'])) {
        $_REQUEST['c'] = explode(',', $_REQUEST['c']);
        foreach ($_REQUEST['c'] as $i => $c) {
            $_REQUEST['c'][$i] = (int) $c;
        }
        $request = db_query("\n\t\t\tSELECT b.ID_BOARD\n\t\t\tFROM {$db_prefix}boards AS b\n\t\t\tWHERE {$user_info['query_see_board']}\n\t\t\t\tAND b.ID_CAT IN (" . implode(', ', $_REQUEST['c']) . ")", __FILE__, __LINE__);
        $boards = array();
        while ($row = mysql_fetch_assoc($request)) {
            $boards[] = $row['ID_BOARD'];
        }
        mysql_free_result($request);
        if (empty($boards)) {
            fatal_lang_error('error_no_boards_selected');
        }
        $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
        $context['querystring_board_limits'] = ';c=' . implode(',', $_REQUEST['c']) . ';start=%d';
    } else {
        // Don't bother to show deleted posts!
        $request = db_query("\n\t\t\tSELECT b.ID_BOARD\n\t\t\tFROM {$db_prefix}boards AS b\n\t\t\tWHERE {$user_info['query_see_board']}" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "\n\t\t\t\tAND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : ''), __FILE__, __LINE__);
        $boards = array();
        while ($row = mysql_fetch_assoc($request)) {
            $boards[] = $row['ID_BOARD'];
        }
        mysql_free_result($request);
        if (empty($boards)) {
            fatal_lang_error('error_no_boards_selected');
        }
        $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
        $context['querystring_board_limits'] = ';start=%d';
        $context['no_board_limits'] = true;
    }
    $sort_methods = array('subject' => 'ms.subject', 'starter' => 'IFNULL(mems.realName, ms.posterName)', 'replies' => 't.numReplies', 'views' => 't.numViews', 'first_post' => 't.ID_TOPIC', 'last_post' => 't.ID_LAST_MSG');
    // The default is the most logical: newest first.
    if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = 'last_post';
        $_REQUEST['sort'] = 't.ID_LAST_MSG';
        $ascending = isset($_REQUEST['asc']);
        $context['querystring_sort_limits'] = $ascending ? ';asc' : '';
    } else {
        $context['sort_by'] = $_REQUEST['sort'];
        $_REQUEST['sort'] = $sort_methods[$_REQUEST['sort']];
        $ascending = !isset($_REQUEST['desc']);
        $context['querystring_sort_limits'] = ';sort=' . $context['sort_by'] . ($ascending ? '' : ';desc');
    }
    $context['sort_direction'] = $ascending ? 'up' : 'down';
    if (!empty($_REQUEST['c']) && is_array($_REQUEST['c']) && count($_REQUEST['c']) == 1) {
        $request = db_query("\n\t\t\tSELECT name\n\t\t\tFROM {$db_prefix}categories\n\t\t\tWHERE ID_CAT = " . (int) $_REQUEST['c'][0] . "\n\t\t\tLIMIT 1", __FILE__, __LINE__);
        list($name) = mysql_fetch_row($request);
        mysql_free_result($request);
        $context['linktree'][] = array('url' => $scripturl . '#' . (int) $_REQUEST['c'][0], 'name' => $name);
    }
    $context['linktree'][] = array('url' => $scripturl . '?action=' . $_REQUEST['action'] . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'], 'name' => $_REQUEST['action'] == 'unread' ? $txt['unread_topics_visit'] : $txt['unread_replies']);
    if ($context['showing_all_topics']) {
        $context['linktree'][] = array('url' => $scripturl . '?action=' . $_REQUEST['action'] . ';all' . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'], 'name' => $txt['unread_topics_all']);
    } else {
        $txt['unread_topics_visit_none'] = strtr($txt['unread_topics_visit_none'], array('?action=unread;all' => '?action=unread;all' . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits']));
    }
//.........这里部分代码省略.........
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:Recent.php

示例9: BuddyListToggle

function BuddyListToggle()
{
    global $user_info;
    checkSession('get');
    isAllowedTo('profile_identity_own');
    is_not_guest();
    if (empty($_REQUEST['u'])) {
        fatal_lang_error('no_access', false);
    }
    $_REQUEST['u'] = (int) $_REQUEST['u'];
    // Remove if it's already there...
    if (in_array($_REQUEST['u'], $user_info['buddies'])) {
        $user_info['buddies'] = array_diff($user_info['buddies'], array($_REQUEST['u']));
    } elseif ($user_info['id'] != $_REQUEST['u']) {
        $user_info['buddies'][] = (int) $_REQUEST['u'];
    }
    // Update the settings.
    updateMemberData($user_info['id'], array('buddy_list' => implode(',', $user_info['buddies'])));
    // Redirect back to the profile
    redirectexit('action=profile;u=' . $_REQUEST['u']);
}
开发者ID:norv,项目名称:EosAlpha,代码行数:21,代码来源:Subs-Members.php

示例10: Post

function Post()
{
    global $txt, $scripturl, $topic, $modSettings, $board;
    global $user_info, $sc, $board_info, $context, $settings;
    global $sourcedir, $options, $smcFunc, $language;
    loadLanguage('Post');
    // You can't reply with a poll... hacker.
    if (isset($_REQUEST['poll']) && !empty($topic) && !isset($_REQUEST['msg'])) {
        unset($_REQUEST['poll']);
    }
    // Posting an event?
    $context['make_event'] = isset($_REQUEST['calendar']);
    $context['robot_no_index'] = true;
    // You must be posting to *some* board.
    if (empty($board) && !$context['make_event']) {
        fatal_lang_error('no_board', false);
    }
    require_once $sourcedir . '/Subs-Post.php';
    if (isset($_REQUEST['xml'])) {
        $context['sub_template'] = 'post';
        // Just in case of an earlier error...
        $context['preview_message'] = '';
        $context['preview_subject'] = '';
    }
    // No message is complete without a topic.
    if (empty($topic) && !empty($_REQUEST['msg'])) {
        $request = $smcFunc['db_query']('', '
			SELECT id_topic
			FROM {db_prefix}messages
			WHERE id_msg = {int:msg}', array('msg' => (int) $_REQUEST['msg']));
        if ($smcFunc['db_num_rows']($request) != 1) {
            unset($_REQUEST['msg'], $_POST['msg'], $_GET['msg']);
        } else {
            list($topic) = $smcFunc['db_fetch_row']($request);
        }
        $smcFunc['db_free_result']($request);
    }
    // Check if it's locked.  It isn't locked if no topic is specified.
    if (!empty($topic)) {
        $request = $smcFunc['db_query']('', '
			SELECT
				t.locked, IFNULL(ln.id_topic, 0) AS notify, t.is_sticky, t.id_poll, t.id_last_msg, mf.id_member,
				t.id_first_msg, mf.subject,
				CASE WHEN ml.poster_time > ml.modified_time THEN ml.poster_time ELSE ml.modified_time END AS last_post_time
			FROM {db_prefix}topics AS t
				LEFT JOIN {db_prefix}log_notify AS ln ON (ln.id_topic = t.id_topic AND ln.id_member = {int:current_member})
				LEFT JOIN {db_prefix}messages AS mf ON (mf.id_msg = t.id_first_msg)
				LEFT JOIN {db_prefix}messages AS ml ON (ml.id_msg = t.id_last_msg)
			WHERE t.id_topic = {int:current_topic}
			LIMIT 1', array('current_member' => $user_info['id'], 'current_topic' => $topic));
        list($locked, $context['notify'], $sticky, $pollID, $context['topic_last_message'], $id_member_poster, $id_first_msg, $first_subject, $lastPostTime) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
        // If this topic already has a poll, they sure can't add another.
        if (isset($_REQUEST['poll']) && $pollID > 0) {
            unset($_REQUEST['poll']);
        }
        if (empty($_REQUEST['msg'])) {
            if ($user_info['is_guest'] && !allowedTo('post_reply_any') && (!$modSettings['postmod_active'] || !allowedTo('post_unapproved_replies_any'))) {
                is_not_guest();
            }
            // By default the reply will be approved...
            $context['becomes_approved'] = true;
            if ($id_member_poster != $user_info['id']) {
                if ($modSettings['postmod_active'] && allowedTo('post_unapproved_replies_any') && !allowedTo('post_reply_any')) {
                    $context['becomes_approved'] = false;
                } else {
                    isAllowedTo('post_reply_any');
                }
            } elseif (!allowedTo('post_reply_any')) {
                if ($modSettings['postmod_active'] && allowedTo('post_unapproved_replies_own') && !allowedTo('post_reply_own')) {
                    $context['becomes_approved'] = false;
                } else {
                    isAllowedTo('post_reply_own');
                }
            }
        } else {
            $context['becomes_approved'] = true;
        }
        $context['can_lock'] = allowedTo('lock_any') || $user_info['id'] == $id_member_poster && allowedTo('lock_own');
        $context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);
        $context['notify'] = !empty($context['notify']);
        $context['sticky'] = isset($_REQUEST['sticky']) ? !empty($_REQUEST['sticky']) : $sticky;
    } else {
        $context['becomes_approved'] = true;
        if (!$context['make_event'] || !empty($board)) {
            if ($modSettings['postmod_active'] && !allowedTo('post_new') && allowedTo('post_unapproved_topics')) {
                $context['becomes_approved'] = false;
            } else {
                isAllowedTo('post_new');
            }
        }
        $locked = 0;
        // !!! These won't work if you're making an event.
        $context['can_lock'] = allowedTo(array('lock_any', 'lock_own'));
        $context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);
        $context['notify'] = !empty($context['notify']);
        $context['sticky'] = !empty($_REQUEST['sticky']);
    }
    // !!! These won't work if you're posting an event!
    $context['can_notify'] = allowedTo('mark_any_notify');
//.........这里部分代码省略.........
开发者ID:valek0972,项目名称:hackits,代码行数:101,代码来源:Post.php

示例11: die

*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/
$smfsite = 'http://www.simplemachines.org/smf';
if (!file_exists(dirname(__FILE__) . '/SSI.php')) {
    die('Please move this file to the main SMF directory and make sure SSI.php is part of that directory.');
}
$sphinx_ver = '0.9.9';
require dirname(__FILE__) . '/SSI.php';
// Kick the guests.
is_not_guest();
// Kick the non-admin
if (!$user_info['is_admin']) {
    die('You need admin permission to use this tool.');
}
if (!isset($_REQUEST['step'])) {
    step_0();
} else {
    $cur_step = 'step_' . (int) $_REQUEST['step'];
    $cur_step();
}
function step_0()
{
    global $txt;
    template_sphinx_config_above('Introduction');
    echo '
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:31,代码来源:sphinx_config.php

示例12: loadBoard


//.........这里部分代码省略.........
            // 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));
                list($board_info['unapproved_user_topics']) = mysql_fetch_row($request);
            }
            if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] >= 3)) {
                // !!! SLOW?
                if (!empty($topic)) {
                    CacheAPI::putCache('topic_board-' . $topic, $board_info, 120);
                }
                CacheAPI::putCache('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 we are in topic view, set up the breadcrumb so that it
     * gives a link back to the last active message index page instead of
     * always pointing back to page one, but ignore the cookie when the board has changed.
     * the cookie is set in MessageIndex.php
     */
    $stored_topicstart = 0;
    if (isset($_COOKIE['smf_topicstart']) && !empty($topic)) {
        $topicstart_cookie = $_COOKIE['smf_topicstart'];
        $_t = explode('_', $topicstart_cookie);
        if (isset($_t[0]) && isset($_t[1]) && intval($_t[1]) > 0) {
            if ($_t[0] == $board) {
                $stored_topicstart = $_t[1];
            }
            $topics_per_page = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
        }
    }
    if (!empty($board)) {
        // Now check if the user is a moderator.
        $user_info['is_mod'] = isset($board_info['moderators'][$user_info['id']]);
        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'], $board_info['cat']['is_root'] ? array() : array(array('url' => $scripturl . '#c' . $board_info['cat']['id'], 'name' => $board_info['cat']['name'])), array_reverse($board_info['parent_boards']), array(array('url' => URL::board($board, $board_info['name'], $stored_topicstart > 0 ? $stored_topicstart : 0, false), 'name' => $board_info['name'] . ($stored_topicstart > 0 ? ' [' . ($stored_topicstart / $topics_per_page + 1) . ']' : ''))));
    }
    // 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();
        EoS_Smarty::init($db_show_debug);
        $_GET['board'] = '';
        $_GET['topic'] = '';
        // The linktree should not give the game away mate!
        $context['linktree'] = array(array('url' => URL::home(), 'name' => $context['forum_name_html_safe']));
        // If it's a prefetching agent or we're requesting an attachment.
        if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch' || !empty($_REQUEST['action']) && $_REQUEST['action'] === 'dlattach') {
            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:norv,项目名称:EosAlpha,代码行数:101,代码来源:Load.php

示例13: action_get_message

function action_get_message()
{
    global $context, $smcFunc, $modSettings, $scripturl, $sourcedir, $user_info, $msg_id, $box_id, $user_profile, $memberContext;
    require_once 'include/PersonalMessage.php';
    // No guests!
    is_not_guest();
    // You're not supposed to be here at all, if you can't even read PMs.
    isAllowedTo('pm_read');
    loadLanguage('PersonalMessage');
    $request = $smcFunc['db_query']('', '
        SELECT COUNT(*) AS num
        FROM {db_prefix}pm_recipients pr
            INNER JOIN {db_prefix}personal_messages AS pm ON (pr.id_pm = pm.id_pm)
        WHERE pm.id_pm = {int:id_message} and (pr.id_member = {int:id_member} or pm.id_member_from = {int:id_member})', array('id_message' => $msg_id, 'id_member' => $user_info['id']));
    $permission = $smcFunc['db_fetch_assoc']($request);
    if (empty($permission) || $permission['num'] <= 0) {
        fatal_lang_error('no_access', false);
    }
    $request = $smcFunc['db_query']('', '
        SELECT pm.id_member_from, pm.msgtime, pm.subject, pm.body, m.member_name, m.real_name
        FROM {db_prefix}personal_messages AS pm
            LEFT JOIN {db_prefix}members AS m ON (pm.id_member_from = m.id_member)
        WHERE pm.id_pm = {int:id_message} ' . ($box_id == 'sent' ? 'AND pm.id_member_from = {int:current_member} AND pm.deleted_by_sender = 0' : ''), array('id_message' => $msg_id, 'current_member' => $user_info['id']));
    $pm = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    if (empty($pm)) {
        fatal_lang_error('no_access', false);
    }
    censorText($pm['subject']);
    censorText($pm['body']);
    $context['pm'] = array('id_member' => $pm['id_member_from'], 'username' => $pm['member_name'], 'name' => $pm['real_name'], 'time' => timeformat($pm['msgtime']), 'timestamp' => $pm['msgtime'], 'subject' => $pm['subject'], 'body' => mobiquo_parse_bbc($pm['body'], false, 'pm' . $msg_id), 'recipients' => array());
    $request = $smcFunc['db_query']('', '
        SELECT pmr.id_member, m.member_name, m.real_name
        FROM {db_prefix}pm_recipients AS pmr
            LEFT JOIN {db_prefix}members AS m ON (pmr.id_member = m.id_member)
        WHERE pmr.id_pm = {int:id_message} ' . ($box_id == 'inbox' ? 'AND ((pmr.id_member = {int:current_member} AND pmr.deleted = 0) OR (pmr.id_member != {int:current_member} AND pmr.bcc = 0))' : ''), array('id_message' => $msg_id, 'current_member' => $user_info['id']));
    $no_member = true;
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $context['pm']['recipients'][] = new xmlrpcval(array('user_id' => new xmlrpcval(basic_clean($row['id_member'])), 'username' => new xmlrpcval(basic_clean($row['real_name']), 'base64')), 'struct');
        if ($no_member) {
            $display_member_id = $box_id == 'inbox' ? $pm['id_member_from'] : $row['id_member'];
            $no_member = false;
        }
    }
    $smcFunc['db_free_result']($request);
    loadMemberData($display_member_id);
    loadMemberContext($display_member_id);
    $context['pm']['member'] = $memberContext[$display_member_id];
    if ($no_avatar) {
        fatal_lang_error('no_access', false);
    }
    // Mark this as read, if it is not already
    markMessages(array($msg_id));
}
开发者ID:keweiliu6,项目名称:test-smf2,代码行数:54,代码来源:mobiquo_action.php

示例14: sp_shoutbox

function sp_shoutbox($parameters, $id, $return_parameters = false)
{
    global $smcFunc, $context, $sourcedir, $modSettings, $user_info, $settings, $txt, $scripturl;
    $block_parameters = array('shoutbox' => array());
    if ($return_parameters) {
        $shoutboxes = sportal_get_shoutbox();
        $in_use = array();
        $request = $smcFunc['db_query']('', '
			SELECT id_block, value
			FROM {db_prefix}sp_parameters
			WHERE variable = {string:name}', array('name' => 'shoutbox'));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            if (empty($_REQUEST['block_id']) || $_REQUEST['block_id'] != $row['id_block']) {
                $in_use[] = $row['value'];
            }
        }
        $smcFunc['db_free_result']($request);
        foreach ($shoutboxes as $shoutbox) {
            if (!in_array($shoutbox['id'], $in_use)) {
                $block_parameters['shoutbox'][$shoutbox['id']] = $shoutbox['name'];
            }
        }
        if (empty($block_parameters['shoutbox'])) {
            fatal_error(allowedTo(array('sp_admin', 'sp_manage_shoutbox')) ? $txt['error_sp_no_shoutbox'] . '<br />' . sprintf($txt['error_sp_no_shoutbox_sp_moderator'], $scripturl . '?action=admin;area=portalshoutbox;sa=add') : $txt['error_sp_no_shoutbox_normaluser'], false);
        }
        return $block_parameters;
    }
    loadTemplate('PortalShoutbox');
    loadLanguage('Post');
    $shoutbox = sportal_get_shoutbox($parameters['shoutbox'], true, true);
    if (empty($shoutbox)) {
        echo '
								', $txt['error_sp_shoutbox_not_exist'];
        return;
    }
    if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id']) {
        checkSession();
        is_not_guest();
        if (!($flood = sp_prevent_flood('spsbp', false))) {
            require_once $sourcedir . '/Subs-Post.php';
            $_POST['new_shout'] = $smcFunc['htmlspecialchars'](trim($_POST['new_shout']));
            preparsecode($_POST['new_shout']);
            if (!empty($_POST['new_shout'])) {
                sportal_create_shout($shoutbox, $_POST['new_shout']);
            }
        } else {
            $shoutbox['warning'] = $flood;
        }
    }
    $can_moderate = allowedTo('sp_admin') || allowedTo('sp_manage_shoutbox');
    if (!$can_moderate && !empty($shoutbox['moderator_groups'])) {
        $can_moderate = count(array_intersect($user_info['groups'], $shoutbox['moderator_groups'])) > 0;
    }
    $shout_parameters = array('limit' => $shoutbox['num_show'], 'bbc' => $shoutbox['allowed_bbc'], 'reverse' => $shoutbox['reverse'], 'cache' => $shoutbox['caching'], 'can_moderate' => $can_moderate);
    $shoutbox['shouts'] = sportal_get_shouts($shoutbox['id'], $shout_parameters);
    $shoutbox['warning'] = parse_bbc($shoutbox['warning']);
    $context['can_shout'] = $context['user']['is_logged'];
    if ($context['can_shout']) {
        $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set'];
        $shoutbox['smileys'] = array('normal' => array(), 'popup' => array());
        if (empty($modSettings['smiley_enable'])) {
            $shoutbox['smileys']['normal'] = array(array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt['icon_smiley']), array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt['icon_wink']), array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt['icon_cheesy']), array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt['icon_grin']), array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt['icon_angry']), array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt['icon_sad']), array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt['icon_shocked']), array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt['icon_cool']), array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt['icon_huh']), array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt['icon_rolleyes']), array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt['icon_tongue']), array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt['icon_embarrassed']), array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt['icon_lips']), array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt['icon_undecided']), array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt['icon_kiss']), array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt['icon_cry']));
        } else {
            if (($temp = cache_get_data('shoutbox_smileys', 3600)) == null) {
                $request = $smcFunc['db_query']('', '
					SELECT code, filename, description, smiley_row, hidden
					FROM {db_prefix}smileys
					WHERE hidden IN ({array_int:hidden})
					ORDER BY smiley_row, smiley_order', array('hidden' => array(0, 2)));
                while ($row = $smcFunc['db_fetch_assoc']($request)) {
                    $row['filename'] = htmlspecialchars($row['filename']);
                    $row['description'] = htmlspecialchars($row['description']);
                    $row['code'] = htmlspecialchars($row['code']);
                    $shoutbox['smileys'][empty($row['hidden']) ? 'normal' : 'popup'][] = $row;
                }
                $smcFunc['db_free_result']($request);
                cache_put_data('shoutbox_smileys', $shoutbox['smileys'], 3600);
            } else {
                $shoutbox['smileys'] = $temp;
            }
        }
        foreach (array_keys($shoutbox['smileys']) as $location) {
            $n = count($shoutbox['smileys'][$location]);
            for ($i = 0; $i < $n; $i++) {
                $shoutbox['smileys'][$location][$i]['code'] = addslashes($shoutbox['smileys'][$location][$i]['code']);
                $shoutbox['smileys'][$location][$i]['js_description'] = addslashes($shoutbox['smileys'][$location][$i]['description']);
            }
            if (!empty($shoutbox['smileys'][$location])) {
                $shoutbox['smileys'][$location][$n - 1]['last'] = true;
            }
        }
        $shoutbox['bbc'] = array('bold' => array('code' => 'b', 'before' => '[b]', 'after' => '[/b]', 'description' => $txt['bold']), 'italicize' => array('code' => 'i', 'before' => '[i]', 'after' => '[/i]', 'description' => $txt['italic']), 'underline' => array('code' => 'u', 'before' => '[u]', 'after' => '[/u]', 'description' => $txt['underline']), 'strike' => array('code' => 's', 'before' => '[s]', 'after' => '[/s]', 'description' => $txt['strike']), 'pre' => array('code' => 'pre', 'before' => '[pre]', 'after' => '[/pre]', 'description' => $txt['preformatted']), 'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt['flash']), 'img' => array('code' => 'img', 'before' => '[img]', 'after' => '[/img]', 'description' => $txt['image']), 'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt['hyperlink']), 'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt['insert_email']), 'ftp' => array('code' => 'ftp', 'before' => '[ftp]', 'after' => '[/ftp]', 'description' => $txt['ftp']), 'glow' => array('code' => 'glow', 'before' => '[glow=red,2,300]', 'after' => '[/glow]', 'description' => $txt['glow']), 'shadow' => array('code' => 'shadow', 'before' => '[shadow=red,left]', 'after' => '[/shadow]', 'description' => $txt['shadow']), 'sup' => array('code' => 'sup', 'before' => '[sup]', 'after' => '[/sup]', 'description' => $txt['superscript']), 'sub' => array('code' => 'sub', 'before' => '[sub]', 'after' => '[/sub]', 'description' => $txt['subscript']), 'tele' => array('code' => 'tt', 'before' => '[tt]', 'after' => '[/tt]', 'description' => $txt['teletype']), 'code' => array('code' => 'code', 'before' => '[code]', 'after' => '[/code]', 'description' => $txt['bbc_code']), 'quote' => array('code' => 'quote', 'before' => '[quote]', 'after' => '[/quote]', 'description' => $txt['bbc_quote']));
    }
    template_shoutbox_embed($shoutbox);
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:95,代码来源:PortalBlocks.php

示例15: isAllowedTo

function isAllowedTo($permission, $boards = null)
{
    global $user_info, $txt;
    static $heavy_permissions = array('admin_forum', 'manage_attachments', 'manage_smileys', 'manage_boards', 'edit_news', 'moderate_forum', 'manage_bans', 'manage_membergroups', 'manage_permissions');
    // Make it an array, even if a string was passed.
    $permission = is_array($permission) ? $permission : array($permission);
    // Check the permission and return an error...
    if (!allowedTo($permission, $boards)) {
        // Pick the last array entry as the permission shown as the error.
        $error_permission = array_shift($permission);
        // If they are a guest, show a login. (because the error might be gone if they do!)
        if ($user_info['is_guest']) {
            loadLanguage('Errors');
            is_not_guest($txt['cannot_' . $error_permission]);
        }
        // Clear the action because they aren't really doing that!
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        fatal_lang_error('cannot_' . $error_permission, false);
        // Getting this far is a really big problem, but let's try our best to prevent any cases...
        trigger_error('Hacking attempt...', E_USER_ERROR);
    }
    // If you're doing something on behalf of some "heavy" permissions, validate your session.
    // (take out the heavy permissions, and if you can't do anything but those, you need a validated session.)
    if (!allowedTo(array_diff($permission, $heavy_permissions), $boards)) {
        validateSession();
    }
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:30,代码来源:Security.php


注:本文中的is_not_guest函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。