Dotclear


Ignore:
Timestamp:
12/03/12 14:14:58 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Cope with junk comments without antispam plugin enabled (addresses #903)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/comments.php

    r1051 r1052  
    1515dcPage::check('usage,contentadmin'); 
    1616 
     17if (!empty($_POST['delete_all_spam'])) 
     18{ 
     19     try { 
     20          $core->blog->delJunkComments(); 
     21          http::redirect('comments.php?delspam=1'); 
     22     } catch (Exception $e) { 
     23          $core->error->add($e->getMessage()); 
     24     } 
     25} 
     26 
    1727# Creating filter combo boxes 
    1828# Filter form we'll put in html_block 
     
    164174if (!$core->error->flag()) 
    165175{ 
     176     if (!empty($_GET['delspam'])) { 
     177          dcPage::message(__('Spam comments have been successfully deleted.')); 
     178     } 
     179      
    166180     # Filters 
    167181     if (!$show_filters) { 
     
    210224      
    211225     if (!$with_spam) { 
     226 
    212227          $spam_count = $core->blog->getComments(array('comment_status'=>-2),true)->f(0); 
    213            
    214           if (!empty($_GET['delspam'])) { 
    215                dcPage::message(__('Spam comments have been successfully deleted.')); 
    216           } 
    217228           
    218229          if ($spam_count > 0) { 
    219230                
    220                if ($core->plugins->moduleExists('antispam')) { 
    221                     echo  
    222                     '<form action="plugin.php?p=antispam" method="post" class="fieldset">'; 
    223                } 
     231               echo  
     232                    '<form action="comments.php" method="post" class="fieldset">'; 
    224233 
    225234               if ($spam_count == 1) { 
     
    231240               } 
    232241                
    233                if ($core->plugins->moduleExists('antispam')) { 
    234  
    235                     $moderationTTL = $core->blog->settings->antispam->antispam_moderation_ttl; 
    236                     $spam_redir = 
    237                          'comments.php?type='.$type. 
    238                          '&author='.preg_replace('/%/','%%',$author). 
    239                          '&status='.$status. 
    240                          '&sortby='.$sortby. 
    241                          '&ip='.preg_replace('/%/','%%',$ip). 
    242                          '&order='.$order. 
    243                          '&page='.$page. 
    244                          '&nb='.$nb_per_page; 
    245                      
    246                     echo 
     242               echo 
    247243                    $core->formNonce(). 
    248                     form::hidden('ts',time()). 
    249                     form::hidden('redir',$spam_redir). 
    250244                    '<input name="delete_all_spam" class="delete" type="submit" value="'.__('Delete all spams').'" /></p>'; 
    251245 
    252                     if ($moderationTTL != null && $moderationTTL >=0) { 
    253                          echo '<p>'.sprintf(__('All spam comments older than %s day(s) will be automatically deleted.'), $moderationTTL).' '. 
    254                          sprintf(__('You can modify this duration in the %s'),'<a href="blog_pref.php"> '.__('Blog preferences').'</a>'). 
    255                          '</p>'; 
    256                     } 
    257  
    258                     echo '</form>'; 
    259                } 
     246               # --BEHAVIOR-- adminCommentsSpamForm 
     247               $core->callBehavior('adminCommentsSpamForm',$core); 
     248 
     249               echo '</form>'; 
    260250          } 
    261251     } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map