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


PHP rebuild_header函数代码示例

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


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

示例1: get_recipient_strings

/**
* Generates an array of coloured recipient names from a list of PMs - (groups & users)
*
* @param	array	$pm_by_id	An array of rows from PRIVMSGS_TABLE, keys are the msg_ids.
*
* @return	array				2D Array: array(msg_id => array('username or group string', ...), ...)
*								Usernames are generated with {@link get_username_string get_username_string}
*								Groups are coloured and have a link to the membership page
*/
function get_recipient_strings($pm_by_id)
{
    global $db, $phpbb_root_path, $phpEx, $user;
    $address_list = $recipient_list = $address = array();
    $_types = array('u', 'g');
    foreach ($pm_by_id as $message_id => $row) {
        $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
        foreach ($_types as $ug_type) {
            if (isset($address[$message_id][$ug_type]) && sizeof($address[$message_id][$ug_type])) {
                foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) {
                    $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => '');
                }
            }
        }
    }
    foreach ($_types as $ug_type) {
        if (!empty($recipient_list[$ug_type])) {
            if ($ug_type == 'u') {
                $sql = 'SELECT user_id as id, username as name, user_colour as colour
					FROM ' . USERS_TABLE . '
					WHERE ';
            } else {
                $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
					FROM ' . GROUPS_TABLE . '
					WHERE ';
            }
            $sql .= $db->sql_in_set($ug_type == 'u' ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type])));
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                if ($ug_type == 'g') {
                    $row['name'] = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['name']] : $row['name'];
                }
                $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']);
            }
            $db->sql_freeresult($result);
        }
    }
    foreach ($address as $message_id => $adr_ary) {
        foreach ($adr_ary as $type => $id_ary) {
            foreach ($id_ary as $ug_id => $_id) {
                if ($type == 'u') {
                    $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']);
                } else {
                    $user_colour = $recipient_list[$type][$ug_id]['colour'] ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : '';
                    $link = '<a href="' . append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=group&amp;g=' . $ug_id) . '"' . $user_colour . '>';
                    $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . ($link ? '</a>' : '');
                }
            }
        }
    }
    return $address_list;
}
开发者ID:binano,项目名称:phpbb,代码行数:61,代码来源:functions_privmsgs.php

示例2: create_message_func


//.........这里部分代码省略.........
    }
    if (($action == 'post' || $action == 'reply') && !$auth->acl_get('u_sendpm')) {
        trigger_error('NO_AUTH_SEND_MESSAGE');
    }
    if ($action == 'forward' && (!$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) {
        trigger_error('NO_AUTH_FORWARD_MESSAGE');
    }
    // Do NOT use request_var or specialchars here
    $address_list = array('u' => array());
    foreach ($user_name as $msg_to_name) {
        $user_id = get_user_id_by_name(trim($msg_to_name));
        if ($user_id) {
            $address_list['u'][$user_id] = 'to';
        } else {
            trigger_error('PM_NO_USERS');
        }
    }
    $sql = '';
    // What is all this following SQL for? Well, we need to know
    // some basic information in all cases before we do anything.
    if ($action != 'post') {
        $sql = 'SELECT t.folder_id, p.*, u.username as quote_username
                FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
                WHERE t.user_id = ' . $user->data['user_id'] . "\n                AND p.author_id = u.user_id\n                AND t.msg_id = p.msg_id\n                AND p.msg_id = {$msg_id}";
    }
    if ($sql) {
        $result = $db->sql_query($sql);
        $post = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!$post) {
            trigger_error('NO_MESSAGE');
        }
        if (!$post['author_id'] || $post['author_id'] == ANONYMOUS) {
            trigger_error('NO_AUTHOR');
        }
    }
    include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
    $message_parser = new parse_message();
    // Get maximum number of allowed recipients
    if ($config['version'] > '3.0.3') {
        $sql = 'SELECT MAX(g.group_max_recipients) as max_recipients
        FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
        WHERE ug.user_id = ' . $user->data['user_id'] . '
            AND ug.user_pending = 0
            AND ug.group_id = g.group_id';
        $result = $db->sql_query($sql);
        $max_recipients = (int) $db->sql_fetchfield('max_recipients');
        $db->sql_freeresult($result);
        $max_recipients = !$max_recipients ? $config['pm_max_recipients'] : $max_recipients;
    } else {
        $max_recipients = 10;
    }
    // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients
    if (($action == 'reply' || $action == 'quote') && $max_recipients) {
        // We try to include every previously listed member from the TO Header
        $list = rebuild_header(array('to' => $post['to_address']));
        // Can be an empty array too ;)
        $list = !empty($list['u']) ? $list['u'] : array();
        $list[$post['author_id']] = 'to';
        if (isset($list[$user->data['user_id']])) {
            unset($list[$user->data['user_id']]);
        }
        $max_recipients = $max_recipients < sizeof($list) ? sizeof($list) : $max_recipients;
        unset($list);
    }
    // Handle User/Group adding/removing
    handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);
    if ($error) {
        $error_msg = trim(strip_tags(implode("\n", $error)));
        trigger_error($error_msg);
    }
    // Check mass pm to group permission
    if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) {
        $address_list = array();
        trigger_error('NO_AUTH_GROUP_MESSAGE');
    }
    // Check mass pm to users permission
    if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) {
        $address_list = get_recipients($address_list, 1);
        trigger_error('TOO_MANY_RECIPIENTS');
    }
    // Check for too many recipients
    if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) {
        $address_list = get_recipients($address_list, $max_recipients);
        trigger_error('TOO_MANY_RECIPIENTS');
    }
    $enable_bbcode = $config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode') ? true : false;
    $enable_smilies = $config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies') ? true : false;
    $img_status = $config['auth_img_pm'] && $auth->acl_get('u_pm_img') ? true : false;
    $flash_status = $config['auth_flash_pm'] && $auth->acl_get('u_pm_flash') ? true : false;
    $enable_urls = true;
    $enable_sig = false;
    $message_parser->message = $text_body;
    // Parse message
    $message_parser->parse($enable_bbcode, $config['allow_post_links'] ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);
    $pm_data = array('msg_id' => (int) $msg_id, 'from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'reply_from_root_level' => isset($post['root_level']) ? (int) $post['root_level'] : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => 0, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'address_list' => $address_list);
    $msg_id = submit_pm($action, $subject, $pm_data);
    $result = new xmlrpcval(array('result' => new xmlrpcval($msg_id ? true : false, 'boolean'), 'msg_id' => new xmlrpcval($msg_id, 'string')), 'struct');
    return new xmlrpcresp($result);
}
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:101,代码来源:create_message.php

示例3: view_folder


//.........这里部分代码省略.........
		}
		$friend = $foe = array();

		// Get friends and foes
		$sql = 'SELECT *
			FROM ' . ZEBRA_TABLE . '
			WHERE user_id = ' . $user->data['user_id'];
		$result = $db->sql_query($sql);

		while ($row = $db->sql_fetchrow($result))
		{
			$friend[$row['zebra_id']] = $row['friend'];
			$foe[$row['zebra_id']] = $row['foe'];
		}
		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'S_MARK_OPTIONS'		=> $s_mark_options,
			'S_MOVE_MARKED_OPTIONS'	=> $s_folder_move_options)
		);

		// Okay, lets dump out the page ...
		if (sizeof($folder_info['pm_list']))
		{
			$address_list = array();

			// Build Recipient List if in outbox/sentbox - max two additional queries
			if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX)
			{
				$recipient_list = $address = array();

				foreach ($folder_info['rowset'] as $message_id => $row)
				{
					$address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
					$_save = array('u', 'g');
					foreach ($_save as $save)
					{
						if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save]))
						{
							foreach (array_keys($address[$message_id][$save]) as $ug_id)
							{
								$recipient_list[$save][$ug_id] = array('name' => $user->lang['NA'], 'colour' => '');
							}
						}
					}
				}

				$_types = array('u', 'g');
				foreach ($_types as $ug_type)
				{
					if (!empty($recipient_list[$ug_type]))
					{
						if ($ug_type == 'u')
						{
							$sql = 'SELECT user_id as id, username as name, user_colour as colour
								FROM ' . USERS_TABLE . '
								WHERE ';
						}
						else
						{
							$sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
								FROM ' . GROUPS_TABLE . '
								WHERE ';
						}
						$sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type])));
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:66,代码来源:ucp_pm_viewfolder.php

示例4: _reparse_pm

 /**
  * Reparse the current private message
  * @param Array &$pm_data Array that will be filled with the reparsed pm data
  */
 function _reparse_pm(&$pm_data)
 {
     // Clean it
     $this->_clean_message($this->message_parser);
     // Reparse
     $this->message_parser->parse($this->flags['enable_bbcode'], $this->flags['enable_magic_url'], $this->flags['enable_smilies'], $this->flags['img_status'], $this->flags['flash_status'], true, $this->flags['enable_urls']);
     // Rebuild addresslist
     $this->data['address_list'] = rebuild_header(array('to' => $this->data['to_address'], 'bcc' => $this->data['bcc_address']));
     $pm_data = array('msg_id' => $this->data['msg_id'], 'from_user_id' => $this->data['author_id'], 'from_user_ip' => $this->data['author_ip'], 'from_username' => $this->data['author_name'], 'icon_id' => $this->data['icon_id'], 'enable_sig' => $this->data['enable_sig'], 'enable_bbcode' => $this->flags['enable_bbcode'], 'enable_urls' => $this->flags['enable_urls'], 'enable_smilies' => $this->flags['enable_smilies'], 'img_status' => $this->flags['img_status'], 'bbcode_bitfield' => $this->message_parser->bbcode_bitfield, 'bbcode_uid' => $this->message_parser->bbcode_uid, 'message' => $this->message_parser->message, 'attachment_data' => $this->message_parser->attachment_data, 'filename_data' => $this->message_parser->filename_data, 'address_list' => $this->data['address_list']);
 }
开发者ID:napus,项目名称:support-toolkit,代码行数:14,代码来源:reparse_bbcode.php

示例5: compose_pm


//.........这里部分代码省略.........
                $result = $db->sql_query($sql);
                $forum_data = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!empty($forum_data['forum_password'])) {
                    login_forum_box($forum_data);
                }
            }
        }
        $msg_id = (int) $post['msg_id'];
        $folder_id = isset($post['folder_id']) ? $post['folder_id'] : 0;
        $message_text = isset($post['message_text']) ? $post['message_text'] : '';
        if ((!$post['author_id'] || $post['author_id'] == ANONYMOUS && $action != 'delete') && $msg_id) {
            trigger_error('NO_AUTHOR');
        }
        if ($action == 'quotepost') {
            // Decode text for message display
            decode_message($message_text, $post['bbcode_uid']);
        }
        if ($action != 'delete') {
            $enable_urls = $post['enable_magic_url'];
            $enable_sig = isset($post['enable_sig']) ? $post['enable_sig'] : 0;
            $message_attachment = isset($post['message_attachment']) ? $post['message_attachment'] : 0;
            $message_subject = $post['message_subject'];
            $message_time = $post['message_time'];
            $bbcode_uid = $post['bbcode_uid'];
            $quote_username = isset($post['quote_username']) ? $post['quote_username'] : '';
            $icon_id = isset($post['icon_id']) ? $post['icon_id'] : 0;
            if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) {
                // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all"
                if ($action == 'quotepost' || !$reply_to_all) {
                    $address_list = array('u' => array($post['author_id'] => 'to'));
                } else {
                    // We try to include every previously listed member from the TO Header - Reply to all
                    $address_list = rebuild_header(array('to' => $post['to_address']));
                    // Add the author (if he is already listed then this is no shame (it will be overwritten))
                    $address_list['u'][$post['author_id']] = 'to';
                    // Now, make sure the user itself is not listed. ;)
                    if (isset($address_list['u'][$user->data['user_id']])) {
                        unset($address_list['u'][$user->data['user_id']]);
                    }
                }
            } else {
                if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview) {
                    // Rebuild TO and BCC Header
                    $address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address']));
                }
            }
            if ($action == 'quotepost') {
                $check_value = 0;
            } else {
                $check_value = ($post['enable_bbcode'] + 1 << 8) + ($post['enable_smilies'] + 1 << 4) + ($enable_urls + 1 << 2) + ($post['enable_sig'] + 1 << 1);
            }
        }
    } else {
        $message_attachment = 0;
        $message_text = $message_subject = '';
        if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post') {
            $address_list['u'][$to_user_id] = 'to';
        } else {
            if ($to_group_id && $action == 'post') {
                $address_list['g'][$to_group_id] = 'to';
            }
        }
        $check_value = 0;
    }
    if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) {
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:ucp_pm_compose.php

示例6: get_box_func

function get_box_func($xmlrpc_params)
{
    global $db, $auth, $user, $cache, $config, $phpbb_home, $phpbb_root_path, $phpEx;
    $params = php_xmlrpc_decode($xmlrpc_params);
    $user->setup('ucp');
    if (!$user->data['is_registered']) {
        trigger_error('LOGIN_EXPLAIN_UCP');
    }
    if (!$config['allow_privmsg']) {
        trigger_error('Module not accessible');
    }
    if (!isset($params[0])) {
        trigger_error('UNKNOWN_FOLDER');
    }
    // get folder id from parameters
    $folder_id = intval($params[0]);
    if (PRIVMSGS_INBOX !== $folder_id) {
        $folder_id = PRIVMSGS_SENTBOX;
    }
    list($start, $limit, $page) = process_page($params[1], $params[2]);
    // Grab icons
    //$icons = $cache->obtain_icons();
    $user_id = $user->data['user_id'];
    include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
    $folder = get_folder($user_id, $folder_id);
    include $phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx;
    $folder_info = get_pm_from($folder_id, $folder, $user_id);
    $address_list = array();
    // Build Recipient List if in outbox/sentbox - max two additional queries
    if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) {
        $recipient_list = $address = array();
        foreach ($folder_info['rowset'] as $message_id => $row) {
            $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
            $_save = array('u', 'g');
            foreach ($_save as $save) {
                if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save])) {
                    foreach (array_keys($address[$message_id][$save]) as $ug_id) {
                        $recipient_list[$save][$ug_id] = array('name' => $user->lang['NA'], 'colour' => '');
                    }
                }
            }
        }
        $_types = array('u', 'g');
        foreach ($_types as $ug_type) {
            if (!empty($recipient_list[$ug_type])) {
                if ($ug_type == 'u') {
                    $sql = 'SELECT user_id as id, username as name, user_colour as colour
                        FROM ' . USERS_TABLE . '
                        WHERE ';
                } else {
                    $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
                        FROM ' . GROUPS_TABLE . '
                        WHERE ';
                }
                $sql .= $db->sql_in_set($ug_type == 'u' ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type])));
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    if ($ug_type == 'g') {
                        $row['name'] = $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['name']] : $row['name'];
                    }
                    $recipient_list[$ug_type][$row['id']] = array('id' => $row['id'], 'name' => $row['name'], 'colour' => $row['colour']);
                }
                $db->sql_freeresult($result);
            }
        }
        foreach ($address as $message_id => $adr_ary) {
            foreach ($adr_ary as $type => $id_ary) {
                foreach ($id_ary as $ug_id => $_id) {
                    $address_list[$message_id][] = $recipient_list[$type][$ug_id];
                }
            }
        }
        unset($recipient_list, $address);
    }
    // get unread count in inbox only
    if (PRIVMSGS_INBOX === $folder_id) {
        $sql = 'SELECT COUNT(msg_id) as num_messages
                FROM ' . PRIVMSGS_TO_TABLE . '
                WHERE pm_unread = 1
                    AND folder_id = ' . PRIVMSGS_INBOX . '
                    AND user_id = ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        $unread_num = (int) $db->sql_fetchfield('num_messages');
        $db->sql_freeresult($result);
    } else {
        $unread_num = 0;
    }
    $sql = 'SELECT COUNT(msg_id) as num_messages
            FROM ' . PRIVMSGS_TO_TABLE . '
            WHERE folder_id = ' . $folder_id . '
                AND user_id = ' . $user->data['user_id'];
    $result = $db->sql_query($sql);
    $total_num = (int) $db->sql_fetchfield('num_messages');
    $db->sql_freeresult($result);
    $sql = 'SELECT t.*, p.*, u.username, u.user_avatar, u.user_avatar_type, u.user_id
            FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u\r\r\n            WHERE t.user_id = {$user_id}\r\r\n            AND p.author_id = u.user_id\r\r\n            AND t.folder_id = {$folder_id}\r\r\n            AND t.msg_id = p.msg_id\r\r\n            ORDER BY p.message_time DESC";
    $result = $db->sql_query_limit($sql, $limit, $start);
    $total_message_count = $total_unread_count = 0;
    $online_cache = array();
    while ($row = $db->sql_fetchrow($result)) {
//.........这里部分代码省略.........
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:101,代码来源:get_box.php

示例7: compose_pm


//.........这里部分代码省略.........
            }
            if (!$msg_id) {
                trigger_error('NO_MESSAGE');
            }
            $sql = 'SELECT msg_id, unread, new, author_id, folder_id
				FROM ' . FORUMS_PRIVMSGS_TO_TABLE . '
				WHERE user_id = ' . $_CLASS['core_user']->data['user_id'] . "\n\t\t\t\t\tAND msg_id = {$msg_id}";
            break;
        case 'smilies':
            require_once $site_file_root . 'includes/forums/functions_posting.php';
            generate_smilies('window', 0);
            script_close(false);
            break;
        default:
            trigger_error('NO_ACTION_MODE');
            break;
    }
    if ($sql) {
        $result = $_CLASS['core_db']->query_limit($sql, 1);
        if (!($row = $_CLASS['core_db']->fetch_row_assoc($result))) {
            trigger_error('NO_MESSAGE');
        }
        extract($row);
        $_CLASS['core_db']->free_result($result);
        $msg_id = (int) $msg_id;
        $enable_urls = $enable_magic_url;
        if (!$author_id && $msg_id) {
            trigger_error('NO_AUTHOR');
        }
        if (($action == 'reply' || $action == 'quote') && empty($address_list) && !$refresh && !$submit && !$preview) {
            $address_list = array('u' => array($author_id => 'to'));
        } elseif ($action == 'edit' && empty($address_list) && !$refresh && !$submit && !$preview) {
            // Rebuild TO and BCC Header
            $address_list = rebuild_header(array('to' => $to_address, 'bcc' => $bcc_address));
        }
        $check_value = ($enable_html + 1 << 16) + ($enable_bbcode + 1 << 8) + ($enable_smilies + 1 << 4) + ($enable_urls + 1 << 2) + ($enable_sig + 1 << 1);
    } else {
        $message_attachment = 0;
        if ($to_user_id && $action == 'post') {
            $address_list['u'][$to_user_id] = 'to';
        } else {
            if ($to_group_id && $action == 'post') {
                $address_list['g'][$to_group_id] = 'to';
            }
        }
        $check_value = 0;
    }
    if (($to_group_id || isset($address_list['g'])) && !$config['allow_mass_pm']) {
        trigger_error('NO_AUTH_GROUP_MESSAGE');
    }
    if ($action == 'edit' && !$refresh && !$preview && !$submit) {
        if (!($message_time > time() - $config['pm_edit_time'] || !$config['pm_edit_time'])) {
            trigger_error('CANNOT_EDIT_MESSAGE_TIME');
        }
    }
    if (!isset($icon_id)) {
        $icon_id = 0;
    }
    require_once $site_file_root . 'includes/forums/functions_admin.php';
    require_once $site_file_root . 'includes/forums/functions_posting.php';
    require_once $site_file_root . 'includes/forums/message_parser.php';
    $message_parser = new parse_message();
    $message_subject = isset($message_subject) ? $message_subject : '';
    $message_parser->message = $action == 'reply' ? '' : (isset($message_text) ? $message_text : '');
    unset($message_text);
    $s_action = "Control_Panel&amp;i={$id}&amp;mode={$mode}&amp;action={$action}";
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:67,代码来源:ucp_pm_compose.php

示例8: compose_pm


//.........这里部分代码省略.........
		$message_text	= (isset($post['message_text'])) ? $post['message_text'] : '';

		if ((!$post['author_id'] || ($post['author_id'] == ANONYMOUS && $action != 'delete')) && $msg_id)
		{
			trigger_error('NO_AUTHOR');
		}

		if ($action == 'quotepost')
		{
			// Decode text for message display
			decode_message($message_text, $post['bbcode_uid']);
		}

		if ($action != 'delete')
		{
			$enable_urls = $post['enable_magic_url'];
			$enable_sig = (isset($post['enable_sig'])) ? $post['enable_sig'] : 0;

			$message_attachment = (isset($post['message_attachment'])) ? $post['message_attachment'] : 0;
			$message_subject = $post['message_subject'];
			$message_time = $post['message_time'];
			$bbcode_uid = $post['bbcode_uid'];

			$quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : '';
			$icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0;

			if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview)
			{
				$address_list = array('u' => array($post['author_id'] => 'to'));
			}
			else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview)
			{
				// Rebuild TO and BCC Header
				$address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address']));
			}

			if ($action == 'quotepost')
			{
				$check_value = 0;
			}
			else
			{
				$check_value = (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1);
			}
		}
	}
	else
	{
		$message_attachment = 0;
		$message_text = $message_subject = '';

		if ($to_user_id && $action == 'post')
		{
			$address_list['u'][$to_user_id] = 'to';
		}
		else if ($to_group_id && $action == 'post')
		{
			$address_list['g'][$to_group_id] = 'to';
		}
		$check_value = 0;
	}

	if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')))
	{
		trigger_error('NO_AUTH_GROUP_MESSAGE');
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:ucp_pm_compose.php

示例9: view_folder

function view_folder($id, $mode, $folder_id, $folder, $type)
{
    global $_CLASS, $config;
    // Grab icons
    $icons = array();
    obtain_icons($icons);
    $color_rows = array('marked', 'replied', 'message_reported', 'friend', 'foe');
    foreach ($color_rows as $var) {
        $_CLASS['core_template']->assign_vars_array('pm_colour_info', array('IMG' => $_CLASS['core_user']->img("pm_{$var}", ''), 'CLASS' => "pm_{$var}_colour", 'LANG' => $_CLASS['core_user']->lang[strtoupper($var) . '_MESSAGE']));
    }
    $mark_options = array('mark_important', 'delete_marked');
    $s_mark_options = '';
    foreach ($mark_options as $mark_option) {
        $s_mark_options .= '<option value="' . $mark_option . '">' . $_CLASS['core_user']->lang[strtoupper($mark_option)] . '</option>';
    }
    $friend = $foe = array();
    // Get friends and foes
    $sql = 'SELECT * 
		FROM ' . ZEBRA_TABLE . ' 
		WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
    $result = $_CLASS['core_db']->query($sql);
    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
        $friend[$row['zebra_id']] = $row['friend'];
        $foe[$row['zebra_id']] = $row['foe'];
    }
    $_CLASS['core_db']->free_result($result);
    $_CLASS['core_template']->assign(array('S_UNREAD' => $type == 'unread', 'S_MARK_OPTIONS' => $s_mark_options));
    $folder_info = get_pm_from($folder_id, $folder, $_CLASS['core_user']->data['user_id'], "Control_Panel&amp;i={$id}", $type);
    // Okay, lets dump out the page ...
    if (sizeof($folder_info['pm_list'])) {
        // Build Recipient List if in outbox/sentbox - max two additional queries
        $recipient_list = $address_list = $address = array();
        if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) {
            foreach ($folder_info['rowset'] as $message_id => $row) {
                $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
                foreach (array('u', 'g') as $save) {
                    if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save])) {
                        foreach (array_keys($address[$message_id][$save]) as $ug_id) {
                            $recipient_list[$save][$ug_id] = array('name' => $_CLASS['core_user']->lang['NA'], 'colour' => '');
                        }
                    }
                }
            }
            foreach (array('u', 'g') as $ug_type) {
                if (isset($recipient_list[$ug_type]) && sizeof($recipient_list[$ug_type])) {
                    $sql = $ug_type == 'u' ? 'SELECT user_id as id, username as name, user_colour as colour FROM ' . USERS_TABLE . ' WHERE user_id' : 'SELECT group_id as id, group_name as name, group_colour as colour FROM ' . GROUPS_TABLE . ' WHERE group_id';
                    $sql .= ' IN (' . implode(', ', array_keys($recipient_list[$ug_type])) . ')';
                    $result = $_CLASS['core_db']->query($sql);
                    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']);
                    }
                    $_CLASS['core_db']->free_result($result);
                }
            }
            foreach ($address as $message_id => $adr_ary) {
                foreach ($adr_ary as $type => $id_ary) {
                    foreach ($id_ary as $ug_id => $_id) {
                        $address_list[$message_id][] = ($type == 'u' ? '<a href="' . generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $ug_id) . '">' : '<a href="' . generate_link('Members_List&amp;mode=group&amp;g=' . $ug_id) . '">') . ($recipient_list[$type][$ug_id]['colour'] ? '<span style="color:#' . $recipient_list[$type][$ug_id]['colour'] . '">' : '<span>') . $recipient_list[$type][$ug_id]['name'] . '</span></a>';
                    }
                }
            }
            unset($recipient_list, $address);
        }
        $url = 'Control_Panel&amp;i=' . $id;
        foreach ($folder_info['pm_list'] as $message_id) {
            $row =& $folder_info['rowset'][$message_id];
            $folder_img = $row['unread'] ? 'folder_new' : 'folder';
            $folder_alt = $row['unread'] ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES';
            // Generate all URIs ...
            $message_author = '<a href="' . generate_link('Members_List&amp;mode=viewprofile&amp;u=' . $row['author_id']) . '">' . $row['username'] . '</a>';
            $view_message_url = generate_link("{$url}&amp;f={$folder_id}&amp;p={$message_id}");
            $remove_message_url = generate_link($url . '&amp;mode=compose&amp;action=delete&amp;p=' . $message_id);
            $row_indicator = '';
            foreach ($color_rows as $var) {
                if ($var != 'friend' && $var != 'foe' && $row[$var] || ($var == 'friend' || $var == 'foe') && isset(${$var}[$row['author_id']])) {
                    $row_indicator = $var;
                    break;
                }
            }
            // Send vars to template
            $_CLASS['core_template']->assign_vars_array('messagerow', array('PM_CLASS' => $row_indicator ? 'pm_' . $row_indicator . '_colour' : '', 'FOLDER_ID' => $folder_id, 'MESSAGE_ID' => $message_id, 'MESSAGE_AUTHOR' => $message_author, 'SENT_TIME' => $_CLASS['core_user']->format_date($row['message_time']), 'SUBJECT' => censor_text($row['message_subject']), 'FOLDER' => isset($folder[$row['folder_id']]) ? $folder[$row['folder_id']]['folder_name'] : '', 'U_FOLDER' => isset($folder[$row['folder_id']]) ? generate_link("{$url}&amp;folder=" . $row['folder_id']) : '', 'PM_ICON_IMG' => !empty($icons[$row['icon_id']]) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', 'FOLDER_IMG' => $_CLASS['core_user']->img($folder_img, $folder_alt), 'PM_IMG' => $row_indicator ? $_CLASS['core_user']->img('pm_' . $row_indicator, '') : '', 'ATTACH_ICON_IMG' => $_CLASS['auth']->acl_get('u_download') && $row['message_attachment'] && $config['allow_pm_attach'] && $config['auth_download_pm'] ? $_CLASS['core_user']->img('icon_attach', $_CLASS['core_user']->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_REPORTED' => !empty($row['message_reported']) && $_CLASS['auth']->acl_get('m_') ? true : false, 'S_PM_DELETED' => $row['deleted'] ? true : false, 'U_VIEW_PM' => $row['deleted'] ? '' : $view_message_url, 'U_REMOVE_PM' => $row['deleted'] ? $remove_message_url : '', 'RECIPIENTS' => $folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX ? implode(', ', $address_list[$message_id]) : '', 'U_MCP_REPORT' => generate_link('Forums&amp;file=mcp&amp;mode=reports&amp;pm=' . $message_id)));
        }
        unset($folder_info['rowset']);
        $_CLASS['core_template']->assign(array('S_SHOW_RECIPIENTS' => $folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX ? true : false, 'S_SHOW_COLOUR_LEGEND' => true));
    }
}
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:86,代码来源:ucp_pm_viewfolder.php

示例10: view_folder

function view_folder($parent_class, $folder_id, $folder, $type)
{
    global $_CLASS;
    $limit = 10;
    $icons = obtain_icons();
    $submit_export = isset($_POST['submit_export']) ? true : false;
    $folder_info = get_pm_from($folder_id, $folder, $_CLASS['core_user']->data['user_id'], $parent_class->link_parent, $type);
    $color_rows = array('marked', 'replied', 'friend', 'foe');
    //, 'message_reported'
    foreach ($color_rows as $var) {
        $_CLASS['core_template']->assign_vars_array('pm_colour_info', array('IMG' => $_CLASS['core_user']->img("pm_{$var}", ''), 'CLASS' => "pm_{$var}_colour", 'LANG' => $_CLASS['core_user']->get_lang(strtoupper($var) . '_MESSAGE')));
    }
    $mark_options = array('mark_important', 'delete_marked', 'mark_read', 'mark_unread');
    $s_mark_options = '';
    foreach ($mark_options as $mark_option) {
        $s_mark_options .= '<option value="' . $mark_option . '">' . $_CLASS['core_user']->get_lang(strtoupper($mark_option)) . '</option>';
    }
    // We do the folder moving options here too, for template authors to use...
    $s_folder_move_options = '';
    foreach ($folder as $f_id => $folder_ary) {
        if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id) {
            continue;
        }
        $s_folder_move_options .= '<option' . ($f_id != PRIVMSGS_INBOX ? ' class="blue"' : '') . ' value="' . $f_id . '">';
        $s_folder_move_options .= sprintf($_CLASS['core_user']->get_lang('MOVE_MARKED_TO_FOLDER'), $folder_ary['folder_name']);
        $s_folder_move_options .= ($folder_ary['unread_messages'] ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
    }
    $friend = $foe = array();
    // Get friends and foes
    $sql = 'SELECT * 
		FROM ' . ZEBRA_TABLE . ' 
		WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
    $result = $_CLASS['core_db']->query($sql);
    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
        $friend[$row['zebra_id']] = $row['friend'];
        $foe[$row['zebra_id']] = $row['foe'];
    }
    $_CLASS['core_db']->free_result($result);
    $_CLASS['core_template']->assign_array(array('S_UNREAD' => $type === 'unread', 'S_MARK_OPTIONS' => $s_mark_options));
    // Okay, lets dump out the page ...
    if (!empty($folder_info['pm_list'])) {
        // Build Recipient List if in outbox/sentbox - max two additional queries
        $recipient_list = $address_list = $address = array();
        if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) {
            foreach ($folder_info['rowset'] as $message_id => $row) {
                $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address']));
                $_save = array('u', 'g');
                foreach ($_save as $save) {
                    if (isset($address[$message_id][$save]) && sizeof($address[$message_id][$save])) {
                        foreach (array_keys($address[$message_id][$save]) as $ug_id) {
                            $recipient_list[$save][$ug_id] = array('name' => $_CLASS['core_user']->lang['NA'], 'colour' => '');
                        }
                    }
                }
            }
            $_types = array('u', 'g');
            foreach ($_types as $ug_type) {
                if (!empty($recipient_list[$ug_type])) {
                    $sql = $ug_type === 'u' ? 'SELECT user_id as id, username as name, user_colour as colour FROM ' . CORE_USERS_TABLE . ' WHERE user_id' : 'SELECT group_id as id, group_name as name, group_colour as colour FROM ' . CORE_GROUPS_TABLE . ' WHERE group_id';
                    $sql .= ' IN (' . implode(', ', array_map('intval', array_keys($recipient_list[$ug_type]))) . ')';
                    $result = $_CLASS['core_db']->query($sql);
                    while ($row = $_CLASS['core_db']->fetch_row_assoc($result)) {
                        $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']);
                    }
                    $_CLASS['core_db']->free_result($result);
                }
            }
            foreach ($address as $message_id => $adr_ary) {
                foreach ($adr_ary as $type => $id_ary) {
                    foreach ($id_ary as $ug_id => $_id) {
                        $user_colour = $recipient_list[$type][$ug_id]['colour'] ? ' style="color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : '';
                        if ($type === 'u') {
                            $link = $ug_id != ANONYMOUS ? '<a href="' . generate_link('members_list&amp;mode=viewprofile&amp;u=' . $ug_id) . '"' . $user_colour . '>' : '';
                        } else {
                            $link = '<a href="' . generate_link('members_list&amp;mode=group&amp;g=' . $ug_id) . '"' . $user_colour . '>';
                        }
                        $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . ($link ? '</a>' : '');
                    }
                }
            }
            unset($recipient_list, $address);
        }
        foreach ($folder_info['pm_list'] as $message_id) {
            $row =& $folder_info['rowset'][$message_id];
            $folder_img = $row['pm_unread'] ? 'folder_new' : 'folder';
            $folder_alt = $row['pm_unread'] ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES';
            // Generate all URIs ...
            $message_author = $row['author_id'] != ANONYMOUS ? '<a href="' . generate_link('members_list&amp;mode=viewprofile&amp;u=' . $row['author_id']) . '">' . $row['username'] . '</a>' : $row['username'];
            $view_message_url = generate_link($parent_class->link_parent . "&amp;f={$folder_id}&amp;p={$message_id}");
            $remove_message_url = generate_link($parent_class->link_parent . '&amp;mode=compose&amp;action=delete&amp;p=' . $message_id);
            $row_indicator = '';
            foreach ($color_rows as $var) {
                if ($var !== 'friend' && $var !== 'foe' && $row['pm_' . $var] || ($var == 'friend' || $var == 'foe') && isset(${$var}[$row['author_id']]) && ${$var}[$row['author_id']]) {
                    $row_indicator = $var;
                    break;
                }
            }
            // Send vars to template
            $_CLASS['core_template']->assign_vars_array('messagerow', array('PM_CLASS' => $row_indicator ? 'pm_' . $row_indicator . '_colour' : '', 'FOLDER_ID' => $folder_id, 'MESSAGE_ID' => $message_id, 'MESSAGE_AUTHOR' => $message_author, 'SENT_TIME' => $_CLASS['core_user']->format_date($row['message_time']), 'SUBJECT' => censor_text($row['message_subject']), 'FOLDER' => isset($folder[$row['folder_id']]) ? $folder[$row['folder_id']]['folder_name'] : '', 'U_FOLDER' => isset($folder[$row['folder_id']]) ? generate_link($parent_class->link_parent . '&amp;folder=' . $row['folder_id']) : '', 'PM_ICON_IMG' => !empty($icons[$row['icon_id']]) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '', 'FOLDER_IMG' => $_CLASS['core_user']->img($folder_img, $folder_alt), 'PM_IMG' => $row_indicator ? $_CLASS['core_user']->img('pm_' . $row_indicator, '') : '', 'ATTACH_ICON_IMG' => $row['message_attachment'] ? $_CLASS['core_user']->img('icon_attach', $_CLASS['core_user']->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_REPORTED' => '', 'S_PM_DELETED' => $row['pm_deleted'] ? true : false, 'S_AUTHOR_DELETED' => $row['author_id'] == ANONYMOUS ? true : false, 'U_VIEW_PM' => $row['pm_deleted'] ? '' : $view_message_url, 'U_REMOVE_PM' => $row['pm_deleted'] ? $remove_message_url : '', 'RECIPIENTS' => $folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX ? implode(', ', $address_list[$message_id]) : '', 'U_MCP_REPORT' => generate_link('forums&amp;file=mcp&amp;mode=reports&amp;pm=' . $message_id)));
        }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_pm_viewfolder.php


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