Changeset 1317 in ExiteCMS


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

disable post flooding check for superadmins
tested thread_first_read functionality, made some adjustments

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/post.php

    r1316 r1317  
    580580                        // insert a new post record 
    581581                        $flood = false; 
    582                         $result = dbquery("SELECT MAX(post_datestamp) AS last_post FROM ".$db_prefix."posts WHERE post_author='".$userdata['user_id']."'"); 
    583                         if (!iSUPERADMIN && dbrows($result) > 0) { 
    584                             $data = dbarray($result); 
    585                             if ((time() - $data['last_post']) < $settings['flood_interval']) { 
    586                                 $flood = true; 
    587                                 $error = $locale['431']; 
    588                                 $result = dbquery("INSERT INTO ".$db_prefix."flood_control (flood_ip, flood_timestamp) VALUES ('".USER_IP."', '".time()."')"); 
    589                                 if (dbcount("(flood_ip)", "flood_control", "flood_ip='".USER_IP."'") > 4) { 
    590                                     $result = dbquery("UPDATE ".$db_prefix."users SET user_status='1', user_ban_reason='".$locale['434']."' WHERE user_id='".$userdata['user_id']."'"); 
    591                                     $error .= "<br />".$locale['432']; 
    592                                 } else { 
    593                                     $error .= "<br />".sprintf($locale['433'], $settings['flood_interval']); 
     582                        if (!iSUPERADMIN) { 
     583                            // for non-webmasters, check for post flooding 
     584                            $result = dbquery("SELECT MAX(post_datestamp) AS last_post FROM ".$db_prefix."posts WHERE post_author='".$userdata['user_id']."'"); 
     585                            if (dbrows($result) > 0) { 
     586                                $data = dbarray($result); 
     587                                if ((time() - $data['last_post']) < $settings['flood_interval']) { 
     588                                    $flood = true; 
     589                                    $error = $locale['431']; 
     590                                    $result = dbquery("INSERT INTO ".$db_prefix."flood_control (flood_ip, flood_timestamp) VALUES ('".USER_IP."', '".time()."')"); 
     591                                    if (dbcount("(flood_ip)", "flood_control", "flood_ip='".USER_IP."'") > 4) { 
     592                                        $result = dbquery("UPDATE ".$db_prefix."users SET user_status='1', user_ban_reason='".$locale['434']."' WHERE user_id='".$userdata['user_id']."'"); 
     593                                        $error .= "<br />".$locale['432']; 
     594                                    } else { 
     595                                        $error .= "<br />".sprintf($locale['433'], $settings['flood_interval']); 
     596                                    } 
    594597                                } 
    595598                            } 
  • trunk/forum/viewforum.php

    r1311 r1317  
    9494                AND tr.forum_id = '".$forum_id."' 
    9595                AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 
    96                 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     96                AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     97                    OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 
    9798            GROUP BY p.thread_id 
    9899        "); 
  • trunk/forum/viewthread.php

    r1310 r1317  
    140140    $message = stripmessageinput(censorwords($_POST['message'])); 
    141141    if ($message != "") { 
    142         $result = dbquery("SELECT MAX(post_datestamp) AS last_post FROM ".$db_prefix."posts WHERE post_author='".$userdata['user_id']."'"); 
    143         if (!iSUPERADMIN || dbrows($result) > 0) { 
    144             $data = dbarray($result); 
    145             if ((time() - $data['last_post']) < $settings['flood_interval']) { 
    146                 $flood = true; 
    147                 $result = dbquery("INSERT INTO ".$db_prefix."flood_control (flood_ip, flood_timestamp) VALUES ('".USER_IP."', '".time()."')"); 
    148                 if (dbcount("(flood_ip)", "flood_control", "flood_ip='".USER_IP."'") > 4) { 
    149                     $result = dbquery("UPDATE ".$db_prefix."users SET user_status='1', user_ban_reason='".$locale['530']."' WHERE user_id='".$userdata['user_id']."'"); 
    150                     redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=0&errorcode=2"); 
    151                 } else { 
    152                     redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=0&errorcode=1"); 
     142        if (!iSUPERADMIN) { 
     143            // for non-webmasters, check for post flooding 
     144            $result = dbquery("SELECT MAX(post_datestamp) AS last_post FROM ".$db_prefix."posts WHERE post_author='".$userdata['user_id']."'"); 
     145            if (dbrows($result) > 0) { 
     146                $data = dbarray($result); 
     147                if ((time() - $data['last_post']) < $settings['flood_interval']) { 
     148                    $flood = true; 
     149                    $result = dbquery("INSERT INTO ".$db_prefix."flood_control (flood_ip, flood_timestamp) VALUES ('".USER_IP."', '".time()."')"); 
     150                    if (dbcount("(flood_ip)", "flood_control", "flood_ip='".USER_IP."'") > 4) { 
     151                        $result = dbquery("UPDATE ".$db_prefix."users SET user_status='1', user_ban_reason='".$locale['530']."' WHERE user_id='".$userdata['user_id']."'"); 
     152                        redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=0&errorcode=2"); 
     153                    } else { 
     154                        redirect("post.php?action=quickreply&forum_id=$forum_id&thread_id=$thread_id&post_id=0&errorcode=1"); 
     155                    } 
    153156                } 
    154157            } 
Note: See TracChangeset for help on using the changeset viewer.