'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.32');
+ $propbag->add('version', '1.33');
$propbag->add('event_hooks', array(
'frontend_saveComment' => true,
'external_plugin' => true,
'backend_comments_top' => true,
'backend_view_comment' => true
));
- $propbag->add('configuration', array('killswitch', 'bodyclone', 'entrytitle', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'trackback_check_url', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'bloggdeblacklist', 'contentfilter_authors', 'hide_email', 'checkmail', 'required_fields', 'logtype', 'logfile'));
+ $propbag->add('configuration', array('killswitch', 'hide_for_authors', 'bodyclone', 'entrytitle', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'trackback_check_url', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'bloggdeblacklist', 'contentfilter_authors', 'hide_email', 'checkmail', 'required_fields', 'logtype', 'logfile'));
$propbag->add('groups', array('ANTISPAM'));
$this->filter_defaults = array(
));
break;
+ case 'hide_for_authors':
+ $_groups =& serendipity_getAllGroups();
+ $groups = array(
+ 'all' => ALL_AUTHORS,
+ 'none' => NONE
+ );
+
+ foreach($_groups AS $group) {
+ $groups[$group['confkey']] = $group['confvalue'];
+ }
+
+ $propbag->add('type', 'multiselect');
+ $propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_HIDE);
+ $propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_HIDE_DESC);
+ $propbag->add('select_values', $groups);
+ $propbag->add('select_size', 5);
+ $propbag->add('default', 'all');
+ break;
+
case 'killswitch':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_KILLSWITCH);
$title = $this->title;
}
+ // Checks whether the current author is contained in one of the gorups that need no spam checking
+ function inGroup() {
+ global $serendipity;
+
+ $checkgroups = explode('^', $this->get_config('hide_for_authors'));
+
+ if (!isset($serendipity['authorid']) || !is_array($checkgroups)) {
+ return false;
+ }
+
+ $mygroups =& serendipity_getGroups($serendipity['authorid'], true);
+ if (!is_array($mygroups)) {
+ return false;
+ }
+
+ foreach($checkgroups AS $key => $groupid) {
+ if ($groupid == 'all') {
+ return true;
+ } elseif (in_array($groupid, $mygroups)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
}
}
}
+
+ // Check whether to allow comments from registered authors
+ if (serendipity_userLoggedIn() && $this->inGroup()) {
+ return true;
+ }
// Check if entry title is the same as comment body
if (serendipity_db_bool($this->get_config('entrytitle')) && trim($eventData['title']) == trim($addData['comment'])) {
echo '<div class="serendipity_commentDirection serendipity_comment_spamblock">' . PLUGIN_EVENT_SPAMBLOCK_HIDE_EMAIL_NOTICE . '</div>';
}
+ // Check whether to allow comments from registered authors
+ if (serendipity_userLoggedIn() && $this->inGroup()) {
+ return true;
+ }
+
if ($show_captcha) {
echo '<div class="serendipity_commentDirection serendipity_comment_captcha">';
if (!isset($serendipity['POST']['preview']) || strtolower($serendipity['POST']['captcha'] != strtolower($_SESSION['spamblock']['captcha']))) {