</select></td>
</tr>
<tr>
- <td colspan="6" align="right"><input type="submit" name="submit" value=" - <?php echo GO ?> - " class="serendipityPrettyButton" /></td>
+ <td colspan="6" align="right"><input type="submit" name="submit" value=" - <?php echo GO ?> - " class="serendipityPrettyButton" /> <?php serendipity_plugin_api::hook_event('backend_comments_top', $sql); ?></td>
</tr>
</table>
</form>
+<hr noshade="noshade" /><br />
<?php
if (!is_array($sql)) {
echo '<div align="center">- '. NO_COMMENTS .' -</div>';
<table width="100%" cellspacing="0" cellpadding="3" border="0">
<tr>
<td rowspan="3" width="20" align="center"><input type="checkbox" name="serendipity[delete][<?php echo $comment['id'] ?>]" value="<?php echo $comment['entry_id'] ?>" onclick="highlightComment('comment_<?php echo $comment['id'] ?>', this.checked)" tabindex="<?php echo $i ?>" /></td>
- <td width="40%"><strong><?php echo AUTHOR ?></strong>: <?php echo htmlspecialchars($comment['author']) ?></td>
+ <td width="40%"><strong><?php echo AUTHOR ?></strong>: <?php echo htmlspecialchars($comment['author']) . $comment['action_author']; ?></td>
<td><strong><?php echo EMAIL ?></strong>:
<?php
if ( empty($comment['email']) ) {
} else {
?>
<a href="mailto:<?php echo htmlspecialchars($comment['email']) ?>"><?php echo htmlspecialchars($comment['email']) ?></a>
- <?php } ?></td>
+ <?php } ?>
+ <?php echo $comment['action_email']; ?>
+ </td>
</tr>
<tr>
<td width="40%"><strong>IP</strong>:
} else {
echo htmlspecialchars($comment['ip']);
}
- ?></td>
+ ?>
+ <?php echo $comment['action_ip']; ?>
+ </td>
<td><strong><?php echo URL; ?></strong>:
<?php
if ( empty($comment['url']) ) {
} else {
?>
<a href="<?php echo htmlspecialchars($comment['url']) ?>" target="_blank"><?php echo htmlspecialchars($comment['url']) ?></a>
- <?php } ?></td>
+ <?php } ?>
+ <?php echo $comment['action_url']; ?>
+ </td>
</tr>
<tr>
<td width="40%"> </td>
} else {
?>
<a href="<?php echo htmlspecialchars($comment['referer']) ?>" title="<?php echo htmlspecialchars($comment['referer']) ?>"><?php echo htmlspecialchars(serendipity_truncateString($comment['referer'],30)) ?></a>
- <?php } ?></td>
+ <?php } ?>
+ <?php echo $comment['action_referer']; ?>
+ </td>
<tr>
<td style="border-top: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC" colspan="3">
<div id="<?php echo $comment['id'] ?>_summary"><?php echo $comment['summary'] ?></div>
<?php } ?>
<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=edit&serendipity[id]=<?php echo $comment['id'] ?>&serendipity[entry_id]=<?php echo $comment['entry_id'] ?>&<?php echo serendipity_setFormToken('url'); ?>" title="<?php echo EDIT; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/edit.png'); ?>" alt="<?php echo EDIT; ?>" /><?php echo EDIT ?></a>
<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]=<?php echo $comment['id'] ?>&serendipity[entry_id]=<?php echo $comment['entry_id'] ?>&<?php echo serendipity_setFormToken('url'); ?>" onclick='return confirm("<?php echo sprintf(COMMENT_DELETE_CONFIRM, $comment['id'], htmlspecialchars($comment['author'])) ?>")' title="<?php echo DELETE ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/delete.png'); ?>" alt="<?php echo DELETE; ?>" /><?php echo DELETE ?></a>
+ <?php echo $comment['action_more']; ?>
</td>
</tr>
<tr>
- <td><hr noshade="noshade"></td>
+ <td><hr noshade="noshade" /></td>
</tr>
<?php } ?>
<tr>
@define('PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL', 'Ungültige E-Mail Adresse');
@define('PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL', 'Auf ungültige E-Mail Adressen prüfen?');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REQUIRED_FIELDS', 'Pflichtfelder');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REQUIRED_FIELDS_DESC', 'Geben Sie die Liste von Pflichtfeldern bei der Abgabe eines Kommentares ein. Mehrere Felder können mit "," getrennt werden. Verfügbare Felder sind: name, email, url, replyTo, comment');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REASON_REQUIRED_FIELD', 'Sie haben das Feld %s nicht ausgefüllt!');
+
+ @define('PLUGIN_EVENT_SPAMBLOCK_CONFIG', 'Anti-Spam-Maßnahmen konfigurieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR', 'Diesen Autoren via Spamschutz blockieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_ADD_URL', 'Diese URL via Spamschutz blockieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR', 'Blockade dieses Autoren via Spamschutz aufheben');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL', 'Blockade dieser URL via Spamschutz aufheben');
@define('PLUGIN_EVENT_SPAMBLOCK_REASON_CHECKMAIL', 'Ungültige E-Mail Adresse');
@define('PLUGIN_EVENT_SPAMBLOCK_CHECKMAIL', 'Auf ungültige E-Mail Adressen prüfen?');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REQUIRED_FIELDS', 'Pflichtfelder');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REQUIRED_FIELDS_DESC', 'Geben Sie die Liste von Pflichtfeldern bei der Abgabe eines Kommentares ein. Mehrere Felder können mit "," getrennt werden. Verfügbare Felder sind: name, email, url, replyTo, comment');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REASON_REQUIRED_FIELD', 'Sie haben das Feld %s nicht ausgefüllt!');
+
+ @define('PLUGIN_EVENT_SPAMBLOCK_CONFIG', 'Anti-Spam-Maßnahmen konfigurieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR', 'Diesen Autoren via Spamschutz blockieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_ADD_URL', 'Diese URL via Spamschutz blockieren');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR', 'Blockade dieses Autoren via Spamschutz aufheben');
+ @define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL', 'Blockade dieser URL via Spamschutz aufheben');
@define('PLUGIN_EVENT_SPAMBLOCK_REQUIRED_FIELDS_DESC', 'Enter a list of required fields that need to be filled when a user comments. Seperate multiple fields with a ",". Available keys are: name, email, url, replyTo, comment');
@define('PLUGIN_EVENT_SPAMBLOCK_REASON_REQUIRED_FIELD', 'You did not specify the %s field!');
+@define('PLUGIN_EVENT_SPAMBLOCK_CONFIG', 'Configure Anti-Spam methods');
+@define('PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR', 'Block this author via Spamblock plugin');
+@define('PLUGIN_EVENT_SPAMBLOCK_ADD_URL', 'Block this URL via Spamblock plugin');
+@define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR', 'Unblock this author via Spamblock plugin');
+@define('PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL', 'Unblock this URL via Spamblock plugin');
+
class serendipity_event_spamblock extends serendipity_event
{
var $filter_defaults;
'frontend_saveComment' => true,
'external_plugin' => true,
'frontend_comment' => true,
- 'fetchcomments' => true
+ 'fetchcomments' => true,
+ 'backend_comments_top' => true,
+ 'backend_view_comment' => true
));
$propbag->add('configuration', array('killswitch', 'bodyclone', 'ipflood', 'captchas', 'captchas_ttl', 'captcha_color', 'forcemoderation', 'disable_api_comments', 'links_moderate', 'links_reject', 'contentfilter_activate', 'contentfilter_urls', 'contentfilter_authors', 'hide_email', 'checkmail', 'required_fields', 'logtype', 'logfile'));
$propbag->add('groups', array('ANTISPAM'));
return true;
break;
+ case 'backend_comments_top':
+
+ // Add Author to blacklist. If already filtered, it will be removed from the filter. (AKA "Toggle")
+ if (isset($serendipity['GET']['spamBlockAuthor'])) {
+ $item = $this->getComment('author', $serendipity['GET']['spamBlockAuthor']);
+ $items = &$this->checkFilter('authors', $item, true);
+ $this->set_config('contentfilter_authors', implode(';', $items));
+ }
+
+ // Add URL to blacklist. If already filtered, it will be removed from the filter. (AKA "Toggle")
+ if (isset($serendipity['GET']['spamBlockURL'])) {
+ $item = $this->getComment('url', $serendipity['GET']['spamBlockURL']);
+ $items = &$this->checkFilter('urls', $item, true);
+ $this->set_config('contentfilter_urls', implode(';', $items));
+ }
+
+ echo ' - ' . WORD_OR . ' - <a class="serendipityPrettyButton" href="serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=serendipity_event_spamblock%3A' . $this->instance . '">' . PLUGIN_EVENT_SPAMBLOCK_CONFIG . '</a>';
+ return true;
+ break;
+
+ case 'backend_view_comment':
+ $author_is_filtered = $this->checkFilter('authors', $eventData['author']);
+ $eventData['action_author'] .= ' <a class="serendipityIconLink" title="' . ($author_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR : PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR) . '" href="serendipity_admin.php?serendipity[adminModule]=comments&serendipity[spamBlockAuthor]=' . $eventData['id'] . '"><img src="' . serendipity_getTemplateFile('admin/img/' . ($author_is_filtered ? 'un' : '') . 'configure.png') . '" /></a>';
+
+ if (!empty($eventData['url'])) {
+ $url_is_filtered = $this->checkFilter('urls', $eventData['url']);
+ $eventData['action_url'] .= ' <a class="serendipityIconLink" title="' . ($url_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL : PLUGIN_EVENT_SPAMBLOCK_ADD_URL) . '" href="serendipity_admin.php?serendipity[adminModule]=comments&serendipity[spamBlockURL]=' . $eventData['id'] . '"><img src="' . serendipity_getTemplateFile('admin/img/' . ($url_is_filtered ? 'un' : '') . 'configure.png') . '" /></a>';
+ }
+
+ return true;
+ break;
+
default:
return false;
break;
}
}
+ function &checkFilter($what, $match, $getItems = false) {
+ $items = explode(';', $this->get_config('contentfilter_' . $what, $this->filter_defaults[$what]));
+
+ $filtered = false;
+ if (is_array($items)) {
+ foreach($items AS $key => $item) {
+ if (empty($match)) {
+ continue;
+ }
+
+ if (empty($item)) {
+ unset($items[$key]);
+ continue;
+ }
+
+ if (preg_match('@' . $item . '@', $match)) {
+ $filtered = true;
+ unset($items[$key]);
+ }
+ }
+ }
+
+ if ($getItems) {
+ if (!$filtered && !empty($match)) {
+ $items[] = preg_quote($match, '@');
+ }
+
+ return $items;
+ }
+
+ return $filtered;
+ }
+
+ function getComment($key, $id) {
+ global $serendipity;
+ $c = serendipity_db_query("SELECT $key FROM {$serendipity['dbPrefix']}comments WHERE id = '" . (int)$id . "'", true, 'assoc');
+
+ if (!is_array($c) || !isset($c[$key])) {
+ return false;
+ }
+
+ return $c[$key];
+ }
+
function random_string($max_char, $min_char) {
$this->chars = array(2, 3, 4, 7, 9); // 1, 5, 6 and 8 may look like characters.
$this->chars = array_merge($this->chars, array('A','B','C','D','E','F','H','J','K','L','M','N','P','Q','R','T','U','V','W','X','Y','Z')); // I, O, S may look like numbers