Dotclear

Changeset 1049:1d17674d50ad


Ignore:
Timestamp:
12/02/12 16:04:27 (13 years ago)
Author:
JcDenis
Branch:
default
Message:

Fix #903 : Added action "Delete all spam" to comments page.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin/comments.php

    r796 r1049  
    211211     if (!$with_spam) { 
    212212          $spam_count = $core->blog->getComments(array('comment_status'=>-2),true)->f(0); 
    213           if ($spam_count == 1) { 
    214                echo '<p>'.sprintf(__('You have one spam comments.'),'<strong>'.$spam_count.'</strong>').' '. 
    215                '<a href="comments.php?status=-2">'.__('Show it.').'</a></p>'; 
    216           } elseif ($spam_count > 1) { 
    217                echo '<p>'.sprintf(__('You have %s spam comments.'),'<strong>'.$spam_count.'</strong>').' '. 
    218                '<a href="comments.php?status=-2">'.__('Show them.').'</a></p>'; 
     213           
     214          if (!empty($_GET['delspam'])) { 
     215               dcPage::message(__('Spam comments have been successfully deleted.')); 
     216          } 
     217           
     218          if ($spam_count > 0) { 
     219               $moderationTTL = $core->blog->settings->antispam->antispam_moderation_ttl; 
     220                
     221               echo  
     222               '<form action="plugin.php?p=antispam" method="post" class="fieldset">'; 
     223                
     224               if ($spam_count == 1) { 
     225                    echo '<p>'.sprintf(__('You have one spam comments.'),'<strong>'.$spam_count.'</strong>').' '. 
     226                    '<a href="comments.php?status=-2">'.__('Show it.').'</a></p>'; 
     227               } elseif ($spam_count > 1) { 
     228                    echo '<p>'.sprintf(__('You have %s spam comments.'),'<strong>'.$spam_count.'</strong>').' '. 
     229                    '<a href="comments.php?status=-2">'.__('Show them.').'</a></p>'; 
     230               } 
     231                
     232               if ($core->plugins->moduleExists('antispam')) { 
     233                    $spam_redir = 
     234                    'comments.php?type='.$type. 
     235                    '&author='.preg_replace('/%/','%%',$author). 
     236                    '&status='.$status. 
     237                    '&sortby='.$sortby. 
     238                    '&ip='.preg_replace('/%/','%%',$ip). 
     239                    '&order='.$order. 
     240                    '&page='.$page. 
     241                    '&nb='.$nb_per_page; 
     242                     
     243                    echo 
     244                    $core->formNonce(). 
     245                    form::hidden('ts',time()). 
     246                    form::hidden('redir',$spam_redir). 
     247                    '<input name="delete_all_spam" class="delete" type="submit" value="'.__('Delete all spams').'" /></p>'; 
     248               } 
     249                
     250               if ($moderationTTL != null && $moderationTTL >=0) { 
     251                    echo '<p>'.sprintf(__('All spam comments older than %s day(s) will be automatically deleted.'), $moderationTTL).' '. 
     252                    __('You can modify this duration in '). 
     253                    '<a href="blog_pref.php"> '.__('Blog preferences').'</a></p>'; 
     254               } 
     255               echo '</form>'; 
    219256          } 
    220257     } 
  • admin/js/_comments.js

    r1034 r1049  
    115115     $('#form-comments td input[type=checkbox]').enableShiftClick(); 
    116116     dotclear.commentsActionsHelper(); 
     117     $('form input[type=submit][name=delete_all_spam]').click(function(){ 
     118          return window.confirm(dotclear.msg.confirm_spam_delete); 
     119     }); 
    117120}); 
  • inc/admin/lib.dc.page.php

    r1039 r1049  
    433433          self::jsVar('dotclear.msg.confirm_delete_post', 
    434434               __("Are you sure you want to delete this entry?")). 
     435          self::jsVar('dotclear.msg.confirm_spam_delete', 
     436               __('Are you sure you want to delete all spams?')). 
    435437          self::jsVar('dotclear.msg.confirm_delete_comments', 
    436438               __('Are you sure you want to delete selected comments (%s)?')). 
  • plugins/antispam/antispam.js

    r1040 r1049  
    44          dragsort.makeTableSortable(this,dotclear.sortable.setHandle, dotclear.sortable.saveOrder); 
    55     }); 
    6      $('form input[type=submit][name=delete_all]').click(function(){ 
     6     $('form input[type=submit][name=delete_all_spam]').click(function(){ 
    77          return window.confirm(dotclear.msg.confirm_spam_delete); 
    88     }); 
  • plugins/antispam/index.php

    r1040 r1049  
    2020$default_tab = null; 
    2121 
     22$redir = isset($_POST['redir']) && strpos($_POST['redir'],'://') === false ? 
     23     $_POST['redir'] : $p_url; 
     24 
    2225try 
    2326{ 
     
    3841 
    3942     # Remove all spam 
    40      if (!empty($_POST['delete_all'])) 
     43     if (!empty($_POST['delete_all_spam'])) 
    4144     { 
    4245          $ts = dt::str('%Y-%m-%d %H:%M:%S',$_POST['ts'],$core->blog->settings->system->blog_timezone); 
    4346 
    4447          dcAntispam::delAllSpam($core,$ts); 
    45           http::redirect($p_url.'&del=1'); 
     48          http::redirect($redir.'&delspam=1'); 
    4649     } 
    4750 
     
    138141     '<h3>'.__('Information').'</h3>'; 
    139142 
    140      if (!empty($_GET['del'])) { 
     143     if (!empty($_GET['delspam'])) { 
    141144          dcPage::message(__('Spam comments have been successfully deleted.')); 
    142145     } 
     
    155158          '<p>'.$core->formNonce(). 
    156159          form::hidden('ts',time()). 
    157           '<input name="delete_all" class="delete" type="submit" value="'.__('Delete all spams').'" /></p>'; 
     160          '<input name="delete_all_spam" class="delete" type="submit" value="'.__('Delete all spams').'" /></p>'; 
    158161     } 
    159162     if ($moderationTTL != null && $moderationTTL >=0) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map