Changeset 3047:b6338d32a3eb for inc/admin
- Timestamp:
- 07/10/15 17:39:03 (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/actions/class.dcactioncomments.php
r2821 r3047 140 140 ); 141 141 } 142 143 $ip_filter_active = true; 144 if ($core->blog->settings->antispam->antispam_filters !== null) { 145 $filters_opt = @unserialize($core->blog->settings->antispam->antispam_filters); 146 if (is_array($filters_opt)) { 147 $ip_filter_active = isset($filters_opt['dcFilterIP']) && is_array($filters_opt['dcFilterIP']) && $filters_opt['dcFilterIP'][0]==1; 148 } 149 } 150 151 if ($ip_filter_active) { 152 $blacklist_actions = array(__('Blacklist IP') => 'blacklist'); 153 if ($core->auth->isSuperAdmin()) { 154 $blacklist_actions[__('Blacklist IP (global)')] = 'blacklist_global'; 155 } 156 157 $ap->addAction( 158 array(__('IP address') => $blacklist_actions), 159 array('dcDefaultCommentActions','doBlacklistIP') 160 ); 161 } 142 162 } 143 163 … … 180 200 $ap->redirect(false); 181 201 } 202 203 public static function doBlacklistIP($core, dcCommentsActionsPage $ap, $post) { 204 $action = $ap->getAction(); 205 $co_ids = $ap->getIDs(); 206 if (empty($co_ids)) { 207 throw new Exception(__('No comment selected')); 208 } 209 210 $global = !empty($action) && $action == 'blacklist_global' && $core->auth->isSuperAdmin(); 211 212 $ip_filter = new dcFilterIP($core); 213 $rs = $ap->getRS(); 214 while ($rs->fetch()) { 215 $ip_filter->addIP('black',$rs->comment_ip,$global); 216 } 217 218 dcPage::addSuccessNotice(__('IP addresses for selected comments have been blacklisted.')); 219 $ap->redirect(true); 220 } 182 221 }
Note: See TracChangeset
for help on using the changeset viewer.