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


PHP URL::user方法代码示例

本文整理汇总了PHP中URL::user方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::user方法的具体用法?PHP URL::user怎么用?PHP URL::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URL的用法示例。


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

示例1: render

    /**
     * Render view.
     *
     * @return  string
     */
    public function render()
    {
        ob_start();
        ?>

<li class="media">
	<div class="pull-left">
		<?php 
        echo HTML::avatar($this->user['avatar'], $this->user['username']);
        ?>
	</div>
	<div class="media-body">

		<?php 
        if (Visitor::$user && !Visitor::$user->is_friend($this->user)) {
            ?>
		<?php 
            echo HTML::anchor(URL::user($this->user, 'friend') . '?token=' . Security::csrf(), '<i class="fa fa-heart"></i> ' . __('Add to friends'), array('class' => 'ajaxify btn btn-lovely btn-sm pull-right', 'data-ajaxify-target' => 'li.media'));
            ?>
		<?php 
        }
        ?>

		<?php 
        echo HTML::user($this->user);
        ?>
<br />
		<?php 
        if ($this->common) {
            ?>
		<small><?php 
            echo __(':friends mutual friends', array(':friends' => $this->common));
            ?>
</small><br />
		<?php 
        }
        ?>

	</div>
</li>

<?php 
        return ob_get_clean();
    }
开发者ID:anqh,项目名称:anqh,代码行数:49,代码来源:friend.php

示例2: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $ignores = array();
        foreach ($this->user->find_ignores() as $ignore_id) {
            $ignore = Model_User::find_user_light($ignore_id);
            $ignores[$ignores['username']] = $ignore;
        }
        ksort($ignores, SORT_LOCALE_STRING);
        ?>

<ul class="media-list">
	<?php 
        foreach ($ignores as $ignore) {
            ?>

	<li class="media">
		<div class="pull-left">
			<?php 
            echo HTML::avatar($ignore['avatar'], $ignore['username']);
            ?>
		</div>
		<div class="media-body">
			<?php 
            echo HTML::user($ignore);
            ?>
<br />
			<?php 
            echo HTML::anchor(URL::user($ignore, 'unignore') . '?token=' . Security::csrf(), '<i class="fa fa-ban"></i> ' . __('Unignore'), array('class' => 'btn btn-default btn-sm ignore-delete'));
            ?>
		</div>
	</li>
	<?php 
        }
        ?>

</ul>

<?php 
        return ob_get_clean();
    }
开发者ID:anqh,项目名称:anqh,代码行数:46,代码来源:ignores.php

示例3: getLastPosts

function getLastPosts($latestPostOptions)
{
    global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
    // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
    // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
    $request = smf_db_query('
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, b.name, m1.subject AS first_subject,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
			SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			INNER JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY m.id_msg DESC
		LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    $posts = array();
    while ($row = mysql_fetch_assoc($request)) {
        // Censor the subject and post for the preview ;).
        censorText($row['subject']);
        censorText($row['body']);
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if (commonAPI::strlen($row['body']) > 128) {
            $row['body'] = commonAPI::substr($row['body'], 0, 128) . '...';
        }
        $bhref = URL::board($row['id_board'], $row['board_name'], 0, true);
        $mhref = URL::user($row['id_member'], $row['poster_name']);
        $thref = URL::topic($row['id_topic'], $row['first_subject'], 0, false, '.msg' . $row['id_msg'], ';topicseen#msg' . $row['id_msg']);
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $bhref, 'link' => '<a href="' . $bhref . '">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $mhref, 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $mhref . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 35), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $thref, 'link' => '<a href="' . $thref . '" rel="nofollow">' . $row['first_subject'] . '</a>');
    }
    mysql_free_result($request);
    return $posts;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:40,代码来源:Subs-Recent.php

示例4: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $ignores = array();
        foreach ($this->user->find_ignores() as $ignore_id) {
            $ignore = Model_User::find_user_light($ignore_id);
            $ignores[$ignores['username']] = $ignore;
        }
        ksort($ignores, SORT_LOCALE_STRING);
        ?>

<ul class="unstyled">
	<?php 
        foreach ($ignores as $ignore) {
            ?>

	<li class="row-fluid">
		<?php 
            echo HTML::avatar($ignore['avatar'], $ignore['username']);
            ?>
		<?php 
            echo HTML::user($ignore);
            ?>
<br />
		<?php 
            echo HTML::anchor(URL::user($ignore, 'unignore') . '?token=' . Security::csrf(), '<i class="icon-ban-circle icon-white"></i> ' . __('Unignore'), array('class' => 'btn btn-inverse btn-small ignore-delete'));
            ?>
	</li>
	<?php 
        }
        ?>

</ul>


<?php 
        return ob_get_clean();
    }
开发者ID:anqh,项目名称:core,代码行数:43,代码来源:ignores.php

示例5: getBoardParents

function getBoardParents($id_parent)
{
    // First check if we have this cached already.
    if (($boards = CacheAPI::getCache('board_parents-' . $id_parent, 480)) === null) {
        $boards = array();
        $original_parent = $id_parent;
        // Loop while the parent is non-zero.
        while ($id_parent != 0) {
            $result = smf_db_query('
				SELECT
					b.id_parent, b.name, {int:board_parent} AS id_board, IFNULL(mem.id_member, 0) AS id_moderator,
					mem.real_name, b.child_level
				FROM {db_prefix}boards AS b
					LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = b.id_board)
					LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = mods.id_member)
				WHERE b.id_board = {int:board_parent}', array('board_parent' => $id_parent));
            // In the EXTREMELY unlikely event this happens, give an error message.
            if (mysql_num_rows($result) == 0) {
                fatal_lang_error('parent_not_found', 'critical');
            }
            while ($row = mysql_fetch_assoc($result)) {
                if (!isset($boards[$row['id_board']])) {
                    $id_parent = $row['id_parent'];
                    $boards[$row['id_board']] = array('url' => URL::board($row['id_board'], $row['name'], 0), 'name' => $row['name'], 'level' => $row['child_level'], 'moderators' => array());
                }
                // If a moderator exists for this board, add that moderator for all children too.
                if (!empty($row['id_moderator'])) {
                    foreach ($boards as $id => $dummy) {
                        $mhref = URL::user($row['id_moderator'], $row['real_name']);
                        $boards[$id]['moderators'][$row['id_moderator']] = array('id' => $row['id_moderator'], 'name' => $row['real_name'], 'href' => $mhref, 'link' => '<a href="' . $mhref . '">' . $row['real_name'] . '</a>');
                    }
                }
            }
            mysql_free_result($result);
        }
        CacheAPI::putCache('board_parents-' . $original_parent, $boards, 480);
    }
    return $boards;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:39,代码来源:Load.php

示例6: getBoardIndex

function getBoardIndex($boardIndexOptions)
{
    global $smcFunc, $scripturl, $user_info, $modSettings, $txt;
    global $settings, $context;
    // For performance, track the latest post while going through the boards.
    if (!empty($boardIndexOptions['set_latest_post'])) {
        $latest_post = array('timestamp' => 0, 'ref' => 0);
    }
    // Find all boards and categories, as well as related information.  This will be sorted by the natural order of boards and categories, which we control.
    $result_boards = smf_db_query('
		SELECT' . ($boardIndexOptions['include_categories'] ? '
			c.id_cat, c.name AS cat_name, c.description AS cat_desc,' : '') . '
			b.id_board, b.name AS board_name, b.description, b.redirect, b.icon AS boardicon,
			CASE WHEN b.redirect != {string:blank_string} THEN 1 ELSE 0 END AS is_redirect,
			b.num_posts, b.num_topics, b.unapproved_posts, b.unapproved_topics, b.id_parent, b.allow_topics,
			IFNULL(m.poster_time, 0) AS poster_time, IFNULL(mem.member_name, m.poster_name) AS poster_name,
			m.subject, m1.subject AS first_subject, m.id_topic, t.id_first_msg AS id_first_msg, t.id_prefix, m1.icon AS icon, IFNULL(mem.real_name, m.poster_name) AS real_name, p.name as topic_prefix,
			' . ($user_info['is_guest'] ? ' 1 AS is_read, 0 AS new_from,' : '
			(IFNULL(lb.id_msg, 0) >= b.id_msg_updated) AS is_read, IFNULL(lb.id_msg, -1) + 1 AS new_from,' . ($boardIndexOptions['include_categories'] ? '
			c.can_collapse, IFNULL(cc.id_member, 0) AS is_collapsed,' : '')) . '
			IFNULL(mem.id_member, 0) AS id_member, m.id_msg,
			IFNULL(mods_mem.id_member, 0) AS id_moderator, mods_mem.real_name AS mod_real_name
		FROM {db_prefix}boards AS b' . ($boardIndexOptions['include_categories'] ? '
			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)' : '') . '
			LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = b.id_last_msg)
			LEFT JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			LEFT JOIN {db_prefix}prefixes AS p ON (p.id_prefix = t.id_prefix)
			LEFT JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . ($user_info['is_guest'] ? '' : '
			LEFT JOIN {db_prefix}log_boards AS lb ON (lb.id_board = b.id_board AND lb.id_member = {int:current_member})' . ($boardIndexOptions['include_categories'] ? '
			LEFT JOIN {db_prefix}collapsed_categories AS cc ON (cc.id_cat = c.id_cat AND cc.id_member = {int:current_member})' : '')) . '
			LEFT JOIN {db_prefix}moderators AS mods ON (mods.id_board = b.id_board)
			LEFT JOIN {db_prefix}members AS mods_mem ON (mods_mem.id_member = mods.id_member)
		WHERE {query_see_board}' . (empty($boardIndexOptions['countChildPosts']) ? empty($boardIndexOptions['base_level']) ? '' : '
			AND b.child_level >= {int:child_level}' : '
			AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)), array('current_member' => $user_info['id'], 'child_level' => $boardIndexOptions['base_level'], 'blank_string' => ''));
    // Start with an empty array.
    if ($boardIndexOptions['include_categories']) {
        $categories = array();
    } else {
        $this_category = array();
    }
    $total_ignored_boards = 0;
    // Run through the categories and boards (or only boards)....
    while ($row_board = mysql_fetch_assoc($result_boards)) {
        // Perhaps we are ignoring this board?
        $ignoreThisBoard = in_array($row_board['id_board'], $user_info['ignoreboards']);
        $total_ignored_boards += $ignoreThisBoard ? 1 : 0;
        $row_board['is_read'] = !empty($row_board['is_read']) || $ignoreThisBoard ? '1' : '0';
        if ($boardIndexOptions['include_categories']) {
            // Haven't set this category yet.
            if (empty($categories[$row_board['id_cat']])) {
                $categories[$row_board['id_cat']] = array('id' => $row_board['id_cat'], 'name' => $row_board['cat_name'], 'desc' => $row_board['cat_desc'], 'is_collapsed' => isset($row_board['can_collapse']) && $row_board['can_collapse'] == 1 && $row_board['is_collapsed'] > 0, 'can_collapse' => isset($row_board['can_collapse']) && $row_board['can_collapse'] == 1, 'collapse_href' => isset($row_board['can_collapse']) ? $scripturl . '?action=collapse;c=' . $row_board['id_cat'] . ';sa=' . ($row_board['is_collapsed'] > 0 ? 'expand;' : 'collapse;') . $context['session_var'] . '=' . $context['session_id'] . '#c' . $row_board['id_cat'] : '', 'collapse_image' => isset($row_board['can_collapse']) ? '<img class="clipsrc ' . ($row_board['is_collapsed'] ? ' _expand' : '_collapse') . '" src="' . $settings['images_url'] . '/clipsrc.png" alt="-" />' : '', 'href' => $scripturl . '#c' . $row_board['id_cat'], 'boards' => array(), 'is_root' => $row_board['cat_name'][0] === '!' ? true : false, 'new' => false);
                $categories[$row_board['id_cat']]['link'] = '<a id="c' . $row_board['id_cat'] . '"></a>' . ($categories[$row_board['id_cat']]['can_collapse'] ? '<a href="' . $categories[$row_board['id_cat']]['collapse_href'] . '">' . $row_board['cat_name'] . '</a>' : $row_board['cat_name']);
            }
            // If this board has new posts in it (and isn't the recycle bin!) then the category is new.
            if (empty($modSettings['recycle_enable']) || $modSettings['recycle_board'] != $row_board['id_board']) {
                $categories[$row_board['id_cat']]['new'] |= empty($row_board['is_read']) && $row_board['poster_name'] != '';
            }
            // Avoid showing category unread link where it only has redirection boards.
            $categories[$row_board['id_cat']]['show_unread'] = !empty($categories[$row_board['id_cat']]['show_unread']) ? 1 : !$row_board['is_redirect'];
            // Collapsed category - don't do any of this.
            //if ($categories[$row_board['id_cat']]['is_collapsed'])
            //	continue;
            // Let's save some typing.  Climbing the array might be slower, anyhow.
            $this_category =& $categories[$row_board['id_cat']]['boards'];
        }
        // This is a parent board.
        if ($row_board['id_parent'] == $boardIndexOptions['parent_id']) {
            // Is this a new board, or just another moderator?
            if (!isset($this_category[$row_board['id_board']])) {
                // Not a child.
                $isChild = false;
                $href = URL::board($row_board['id_board'], $row_board['board_name'], 0, false);
                $this_category[$row_board['id_board']] = array('new' => empty($row_board['is_read']), 'id' => $row_board['id_board'], 'name' => $row_board['board_name'], 'description' => $row_board['description'], 'moderators' => array(), 'link_moderators' => array(), 'children' => array(), 'link_children' => array(), 'children_new' => false, 'topics' => $row_board['num_topics'], 'posts' => $row_board['num_posts'], 'is_redirect' => $row_board['is_redirect'], 'is_page' => !empty($row_board['redirect']) && $row_board['redirect'][0] === '%' && intval(substr($row_board['redirect'], 1)) > 0, 'redirect' => $row_board['redirect'], 'boardicon' => $row_board['boardicon'], 'unapproved_topics' => $row_board['unapproved_topics'], 'unapproved_posts' => $row_board['unapproved_posts'] - $row_board['unapproved_topics'], 'can_approve_posts' => !empty($user_info['mod_cache']['ap']) && ($user_info['mod_cache']['ap'] == array(0) || in_array($row_board['id_board'], $user_info['mod_cache']['ap'])), 'href' => $href, 'link' => '<a href="' . $href . '">' . $row_board['board_name'] . '</a>', 'act_as_cat' => $row_board['allow_topics'] ? false : true, 'ignored' => $ignoreThisBoard);
                $this_category[$row_board['id_board']]['page_link'] = $this_category[$row_board['id_board']]['is_page'] ? URL::topic(intval(substr($this_category[$row_board['id_board']]['redirect'], 1)), $this_category[$row_board['id_board']]['name'], 0) : '';
            }
            if (!empty($row_board['id_moderator'])) {
                $this_category[$row_board['id_board']]['moderators'][$row_board['id_moderator']] = array('id' => $row_board['id_moderator'], 'name' => $row_board['mod_real_name'], 'href' => $scripturl . '?action=profile;u=' . $row_board['id_moderator'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_moderator'] . '" title="' . $txt['board_moderator'] . '">' . $row_board['mod_real_name'] . '</a>');
                $this_category[$row_board['id_board']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_moderator'] . '" title="' . $txt['board_moderator'] . '">' . $row_board['mod_real_name'] . '</a>';
            }
        } elseif (isset($this_category[$row_board['id_parent']]['children']) && !isset($this_category[$row_board['id_parent']]['children'][$row_board['id_board']])) {
            // A valid child!
            $isChild = true;
            $href = URL::board($row_board['id_board'], $row_board['board_name'], 0, false);
            $this_category[$row_board['id_parent']]['children'][$row_board['id_board']] = array('id' => $row_board['id_board'], 'name' => $row_board['board_name'], 'description' => $row_board['description'], 'short_description' => !empty($row_board['description']) ? $modSettings['child_board_desc_shortened'] ? '(' . commonAPI::substr($row_board['description'], 0, $modSettings['child_board_desc_shortened']) . '...)' : '(' . $row_board['description'] . ')' : '', 'new' => empty($row_board['is_read']) && $row_board['poster_name'] != '', 'topics' => $row_board['num_topics'], 'posts' => $row_board['num_posts'], 'is_redirect' => $row_board['is_redirect'], 'is_page' => !empty($row_board['redirect']) && $row_board['redirect'][0] === '%' && intval(substr($row_board['redirect'], 1)) > 0, 'redirect' => $row_board['redirect'], 'boardicon' => $row_board['boardicon'], 'unapproved_topics' => $row_board['unapproved_topics'], 'unapproved_posts' => $row_board['unapproved_posts'] - $row_board['unapproved_topics'], 'can_approve_posts' => !empty($user_info['mod_cache']['ap']) && ($user_info['mod_cache']['ap'] == array(0) || in_array($row_board['id_board'], $user_info['mod_cache']['ap'])), 'href' => $href, 'link' => '<a href="' . $href . '">' . $row_board['board_name'] . '</a>', 'act_as_cat' => $row_board['allow_topics'] ? false : true, 'ignored' => $ignoreThisBoard);
            $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['page_link'] = $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['is_page'] ? URL::topic(intval(substr($this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['redirect'], 1)), $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['name'], 0) : '';
            // Counting child board posts is... slow :/.
            if (!empty($boardIndexOptions['countChildPosts']) && !$row_board['is_redirect']) {
                $this_category[$row_board['id_parent']]['posts'] += $row_board['num_posts'];
                $this_category[$row_board['id_parent']]['topics'] += $row_board['num_topics'];
            }
            // Does this board contain new boards?
            $this_category[$row_board['id_parent']]['children_new'] |= empty($row_board['is_read']);
            // This is easier to use in many cases for the theme....
            $this_category[$row_board['id_parent']]['link_children'][] =& $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['link'];
        } elseif (!empty($boardIndexOptions['countChildPosts'])) {
            if (!isset($parent_map)) {
                $parent_map = array();
            }
//.........这里部分代码省略.........
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Subs-BoardIndex.php

示例7: __construct

    function __construct($request, $total_items, $not_profile = false)
    {
        global $context, $txt, $user_info, $scripturl, $options, $memberContext, $modSettings;
        if (!isset($context['pageindex_multiplier'])) {
            $context['pageindex_multiplier'] = commonAPI::getMessagesPerPage();
        }
        $cb_name = isset($context['cb_name']) ? $context['cb_name'] : 'topics[]';
        while ($row = mysql_fetch_assoc($request)) {
            censorText($row['subject']);
            $this->topic_ids[] = $row['id_topic'];
            $f_post_mem_href = !empty($row['id_member']) ? URL::user($row['id_member'], $row['first_member_name']) : '';
            $t_href = URL::topic($row['id_topic'], $row['subject'], 0);
            $l_post_mem_href = !empty($row['id_member_updated']) ? URL::user($row['id_member_updated'], $row['last_real_name']) : '';
            $l_post_msg_href = URL::topic($row['id_topic'], $row['last_subject'], $user_info['is_guest'] ? !empty($options['view_newest_first']) ? 0 : (int) ($row['num_replies'] / $context['pageindex_multiplier']) * $context['pageindex_multiplier'] : 0, $user_info['is_guest'] ? true : false, $user_info['is_guest'] ? '' : '.msg' . $row['id_last_msg'], $user_info['is_guest'] ? '#msg' . $row['id_last_msg'] : '#new');
            $this->topiclist[$row['id_topic']] = array('id' => $row['id_topic'], 'id_member_started' => empty($row['id_member']) ? 0 : $row['id_member'], 'first_post' => array('id' => $row['id_first_msg'], 'member' => array('username' => $row['first_member_name'], 'name' => $row['first_member_name'], 'id' => empty($row['id_member']) ? 0 : $row['id_member'], 'href' => $f_post_mem_href, 'link' => !empty($row['id_member']) ? '<a onclick="getMcard(' . $row['id_member'] . ', $(this));return(false);" href="' . $f_post_mem_href . '" title="' . $txt['profile_of'] . ' ' . $row['first_member_name'] . '">' . $row['first_member_name'] . '</a>' : $row['first_member_name']), 'time' => timeformat($row['first_poster_time']), 'timestamp' => forum_time(true, $row['first_poster_time']), 'subject' => $row['subject'], 'icon' => $row['first_icon'], 'icon_url' => getPostIcon($row['first_icon']), 'href' => $t_href, 'link' => '<a href="' . $t_href . '">' . $row['subject'] . '</a>'), 'last_post' => array('id' => $row['id_last_msg'], 'member' => array('username' => $row['last_real_name'], 'name' => $row['last_real_name'], 'id' => $row['id_member_updated'], 'href' => $l_post_mem_href, 'link' => !empty($row['id_member_updated']) ? '<a onclick="getMcard(' . $row['id_member_updated'] . ', $(this));return(false);" href="' . $l_post_mem_href . '">' . $row['last_real_name'] . '</a>' : $row['last_real_name']), 'time' => timeformat($row['last_post_time']), 'timestamp' => forum_time(true, $row['last_post_time']), 'subject' => $row['last_subject'], 'href' => $l_post_msg_href, 'link' => '<a href="' . $l_post_msg_href . ($row['num_replies'] == 0 ? '' : ' rel="nofollow"') . '>' . $row['last_subject'] . '</a>'), 'checkbox_name' => $cb_name, 'subject' => $row['subject'], 'new' => $row['new_from'] <= $row['id_msg_modified'], 'new_from' => $row['new_from'], 'newtime' => $row['new_from'], 'updated' => timeformat($row['poster_time']), 'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . '#new', 'new_link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . '#new">' . $row['subject'] . '</a>', 'replies' => comma_format($row['num_replies']), 'views' => comma_format($row['num_views']), 'approved' => $row['approved'], 'unapproved_posts' => $row['unapproved_posts'], 'is_old' => !empty($modSettings['oldTopicDays']) ? $context['time_now'] - $row['last_post_time'] > $modSettings['oldTopicDays'] * 86400 : false, 'is_posted_in' => false, 'prefix' => '', 'pages' => '', 'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']), 'is_locked' => !empty($row['locked']), 'is_poll' => false, 'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'], 'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'], 'board' => isset($row['id_board']) && !empty($row['id_board']) ? array('name' => $row['board_name'], 'id' => $row['id_board'], 'href' => URL::board($row['id_board'], $row['board_name'])) : array('name' => '', 'id' => 0, 'href' => ''));
            determineTopicClass($this->topiclist[$row['id_topic']]);
            if (!empty($row['id_member']) && ($row['id_member'] != $user_info['id'] || $not_profile)) {
                $this->users_to_load[$row['id_member']] = $row['id_member'];
            }
        }
        loadMemberData($this->users_to_load);
        foreach ($this->topiclist as &$topic) {
            if (!isset($memberContext[$topic['id_member_started']])) {
                loadMemberContext($topic['id_member_started']);
            }
            $topic['first_post']['member']['avatar'] =& $memberContext[$topic['id_member_started']]['avatar']['image'];
        }
        // figure out whether we have posted in a topic (but only if we are not the topic starter)
        if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($this->topic_ids)) {
            $result = smf_db_query('
				SELECT id_topic
				FROM {db_prefix}messages
				WHERE id_topic IN ({array_int:topic_list})
					AND id_member = {int:current_member}
				GROUP BY id_topic
				LIMIT ' . count($this->topic_ids), array('current_member' => $user_info['id'], 'topic_list' => $this->topic_ids));
            while ($row = mysql_fetch_assoc($result)) {
                if ($this->topiclist[$row['id_topic']]['first_post']['member']['id'] != $user_info['id']) {
                    $this->topiclist[$row['id_topic']]['is_posted_in'] = true;
                }
            }
            mysql_free_result($result);
        }
    }
开发者ID:norv,项目名称:EosAlpha,代码行数:44,代码来源:CommonAPI.php

示例8: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $facebook = $this->consumer ? $this->load_facebook() : false;
        $tabs = array('basic' => '<i class="hidden-sm fa fa-fw fa-user"></i> ' . __('Profile'), 'auth' => '<i class="hidden-sm fa fa-fw fa-key"></i> ' . __('Username & Email'), 'facebook' => '<i class="hidden-sm fa fa-fw fa-facebook"></i> ' . 'Facebook', 'forum' => '<i class="hidden-sm fa fa-fw fa-comments"></i> ' . __('Forum'));
        echo Form::open();
        ?>

<?php 
        if ($this->errors) {
            ?>
<div class="alert alert-danger">
	<strong><?php 
            echo __('Error happens!');
            ?>
</strong>
	<ul>
		<?php 
            foreach ((array) $this->errors as $error) {
                ?>
		<li><?php 
                echo $error;
                ?>
</li>
		<?php 
            }
            ?>
	</ul>
</div>
<?php 
        }
        ?>

<ul class="nav nav-pills nav-stacked col-sm-2">
	<?php 
        foreach ($tabs as $tab => $title) {
            ?>
	<li<?php 
            echo $tab == $this->tab ? ' class="active"' : '';
            ?>
>
		<a href="#settings-<?php 
            echo $tab;
            ?>
" data-toggle="tab"><?php 
            echo $title;
            ?>
</a>
	</li>
	<?php 
        }
        ?>
</ul>

<div class="tab-content col-md-10">

	<div id="settings-basic" class="tab-pane<?php 
        echo $this->tab == 'basic' ? ' active' : '';
        ?>
">
		<fieldset id="fields-basic" class="col-sm-6">

			<div class="row">
			<div class="col-sm-10">
				<?php 
        echo Form::input_wrap('avatar', $this->user->avatar_url, null, __('Avatar'), Arr::get($this->errors, 'avatar'));
        ?>
			</div>
			<div class="col-sm-2">
				<?php 
        echo HTML::avatar($this->user->avatar_url, null, null, false);
        ?>
			</div>
			</div>


			<?php 
        echo Form::input_wrap('name', $this->user->name, null, __('Name'), Arr::get($this->errors, 'name'));
        ?>

			<?php 
        echo Form::radios_wrap('name_visibility', array(Model_User::NAME_VISIBLE => __('Visible'), Model_User::NAME_HIDDEN => __('Hidden')), $this->user->setting('user.name'), null, null, null, null, true);
        ?>

			<?php 
        echo Form::input_wrap('homepage', $this->user->homepage, null, __('Homepage'), Arr::get($this->errors, 'homepage'));
        ?>

			<?php 
        echo Form::radios_wrap('gender', array('f' => '<i class="fa fa-female female"></i> ' . __('Female'), 'm' => '<i class="fa fa-male male"></i> ' . __('Male'), 'o' => __('Other')), $this->user->gender, null, __('Gender'), Arr::get($this->errors, 'gender'), null, true);
        ?>

			<?php 
        echo Form::input_wrap('dob', $this->user->dob ? Date::format('DMYYYY', $this->user->dob) : null, array('class' => 'date', 'maxlength' => 10, 'size' => 7, 'placeholder' => 'd.m.yyyy'), __('Date of Birth'), Arr::get($this->errors, 'dob'));
        ?>
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:anqh,代码行数:101,代码来源:settings.php

示例9: defined

defined('SYSPATH') or die('No direct access allowed.');
/**
 * Image
 *
 * @package    Galleries
 * @author     Antti Qvickström
 * @copyright  (c) 2010-2011 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
$approve = isset($approve) && !is_null($approve) ? 'approve' : '';
$note_array = array();
if (count($notes)) {
    foreach ($notes as $noted) {
        $noted_user = $noted->user();
        $note_array[] = array('id' => (int) $noted->id, 'x' => (int) $noted->x, 'y' => (int) $noted->y, 'width' => (int) $noted->width, 'height' => (int) $noted->height, 'name' => $noted_user ? $noted_user['username'] : $noted->name, 'url' => $noted_user ? URL::base() . URL::user($noted_user) : null);
    }
}
?>

<nav>

	<?php 
if ($previous) {
    ?>
	<?php 
    echo HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id($gallery), 'id' => $previous->id, 'action' => $approve)), '&laquo; ' . __('Previous'), array('title' => __('Previous image'), 'class' => 'prev'));
    ?>
	<?php 
} else {
    ?>
开发者ID:anqh,项目名称:galleries,代码行数:30,代码来源:image.php

示例10: _prepare_user

 /**
  * Prepare user for data array
  *
  * @param   Model_User  $user
  * @param   array       $fields
  * @return  array
  */
 protected function _prepare_user(Model_User $user, array $fields = null)
 {
     $data = array();
     empty($fields) and $fields = self::$_fields;
     foreach ($fields as $field) {
         switch ($field) {
             // Raw value
             case 'id':
             case 'username':
             case 'homepage':
             case 'gender':
             case 'description':
             case 'logins':
             case 'posts':
             case 'adds':
             case 'signature':
             case 'title':
             case 'dob':
             case 'latitude':
             case 'longitude':
             case 'created':
             case 'modified':
             case 'last_login':
                 $data[$field] = $user->{$field};
                 break;
                 // Custom value
             // Custom value
             case 'city':
                 $data[$field] = ($city = $user->city()) ? $city->name : $user->city_name;
                 break;
             case 'avatar':
                 $data[$field] = $user->avatar ? URL::site($user->avatar, true) : URL::site('avatar/unknown.png');
                 break;
             case 'picture':
                 if ($user->default_image_id) {
                     $image = new Model_Image($user->default_image_id);
                     $data[$field] = $image->loaded() ? $image->get_url() : '';
                 } else {
                     if (Valid::url($user->picture)) {
                         $data[$field] = URL::site($user->picture, true);
                     } else {
                         $data[$field] = null;
                     }
                 }
                 break;
             case 'url':
                 $data[$field] = URL::site(URL::user($user), true);
                 break;
         }
     }
     return $data;
 }
开发者ID:anqh,项目名称:core,代码行数:59,代码来源:api.php

示例11: content

    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        echo Form::open(null, array('class' => 'row'));
        ?>

<div class="span4">
	<fieldset id="fields-basic">
		<legend><?php 
        echo __('Basic information');
        ?>
</legend>

		<?php 
        echo Form::control_group(Form::input('name', $this->user->name, array('class' => 'input-large')), array('name' => __('Name')), Arr::get($this->errors, 'name'));
        ?>

		<?php 
        echo Form::control_group(Form::input('email', $this->user->email, array('class' => 'input-large')), array('email' => __('Email')), Arr::get($this->errors, 'email'));
        ?>

		<?php 
        echo Form::control_group(Form::input('homepage', $this->user->homepage, array('class' => 'input-large')), array('homepage' => __('Homepage')), Arr::get($this->errors, 'homepage'));
        ?>

		<?php 
        echo Form::radios_wrap('gender', array('f' => __('Female'), 'm' => __('Male')), $this->user, null, __('Gender'), $this->errors);
        ?>

		<?php 
        echo Form::control_group(Form::input('dob', Date::format('DMYYYY', $this->user->dob), array('class' => 'date input-small', 'maxlengt' => 10, 'placeholder' => __('d.m.yyyy'))), array('dob' => __('Date of Birth')), Arr::get($this->errors, 'dob'));
        ?>

		<?php 
        echo Form::control_group(Form::input('title', $this->user->title, array('class' => 'input-large')), array('title' => __('Title')), Arr::get($this->errors, 'title'));
        ?>

		<?php 
        echo Form::control_group(Form::textarea('description', $this->user->description, array('class' => 'input-large', 'rows' => 3), true), array('description' => __('Description')), Arr::get($this->errors, 'description'));
        ?>

	</fieldset>
</div>

<div class="span4">
	<fieldset id="fields-contact">
		<legend><?php 
        echo __('Contact information');
        ?>
</legend>

		<?php 
        echo Form::control_group(Form::input('address_street', $this->user->address_street), array('address_street' => __('Street address')), Arr::get($this->errors, 'address_street'));
        ?>

		<?php 
        echo Form::control_group(Form::input('address_zip', $this->user->address_zip), array('address_zip' => __('Zip code')), Arr::get($this->errors, 'address_zip'));
        ?>

		<?php 
        echo Form::control_group(Form::input('address_city', $this->user->address_city), array('address_city' => __('City')), Arr::get($this->errors, 'address_city'));
        ?>

	</fieldset>

	<fieldset id="fields-forum">
		<legend><?php 
        echo __('Forum settings');
        ?>
</legend>

		<?php 
        echo Form::control_group(Form::textarea('signature', $this->user->signature, array('class' => 'input-large', 'rows' => 5), true), array('signature' => __('Signature')), Arr::get($this->errors, 'signature'));
        ?>

	</fieldset>
</div>

<fieldset class="span8 form-actions">
	<?php 
        echo Form::hidden('latitude', $this->user->latitude);
        ?>
	<?php 
        echo Form::hidden('longitude', $this->user->longitude);
        ?>

	<?php 
        echo Form::csrf();
        ?>
	<?php 
        echo Form::button('save', __('Save'), array('type' => 'submit', 'class' => 'btn btn-success btn-large'));
        ?>
	<?php 
        echo HTML::anchor(URL::user($this->user), __('Cancel'), array('class' => 'cancel'));
        ?>
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:core,代码行数:101,代码来源:settings.php

示例12: action_redirect

 /**
  * Action: Redirected from 3rd party.
  */
 public function action_redirect()
 {
     $provider = $this->consumer->get_provider();
     if ($provider != 'facebook') {
         // Unsupported provider
         $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(__('We are not entirely sure what 3rd party service redirected you here'), __('Failed to load your profile :('), View_Alert::ERROR));
         Kohana::$log->add(Log::NOTICE, 'OAuth2: Unsupported provider: :provider', array(':provider' => $provider));
         return;
     }
     if ($response = Arr::get($_REQUEST, OAuth2::RESPONSE_TYPE_CODE)) {
         // Code received, change it to access token
         try {
             $token = $this->consumer->request_token(array(OAuth2::RESPONSE_TYPE_CODE => $response));
             if (Visitor::$user) {
                 // Already logged in
                 $external = Model_User_External::factory()->find_by_user_id(Visitor::$user->id, $provider);
                 if ($this->_update_token($external, $token)) {
                     // Already paired with local user
                     $this->request->redirect(URL::user(Visitor::$user, 'settings'));
                     //Request::back();
                 } else {
                     // Not paired with local user, do so
                     if ($response = $this->consumer->api_call('/me', array('fields' => 'id,email'))) {
                         // Received a response from 3rd party
                         if ($error = Arr::get($response, 'error')) {
                             // .. but it was an error
                             $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(__('They said ":error"', array(':error' => HTML::chars($error->message))), __('Failed to load your profile :('), View_Alert::ERROR));
                             Kohana::$log->add(Log::NOTICE, 'OAuth2: Failed to load Facebook profile: :error', array(':error' => $error->message));
                         } else {
                             // Received required information
                             $external = new Model_User_External();
                             $external->set_fields(array('token' => $token['access_token'], 'user_id' => Visitor::$user->id, 'external_user_id' => Arr::get($response, 'id'), 'created' => time(), 'expires' => time() + (int) $token['expires'], 'provider' => $provider));
                             $external->save();
                             $this->request->redirect(URL::user(Visitor::$user, 'settings'));
                             //Request::back();
                         }
                     } else {
                         // No data received, this should be handled by exceptions
                     }
                 }
             } else {
                 // No signed in user available
                 if ($response = $this->consumer->api_call('/me')) {
                     // Received a response from 3rd party
                     if ($error = Arr::get($response, 'error')) {
                         // .. but it was an error
                         $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(__('They said ":error"', array(':error' => HTML::chars($error->message))), __('Failed to load your profile :('), View_Alert::ERROR));
                         Kohana::$log->add(Log::NOTICE, 'OAuth2: Failed to load Facebook profile: :error', array(':error' => $error->message));
                     } else {
                         // Received required information
                         $external_user_id = Arr::get($response, 'id');
                         $external = Model_User_External::factory()->find_by_external_user_id($external_user_id, $provider);
                         if ($this->_update_token($external, $token)) {
                             // Already paired with local user, login
                             Kohana::$log->add(Log::DEBUG, 'OAuth2: Attempting to login :external_user_id => :user_id', array(':external_user_id' => $external->external_user_id, ':user_id' => $external->user_id));
                             if ($this->_login($external)) {
                                 Request::back();
                             }
                             Kohana::$log->add(Log::WARNING, 'OAuth2: Login failed');
                         } else {
                             // Not paired with a local user, check if we have unpaired user available
                             $email = Arr::get($response, 'email');
                             // Store external user id in session data, token should be stored in OAuth2
                             Session::instance()->set('oauth2.' . $provider . '.id', $external_user_id);
                             if ($user = Model_User::find_user($email)) {
                                 // User with same email found, ask to sign in
                                 Kohana::$log->add(Log::DEBUG, 'OAuth2: Existing user with same email found');
                                 $this->view->add(View_Page::COLUMN_CENTER, $this->section_signin($user, $response));
                             } else {
                                 // No user with same email found, start registering
                                 Kohana::$log->add(Log::DEBUG, 'OAuth2: Starting new user registration');
                                 Session::instance()->set('oauth2.' . $provider . '.response', $response);
                                 $this->request->redirect(Route::url('sign', array('action' => 'up')) . '?provider=' . $provider);
                             }
                         }
                     }
                 } else {
                     // No data received, this should be handled by exceptions
                 }
             }
         } catch (OAuth2_Exception_InvalidGrant $e) {
             $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(HTML::chars($e->getMessage()), __('Failed to load your profile :('), View_Alert::ERROR));
             Kohana::$log->add(Log::NOTICE, 'OAuth2: Invalid grant: :error', array(':error' => $e->getMessage()));
         } catch (Kohana_Exception $e) {
             $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(HTML::chars($e->getMessage()), __('Failed to load your profile :('), View_Alert::ERROR));
             Kohana::$log->add(Log::NOTICE, 'OAuth2: Exception: :error', array(':error' => $e->getMessage()));
         }
     } else {
         $this->view->add(View_Page::COLUMN_CENTER, new View_Alert(__('Did not receive required code from 3rd party'), __('Failed to load your profile :('), View_Alert::ERROR));
         Kohana::$log->add(Log::NOTICE, 'OAuth2: No code received');
     }
 }
开发者ID:anqh,项目名称:anqh,代码行数:95,代码来源:oauth.php

示例13: __

	<fieldset>
		<?php 
echo Form::hidden('city_id', (int) $user->geo_city_id);
?>
		<?php 
echo Form::hidden('latitude', $user->latitude);
?>
		<?php 
echo Form::hidden('longitude', $user->longitude);
?>

		<?php 
echo Form::csrf();
?>
		<?php 
echo Form::submit_wrap('save', __('Save'), null, URL::user($user));
?>
	</fieldset>

<?php 
echo Form::close();
// Date picker
$options = array('changeMonth' => true, 'changeYear' => true, 'dateFormat' => 'd.m.yy', 'defaultDate' => date('j.n.Y', $user->dob), 'dayNames' => array(__('Sunday'), __('Monday'), __('Tuesday'), __('Wednesday'), __('Thursday'), __('Friday'), __('Saturday')), 'dayNamesMin' => array(__('Su'), __('Mo'), __('Tu'), __('We'), __('Th'), __('Fr'), __('Sa')), 'firstDay' => 1, 'monthNames' => array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'), __('September'), __('October'), __('November'), __('December')), 'monthNamesShort' => array(__('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'), __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec')), 'nextText' => __('&raquo;'), 'prevText' => __('&laquo;'), 'showWeek' => true, 'showOtherMonths' => true, 'weekHeader' => __('Wk'), 'yearRange' => '1900:+0');
echo HTML::script_source('

// Date picker
head.ready("jquery-ui", function() {
	$("#field-dob").datepicker(' . json_encode($options) . ');
});

// Maps
开发者ID:anqh,项目名称:core,代码行数:31,代码来源:settings.php

示例14: tabs

 /**
  * Get tabs.
  *
  * @return  array
  */
 public function tabs()
 {
     return array(array('selected' => !$this->friended, 'tab' => HTML::anchor(URL::user($this->user, 'friends'), __('My friends'))), array('selected' => $this->friended, 'tab' => HTML::anchor(URL::user($this->user, 'friends') . '?of=me', __('Friending me'))));
 }
开发者ID:anqh,项目名称:anqh,代码行数:9,代码来源:friends.php

示例15: prepareSearchContext

function prepareSearchContext($reset = false)
{
    global $txt, $modSettings, $scripturl, $user_info, $sourcedir;
    global $memberContext, $context, $options, $messages_request;
    global $boards_can, $participants, $output;
    // Remember which message this is.  (ie. reply #83)
    static $counter = null;
    if ($counter == null || $reset) {
        $counter = $_REQUEST['start'] + 1;
    }
    // If the query returned false, bail.
    if ($messages_request == false) {
        return false;
    }
    // Start from the beginning...
    if ($reset) {
        return @mysql_data_seek($messages_request, 0);
    }
    // Attempt to get the next message.
    $message = mysql_fetch_assoc($messages_request);
    if (!$message) {
        return false;
    }
    // Can't have an empty subject can we?
    $message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
    $message['first_subject'] = $message['first_subject'] != '' ? $message['first_subject'] : $txt['no_subject'];
    $message['last_subject'] = $message['last_subject'] != '' ? $message['last_subject'] : $txt['no_subject'];
    // If it couldn't load, or the user was a guest.... someday may be done with a guest table.
    if (!loadMemberContext($message['id_member'])) {
        // Notice this information isn't used anywhere else.... *cough guest table cough*.
        $memberContext[$message['id_member']]['name'] = $message['poster_name'];
        $memberContext[$message['id_member']]['id'] = 0;
        $memberContext[$message['id_member']]['group'] = $txt['guest_title'];
        $memberContext[$message['id_member']]['link'] = $message['poster_name'];
        $memberContext[$message['id_member']]['email'] = $message['poster_email'];
    }
    $memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
    // Do the censor thang...
    censorText($message['body']);
    censorText($message['subject']);
    censorText($message['first_subject']);
    censorText($message['last_subject']);
    // Shorten this message if necessary.
    if ($context['compact']) {
        // Set the number of characters before and after the searched keyword.
        $charLimit = 50;
        $message['body'] = strtr($message['body'], array("\n" => ' ', '<br />' => "\n"));
        $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
        $message['body'] = strip_tags(strtr($message['body'], array('</div>' => '<br />', '</li>' => '<br />')), '<br>');
        if (commonAPI::strlen($message['body']) > $charLimit) {
            if (empty($context['key_words'])) {
                $message['body'] = commonAPI::substr($message['body'], 0, $charLimit) . '<strong>...</strong>';
            } else {
                $matchString = '';
                $force_partial_word = false;
                foreach ($context['key_words'] as $keyword) {
                    $keyword = preg_replace('~&amp;#(\\d{1,7}|x[0-9a-fA-F]{1,6});~e', 'commonAPI::entity_fix(\'\\1\')', strtr($keyword, array('\\\'' => '\'', '&' => '&amp;')));
                    if (preg_match('~[\'\\.,/@%&;:(){}\\[\\]_\\-+\\\\]$~', $keyword) != 0 || preg_match('~^[\'\\.,/@%&;:(){}\\[\\]_\\-+\\\\]~', $keyword) != 0) {
                        $force_partial_word = true;
                    }
                    $matchString .= strtr(preg_quote($keyword, '/'), array('\\*' => '.+?')) . '|';
                }
                $matchString = substr($matchString, 0, -1);
                $message['body'] = un_htmlspecialchars(strtr($message['body'], array('&nbsp;' => ' ', '<br />' => "\n", '&#91;' => '[', '&#93;' => ']', '&#58;' => ':', '&#64;' => '@')));
                if (empty($modSettings['search_method']) || $force_partial_word) {
                    preg_match_all('/([^\\s\\W]{' . $charLimit . '}[\\s\\W]|[\\s\\W].{0,' . $charLimit . '}?|^)(' . $matchString . ')(.{0,' . $charLimit . '}[\\s\\W]|[^\\s\\W]{' . $charLimit . '})/isu', $message['body'], $matches);
                } else {
                    preg_match_all('/([^\\s\\W]{' . $charLimit . '}[\\s\\W]|[\\s\\W].{0,' . $charLimit . '}?[\\s\\W]|^)(' . $matchString . ')([\\s\\W].{0,' . $charLimit . '}[\\s\\W]|[\\s\\W][^\\s\\W]{' . $charLimit . '})/isu', $message['body'], $matches);
                }
                $message['body'] = '';
                foreach ($matches[0] as $index => $match) {
                    $match = strtr(htmlspecialchars($match, ENT_QUOTES), array("\n" => '&nbsp;'));
                    $message['body'] .= '<strong>......</strong>&nbsp;' . $match . '&nbsp;<strong>......</strong>';
                }
            }
            // Re-fix the international characters.
            $message['body'] = preg_replace('~&amp;#(\\d{1,7}|x[0-9a-fA-F]{1,6});~e', 'commonAPI::entity_fix(\'\\1\')', $message['body']);
        }
    } else {
        // Run BBC interpreter on the message.
        $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
    }
    // Make sure we don't end up with a practically empty message body.
    $message['body'] = preg_replace('~^(?:&nbsp;)+$~', '', $message['body']);
    // Do we have quote tag enabled?
    $quote_enabled = empty($modSettings['disabledBBC']) || !in_array('quote', explode(',', $modSettings['disabledBBC']));
    $href = URL::topic($message['id_topic'], $message['first_subject'], 0);
    $mhref = URL::user($message['first_member_id'], $message['first_member_name']);
    $lhref = URL::topic($message['id_topic'], $message['last_subject'], 0, $message['num_replies'] == 0 ? true : false, $message['num_replies'] == 0 ? '' : '.msg' . $message['last_msg'], $message['num_replies'] == 0 ? '' : '#msg' . $message['last_msg']);
    $lmhref = URL::user($message['last_member_id'], $message['last_member_name']);
    $bhref = URL::board($message['id_board'], $message['board_name'], 0, true);
    $output = array_merge($context['topics'][$message['id_msg']], array('id' => $message['id_topic'], 'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($message['is_sticky']), 'is_locked' => !empty($message['locked']), 'is_poll' => $modSettings['pollMode'] == '1' && $message['id_poll'] > 0, 'is_hot' => $message['num_replies'] >= $modSettings['hotTopicPosts'], 'is_very_hot' => $message['num_replies'] >= $modSettings['hotTopicVeryPosts'], 'posted_in' => !empty($participants[$message['id_topic']]), 'views' => $message['num_views'], 'replies' => $message['num_replies'], 'can_reply' => in_array($message['id_board'], $boards_can['post_reply_any']) || in_array(0, $boards_can['post_reply_any']), 'can_quote' => (in_array($message['id_board'], $boards_can['post_reply_any']) || in_array(0, $boards_can['post_reply_any'])) && $quote_enabled, 'can_mark_notify' => in_array($message['id_board'], $boards_can['mark_any_notify']) || in_array(0, $boards_can['mark_any_notify']) && !$context['user']['is_guest'], 'first_post' => array('id' => $message['first_msg'], 'time' => timeformat($message['first_poster_time']), 'timestamp' => forum_time(true, $message['first_poster_time']), 'subject' => $message['first_subject'], 'href' => $href, 'link' => '<a href="' . $href . '">' . $message['first_subject'] . '</a>', 'icon' => $message['first_icon'], 'icon_url' => getPostIcon($message['first_icon']), 'member' => array('id' => $message['first_member_id'], 'name' => $message['first_member_name'], 'href' => !empty($message['first_member_id']) ? $mhref : '', 'link' => !empty($message['first_member_id']) ? '<a href="' . $mhref . '" title="' . $txt['profile_of'] . ' ' . $message['first_member_name'] . '">' . $message['first_member_name'] . '</a>' : $message['first_member_name'])), 'last_post' => array('id' => $message['last_msg'], 'time' => timeformat($message['last_poster_time']), 'timestamp' => forum_time(true, $message['last_poster_time']), 'subject' => $message['last_subject'], 'href' => $lhref, 'link' => '<a href="' . $lhref . '">' . $message['last_subject'] . '</a>', 'icon' => $message['last_icon'], 'icon_url' => getPostIcon($message['last_icon']), 'member' => array('id' => $message['last_member_id'], 'name' => $message['last_member_name'], 'href' => !empty($message['last_member_id']) ? $lmhref : '', 'link' => !empty($message['last_member_id']) ? '<a href="' . $lmhref . '" title="' . $txt['profile_of'] . ' ' . $message['last_member_name'] . '">' . $message['last_member_name'] . '</a>' : $message['last_member_name'])), 'board' => array('id' => $message['id_board'], 'name' => $message['board_name'], 'href' => $bhref, 'link' => '<a href="' . $bhref . '">' . $message['board_name'] . '</a>'), 'category' => array('id' => $message['id_cat'], 'name' => $message['cat_name'], 'href' => $scripturl . '#c' . $message['id_cat'], 'link' => '<a href="' . $scripturl . '#c' . $message['id_cat'] . '">' . $message['cat_name'] . '</a>')));
    determineTopicClass($output);
    if ($output['posted_in']) {
        $output['class'] = 'my_' . $output['class'];
    }
    $body_highlighted = $message['body'];
    $subject_highlighted = $message['subject'];
    if (!empty($options['display_quick_mod'])) {
        $started = $output['first_post']['member']['id'] == $user_info['id'];
//.........这里部分代码省略.........
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Search.php


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