Changeset 44532
- Timestamp:
- 05/06/08 08:41:13 (2 months ago)
- Files:
-
- 1 modified
-
worst-offenders/trunk/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
worst-offenders/trunk/functions.php
r43791 r44532 251 251 function do_delete($comma_separated_id_list) { 252 252 global $wpdb, $keys; 253 $query = "delete from wp_comments where comment_ID in ($comma_separated_id_list)"; 253 $info["banned"] = wo3_prepare_ban_ip_addresses($comma_separated_id_list); 254 $query = "delete from wp_comments where comment_ID in ($comma_separated_id_list)"; 254 255 $result = $wpdb->query($query); 255 return $result; 256 $info["deleted"] = $result; 257 return $info; 258 } 259 260 261 function wo3_prepare_ban_ip_addresses($comma_separated_id_list) { 262 global $wpdb, $keys, $wo3_feedback; 263 $query = "select distinct comment_author_IP from wp_comments where comment_ID in ($comma_separated_id_list)"; 264 $results = $wpdb->get_results($query); 265 $ban=0; 266 foreach($results as $result) { 267 do_action("ban_ip_address", $result->comment_author_IP); 268 $ban++; 269 } 270 return $ban; 256 271 } 257 272 … … 292 307 if (!empty($_POST['worst'])) { 293 308 $deletionList = implode(",", $_POST['worst']); 294 // $wo3_feedback[] = "<div class='updated'>$deletionList</div>"; 295 $deleted = do_delete($deletionList); 296 if ($deleted === false) { 309 $info = do_delete($deletionList); 310 if ($info["deleted"] === false) { 297 311 $wo3_feedback[] = "<div class='updated'>DB Error - Failed to delete - Boo! Perhaps the DB log can help!</div>"; 298 312 } else { 299 $wo3_feedback[] = "<div class='updated'>Congratulations! You just ignored <strong> $deleted</strong> servings of spam!</div>";313 $wo3_feedback[] = "<div class='updated'>Congratulations! You just ignored <strong>".$info["deleted"]."</strong> servings of spam, from <strong>".$info["banned"]."</strong> worst offenders.</div>"; 300 314 update_option( $keys['counter'], $deleted + get_option( $keys['counter'] ) ); 301 315 reset_current_count();
