[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /** 4 * file: MassDelTrackback.Admin.class.php 5 * 6 * Mass delete trackback spam 7 * 8 * Copyright (C) 2004-2006 by the following authors: 9 * 10 * @author Tom Willett tomw AT pigstye DOT net 11 * @author Dirk Haun dirk AT haun-online DOT de 12 * 13 * Licensed under GNU General Public License 14 * 15 * $Id: MassDelTrackback.Admin.class.php,v 1.6 2006/08/20 16:42:32 dhaun Exp $ 16 */ 17 18 if (strpos ($_SERVER['PHP_SELF'], 'MassDelTrackback.Admin.class.php') !== false) { 19 die ('This file can not be used on its own!'); 20 } 21 22 require_once ($_CONF['path'] . 'plugins/spamx/BaseAdmin.class.php'); 23 24 25 class MassDelTrackback extends BaseAdmin { 26 27 function display() 28 { 29 global $_CONF, $_TABLES, $LANG_SX00; 30 31 $display = $LANG_SX00['masstb']; 32 33 $act = ''; 34 if (isset ($_POST['action'])) { 35 $act = COM_applyFilter ($_POST['action']); 36 } 37 $lmt = 0; 38 if (isset ($_POST['limit'])) { 39 $lmt = COM_applyFilter ($_POST['limit'], true); 40 } 41 42 if (($act == $LANG_SX00['deletespam']) && ($lmt > 0)) { 43 $numc = 0; 44 $spamx_path = $_CONF['path'] . 'plugins/spamx/'; 45 46 if ($dir = @opendir ($spamx_path)) { 47 while (($file = readdir ($dir)) !== false) { 48 if (is_file ($spamx_path . $file)) { 49 if (substr ($file, -18) == '.Examine.class.php') { 50 $tmp = str_replace ('.Examine.class.php', '', $file); 51 $Spamx_Examine[] = $tmp; 52 53 require_once ($spamx_path . $file); 54 } 55 } 56 } 57 closedir ($dir); 58 } 59 60 require_once ($_CONF['path_system'] . 'lib-trackback.php'); 61 62 $result = DB_query ("SELECT cid,sid,type,url,title,blog,excerpt,ipaddress,UNIX_TIMESTAMP(date) as date FROM {$_TABLES['trackback']} ORDER BY date DESC LIMIT $lmt"); 63 $nrows = DB_numRows ($result); 64 for ($i = 0; $i < $nrows; $i++) { 65 $A = DB_fetchArray ($result); 66 $comment = TRB_formatComment ($A['url'], $A['title'], 67 $A['blog'], $A['excerpt']); 68 69 foreach ($Spamx_Examine as $Examine) { 70 $EX = new $Examine; 71 if(method_exists($EX, 'reexecute')) 72 { 73 $res = $EX->reexecute($comment, $A['date'], $A['ipaddress'], $A['type']); 74 } else { 75 $res = $EX->execute ($comment); 76 } 77 if ($res == 1) { 78 break; 79 } 80 } 81 if ($res == 1) { 82 $this->deltrackback ($A['cid'], $A['sid'], $A['type']); 83 $numc = $numc + 1; 84 } 85 } 86 $display .= $numc . $LANG_SX00['comdel']; 87 } else { 88 $display .= '<form method="post" action="' . $_CONF['site_admin_url'] . '/plugins/spamx/index.php?command=MassDelTrackback">'; 89 $display .= $LANG_SX00['numtocheck'] . '   ' . ' <select name="limit">'; 90 $display .= '<option value="10">10</option>' 91 . '<option value="50">50</option>' 92 . '<option value="100" selected="selected">100</option>' 93 . '<option value="200">200</option>' 94 . '<option value="300">300</option>' 95 . '<option value="400">400</option>'; 96 $display .= '</select>'; 97 $display .= $LANG_SX00['note1']; 98 $display .= $LANG_SX00['note2']; 99 $display .= $LANG_SX00['note3']; 100 $display .= $LANG_SX00['note4']; 101 $display .= $LANG_SX00['note5']; 102 $display .= $LANG_SX00['note6']; 103 $display .= '<input type="submit" name="action" value="' . $LANG_SX00['deletespam'] . '">'; 104 $display .= '</form>'; 105 } 106 107 return $display; 108 } 109 110 function link() 111 { 112 global $LANG_SX00; 113 114 return 'Mass Delete Trackback Spam'; 115 } 116 117 /** 118 * Deletes a given trackback comment 119 * 120 * @param int $cid Comment ID 121 * @param string $sid ID of object comment belongs to 122 * @param string $type Comment type (e.g. article, poll, etc) 123 * @return void 124 * 125 */ 126 function deltrackback ($cid, $sid, $type) 127 { 128 global $_TABLES, $LANG_SX00; 129 130 if (TRB_allowDelete ($sid, $type)) { 131 TRB_deleteTrackbackComment ($cid); 132 133 if ($type == 'article') { 134 $tbcount = DB_count ($_TABLES['trackback'], 135 array ('type', 'sid'), 136 array ('article', $sid)); 137 DB_query ("UPDATE {$_TABLES['stories']} SET trackbacks = $tbcount WHERE sid = '$sid'"); 138 } 139 140 SPAMX_log ($LANG_SX00['spamdeleted']); 141 } 142 } 143 } 144 145 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |