// Works because of current order_id selected as bookmark value (please do not change because of simplicity)
        $where_sql = " AND order_id > " . $topic_data['bookmarked'];
        $sign = '-';
    }
    // Re-Sort Bookmarks
    $sql = 'UPDATE ' . FORUMS_BOOKMARKS_TABLE . "\n\t\tSET order_id = order_id {$sign} 1\n\t\t\tWHERE user_id = {$_CLASS['core_user']->data['user_id']}\n\t\t\t{$where_sql}";
    $_CLASS['core_db']->query($sql);
    $topic_data['bookmarked'] = $topic_data['bookmarked'] ? false : true;
    //	$_CLASS['core_display']->meta_refresh(3, generate_link($viewtopic_url, false));
    //	$message = (($topic_data['bookmarked']) ? $_CLASS['core_user']->lang['BOOKMARK_REMOVED'] : $_CLASS['core_user']->lang['BOOKMARK_ADDED']) . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_TOPIC'], '<a href="' . generate_link($viewtopic_url, false) . '">', '</a>');
    //	trigger_error($message);
}
// We make this check here because the correct forum_id is determined
$topic_replies = $_CLASS['auth']->acl_get('m_approve', $forum_id) ? (int) $topic_data['topic_replies_real'] : (int) $topic_data['topic_replies'];
if (!isset($topic_last_read)) {
    $topic_last_read = topic_last_read($topic_id, $forum_id);
}
// Check sticky/announcement time limit
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && $topic_data['topic_time'] + $topic_data['topic_time_limit'] < $_CLASS['core_user']->time) {
    $sql = 'UPDATE ' . FORUMS_TOPICS_TABLE . ' 
		SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0
		WHERE topic_id = ' . $topic_id;
    $_CLASS['core_db']->query($sql);
    $topic_data['topic_type'] = POST_NORMAL;
    $topic_data['topic_time_limit'] = 0;
}
$_CLASS['core_user']->user_setup();
$_CLASS['core_user']->add_lang('viewtopic');
$_CLASS['core_user']->add_img();
// Forum is passworded ... check whether access has been granted to this
// user this session, if not show login box
Exemple #2
0
function list_new_unreads(&$forum_unread, $check_auth = 0)
{
    global $board_config, $userdata, $db;
    //Clean tracking_forums
    $tracking_time = $board_config['tracking_time'] != 0 ? $board_config['tracking_time'] : $userdata['user_lastvisit'];
    if ($tracking_time == '') {
        $tracking_time = 0;
    }
    if (!empty($board_config['tracking_forums'])) {
        @reset($board_config['tracking_forums']);
        //Mark whole forum as read records
        while (list($id, $time) = @each($board_config['tracking_forums'])) {
            //obsolete if forum was marked read before current visit time
            if ($time <= $tracking_time) {
                unset($board_config['tracking_forums'][$id]);
            }
        }
    }
    //get list of remembered topic id's
    @reset($board_config['tracking_unreads']);
    //Mark whole forum as read records
    $list_unreads = '';
    while (list($id, $time) = @each($board_config['tracking_unreads'])) {
        if ($id) {
            $list_unreads .= ($list_unreads ? ',' : '') . $id;
        }
    }
    $new_unreads = array();
    $forum_unread = array();
    $sql_and = array();
    $sql_and[] = "p.post_time > {$tracking_time}";
    if (!empty($list_unreads)) {
        $sql_and[] = "t.topic_id IN ({$list_unreads}) AND (p.post_time <= {$tracking_time})";
    }
    $check_auth_sql = '';
    // the next line of code artificially sets $auth_list to true so that when it is used later on
    // in an if statement the if statement will resolve to true if either (a) $check_auth is false (since in
    // that case $auth_list never gets reset) or (b) $check_auth is true and the user is authorized
    // to view some forums
    $auth_list = TRUE;
    if ($check_auth) {
        // get a list of all forums the user is allowed to read
        $is_auth_ary = array();
        $forum_ids = array();
        $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
        if (count($is_auth_ary)) {
            foreach ($is_auth_ary as $forum_id => $auths) {
                if ($auths['auth_read']) {
                    $forum_ids[] = $forum_id;
                }
            }
        }
        $auth_list = implode(",", $forum_ids);
        $check_auth_sql = "AND t.forum_id IN (" . $auth_list . ")";
    }
    //Get all topics
    // note that $auth_list may resolve to true if $check_auth is false (i.e. we are not checking authorizations on this board)
    // or alternatively if we are checking authorizations and there are in fact forums the user is authorized to view;
    // however, if we are checking authorizations and there are no forums the user is authorized to view we can skip the rest of this
    // since the user will not be shown any unreads, and that's what the next if statement is for
    if ($auth_list) {
        // V: made that into one unique query
        $sql = "SELECT t.forum_id, t.topic_id, p.post_time\r\n\t\t\t\tFROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p\r\n\t\t\t\tWHERE p.post_id = t.topic_last_post_id\r\n\t\t\t\tAND (" . implode(') OR (', $sql_and) . ")\r\n\t\t\t\t{$check_auth_sql}\r\n\t\t\t\tAND t.topic_moved_id = 0";
        // this gets cached along with the posts
        if (!($result = $db->sql_query($sql, false, 'posts_'))) {
            message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql);
        }
        while ($topic_data = $db->sql_fetchrow($result)) {
            $id = $topic_data['topic_id'];
            $topic_last_read = topic_last_read($topic_data['forum_id'], $id);
            if ($topic_data['post_time'] > $topic_last_read) {
                $new_unreads[$id] = $topic_last_read;
                $forum_unread[$topic_data['forum_id']] = true;
            }
        }
        $db->sql_freeresult($result);
    }
    $board_config['tracking_time'] = time();
    $board_config['tracking_unreads'] = $new_unreads;
    write_cookies($userdata);
    //save
    return $new_unreads;
}
Exemple #3
0
                     $folder = $images['folder_locked'];
                     $folder_new = $images['folder_locked_new'];
                 } else {
                     if ($replies >= $board_config['hot_threshold']) {
                         $folder = $images['folder_hot'];
                         $folder_new = $images['folder_hot_new'];
                     } else {
                         $folder = $images['folder'];
                         $folder_new = $images['folder_new'];
                     }
                 }
             }
         }
     }
     //START MOD Keep_unread_2
     if ($topic_rowset[$i]['post_time'] > topic_last_read($forum_id, $topic_id)) {
         $folder_image = $folder_new;
         $folder_alt = $lang['New_posts'];
         $newest_post_img = '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
     } else {
         $folder_image = $folder;
         $folder_alt = $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts'];
         $newest_post_img = '';
     }
     //END MOD Keep_unread_2
 }
 // www.phpBB-SEO.com SEO TOOLKIT BEGIN
 if (!isset($phpbb_seo->seo_url['topic'][$topic_id])) {
     $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($topic_title);
 }
 // www.phpBB-SEO.com SEO TOOLKIT END
Exemple #4
0
                 $folder_new = $images['folder_sticky_new'];
             } else {
                 if ($replies >= $board_config['hot_threshold']) {
                     $folder = $images['folder_hot'];
                     $folder_new = $images['folder_hot_new'];
                 } else {
                     $folder = $images['folder'];
                     $folder_new = $images['folder_new'];
                 }
             }
         }
     }
     //START MOD Keep_unread_2
     $topic_id = $searchset[$i]['topic_id'];
     $forum_id = $searchset[$i]['forum_id'];
     if ($searchset[$i]['post_time'] > topic_last_read($forum_id, $topic_id)) {
         $folder_image = $folder_new;
         $folder_alt = $lang['New_posts'];
         $newest_post_img = '<a href="' . append_sid("viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
     } else {
         $folder_alt = $searchset[$i]['topic_status'] == TOPIC_LOCKED ? $lang['Topic_locked'] : $lang['No_new_posts'];
         $folder_image = $folder;
         $folder_alt = $folder_alt;
         $newest_post_img = '';
     }
     //END MOD Keep_unread_2
 }
 $topic_author_color = $rcs->get_colors($searchset[$i]);
 $topic_author = $searchset[$i]['user_id'] != ANONYMOUS ? '<a href="' . $get->url('userlist', array('mode' => 'viewprofile', POST_USERS_URL => $searchset[$i]['user_id']), true) . '"' . $topic_author_color . '>' : '';
 $topic_author .= $searchset[$i]['user_id'] != ANONYMOUS ? $searchset[$i]['username'] : ($searchset[$i]['post_username'] != '' ? $searchset[$i]['post_username'] : $lang['Guest']);
 $topic_author .= $searchset[$i]['user_id'] != ANONYMOUS ? '</a>' : '';