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


PHP send_status_line函数代码示例

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


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

示例1: phpbb_download_handle_pm_auth

/**
* Handles authentication when downloading attachments from PMs
*
* @param \phpbb\db\driver\driver_interface $db The database object
* @param \phpbb\auth\auth $auth The authentication object
* @param int $user_id The user id
* @param int $msg_id The id of the PM that we are downloading from
*
* @return null
*/
function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
{
    if (!$auth->acl_get('u_pm_download')) {
        send_status_line(403, 'Forbidden');
        trigger_error('SORRY_AUTH_VIEW_ATTACH');
    }
    $allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id);
    if (!$allowed) {
        send_status_line(403, 'Forbidden');
        trigger_error('ERROR_NO_ATTACHMENT');
    }
}
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:22,代码来源:functions_download.php

示例2: check_allow

 /**
  * {inheritDoc}
  */
 public function check_allow()
 {
     $error = parent::check_allow();
     if ($error) {
         return $error;
     }
     if (!$this->auth->acl_get('u_sendemail')) {
         return 'NO_EMAIL';
     }
     if (!$this->topic_row) {
         return 'NO_TOPIC';
     }
     if (!$this->auth->acl_get('f_read', $this->topic_row['forum_id'])) {
         if ($this->user->data['user_id'] != ANONYMOUS) {
             send_status_line(403, 'Forbidden');
         } else {
             send_status_line(401, 'Unauthorized');
         }
         return 'SORRY_AUTH_READ';
     }
     if (!$this->auth->acl_get('f_email', $this->topic_row['forum_id'])) {
         return 'NO_EMAIL';
     }
     return false;
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:28,代码来源:topic_form.php

示例3: open

    /**
     * {@inheritdoc}
     */
    public function open()
    {
        // Check if forum exists
        $sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options
			FROM ' . FORUMS_TABLE . '
			WHERE forum_id = ' . $this->forum_id;
        $result = $this->db->sql_query($sql);
        $this->forum_data = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (empty($this->forum_data)) {
            throw new no_forum_exception($this->forum_id);
        }
        // Forum needs to be postable
        if ($this->forum_data['forum_type'] != FORUM_POST) {
            throw new no_feed_exception();
        }
        // Make sure forum is not excluded from feed
        if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options'])) {
            throw new no_feed_exception();
        }
        // Make sure we can read this forum
        if (!$this->auth->acl_get('f_read', $this->forum_id)) {
            if ($this->user->data['user_id'] != ANONYMOUS) {
                send_status_line(403, 'Forbidden');
            } else {
                send_status_line(401, 'Unauthorized');
            }
            throw new unauthorized_forum_exception($this->forum_id);
        }
        // Make sure forum is not passworded or user is authed
        if ($this->forum_data['forum_password']) {
            $forum_ids_passworded = $this->get_passworded_forums();
            if (isset($forum_ids_passworded[$this->forum_id])) {
                if ($this->user->data['user_id'] != ANONYMOUS) {
                    send_status_line(403, 'Forbidden');
                } else {
                    send_status_line(401, 'Unauthorized');
                }
                throw new unauthorized_forum_exception($this->forum_id);
            }
            unset($forum_ids_passworded);
        }
        parent::open();
    }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:47,代码来源:forum.php

示例4: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
        global $db, $user, $auth, $cache, $template;
        global $request, $phpbb_container, $phpbb_log;
        $user->add_lang('groups');
        $return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
        $mark_ary = $request->variable('mark', array(0));
        $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
        /** @var \phpbb\group\helper $group_helper */
        $group_helper = $phpbb_container->get('group_helper');
        switch ($mode) {
            case 'membership':
                $this->page_title = 'UCP_USERGROUPS_MEMBER';
                if ($submit || isset($_POST['change_default'])) {
                    $action = isset($_POST['change_default']) ? 'change_default' : $request->variable('action', '');
                    $group_id = $action == 'change_default' ? $request->variable('default', 0) : $request->variable('selected', 0);
                    if (!$group_id) {
                        trigger_error('NO_GROUP_SELECTED');
                    }
                    $sql = 'SELECT group_id, group_name, group_type
						FROM ' . GROUPS_TABLE . "\n\t\t\t\t\t\tWHERE group_id IN ({$group_id}, {$user->data['group_id']})";
                    $result = $db->sql_query($sql);
                    $group_row = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $row['group_name'] = $group_helper->get_name($row['group_name']);
                        $group_row[$row['group_id']] = $row;
                    }
                    $db->sql_freeresult($result);
                    if (!sizeof($group_row)) {
                        trigger_error('GROUP_NOT_EXIST');
                    }
                    switch ($action) {
                        case 'change_default':
                            // User already having this group set as default?
                            if ($group_id == $user->data['group_id']) {
                                trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page);
                            }
                            if (!$auth->acl_get('u_chggrp')) {
                                send_status_line(403, 'Forbidden');
                                trigger_error($user->lang['NOT_AUTHORISED'] . $return_page);
                            }
                            // User needs to be member of the group in order to make it default
                            if (!group_memberships($group_id, $user->data['user_id'], true)) {
                                trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
                            }
                            if (confirm_box(true)) {
                                group_user_attributes('default', $group_id, $user->data['user_id']);
                                $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_CHANGE', false, array('reportee_id' => $user->data['user_id'], sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name'])));
                                meta_refresh(3, $this->u_action);
                                trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);
                            } else {
                                $s_hidden_fields = array('default' => $group_id, 'change_default' => true);
                                confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields));
                            }
                            break;
                        case 'resign':
                            // User tries to resign from default group but is not allowed to change it?
                            if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp')) {
                                trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page);
                            }
                            if (!($row = group_memberships($group_id, $user->data['user_id']))) {
                                trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
                            }
                            list(, $row) = each($row);
                            $sql = 'SELECT group_type
								FROM ' . GROUPS_TABLE . '
								WHERE group_id = ' . $group_id;
                            $result = $db->sql_query($sql);
                            $group_type = (int) $db->sql_fetchfield('group_type');
                            $db->sql_freeresult($result);
                            if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE) {
                                trigger_error($user->lang['CANNOT_RESIGN_GROUP'] . $return_page);
                            }
                            if (confirm_box(true)) {
                                group_user_del($group_id, $user->data['user_id']);
                                $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_RESIGN', false, array('reportee_id' => $user->data['user_id'], $group_row[$group_id]['group_name']));
                                meta_refresh(3, $this->u_action);
                                trigger_error($user->lang[$row['user_pending'] ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page);
                            } else {
                                $s_hidden_fields = array('selected' => $group_id, 'action' => 'resign', 'submit' => true);
                                confirm_box(false, $row['user_pending'] ? 'GROUP_RESIGN_PENDING' : 'GROUP_RESIGN_MEMBERSHIP', build_hidden_fields($s_hidden_fields));
                            }
                            break;
                        case 'join':
                            $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email
								FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
								WHERE ug.user_id = u.user_id
									AND ug.group_id = ' . $group_id . '
									AND ug.user_id = ' . $user->data['user_id'];
                            $result = $db->sql_query($sql);
                            $row = $db->sql_fetchrow($result);
                            $db->sql_freeresult($result);
                            if ($row) {
                                if ($row['user_pending']) {
                                    trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page);
                                }
                                trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page);
                            }
                            // Check permission to join (open group or request)
//.........这里部分代码省略.........
开发者ID:phpbb,项目名称:phpbb,代码行数:101,代码来源:ucp_groups.php

示例5: open

    /**
     * {@inheritdoc}
     */
    public function open()
    {
        $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type
			FROM ' . TOPICS_TABLE . ' t
			LEFT JOIN ' . FORUMS_TABLE . ' f
				ON (f.forum_id = t.forum_id)
			WHERE t.topic_id = ' . $this->topic_id;
        $result = $this->db->sql_query($sql);
        $this->topic_data = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        if (empty($this->topic_data)) {
            throw new no_topic_exception($this->topic_id);
        }
        $this->forum_id = (int) $this->topic_data['forum_id'];
        // Make sure topic is either approved or user authed
        if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id)) {
            if ($this->user->data['user_id'] != ANONYMOUS) {
                send_status_line(403, 'Forbidden');
            } else {
                send_status_line(401, 'Unauthorized');
            }
            throw new unauthorized_topic_exception($this->topic_id);
        }
        // Make sure forum is not excluded from feed
        if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options'])) {
            throw new no_feed_exception();
        }
        // Make sure we can read this forum
        if (!$this->auth->acl_get('f_read', $this->forum_id)) {
            if ($this->user->data['user_id'] != ANONYMOUS) {
                send_status_line(403, 'Forbidden');
            } else {
                send_status_line(401, 'Unauthorized');
            }
            throw new unauthorized_forum_exception($this->forum_id);
        }
        // Make sure forum is not passworded or user is authed
        if ($this->topic_data['forum_password']) {
            $forum_ids_passworded = $this->get_passworded_forums();
            if (isset($forum_ids_passworded[$this->forum_id])) {
                if ($this->user->data['user_id'] != ANONYMOUS) {
                    send_status_line(403, 'Forbidden');
                } else {
                    send_status_line(401, 'Unauthorized');
                }
                throw new unauthorized_forum_exception($this->forum_id);
            }
            unset($forum_ids_passworded);
        }
        parent::open();
    }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:54,代码来源:topic.php

示例6: create_server_url

$server_url = create_server_url();
$notification_email = $config['board_email'];
$sitename = $config['sitename'];
$datecode = gmdate('Ymd');
$logs_path = !empty($config['logs_path']) ? $config['logs_path'] : 'logs';
$errors_log = $logs_path . '/errors_' . $datecode . '.txt';
//$errors_log = 'logs/errors.txt';
if ($config['write_errors_log'] == true && $log[$result] == 'Y') {
    errors_notification('L', $result, $sitename, $subject, $errors_log, $notification_email);
}
if ($email[$result] == 'Y') {
    errors_notification('M', $result, $sitename, $subject, $errors_log, $notification_email);
}
// Start output of page
$template->assign_vars(array('ERROR_MESSAGE' => $error_msg));
send_status_line($result, $error_msg);
full_page_generation('errors_body.tpl', $lang['Error'], '', '');
function errors_notification($action, $result, $sitename, $subject, $errors_log, $notification_email)
{
    global $REQUEST_URI, $REMOTE_ADDR, $HTTP_USER_AGENT, $REDIRECT_ERROR_NOTES, $SERVER_NAME, $HTTP_REFERER;
    global $lang;
    $remote_address = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : (!empty($_ENV['REMOTE_ADDR']) ? $_ENV['REMOTE_ADDR'] : getenv('REMOTE_ADDR'));
    $remote_address = !empty($remote_address) && $remote_address != '::1' ? $remote_address : '127.0.0.1';
    $user_agent_errors = !empty($_SERVER['HTTP_USER_AGENT']) ? trim($_SERVER['HTTP_USER_AGENT']) : (!empty($_ENV['HTTP_USER_AGENT']) ? trim($_ENV['HTTP_USER_AGENT']) : trim(getenv('HTTP_USER_AGENT')));
    $referer = !empty($_SERVER['HTTP_REFERER']) ? (string) $_SERVER['HTTP_REFERER'] : '';
    $referer = preg_replace('/sid=[A-Za-z0-9]{32}/', '', $referer);
    $script_name = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
    $server_name = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME');
    $date = gmdate('Y/m/d - H:i:s');
    if ($action == 'L' || $action == 'LM') {
        $message = '[' . $date . ']';
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:31,代码来源:errors.php

示例7: view_message

/**
* View private message
*/
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
{
    global $user, $template, $auth, $db, $phpbb_container;
    global $phpbb_root_path, $request, $phpEx, $config, $phpbb_dispatcher;
    $user->add_lang(array('viewtopic', 'memberlist'));
    $msg_id = (int) $msg_id;
    $folder_id = (int) $folder_id;
    $author_id = (int) $message_row['author_id'];
    $view = $request->variable('view', '');
    // Not able to view message, it was deleted by the sender
    if ($message_row['pm_deleted']) {
        $meta_info = append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&amp;folder={$folder_id}");
        $message = $user->lang['NO_AUTH_READ_REMOVED_MESSAGE'];
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_FOLDER'], '<a href="' . $meta_info . '">', '</a>');
        send_status_line(403, 'Forbidden');
        trigger_error($message);
    }
    // Do not allow hold messages to be seen
    if ($folder_id == PRIVMSGS_HOLD_BOX) {
        trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
    }
    // Load the custom profile fields
    if ($config['load_cpf_pm']) {
        /* @var $cp \phpbb\profilefields\manager */
        $cp = $phpbb_container->get('profilefields.manager');
        $profile_fields = $cp->grab_profile_fields_data($author_id);
    }
    // Assign TO/BCC Addresses to template
    write_pm_addresses(array('to' => $message_row['to_address'], 'bcc' => $message_row['bcc_address']), $author_id);
    $user_info = get_user_information($author_id, $message_row);
    // Parse the message and subject
    $parse_flags = ($message_row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
    $message = generate_text_for_display($message_row['message_text'], $message_row['bbcode_uid'], $message_row['bbcode_bitfield'], $parse_flags, true);
    // Replace naughty words such as farty pants
    $message_row['message_subject'] = censor_text($message_row['message_subject']);
    // Editing information
    if ($message_row['message_edit_count'] && $config['display_last_edited']) {
        if (!$message_row['message_edit_user']) {
            $display_username = get_username_string('full', $author_id, $user_info['username'], $user_info['user_colour']);
        } else {
            $edit_user_info = get_user_information($message_row['message_edit_user'], false);
            $display_username = get_username_string('full', $message_row['message_edit_user'], $edit_user_info['username'], $edit_user_info['user_colour']);
        }
        $l_edited_by = '<br /><br />' . $user->lang('EDITED_TIMES_TOTAL', (int) $message_row['message_edit_count'], $display_username, $user->format_date($message_row['message_edit_time'], false, true));
    } else {
        $l_edited_by = '';
    }
    // Pull attachment data
    $display_notice = false;
    $attachments = array();
    if ($message_row['message_attachment'] && $config['allow_pm_attach']) {
        if ($auth->acl_get('u_pm_download')) {
            $sql = 'SELECT *
				FROM ' . ATTACHMENTS_TABLE . "\n\t\t\t\tWHERE post_msg_id = {$msg_id}\n\t\t\t\t\tAND in_message = 1\n\t\t\t\tORDER BY filetime DESC, post_msg_id ASC";
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $attachments[] = $row;
            }
            $db->sql_freeresult($result);
            // No attachments exist, but message table thinks they do so go ahead and reset attach flags
            if (!sizeof($attachments)) {
                $sql = 'UPDATE ' . PRIVMSGS_TABLE . "\n\t\t\t\t\tSET message_attachment = 0\n\t\t\t\t\tWHERE msg_id = {$msg_id}";
                $db->sql_query($sql);
            }
        } else {
            $display_notice = true;
        }
    }
    // Assign inline attachments
    if (!empty($attachments)) {
        $update_count = array();
        parse_attachments(false, $message, $attachments, $update_count);
        // Update the attachment download counts
        if (sizeof($update_count)) {
            $sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
				SET download_count = download_count + 1
				WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count));
            $db->sql_query($sql);
        }
    }
    $user_info['sig'] = '';
    $signature = $message_row['enable_sig'] && $config['allow_sig'] && $auth->acl_get('u_sig') && $user->optionget('viewsigs') ? $user_info['user_sig'] : '';
    // End signature parsing, only if needed
    if ($signature) {
        $parse_flags = ($user_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
        $signature = generate_text_for_display($signature, $user_info['user_sig_bbcode_uid'], $user_info['user_sig_bbcode_bitfield'], $parse_flags, true);
    }
    $url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm');
    // Number of "to" recipients
    $num_recipients = (int) preg_match_all('/:?(u|g)_([0-9]+):?/', $message_row['to_address'], $match);
    $bbcode_status = $config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode') ? true : false;
    // Get the profile fields template data
    $cp_row = array();
    if ($config['load_cpf_pm'] && isset($profile_fields[$author_id])) {
        // Filter the fields we don't want to show
        foreach ($profile_fields[$author_id] as $used_ident => $profile_field) {
            if (!$profile_field['data']['field_show_on_pm']) {
//.........这里部分代码省略.........
开发者ID:phpbb,项目名称:phpbb,代码行数:101,代码来源:ucp_pm_viewmessage.php

示例8: message_die


//.........这里部分代码省略.........
        }
        $header_tpl = empty($gen_simple_header) ? 'overall_header.tpl' : 'simple_header.tpl';
        $template->set_filenames(array('overall_header' => $header_tpl));
        $template->pparse('overall_header');
    }
    switch ($msg_code) {
        case GENERAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Information'];
            }
            break;
        case CRITICAL_MESSAGE:
            if ($msg_title == '') {
                $msg_title = $lang['Critical_Information'];
            }
            break;
        case GENERAL_ERROR:
            if ($msg_text == '') {
                $msg_text = $lang['An_error_occured'];
            }
            if ($msg_title == '') {
                $msg_title = $lang['General_Error'];
            }
            break;
        case CRITICAL_ERROR:
            // Critical errors mean we cannot rely on _ANY_ DB information being available so we're going to dump out a simple echo'd statement
            // We force english to make sure we have at least the default language
            $config['default_lang'] = 'english';
            setup_basic_lang();
            if ($msg_text == '') {
                $msg_text = $lang['A_critical_error'];
            }
            if ($msg_title == '') {
                $msg_title = '<b>' . $lang['Critical_Error'] . '</b>';
            }
            break;
    }
    //
    // Add on DEBUG info if we've enabled debug mode and this is an error. This
    // prevents debug info being output for general messages should DEBUG be
    // set TRUE by accident (preventing confusion for the end user!)
    //
    if (DEBUG && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR)) {
        if ($debug_text != '') {
            $msg_text = $msg_text . '<br /><br /><b><u>DEBUG MODE</u></b>' . $debug_text;
        }
    }
    // MG Logs - BEGIN
    //if (($config['mg_log_actions'] == true) && ($msg_code == GENERAL_ERROR || $msg_code == CRITICAL_ERROR))
    if ($msg_code != GENERAL_MESSAGE) {
        if ($config['mg_log_actions'] || !empty($config['db_log_actions'])) {
            $db_log = array('action' => 'MESSAGE', 'desc' => $msg_code, 'target' => '');
            $error_log = array('code' => $msg_code, 'title' => $msg_title, 'text' => $msg_text);
            if (!function_exists('ip_log')) {
                @(include IP_ROOT_PATH . 'includes/functions_mg_log.' . PHP_EXT);
            }
            ip_log('[MSG_CODE: ' . $msg_code . '] - [MSG_TITLE: ' . $msg_title . '] - [MSG_TEXT: ' . $msg_text . ']', $db_log, $error_log);
        }
    }
    // MG Logs - END
    if ($msg_code != CRITICAL_ERROR) {
        if (defined('STATUS_404')) {
            send_status_line(404, 'Not Found');
        }
        if (defined('STATUS_503')) {
            send_status_line(503, 'Service Unavailable');
        }
        if (!empty($lang[$msg_text])) {
            $msg_text = $lang[$msg_text];
        }
        if (defined('IN_ADMIN')) {
            $template->set_filenames(array('message_body' => ADM_TPL . 'admin_message_body.tpl'));
        } elseif (defined('IN_CMS')) {
            $template->set_filenames(array('message_body' => COMMON_TPL . 'cms/message_body.tpl'));
        } else {
            $template->set_filenames(array('message_body' => 'message_body.tpl'));
        }
        //echo('<br />' . htmlspecialchars($template->vars['META']));
        $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text));
        if (!defined('IN_CMS')) {
            $template->pparse('message_body');
        }
        // If we have already defined the var in header, let's output it in footer as well
        if (defined('TPL_HAS_DIED')) {
            $template->assign_var('HAS_DIED', true);
        }
        if (!defined('IN_ADMIN')) {
            $template_to_parse = defined('IN_CMS') ? 'message_body' : '';
            $parse_template = defined('IN_CMS') ? false : true;
            page_footer(true, $template_to_parse, $parse_template);
        } else {
            include IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT;
        }
    } else {
        echo "<html>\n<body>\n" . $msg_title . "\n<br /><br />\n" . $msg_text . "</body>\n</html>";
    }
    garbage_collection();
    exit_handler();
    exit;
}
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:101,代码来源:functions.php

示例9: main


//.........这里部分代码省略.........
                if (confirm_box(true)) {
                    $group_name = $group_helper->get_name($group_row['group_name']);
                    $start = 0;
                    do {
                        $sql = 'SELECT user_id
							FROM ' . USER_GROUP_TABLE . "\n\t\t\t\t\t\t\tWHERE group_id = {$group_id}\n\t\t\t\t\t\t\tORDER BY user_id";
                        $result = $db->sql_query_limit($sql, 200, $start);
                        $mark_ary = array();
                        if ($row = $db->sql_fetchrow($result)) {
                            do {
                                $mark_ary[] = $row['user_id'];
                            } while ($row = $db->sql_fetchrow($result));
                            group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
                            $start = sizeof($mark_ary) < 200 ? 0 : $start + 200;
                        } else {
                            $start = 0;
                        }
                        $db->sql_freeresult($result);
                    } while ($start);
                    trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&amp;action=list&amp;g=' . $group_id));
                } else {
                    confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mark' => $mark_ary, 'g' => $group_id, 'i' => $id, 'mode' => $mode, 'action' => $action)));
                }
                break;
            case 'deleteusers':
                if (empty($mark_ary)) {
                    trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&amp;action=list&amp;g=' . $group_id), E_USER_WARNING);
                }
            case 'delete':
                if (!$group_id) {
                    trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
                } else {
                    if ($action === 'delete' && $group_row['group_type'] == GROUP_SPECIAL) {
                        send_status_line(403, 'Forbidden');
                        trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
                    }
                }
                if (confirm_box(true)) {
                    $error = '';
                    switch ($action) {
                        case 'delete':
                            if (!$auth->acl_get('a_groupdel')) {
                                send_status_line(403, 'Forbidden');
                                trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
                            }
                            $error = group_delete($group_id, $group_row['group_name']);
                            break;
                        case 'deleteusers':
                            $group_name = $group_helper->get_name($group_row['group_name']);
                            $error = group_user_del($group_id, $mark_ary, false, $group_name);
                            break;
                    }
                    $back_link = $action == 'delete' ? $this->u_action : $this->u_action . '&amp;action=list&amp;g=' . $group_id;
                    if ($error) {
                        trigger_error($user->lang[$error] . adm_back_link($back_link), E_USER_WARNING);
                    }
                    $message = $action == 'delete' ? 'GROUP_DELETED' : 'GROUP_USERS_REMOVE';
                    trigger_error($user->lang[$message] . adm_back_link($back_link));
                } else {
                    confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('mark' => $mark_ary, 'g' => $group_id, 'i' => $id, 'mode' => $mode, 'action' => $action)));
                }
                break;
            case 'addusers':
                if (!check_form_key($form_key)) {
                    trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
                }
开发者ID:phpbb,项目名称:phpbb,代码行数:67,代码来源:acp_groups.php

示例10: session_create

    /**
     * Create a new session
     *
     * If upon trying to start a session we discover there is nothing existing we
     * jump here. Additionally this method is called directly during login to regenerate
     * the session for the specific user. In this method we carry out a number of tasks;
     * garbage collection, (search)bot checking, banned user comparison. Basically
     * though this method will result in a new session for a specific user.
     */
    function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)
    {
        global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container;
        $this->data = array();
        /* Garbage collection ... remove old sessions updating user information
        		// if necessary. It means (potentially) 11 queries but only infrequently
        		if ($this->time_now > $config['session_last_gc'] + $config['session_gc'])
        		{
        			$this->session_gc();
        		}*/
        // Do we allow autologin on this board? No? Then override anything
        // that may be requested here
        if (!$config['allow_autologin']) {
            $this->cookie_data['k'] = $persist_login = false;
        }
        /**
         * Here we do a bot check, oh er saucy! No, not that kind of bot
         * check. We loop through the list of bots defined by the admin and
         * see if we have any useragent and/or IP matches. If we do, this is a
         * bot, act accordingly
         */
        $bot = false;
        $active_bots = $cache->obtain_bots();
        foreach ($active_bots as $row) {
            if ($row['bot_agent'] && preg_match('#' . str_replace('\\*', '.*?', preg_quote($row['bot_agent'], '#')) . '#i', $this->browser)) {
                $bot = $row['user_id'];
            }
            // If ip is supplied, we will make sure the ip is matching too...
            if ($row['bot_ip'] && ($bot || !$row['bot_agent'])) {
                // Set bot to false, then we only have to set it to true if it is matching
                $bot = false;
                foreach (explode(',', $row['bot_ip']) as $bot_ip) {
                    $bot_ip = trim($bot_ip);
                    if (!$bot_ip) {
                        continue;
                    }
                    if (strpos($this->ip, $bot_ip) === 0) {
                        $bot = (int) $row['user_id'];
                        break;
                    }
                }
            }
            if ($bot) {
                break;
            }
        }
        /* @var $provider_collection \phpbb\auth\provider_collection */
        $provider_collection = $phpbb_container->get('auth.provider_collection');
        $provider = $provider_collection->get_provider();
        $this->data = $provider->autologin();
        if ($user_id !== false && sizeof($this->data) && $this->data['user_id'] != $user_id) {
            $this->data = array();
        }
        if (sizeof($this->data)) {
            $this->cookie_data['k'] = '';
            $this->cookie_data['u'] = $this->data['user_id'];
        }
        // If we're presented with an autologin key we'll join against it.
        // Else if we've been passed a user_id we'll grab data based on that
        if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && !sizeof($this->data)) {
            $sql = 'SELECT u.*
				FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k
				WHERE u.user_id = ' . (int) $this->cookie_data['u'] . '
					AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ")\n\t\t\t\t\tAND k.user_id = u.user_id\n\t\t\t\t\tAND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'";
            $result = $db->sql_query($sql);
            $user_data = $db->sql_fetchrow($result);
            if ($user_id === false || isset($user_data['user_id']) && $user_id == $user_data['user_id']) {
                $this->data = $user_data;
                $bot = false;
            }
            $db->sql_freeresult($result);
        }
        if ($user_id !== false && !sizeof($this->data)) {
            $this->cookie_data['k'] = '';
            $this->cookie_data['u'] = $user_id;
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . '
				WHERE user_id = ' . (int) $this->cookie_data['u'] . '
					AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')';
            $result = $db->sql_query($sql);
            $this->data = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            $bot = false;
        }
        // Bot user, if they have a SID in the Request URI we need to get rid of it
        // otherwise they'll index this page with the SID, duplicate content oh my!
        if ($bot && isset($_GET['sid'])) {
            send_status_line(301, 'Moved Permanently');
            redirect(build_url(array('sid')));
        }
        // If no data was returned one or more of the following occurred:
//.........这里部分代码省略.........
开发者ID:Alexey3112,项目名称:phpbb,代码行数:101,代码来源:session.php

示例11: setup


//.........这里部分代码省略.........
            $sql = 'SELECT *
				FROM ' . STYLES_TABLE . " s\n\t\t\t\tWHERE s.style_id = {$style_id}";
            $result = $db->sql_query($sql, 3600);
            $this->style = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
        }
        if (!$this->style) {
            trigger_error('NO_STYLE_DATA', E_USER_ERROR);
        }
        // Now parse the cfg file and cache it
        $parsed_items = $cache->obtain_cfg_items($this->style);
        $check_for = array('pagination_sep' => (string) ', ');
        foreach ($check_for as $key => $default_value) {
            $this->style[$key] = isset($parsed_items[$key]) ? $parsed_items[$key] : $default_value;
            settype($this->style[$key], gettype($default_value));
            if (is_string($default_value)) {
                $this->style[$key] = htmlspecialchars($this->style[$key]);
            }
        }
        $template->set_style();
        $this->img_lang = $this->lang_name;
        // Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes...
        // After calling it we continue script execution...
        phpbb_user_session_handler();
        /**
         * Execute code at the end of user setup
         *
         * @event core.user_setup_after
         * @since 3.1.6-RC1
         */
        $phpbb_dispatcher->dispatch('core.user_setup_after');
        // If this function got called from the error handler we are finished here.
        if (defined('IN_ERROR_HANDLER')) {
            return;
        }
        // Disable board if the install/ directory is still present
        // For the brave development army we do not care about this, else we need to comment out this everytime we develop locally
        if (!defined('DEBUG') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) {
            // Adjust the message slightly according to the permissions
            if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) {
                $message = 'REMOVE_INSTALL';
            } else {
                $message = !empty($config['board_disable_msg']) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
            }
            trigger_error($message);
        }
        // Is board disabled and user not an admin or moderator?
        if ($config['board_disable'] && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) {
            if ($this->data['is_bot']) {
                send_status_line(503, 'Service Unavailable');
            }
            $message = !empty($config['board_disable_msg']) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
            trigger_error($message);
        }
        // Is load exceeded?
        if ($config['limit_load'] && $this->load !== false) {
            if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN')) {
                // Set board disabled to true to let the admins/mods get the proper notification
                $config['board_disable'] = '1';
                if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) {
                    if ($this->data['is_bot']) {
                        send_status_line(503, 'Service Unavailable');
                    }
                    trigger_error('BOARD_UNAVAILABLE');
                }
            }
        }
        if (isset($this->data['session_viewonline'])) {
            // Make sure the user is able to hide his session
            if (!$this->data['session_viewonline']) {
                // Reset online status if not allowed to hide the session...
                if (!$auth->acl_get('u_hideonline')) {
                    $sql = 'UPDATE ' . SESSIONS_TABLE . '
						SET session_viewonline = 1
						WHERE session_user_id = ' . $this->data['user_id'];
                    $db->sql_query($sql);
                    $this->data['session_viewonline'] = 1;
                }
            } else {
                if (!$this->data['user_allow_viewonline']) {
                    // the user wants to hide and is allowed to  -> cloaking device on.
                    if ($auth->acl_get('u_hideonline')) {
                        $sql = 'UPDATE ' . SESSIONS_TABLE . '
						SET session_viewonline = 0
						WHERE session_user_id = ' . $this->data['user_id'];
                        $db->sql_query($sql);
                        $this->data['session_viewonline'] = 0;
                    }
                }
            }
        }
        // Does the user need to change their password? If so, redirect to the
        // ucp profile reg_details page ... of course do not redirect if we're already in the ucp
        if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - $config['chg_passforce'] * 86400) {
            if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.{$phpEx}") {
                redirect(append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=profile&amp;mode=reg_details'));
            }
        }
        return;
    }
开发者ID:corycubbage,项目名称:ShadoWorld,代码行数:101,代码来源:user.php

示例12: main

    function main($id, $mode)
    {
        global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request;
        if (!$user->data['is_registered']) {
            trigger_error('NO_MESSAGE');
        }
        // Is PM disabled?
        if (!$config['allow_privmsg']) {
            trigger_error('PM_DISABLED');
        }
        $user->add_lang('posting');
        $template->assign_var('S_PRIVMSGS', true);
        // Folder directly specified?
        $folder_specified = $request->variable('folder', '');
        if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) {
            $folder_specified = (int) $folder_specified;
        } else {
            $folder_specified = $folder_specified == 'inbox' ? PRIVMSGS_INBOX : ($folder_specified == 'outbox' ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX);
        }
        if (!$folder_specified) {
            $mode = !$mode ? $request->variable('mode', 'view') : $mode;
        } else {
            $mode = 'view';
        }
        include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
        switch ($mode) {
            // Compose message
            case 'compose':
                $action = $request->variable('action', 'post');
                $user_folders = get_folder($user->data['user_id']);
                if ($action != 'delete' && !$auth->acl_get('u_sendpm')) {
                    // trigger_error('NO_AUTH_SEND_MESSAGE');
                    $template->assign_vars(array('S_NO_AUTH_SEND_MESSAGE' => true, 'S_COMPOSE_PM_VIEW' => true));
                    $tpl_file = 'ucp_pm_viewfolder';
                    break;
                }
                include $phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx;
                compose_pm($id, $mode, $action, $user_folders);
                $tpl_file = 'posting_body';
                break;
            case 'options':
                set_user_message_limit();
                get_folder($user->data['user_id']);
                include $phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx;
                message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions);
                $tpl_file = 'ucp_pm_options';
                break;
            case 'drafts':
                get_folder($user->data['user_id']);
                $this->p_name = 'pm';
                // Call another module... please do not try this at home... Hoochie Coochie Man
                include $phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx;
                $module = new ucp_main($this);
                $module->u_action = $this->u_action;
                $module->main($id, $mode);
                $this->tpl_name = $module->tpl_name;
                $this->page_title = 'UCP_PM_DRAFTS';
                unset($module);
                return;
                break;
            case 'view':
                set_user_message_limit();
                if ($folder_specified) {
                    $folder_id = $folder_specified;
                    $action = 'view_folder';
                } else {
                    $folder_id = $request->variable('f', PRIVMSGS_NO_BOX);
                    $action = $request->variable('action', 'view_folder');
                }
                $msg_id = $request->variable('p', 0);
                $view = $request->variable('view', '');
                // View message if specified
                if ($msg_id) {
                    $action = 'view_message';
                }
                if (!$auth->acl_get('u_readpm')) {
                    send_status_line(403, 'Forbidden');
                    trigger_error('NO_AUTH_READ_MESSAGE');
                }
                // Do not allow hold messages to be seen
                if ($folder_id == PRIVMSGS_HOLD_BOX) {
                    trigger_error('NO_AUTH_READ_HOLD_MESSAGE');
                }
                // First Handle Mark actions and moving messages
                $submit_mark = isset($_POST['submit_mark']) ? true : false;
                $move_pm = isset($_POST['move_pm']) ? true : false;
                $mark_option = $request->variable('mark_option', '');
                $dest_folder = $request->variable('dest_folder', PRIVMSGS_NO_BOX);
                // Is moving PM triggered through mark options?
                if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) {
                    $move_pm = true;
                    $dest_folder = (int) $mark_option;
                    $submit_mark = false;
                }
                // Move PM
                if ($move_pm) {
                    $move_msg_ids = isset($_POST['marked_msg_id']) ? $request->variable('marked_msg_id', array(0)) : array();
                    $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX);
                    if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) {
                        // Return to folder view if single message moved
//.........这里部分代码省略.........
开发者ID:phpbb,项目名称:phpbb,代码行数:101,代码来源:ucp_pm.php

示例13: request_var

}
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup(array('memberlist', 'groups'));
// Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_MEMBERLIST', true);
// Grab data
$action = request_var('action', '');
$user_id = request_var('u', ANONYMOUS);
$username = request_var('un', '', true);
$group_id = request_var('g', 0);
$topic_id = request_var('t', 0);
// Redirect when old mode is used
if ($mode == 'leaders') {
    send_status_line(301, 'Moved Permanently');
    redirect(append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=team'));
}
// Check our mode...
if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'contactadmin', 'searchuser', 'team', 'livesearch'))) {
    trigger_error('NO_MODE');
}
switch ($mode) {
    case 'email':
    case 'contactadmin':
        break;
    case 'livesearch':
        if (!$config['allow_live_searches']) {
            trigger_error('LIVE_SEARCHES_NOT_ALLOWED');
        }
        // No break
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:31,代码来源:memberlist.php

示例14: main


//.........这里部分代码省略.........
                         */
                        $vars = array('data', 'sql_ary');
                        extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars)));
                        if (sizeof($sql_ary)) {
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
								WHERE user_id = ' . $user->data['user_id'];
                            $db->sql_query($sql);
                        }
                        // Need to update config, forum, topic, posting, messages, etc.
                        if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) {
                            user_update_name($user->data['username'], $data['username']);
                        }
                        // Now, we can remove the user completely (kill the session) - NOT BEFORE!!!
                        if (!empty($sql_ary['user_actkey'])) {
                            meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx));
                            $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid($phpbb_root_path . 'index.' . $phpEx) . '">', '</a>');
                            // Because the user gets deactivated we log him out too, killing his session
                            $user->session_kill();
                        } else {
                            meta_refresh(3, $this->u_action);
                            $message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                        }
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = array_map(array($user, 'lang'), $error);
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], 'EMAIL' => $data['email'], 'PASSWORD_CONFIRM' => $data['password_confirm'], 'NEW_PASSWORD' => $data['new_password'], 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'S_FORCE_PASSWORD' => $auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce'] * 86400 ? true : false, 'S_CHANGE_USERNAME' => $config['allow_namechange'] && $auth->acl_get('u_chgname') ? true : false, 'S_CHANGE_EMAIL' => $auth->acl_get('u_chgemail') ? true : false, 'S_CHANGE_PASSWORD' => $auth->acl_get('u_chgpasswd') ? true : false));
                break;
            case 'profile_info':
                // Do not display profile information panel if not authed to do so
                if (!$auth->acl_get('u_chgprofileinfo')) {
                    send_status_line(403, 'Forbidden');
                    trigger_error('NO_AUTH_PROFILEINFO');
                }
                /* @var $cp \phpbb\profilefields\manager */
                $cp = $phpbb_container->get('profilefields.manager');
                $cp_data = $cp_error = array();
                $data = array('jabber' => $request->variable('jabber', $user->data['user_jabber'], true));
                if ($config['allow_birthdays']) {
                    $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0;
                    if ($user->data['user_birthday']) {
                        list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']);
                    }
                    $data['bday_day'] = $request->variable('bday_day', $data['bday_day']);
                    $data['bday_month'] = $request->variable('bday_month', $data['bday_month']);
                    $data['bday_year'] = $request->variable('bday_year', $data['bday_year']);
                    $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);
                }
                /**
                 * Modify user data on editing profile in UCP
                 *
                 * @event core.ucp_profile_modify_profile_info
                 * @var	array	data		Array with user profile data
                 * @var	bool	submit		Flag indicating if submit button has been pressed
                 * @since 3.1.4-RC1
                 */
                $vars = array('data', 'submit');
                extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_profile_info', compact($vars)));
                add_form_key('ucp_profile_info');
                if ($submit) {
                    $validate_array = array('jabber' => array(array('string', true, 5, 255), array('jabber')));
                    if ($config['allow_birthdays']) {
                        $validate_array = array_merge($validate_array, array('bday_day' => array('num', true, 1, 31), 'bday_month' => array('num', true, 1, 12), 'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50), 'user_birthday' => array('date', true)));
                    }
开发者ID:phpbb,项目名称:phpbb,代码行数:67,代码来源:ucp_profile.php

示例15: main

    function main($id, $mode)
    {
        global $auth, $db, $user, $template, $request;
        global $config, $phpbb_container, $phpbb_log;
        $user->add_lang('acp/common');
        $action = $request->variable('action', array('' => ''));
        if (is_array($action)) {
            list($action, ) = each($action);
        } else {
            $action = $request->variable('action', '');
        }
        // Set up general vars
        $start = $request->variable('start', 0);
        $deletemark = $action == 'del_marked' ? true : false;
        $deleteall = $action == 'del_all' ? true : false;
        $marked = $request->variable('mark', array(0));
        // Sort keys
        $sort_days = $request->variable('st', 0);
        $sort_key = $request->variable('sk', 't');
        $sort_dir = $request->variable('sd', 'd');
        $this->tpl_name = 'mcp_logs';
        $this->page_title = 'MCP_LOGS';
        /* @var $pagination \phpbb\pagination */
        $pagination = $phpbb_container->get('pagination');
        $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_')));
        $forum_list[] = 0;
        $forum_id = $topic_id = 0;
        switch ($mode) {
            case 'front':
                break;
            case 'forum_logs':
                $forum_id = $request->variable('f', 0);
                if (!in_array($forum_id, $forum_list)) {
                    send_status_line(403, 'Forbidden');
                    trigger_error('NOT_AUTHORISED');
                }
                $forum_list = array($forum_id);
                break;
            case 'topic_logs':
                $topic_id = $request->variable('t', 0);
                $sql = 'SELECT forum_id
					FROM ' . TOPICS_TABLE . '
					WHERE topic_id = ' . $topic_id;
                $result = $db->sql_query($sql);
                $forum_id = (int) $db->sql_fetchfield('forum_id');
                $db->sql_freeresult($result);
                if (!in_array($forum_id, $forum_list)) {
                    send_status_line(403, 'Forbidden');
                    trigger_error('NOT_AUTHORISED');
                }
                $forum_list = array($forum_id);
                break;
        }
        // Delete entries if requested and able
        if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) {
            if (confirm_box(true)) {
                if ($deletemark && sizeof($marked)) {
                    $conditions = array('forum_id' => array('IN' => $forum_list), 'log_id' => array('IN' => $marked));
                    $phpbb_log->delete('mod', $conditions);
                } else {
                    if ($deleteall) {
                        $keywords = $request->variable('keywords', '', true);
                        $conditions = array('forum_id' => array('IN' => $forum_list), 'keywords' => $keywords);
                        if ($sort_days) {
                            $conditions['log_time'] = array('>=', time() - $sort_days * 86400);
                        }
                        if ($mode == 'topic_logs') {
                            $conditions['topic_id'] = $topic_id;
                        }
                        $phpbb_log->delete('mod', $conditions);
                    }
                }
            } else {
                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('f' => $forum_id, 't' => $topic_id, 'start' => $start, 'delmarked' => $deletemark, 'delall' => $deleteall, 'mark' => $marked, 'st' => $sort_days, 'sk' => $sort_key, 'sd' => $sort_dir, 'i' => $id, 'mode' => $mode, 'action' => $request->variable('action', array('' => '')))));
            }
        }
        // Sorting
        $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
        $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
        $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
        $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
        gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
        // Define where and sort sql for use in displaying logs
        $sql_where = $sort_days ? time() - $sort_days * 86400 : 0;
        $sql_sort = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'DESC' : 'ASC');
        $keywords = $request->variable('keywords', '', true);
        $keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
        // Grab log data
        $log_data = array();
        $log_count = 0;
        $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
        $base_url = $this->u_action . "&amp;{$u_sort_param}{$keywords_param}";
        $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
        $template->assign_vars(array('TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count), 'L_TITLE' => $user->lang['MCP_LOGS'], 'U_POST_ACTION' => $this->u_action . "&amp;{$u_sort_param}{$keywords_param}&amp;start={$start}", 'S_CLEAR_ALLOWED' => $auth->acl_get('a_clearlogs') ? true : false, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_LOGS' => $log_count > 0, 'S_KEYWORDS' => $keywords));
        foreach ($log_data as $row) {
            $data = array();
            $checks = array('viewpost', 'viewtopic', 'viewforum');
            foreach ($checks as $check) {
                if (isset($row[$check]) && $row[$check]) {
                    $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
//.........这里部分代码省略.........
开发者ID:phpbb,项目名称:phpbb,代码行数:101,代码来源:mcp_logs.php


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