Source for file antispam_list.ctrl.php
Documentation is available at antispam_list.ctrl.php
* This file implements the UI controller for the antispam management.
* This file is part of the Quam Plures project - {@link http://quamplures.net/}.
* See also {@link https://launchpad.net/quam-plures}.
* @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
* @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}.
* Parts of this file are copyright (c)2004 by Vegar BERG GULDAL - {@link http://funky-m.com/}.
* @license http://quamplures.net/license.html GNU General Public License (GPL)
* {@internal Open Source relicensing agreement:
* Daniel HAHLER grants Francois PLANQUE the right to license
* Daniel HAHLER's contributions to this file and the b2evolution project
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
* Vegar BERG GULDAL grants Francois PLANQUE the right to license
* Vegar BERG GULDAL's contributions to this file and the b2evolution project
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
* Halton STEWART grants Francois PLANQUE the right to license
* Halton STEWART's contributions to this file and the b2evolution project
* under any OSI approved OSS license (http://www.opensource.org/licenses/).
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author blueyed: Daniel HAHLER.
* @author fplanque: Francois PLANQUE.
* @author vegarg: Vegar BERG GULDAL.
* @author halton: Halton STEWART.
* @todo Allow applying / re-checking of the known data, not just after an update!
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
$AdminUI->set_path( 'tools', 'antispam' );
param( 'confirm', 'string' );
param( 'keyword', 'string', '', true );
param( 'domain', 'string' );
param( 'filteron', 'string', '', true );
param( 'filter', 'array', array() );
if( isset ($filter['off']) )
$current_User->check_perm( 'spamblacklist', 'view', true );
case 'ban': // only an action if further "actions" given
$current_User->check_perm( 'spamblacklist', 'edit', true ); // TODO: This should become different for 'edit'/'add' perm level - check for 'add' here.
param( 'delhits', 'integer', 0 );
param( 'delcomments', 'integer', 0 );
param( 'blacklist_locally', 'integer', 0 );
param( 'aspm_source', 'string', 'local' );
// Check if the string is too short,
// it has to be a minimum of 5 characters to avoid being too generic
$Messages->add( sprintf( T_('The keyword «%s» is too short, it has to be a minimum of 5 characters!'), htmlspecialchars($keyword) ), 'error' );
{ // Delete all banned hit-log entries
$r = $DB->query('DELETE FROM T_hitlog
WHERE hit_referer LIKE '. $DB->quote('%'. $keyword. '%'),
'Delete all banned hit-log entries' );
$Messages->add( sprintf( T_('Deleted %d logged hits matching «%s».'), $r, htmlspecialchars($keyword) ), 'success' );
{ // Then all banned comments
$r = $DB->query('DELETE FROM T_comments
WHERE comment_author LIKE '. $DB->quote('%'. $keyword. '%'). '
OR comment_author_email LIKE '. $DB->quote('%'. $keyword. '%'). '
OR comment_author_url LIKE '. $DB->quote('%'. $keyword. '%'). '
OR comment_content LIKE '. $DB->quote('%'. $keyword. '%') );
$Messages->add( sprintf( T_('Deleted %d comments matching «%s».'), $r, htmlspecialchars($keyword) ), 'success' );
$Messages->add( sprintf( T_('The keyword «%s» has been blacklisted locally.'), htmlspecialchars($keyword) ), 'success' );
// We'll ask the user later what to do, if no "sub-action" given.
// Remove a domain from ban list:
$current_User->check_perm( 'spamblacklist', 'edit', true );
param( 'hit_ID', 'integer', true ); // Required!
$Messages->add( sprintf( T_('Removing entry #%d from the ban list...'), $hit_ID), 'note' );
// Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
$AdminUI->disp_html_head();
// Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions)
$AdminUI->disp_body_top();
$AdminUI->disp_payload_begin();
if( $action == 'ban' && !$Messages->count('error') && !( $delhits || $delcomments || $blacklist_locally ) )
{ // Nothing to do, ask user:
$AdminUI->disp_view( 'antispam/views/_antispam_ban.form.php' );
$AdminUI->disp_view( 'antispam/views/_antispam_list.view.php' );
$AdminUI->disp_payload_end();
// Display body bottom, debug info and close </html>:
$AdminUI->disp_global_footer();
|