getFilters(); $page_name = __('Antispam'); $filter_gui = false; $default_tab = null; try { # Show filter configuration GUI if (!empty($_GET['f'])) { if (!isset($filters[$_GET['f']])) { throw new Exception(__('Filter does not exist.')); } if (!$filters[$_GET['f']]->hasGUI()) { throw new Exception(__('Filter has no user interface.')); } $filter = $filters[$_GET['f']]; $filter_gui = $filter->gui($filter->guiURL()); } # Remove all spam if (!empty($_POST['delete_all'])) { $ts = dt::str('%Y-%m-%d %H:%M:%S', $_POST['ts'], $core->blog->settings->system->blog_timezone); dcAntispam::delAllSpam($core, $ts); dcPage::addSuccessNotice(__('Spam comments have been successfully deleted.')); http::redirect($p_url); } # Update filters if (isset($_POST['filters_upd'])) { $filters_opt = array(); $i = 0; foreach ($filters as $fid => $f) { $filters_opt[$fid] = array(false, $i); $i++; } # Enable active filters if (isset($_POST['filters_active']) && is_array($_POST['filters_active'])) { foreach ($_POST['filters_active'] as $v) { $filters_opt[$v][0] = true; } } # Order filters if (!empty($_POST['f_order']) && empty($_POST['filters_order'])) { $order = $_POST['f_order']; asort($order); $order = array_keys($order); } elseif (!empty($_POST['filters_order'])) { $order = explode(',', trim($_POST['filters_order'], ',')); } if (isset($order)) { foreach ($order as $i => $f) { $filters_opt[$f][1] = $i; } } # Set auto delete flag if (isset($_POST['filters_auto_del']) && is_array($_POST['filters_auto_del'])) { foreach ($_POST['filters_auto_del'] as $v) { $filters_opt[$v][2] = true; } } dcAntispam::$filters->saveFilterOpts($filters_opt); dcPage::addSuccessNotice(__('Filters configuration has been successfully saved.')); http::redirect($p_url); } } catch (Exception $e) { $core->error->add($e->getMessage()); } ?> <?php echo ($filter_gui !== false ? sprintf(__('%s configuration'), $filter->name) . ' - ' : '') . $page_name; ?> auth->user_prefs->addWorkspace('accessibility'); if (!$core->auth->user_prefs->accessibility->nodragdrop) { echo dcPage::jsLoad('js/jquery/jquery-ui.custom.js') . dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js') . dcPage::jsLoad(dcPage::getPF('antispam/js/antispam.js')); } echo dcPage::cssLoad(dcPage::getPF('antispam/style.css')); ?> '', $page_name => $p_url, sprintf(__('%s filter configuration'), $filter->name) => '' )) . dcPage::notices(); echo '

' . __('Back to filters list') . '

'; echo $filter_gui; if ($filter->help) { dcPage::helpBlock($filter->help); } } else { echo dcPage::breadcrumb( array( __('Plugins') => '', $page_name => '' )) . dcPage::notices(); # Information $spam_count = dcAntispam::countSpam($core); $published_count = dcAntispam::countPublishedComments($core); $moderationTTL = $core->blog->settings->antispam->antispam_moderation_ttl; echo '
' . '

' . __('Information') . '

'; echo ''; if ($spam_count > 0) { echo '

' . $core->formNonce() . form::hidden('ts', time()) . '

'; } if ($moderationTTL != null && $moderationTTL >= 0) { echo '

' . sprintf(__('All spam comments older than %s day(s) will be automatically deleted.'), $moderationTTL) . ' ' . sprintf(__('You can modify this duration in the %s'), ' ' . __('Blog settings') . '') . '.

'; } echo '
'; # Filters echo '
'; if (!empty($_GET['upd'])) { dcPage::success(__('Filters configuration has been successfully saved.')); } echo '
' . '' . '' . '' . '' . '' . '' . '' . '' . '' . ''; $i = 0; foreach ($filters as $fid => $f) { $gui_link = ' '; if ($f->hasGUI()) { $gui_link = '' . '' . __('Filter configuration') . ''; } echo '' . '' . '' . '' . '' . '' . '' . ''; $i++; } echo '
' . __('Available spam filters') . '
' . __('Order') . '' . __('Active') . '' . __('Auto Del.') . '' . __('Filter name') . '' . __('Description') . '
' . form::number(array('f_order[' . $fid . ']'), array( 'min' => 0, 'default' => $i, 'class' => 'position', 'extra_html' => 'title="' . __('position') . '"' )) . '' . form::checkbox(array('filters_active[]'), $fid, array( 'checked' => $f->active, 'extra_html' => 'title="' . __('Active') . '"' ) ) . '' . form::checkbox(array('filters_auto_del[]'), $fid, array( 'checked' => $f->auto_delete, 'extra_html' => 'title="' . __('Auto Del.') . '"' ) ) . '' . $f->name . '' . $f->description . '' . $gui_link . '
' . '

' . form::hidden('filters_order', '') . $core->formNonce() . '

' . '
'; # Syndication if (DC_ADMIN_URL) { $ham_feed = $core->blog->url . $core->url->getURLFor( 'hamfeed', $code = dcAntispam::getUserCode($core) ); $spam_feed = $core->blog->url . $core->url->getURLFor( 'spamfeed', $code = dcAntispam::getUserCode($core) ); echo '

' . __('Syndication') . '

' . ''; } dcPage::helpBlock('antispam', 'antispam-filters'); } ?>