本文整理汇总了PHP中get_complete_topic_tracking函数的典型用法代码示例。如果您正苦于以下问题:PHP get_complete_topic_tracking函数的具体用法?PHP get_complete_topic_tracking怎么用?PHP get_complete_topic_tracking使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_complete_topic_tracking函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:autonomous1,项目名称:tapatalk-phpbb3,代码行数:34,代码来源:get_inbox_stat.php
示例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);
}
开发者ID:patrickrolanddg,项目名称:dragonfly-tapatalk,代码行数:59,代码来源:get_subscribed_topic.php
示例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;
}
/**
开发者ID:NuLeaf,项目名称:nuleaf-forum,代码行数:67,代码来源:recenttopics.php
示例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;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:72,代码来源:functions_display.php
示例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'] . '"' : ''));
}
}
开发者ID:jverkoey,项目名称:Three20-Scope,代码行数:84,代码来源:ucp_main.php
示例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);
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:67,代码来源:mcp_topic.php
示例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
开发者ID:ramukumar555,项目名称:phpbb,代码行数:31,代码来源:viewtopic.php
示例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));
}
//.........这里部分代码省略.........
开发者ID:ahmatjan,项目名称:Crimson,代码行数:101,代码来源:mcp_post.php
示例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)) {
//.........这里部分代码省略.........
开发者ID:html,项目名称:PI,代码行数:101,代码来源:mcp_queue.php
示例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'];
|
请发表评论