[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI controller for the antispam management. 4 * 5 * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}. 9 * 10 * @license http://b2evolution.net/about/license.html GNU General Public License (GPL) 11 * 12 * {@internal Open Source relicensing agreement: 13 * }} 14 * 15 * @package admin 16 * 17 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 18 * 19 * @todo Allow applying / re-checking of the known data, not just after an update! 20 * 21 * @version $Id: _antispam_list.view.php,v 1.1 2007/09/04 14:56:19 fplanque Exp $ 22 */ 23 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 24 25 26 echo '<a href="?ctrl=set_antispam" style="float: right;"><strong>'.T_('Antispam settings').' »</strong></a>'; 27 echo '<h2>'.T_('Antispam blacklist').'</h2>'; 28 29 // ADD KEYWORD FORM: 30 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) // TODO: check for 'add' here once it's mature. 31 { // add keyword or domain 32 global $keyword; 33 34 $Form = & new Form( NULL, 'antispam_add', 'post', '' ); 35 $Form->begin_form('fform'); 36 $Form->hidden_ctrl(); 37 $Form->hidden( 'action', 'ban' ); 38 $Form->text( 'keyword', $keyword, 30, T_('Add a banned keyword'), '', 80 ); // TODO: add note 39 /* 40 * TODO: explicitly add a domain? 41 * $add_Form->text( 'domain', $domain, 30, T_('Add a banned domain'), 'note..', 80 ); // TODO: add note 42 */ 43 $Form->end_form( array( array( 'submit', 'submit', T_('Check & ban...'), 'SaveButton' ) ) ); 44 } 45 46 47 echo '<p class="center">'.T_('Any URL containing one of the following keywords will be banned from posts, comments and logs.'); 48 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 49 { 50 echo '<br />'.T_( 'If a keyword restricts legitimate domains, click on the green tick to stop banning with this keyword.'); 51 } 52 echo '</p>'; 53 54 55 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 56 { // User can edit: 57 ?> 58 <p class="center"> 59 [<a href="?ctrl=antispam&action=poll"><?php echo T_('Request abuse update from centralized blacklist!') ?></a>] 60 [<a href="http://b2evolution.net/about/terms.html"><?php echo T_('Terms of service') ?></a>] 61 </p> 62 <?php 63 } 64 65 66 /* 67 * Query antispam blacklist: 68 */ 69 $keywords = param( 'keywords', 'string', '', true ); 70 71 $where_clause = ''; 72 73 if( !empty( $keywords ) ) 74 { 75 $kw_array = split( ' ', $keywords ); 76 foreach( $kw_array as $kw ) 77 { 78 $where_clause .= 'aspm_string LIKE "%'.$DB->escape($kw).'%" AND '; 79 } 80 } 81 82 $sql = 'SELECT aspm_ID, aspm_string, aspm_source 83 FROM T_antispam 84 WHERE '.$where_clause.' 1'; 85 86 // Create result set: 87 $Results = & new Results( $sql, 'antispam_' ); 88 89 $Results->title = T_('Banned keywords blacklist'); 90 91 92 /** 93 * Callback to add filters on top of the result set 94 * 95 * @param Form 96 */ 97 function filter_antispam( & $Form ) 98 { 99 $Form->text( 'keywords', get_param('keywords'), 20, T_('Keywords'), T_('Separate with space'), 50 ); 100 } 101 $Results->filter_area = array( 102 'callback' => 'filter_antispam', 103 'url_ignore' => 'results_antispam_page,keywords', 104 'presets' => array( 105 'all' => array( T_('All keywords'), '?ctrl=antispam' ), 106 ) 107 ); 108 109 110 111 /* 112 * Column definitions: 113 */ 114 $Results->cols[] = array( 115 'th' => T_('Keyword'), 116 'order' => 'aspm_string', 117 'td' => '%htmlspecialchars(#aspm_string#)%', 118 ); 119 120 // Set columns: 121 function antispam_source2( & $row ) 122 { 123 static $aspm_sources = NULL; 124 125 if( $aspm_sources === NULL ) 126 { 127 /** 128 * the antispam sources 129 * @var array 130 * @static 131 */ 132 $aspm_sources = array ( 133 'local' => T_('Local'), 134 'reported' => T_('Reported'), 135 'central' => T_('Central'), 136 ); 137 } 138 139 return $aspm_sources[$row->aspm_source]; 140 } 141 $Results->cols[] = array( 142 'th' => T_('Source'), 143 'order' => 'aspm_source', 144 'td' => '%antispam_source2({row})%', 145 ); 146 147 // Check if we need to display more: 148 if( $current_User->check_perm( 'spamblacklist', 'edit' ) ) 149 { // User can edit, spamlist: add controls to output columns: 150 // Add CHECK to 1st column: 151 $Results->cols[0]['td'] = action_icon( TS_('Allow keyword back (Remove it from the blacklist)'), 'allowback', 152 '?ctrl=antispam&action=remove&hit_ID=$aspm_ID$' ) 153 .$Results->cols[0]['td']; 154 155 // Add a column for actions: 156 function antispam_actions( & $row ) 157 { 158 $output = ''; 159 160 if( $row->aspm_source == 'local' ) 161 { 162 $output .= '[<a href="'.regenerate_url( 'action,keyword', 'action=report&keyword=' 163 .rawurlencode( $row->aspm_string )).'" title="'. 164 T_('Report abuse to centralized ban blacklist!').'">'. 165 T_('Report').'</a>]'; 166 } 167 168 return $output.'[<a href="'.regenerate_url( 'action,keyword', 'action=ban&keyword=' 169 .rawurlencode( $row->aspm_string )).'" title="'. 170 T_('Check hit-logs and comments for this keyword!').'">'. 171 T_('Re-check').'</a>]'; 172 } 173 $Results->cols[] = array( 174 'th' => T_('Actions'), 175 'td' => '%antispam_actions({row})%', 176 ); 177 } 178 179 // Display results: 180 $Results->display(); 181 182 183 /* 184 * $Log: _antispam_list.view.php,v $ 185 * Revision 1.1 2007/09/04 14:56:19 fplanque 186 * antispam cleanup 187 * 188 * Revision 1.1 2007/06/25 10:59:22 fplanque 189 * MODULES (refactored MVC) 190 * 191 * Revision 1.7 2007/04/26 00:11:05 fplanque 192 * (c) 2007 193 * 194 * Revision 1.6 2006/12/07 23:13:12 fplanque 195 * @var needs to have only one argument: the variable type 196 * Otherwise, I can't code! 197 */ 198 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |