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


PHP shorten_subject函数代码示例

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


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

示例1: boardindex

 public static function boardindex()
 {
     global $context, $txt, $sourcedir, $user_info;
     $data = array();
     if (($data = CacheAPI::getCache('github-feed-index', 1800)) === null) {
         $f = curl_init();
         if ($f) {
             curl_setopt_array($f, array(CURLOPT_URL => self::$my_git_api_url, CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false));
             $json_response = curl_exec($f);
             $data = json_decode($json_response, true);
             CacheAPI::putCache('github-feed-index', $data, 1800);
             curl_close($f);
         }
     }
     $n = 0;
     foreach ($data as $commit) {
         if (is_array($commit) && isset($commit['commit'])) {
             $context['gitfeed'][] = array('message_short' => shorten_subject($commit['commit']['message'], 60), 'message' => nl2br($commit['commit']['message']), 'dateline' => timeformat(strtotime($commit['commit']['committer']['date'])), 'sha' => $commit['sha'], 'href' => self::$my_git_url . 'commit/' . $commit['sha']);
         }
         if (++$n > 5) {
             break;
         }
     }
     if (!empty($data)) {
         /* 
          * add our plugin directory to the list of directories to search for templates
          * and register the template hook.
          * only do this if we actually have something to display
          */
         EoS_Smarty::addTemplateDir(dirname(__FILE__));
         EoS_Smarty::getConfigInstance()->registerHookTemplate('sidebar_below_userblock', 'gitfeed_sidebar_top');
         $context['gitfeed_global']['see_all']['href'] = self::$my_git_url . 'commits/master';
         $context['gitfeed_global']['see_all']['txt'] = 'Browse all commits';
     }
 }
开发者ID:norv,项目名称:EosAlpha,代码行数:35,代码来源:main.php

示例2: getLastPost

function getLastPost()
{
    global $user_info, $scripturl, $modSettings, $smcFunc;
    // Find it by the board - better to order by board than sort the entire messages table.
    $request = $smcFunc['db_query']('substring', '
		SELECT ml.poster_time, ml.subject, ml.id_topic, ml.poster_name, SUBSTRING(ml.body, 1, 385) AS body,
			ml.smileys_enabled
		FROM {db_prefix}boards AS b
			INNER JOIN {db_prefix}messages AS ml ON (ml.id_msg = b.id_last_msg)
		WHERE {query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND ml.approved = {int:is_approved}
		ORDER BY b.id_msg_updated DESC
		LIMIT 1', array('recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    if ($smcFunc['db_num_rows']($request) == 0) {
        return array();
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Censor the subject and post...
    censorText($row['subject']);
    censorText($row['body']);
    $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled']), array('<br />' => '&#10;')));
    if ($smcFunc['strlen']($row['body']) > 128) {
        $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
    }
    // Send the data.
    return array('topic' => $row['id_topic'], 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.new;topicseen#new">' . $row['subject'] . '</a>');
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:29,代码来源:Recent.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 = $smcFunc['db_query']('substring', '
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
			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)
			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();
    $context['MemberColor_ID_MEMBER'] = array();
    while ($row = $smcFunc['db_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 ($smcFunc['strlen']($row['body']) > 128) {
            $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
        }
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:' . $modSettings['MemberColorGuests'] . ';">' : '') . $row['poster_name'] . (!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['poster_name'] . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>');
        //The Last Posters id for the MemberColor.
        if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['id_member'])) {
            $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Know set the colors for the Recent posts...
    if (!empty($context['MemberColor_ID_MEMBER'])) {
        $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
        //So Let's Color The Recent Posts ;)
        if (!empty($modSettings['MemberColorRecentLastPost']) && is_array($posts)) {
            foreach ($posts as $postkey => $postid_memcolor) {
                if (!empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link'])) {
                    $posts[$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
                }
            }
        }
    }
    return $posts;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:53,代码来源:Subs-Recent.php

示例4: getLastPosts

function getLastPosts($showlatestcount)
{
    global $scripturl, $txt, $db_prefix, $user_info, $modSettings, $func;
    // 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 = db_query("\n\t\tSELECT\n\t\t\tm.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG,\n\t\t\tIFNULL(mem.realName, m.posterName) AS posterName, t.ID_BOARD, b.name AS bName,\n\t\t\tLEFT(m.body, 384) AS body, m.smileysEnabled\n\t\tFROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_MSG >= " . max(0, $modSettings['maxMsgID'] - 20 * $showlatestcount) . "\n\t\t\tAND t.ID_TOPIC = m.ID_TOPIC\n\t\t\tAND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "\n\t\t\tAND b.ID_BOARD != {$modSettings['recycle_board']}" : '') . "\n\t\t\tAND {$user_info['query_see_board']}\n\t\tORDER BY m.ID_MSG DESC\n\t\tLIMIT {$showlatestcount}", __FILE__, __LINE__);
    $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['smileysEnabled'], $row['ID_MSG']), array('<br />' => '&#10;')));
        if ($func['strlen']($row['body']) > 128) {
            $row['body'] = $func['substr']($row['body'], 0, 128) . '...';
        }
        // Build the array.
        $posts[] = array('board' => array('id' => $row['ID_BOARD'], 'name' => $row['bName'], 'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'), 'topic' => $row['ID_TOPIC'], 'poster' => array('id' => $row['ID_MEMBER'], 'name' => $row['posterName'], 'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'], 'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['posterTime']), 'timestamp' => forum_time(true, $row['posterTime']), 'raw_timestamp' => $row['posterTime'], 'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#msg' . $row['ID_MSG'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>');
    }
    mysql_free_result($request);
    return $posts;
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:21,代码来源:Recent.php

示例5: 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

示例6: ShowDrafts

/**
 * Loads in a group of drafts for the user of a given type (0/posts, 1/pm's)
 * loads a specific draft for forum use if selected.
 * Used in the posting screens to allow draft selection
 * WIll load a draft if selected is supplied via post
 *
 * @param type $member_id
 * @param type $topic
 * @param type $draft_type
 * @return boolean
 */
function ShowDrafts($member_id, $topic = false, $draft_type = 0)
{
    global $smcFunc, $scripturl, $context, $txt, $modSettings;
    // Permissions
    if ($draft_type === 0 && empty($context['drafts_save']) || $draft_type === 1 && empty($context['drafts_pm_save']) || empty($member_id)) {
        return false;
    }
    $context['drafts'] = array();
    // has a specific draft has been selected?  Load it up if there is not a message already in the editor
    if (isset($_REQUEST['id_draft']) && empty($_POST['subject']) && empty($_POST['message'])) {
        ReadDraft((int) $_REQUEST['id_draft'], $draft_type, true, true);
    }
    // load the drafts this user has available
    $request = $smcFunc['db_query']('', '
		SELECT *
		FROM {db_prefix}user_drafts
		WHERE id_member = {int:id_member}' . (!empty($topic) && empty($draft_type) ? '
			AND id_topic = {int:id_topic}' : (!empty($topic) ? '
			AND id_reply = {int:id_topic}' : '')) . '
			AND type = {int:draft_type}' . (!empty($modSettings['drafts_keep_days']) ? '
			AND poster_time > {int:time}' : '') . '
		ORDER BY poster_time DESC', array('id_member' => $member_id, 'id_topic' => (int) $topic, 'draft_type' => $draft_type, 'time' => !empty($modSettings['drafts_keep_days']) ? time() - $modSettings['drafts_keep_days'] * 86400 : 0));
    // add them to the draft array for display
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Post drafts
        if ($draft_type === 0) {
            $context['drafts'][] = array('subject' => censorText(shorten_subject(stripslashes($row['subject']), 24)), 'poster_time' => timeformat($row['poster_time']), 'link' => '<a href="' . $scripturl . '?action=post;board=' . $row['id_board'] . ';' . (!empty($row['id_topic']) ? 'topic=' . $row['id_topic'] . '.0;' : '') . 'id_draft=' . $row['id_draft'] . '">' . $row['subject'] . '</a>');
        } elseif ($draft_type === 1) {
            $context['drafts'][] = array('subject' => censorText(shorten_subject(stripslashes($row['subject']), 24)), 'poster_time' => timeformat($row['poster_time']), 'link' => '<a href="' . $scripturl . '?action=pm;sa=send;id_draft=' . $row['id_draft'] . '">' . (!empty($row['subject']) ? $row['subject'] : $txt['drafts_none']) . '</a>');
        }
    }
    $smcFunc['db_free_result']($request);
}
开发者ID:albertlast,项目名称:SMF2.1,代码行数:44,代码来源:Drafts.php

示例7: getBoardIndex


//.........这里部分代码省略.........
            }
            // 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;
                $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'], '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' => $scripturl . '?board=' . $row_board['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>');
            }
            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;
            $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'], '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'], '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' => $scripturl . '?board=' . $row_board['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>');
            // 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();
            }
            if (!isset($parent_map[$row_board['id_parent']])) {
                foreach ($this_category as $id => $board) {
                    if (!isset($board['children'][$row_board['id_parent']])) {
                        continue;
                    }
                    $parent_map[$row_board['id_parent']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
                    $parent_map[$row_board['id_board']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['id_parent']]);
                    break;
                }
            }
            if (isset($parent_map[$row_board['id_parent']]) && !$row_board['is_redirect']) {
                $parent_map[$row_board['id_parent']][0]['posts'] += $row_board['num_posts'];
                $parent_map[$row_board['id_parent']][0]['topics'] += $row_board['num_topics'];
                $parent_map[$row_board['id_parent']][1]['posts'] += $row_board['num_posts'];
                $parent_map[$row_board['id_parent']][1]['topics'] += $row_board['num_topics'];
                continue;
            }
            continue;
        } else {
            continue;
        }
        // Prepare the subject, and make sure it's not too long.
        censorText($row_board['subject']);
        $row_board['short_subject'] = shorten_subject($row_board['subject'], 24);
        $this_last_post = array('id' => $row_board['id_msg'], 'time' => $row_board['poster_time'] > 0 ? timeformat($row_board['poster_time']) : $txt['not_applicable'], 'timestamp' => forum_time(true, $row_board['poster_time']), 'subject' => $row_board['short_subject'], 'member' => array('id' => $row_board['id_member'], 'username' => $row_board['poster_name'] != '' ? $row_board['poster_name'] : $txt['not_applicable'], 'name' => $row_board['real_name'], 'href' => $row_board['poster_name'] != '' && !empty($row_board['id_member']) ? $scripturl . '?action=profile;u=' . $row_board['id_member'] : '', 'link' => $row_board['poster_name'] != '' ? !empty($row_board['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['id_member'] . '">' . $row_board['real_name'] . '</a>' : $row_board['real_name'] : $txt['not_applicable']), 'start' => 'msg' . $row_board['new_from'], 'topic' => $row_board['id_topic']);
        // Provide the href and link.
        if ($row_board['subject'] != '') {
            $this_last_post['href'] = $scripturl . '?topic=' . $row_board['id_topic'] . '.msg' . ($user_info['is_guest'] ? $row_board['id_msg'] : $row_board['new_from']) . (empty($row_board['is_read']) ? ';boardseen' : '') . '#new';
            $this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>';
        } else {
            $this_last_post['href'] = '';
            $this_last_post['link'] = $txt['not_applicable'];
        }
        // Set the last post in the parent board.
        if ($row_board['id_parent'] == $boardIndexOptions['parent_id'] || $isChild && !empty($row_board['poster_time']) && $this_category[$row_board['id_parent']]['last_post']['timestamp'] < forum_time(true, $row_board['poster_time'])) {
            $this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post'] = $this_last_post;
        }
        // Just in the child...?
        if ($isChild) {
            $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['last_post'] = $this_last_post;
            // If there are no posts in this board, it really can't be new...
            $this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['new'] &= $row_board['poster_name'] != '';
        } elseif ($row_board['poster_name'] == '') {
            $this_category[$row_board['id_board']]['new'] = false;
        }
        // Determine a global most recent topic.
        if (!empty($boardIndexOptions['set_latest_post']) && !empty($row_board['poster_time']) && $row_board['poster_time'] > $latest_post['timestamp'] && !$ignoreThisBoard) {
            $latest_post = array('timestamp' => $row_board['poster_time'], 'ref' => &$this_category[$isChild ? $row_board['id_parent'] : $row_board['id_board']]['last_post']);
        }
    }
    $smcFunc['db_free_result']($result_boards);
    // By now we should know the most recent post...if we wanna know it that is.
    if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref'])) {
        $context['latest_post'] = $latest_post['ref'];
    }
    return $boardIndexOptions['include_categories'] ? $categories : $this_category;
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:101,代码来源:Subs-BoardIndex.php

示例8: template_boardindex_outer_below

function template_boardindex_outer_below()
{
    global $modSettings;
    // Info center collapse object.
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; overflow:hidden;">
				', empty($modSettings['sideright1']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>' . $modSettings['sideright1'] . '', '
				', empty($modSettings['siderightphp']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
        eval($modSettings['siderightphp']);
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								
								<h3><a href="', $news['href'], '"><span class="generic_icons sort_up"></span> ', shorten_subject($news['subject'], 30), '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '</td>
		</tr></tbody></table>';
    template_info_center();
}
开发者ID:CeeMoo,项目名称:pisi,代码行数:41,代码来源:BoardIndex.template.php

示例9: adk_ultimosmensajes

function adk_ultimosmensajes()
{
    global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
    global $modSettings, $smcFunc, $adkportal, $boardurl, $adkFolder;
    //SSI FUNCTION
    $exclude_boards = null;
    $include_boards = null;
    $num_recent = !empty($adkportal['adk_two_column']) ? $adkportal['ultimos_mensajes'] * 2 : $adkportal['ultimos_mensajes'];
    $output_method = 'array';
    if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
        $exclude_boards = array($modSettings['recycle_board']);
    } else {
        $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
    }
    // Only some boards?.
    if (is_array($include_boards) || (int) $include_boards === $include_boards) {
        $include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
    } elseif ($include_boards != null) {
        $output_method = $include_boards;
        $include_boards = array();
    }
    $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
    $icon_sources = array();
    foreach ($stable_icons as $icon) {
        $icon_sources[$icon] = 'images_url';
    }
    // Find all the posts in distinct topics.  Newer ones will have higher IDs.
    $request = $smcFunc['db_query']('substring', '
		SELECT
			m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
			mem.avatar,
			mg.online_color,
			IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
		FROM {db_prefix}topics AS t
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			INNER JOIN {db_prefix}messages AS ms ON (ms.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_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
			LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
			LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
			LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:reg_mem_group} THEN mem.id_post_group ELSE mem.id_group END)
		WHERE t.id_last_msg >= {int:min_message_id}
			' . (empty($exclude_boards) ? '' : '
			AND b.id_board NOT IN ({array_int:exclude_boards})') . '
			' . (empty($include_boards) ? '' : '
			AND b.id_board IN ({array_int:include_boards})') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY t.id_last_msg DESC
		LIMIT ' . $num_recent, array('current_member' => $user_info['id'], 'include_boards' => empty($include_boards) ? '' : $include_boards, 'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards, 'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5), 'is_approved' => 1, 'reg_mem_group' => 0));
    $posts = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if ($smcFunc['strlen']($row['body']) > 128) {
            $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
        }
        // Censor the subject.
        censorText($row['subject']);
        censorText($row['body']);
        if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']])) {
            $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';
        }
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'avatar' => $row['avatar'] == '' ? $row['id_attach'] > 0 ? '<img width="50" height="50" src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" border="0" />' : '' : (stristr($row['avatar'], 'http://') ? '<img width="50" height="50" src="' . $row['avatar'] . '" alt="" border="0" />' : '<img width="50" height="50" src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar']) . '" alt="" border="0" />'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? '<b>' . $row['poster_name'] . '</b>' : '<a style="color: ' . $row['online_color'] . '; font-weight: bold;" href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'), 'online_color' => $row['online_color'], 'subject' => $row['subject'], 'replies' => $row['num_replies'], 'views' => $row['num_views'], 'short_subject' => shorten_subject($row['subject'], 25), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>', 'new' => !empty($row['is_read']), 'is_new' => empty($row['is_read']), 'new_from' => $row['new_from'], 'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />');
    }
    $smcFunc['db_free_result']($request);
    echo '
		<table style="width: 100%;">';
    if (!empty($adkportal['adk_two_column'])) {
        $i = 0;
        echo '
			<tr>';
    }
    if (!empty($posts)) {
        $u = 1;
        $totales = count($posts);
        foreach ($posts as $Output) {
            $ID_TOPIC = $Output['topic'];
            $subject = $Output['subject'];
            $posterTime = !empty($adkportal['adk_two_column']) ? timeformat($Output['timestamp'], '%d/%m - %H:%M:%S') : $Output['time'];
            $id_member = $Output['poster']['id'];
            $href_last = $Output['href'];
            if ($id_member == 0) {
                $MEMBER_STARTED = $Output['poster']['link'];
                $avatar = '<img src="' . $adkFolder['images'] . '/noavatar.jpg" class="adk_avatar" alt="" />';
            } else {
                $MEMBER_STARTED = $Output['poster']['link'];
                if (!empty($Output['avatar'])) {
                    $avatar = $Output['avatar'];
                } else {
                    $avatar = '<img src="' . $adkFolder['images'] . '/noavatar.jpg" class="adk_avatar" alt="" />';
                }
            }
            if (!empty($adkportal['adk_two_column'])) {
                if ($i == 2) {
//.........这里部分代码省略.........
开发者ID:lucasruroken,项目名称:adkportal,代码行数:101,代码来源:Subs-adkblocks.php

示例10: tp_recentTopics

function tp_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
{
    global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
    global $modSettings, $smcFunc;
    if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
        $exclude_boards = array($modSettings['recycle_board']);
    } else {
        $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));
    }
    // Only some boards?.
    if (is_array($include_boards) || (int) $include_boards === $include_boards) {
        $include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
    } elseif ($include_boards != null) {
        $output_method = $include_boards;
        $include_boards = array();
    }
    // Find all the posts in distinct topics.  Newer ones will have higher IDs.
    $request = $smcFunc['db_query']('substring', '
		SELECT
			m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon,
			IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType,  mem.avatar as avy
		FROM {db_prefix}topics AS t
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			INNER JOIN {db_prefix}messages AS ms ON (ms.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_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
			LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
			LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)

		WHERE t.id_last_msg >= {int:min_message_id}
			' . (empty($exclude_boards) ? '' : '
			AND b.id_board NOT IN ({array_int:exclude_boards})') . '

			' . (empty($include_boards) ? '' : '
			AND b.id_board IN ({array_int:include_boards})') . '

			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '

		ORDER BY t.id_last_msg DESC
		LIMIT ' . $num_recent, array('current_member' => $user_info['id'], 'include_boards' => empty($include_boards) ? '' : $include_boards, 'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards, 'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5), 'is_approved' => 1));
    $posts = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if ($smcFunc['strlen']($row['body']) > 128) {
            $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
        }
        // Censor the subject.
        censorText($row['subject']);
        censorText($row['body']);
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>', 'avatar' => $row['avy'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="recent_avatar" border="0" />' : '' : (stristr($row['avy'], 'http://') ? '<img src="' . $row['avy'] . '" alt="" class="recent_avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avy'], ENT_QUOTES) . '" alt="" class="recent_avatar" border="0" />')), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 25), 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>', 'new' => !empty($row['is_read']), 'is_new' => empty($row['is_read']), 'new_from' => $row['new_from']);
    }
    $smcFunc['db_free_result']($request);
    return $posts;
}
开发者ID:DiegoCortes,项目名称:TinyPortal,代码行数:61,代码来源:TPSubs.php

示例11: ssi_getSDTickets

/**
 *	Gets tickets based on supplied criteria; this is a helper function not really intended to be called directly.
 *
 *	@todo Finish writing and documenting this function.
 *	@param string $query_where SQL clauses to be supplied to the query in addition to {query_see_ticket} - note 'AND' is not required at the start.
 *	@param array $query_where_params Key/value associative array to be injected into the query, related to $query_where.
 *	@param int $query_limit Number of items to limit the query to.
 *	@param string $query_order The clause to order tickets by, defaults to tickets by order of creation.
 *	@return array An array of arrays, each primary item containing the following:
 *	<ul>
 *	<li>id: Main ticket id</li>
 *	<li>display_id: Formatted ticket id in [0000x] format</li>
 *	<li>subject: Ticket subject</li>
 *	<li>short_subject: Shortened version of ticket subject</li>
 *	<li>href: Ticket href</li>
 *	<li>opener: array of details about the ticket starter:
 *		<ul>
 *			<li>id: user id of the person who opened the ticket</li>
 *			<li>name: username of the person who opened the ticket</li>
 *			<li>link: link to the profile of the person who opened the ticket</li>
 *		</ul>
 *	</li>
 *	<li>replier: array of details about the last person to reply to the ticket:
 *		<ul>
 *			<li>id: user id of the last person to reply to the ticket</li>
 *			<li>name: username of the last person to reply to the ticket</li>
 *			<li>link: link to the profile of the last person to reply to the ticket</li>
 *		</ul>
 *	</li>
 *	<li>assigned: array of details about the person who the ticket is assigned to:
 *		<ul>
 *			<li>id: user id of the person who the ticket is assigned to</li>
 *			<li>name: username of the person who the ticket is assigned to or 'Unassigned' otherwise</li>
 *			<li>link: link to the profile of the person  who the ticket is assigned to or 'Unassigned' otherwise</li>
 *		</ul>
 *	</li>
 *	<li>num_replies: Number of replies in the ticket</li>
 *	<li>start_time: Formatted string of time the ticket was opened</li>
 *	<li>start_timestamp: Raw timestamp (adjusted for timezones) of ticket being opened</li>
 *	<li>last_time: Formatted string of time the ticket was last replied to</li>
 *	<li>last_timestamp: Raw timestamp (adjusted for timezones) of ticket's last reply</li>
 *	<li>private: Whether the ticket is private or not</li>
 *	<li>urgency_id: Number representing ticket urgency</li>
 *	<li>urgency_string: String representing ticket urgency</li>
 *	<li>status_id: Number representing ticket status</li>
 *	<li>status_text: String representing ticket status</li>
 *  <li>department: Number representing ticket department ID</li>
 *	</ul>
 *	@since 2.0
*/
function ssi_getSDTickets($query_where, $query_where_params = array(), $query_limit = 0, $query_order = 'hdt.id_ticket ASC', $output_method = 'echo')
{
    global $smcFunc, $scripturl, $txt, $modSettings;
    $query_limit = (int) $query_limit;
    $query = shd_db_query('', '
		SELECT hdt.id_ticket, hdt.subject, hdt.num_replies, hdt.private, hdt.urgency, hdt.status, hdt.dept,
			hdtr_first.poster_time AS start_time, hdt.last_updated AS last_time,
			IFNULL(mem.real_name, hdtr_first.poster_name) AS starter_name, IFNULL(mem.id_member, 0) AS starter_id,
			IFNULL(ma.real_name, 0) AS assigned_name, IFNULL(ma.id_member, 0) AS assigned_id,
			IFNULL(mm.real_name, hdtr_last.modified_name) AS modified_name, IFNULL(mm.id_member, 0) AS modified_id
		FROM {db_prefix}helpdesk_tickets AS hdt
			INNER JOIN {db_prefix}helpdesk_ticket_replies AS hdtr_first ON (hdt.id_first_msg = hdtr_first.id_msg)
			INNER JOIN {db_prefix}helpdesk_ticket_replies AS hdtr_last ON (hdt.id_last_msg = hdtr_last.id_msg)
			LEFT JOIN {db_prefix}members AS mem ON (hdt.id_member_started = mem.id_member)
			LEFT JOIN {db_prefix}members AS ma ON (hdt.id_member_assigned = ma.id_member)
			LEFT JOIN {db_prefix}members AS mm ON (hdt.id_member_updated = mm.id_member)
		WHERE {query_see_ticket} AND ' . $query_where . '
		ORDER BY ' . $query_order . '
		' . ($query_limit == 0 ? '' : 'LIMIT ' . $query_limit), array_merge($query_where_params, array()));
    $tickets = array();
    while ($row = $smcFunc['db_fetch_assoc']($query)) {
        censorText($row['subject']);
        $tickets[] = array('id' => $row['id_ticket'], 'display_id' => str_pad($row['id_ticket'], $modSettings['shd_zerofill'], '0', STR_PAD_LEFT), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 25), 'href' => $scripturl . '?action=helpdesk;sa=ticket;ticket=' . $row['id_ticket'], 'opener' => array('id' => $row['starter_id'], 'name' => $row['starter_name'], 'link' => shd_profile_link($row['starter_name'], $row['starter_id'])), 'replier' => array('id' => $row['modified_id'], 'name' => $row['modified_name'], 'link' => shd_profile_link($row['modified_name'], $row['modified_id'])), 'assigned' => array('id' => $row['assigned_id'], 'name' => empty($row['assigned_name']) ? $txt['shd_unassigned'] : $row['assigned_name'], 'link' => empty($row['assigned_name']) ? '<span class="error">' . $txt['shd_unassigned'] . '</span>' : shd_profile_link($row['assigned_name'], $row['assigned_id'])), 'start_time' => timeformat($row['start_time']), 'start_timestamp' => forum_time(true, $row['start_time']), 'last_time' => timeformat($row['last_time']), 'last_timestamp' => forum_time(true, $row['last_time']), 'num_replies' => $row['num_replies'], 'private' => !empty($row['private']), 'urgency_id' => $row['urgency'], 'urgency_string' => $txt['shd_urgency_' . $row['urgency']], 'status_id' => $row['status'], 'status_text' => $txt['shd_status_' . $row['status']], 'department' => $row['dept']);
    }
    $smcFunc['db_free_result']($query);
    if (empty($tickets) || $output_method != 'echo') {
        return $tickets;
    }
    // output this stuff
    echo '
		<table border="0" class="ssi_table">';
    foreach ($tickets as $ticket) {
        echo '
			<tr>
				<td align="right" valign="top" nowrap="nowrap">
					[', $ticket['status_text'], ']
				</td>
				<td valign="top">
					<a href="', $ticket['href'], '">', $ticket['subject'], '</a>
					', $txt['by'], ' ', $ticket['replier']['link'], '
				</td>
				<td align="right" nowrap="nowrap">
					', $ticket['last_time'], '
				</td>
			</tr>';
    }
    echo '
		</table>';
}
开发者ID:wintstar,项目名称:Testing,代码行数:99,代码来源:SimpleDesk-SSI.php

示例12: BoardIndex

function BoardIndex()
{
    global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
    global $modSettings, $context, $settings;
    // For wireless, we use the Wireless template...
    if (WIRELESS) {
        $context['sub_template'] = WIRELESS_PROTOCOL . '_boardindex';
    } else {
        loadTemplate('BoardIndex');
    }
    // Remember the most recent topic for optimizing the recent posts feature.
    $most_recent_topic = array('timestamp' => 0, 'ref' => null);
    // 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 = db_query("\n\t\tSELECT\n\t\t\tc.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.description,\n\t\t\tb.numPosts, b.numTopics, b.ID_PARENT, IFNULL(m.posterTime, 0) AS posterTime,\n\t\t\tIFNULL(mem.memberName, m.posterName) AS posterName, m.subject, m.ID_TOPIC,\n\t\t\tIFNULL(mem.realName, m.posterName) AS realName," . ($user_info['is_guest'] ? "\n\t\t\t1 AS isRead, 0 AS new_from" : "\n\t\t\t(IFNULL(lb.ID_MSG, 0) >= b.ID_MSG_UPDATED) AS isRead, IFNULL(lb.ID_MSG, -1) + 1 AS new_from,\n\t\t\tc.canCollapse, IFNULL(cc.ID_MEMBER, 0) AS isCollapsed") . ",\n\t\t\tIFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, m.ID_MSG,\n\t\t\tIFNULL(mods_mem.ID_MEMBER, 0) AS ID_MODERATOR, mods_mem.realName AS modRealName\n\t\tFROM {$db_prefix}boards AS b\n\t\t\tLEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)\n\t\t\tLEFT JOIN {$db_prefix}messages AS m ON (m.ID_MSG = b.ID_LAST_MSG)\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "\n\t\t\tLEFT JOIN {$db_prefix}log_boards AS lb ON (lb.ID_BOARD = b.ID_BOARD AND lb.ID_MEMBER = {$ID_MEMBER})\n\t\t\tLEFT JOIN {$db_prefix}collapsed_categories AS cc ON (cc.ID_CAT = c.ID_CAT AND cc.ID_MEMBER = {$ID_MEMBER})" : '') . "\n\t\t\tLEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = b.ID_BOARD)\n\t\t\tLEFT JOIN {$db_prefix}members AS mods_mem ON (mods_mem.ID_MEMBER = mods.ID_MEMBER)\n\t\tWHERE {$user_info['query_see_board']}" . (empty($modSettings['countChildPosts']) ? "\n\t\t\tAND b.childLevel <= 1" : ''), __FILE__, __LINE__);
    // Run through the categories and boards....
    $context['categories'] = array();
    while ($row_board = mysql_fetch_assoc($result_boards)) {
        // Haven't set this category yet.
        if (empty($context['categories'][$row_board['ID_CAT']])) {
            $context['categories'][$row_board['ID_CAT']] = array('id' => $row_board['ID_CAT'], 'name' => $row_board['catName'], 'is_collapsed' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1 && $row_board['isCollapsed'] > 0, 'can_collapse' => isset($row_board['canCollapse']) && $row_board['canCollapse'] == 1, 'collapse_href' => isset($row_board['canCollapse']) ? $scripturl . '?action=collapse;c=' . $row_board['ID_CAT'] . ';sa=' . ($row_board['isCollapsed'] > 0 ? 'expand' : 'collapse;') . '#' . $row_board['ID_CAT'] : '', 'collapse_image' => isset($row_board['canCollapse']) ? '<img src="' . $settings['images_url'] . '/' . ($row_board['isCollapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' border="0" />' : '', 'href' => $scripturl . '#' . $row_board['ID_CAT'], 'boards' => array(), 'new' => false);
            $context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
        }
        // 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']) {
            $context['categories'][$row_board['ID_CAT']]['new'] |= empty($row_board['isRead']) && $row_board['posterName'] != '';
        }
        // Collapsed category - don't do any of this.
        if ($context['categories'][$row_board['ID_CAT']]['is_collapsed']) {
            continue;
        }
        // Let's save some typing.  Climbing the array might be slower, anyhow.
        $this_category =& $context['categories'][$row_board['ID_CAT']]['boards'];
        // This is a parent board.
        if (empty($row_board['ID_PARENT'])) {
            // Is this a new board, or just another moderator?
            if (!isset($this_category[$row_board['ID_BOARD']])) {
                // Not a child.
                $isChild = false;
                $this_category[$row_board['ID_BOARD']] = array('new' => empty($row_board['isRead']), 'id' => $row_board['ID_BOARD'], 'name' => $row_board['boardName'], 'description' => $row_board['description'], 'moderators' => array(), 'link_moderators' => array(), 'children' => array(), 'link_children' => array(), 'children_new' => false, 'topics' => $row_board['numTopics'], 'posts' => $row_board['numPosts'], 'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>');
            }
            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['modRealName'], 'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</a>');
                $this_category[$row_board['ID_BOARD']]['link_moderators'][] = '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row_board['modRealName'] . '</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;
            $this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array('id' => $row_board['ID_BOARD'], 'name' => $row_board['boardName'], 'description' => $row_board['description'], 'new' => empty($row_board['isRead']) && $row_board['posterName'] != '', 'topics' => $row_board['numTopics'], 'posts' => $row_board['numPosts'], 'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['boardName'] . '</a>');
            // Counting child board posts is... slow :/.
            if (!empty($modSettings['countChildPosts'])) {
                $this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts'];
                $this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics'];
            }
            // Does this board contain new boards?
            $this_category[$row_board['ID_PARENT']]['children_new'] |= empty($row_board['isRead']);
            // 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($modSettings['countChildPosts'])) {
            if (!isset($parent_map)) {
                $parent_map = array();
            }
            if (!isset($parent_map[$row_board['ID_PARENT']])) {
                foreach ($this_category as $id => $board) {
                    if (!isset($board['children'][$row_board['ID_PARENT']])) {
                        continue;
                    }
                    $parent_map[$row_board['ID_PARENT']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);
                    $parent_map[$row_board['ID_BOARD']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]);
                    break;
                }
            }
            if (isset($parent_map[$row_board['ID_PARENT']])) {
                $parent_map[$row_board['ID_PARENT']][0]['posts'] += $row_board['numPosts'];
                $parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics'];
                $parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts'];
                $parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics'];
                continue;
            }
            continue;
        } else {
            continue;
        }
        // Prepare the subject, and make sure it's not too long.
        censorText($row_board['subject']);
        $row_board['short_subject'] = shorten_subject($row_board['subject'], 24);
        $this_last_post = array('id' => $row_board['ID_MSG'], 'time' => $row_board['posterTime'] > 0 ? timeformat($row_board['posterTime']) : $txt[470], 'timestamp' => forum_time(true, $row_board['posterTime']), 'subject' => $row_board['short_subject'], 'member' => array('id' => $row_board['ID_MEMBER'], 'username' => $row_board['posterName'] != '' ? $row_board['posterName'] : $txt[470], 'name' => $row_board['realName'], 'href' => $row_board['posterName'] != '' && !empty($row_board['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] : '', 'link' => $row_board['posterName'] != '' ? !empty($row_board['ID_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] . '">' . $row_board['realName'] . '</a>' : $row_board['realName'] : $txt[470]), 'start' => 'msg' . $row_board['new_from'], 'topic' => $row_board['ID_TOPIC']);
        // Provide the href and link.
        if ($row_board['subject'] != '') {
            $this_last_post['href'] = $scripturl . '?topic=' . $row_board['ID_TOPIC'] . '.msg' . ($user_info['is_guest'] ? $modSettings['maxMsgID'] : $row_board['new_from']) . (empty($row_board['isRead']) ? ';boardseen' : '') . '#new';
            $this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>';
        } else {
            $this_last_post['href'] = '';
            $this_last_post['link'] = $txt[470];
        }
        // Set the last post in the parent board.
        if (empty($row_board['ID_PARENT']) || $isChild && !empty($row_board['posterTime']) && $this_category[$row_board['ID_PARENT']]['last_post']['timestamp'] < forum_time(true, $row_board['posterTime'])) {
            $this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'] = $this_last_post;
        }
        // Just in the child...?
        if ($isChild) {
//.........这里部分代码省略.........
开发者ID:alencarmo,项目名称:OCF,代码行数:101,代码来源:BoardIndex.php

示例13: tp_recentTopics

function tp_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = 'echo')
{
    global $context, $scripturl, $user_info, $modSettings, $smcFunc;
    if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) {
        $exclude_boards = array($modSettings['recycle_board']);
    } else {
        $exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;
    }
    // !!!
    // Why the use of SMF 1.0/1.1 naming scheme?
    // Find all the posts in distinct topics.  Newer ones will have higher IDs.
    $request = $smcFunc['db_query']('', '
		SELECT
			m.poster_time as posterTime, ms.subject, m.id_topic as ID_TOPIC, m.id_member as ID_MEMBER, m.id_msg as ID_MSG, b.id_board as ID_BOARD, b.name AS bName,
			IFNULL(mem.real_name, m.poster_name) AS posterName, ' . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS isRead,
			IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', 
			IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType,  mem.avatar as avy
		FROM ({db_prefix}messages AS m, {db_prefix}topics AS t, {db_prefix}boards AS b, {db_prefix}messages AS ms)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
			LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = ' . $context['user']['id'] . ')
			LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = ' . $context['user']['id'] . ')' : '') . '
			LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member)
		WHERE t.id_last_msg >= ' . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . '
			AND t.id_last_msg = m.id_msg
			AND b.id_board = t.id_board' . (empty($exclude_boards) ? '' : '
			AND b.id_board NOT IN ({string:exclude})') . '
			AND {query_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
			AND ms.id_msg = t.id_first_msg
		ORDER BY t.id_last_msg DESC
		LIMIT {int:num_recent}', array('exclude' => implode(', ', $exclude_boards), 'num_recent' => $num_recent, 'is_approved' => 1));
    $posts = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject.
        censorText($row['subject']);
        // Build the array.
        $posts[] = array('board' => array('id' => $row['ID_BOARD'], 'name' => $row['bName'], 'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'), 'topic' => $row['ID_TOPIC'], 'poster' => array('id' => $row['ID_MEMBER'], 'name' => $row['posterName'], 'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'], 'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>', 'avatar' => $row['avy'] == '' ? $row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="recent_avatar" border="0" />' : '' : (stristr($row['avy'], 'http://') ? '<img src="' . $row['avy'] . '" alt="" class="recent_avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avy'], ENT_QUOTES) . '" alt="" class="recent_avatar" border="0" />')), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 25), 'time' => timeformat($row['posterTime']), 'timestamp' => forum_time(true, $row['posterTime']), 'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new', 'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>', 'new' => !empty($row['isRead']), 'new_from' => $row['new_from']);
    }
    $smcFunc['db_free_result']($request);
    return $posts;
}
开发者ID:rhodefey,项目名称:TinyPortal,代码行数:43,代码来源:TPSubs.php

示例14: Who

function Who()
{
    global $context, $scripturl, $user_info, $txt, $modSettings, $memberContext, $sourcedir;
    // Permissions, permissions, permissions.
    isAllowedTo('who_view');
    require_once $sourcedir . '/lib/Subs-MembersOnline.php';
    $context['sef_full_rewrite'] = true;
    // You can't do anything if this is off.
    if (empty($modSettings['who_enabled'])) {
        fatal_lang_error('who_off', false);
    }
    // Load the 'Who' template.
    //loadTemplate('Who');
    loadLanguage('Who');
    EoS_Smarty::loadTemplate('who');
    // Sort out... the column sorting.
    $sort_methods = array('user' => 'mem.real_name', 'time' => 'lo.log_time');
    $show_methods = array('members' => '(lo.id_member != 0)', 'guests' => '(lo.id_member = 0)', 'all' => '1=1');
    // Store the sort methods and the show types for use in the template.
    $context['sort_methods'] = array('user' => $txt['who_user'], 'time' => $txt['who_time']);
    $context['show_methods'] = array('all' => $txt['who_show_all'], 'members' => $txt['who_show_members_only'], 'guests' => $txt['who_show_guests_only']);
    // Can they see spiders too?
    if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) {
        $show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
        $show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
        $context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
    }
    // Does the user prefer a different sort direction?
    if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = $_SESSION['who_online_sort_by'] = $_REQUEST['sort'];
        $sort_method = $sort_methods[$_REQUEST['sort']];
    } elseif (isset($_SESSION['who_online_sort_by'])) {
        $context['sort_by'] = $_SESSION['who_online_sort_by'];
        $sort_method = $sort_methods[$_SESSION['who_online_sort_by']];
    } else {
        $context['sort_by'] = $_SESSION['who_online_sort_by'] = 'time';
        $sort_method = 'lo.log_time';
    }
    $context['sort_direction'] = isset($_REQUEST['asc']) || isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc' ? 'up' : 'down';
    $conditions = array();
    if (!allowedTo('moderate_forum')) {
        $conditions[] = '(IFNULL(mem.show_online, 1) = 1)';
    }
    // Fallback to top filter?
    if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) {
        $_REQUEST['show'] = $_REQUEST['show_top'];
    }
    // Does the user wish to apply a filter?
    if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) {
        $context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
        $conditions[] = $show_methods[$_REQUEST['show']];
    } elseif (isset($_SESSION['who_online_filter'])) {
        $context['show_by'] = $_SESSION['who_online_filter'];
        $conditions[] = $show_methods[$_SESSION['who_online_filter']];
    } else {
        $context['show_by'] = $_SESSION['who_online_filter'] = 'all';
    }
    // Get the total amount of members online.
    $request = smf_db_query('
		SELECT COUNT(*)
		FROM {db_prefix}log_online AS lo
			LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)' . (!empty($conditions) ? '
		WHERE ' . implode(' AND ', $conditions) : ''), array());
    list($totalMembers) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Prepare some page index variables.
    $context['page_index'] = constructPageIndex($scripturl . '?action=who;sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';asc' : '') . ';show=' . $context['show_by'], $_REQUEST['start'], $totalMembers, $modSettings['defaultMaxMembers']);
    $context['start'] = $_REQUEST['start'];
    // Look for people online, provided they don't mind if you see they are.
    $request = smf_db_query('
		SELECT
			lo.log_time, lo.id_member, lo.url, INET_NTOA(lo.ip) AS ip, mem.real_name,
			lo.session, mg.online_color, IFNULL(mem.show_online, 1) AS show_online,
			lo.id_spider
		FROM {db_prefix}log_online AS lo
			LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)
			LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_member} THEN mem.id_post_group ELSE mem.id_group END)' . (!empty($conditions) ? '
		WHERE ' . implode(' AND ', $conditions) : '') . '
		ORDER BY {raw:sort_method} {raw:sort_direction}
		LIMIT {int:offset}, {int:limit}', array('regular_member' => 0, 'sort_method' => $sort_method, 'sort_direction' => $context['sort_direction'] == 'up' ? 'ASC' : 'DESC', 'offset' => $context['start'], 'limit' => $modSettings['defaultMaxMembers']));
    $context['members'] = array();
    $member_ids = array();
    $url_data = array();
    while ($row = mysql_fetch_assoc($request)) {
        $actions = @unserialize($row['url']);
        if ($actions === false) {
            continue;
        }
        // Send the information to the template.
        $context['members'][$row['session']] = array('id' => $row['id_member'], 'ip' => allowedTo('moderate_forum') ? $row['ip'] : '', 'time' => strtr(timeformat($row['log_time']), array($txt['today'] => '', $txt['yesterday'] => '')), 'timestamp' => forum_time(true, $row['log_time']), 'query' => $actions, 'is_hidden' => $row['show_online'] == 0, 'id_spider' => $row['id_spider'], 'id_unique' => base64_encode($row['session']), 'color' => empty($row['online_color']) ? '' : $row['online_color']);
        $url = @unserialize($row['url']);
        $context['members'][$row['session']]['user_agent'] = isset($url['USER_AGENT']) ? $url['USER_AGENT'] : '';
        $context['members'][$row['session']]['user_agent_short'] = isset($url['USER_AGENT']) ? shorten_subject(substr($url['USER_AGENT'], 0, strpos($url['USER_AGENT'], ' ')), 25) : '';
        $url_data[$row['session']] = array($row['url'], $row['id_member']);
        $member_ids[] = $row['id_member'];
    }
    mysql_free_result($request);
    // Load the user data for these members.
    loadMemberData($member_ids);
    // Load up the guest user.
//.........这里部分代码省略.........
开发者ID:norv,项目名称:EosAlpha,代码行数:101,代码来源:Who.php

示例15: template_body_above

function template_body_above()
{
    global $context, $settings, $scripturl, $txt, $modSettings;
    // Wrapper div now echoes permanently for better layout options. h1 a is now target for "Go up" links.
    echo '
	<div id="ust">
		<div class="frame">';
    // If the user is logged in, display some things that might be useful.
    if ($context['user']['is_logged']) {
        // Firstly, the user's menu
        echo '
			<ul class="floatleft" id="top_info">
				<li>
					<a href="', $scripturl, '?action=profile"', !empty($context['self_profile']) ? ' class="active"' : '', ' id="profile_menu_top" onclick="return false;">';
        if (!empty($context['user']['avatar'])) {
            echo $context['user']['avatar']['image'];
        }
        echo $context['user']['name'], ' &#9660;</a>
					<div id="profile_menu" class="top_menu"></div>
				</li>';
        // Secondly, PMs if we're doing them
        if ($context['allow_pm']) {
            echo '
				<li>
					<a href="', $scripturl, '?action=pm"', !empty($context['self_pm']) ? ' class="active"' : '', ' id="pm_menu_top">', $txt['pm_short'], !empty($context['user']['unread_messages']) ? ' <span class="amt">' . $context['user']['unread_messages'] . '</span>' : '', '</a>
					<div id="pm_menu" class="top_menu scrollable"></div>
				</li>';
        }
        // Thirdly, alerts
        echo '
				<li>
					<a href="', $scripturl, '?action=profile;area=showalerts;u=', $context['user']['id'], '"', !empty($context['self_alerts']) ? ' class="active"' : '', ' id="alerts_menu_top">', $txt['alerts'], !empty($context['user']['alerts']) ? ' <span class="amt">' . $context['user']['alerts'] . '</span>' : '', '</a>
					<div id="alerts_menu" class="top_menu scrollable"></div>
				</li>';
        // And now we're done.
        echo '
			</ul>';
    } else {
        echo '
			<ul class="floatleft welcome">
				<li>', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $context['forum_name_html_safe'], $scripturl . '?action=login', 'return reqOverlayDiv(this.href, ' . JavaScriptEscape($txt['login']) . ');', $scripturl . '?action=signup'), '</li>
			</ul>';
    }
    // Show a random news item? (or you could pick one from news_lines...)
    if (!empty($settings['enable_news']) && !empty($context['random_news_line'])) {
        echo '
					<div class="news">
						<h2>', $txt['news'], ': </h2>
						<p>', $context['random_news_line'], '</p>
					</div>';
    }
    global $db_prefix, $scripturl, $smcFunc;
    $request = $smcFunc['db_query']('', "SELECT f.ID_FILE, f.ID_MEMBER, f.date, f.ID_CAT, f.totaldownloads, f.title AS ftitle,\n\t  c.title, m.real_Name, m.ID_MEMBER AS mID_MEMBER\n\t  FROM {$db_prefix}down_file AS f, {$db_prefix}down_cat AS c, {$db_prefix}members AS m\n\t  WHERE f.ID_CAT = '7'\n\t  AND f.approved = '1'\n\t  AND f.ID_MEMBER = m.ID_MEMBER\n\t  ORDER BY RAND()\n\t  LIMIT 1");
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        echo '
		  <div class="solborder rightla"><a href="', $scripturl, '?action=downloads;sa=view;id=', $row['ID_FILE'], '" title="', $row['ftitle'], '">' . shorten_subject($row['ftitle'], 30) . '</a></div>';
    }
    echo '
		</div>
	</div>';
    echo '
	<div class="menuyeri">
	<div id="mcolor" class="floatright">
			<a class="mor" href="', $scripturl, '?variant=mor" title=""></a>
			<a class="red" href="', $scripturl, '?variant=red" title=""></a>
			<a class="blue" href="', $scripturl, '?variant=blue" title=""></a>
			<a class="green" href="', $scripturl, '?variant=green" title=""></a>
			<a class="orange" href="', $scripturl, '?variant=orange" title=""></a>	
			<a class="black" href="', $scripturl, '?variant=black" title=""></a>
    </div>
		<div class="frame">
			<a href="', $scripturl, '" title="Smf Destek"><img id="logos" src="' . $settings['images_url'] . '/theme/logo.png" alt="smfdestek" title="Smf Destek"></a>';
    template_menu();
    if ($context['allow_search']) {
        echo '
			<form id="aramaz" class="floatright" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
				<input type="search" name="search" value="" class="aramaz">&nbsp;';
        // Search within current topic?
        if (!empty($context['current_topic'])) {
            echo '
				<input type="hidden" name="sd_topic" value="', $context['current_topic'], '">';
        } elseif (!empty($context['current_board'])) {
            echo '
				<input type="hidden" name="sd_brd[', $context['current_board'], ']" value="', $context['current_board'], '">';
        }
        echo '
			</form>';
    }
    echo '
		  </div>
	</div>';
    echo '
	<div id="wrapper">
			<div id="inner_section">';
    // Show the menu here, according to the menu sub template, followed by the navigation tree.
    theme_linktree();
    echo '
		</div>';
    // The main content should go here.
}
开发者ID:CeeMoo,项目名称:pisi,代码行数:100,代码来源:index.template.php


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