本文整理汇总了PHP中get_complete_topic_tracking函数的典型用法代码示例。如果您正苦于以下问题:PHP get_complete_topic_tracking函数的具体用法?PHP get_complete_topic_tracking怎么用?PHP get_complete_topic_tracking使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_complete_topic_tracking函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_inbox_stat_func
function get_inbox_stat_func()
{
global $db, $user, $config, $auth, $mobiquo_config;
$user->setup('ucp');
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_UCP');
}
// get unread number of subscribed topic
$forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums));
if (isset($mobiquo_config['hide_forum_id'])) {
$forbidden_forums = array_unique(array_merge($forbidden_forums, $mobiquo_config['hide_forum_id']));
}
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_last_post_time
FROM ' . TOPICS_WATCH_TABLE . ' tw
LEFT JOIN ' . TOPICS_TABLE . ' t ON tw.topic_id=t.topic_id
WHERE tw.user_id = ' . $user->data['user_id'] . '
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true) . '
AND t.topic_last_post_time > ' . $user->data['user_lastvisit'];
$result = $db->sql_query($sql);
$subscribed_topic_unread_count = 0;
while ($row = $db->sql_fetchrow($result)) {
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id'];
$topic_tracking = get_complete_topic_tracking($forum_id, $topic_id);
if ($topic_tracking[$topic_id] < $row['topic_last_post_time']) {
$subscribed_topic_unread_count++;
}
}
$db->sql_freeresult($result);
$inbox_unread_count = $user->data['user_unread_privmsg'] ? $user->data['user_unread_privmsg'] : 0;
$result = new xmlrpcval(array('inbox_unread_count' => new xmlrpcval($inbox_unread_count, 'int'), 'subscribed_topic_unread_count' => new xmlrpcval($subscribed_topic_unread_count, 'int')), 'struct');
return new xmlrpcresp($result);
}
示例2: get_subscribed_topic_func
function get_subscribed_topic_func()
{
global $config, $db, $user, $auth, $mobiquo_config;
// Only registered users can go beyond this point
if (!$user->data['is_registered']) {
return get_error(9);
}
$topic_list = array();
if ($config['allow_topic_notify']) {
$forbidden_forums = $auth->acl_getf('!f_read', true);
$forbidden_forums = array_unique(array_keys($forbidden_forums));
if (isset($mobiquo_config['hide_forum_id'])) {
$forbidden_forums = array_unique(array_merge($forbidden_forums, $mobiquo_config['hide_forum_id']));
}
$sql_array = array('SELECT' => 't.*,
f.forum_name,
u.user_avatar,
u.user_avatar_type', 'FROM' => array(TOPICS_WATCH_TABLE => 'tw', TOPICS_TABLE => 't', USERS_TABLE => 'u'), 'WHERE' => 'tw.user_id = ' . $user->data['user_id'] . '
AND t.topic_id = tw.topic_id
AND u.user_id = t.topic_last_poster_id
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC');
$sql_array['LEFT_JOIN'] = array();
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
if ($config['allow_bookmarks']) {
$sql_array['SELECT'] .= ', bm.topic_id as bookmarked';
$sql_array['LEFT_JOIN'][] = array('FROM' => array(BOOKMARKS_TABLE => 'bm'), 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id');
}
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, 20);
$topic_list = array();
while ($row = $db->sql_fetchrow($result)) {
$forum_id = $row['forum_id'];
$topic_id = isset($row['b_topic_id']) ? $row['b_topic_id'] : $row['topic_id'];
// Replies
$replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id'])) {
$topic_id = $row['topic_moved_id'];
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$short_content = get_short_content($row['topic_last_post_id']);
if ($forum_id) {
$topic_tracking = get_complete_topic_tracking($forum_id, $topic_id);
$new_post = $topic_tracking[$topic_id] < $row['topic_last_post_time'] ? true : false;
} else {
$new_post = false;
}
$user_avatar_url = get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']);
$allow_change_type = $auth->acl_get('m_', $forum_id) || $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'] ? true : false;
$xmlrpc_topic = new xmlrpcval(array('forum_id' => new xmlrpcval($forum_id), 'forum_name' => new xmlrpcval(html_entity_decode($row['forum_name']), 'base64'), 'topic_id' => new xmlrpcval($topic_id), 'topic_title' => new xmlrpcval(html_entity_decode(strip_tags(censor_text($row['topic_title']))), 'base64'), 'reply_number' => new xmlrpcval(intval($replies), 'int'), 'view_number' => new xmlrpcval(intval($row['topic_views']), 'int'), 'short_content' => new xmlrpcval($short_content, 'base64'), 'post_author_id' => new xmlrpcval($row['topic_last_poster_id']), 'post_author_name' => new xmlrpcval(html_entity_decode($row['topic_last_poster_name']), 'base64'), 'new_post' => new xmlrpcval($new_post, 'boolean'), 'post_time' => new xmlrpcval(mobiquo_iso8601_encode($row['topic_last_post_time']), 'dateTime.iso8601'), 'icon_url' => new xmlrpcval($user_avatar_url), 'can_delete' => new xmlrpcval($auth->acl_get('m_delete', $forum_id), 'boolean'), 'can_bookmark' => new xmlrpcval($user->data['is_registered'] && $config['allow_bookmarks'], 'boolean'), 'isbookmarked' => new xmlrpcval($row['bookmarked'] ? true : false, 'boolean'), 'can_close' => new xmlrpcval($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $row['topic_poster'], 'boolean'), 'is_closed' => new xmlrpcval($row['topic_status'] == ITEM_LOCKED, 'boolean'), 'can_stick' => new xmlrpcval($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $row['topic_type'] != POST_STICKY, 'boolean')), 'struct');
$topic_list[] = $xmlrpc_topic;
}
$db->sql_freeresult($result);
}
$topic_num = count($topic_list);
$response = new xmlrpcval(array('total_topic_num' => new xmlrpcval($topic_num, 'int'), 'topics' => new xmlrpcval($topic_list, 'array')), 'struct');
return new xmlrpcresp($response);
}
示例3: display_recent_topics
//.........这里部分代码省略.........
if ($topics_count > $start && $topics_count <= $start + $topics_per_page) {
$topic_list[] = $row['topic_id'];
$rowset[$row['topic_id']] = $row;
if (!isset($forums[$row['forum_id']]) && $this->user->data['is_registered'] && $this->config['load_db_lastread']) {
$forums[$row['forum_id']]['mark_time'] = $row['f_mark_time'];
}
$forums[$row['forum_id']]['topic_list'][] = $row['topic_id'];
$forums[$row['forum_id']]['rowset'][$row['topic_id']] =& $rowset[$row['topic_id']];
if ($row['icon_id'] && $this->auth->acl_get('f_icons', $row['forum_id'])) {
$obtain_icons = true;
}
}
}
$this->db->sql_freeresult($result);
}
// No topics to display
if (!sizeof($topic_list)) {
return;
}
// Grab icons
if ($obtain_icons) {
$icons = $this->cache->obtain_icons();
} else {
$icons = array();
}
// Borrowed from search.php
foreach ($forums as $forum_id => $forum) {
if ($this->user->data['is_registered'] && $this->config['load_db_lastread']) {
$topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time']), $forum_id ? false : $forum['topic_list']);
} else {
if ($this->config['load_anon_lastread'] || $this->user->data['is_registered']) {
$tracking_topics = $this->request->variable($this->config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
$tracking_topics = $tracking_topics ? tracking_unserialize($tracking_topics) : array();
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list'], $forum_id ? false : $forum['topic_list']);
if (!$this->user->data['is_registered']) {
$this->user->data['user_lastmark'] = isset($tracking_topics['l']) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $this->config['board_startdate']) : 0;
}
}
}
}
// Now only pull the data of the requested topics
$sql_array = array('SELECT' => 't.*, tp.topic_posted, f.forum_name', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 't.topic_id = tp.topic_id AND tp.user_id = ' . $this->user->data['user_id']), array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id')), 'WHERE' => $this->db->sql_in_set('t.topic_id', $topic_list), 'ORDER_BY' => 't.' . $sort_topics . ' DESC');
if ($display_parent_forums) {
$sql_array['SELECT'] .= ', f.parent_id, f.forum_parents, f.left_id, f.right_id';
}
/**
* Event to modify the SQL query before the topics data is retrieved
*
* @event paybas.recenttopics.sql_pull_topics_data
* @var array sql_array The SQL array
* @since 2.0.0
*/
$vars = array('sql_array');
extract($this->dispatcher->trigger_event('paybas.recenttopics.sql_pull_topics_data', compact($vars)));
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $topics_per_page);
$rowset = $topic_icons = array();
while ($row = $this->db->sql_fetchrow($result)) {
$rowset[] = $row;
}
$this->db->sql_freeresult($result);
// No topics returned by the DB
if (!sizeof($rowset)) {
return;
}
/**
示例4: global_announcements
function global_announcements()
{
global $db, $auth, $user, $template;
global $phpbb_root_path, $phpEx, $config;
global $cache, $topic_id;
//need to know what page we are on....
$page = str_replace('.' . $phpEx, '', $user->page['page_name']);
if ($page == 'index' && $config['load_global_announcements_home'] || $page == 'viewtopic' && $config['load_global_announcements_topic']) {
//this template varible is only used to see if we should include forumlist_body on viewtopic_body (.html)
$template->assign_var('S_HAS_GLOBAL', true);
//so we are on the index or viewtopic page and we are enabled lets get the global announcements
$sql = 'SELECT *
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . FORUM_CAT . ' AND topic_type = ' . POST_GLOBAL;
if ($user->page['page_name'] == 'viewtopic.' . $phpEx) {
//exclude the current topic, say if we are viewing it...
$sql .= ' AND topic_id != ' . $topic_id;
}
$sql .= ' ORDER BY topic_time DESC';
//order by original creation user topic_last_post_time for last commente
$result = $db->sql_query($sql);
$first_time_flag = 0;
$topic_list = $global_announce_list = array();
//generate items for tracking
while ($row = $db->sql_fetchrow($result)) {
$topic_list[] = $row['topic_id'];
$global_announce_list[$row['topic_id']] = '1';
}
$db->sql_freeresult($result);
//tracking setup
//sql hack to bypass the no f=0 topics...
if (sizeof($topic_list)) {
$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $global_announce_list);
}
//regen
$result = $db->sql_query($sql);
$s_category = TRUE;
while ($row = $db->sql_fetchrow($result)) {
//is this the first time thru? if so we need a category...
//genny a catergory :-)
//highway of live mod no work, always gennys cats (under prosilver anyway)
if ($s_category) {
$template->assign_block_vars('forumrow', array('S_IS_CAT' => $s_category, 'FORUM_ID' => '0', 'FORUM_NAME' => $user->lang['GLOBAL_ANNOUNCEMENT'], 'U_VIEWFORUM' => ''));
}
$s_category = FALSE;
// Grab topic icons stolen form cache.php
$icons = $cache->obtain_icons();
// Get folder img, topic status/type related information and tracking/read/unread
$unread_topic = isset($topic_tracking_info[$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$row['topic_id']] ? true : false;
$folder_img = $folder_alt = '';
//topic_posted hack...for showing _mine images
if ($row['topic_first_poster_name'] == $user->data['username']) {
$row['topic_posted'] = true;
}
topic_status($row, $row['topic_replies'], $unread_topic, $folder_img, $folder_alt, $row['topic_type']);
//doing first time here... so near to last time...
$first_post_time = $user->format_date($row['topic_time']);
// Create last post link information, if appropriate
if ($row['topic_last_post_id']) {
$last_post_subject = $row['topic_last_post_subject'];
$last_post_time = $user->format_date($row['topic_last_post_time']);
$last_post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'];
} else {
$last_post_subject = $last_post_time = $last_post_url = '';
}
//most of the block varibles used forum var names but topic equiv to save mods to forumlist_body.html
$template->assign_block_vars('forumrow', array('S_IS_CAT' => false, 'S_NO_CAT' => false, 'S_IS_LINK' => false, 'S_UNREAD_FORUM' => true, 'S_LOCKED_FORUM' => false, 'S_SUBFORUMS' => false, 'FORUM_ID' => $row['forum_id'], 'FORUM_NAME' => $row['topic_title'], 'FORUM_DESC' => $user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']) . ' ' . $user->lang['POSTED_ON_DATE'] . ' ' . $first_post_time, 'TOPICS' => $row['topic_replies'], 'POSTS' => $row['topic_views'], 'FORUM_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'LAST_POST_SUBJECT' => censor_text($last_post_subject), 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POSTER_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), 'U_LAST_POSTER' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_LAST_POST' => $last_post_url, 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : ''));
}
$db->sql_freeresult($result);
}
return;
}
示例5: assign_topiclist
/**
* Build and assign topiclist for bookmarks/subscribed topics
*/
function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
{
global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx;
$table = $mode == 'subscribed' ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
$start = request_var('start', 0);
// Grab icons
$icons = $cache->obtain_icons();
$sql_array = array('SELECT' => 'COUNT(t.topic_id) as topics_count', 'FROM' => array($table => 'i', TOPICS_TABLE => 't'), 'WHERE' => 'i.topic_id = t.topic_id
AND i.user_id = ' . $user->data['user_id'] . '
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true));
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('topics_count');
$db->sql_freeresult($result);
if ($topics_count) {
$template->assign_vars(array('PAGINATION' => generate_pagination($this->u_action, $topics_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), 'TOTAL_TOPICS' => $topics_count == 1 ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)));
}
if ($mode == 'subscribed') {
$sql_array = array('SELECT' => 't.*, f.forum_name, f.forum_solve_text, f.forum_solve_color, f.forum_allow_solve', 'FROM' => array(TOPICS_WATCH_TABLE => 'tw', TOPICS_TABLE => 't'), 'WHERE' => 'tw.user_id = ' . $user->data['user_id'] . '
AND t.topic_id = tw.topic_id
AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC');
$sql_array['LEFT_JOIN'] = array();
} else {
$sql_array = array('SELECT' => 't.*, f.forum_name, f.forum_solve_text, f.forum_solve_color, f.forum_allow_solve, b.topic_id as b_topic_id', 'FROM' => array(BOOKMARKS_TABLE => 'b'), 'WHERE' => 'b.user_id = ' . $user->data['user_id'] . '
AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC');
$sql_array['LEFT_JOIN'] = array();
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'b.topic_id = t.topic_id');
}
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
if ($config['load_db_lastread']) {
$sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']);
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']);
$sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time AS forum_mark_time';
}
if ($config['load_db_track']) {
$sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']);
$sql_array['SELECT'] .= ', tp.topic_posted';
}
$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$topic_list = $topic_forum_list = $global_announce_list = $rowset = array();
while ($row = $db->sql_fetchrow($result)) {
$topic_id = isset($row['b_topic_id']) ? $row['b_topic_id'] : $row['topic_id'];
$topic_list[] = $topic_id;
$rowset[$topic_id] = $row;
$topic_forum_list[$row['forum_id']]['forum_mark_time'] = $config['load_db_lastread'] ? $row['forum_mark_time'] : 0;
$topic_forum_list[$row['forum_id']]['topics'][] = $topic_id;
if ($row['topic_type'] == POST_GLOBAL) {
$global_announce_list[] = $topic_id;
}
}
$db->sql_freeresult($result);
$topic_tracking_info = array();
if ($config['load_db_lastread']) {
foreach ($topic_forum_list as $f_id => $topic_row) {
$topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time']), $f_id == 0 ? $global_announce_list : false);
}
} else {
foreach ($topic_forum_list as $f_id => $topic_row) {
$topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics'], $global_announce_list);
}
}
foreach ($topic_list as $topic_id) {
$row =& $rowset[$topic_id];
$forum_id = $row['forum_id'];
$topic_id = isset($row['b_topic_id']) ? $row['b_topic_id'] : $row['topic_id'];
$unread_topic = isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id] ? true : false;
// Replies
$replies = $auth->acl_get('m_approve', $forum_id) ? $row['topic_replies_real'] : $row['topic_replies'];
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id'])) {
$topic_id = $row['topic_moved_id'];
}
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type);
$view_topic_url_params = "f={$forum_id}&t={$topic_id}";
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", $view_topic_url_params);
// Send vars to template
$template->assign_block_vars('topicrow', array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'S_DELETED_TOPIC' => !$row['topic_id'] ? true : false, 'S_GLOBAL_TOPIC' => !$forum_id ? true : false, 'PAGINATION' => topic_generate_pagination($replies, append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . ($row['forum_id'] ? $row['forum_id'] : $forum_id) . "&t={$topic_id}")), 'REPLIES' => $replies, 'VIEWS' => $row['topic_views'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'FORUM_NAME' => $row['forum_name'], 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], 'TOPIC_ICON_IMG' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$row['icon_id']]) ? $icons[$row['icon_id']]['height'] : '', 'ATTACH_ICON_IMG' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment'] ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => !empty($row['topic_posted']) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", $view_topic_url_params . '&view=unread') . '#unread', 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_id), 'SOLVED_TOPIC' => $row['topic_solved'] && $row['forum_allow_solve'] ? $row['forum_solve_text'] ? $row['forum_solve_text'] : $user->img('icon_topic_solved_list', 'TOPIC_SOLVED') : '', 'U_SOLVED_TOPIC' => $row['topic_solved'] && $row['forum_allow_solve'] ? append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'p=' . $row['topic_solved'] . '#p' . $row['topic_solved']) : '', 'SOLVED_STYLE' => $row['forum_solve_color'] ? ' style="color: #' . $row['forum_solve_color'] . '"' : ''));
}
}
示例6: mcp_topic_view
//.........这里部分代码省略.........
if (!empty($sort_days_old) && $sort_days_old != $sort_days || $total <= $posts_per_page) {
$start = 0;
}
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total) {
$start = $start < 0 ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
}
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . ($action == 'reports' ? 'p.post_reported = 1 AND ' : '') . '
p.topic_id = ' . $topic_id . ' ' . (!$auth->acl_get('m_approve', $topic_info['forum_id']) ? ' AND p.post_approved = 1 ' : '') . '
AND p.poster_id = u.user_id ' . $limit_time_sql . '
ORDER BY ' . $sort_order_sql;
$result = $db->sql_query_limit($sql, $posts_per_page, $start);
$rowset = $post_id_list = array();
$bbcode_bitfield = '';
while ($row = $db->sql_fetchrow($result)) {
$rowset[] = $row;
$post_id_list[] = $row['post_id'];
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
}
$db->sql_freeresult($result);
if ($bbcode_bitfield !== '') {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread']) {
$tmp_topic_data = array($topic_id => $topic_info);
$topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time']));
unset($tmp_topic_data);
} else {
$topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id);
}
$has_unapproved_posts = false;
// Grab extensions
$extensions = $attachments = array();
if ($topic_info['topic_attachment'] && sizeof($post_id_list)) {
$extensions = $cache->obtain_attach_extensions($topic_info['forum_id']);
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) {
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . '
AND in_message = 0
ORDER BY filetime DESC, post_msg_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[$row['post_msg_id']][] = $row;
}
$db->sql_freeresult($result);
}
}
foreach ($rowset as $i => $row) {
$message = $row['post_text'];
$post_subject = $row['post_subject'] != '' ? $row['post_subject'] : $topic_info['topic_title'];
if ($row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
if (!empty($attachments[$row['post_id']])) {
$update_count = array();
parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count);
}
示例7: floor
}
// What is start equal to?
if ($post_id) {
$start = floor($topic_data['prev_posts'] / $config['posts_per_page']) * $config['posts_per_page'];
}
// Get topic tracking info
if (!isset($topic_tracking_info)) {
$topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread'] && $user->data['is_registered']) {
$tmp_topic_data = array($topic_id => $topic_data);
$topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time']));
unset($tmp_topic_data);
} else {
if ($config['load_anon_lastread'] || $user->data['is_registered']) {
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
}
}
}
// Post ordering options
$limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id'));
$join_user_sql = array('a' => true, 't' => false, 's' => false);
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
// Obtain correct post count and ordering SQL if user has
// requested anything different
if ($sort_days) {
$min_post_time = time() - $sort_days * 86400;
$sql = 'SELECT COUNT(post_id) AS num_posts
示例8: mcp_post_details
/**
* Handling actions in post details screen
*/
function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth, $cache;
$user->add_lang('posting');
$post_id = request_var('p', 0);
$start = request_var('start', 0);
// Get post data
$post_info = get_post_data(array($post_id), false, true);
add_form_key('mcp_post_details');
if (!sizeof($post_info)) {
trigger_error('POST_NOT_EXIST');
}
$post_info = $post_info[$post_id];
$url = append_sid("{$phpbb_root_path}mcp.{$phpEx}?" . extra_url());
switch ($action) {
case 'whois':
if ($auth->acl_get('m_info', $post_info['forum_id'])) {
$ip = request_var('ip', '');
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
$template->assign_vars(array('RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&mode={$mode}&p={$post_id}") . '">', '</a>'), 'U_RETURN_POST' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i={$id}&mode={$mode}&p={$post_id}"), 'L_RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), 'WHOIS' => user_ipwhois($ip)));
}
// We're done with the whois page so return
return;
break;
case 'chgposter':
case 'chgposter_ip':
if ($action == 'chgposter') {
$username = request_var('username', '', true);
$sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
} else {
$new_user_id = request_var('u', 0);
$sql_where = 'user_id = ' . $new_user_id;
}
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $sql_where;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$row) {
trigger_error('NO_USER');
}
if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) {
if (check_form_key('mcp_post_details')) {
change_poster($post_info, $row);
} else {
trigger_error('FORM_INVALID');
}
}
break;
}
// Set some vars
$users_ary = $usernames_ary = array();
$attachments = $extensions = array();
$post_id = $post_info['post_id'];
$topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread']) {
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
$topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
unset($tmp_topic_data);
} else {
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
}
$post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield']) {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
AND in_message = 0
ORDER BY filetime DESC, post_msg_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($attachments)) {
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
}
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments)) {
$template->assign_var('S_HAS_ATTACHMENTS', true);
foreach ($attachments as $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
//.........这里部分代码省略.........
示例9: main
function main($id, $mode)
{
global $auth, $db, $user, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $action;
include_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$forum_id = request_var('f', 0);
$start = request_var('start', 0);
$this->page_title = 'MCP_QUEUE';
switch ($action) {
case 'approve':
case 'disapprove':
include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
$post_id_list = request_var('post_id_list', array(0));
if (!sizeof($post_id_list)) {
trigger_error('NO_POST_SELECTED');
}
if ($action == 'approve') {
approve_post($post_id_list, 'queue', $mode);
} else {
disapprove_post($post_id_list, 'queue', $mode);
}
break;
}
switch ($mode) {
case 'approve_details':
$this->tpl_name = 'mcp_post';
$user->add_lang(array('posting', 'viewtopic'));
$post_id = request_var('p', 0);
$topic_id = request_var('t', 0);
if ($topic_id) {
$topic_info = get_topic_data(array($topic_id), 'm_approve');
if (isset($topic_info[$topic_id]['topic_first_post_id'])) {
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
} else {
$topic_id = 0;
}
}
$post_info = get_post_data(array($post_id), 'm_approve', true);
if (!sizeof($post_info)) {
trigger_error('NO_POST_SELECTED');
}
$post_info = $post_info[$post_id];
if ($post_info['topic_first_post_id'] != $post_id && topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false)) {
$template->assign_vars(array('S_TOPIC_REVIEW' => true, 'TOPIC_TITLE' => $post_info['topic_title']));
}
$extensions = $attachments = $topic_tracking_info = array();
// Get topic tracking info
if ($config['load_db_lastread']) {
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
$topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
unset($tmp_topic_data);
} else {
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
}
$post_unread = isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']] ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield']) {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id'])) {
$extensions = $cache->obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE post_msg_id = ' . $post_id . '
AND in_message = 0
ORDER BY filetime DESC, post_msg_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($attachments)) {
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
}
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (!empty($attachments)) {
$template->assign_var('S_HAS_ATTACHMENTS', true);
foreach ($attachments as $attachment) {
$template->assign_block_vars('attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
}
$post_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']);
$topic_url = append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']);
$template->assign_vars(array('S_MCP_QUEUE' => true, 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=queue&p={$post_id}&f={$forum_id}"), 'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']), 'S_POST_REPORTED' => $post_info['post_reported'], 'S_POST_UNAPPROVED' => !$post_info['post_approved'], 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, 'U_EDIT' => $auth->acl_get('m_edit', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), 'U_MCP_WARN_USER' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, 'MINI_POST_IMG' => $post_unread ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '<a href="' . append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue' . ($topic_id ? '&mode=unapproved_topics' : '&mode=unapproved_posts')) . "&start={$start}\">", '</a>'), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>'), 'RETURN_TOPIC_SIMPLE' => sprintf($user->lang['RETURN_TOPIC_SIMPLE'], '<a href="' . $topic_url . '">', '</a>'), 'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), 'POST_AUTHOR_FULL' => get_username_string('full', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_AUTHOR' => get_username_string('username', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $post_info['user_id'], $post_info['username'], $post_info['user_colour'], $post_info['post_username']), 'POST_PREVIEW' => $message, 'POST_SUBJECT' => $post_info['post_subject'], 'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => $auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '') ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], 'U_LOOKUP_IP' => $auth->acl_get('m_info', $post_info['forum_id']) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : ''));
break;
case 'unapproved_topics':
case 'unapproved_posts':
$user->add_lang(array('viewtopic', 'viewforum'));
$topic_id = request_var('t', 0);
$forum_info = array();
if ($topic_id) {
$topic_info = get_topic_data(array($topic_id));
if (!sizeof($topic_info)) {
//.........这里部分代码省略.........
示例10: main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
switch ($mode) {
case 'front':
$user->add_lang('memberlist');
$sql_from = TOPICS_TABLE . ' t ';
$sql_select = '';
if ($config['load_db_track']) {
$sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
AND tp.user_id = ' . $user->data['user_id'] . ')';
$sql_select .= ', tp.topic_posted';
}
if ($config['load_db_lastread']) {
$sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
AND tt.user_id = ' . $user->data['user_id'] . ')';
$sql_select .= ', tt.mark_time';
}
$topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT'];
$folder = 'folder_announce';
$folder_new = $folder . '_new';
// Get cleaned up list... return only those forums not having the f_read permission
$forum_ary = $auth->acl_getf('!f_read', true);
$forum_ary = array_unique(array_keys($forum_ary));
// Determine first forum the user is able to read into - for global announcement link
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
if (sizeof($forum_ary)) {
$sql .= ' AND forum_id NOT IN ( ' . implode(', ', $forum_ary) . ')';
}
$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
$sql = "SELECT t.* {$sql_select} \n\t\t\t\t\tFROM {$sql_from}\n\t\t\t\t\tWHERE t.forum_id = 0\n\t\t\t\t\t\tAND t.topic_type = " . POST_GLOBAL . '
ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query($sql);
$topic_list = $rowset = array();
while ($row = $db->sql_fetchrow($result)) {
$topic_list[] = $row['topic_id'];
$rowset[$row['topic_id']] = $row;
}
$db->sql_freeresult($result);
$topic_tracking_info = array();
if ($config['load_db_lastread']) {
$topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list);
} else {
$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $topic_list);
}
foreach ($topic_list as $topic_id) {
$row =& $rowset[$topic_id];
$forum_id = $row['forum_id'];
$topic_id = $row['topic_id'];
$unread_topic = isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id] ? true : false;
if ($row['topic_status'] == ITEM_LOCKED) {
$topic_type = $user->lang['VIEW_TOPIC_LOCKED'];
$folder = 'folder_locked';
$folder_new = 'folder_locked_new';
}
$folder_img = $unread_topic ? $folder_new : $folder;
$folder_alt = $unread_topic ? 'NEW_POSTS' : ($row['topic_status'] == ITEM_LOCKED ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Posted image?
if (!empty($row['topic_posted']) && $row['topic_posted']) {
$folder_img .= '_posted';
}
$template->assign_block_vars('topicrow', array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), 'LAST_POST_AUTHOR' => $row['topic_last_poster_id'] == ANONYMOUS ? $row['topic_last_poster_name'] != '' ? $row['topic_last_poster_name'] . ' ' : $user->lang['GUEST'] . ' ' : $row['topic_last_poster_name'], 'TOPIC_TITLE' => censor_text($row['topic_title']), 'TOPIC_TYPE' => $topic_type, 'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'), 'NEWEST_POST_IMG' => $user->img('icon_post_newest', 'VIEW_NEWEST_POST'), 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'ATTACH_ICON_IMG' => $auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment'] ? $user->img('icon_attach', '') : '', 'S_USER_POSTED' => !empty($row['topic_posted']) && $row['topic_posted'] ? true : false, 'S_UNREAD' => $unread_topic, 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$g_forum_id}&t={$topic_id}&p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => $row['topic_last_poster_id'] != ANONYMOUS ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=viewprofile&u=' . $row['topic_last_poster_id']) : '', 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$g_forum_id}&t={$topic_id}&view=unread") . '#unread', 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$g_forum_id}&t={$topic_id}")));
}
if ($config['load_user_activity']) {
if (!function_exists('display_user_activity')) {
include_once $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
display_user_activity($user->data);
}
// Do the relevant calculations
$memberdays = max(1, round((time() - $user->data['user_regdate']) / 86400));
$posts_per_day = $user->data['user_posts'] / $memberdays;
$percentage = $config['num_posts'] ? min(100, $user->data['user_posts'] / $config['num_posts'] * 100) : 0;
$template->assign_vars(array('USER_COLOR' => !empty($user->data['user_colour']) ? $user->data['user_colour'] : '', 'JOINED' => $user->format_date($user->data['user_regdate']), 'VISITED' => empty($last_visit) ? ' - ' : $user->format_date($last_visit), 'WARNINGS' => $user->data['user_warnings'] ? $user->data['user_warnings'] : 0, 'POSTS' => $user->data['user_posts'] ? $user->data['user_posts'] : 0, 'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day), 'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage), 'OCCUPATION' => !empty($row['user_occ']) ? $row['user_occ'] : '', 'INTERESTS' => !empty($row['user_interests']) ? $row['user_interests'] : '', 'S_SHOW_ACTIVITY' => $config['load_user_activity'] ? true : false, 'U_SEARCH_USER' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", 'author_id=' . $user->data['user_id'] . '&sr=posts') : ''));
break;
case 'subscribed':
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
$user->add_lang('viewforum');
$unwatch = isset($_POST['unwatch']) ? true : false;
if ($unwatch) {
$forums = isset($_POST['f']) ? implode(', ', array_map('intval', array_keys($_POST['f']))) : false;
$topics = isset($_POST['t']) ? implode(', ', array_map('intval', array_keys($_POST['t']))) : false;
if ($forums || $topics) {
$l_unwatch = '';
if ($forums) {
$sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . "\n\t\t\t\t\t\t\t\tWHERE forum_id IN ({$forums}) \n\t\t\t\t\t\t\t\t\tAND user_id = " . $user->data['user_id'];
$db->sql_query($sql);
$l_unwatch .= '_FORUMS';
}
if ($topics) {
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . "\n\t\t\t\t\t\t\t\tWHERE topic_id IN ({$topics}) \n\t\t\t\t\t\t\t\t\tAND user_id = " . $user->data['user_id'];
$db->sql_query($sql);
$l_unwatch .= '_TOPICS';
}
$message = $user->lang['UNWATCHED' . $l_unwatch] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i={$id}&mode=subscribed") . '">', '</a>');
meta_refresh(3, append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i={$id}&mode=subscribed"));
//.........这里部分代码省略.........
示例11: get_template_center
//.........这里部分代码省略.........
$topic_tracking_info = get_portal_tracking_info($fetch_news);
if ($this->config['board3_number_of_announcements_' . $module_id] != 0 && $this->config['board3_announcements_archive_' . $module_id]) {
$pagination = generate_portal_pagination($this->modules_helper->route('board3_portal_controller'), $total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start, 'announcements', $module_id);
$announcements_row = array_merge($announcements_row, array('AP_PAGINATION' => isset($pagination) ? $pagination : '', 'TOTAL_ANNOUNCEMENTS' => $total_announcements == 1 ? $this->user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($this->user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements), 'AP_PAGE_NUMBER' => $this->pagination->on_page($total_announcements, $this->config['board3_number_of_announcements_' . $module_id], $start)));
}
// Assign announcements row
$this->template->assign_block_vars('announcements', $announcements_row);
// Show the announcements overview
if ($announcement < 0) {
$count = $fetch_news['topic_count'];
for ($i = 0; $i < $count; $i++) {
if (isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true) {
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $this->user->lang['READ_FULL'];
} else {
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
// unread?
$forum_id = $fetch_news[$i]['forum_id'];
$topic_id = $fetch_news[$i]['topic_id'];
$unread_topic = isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id] ? true : false;
$real_forum_id = $forum_id == 0 ? $fetch_news['global_id'] : $forum_id;
$read_full_url = $this->request->is_set('ap_' . $module_id) ? "ap_{$module_id}={$start}&announcement_{$module_id}={$i}#a_{$module_id}_{$i}" : "announcement_{$module_id}={$i}#a_{$module_id}_{$i}";
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . ($fetch_news[$i]['forum_id'] ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
$replies = $this->auth->acl_get('m_approve', $forum_id) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
switch ($fetch_news[$i]['topic_type']) {
case POST_GLOBAL:
$folder = 'global_read';
$folder_new = 'global_unread';
break;
case POST_ANNOUNCE:
$folder = 'announce_read';
$folder_new = 'announce_unread';
break;
default:
$folder = 'topic_read';
$folder_new = 'topic_unread';
if ($this->config['hot_threshold'] && $replies >= $this->config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED) {
$folder .= '_hot';
$folder_new .= '_hot';
}
break;
}
if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED) {
$folder .= '_locked';
$folder_new .= '_locked';
}
if ($fetch_news[$i]['topic_posted']) {
$folder .= '_mine';
$folder_new .= '_mine';
}
$folder_img = $unread_topic ? $folder_new : $folder;
$folder_alt = $unread_topic ? 'NEW_POSTS' : ($fetch_news[$i]['topic_status'] == ITEM_LOCKED ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');
// Grab icons
$icons = $this->cache->obtain_icons();
$this->template->assign_block_vars('announcements.center_row', array('ATTACH_ICON_IMG' => $fetch_news[$i]['attachment'] && $this->config['allow_attachments'] ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '', 'FORUM_NAME' => $forum_id ? $fetch_news[$i]['forum_name'] : '', 'TITLE' => $fetch_news[$i]['topic_title'], 'POSTER' => $fetch_news[$i]['username'], 'POSTER_FULL' => $fetch_news[$i]['username_full'], 'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'], 'U_USER_PROFILE' => ($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS ? append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '', 'TIME' => $fetch_news[$i]['topic_time'], 'LAST_POST_TIME' => $this->user->format_date($fetch_news[$i]['topic_last_post_time']), 'TEXT' => $fetch_news[$i]['post_text'], 'REPLIES' => $fetch_news[$i]['topic_replies'], 'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'], 'A_ID' => $i, 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'TOPIC_FOLDER_IMG_SRC' => $this->user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG' => $this->user->img('topic_read', 'NO_NEW_POSTS'), 'TOPIC_ICON_IMG' => !empty($icons[$fetch_news[$i]['icon_id']]) ? $icons[$fetch_news[$i]['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => !empty($icons[$fetch_news[$i]['icon_id']]) ? $icons[$fetch_news[$i]['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => !empty($icons[$fetch_news[$i]['icon_id']]) ? $icons[$fetch_news[$i]['icon_id']]['height'] : '', 'U_VIEWFORUM' => append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $fetch_news[$i]['forum_id']), 'U_LAST_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']), 'U_VIEW_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id), 'U_VIEW_UNREAD' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&view=unread#unread'), 'U_POST_COMMENT' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", 'mode=reply&' . ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id), 'U_READ_FULL' => $this->modules_helper->route('board3_portal_controller') . '?' . $read_full_url, 'L_READ_FULL' => $read_full, 'OPEN' => $open_bracket, 'CLOSE' => $close_bracket, 'S_NOT_LAST' => $i < sizeof($fetch_news) - 1 ? true : false, 'S_POLL' => $fetch_news[$i]['poll'], 'S_UNREAD_INFO' => $unread_topic, 'S_HAS_ATTACHMENTS' => !empty($fetch_news[$i]['attachments']) ? true : false));
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
if (!empty($fetch_news[$i]['attachments'])) {
foreach ($fetch_news[$i]['attachments'] as $attachment) {
$this->template->assign_block_vars('announcements.center_row.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
}
} else {
$i = $announcement;
/**
* redirect to portal page if the specified announcement does not exist
* force #top anchor in order to get rid of the #a anchor
*/
if (!isset($fetch_news[$i])) {
redirect($this->modules_helper->route('board3_portal_controller') . '#top');
}
$forum_id = $fetch_news[$i]['forum_id'];
$topic_id = $fetch_news[$i]['topic_id'];
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
$unread_topic = isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id] ? true : false;
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $this->user->lang['BACK'];
$real_forum_id = $forum_id == 0 ? $fetch_news['global_id'] : $forum_id;
$read_full_url = $this->request->is_set('ap_' . $module_id) ? $this->modules_helper->route('board3_portal_controller') . "?ap_{$module_id}={$start}#a_{$module_id}_{$i}" : $this->modules_helper->route('board3_portal_controller') . "#a_{$module_id}_{$i}";
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . ($fetch_news[$i]['forum_id'] ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
$this->template->assign_block_vars('announcements.center_row', array('ATTACH_ICON_IMG' => $fetch_news[$i]['attachment'] && $this->config['allow_attachments'] ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '', 'FORUM_NAME' => $forum_id ? $fetch_news[$i]['forum_name'] : '', 'TITLE' => $fetch_news[$i]['topic_title'], 'POSTER' => $fetch_news[$i]['username'], 'POSTER_FULL' => $fetch_news[$i]['username_full'], 'TIME' => $fetch_news[$i]['topic_time'], 'TEXT' => $fetch_news[$i]['post_text'], 'REPLIES' => $fetch_news[$i]['topic_replies'], 'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'], 'A_ID' => $i, 'U_VIEWFORUM' => append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $fetch_news[$i]['forum_id']), 'U_LAST_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']), 'U_VIEW_COMMENTS' => append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id), 'U_POST_COMMENT' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", 'mode=reply&' . ($real_forum_id ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id), 'S_POLL' => $fetch_news[$i]['poll'], 'S_UNREAD_INFO' => $unread_topic, 'U_READ_FULL' => $read_full_url, 'L_READ_FULL' => $read_full, 'OPEN' => $open_bracket, 'CLOSE' => $close_bracket, 'S_HAS_ATTACHMENTS' => !empty($fetch_news[$i]['attachments']) ? true : false));
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
if (!empty($fetch_news[$i]['attachments'])) {
foreach ($fetch_news[$i]['attachments'] as $attachment) {
$this->template->assign_block_vars('announcements.center_row.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
}
}
}
if ($this->config['board3_announcements_style_' . $module_id]) {
return 'announcements_center_compact.html';
} else {
return 'announcements_center.html';
}
}
示例12: get_topic_func
//.........这里部分代码省略.........
$sql_shadow_out = empty($shadow_topic_list) ? '' : 'AND ' . $db->sql_in_set('t.topic_moved_id', $shadow_topic_list, true);
// If the user is trying to reach late pages, start searching from the end
$store_reverse = false;
$unread_sticky_num = $unread_announce_count = 0;
//get subscribe users
$user_watch_row = array();
$sql = 'SELECT * FROM ' . TOPICS_WATCH_TABLE . ' WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$user_watch_row[$row['topic_id']] = $row['notify_status'];
}
$db->sql_freeresult($result);
if (!empty($topic_type)) {
$sql = 'SELECT t.*, u.user_avatar, u.user_avatar_type,bm.topic_id as bookmarked
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . USERS_TABLE . ' u ON (t.topic_poster = u.user_id)
LEFT JOIN ' . BOOKMARKS_TABLE . ' bm ON (bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id)
WHERE t.forum_id IN (' . $forum_id . ', 0)
AND t.topic_type IN (' . $topic_type . ') ' . $sql_shadow_out . ' ' . $sql_approved . '
ORDER BY ' . $sql_sort_order;
$result = $db->sql_query_limit($sql, $sql_limit, $start);
} else {
if ($user->data['user_id'] != ANONYMOUS) {
// get total number of unread sticky topics number
$sql = 'SELECT t.topic_id, t.topic_last_post_time
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_type = ' . POST_STICKY . ' ' . $sql_shadow_out . ' ' . $sql_approved;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (empty($forum_id) || empty($row['topic_id'])) {
continue;
}
$topic_tracking = get_complete_topic_tracking($forum_id, $row['topic_id']);
if (isset($topic_tracking[$row['topic_id']]) && $topic_tracking[$row['topic_id']] < $row['topic_last_post_time']) {
$unread_sticky_num++;
}
}
$db->sql_freeresult($result);
// get total number of unread announce topics number
$sql = 'SELECT t.topic_id, t.topic_last_post_time
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id IN (' . $forum_id . ', 0)
AND t.topic_type IN (' . POST_ANNOUNCE . ', ' . POST_GLOBAL . ') ' . $sql_shadow_out . ' ' . $sql_approved;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
if (empty($forum_id) || empty($row['topic_id'])) {
continue;
}
$topic_tracking = get_complete_topic_tracking($forum_id, $row['topic_id']);
if (isset($topic_tracking[$row['topic_id']]) && $topic_tracking[$row['topic_id']] < $row['topic_last_post_time']) {
$unread_announce_count++;
}
}
$db->sql_freeresult($result);
}
// get total number of normal topics
$sql = 'SELECT count(t.topic_id) AS num_topics
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_type = ' . POST_NORMAL . ' ' . $sql_shadow_out . ' ' . $sql_approved;
$result = $db->sql_query($sql);
$topics_count = (int) $db->sql_fetchfield('num_topics');
$db->sql_freeresult($result);
if ($start > $topics_count / 2) {
$store_reverse = true;
示例13: get_template_center
//.........这里部分代码省略.........
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
$template->assign_block_vars('announcements_center_row.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}
if ($config['board3_number_of_announcements_' . $module_id] != 0 && $config['board3_announcements_archive_' . $module_id])
{
$template->assign_vars(array(
'AP_PAGINATION' => $pagination,
'TOTAL_ANNOUNCEMENTS' => ($total_announcements == 1) ? $user->lang['VIEW_LATEST_ANNOUNCEMENT'] : sprintf($user->lang['VIEW_LATEST_ANNOUNCEMENTS'], $total_announcements),
'AP_PAGE_NUMBER' => on_page($total_announcements, $config['board3_number_of_announcements_' . $module_id], $start))
);
}
}
}
else
// Show "read full" page
{
$i = $announcement;
/**
* redirect to portal page if the specified announcement does not exist
* force #top anchor in order to get rid of the #a anchor
*/
if (!isset($fetch_news[$i]))
{
redirect(append_sid($phpbb_root_path . 'portal.' . $phpEx, '#top'));
}
$forum_id = $fetch_news[$i]['forum_id'];
$topic_id = $fetch_news[$i]['topic_id'];
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $user->lang['BACK'];
$real_forum_id = ($forum_id == 0) ? $fetch_news['global_id']: $forum_id;
$read_full_url = (isset($_GET['ap'])) ? append_sid("{$phpbb_root_path}portal.$phpEx", "ap=$start#a$i") : append_sid("{$phpbb_root_path}portal.$phpEx#a$i");
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
if ($config['board3_announcements_archive_' . $module_id])
{
$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_announcements, $config['board3_number_of_announcements_' . $module_id], $start, 'announcements');
}
$template->assign_block_vars('announcements_center_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'POSTER_FULL' => $fetch_news[$i]['username_full'],
'TIME' => $fetch_news[$i]['topic_time'],
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'A_ID' => $i,
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&' . (($real_forum_id) ? 'f=' . $real_forum_id . '&' : '') . 't=' . $topic_id),
'S_POLL' => $fetch_news[$i]['poll'],
'S_UNREAD_INFO' => $unread_topic,
'U_READ_FULL' => $read_full_url,
'L_READ_FULL' => $read_full,
示例14: main
function main($id, $mode)
{
global $auth, $db, $user, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $action;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
$forum_id = request_var('f', 0);
$start = request_var('start', 0);
$this->page_title = 'MCP_REPORTS';
switch ($action)
{
case 'close':
case 'delete':
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$report_id_list = request_var('report_id_list', array(0));
if (!sizeof($report_id_list))
{
trigger_error('NO_REPORT_SELECTED');
}
close_report($report_id_list, $mode, $action);
break;
}
switch ($mode)
{
case 'report_details':
$user->add_lang('posting');
$post_id = request_var('p', 0);
// closed reports are accessed by report id
$report_id = request_var('r', 0);
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
AND rr.reason_id = r.reason_id
AND r.user_id = u.user_id
ORDER BY report_closed ASC';
$result = $db->sql_query_limit($sql, 1);
$report = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$report)
{
trigger_error('NO_REPORT');
}
if (!$report_id && $report['report_closed'])
{
trigger_error('REPORT_CLOSED');
}
$post_id = $report['post_id'];
$report_id = $report['report_id'];
$post_info = get_post_data(array($post_id), 'm_report', true);
if (!sizeof($post_info))
{
trigger_error('NO_REPORT_SELECTED');
}
$post_info = $post_info[$post_id];
$reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']);
if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])]))
{
$reason['description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])];
$reason['title'] = $user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])];
}
if (topic_review($post_info['topic_id'], $post_info['forum_id'], 'topic_review', 0, false))
{
$template->assign_vars(array(
'S_TOPIC_REVIEW' => true,
'TOPIC_TITLE' => $post_info['topic_title'])
);
}
$topic_tracking_info = $extensions = $attachments = array();
// Get topic tracking info
if ($config['load_db_lastread'])
{
$tmp_topic_data = array($post_info['topic_id'] => $post_info);
$topic_tracking_info = get_topic_tracking($post_info['forum_id'], $post_info['topic_id'], $tmp_topic_data, array($post_info['forum_id'] => $post_info['forum_mark_time']));
unset($tmp_topic_data);
}
else
{
$topic_tracking_info = get_complete_topic_tracking($post_info['forum_id'], $post_info['topic_id']);
}
//.........这里部分代码省略.........
示例15: toptopics
public function toptopics($tpl_loopname = 'top_five_topic')
{
$howmany = $this->howmany();
$forum_ary = array();
$forum_read_ary = $this->auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed) {
if ($allowed['f_read']) {
$forum_ary[] = (int) $forum_id;
}
}
$forum_ary = array_unique($forum_ary);
if (sizeof($forum_ary)) {
/**
* Select topic_ids
*/
$sql = 'SELECT forum_id, topic_id, topic_type
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ary) . '
AND topic_status <> ' . ITEM_MOVED . '
ORDER BY topic_last_post_time DESC';
$result = $this->db->sql_query_limit($sql, $howmany);
$forums = $ga_topic_ids = $topic_ids = array();
while ($row = $this->db->sql_fetchrow($result)) {
$topic_ids[] = $row['topic_id'];
if ($row['topic_type'] == POST_GLOBAL) {
$ga_topic_ids[] = $row['topic_id'];
} else {
$forums[$row['forum_id']][] = $row['topic_id'];
}
}
$this->db->sql_freeresult($result);
// Get topic tracking
$topic_tracking_info = array();
foreach ($forums as $forum_id => $topic_id) {
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $topic_id, $ga_topic_ids);
}
/*
* must have topic_ids.
* A user can have forums and not have topic_ids before installing this extension
*/
if (sizeof($topic_ids)) {
// grab all posts that meet criteria and auths
$sql_array = array('SELECT' => 'u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_id, t.topic_first_post_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name, f.forum_name', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 't.topic_last_poster_id = u.user_id'), array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id')), 'WHERE' => $this->db->sql_in_set('t.topic_id', $topic_ids), 'ORDER_BY' => 't.topic_last_post_time DESC');
/**
* Event to modify the SQL query before the topics data is retrieved
*
* @event rmcgirr83.topfive.sql_pull_topics_data
* @var array sql_array The SQL array
* @since 1.0.0
*/
$vars = array('sql_array');
extract($this->dispatcher->trigger_event('rmcgirr83.topfive.sql_pull_topics_data', compact($vars)));
// cache the query for one minute
$result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_array), $howmany, 0, 60);
while ($row = $this->db->sql_fetchrow($result)) {
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id'];
$forum_name = $row['forum_name'];
$post_unread = isset($topic_tracking_info[$forum_id][$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$topic_id] ? true : false;
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
$forum_name_url = append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']);
$topic_title = censor_text($row['topic_title']);
$topic_title = truncate_string($topic_title, 60, 255, false, $this->user->lang['ELLIPSIS']);
$is_guest = $row['user_id'] == ANONYMOUS ? true : false;
$tpl_ary = array('U_TOPIC' => $view_topic_url, 'U_FORUM' => $forum_name_url, 'S_UNREAD' => $post_unread ? true : false, 'USERNAME_FULL' => $is_guest || !$this->auth->acl_get('u_viewprofile') ? $this->user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $this->user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'LAST_TOPIC_TIME' => $this->user->format_date($row['topic_last_post_time']), 'TOPIC_TITLE' => $topic_title, 'FORUM_NAME' => $forum_name);
/**
* Modify the topic data before it is assigned to the template
*
* @event rmcgirr83.topfive.modify_tpl_ary
* @var array row Array with topic data
* @var array tpl_ary Template block array with topic data
* @since 1.0.0
*/
$vars = array('row', 'tpl_ary');
extract($this->dispatcher->trigger_event('rmcgirr83.topfive.modify_tpl_ary', compact($vars)));
$this->template->assign_block_vars($tpl_loopname, $tpl_ary);
}
$this->db->sql_freeresult($result);
} else {
$this->template->assign_block_vars($tpl_loopname, array('NO_TOPIC_TITLE' => $this->user->lang['NO_TOPIC_EXIST']));
}
} else {
$this->template->assign_block_vars($tpl_loopname, array('NO_TOPIC_TITLE' => $this->user->lang['NO_TOPIC_EXIST']));
}
}