Esempio n. 1
0
 } else {
     if (VBSEO_REWRITE_THREADS && ($vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_NEWPOST', $vbseo_url_)) || ($vbseo_arr2 = $vbseo_arr = vbseo_check_url('VBSEO_URL_THREAD_LASTPOST', $vbseo_url_))) {
         define('THIS_SCRIPT', 'showthread');
         vbseo_set_self($q = 'showthread.' . VBSEO_VB_EXT . '?' . VBSEO_THREADID_URI . '=' . $vbseo_arr['thread_id'] . '&goto=' . (isset($vbseo_arr2) ? 'lastpost' : 'newpost'));
         define('VBSEO_GT_POST', $q);
         if (1 || defined('VBSEO_NEW_LAST_POST_COOKIE') && VBSEO_NEW_LAST_POST_COOKIE) {
             $postid = 0;
         } else {
             vbseo_vars_push('vbseo_arr', 'vbseo_arr2');
             $globaltemplates = $phrasegroups = $specialtemplates = array();
             include 'global.' . VBSEO_VB_EXT;
             vbseo_vars_pop();
             vbseo_get_options();
             vbseo_prepare_seo_replace();
             vbseo_get_forum_info();
             $postid = $vbseo_arr2 ? vbseo_get_last_post($vbseo_arr['thread_id']) : vbseo_get_new_post($vbseo_arr['thread_id']);
         }
         if ($postid) {
             $tmode = $_COOKIE[vbseo_vb_cprefix() . "threadedmode"];
             if ($tmode == 'threaded' || $tmode == 'hybrid') {
                 $vbseo_found_fn = 'showthread.' . VBSEO_VB_EXT;
                 $vbseo_found = true;
             } else {
                 $found_object_ids['prepostthread_ids'] = array($postid);
                 vbseo_get_post_thread_info($postid, true);
                 vbseo_get_thread_info($found_object_ids['postthreads']);
                 $vbseo_url_ = vbseo_thread_url_postid($postid);
                 $ti = $vbseo_gcache['thread'][$vbseo_arr['thread_id']];
                 if ($GAS_settings && preg_match('#\\b' . $ti['forumid'] . '\\b#', $GAS_settings['forums'])) {
                     $_SERVER['QUERY_STRING'] = 'conly=1';
                 }
Esempio n. 2
0
function vbseo_get_new_post($threadid)
{
    global $bbuserinfo, $vboptions, $vbseo_gcache;
    $db = vbseo_get_db();
    $lvisit = $bbuserinfo['lastvisit'];
    if ($vboptions['threadmarking'] and $bbuserinfo['userid']) {
        $threadinfo = $db->vbseodb_query_first($q = "\nSELECT\nthreadread.readtime AS threadread, forumread.readtime AS forumread\nFROM " . vbseo_tbl_prefix('thread') . " AS thread\nLEFT JOIN " . vbseo_tbl_prefix('threadread') . " AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $bbuserinfo['userid'] . ")\nLEFT JOIN " . vbseo_tbl_prefix('forumread') . " AS forumread ON (forumread.forumid = thread.forumid AND forumread.userid = " . $bbuserinfo['userid'] . ")\nWHERE thread.threadid = '{$threadid}'\n");
        $lvisit = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - $vboptions['markinglimit'] * 86400);
    } else {
        if (($tview = vbseo_bbarray_cookie('thread_lastview', $threadid)) > $lvisit) {
            $lvisit = $tview;
        }
    }
    $postarr = $db->vbseodb_query_first($q = "\nSELECT MIN(postid) AS postid\nFROM " . vbseo_tbl_prefix('post') . "\nWHERE threadid = {$threadid}\nAND visible = 1\nAND dateline > " . intval($lvisit) . "\nLIMIT 1\n");
    return $postarr['postid'] ? $postarr['postid'] : vbseo_get_last_post($threadid);
}