Changeset 1322 in ExiteCMS


Ignore:
Timestamp:
02/28/08 00:27:46 (4 years ago)
Author:
hverton
Message:

conversion of module version numbers so they can be compared numerically
fixed typo in forum/index.php that caused a query to crash

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/modules.php

    r1281 r1322  
    480480                    $this_module['id'] = $data['mod_id']; 
    481481                    $this_module['version'] = $data['mod_version']; 
    482                     if ($mod_version > $data['mod_version']) { 
     482                    // convert the versions to a number 
     483                    $new = explode(".", $mod_version); 
     484                    while (count($new) < 4) { array_unshift($new, 0); } 
     485                    $new = 1 * $new[3] + 100 * $new[2] + 10000 * $new[1] + 1000000 * $new[0];  
     486                    $cur = explode(".", $data['mod_version']); 
     487                    while (count($cur) < 4) { array_unshift($cur, 0); } 
     488                    $cur = 1 * $cur[3] + 100 * $cur[2] + 10000 * $cur[1] + 1000000 * $cur[0];  
     489                    // now compare the numeric version numbers 
     490                    if ($new > $cur) { 
    483491                        if ($filter && $filter != 2) continue; 
    484492                        $this_module['status'] = 2; 
  • trunk/forum/index.php

    r1311 r1322  
    8181    if (iMEMBER) { 
    8282        if ($userdata['user_posts_unread']) { 
    83             $result = dbquery(" 
     83            $result2 = dbquery(" 
    8484                SELECT count(*) as unread  
    8585                    FROM ".$db_prefix."posts p  
    8686                        LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
    8787                    WHERE tr.user_id = '".$userdata['user_id']."'  
     88                        AND tr.forum_id = '".$data['forum_id']."'  
    8889                        AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
    8990                        AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     
    9192                ); 
    9293        } else { 
    93             $result = dbquery(" 
     94            $result2 = dbquery(" 
    9495                SELECT count(*) as unread  
    9596                    FROM ".$db_prefix."posts p  
    9697                        LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
    9798                    WHERE tr.user_id = '".$userdata['user_id']."'  
     99                        AND tr.forum_id = '".$data['forum_id']."'  
    98100                        AND p.post_author != '".$userdata['user_id']."' 
    99101                        AND p.post_edituser != '".$userdata['user_id']."' 
Note: See TracChangeset for help on using the changeset viewer.