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


PHP reapply_sid函数代码示例

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


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

示例1: main

 function main($id, $mode)
 {
     global $config, $db, $user, $table_prefix, $auth, $template, $phpbb_root_path, $phpEx;
     define('TABLE_PREFIX', $table_prefix);
     require_once 'class_ulogin.php';
     $uLogin = new uLogin($db);
     if ($config['require_activation'] == USER_ACTIVATION_DISABLE) {
         trigger_error('UCP_REGISTER_DISABLE');
     }
     if (!($user_id = $uLogin->auth())) {
         $user_id = $uLogin->register();
     }
     if ($user_id) {
         $session = $user->session_create($user_id, 0, 1);
     }
     if (!$session) {
         page_header($user->lang['LOGIN'], false);
         $template->set_filenames(array('body' => 'login_body.html'));
         make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
         page_footer();
         exit;
     }
     $redirect = request_var('redirect', "{$phpbb_root_path}index.{$phpEx}");
     $message = $user->lang['LOGIN_REDIRECT'];
     $l_redirect = $redirect === "{$phpbb_root_path}index.{$phpEx}" || $redirect === "index.{$phpEx}" ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE'];
     $redirect = reapply_sid($redirect);
     if (defined('IN_CHECK_BAN') && $session['user_row']['user_type'] != USER_FOUNDER) {
         return false;
     }
     $redirect = meta_refresh(3, $redirect);
     trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));
 }
开发者ID:mike-a-b,项目名称:crossfit,代码行数:32,代码来源:ulogin_register.php

示例2: set_javascript_data

 /**
  * Set data used in javascript
  */
 public function set_javascript_data($route, $style_id)
 {
     $board_url = generate_board_url();
     $ajax_url = $board_url . (!$this->config['enable_mod_rewrite'] ? '/app.' . $this->php_ext : '');
     $is_default_route = $u_default_route = false;
     if ($this->config['sitemaker_default_layout']) {
         $is_default_route = $this->config['sitemaker_default_layout'] === $route ? true : false;
         $u_default_route .= $board_url . '/' . $this->config['sitemaker_default_layout'];
         $u_default_route = reapply_sid($u_default_route);
     }
     $this->template->assign_vars(array('S_IS_DEFAULT' => $is_default_route, 'PAGE_URL' => build_url(array('style')), 'UA_ROUTE' => $route, 'UA_AJAX_URL' => $ajax_url, 'UA_BOARD_URL' => $board_url, 'UA_STYLE_ID' => $style_id, 'U_VIEW_DEFAULT' => $u_default_route));
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:15,代码来源:admin_bar.php

示例3: display

 /**
  * {@inheritdoc}
  */
 public function display(array $bdata, $edit_mode = false)
 {
     $settings = $bdata['settings'];
     $content = '';
     if (!$this->user->data['is_registered'] || $edit_mode === true) {
         $this->ptemplate->assign_vars(array('S_SHOW_HIDE_ME' => $settings['show_hide_me'] ? true : false, 'S_AUTOLOGIN_ENABLED' => $settings['allow_autologin'] ? true : false, 'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp" . $this->php_ext, 'mode=login'), 'U_REGISTER' => append_sid("{$this->phpbb_root_path}ucp" . $this->php_ext, 'mode=register'), 'U_SEND_PASSWORD' => append_sid("{$this->phpbb_root_path}ucp" . $this->php_ext, 'mode=sendpassword'), 'U_REDIRECT' => reapply_sid(ltrim(rtrim(build_url(array('edit_mode')), '?'), './../'))));
         $content = $this->ptemplate->render_view('blitze/sitemaker', 'blocks/login.html', 'login_block');
     } else {
         if ($settings['show_member_menu']) {
             $block = $this->phpbb_container->get('blitze.sitemaker.block.member_menu');
             $block->set_template($this->ptemplate);
             return $block->display(array(), $edit_mode);
         }
     }
     return array('title' => 'LOGIN', 'content' => $content);
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:19,代码来源:login.php

示例4: idea

 /**
  * Controller for /idea/{idea_id}
  *
  * @param $idea_id int The ID of the requested idea, maybe?
  * @throws http_exception
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function idea($idea_id)
 {
     if (!$this->is_available()) {
         throw new http_exception(404, 'IDEAS_NOT_AVAILABLE');
     }
     $this->data = $this->ideas->get_idea($idea_id);
     if (!$this->data) {
         throw new http_exception(404, 'IDEA_NOT_FOUND');
     }
     $mode = $this->request->variable('mode', '');
     if ($this->request->is_ajax() && !empty($mode)) {
         $result = call_user_func(array($this, $mode));
         return new \Symfony\Component\HttpFoundation\JsonResponse($result);
     }
     $url = reapply_sid(generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->config['ideas_forum_id']}&t={$this->data['topic_id']}");
     return new RedirectResponse($url);
 }
开发者ID:rxu,项目名称:phpbb-ideas,代码行数:24,代码来源:idea_controller.php

示例5: main

    /**
     * Main method, is called by p_master to run the module
     */
    public function main($mode, $id)
    {
        // Fetch all the data
        $fid = request_var('f', 0);
        $pid = request_var('prefixid', 0);
        $red = request_var('redirect', 'index.' . PHP_EXT);
        $tid = request_var('t', 0);
        $red = reapply_sid($red);
        // Get the prefix data
        $tree = $forums = array();
        sp_phpbb::$cache->obtain_prefix_forum_tree($tree, $forums);
        // Nothing for this forum
        if (empty($tree[$fid])) {
            return;
        }
        // Fetch the current data for this forum
        $sql = 'SELECT subject_prefix_id
			FROM ' . TOPICS_TABLE . '
			WHERE topic_id = ' . $tid;
        $result = sp_phpbb::$db->sql_query($sql);
        $_c_pid = sp_phpbb::$db->sql_fetchfield('subject_prefix_id', false, $result);
        sp_phpbb::$db->sql_freeresult($result);
        // No change
        if ($pid == $_c_pid) {
            meta_refresh(2, $red);
            trigger_error(sp_phpbb::$user->lang['PREFIX_NOT_CHANGED'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>'));
        }
        // The selected prefix can be used in this forum?
        if (!isset($tree[$fid][$pid]) && $pid > 0) {
            meta_refresh(2, $red);
            trigger_error(sp_phpbb::$user->lang['PREFIX_NOT_ALLOWED'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>'));
        }
        // Update
        $sql = 'UPDATE ' . TOPICS_TABLE . '
			SET subject_prefix_id = ' . $pid . '
			WHERE topic_id = ' . $tid;
        sp_phpbb::$db->sql_query($sql);
        if (sp_phpbb::$db->sql_affectedrows() == -1) {
            trigger_error('PREFIX_UPDATE_FAILED');
        } else {
            sp_cache::subject_prefix_quick_clear();
            meta_refresh(2, $red);
            trigger_error(sp_phpbb::$user->lang['PREFIX_UPDATED_SUCCESS'] . '<br /><br />' . sprintf(sp_phpbb::$user->lang['RETURN_PAGE'], '<a href="' . $red . '">', '</a>'));
        }
    }
开发者ID:erikfrerejean,项目名称:mods,代码行数:48,代码来源:mcp_subject_prefix.php

示例6: close_announcement

 /**
  * Board Announcements controller accessed from the URL /boardannouncements/close
  *
  * @throws \phpbb\exception\http_exception An http exception
  * @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JSON Response object
  * @access public
  */
 public function close_announcement()
 {
     // Check the link hash to protect against CSRF/XSRF attacks
     if (!check_link_hash($this->request->variable('hash', ''), 'close_boardannouncement') || !$this->config['board_announcements_dismiss']) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     // Set a cookie
     $response = $this->set_board_announcement_cookie();
     // Close the announcement for registered users
     if ($this->user->data['is_registered']) {
         $response = $this->update_board_announcement_status();
     }
     // Send a JSON response if an AJAX request was used
     if ($this->request->is_ajax()) {
         return new \Symfony\Component\HttpFoundation\JsonResponse(array('success' => $response));
     }
     // Redirect the user back to their last viewed page (non-AJAX requests)
     $redirect = $this->request->variable('redirect', $this->user->data['session_page']);
     $redirect = reapply_sid($redirect);
     redirect($redirect);
     // We shouldn't get here, but throw an http exception just in case
     throw new \phpbb\exception\http_exception(500, 'GENERAL_ERROR');
 }
开发者ID:harsha-sira,项目名称:Online-Forum,代码行数:30,代码来源:controller.php

示例7: mcp_fork_topic


//.........这里部分代码省略.........
            $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
            $new_topic_id = $db->sql_nextid();
            $new_topic_id_list[$topic_id] = $new_topic_id;
            if ($topic_row['poll_start']) {
                $poll_rows = array();
                $sql = 'SELECT *
					FROM ' . POLL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE topic_id = {$topic_id}";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $sql_ary = array('poll_option_id' => (int) $row['poll_option_id'], 'topic_id' => (int) $new_topic_id, 'poll_option_text' => (string) $row['poll_option_text'], 'poll_option_total' => 0);
                    $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                }
            }
            $sql = 'SELECT *
				FROM ' . POSTS_TABLE . "\n\t\t\t\tWHERE topic_id = {$topic_id}\n\t\t\t\tORDER BY post_time ASC";
            $result = $db->sql_query($sql);
            $post_rows = array();
            while ($row = $db->sql_fetchrow($result)) {
                $post_rows[] = $row;
            }
            $db->sql_freeresult($result);
            if (!sizeof($post_rows)) {
                continue;
            }
            $total_posts += sizeof($post_rows);
            foreach ($post_rows as $row) {
                $sql_ary = array('topic_id' => (int) $new_topic_id, 'forum_id' => (int) $to_forum_id, 'poster_id' => (int) $row['poster_id'], 'icon_id' => (int) $row['icon_id'], 'poster_ip' => (string) $row['poster_ip'], 'post_time' => (int) $row['post_time'], 'post_approved' => 1, 'post_reported' => 0, 'enable_bbcode' => (int) $row['enable_bbcode'], 'enable_smilies' => (int) $row['enable_smilies'], 'enable_magic_url' => (int) $row['enable_magic_url'], 'enable_sig' => (int) $row['enable_sig'], 'post_username' => (string) $row['post_username'], 'post_subject' => (string) $row['post_subject'], 'post_text' => (string) $row['post_text'], 'post_edit_reason' => (string) $row['post_edit_reason'], 'post_edit_user' => (int) $row['post_edit_user'], 'post_checksum' => (string) $row['post_checksum'], 'post_attachment' => (int) $row['post_attachment'], 'bbcode_bitfield' => $row['bbcode_bitfield'], 'bbcode_uid' => (string) $row['bbcode_uid'], 'post_edit_time' => (int) $row['post_edit_time'], 'post_edit_count' => (int) $row['post_edit_count'], 'post_edit_locked' => (int) $row['post_edit_locked'], 'post_postcount' => 0);
                $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
                $new_post_id = $db->sql_nextid();
                // Copy whether the topic is dotted
                markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']);
                if ($search_type) {
                    $search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], $topic_row['topic_type'] == POST_GLOBAL ? 0 : $to_forum_id);
                    $search_mode = 'reply';
                    // After one we index replies
                }
                // Copy Attachments
                if ($row['post_attachment']) {
                    $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\t\t\tWHERE post_msg_id = {$row['post_id']}\n\t\t\t\t\t\t\tAND topic_id = {$topic_id}\n\t\t\t\t\t\t\tAND in_message = 0";
                    $result = $db->sql_query($sql);
                    $sql_ary = array();
                    while ($attach_row = $db->sql_fetchrow($result)) {
                        $sql_ary[] = array('post_msg_id' => (int) $new_post_id, 'topic_id' => (int) $new_topic_id, 'in_message' => 0, 'is_orphan' => (int) $attach_row['is_orphan'], 'poster_id' => (int) $attach_row['poster_id'], 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), 'real_filename' => (string) utf8_basename($attach_row['real_filename']), 'download_count' => (int) $attach_row['download_count'], 'attach_comment' => (string) $attach_row['attach_comment'], 'extension' => (string) $attach_row['extension'], 'mimetype' => (string) $attach_row['mimetype'], 'filesize' => (int) $attach_row['filesize'], 'filetime' => (int) $attach_row['filetime'], 'thumbnail' => (int) $attach_row['thumbnail']);
                    }
                    $db->sql_freeresult($result);
                    if (sizeof($sql_ary)) {
                        $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary);
                    }
                }
            }
            $sql = 'SELECT user_id, notify_status
				FROM ' . TOPICS_WATCH_TABLE . '
				WHERE topic_id = ' . $topic_id;
            $result = $db->sql_query($sql);
            $sql_ary = array();
            while ($row = $db->sql_fetchrow($result)) {
                $sql_ary[] = array('topic_id' => (int) $new_topic_id, 'user_id' => (int) $row['user_id'], 'notify_status' => (int) $row['notify_status']);
            }
            $db->sql_freeresult($result);
            if (sizeof($sql_ary)) {
                $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary);
            }
        }
        // Sync new topics, parent forums and board stats
        sync('topic', 'topic_id', $new_topic_id_list);
        $sync_sql = array();
        $sync_sql[$to_forum_id][] = 'forum_posts = forum_posts + ' . $total_posts;
        $sync_sql[$to_forum_id][] = 'forum_topics = forum_topics + ' . sizeof($new_topic_id_list);
        $sync_sql[$to_forum_id][] = 'forum_topics_real = forum_topics_real + ' . sizeof($new_topic_id_list);
        foreach ($sync_sql as $forum_id_key => $array) {
            $sql = 'UPDATE ' . FORUMS_TABLE . '
				SET ' . implode(', ', $array) . '
				WHERE forum_id = ' . $forum_id_key;
            $db->sql_query($sql);
        }
        sync('forum', 'forum_id', $to_forum_id);
        set_config_count('num_topics', sizeof($new_topic_id_list), true);
        set_config_count('num_posts', $total_posts, true);
        foreach ($new_topic_id_list as $topic_id => $new_topic_id) {
            add_log('mod', $to_forum_id, $new_topic_id, 'LOG_FORK', $topic_row['forum_name']);
        }
        $success_msg = sizeof($topic_ids) == 1 ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS';
    } else {
        $template->assign_vars(array('S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true, true), 'S_CAN_LEAVE_SHADOW' => false, 'ADDITIONAL_MSG' => $additional_msg));
        confirm_box(false, 'FORK_TOPIC' . (sizeof($topic_ids) == 1 ? '' : 'S'), $s_hidden_fields, 'mcp_move.html');
    }
    $redirect = request_var('redirect', "index.{$phpEx}");
    $redirect = reapply_sid($redirect);
    if (!$success_msg) {
        redirect($redirect);
    } else {
        $redirect_url = append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id);
        meta_refresh(3, $redirect_url);
        $return_link = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>');
        if ($forum_id != $to_forum_id) {
            $return_link .= '<br /><br />' . sprintf($user->lang['RETURN_NEW_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $to_forum_id) . '">', '</a>');
        }
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    }
}
开发者ID:danielheyman,项目名称:EazySubs,代码行数:101,代码来源:mcp_main.php

示例8: oauth_login

function oauth_login()
{
    global $phpEx, $config, $auth, $user;
    $info = false;
    $method = trim(basename($config['auth_method']));
    include_once $phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx;
    $method = 'oauth_redirect_info_' . $method;
    if (function_exists($method)) {
        $info = $method();
    }
    if (!$info) {
        redirect('index.' . $phpEx);
    }
    // // Hack code
    // $_POST['login'] = 'Login';
    // $_REQUEST['credential'] = ($info->admin) ? md5(unique_id()) : false;
    // $_REQUEST['redirect'] = $info ->redirect;
    // login_box($info ->redirect, $info->l_explain, $info->l_success, $info->admin);
    $admin = $info->admin;
    $redirect = $info->redirect;
    if ($admin && !$auth->acl_get('a_')) {
        // Not authd
        // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
        if ($user->data['is_registered']) {
            add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
        }
        trigger_error('NO_AUTH_ADMIN');
    }
    // If authentication is successful we redirect user to previous page
    $result = $auth->login('', '', false, 0, $admin);
    // If admin authentication and login, we will log if it was a success or not...
    // We also break the operation on the first non-success login - it could be argued that the user already knows
    if ($admin) {
        if ($result['status'] == LOGIN_SUCCESS) {
            add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');
        } else {
            // Only log the failed attempt if a real user tried to.
            // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
            if ($user->data['is_registered']) {
                add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
            }
        }
    }
    // The result parameter is always an array, holding the relevant information...
    if ($result['status'] == LOGIN_SUCCESS) {
        $message = $l_success ? $l_success : $user->lang['LOGIN_REDIRECT'];
        $l_redirect = $admin ? $user->lang['PROCEED_TO_ACP'] : ($redirect === "{$phpbb_root_path}index.{$phpEx}" || $redirect === "index.{$phpEx}" ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
        // append/replace SID (may change during the session for AOL users)
        $redirect = reapply_sid($redirect);
        // Special case... the user is effectively banned, but we allow founders to login
        if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) {
            return;
        }
        $redirect = meta_refresh(3, $redirect);
        trigger_error($message . '<br /><br />' . sprintf($l_redirect, '<a href="' . $redirect . '">', '</a>'));
    }
    if ($result['status'] == LOGIN_CONTINUE) {
        oauth_show_register($result['oauth_extra']);
    }
    trigger_error("Extern auth error!");
}
开发者ID:zanpen2000,项目名称:nginx-wps-community,代码行数:61,代码来源:oauth.php

示例9: get_username_string

/**
* Get username details for placing into templates.
* This function caches all modes on first call, except for no_profile and anonymous user - determined by $user_id.
*
* @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link)
* @param int $user_id The users id
* @param string $username The users name
* @param string $username_colour The users colour
* @param string $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &amp;u={user_id}
*
* @return string A string consisting of what is wanted based on $mode.
* @author BartVB, Acyd Burn
*/
function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
{
    static $_profile_cache;
    // We cache some common variables we need within this function
    if (empty($_profile_cache)) {
        global $phpbb_root_path, $phpEx;
        $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u={USER_ID}');
        $_profile_cache['tpl_noprofile'] = '{USERNAME}';
        $_profile_cache['tpl_noprofile_colour'] = '<span style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</span>';
        $_profile_cache['tpl_profile'] = '<a href="{PROFILE_URL}">{USERNAME}</a>';
        $_profile_cache['tpl_profile_colour'] = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';
    }
    global $user, $auth;
    // This switch makes sure we only run code required for the mode
    switch ($mode) {
        case 'full':
        case 'no_profile':
        case 'colour':
            // Build correct username colour
            $username_colour = $username_colour ? '#' . $username_colour : '';
            // Return colour
            if ($mode == 'colour') {
                return $username_colour;
            }
            // no break;
        // no break;
        case 'username':
            // Build correct username
            if ($guest_username === false) {
                $username = $username ? $username : $user->lang['GUEST'];
            } else {
                $username = $user_id && $user_id != ANONYMOUS ? $username : (!empty($guest_username) ? $guest_username : $user->lang['GUEST']);
            }
            // Return username
            if ($mode == 'username') {
                return $username;
            }
            // no break;
        // no break;
        case 'profile':
            // Build correct profile url - only show if not anonymous and permission to view profile if registered user
            // For anonymous the link leads to a login page.
            if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile'))) {
                // www.phpBB-SEO.com SEO TOOLKIT BEGIN
                // $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&amp;u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']);
                global $phpbb_seo, $phpbb_root_path, $phpEx;
                $phpbb_seo->set_user_url($username, $user_id);
                if ($custom_profile_url !== false) {
                    $profile_url = reapply_sid($custom_profile_url . (strpos($custom_profile_url, '?') !== false ? '&amp;' : '?') . 'u=' . (int) $user_id);
                } else {
                    $profile_url = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&amp;u=' . (int) $user_id);
                }
                // www.phpBB-SEO.com SEO TOOLKIT END
            } else {
                $profile_url = '';
            }
            // Return profile
            if ($mode == 'profile') {
                return $profile_url;
            }
            // no break;
    }
    if ($mode == 'full' && !$profile_url || $mode == 'no_profile') {
        return str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), !$username_colour ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']);
    }
    return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), !$username_colour ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
}
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:81,代码来源:functions_content.php

示例10: merge_posts

/**
* Merge selected posts into selected topic
*/
function merge_posts($topic_id, $to_topic_id)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
    if (!$to_topic_id) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $topic_data = get_topic_data(array($to_topic_id), 'm_merge');
    if (!sizeof($topic_data)) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $topic_data = $topic_data[$to_topic_id];
    $post_id_list = request_var('post_id_list', array(0));
    $start = request_var('start', 0);
    if (!sizeof($post_id_list)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge'))) {
        return;
    }
    $redirect = request_var('redirect', $user->data['session_page']);
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'post_id_list' => $post_id_list, 'to_topic_id' => $to_topic_id, 'mode' => 'topic_view', 'action' => 'merge_posts', 'start' => $start, 'redirect' => $redirect, 'f' => $forum_id, 't' => $topic_id));
    $success_msg = $return_link = '';
    if (confirm_box(true)) {
        $to_forum_id = $topic_data['forum_id'];
        move_posts($post_id_list, $to_topic_id);
        add_log('mod', $to_forum_id, $to_topic_id, 'LOG_MERGE', $topic_data['topic_title']);
        // Message and return links
        $success_msg = 'POSTS_MERGED_SUCCESS';
        // Does the original topic still exist? If yes, link back to it
        $topic_data = get_topic_data(array($topic_id));
        if (sizeof($topic_data)) {
            $return_link .= sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $forum_id . '&amp;t=' . $topic_id) . '">', '</a>');
        }
        // Link to the new topic
        $return_link .= ($return_link ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
    } else {
        confirm_box(false, 'MERGE_POSTS', $s_hidden_fields);
    }
    $redirect = request_var('redirect', "index.{$phpEx}");
    $redirect = reapply_sid($redirect);
    if (!$success_msg) {
        return;
    } else {
        meta_refresh(3, append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$to_forum_id}&amp;t={$to_topic_id}"));
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    }
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:53,代码来源:mcp_topic.php

示例11: confirm_box

/**
* Build Confirm box
* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
* @param string $title Title/Message used for confirm box.
* message text is _CONFIRM appended to title.
* If title cannot be found in user->lang a default one is displayed
* If title_CONFIRM cannot be found in user->lang the text given is used.
* @param string $hidden Hidden variables
* @param string $html_body Template used for confirm box
* @param string $u_action Custom form action
*/
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.tpl', $u_action = '')
{
    global $db, $user, $lang, $template;
    if (isset($_POST['cancel'])) {
        return false;
    }
    $confirm = false;
    if (isset($_POST['confirm'])) {
        // language frontier
        if ($_POST['confirm'] === $lang['YES']) {
            $confirm = true;
        }
    }
    if ($check && $confirm) {
        $user_id = request_var('confirm_uid', 0);
        $session_id = request_var('sess', '');
        if ($user_id != $user->data['user_id'] || $session_id != $user->session_id) {
            return false;
        }
        return true;
    } elseif ($check) {
        return false;
    }
    $s_hidden_fields = build_hidden_fields(array('confirm_uid' => $user->data['user_id'], 'sess' => $user->session_id, 'sid' => $user->session_id));
    // re-add sid / transform & to &amp; for user->page (user->page is always using &)
    $use_page = $u_action ? IP_ROOT_PATH . $u_action : IP_ROOT_PATH . str_replace('&', '&amp;', $user->page['page']);
    $u_action = reapply_sid($use_page);
    $u_action .= strpos($u_action, '?') === false ? '?' : '&amp;';
    $confirm_title = !isset($lang[$title]) ? $lang['Confirm'] : $lang[$title];
    $template->assign_vars(array('MESSAGE_TITLE' => $confirm_title, 'MESSAGE_TEXT' => !isset($lang[$title . '_CONFIRM']) ? $title : $lang[$title . '_CONFIRM'], 'YES_VALUE' => $lang['YES'], 'S_CONFIRM_ACTION' => $u_action, 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields));
    full_page_generation($html_body, $confirm_title, '', '');
}
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:43,代码来源:functions.php

示例12: merge_topics

/**
* Merge selected topics into selected topic
*/
function merge_topics($forum_id, $topic_ids, $to_topic_id)
{
    global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request;
    if (!sizeof($topic_ids)) {
        $template->assign_var('MESSAGE', $user->lang['NO_TOPIC_SELECTED']);
        return;
    }
    if (!$to_topic_id) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_topics = array_merge($topic_ids, array($to_topic_id));
    $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge');
    if (!sizeof($topic_data) || empty($topic_data[$to_topic_id])) {
        $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']);
        return;
    }
    $sync_forums = array();
    foreach ($topic_data as $data) {
        $sync_forums[$data['forum_id']] = $data['forum_id'];
    }
    $topic_data = $topic_data[$to_topic_id];
    $post_id_list = $request->variable('post_id_list', array(0));
    $start = $request->variable('start', 0);
    if (!sizeof($post_id_list) && sizeof($topic_ids)) {
        $sql = 'SELECT post_id
			FROM ' . POSTS_TABLE . '
			WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
        $result = $db->sql_query($sql);
        $post_id_list = array();
        while ($row = $db->sql_fetchrow($result)) {
            $post_id_list[] = $row['post_id'];
        }
        $db->sql_freeresult($result);
    }
    if (!sizeof($post_id_list)) {
        $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']);
        return;
    }
    if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) {
        return;
    }
    $redirect = $request->variable('redirect', build_url(array('quickmod')));
    $s_hidden_fields = build_hidden_fields(array('i' => 'main', 'f' => $forum_id, 'post_id_list' => $post_id_list, 'to_topic_id' => $to_topic_id, 'mode' => 'forum_view', 'action' => 'merge_topics', 'start' => $start, 'redirect' => $redirect, 'topic_id_list' => $topic_ids));
    $return_link = '';
    if (confirm_box(true)) {
        $to_forum_id = $topic_data['forum_id'];
        move_posts($post_id_list, $to_topic_id, false);
        $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array('forum_id' => $to_forum_id, 'topic_id' => $to_topic_id, $topic_data['topic_title']));
        // Message and return links
        $success_msg = 'POSTS_MERGED_SUCCESS';
        if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status')) {
            include $phpbb_root_path . 'includes/functions_database_helper.' . $phpEx;
        }
        // Update the topic watch table.
        phpbb_update_rows_avoiding_duplicates_notify_status($db, TOPICS_WATCH_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Update the bookmarks table.
        phpbb_update_rows_avoiding_duplicates($db, BOOKMARKS_TABLE, 'topic_id', $topic_ids, $to_topic_id);
        // Re-sync the topics and forums because the auto-sync was deactivated in the call of  move_posts()
        sync('topic_reported', 'topic_id', $sync_topics);
        sync('topic_attachment', 'topic_id', $sync_topics);
        sync('topic', 'topic_id', $sync_topics, true);
        sync('forum', 'forum_id', $sync_forums, true, true);
        // Link to the new topic
        $return_link .= ($return_link ? '<br /><br />' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $to_forum_id . '&amp;t=' . $to_topic_id) . '">', '</a>');
        $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.{$phpEx}?f={$to_forum_id}&amp;t={$to_topic_id}");
        $redirect = reapply_sid($redirect);
        meta_refresh(3, $redirect);
        trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link);
    } else {
        confirm_box(false, 'MERGE_TOPICS', $s_hidden_fields);
    }
}
开发者ID:bruninoit,项目名称:phpbb,代码行数:76,代码来源:mcp_forum.php

示例13: login_box

/**
* Generate login box or verify password
*/
function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true)
{
    global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config;
    global $request, $phpbb_container, $phpbb_dispatcher;
    $err = '';
    // Make sure user->setup() has been called
    if (empty($user->lang)) {
        $user->setup();
    }
    /**
     * This event allows an extension to modify the login process
     *
     * @event core.login_box_before
     * @var string	redirect	Redirect string
     * @var string	l_explain	Explain language string
     * @var string	l_success	Success language string
     * @var	bool	admin		Is admin?
     * @var bool	s_display	Display full login form?
     * @var string	err			Error string
     * @since 3.1.9-RC1
     */
    $vars = array('redirect', 'l_explain', 'l_success', 'admin', 's_display', 'err');
    extract($phpbb_dispatcher->trigger_event('core.login_box_before', compact($vars)));
    // Print out error if user tries to authenticate as an administrator without having the privileges...
    if ($admin && !$auth->acl_get('a_')) {
        // Not authd
        // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
        if ($user->data['is_registered']) {
            add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
        }
        trigger_error('NO_AUTH_ADMIN');
    }
    if (empty($err) && ($request->is_set_post('login') || $request->is_set('login') && $request->variable('login', '') == 'external')) {
        // Get credential
        if ($admin) {
            $credential = request_var('credential', '');
            if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32) {
                if ($user->data['is_registered']) {
                    add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
                }
                trigger_error('NO_AUTH_ADMIN');
            }
            $password = $request->untrimmed_variable('password_' . $credential, '', true);
        } else {
            $password = $request->untrimmed_variable('password', '', true);
        }
        $username = request_var('username', '', true);
        $autologin = $request->is_set_post('autologin');
        $viewonline = (int) (!$request->is_set_post('viewonline'));
        $admin = $admin ? 1 : 0;
        $viewonline = $admin ? $user->data['session_viewonline'] : $viewonline;
        // Check if the supplied username is equal to the one stored within the database if re-authenticating
        if ($admin && utf8_clean_string($username) != utf8_clean_string($user->data['username'])) {
            // We log the attempt to use a different username...
            add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
            trigger_error('NO_AUTH_ADMIN_USER_DIFFER');
        }
        // If authentication is successful we redirect user to previous page
        $result = $auth->login($username, $password, $autologin, $viewonline, $admin);
        // If admin authentication and login, we will log if it was a success or not...
        // We also break the operation on the first non-success login - it could be argued that the user already knows
        if ($admin) {
            if ($result['status'] == LOGIN_SUCCESS) {
                add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');
            } else {
                // Only log the failed attempt if a real user tried to.
                // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
                if ($user->data['is_registered']) {
                    add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
                }
            }
        }
        // The result parameter is always an array, holding the relevant information...
        if ($result['status'] == LOGIN_SUCCESS) {
            $redirect = request_var('redirect', "{$phpbb_root_path}index.{$phpEx}");
            /**
             * This event allows an extension to modify the redirection when a user successfully logs in
             *
             * @event core.login_box_redirect
             * @var  string	redirect	Redirect string
             * @var	bool	admin		Is admin?
             * @since 3.1.0-RC5
             * @changed 3.1.9-RC1 Removed undefined return variable
             */
            $vars = array('redirect', 'admin');
            extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars)));
            // append/replace SID (may change during the session for AOL users)
            $redirect = reapply_sid($redirect);
            // Special case... the user is effectively banned, but we allow founders to login
            if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) {
                return;
            }
            redirect($redirect);
        }
        // Something failed, determine what...
        if ($result['status'] == LOGIN_BREAK) {
            trigger_error($result['error_msg']);
//.........这里部分代码省略.........
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:101,代码来源:functions.php

示例14: ajax_confirm_box

 /**
  * Build Confirm box for Ajax requests
  * @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box
  * @param string $title Title/Message used for confirm box.
  *		message text is _CONFIRM appended to title.
  *		If title cannot be found in user->lang a default one is displayed
  *		If title_CONFIRM cannot be found in user->lang the text given is used.
  * @param string $hidden Hidden variables
  * @param string $u_action Custom form action
  */
 public static function ajax_confirm_box($check, $title = '', $hidden = '', $u_action = '')
 {
     global $user, $db, $request;
     if (!$request->is_ajax()) {
         return false;
     }
     $confirm = $user->lang['YES'] === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST);
     if ($check && $confirm) {
         $user_id = $request->variable('confirm_uid', 0);
         $session_id = $request->variable('sess', '');
         $confirm_key = $request->variable('confirm_key', '');
         if ($user_id != $user->data['user_id'] || $session_id != $user->session_id || !$confirm_key || !$user->data['user_last_confirm_key'] || $confirm_key != $user->data['user_last_confirm_key']) {
             return false;
         }
         // Reset user_last_confirm_key
         $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = ''\n\t\t\t\t\tWHERE user_id = " . $user->data['user_id'];
         $db->sql_query($sql);
         return true;
     } else {
         if ($check) {
             return false;
         }
     }
     $s_hidden_fields = build_hidden_fields(array('confirm_uid' => $user->data['user_id'], 'sess' => $user->session_id, 'sid' => $user->session_id));
     // generate activation key
     $confirm_key = gen_rand_string(10);
     // If activation key already exist, we better do not re-use the key (something very strange is going on...)
     if ($request->variable('confirm_key', '')) {
         // This should not occur, therefore we cancel the operation to safe the user
         return false;
     }
     $use_page = $u_action ? $u_action : objects::$phpbb_root_path . str_replace('&', '&amp;', $user->page['page']);
     $u_action = reapply_sid($use_page);
     $u_action .= (strpos($u_action, '?') === false ? '?' : '&') . 'confirm_key=' . $confirm_key;
     $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '" . $db->sql_escape($confirm_key) . "'\n\t\t\t\tWHERE user_id = " . $user->data['user_id'];
     $db->sql_query($sql);
     $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
     $json_response = new \phpbb\json_response();
     $json_response->send(array('MESSAGE_TITLE' => !isset($user->lang[$title]) ? $user->lang['CONFIRM'] : $user->lang[$title], 'MESSAGE_TEXT' => !isset($user->lang[$title . '_CONFIRM']) ? $title : $user->lang[$title . '_CONFIRM'], 'YES_VALUE' => $user->lang['YES'], 'NO_VALUE' => $user->lang['NO'], 'S_CONFIRM_ACTION' => str_replace('&amp;', '&', $u_action), 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields));
 }
开发者ID:boardtools,项目名称:upload,代码行数:50,代码来源:load.php

示例15: close_report


//.........这里部分代码省略.........
    }
    if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false) {
        $redirect = request_var('redirect', build_url(array('mode')) . '&amp;mode=reports');
    } else {
        $redirect = request_var('redirect', $user->data['session_page']);
    }
    $success_msg = '';
    $s_hidden_fields = build_hidden_fields(array('i' => 'reports', 'mode' => $mode, 'post_id_list' => $post_id_list, 'f' => $forum_id, 'action' => $action, 'redirect' => $redirect));
    if (confirm_box(true)) {
        $post_info = get_post_data($post_id_list, 'm_report');
        $sql = 'SELECT r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type
			FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u
			WHERE r.post_id IN (' . implode(',', array_keys($post_info)) . ')
				' . ($action == 'close' ? 'AND r.report_closed = 0' : '') . '
				AND r.user_id = u.user_id';
        $result = $db->sql_query($sql);
        $reports = array();
        while ($report = $db->sql_fetchrow($result)) {
            $reports[$report['post_id']] = $report;
        }
        $db->sql_freeresult($result);
        $close_report_posts = $close_report_topics = $notify_reporters = array();
        foreach ($post_info as $post_id => $post_data) {
            if (isset($reports[$post_id])) {
                $close_report_posts[] = $post_id;
                $close_report_topics[] = $post_data['topic_id'];
                if ($reports[$post_id]['user_notify'] && !$reports[$post_id]['report_closed']) {
                    $notify_reporters[$post_id] = $reports[$post_id];
                }
            }
        }
        if (sizeof($close_report_posts)) {
            $close_report_topics = array_unique($close_report_topics);
            // Get a list of topics that still contain reported posts
            $sql = 'SELECT DISTINCT topic_id
				FROM ' . POSTS_TABLE . '
				WHERE topic_id IN (' . implode(', ', $close_report_topics) . ')
					AND post_reported = 1
					AND post_id NOT IN (' . implode(', ', $close_report_posts) . ')';
            $result = $db->sql_query($sql);
            $keep_report_topics = array();
            while ($row = $db->sql_fetchrow($result)) {
                $keep_report_topics[] = $row['topic_id'];
            }
            $db->sql_freeresult($result);
            $close_report_topics = array_diff($close_report_topics, $keep_report_topics);
            unset($keep_report_topics);
            $db->sql_transaction('begin');
            if ($action == 'close') {
                $sql = 'UPDATE ' . REPORTS_TABLE . '
					SET report_closed = 1
					WHERE post_id IN (' . implode(', ', $close_report_posts) . ')';
            } else {
                $sql = 'DELETE FROM ' . REPORTS_TABLE . '
					WHERE post_id IN (' . implode(', ', $close_report_posts) . ')';
            }
            $db->sql_query($sql);
            $sql = 'UPDATE ' . POSTS_TABLE . '
				SET post_reported = 0
				WHERE post_id IN (' . implode(', ', $close_report_posts) . ')';
            $db->sql_query($sql);
            $sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_reported = 0
				WHERE topic_id IN (' . implode(', ', $close_report_topics) . ')';
            $db->sql_query($sql);
            $db->sql_transaction('commit');
        }
        unset($close_report_posts, $close_report_topics);
        $messenger = new messenger();
        // Notify reporters
        if (sizeof($notify_reporters)) {
            $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']);
            foreach ($notify_reporters as $post_id => $reporter) {
                if ($reporter['user_id'] == ANONYMOUS) {
                    continue;
                }
                $messenger->template('report_' . $action . 'd', $reporter['user_lang']);
                $messenger->replyto($config['board_email']);
                $messenger->to($reporter['user_email'], $reporter['username']);
                $messenger->im($reporter['user_jabber'], $reporter['username']);
                $messenger->assign_vars(array('EMAIL_SIG' => $email_sig, 'SITENAME' => $config['sitename'], 'USERNAME' => html_entity_decode($reporter['username']), 'CLOSER_NAME' => html_entity_decode($user->data['username']), 'POST_SUBJECT' => html_entity_decode(censor_text($post_info[$post_id]['post_subject'])), 'TOPIC_TITLE' => html_entity_decode(censor_text($post_info[$post_id]['topic_title']))));
                $messenger->send($reporter['user_notify_type']);
                $messenger->reset();
            }
            $messenger->save_queue();
        }
        unset($notify_reporters, $post_info);
        $success_msg = sizeof($post_id_list) == 1 ? 'REPORT_' . strtoupper($action) . 'D_SUCCESS' : 'REPORTS_' . strtoupper($action) . 'D_SUCCESS';
    } else {
        confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . (sizeof($post_id_list) == 1 ? '' : 'S') . '_CONFIRM'], $s_hidden_fields);
    }
    $redirect = request_var('redirect', "index.{$phpEx}");
    $redirect = reapply_sid($redirect);
    if (!$success_msg) {
        redirect($redirect);
    } else {
        meta_refresh(3, $redirect);
        trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"{$redirect}\">", '</a>'));
    }
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:101,代码来源:mcp_reports.php


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