Dotclear

source: plugins/antispam/_admin.php @ 324:07f1d829b183

Revision 324:07f1d829b183, 2.5 KB checked in by xave <xave@…>, 14 years ago (diff)

Favourites are now internally handled in English and translated
only when displayed.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Antispam, a plugin for Dotclear 2.
5#
6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_CONTEXT_ADMIN')) { return; }
13
14if (!defined('DC_ANTISPAM_CONF_SUPER')) {
15     define('DC_ANTISPAM_CONF_SUPER',false);
16}
17
18$_menu['Plugins']->addItem(__('Antispam'),'plugin.php?p=antispam','index.php?pf=antispam/icon.png',
19          preg_match('/plugin.php\?p=antispam(&.*)?$/',$_SERVER['REQUEST_URI']),
20          $core->auth->check('admin',$core->blog->id));
21
22$core->addBehavior('coreAfterCommentUpdate',array('dcAntispam','trainFilters'));
23$core->addBehavior('adminAfterCommentDesc',array('dcAntispam','statusMessage'));
24$core->addBehavior('adminDashboardIcons',array('dcAntispam','dashboardIcon'));
25
26$core->addBehavior('adminDashboardFavs','antispamDashboardFavs');
27$core->addBehavior('adminDashboardFavsIcon','antispamDashboardFavsIcon');
28
29function antispamDashboardFavs($core,$favs)
30{
31     $favs['antispam'] = new ArrayObject(array('antispam','Antispam','plugin.php?p=antispam',
32          'index.php?pf=antispam/icon.png','index.php?pf=antispam/icon-big.png',
33          'admin',null,null));
34}
35
36function antispamDashboardFavsIcon($core,$name,$icon)
37{
38     // Check if it is comments favs
39     if ($name == 'comments') {
40          // Hack comments title if there is at least one spam
41          $str = dcAntispam::dashboardIconTitle($core);
42          if ($str != '') {
43               $icon[0] .= $str;
44          }
45     }
46}
47
48if (!DC_ANTISPAM_CONF_SUPER || $core->auth->isSuperAdmin()) {
49     $core->addBehavior('adminBlogPreferencesForm',array('antispamBehaviors','adminBlogPreferencesForm'));
50     $core->addBehavior('adminBeforeBlogSettingsUpdate',array('antispamBehaviors','adminBeforeBlogSettingsUpdate'));
51}
52
53class antispamBehaviors
54{
55     public static function adminBlogPreferencesForm($core,$settings)
56     {
57          $ttl = $settings->antispam->antispam_moderation_ttl;
58          echo
59          '<fieldset><legend>Antispam</legend>'.
60          '<p><label for="antispam_moderation_ttl" class="classic">'.__('Delete junk comments older than').' '.
61          form::field('antispam_moderation_ttl', 3, 3, $ttl).
62          ' '.__('days').
63          '</label></p>'.
64          '</fieldset>';
65     }
66     
67     public static function adminBeforeBlogSettingsUpdate($settings)
68     {
69          $settings->addNamespace('antispam');
70          $settings->antispam->put('antispam_moderation_ttl',(integer)$_POST['antispam_moderation_ttl']);
71     }
72}
73?>
Note: See TracBrowser for help on using the repository browser.

Sites map