diff --git a/include/admin/comments.inc.php b/include/admin/comments.inc.php index e52f992f..5cd62bfc 100644 --- a/include/admin/comments.inc.php +++ b/include/admin/comments.inc.php @@ -278,6 +278,12 @@ $sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']} WHERE 1 = 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int)$serendipity['authorid'] : '') . " ORDER BY c.id DESC $limit"); + +ob_start(); +# This event has to get send here so the spamblock-plugin can block an author now and the comment_page show that on this pageload +serendipity_plugin_api::hook_event('backend_comments_top', $sql); +$data['backend_comments_top'] = ob_get_contents(); +ob_end_clean(); $data['commentsPerPage'] = $commentsPerPage; $data['totalComments'] = $totalComments; diff --git a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php index ea6c844a..bca47f4c 100644 --- a/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php +++ b/plugins/serendipity_event_spamblock/serendipity_event_spamblock.php @@ -1397,26 +1397,27 @@ var $filter_defaults; case 'backend_view_comment': $author_is_filtered = $this->checkFilter('authors', $eventData['author']); - $clink1 = 'clink1' . $eventData['id']; - $clink2 = 'clink2' . $eventData['id']; - + $clink = 'comment_' . $eventData['id']; + $randomString = '&random=' . substr(sha1(rand()), 0, 10); # the random string will force browser to reload the page, + # so the server knows who to block/unblock when clicking again on the same link, + # see http://stackoverflow.com/a/2573986/2508518, http://stackoverflow.com/a/14043346/2508518 $akismet_apikey = $this->get_config('akismet'); $akismet = $this->get_config('akismet_filter'); if (!empty($akismet_apikey)) { - $eventData['action_more'] .= ' ' . PLUGIN_EVENT_SPAMBLOCK_SPAM . ''; - $eventData['action_more'] .= ' ' . PLUGIN_EVENT_SPAMBLOCK_NOT_SPAM . ''; + $eventData['action_more'] .= ' ' . PLUGIN_EVENT_SPAMBLOCK_SPAM . ''; + $eventData['action_more'] .= ' ' . PLUGIN_EVENT_SPAMBLOCK_NOT_SPAM . ''; } - $eventData['action_author'] .= ' ' . ($author_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR : PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR) . ''; + $eventData['action_author'] .= ' ' . ($author_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_AUTHOR : PLUGIN_EVENT_SPAMBLOCK_ADD_AUTHOR) . ''; if (!empty($eventData['url'])) { $url_is_filtered = $this->checkFilter('urls', $eventData['url']); - $eventData['action_url'] .= ' ' . ($url_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL : PLUGIN_EVENT_SPAMBLOCK_ADD_URL) . ''; + $eventData['action_url'] .= ' ' . ($url_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_URL : PLUGIN_EVENT_SPAMBLOCK_ADD_URL) . ''; } if (!empty($eventData['email'])) { $email_is_filtered = $this->checkFilter('emails', $eventData['email']); - $eventData['action_email'] .= ' ' . ($email_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_EMAIL : PLUGIN_EVENT_SPAMBLOCK_ADD_EMAIL) . ''; + $eventData['action_email'] .= ' ' . ($email_is_filtered ? PLUGIN_EVENT_SPAMBLOCK_REMOVE_EMAIL : PLUGIN_EVENT_SPAMBLOCK_ADD_EMAIL) . ''; } return true; diff --git a/templates/2k11/admin/comments.inc.tpl b/templates/2k11/admin/comments.inc.tpl index 7709d810..fc04c7bd 100644 --- a/templates/2k11/admin/comments.inc.tpl +++ b/templates/2k11/admin/comments.inc.tpl @@ -14,7 +14,7 @@
diff --git a/templates/2k11/admin/serendipity_editor.js.tpl b/templates/2k11/admin/serendipity_editor.js.tpl index 438ad15c..387f5244 100644 --- a/templates/2k11/admin/serendipity_editor.js.tpl +++ b/templates/2k11/admin/serendipity_editor.js.tpl @@ -1000,12 +1000,17 @@ var AccessifyHTML5 = function (defaults, more_fixes) { $('.comments_pane .pagination').clone().prependTo('.comments_pane'); $('.entries_pane .pagination').clone().prependTo('.entries_pane'); + // close comment reply on button click if ($('body').has('#comment_replied').size() > 0) { $('#comment_replied').click(function() { serendipity.closeCommentPopup(); }); } - + + // reopen detail element after spamblock action + if ($('body').has('#serendipity_comments_list').size() > 0 && window.location.hash && $('body').has('#' + window.location.hash.replace('#', '')).size() > 0) { + $('#' + window.location.hash.replace('#', '')).find(".toggle_info").click(); + } // Equal Heights $(window).load(function() { @@ -1016,3 +1021,5 @@ var AccessifyHTML5 = function (defaults, more_fixes) { } }); })(jQuery); + +