Changeset 1307 in ExiteCMS


Ignore:
Timestamp:
02/27/08 09:57:44 (4 years ago)
Author:
root
Message:

removed the thread_page field from the threads_read table

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/theme.php

    r1201 r1307  
    8282 
    8383// unread forum post indicator 
    84 if (iMEMBER) { 
     84if (iMEMBER && $settings['revision'] >= 1193) { 
    8585    $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    8686    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/theme.php

    r1201 r1307  
    8282 
    8383// unread forum post indicator 
    84 if (iMEMBER) { 
     84if (iMEMBER && $settings['revision'] >= 1193) { 
    8585    $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    8686    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
  • themes/PLi-Fusion/PLiXmas/php-files/themes/PLiXmas/theme.php

    r1201 r1307  
    8282 
    8383// unread forum post indicator 
    84 if (iMEMBER) { 
     84if (iMEMBER && $settings['revision'] >= 1193) { 
    8585    $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    8686    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
  • themes/public/ExiteCMS_70/php-files/themes/ExiteCMS_70/theme.php

    r1303 r1307  
    6565 
    6666// unread forum post indicator 
    67 if (iMEMBER) { 
     67if (iMEMBER && $settings['revision'] >= 1193) { 
    6868    if ($userdata['user_posts_unread']) { 
    6969        // include the users own posts 
  • trunk/forum/index.php

    r1280 r1307  
    8282        if ($userdata['user_posts_unread']) { 
    8383            // include the users own posts 
    84             $result2 = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     84            $result2 = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    8585        } else { 
    8686            // filter the users own posts 
    87             $result2 = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     87            $result2 = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    8888        } 
    8989        $data['unread_posts'] = ($result2 ? mysql_result($result2, 0) : 0); 
  • trunk/forum/viewforum.php

    r1280 r1307  
    107107    if ($userdata['user_posts_unread']) { 
    108108        // include the users own posts 
    109         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     109        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    110110    } else { 
    111111        // filter the users own posts 
    112         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     112        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    113113    } 
    114114    $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); 
     
    152152    if (isset($userdata['user_id']) && $variables['unread_posts']) { 
    153153        $result2 = dbquery(" 
    154             SELECT count(*) as unread, sum(tr.thread_page) AS pages, MIN(p.post_id) as post_id 
     154            SELECT count(*) as unread, MIN(p.post_id) as post_id 
    155155                FROM ".$db_prefix."posts p  
    156156                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
     
    173173        $data['first_unread_post'] = 0; 
    174174    } 
    175     // number of pages of posts in this thread 
    176     $data['thread_pages'] = ceil($data['thread_replies'] / $settings['numofthreads']) + 1; 
    177175    // correct the number of replies 
    178176    $data['thread_replies'] = max(0, $data['thread_replies'] - 1); 
  • trunk/forum/viewthread.php

    r1295 r1307  
    194194        // include the users own posts 
    195195        $result = dbquery(" 
    196             SELECT count(*) as unread, tr.thread_last_read, tr.thread_page 
     196            SELECT count(*) as unread, tr.thread_last_read 
    197197                FROM ".$db_prefix."posts p 
    198198                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 
     
    206206        // filter the users own posts 
    207207        $result = dbquery(" 
    208             SELECT count(*) as unread, tr.thread_last_read, tr.thread_page 
     208            SELECT count(*) as unread, tr.thread_last_read 
    209209                FROM ".$db_prefix."posts p 
    210210                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 
     
    222222        $variables['unread_posts'] = $data['unread']; 
    223223        $thread_last_read = $data['thread_last_read']; 
    224         $thread_page = $data['thread_page']; 
    225224    } else { 
    226225        $variables['unread_posts'] = 0; 
    227226        $thread_last_read = time(); 
    228         $thread_page = 0; 
    229227    } 
    230228} else { 
    231229    $variables['unread_posts'] = 0; 
    232230    $thread_last_read = time(); 
    233     $thread_page = 0; 
    234231} 
    235232 
     
    397394// update the threads_read record for this user and thread when the last_post_datestamp is newer 
    398395if (iMEMBER && $last_post_datestamp) { 
    399     $result = dbquery("UPDATE ".$db_prefix."threads_read SET thread_last_read = '".$last_post_datestamp."', thread_page = '".min($rowstart, $thread_page)."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$thread_id."' AND thread_last_read < '".$last_post_datestamp."'"); 
     396    $result = dbquery("UPDATE ".$db_prefix."threads_read SET thread_last_read = '".$last_post_datestamp."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$thread_id."' AND thread_last_read < '".$last_post_datestamp."'"); 
    400397} 
    401398 
  • trunk/modules/user_info_panel/user_info_panel.php

    r1280 r1307  
    3434    if ($userdata['user_posts_unread']) { 
    3535        // include the users own posts 
    36         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     36        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    3737    } else { 
    3838        // filter the users own posts 
    39         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     39        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    4040    } 
    4141    $variables['new_post_msg'] = ($result ? mysql_result($result, 0) : 0); 
  • trunk/profile.php

    r1286 r1307  
    9292    $data['user_posts'] = number_format($data['user_posts']); 
    9393    $data['show_viewposts_button'] = ($data['user_posts'] > 0 and file_exists(PATH_MODULES."forum_threads_list_panel/my_posts.php")); 
    94     $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$data['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     94    $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$data['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    9595    $data['unread_count'] = ($result ? mysql_result($result, 0) : 0); 
    9696    $data['user_email'] = str_replace("@","&#64;",$data['user_email']); 
  • trunk/themes/ExiteCMS/theme.php

    r1280 r1307  
    6868    if ($userdata['user_posts_unread']) { 
    6969        // include the users own posts 
    70         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     70        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    7171    } else { 
    7272        // filter the users own posts 
    73         $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     73        $result = dbquery("SELECT count(*) as unread FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    7474    } 
    7575    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
Note: See TracChangeset for help on using the changeset viewer.