?> " class="blockpost<?php echo $count % 2 == 0 ? ' roweven' : ' rowodd'; ?> "> <div class="box roweven"> <div class="inbox"> <div class="postbody"> <div class="postleft"> <dl> <dt><strong><?php echo $msg['poster']; ?> </strong></dt> <dd><span><?php echo Utils::format_time($msg['sent']); ?> </span></dd> </dl> </div> <div class="postright"> <div class="postmsg"> <p><?php echo Utils::escape($msg['message']); ?> </p> </div> </div> </div> <div class="clearer"></div> </div>
<fieldset> <legend><?php _e('User activity'); ?> </legend> <div class="infldset"> <p><?php printf(__('Registered info'), Utils::format_time($user['registered'], true) . (User::get()->is_admmod ? ' (<a href="' . Router::pathFor('usersIpShow', ['ip' => $user['registration_ip']]) . '">' . Utils::escape($user['registration_ip']) . '</a>)' : '')); ?> </p> <p><?php printf(__('Last post info'), Utils::format_time($user['last_post'])); ?> </p> <p><?php printf(__('Last visit info'), Utils::format_time($user['last_visit'])); ?> </p> <?php echo $user_disp['posts_field']; if (User::get()->is_admmod) { ?> <label><?php _e('Admin note'); ?> <br /> <input id="admin_note" type="text" name="admin_note" value="<?php echo Utils::escape($user['admin_note']); ?> " size="30" maxlength="30" /><br /></label> <?php
?> </strong></dd> </dl> </div> <div class="postright"> <h3 class="nosize"><?php _e('Message'); ?> </h3> <div class="postmsg"> <?php echo $post['message'] . "\n"; ?> <?php if ($post['edited'] != '') { echo "\t\t\t\t\t\t" . '<p class="postedit"><em>' . __('Last edit') . ' ' . Utils::escape($post['edited_by']) . ' (' . Utils::format_time($post['edited']) . ')</em></p>' . "\n"; } ?> </div> </div> </div> </div> <div class="inbox"> <div class="postfoot clearb"> <div class="postfootright"><?php echo $post['id'] != $cur_topic['first_post_id'] ? '<p class="multidelete"><label><strong>' . __('Select') . '</strong> <input type="checkbox" name="posts[' . $post['id'] . ']" value="1" /></label></p>' : '<p>' . __('Cannot select first') . '</p>'; ?> </div> </div> </div> </div>
public function parse_user_info($user) { $user_info = array(); $user_info = Container::get('hooks')->fire('model.profile.parse_user_info_start', $user_info, $user); $user_info['personal'][] = '<dt>' . __('Username') . '</dt>'; $user_info['personal'][] = '<dd>' . Utils::escape($user['username']) . '</dd>'; $user_title_field = Utils::get_title($user); $user_info['personal'][] = '<dt>' . __('Title') . '</dt>'; $user_info['personal'][] = '<dd>' . (ForumSettings::get('o_censoring') == '1' ? Utils::censor($user_title_field) : $user_title_field) . '</dd>'; if ($user['realname'] != '') { $user_info['personal'][] = '<dt>' . __('Realname') . '</dt>'; $user_info['personal'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['realname']) : $user['realname']) . '</dd>'; } if ($user['location'] != '') { $user_info['personal'][] = '<dt>' . __('Location') . '</dt>'; $user_info['personal'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['location']) : $user['location']) . '</dd>'; } if ($user['url'] != '') { $user['url'] = Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['url']) : $user['url']); $user_info['personal'][] = '<dt>' . __('Website') . '</dt>'; $user_info['personal'][] = '<dd><span class="website"><a href="' . $user['url'] . '" rel="nofollow">' . $user['url'] . '</a></span></dd>'; } if ($user['email_setting'] == '0' && !User::get()->is_guest && User::get()->g_send_email == '1') { $user['email_field'] = '<a href="mailto:' . Utils::escape($user['email']) . '">' . Utils::escape($user['email']) . '</a>'; } elseif ($user['email_setting'] == '1' && !User::get()->is_guest && User::get()->g_send_email == '1') { $user['email_field'] = '<a href="' . Router::pathFor('email', ['id' => $user['id']]) . '">' . __('Send email') . '</a>'; } else { $user['email_field'] = ''; } if ($user['email_field'] != '') { $user_info['personal'][] = '<dt>' . __('Email') . '</dt>'; $user_info['personal'][] = '<dd><span class="email">' . $user['email_field'] . '</span></dd>'; } if ($user['jabber'] != '') { $user_info['messaging'][] = '<dt>' . __('Jabber') . '</dt>'; $user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['jabber']) : $user['jabber']) . '</dd>'; } if ($user['icq'] != '') { $user_info['messaging'][] = '<dt>' . __('ICQ') . '</dt>'; $user_info['messaging'][] = '<dd>' . $user['icq'] . '</dd>'; } if ($user['msn'] != '') { $user_info['messaging'][] = '<dt>' . __('MSN') . '</dt>'; $user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['msn']) : $user['msn']) . '</dd>'; } if ($user['aim'] != '') { $user_info['messaging'][] = '<dt>' . __('AOL IM') . '</dt>'; $user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['aim']) : $user['aim']) . '</dd>'; } if ($user['yahoo'] != '') { $user_info['messaging'][] = '<dt>' . __('Yahoo') . '</dt>'; $user_info['messaging'][] = '<dd>' . Utils::escape(ForumSettings::get('o_censoring') == '1' ? Utils::censor($user['yahoo']) : $user['yahoo']) . '</dd>'; } if (ForumSettings::get('o_avatars') == '1') { $avatar_field = Utils::generate_avatar_markup($user['id']); if ($avatar_field != '') { $user_info['personality'][] = '<dt>' . __('Avatar') . '</dt>'; $user_info['personality'][] = '<dd>' . $avatar_field . '</dd>'; } } if (ForumSettings::get('o_signatures') == '1') { if (isset($parsed_signature)) { $user_info['personality'][] = '<dt>' . __('Signature') . '</dt>'; $user_info['personality'][] = '<dd><div class="postsignature postmsg">' . $parsed_signature . '</div></dd>'; } } $posts_field = ''; if (ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod) { $posts_field = Utils::forum_number_format($user['num_posts']); } if (User::get()->g_search == '1') { $quick_searches = array(); if ($user['num_posts'] > 0) { $quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_user_topics&user_id=' . $user['id'] . '">' . __('Show topics') . '</a>'; $quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_user_posts&user_id=' . $user['id'] . '">' . __('Show posts') . '</a>'; } if (User::get()->is_admmod && ForumSettings::get('o_topic_subscriptions') == '1') { $quick_searches[] = '<a href="' . Router::pathFor('search') . '?action=show_subscriptions&user_id=' . $user['id'] . '">' . __('Show subscriptions') . '</a>'; } if (!empty($quick_searches)) { $posts_field .= ($posts_field != '' ? ' - ' : '') . implode(' - ', $quick_searches); } } if ($posts_field != '') { $user_info['activity'][] = '<dt>' . __('Posts') . '</dt>'; $user_info['activity'][] = '<dd>' . $posts_field . '</dd>'; } if ($user['num_posts'] > 0) { $user_info['activity'][] = '<dt>' . __('Last post') . '</dt>'; $user_info['activity'][] = '<dd>' . Utils::format_time($user['last_post']) . '</dd>'; } $user_info['activity'][] = '<dt>' . __('Registered') . '</dt>'; $user_info['activity'][] = '<dd>' . Utils::format_time($user['registered'], true) . '</dd>'; $user_info = Container::get('hooks')->fire('model.profile.parse_user_info', $user_info); return $user_info; }
public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod) { $post_data = array(); $post_data = Container::get('hooks')->fire('model.topic.print_posts_start', $post_data, $topic_id, $start_from, $cur_topic, $is_admmod); $post_count = 0; // Keep track of post numbers // Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data $result = DB::for_table('posts')->select('id')->where('topic_id', $topic_id)->order_by('id')->limit(User::get()->disp_topics)->offset($start_from); $result = Container::get('hooks')->fireDB('model.topic.print_posts_ids_query', $result); $result = $result->find_many(); $post_ids = array(); foreach ($result as $cur_post_id) { $post_ids[] = $cur_post_id['id']; } if (empty($post_ids)) { throw new Error('The post table and topic table seem to be out of sync!', 500); } // Retrieve the posts (and their respective poster/online status) $result['select'] = array('u.email', 'u.title', 'u.url', 'u.location', 'u.signature', 'u.email_setting', 'u.num_posts', 'u.registered', 'u.admin_note', 'p.id', 'username' => 'p.poster', 'p.poster_id', 'p.poster_ip', 'p.poster_email', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by', 'g.g_id', 'g.g_user_title', 'g.g_promote_next_group', 'is_online' => 'o.user_id'); $result = DB::for_table('posts')->table_alias('p')->select_many($result['select'])->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->raw_join('LEFT OUTER JOIN ' . ForumSettings::get('db_prefix') . 'online', "o.user_id!=1 AND o.idle=0 AND o.user_id=u.id", 'o')->where_in('p.id', $post_ids)->order_by('p.id'); $result = Container::get('hooks')->fireDB('model.topic.print_posts_query', $result); $result = $result->find_array(); foreach ($result as $cur_post) { $post_count++; $cur_post['user_avatar'] = ''; $cur_post['user_info'] = array(); $cur_post['user_contacts'] = array(); $cur_post['post_actions'] = array(); $cur_post['is_online_formatted'] = ''; $cur_post['signature_formatted'] = ''; // If the poster is a registered user if ($cur_post['poster_id'] > 1) { if (User::get()->g_view_users == '1') { $cur_post['username_formatted'] = '<a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/">' . Utils::escape($cur_post['username']) . '</a>'; } else { $cur_post['username_formatted'] = Utils::escape($cur_post['username']); } $cur_post['user_title_formatted'] = Utils::get_title($cur_post); if (ForumSettings::get('o_censoring') == '1') { $cur_post['user_title_formatted'] = Utils::censor($cur_post['user_title_formatted']); } // Format the online indicator $cur_post['is_online_formatted'] = $cur_post['is_online'] == $cur_post['poster_id'] ? '<strong>' . __('Online') . '</strong>' : '<span>' . __('Offline') . '</span>'; if (ForumSettings::get('o_avatars') == '1' && User::get()->show_avatars != '0') { if (isset($avatar_cache[$cur_post['poster_id']])) { $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']]; } else { $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']] = Utils::generate_avatar_markup($cur_post['poster_id']); } } // We only show location, register date, post count and the contact links if "Show user info" is enabled if (ForumSettings::get('o_show_user_info') == '1') { if ($cur_post['location'] != '') { if (ForumSettings::get('o_censoring') == '1') { $cur_post['location'] = Utils::censor($cur_post['location']); } $cur_post['user_info'][] = '<dd><span>' . __('From') . ' ' . Utils::escape($cur_post['location']) . '</span></dd>'; } $cur_post['user_info'][] = '<dd><span>' . __('Registered topic') . ' ' . Utils::format_time($cur_post['registered'], true) . '</span></dd>'; if (ForumSettings::get('o_show_post_count') == '1' || User::get()->is_admmod) { $cur_post['user_info'][] = '<dd><span>' . __('Posts topic') . ' ' . Utils::forum_number_format($cur_post['num_posts']) . '</span></dd>'; } // Now let's deal with the contact links (Email and URL) if (($cur_post['email_setting'] == '0' && !User::get()->is_guest || User::get()->is_admmod) && User::get()->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['email']) . '">' . __('Email') . '</a></span>'; } elseif ($cur_post['email_setting'] == '1' && !User::get()->is_guest && User::get()->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="' . Router::pathFor('email', ['id' => $cur_post['poster_id']]) . '">' . __('Email') . '</a></span>'; } if ($cur_post['url'] != '') { if (ForumSettings::get('o_censoring') == '1') { $cur_post['url'] = Utils::censor($cur_post['url']); } $cur_post['user_contacts'][] = '<span class="website"><a href="' . Utils::escape($cur_post['url']) . '" rel="nofollow">' . __('Website') . '</a></span>'; } } if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->g_mod_promote_users == '1') { if ($cur_post['g_promote_next_group']) { $cur_post['user_info'][] = '<dd><span><a href="' . Url::base() . '/user/' . $cur_post['poster_id'] . '/action/promote/pid/' . $cur_post['id'] . '">' . __('Promote user') . '</a></span></dd>'; } } if (User::get()->is_admmod) { $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>'; if ($cur_post['admin_note'] != '') { $cur_post['user_info'][] = '<dd><span>' . __('Note') . ' <strong>' . Utils::escape($cur_post['admin_note']) . '</strong></span></dd>'; } } } else { $cur_post['username_formatted'] = Utils::escape($cur_post['username']); $cur_post['user_title_formatted'] = Utils::get_title($cur_post); if (User::get()->is_admmod) { $cur_post['user_info'][] = '<dd><span><a href="' . Router::pathFor('getPostHost', ['pid' => $cur_post['id']]) . '" title="' . Utils::escape($cur_post['poster_ip']) . '">' . __('IP address logged') . '</a></span></dd>'; } if (ForumSettings::get('o_show_user_info') == '1' && $cur_post['poster_email'] != '' && !User::get()->is_guest && User::get()->g_send_email == '1') { $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . Utils::escape($cur_post['poster_email']) . '">' . __('Email') . '</a></span>'; } } // Generation post action array (quote, edit, delete etc.) if (!$is_admmod) { if (!User::get()->is_guest) { $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . Router::pathFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>'; } if ($cur_topic['closed'] == '0') { if ($cur_post['poster_id'] == User::get()->id) { if ($start_from + $post_count == 1 && User::get()->g_delete_topics == '1' || $start_from + $post_count > 1 && User::get()->g_delete_posts == '1') { $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . Router::pathFor('deletePost', ['id' => $cur_post['id']]) . '">' . __('Delete') . '</a></span></li>'; } if (User::get()->g_edit_posts == '1') { $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . Router::pathFor('editPost', ['id' => $cur_post['id']]) . '">' . __('Edit') . '</a></span></li>'; } } if ($cur_topic['post_replies'] == '' && User::get()->g_post_replies == '1' || $cur_topic['post_replies'] == '1') { $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . Router::pathFor('newQuoteReply', ['tid' => $topic_id, 'qid' => $cur_post['id']]) . '">' . __('Quote') . '</a></span></li>'; } } } else { $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . Router::pathFor('report', ['id' => $cur_post['id']]) . '">' . __('Report') . '</a></span></li>'; if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || !in_array($cur_post['poster_id'], $admin_ids)) { $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . Router::pathFor('deletePost', ['id' => $cur_post['id']]) . '">' . __('Delete') . '</a></span></li>'; $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . Router::pathFor('editPost', ['id' => $cur_post['id']]) . '">' . __('Edit') . '</a></span></li>'; } $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . Router::pathFor('newQuoteReply', ['tid' => $topic_id, 'qid' => $cur_post['id']]) . '">' . __('Quote') . '</a></span></li>'; } // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = Container::get('parser')->parse_message($cur_post['message'], $cur_post['hide_smilies']); // Do signature parsing/caching if (ForumSettings::get('o_signatures') == '1' && $cur_post['signature'] != '' && User::get()->show_sig != '0') { // if (isset($avatar_cache[$cur_post['poster_id']])) { // $cur_post['signature_formatted'] = $avatar_cache[$cur_post['poster_id']]; // } else { $cur_post['signature_formatted'] = Container::get('parser')->parse_signature($cur_post['signature']); // $avatar_cache[$cur_post['poster_id']] = $cur_post['signature_formatted']; // } } $cur_post = Container::get('hooks')->fire('model.print_posts.one', $cur_post); $post_data[] = $cur_post; } $post_data = Container::get('hooks')->fire('model.topic.print_posts', $post_data); return $post_data; }
?> <tr> <td class="tcl"><?php echo $cur_ban['username'] != '' ? Utils::escape($cur_ban['username']) : ' '; ?> </td> <td class="tc2"><?php echo $cur_ban['email'] != '' ? Utils::escape($cur_ban['email']) : ' '; ?> </td> <td class="tc3"><?php echo $cur_ban['ip'] != '' ? Utils::escape($cur_ban['ip']) : ' '; ?> </td> <td class="tc4"><?php echo Utils::format_time($cur_ban['expire'], true); ?> </td> <td class="tc5"><?php echo $cur_ban['message'] != '' ? Utils::escape($cur_ban['message']) : ' '; ?> </td> <td class="tc6"><?php echo $cur_ban['ban_creator_username'] != '' ? '<a href="' . Router::pathFor('userProfile', ['id' => $cur_ban['ban_creator']]) . '">' . Utils::escape($cur_ban['ban_creator_username']) . '</a>' : __('Unknown'); ?> </td> <td class="tcr"><?php echo '<a href="' . Router::pathFor('editBan', ['id' => $cur_ban['id']]) . '">' . __('Edit') . '</a> | <a href="' . Router::pathFor('deleteBan', ['id' => $cur_ban['id']]) . '">' . __('Remove') . '</a>'; ?> </td> </tr>
?> <div class="blockpost"> <div class="box<?php echo $post_count % 2 == 0 ? ' roweven' : ' rowodd'; ?> "> <div class="inbox"> <div class="postbody"> <div class="postleft"> <dl> <dt><strong><?php echo Utils::escape($post['poster']); ?> </strong></dt> <dd><span><?php echo Utils::format_time($post['posted']); ?> </span></dd> </dl> </div> <div class="postright"> <div class="postmsg"> <?php echo $post['message'] . "\n"; ?> </div> </div> </div> <div class="clearer"></div> </div> </div>
"> <div class="nosize"><?php echo Utils::forum_number_format($search['topic_count'] + $search['start_from']); ?> </div> </div> <div class="tclcon"> <div> <?php echo $search['subject'] . "\n"; ?> </div> </div> </td> <td class="tc2"><?php echo $search['forum']; ?> </td> <td class="tc3"><?php echo Utils::forum_number_format($search['num_replies']); ?> </td> <td class="tcr"><?php echo '<a href="' . Router::pathFor('viewPost', ['pid' => $search['last_post_id']]) . '#p' . $search['last_post_id'] . '">' . Utils::format_time($search['last_post']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($search['last_poster']); ?> </span></td> </tr> <?php } Container::get('hooks')->fire('view.search.topics.end');
foreach ($messages as $message) { ?> <div id="p<?php echo $message['id']; ?> " class="blockpost<?php echo $message_count % 2 == 0 ? ' roweven' : ' rowodd'; echo $message['id'] == $cur_conv['first_post_id'] ? ' firstpost' : ''; echo $message_count == 1 ? ' blockpost1' : ''; ?> "> <h2><span class="conr">#<?php echo $start_from + $message_count; ?> </span> <?php echo Utils::format_time($message['sent']); ?> </h2> <div class="box"> <div class="inbox"> <div class="postbody"> <div class="postleft"> <dl> <dt><strong><a href="<?php echo Router::pathFor('userProfile', ['id' => $message['poster_id']]); ?> "><span><?php echo Utils::escape($message['username']); ?> </span></a></strong></dt> <dd class="usertitle"><strong><?php
<div class="blockform block2"> <h2><span><?php _e('Last 10 head'); ?> </span></h2> <div class="box"> <div class="fakeform"> <?php if (!empty($report_zapped_data)) { foreach ($report_zapped_data as $report) { ?> <div class="inform"> <fieldset> <legend><?php printf(__('Zapped subhead'), Utils::format_time($report['zapped']), $report['zapped_by'] != '' ? '<a href="' . Router::pathFor('userProfile', ['id' => $report['zapped_by_id']]) . '">' . Utils::escape($report['zapped_by']) . '</a>' : __('NA')); ?> </legend> <div class="infldset"> <table class="aligntop"> <tr> <th scope="row"><?php printf(__('Reported by'), $report['reporter'] != '' ? '<a href="' . Router::pathFor('userProfile', ['id' => $report['reported_by']]) . '">' . Utils::escape($report['reporter']) . '</a>' : __('Deleted user')); ?> </th> <td class="location"> <?php echo AdminUtils::breadcrumbs_admin(array($report['forum_name'] => Router::pathFor('Forum', ['id' => $report['forum_id'], 'name' => Url::url_friendly($report['forum_name'])]), $report['subject'] => Router::pathFor('Forum', ['id' => $report['topic_id'], 'name' => Url::url_friendly($report['subject'])]), sprintf(__('Post ID'), $report['pid']) => Router::pathFor('viewPost', ['pid' => $report['pid']]) . '#p' . $report['pid'])); ?> </td> </tr>
<td class="tc2"><?php echo Utils::get_title($user); ?> </td> <?php if ($show_post_count) { ?> <td class="tc3"><?php echo Utils::forum_number_format($user['num_posts']); ?> </td> <?php } ?> <td class="tcr"><?php echo Utils::format_time($user['registered'], true); ?> </td> </tr> <?php } if (empty($userlist_data)) { echo "\t\t\t" . '<tr>' . "\n\t\t\t\t\t" . '<td class="tcl" colspan="' . ($show_post_count ? 4 : 3) . '">' . __('No hits') . '</td></tr>' . "\n"; } ?> </tbody> </table> </div> </div> </div>
</tr> </thead> <tbody> <?php foreach ($ip_data as $ip) { ?> <tr> <td class="tcl"><a href="<?php echo Router::pathFor('getHostIp', ['ip' => Utils::escape($ip['poster_ip'])]); ?> "><?php echo Utils::escape($ip['poster_ip']); ?> </a></td> <td class="tc2"><?php echo Utils::format_time($ip['last_used']); ?> </td> <td class="tc3"><?php echo $ip['used_times']; ?> </td> <td class="tcr"><a href="<?php echo Router::pathFor('usersIpShow', ['ip' => $ip['poster_ip']]); ?> "><?php _e('Results find more link'); ?> </a></td> </tr> <?php
public function display_topics_moderate($fid, $sort_by, $start_from) { Container::get('hooks')->fire('model.forum.display_topics_start', $fid, $sort_by, $start_from); $topic_data = array(); // Get topic/forum tracking data if (!User::get()->is_guest) { $tracked_topics = Track::get_tracked_topics(); } // Retrieve a list of topic IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data $result = DB::for_table('topics')->select('id')->where('forum_id', $fid)->order_by_expr('sticky DESC, ' . $sort_by)->limit(User::get()->disp_topics)->offset($start_from); $result = Container::get('hooks')->fireDB('model.forum.display_topics_list_ids', $result); $result = $result->find_many(); // If there are topics in this forum if ($result) { foreach ($result as $id) { $topic_ids[] = $id['id']; } unset($result); // Select topics $result['select'] = array('id', 'poster', 'subject', 'posted', 'last_post', 'last_post_id', 'last_poster', 'num_views', 'num_replies', 'closed', 'sticky', 'moved_to'); $result = DB::for_table('topics')->select_many($result['select'])->where_in('id', $topic_ids)->order_by_desc('sticky')->order_by_expr($sort_by)->order_by_desc('id'); $result = Container::get('hooks')->fireDB('model.forum.display_topics_query', $result); $result = $result->find_many(); $topic_count = 0; foreach ($result as $cur_topic) { ++$topic_count; $status_text = array(); $cur_topic['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd'; $cur_topic['icon_type'] = 'icon'; $url_topic = Url::url_friendly($cur_topic['subject']); if (is_null($cur_topic['moved_to'])) { $cur_topic['last_post_disp'] = '<a href="' . Router::pathFor('viewPost', ['pid' => $cur_topic['last_post_id']]) . '#p' . $cur_topic['last_post_id'] . '">' . Utils::format_time($cur_topic['last_post']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['last_poster']) . '</span>'; $cur_topic['ghost_topic'] = false; } else { $cur_topic['last_post_disp'] = '- - -'; $cur_topic['ghost_topic'] = true; } if (ForumSettings::get('o_censoring') == '1') { $cur_topic['subject'] = Utils::censor($cur_topic['subject']); } if ($cur_topic['sticky'] == '1') { $cur_topic['item_status'] .= ' isticky'; $status_text[] = '<span class="stickytext">' . __('Sticky') . '</span>'; } if ($cur_topic['moved_to'] != 0) { $cur_topic['subject_disp'] = '<a href="' . Router::pathFor('Topic', ['id' => $cur_topic['moved_to'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>'; $status_text[] = '<span class="movedtext">' . __('Moved') . '</span>'; $cur_topic['item_status'] .= ' imoved'; } elseif ($cur_topic['closed'] == '0') { $cur_topic['subject_disp'] = '<a href="' . Router::pathFor('Topic', ['id' => $cur_topic['id'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>'; } else { $cur_topic['subject_disp'] = '<a href="' . Router::pathFor('Topic', ['id' => $cur_topic['id'], 'name' => $url_topic]) . '">' . Utils::escape($cur_topic['subject']) . '</a> <span class="byuser">' . __('by') . ' ' . Utils::escape($cur_topic['poster']) . '</span>'; $status_text[] = '<span class="closedtext">' . __('Closed') . '</span>'; $cur_topic['item_status'] .= ' iclosed'; } if (!$cur_topic['ghost_topic'] && $cur_topic['last_post'] > User::get()->last_visit && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post'])) { $cur_topic['item_status'] .= ' inew'; $cur_topic['icon_type'] = 'icon icon-new'; $cur_topic['subject_disp'] = '<strong>' . $cur_topic['subject_disp'] . '</strong>'; $subject_new_posts = '<span class="newtext">[ <a href="' . Router::pathFor('Topic', ['id' => $cur_topic['id'], 'action' => 'new']) . '" title="' . __('New posts info') . '">' . __('New posts') . '</a> ]</span>'; } else { $subject_new_posts = null; } // Insert the status text before the subject $cur_topic['subject_disp'] = implode(' ', $status_text) . ' ' . $cur_topic['subject_disp']; $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / User::get()->disp_posts); if ($num_pages_topic > 1) { $subject_multipage = '<span class="pagestext">[ ' . Url::paginate($num_pages_topic, -1, 'topic/' . $cur_topic['id'] . '/' . $url_topic . '/#') . ' ]</span>'; } else { $subject_multipage = null; } // Should we show the "New posts" and/or the multipage links? if (!empty($subject_new_posts) || !empty($subject_multipage)) { $cur_topic['subject_disp'] .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : ''; $cur_topic['subject_disp'] .= !empty($subject_multipage) ? ' ' . $subject_multipage : ''; } $topic_data[] = $cur_topic; } } $topic_data = Container::get('hooks')->fire('model.forum.display_topics', $topic_data); return $topic_data; }
} echo $search['forum']; ?> </span> <span>» <a href="<?php echo Router::pathFor('Topic', ['id' => $search['tid'], 'name' => $search['url_topic']]); ?> "><?php echo Utils::escape($search['subject']); ?> </a></span> <span>» <a href="<?php echo Router::pathFor('viewPost', ['pid' => $search['pid']]) . '#p' . $search['pid']; ?> "><?php echo Utils::format_time($search['pposted']); ?> </a></span></span> </h2> <div class="box"> <div class="inbox"> <div class="postbody"> <div class="postleft"> <dl> <dt><?php echo $search['pposter_disp']; ?> </dt> <?php if ($search['pid'] == $search['first_post_id']) {