remove comments by author overview page

Not used by known themes, not properly documented
This commit is contained in:
onli 2015-07-26 20:10:40 +02:00
parent d0dc9da015
commit c8b4faf93a
5 changed files with 0 additions and 149 deletions

View File

@ -432,86 +432,6 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
return serendipity_smarty_fetch($smarty_block, $smarty_file);
}
/**
* Fetches and prints a listing of comments by author
*/
function serendipity_printCommentsByAuthor() {
global $serendipity;
$type = serendipity_db_escape_string($serendipity['GET']['commentMode']);
if ($type == 'comments' || empty($type)) {
$type = 'NORMAL';
} elseif ($type == 'trackbacks') {
$type = 'TRACKBACK';
} elseif ($type == 'comments_and_trackbacks') {
$type = '%';
}
if (!empty($serendipity['GET']['viewCommentAuthor'])) {
$sql_where = " AND co.author = '" . serendipity_db_escape_string($serendipity['GET']['viewCommentAuthor']) . "'";
$group_by = "GROUP BY co.author";
} else {
$sql_where = " AND 1"; // Required fake 'where' condition
$group_by = "";
}
if (!empty($serendipity['GET']['commentStartTime'])) {
$sql_where .= " AND co.timestamp >= " . (int)$serendipity['GET']['commentStartTime'];
}
if (!empty($serendipity['GET']['commentEndTime'])) {
$sql_where .= " AND co.timestamp <= " . (int)$serendipity['GET']['commentEndTime'];
}
if (empty($serendipity['GET']['page'])) {
$serendipity['GET']['page'] = 1;
}
$sql_limit = $serendipity['fetchLimit'] * ($serendipity['GET']['page']-1) . ',' . $serendipity['fetchLimit'];
$c = serendipity_fetchComments(null, $sql_limit, 'co.entry_id DESC, co.id ASC', false, $type, $sql_where);
$entry_comments = array();
foreach($c as $i => $comment) {
if (!isset($entry_comments[$comment['entry_id']])) {
$comment['link'] = serendipity_archiveURL($comment['entry_id'], $comment['title'], 'serendipityHTTPPath', true, array('timestamp' => $comment['entrytimestamp']));
$entry_comments[$comment['entry_id']] = $comment;
}
$entry_comments[$comment['entry_id']]['comments'][] = $comment;
}
foreach($entry_comments AS $entry_id => $_data) {
$entry_comments[$entry_id]['tpl_comments'] = serendipity_printComments($_data['comments'], VIEWMODE_LINEAR, 0, null, 'COMMENTS', 'comments.tpl');
}
$serendipity['smarty']->assignByRef('comments_by_authors', $entry_comments);
if (!empty($id)) {
$and .= " AND co.entry_id = '" . (int)$id ."'";
}
if (!$showAll) {
$and .= ' AND co.status = \'approved\'';
}
$fc = "SELECT count(co.id) AS counter
FROM {$serendipity['dbPrefix']}comments AS co
WHERE co.entry_id > 0
AND co.type LIKE '" . $type . "'
AND co.status = 'approved' " . $sql_where . " "
. $group_by;
$cc = serendipity_db_query($fc, true, 'assoc');
if (!isset($cc['counter'])) {
$totalComments = 0;
} else {
$totalComments = $cc['counter'];
}
serendipity_printEntryFooter('', $totalComments);
serendipity_smarty_fetch('ENTRIES', 'comments_by_author.tpl');
return true;
}
/**
* Delete a specific comment
*

View File

@ -69,58 +69,6 @@ function locateHiddenVariables($_args) {
return $_args;
}
function serveComments() {
global $serendipity;
$serendipity['view'] = 'comments';
$_args = serendipity_getUriArguments($uri, true); // Need to also match "." character
$timedesc = array();
/* Attempt to locate hidden variables within the URI */
foreach ($_args AS $k => $v){
if ($v == PATH_COMMENTS) {
continue;
}
if (preg_match('@^(last|f|t|from|to)[\s_-]*([\d-/ ]+)$@', strtolower(urldecode($v)), $m)) {
if ($m[1] == 'last') {
$usetime = time() - ($m[2]*86400);
$serendipity['GET']['commentStartTime'] = $usetime;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $usetime);
continue;
}
$date = strtotime($m[2]);
if ($date < 1) {
continue;
}
if ($m[1] == 'f' || $m[1] == 'from') {
$serendipity['GET']['commentStartTime'] = $date;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
} else {
$serendipity['GET']['commentEndTime'] = $date;
$timedesc['end'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
}
} elseif ($v == 'trackbacks' || $v == 'comments_and_trackbacks' || $v == 'comments') {
$serendipity['GET']['commentMode'] = $v;
} elseif (!empty($v)) {
$serendipity['GET']['viewCommentAuthor'] .= urldecode($v);
}
}
$serendipity['head_title'] = COMMENTS_FROM . ' ' . serendipity_specialchars($serendipity['GET']['viewCommentAuthor']);
if (isset($timedesc['start']) && isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (' . $timedesc['start'] . ' - ' . $timedesc['end'] . ')';
} elseif (isset($timedesc['start'])) {
$serendipity['head_title'] .= ' (&gt; ' . $timedesc['start'] . ')';
} elseif (isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (&lt; ' . $timedesc['end'] . ')';
}
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
$serendipity['GET']['action'] = 'comments';
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
}
function serveJS($js_mode) {
global $serendipity;
$serendipity['view'] = 'js';

View File

@ -95,13 +95,6 @@ switch ($serendipity['GET']['action']) {
serendipity_printEntries($r);
break;
// Show the comments
case 'comments':
serendipity_printCommentsByAuthor();
// use 'content_message' for pagination?
break;
// Show the archive
case 'archives':
$serendipity['head_subtitle'] = ARCHIVES;

View File

@ -257,14 +257,6 @@
'permission' => 'siteConfiguration',
'flags' => array('ifEmpty')),
array('var' => 'permalinkCommentsPath',
'title' => INSTALL_PERMALINK_COMMENTSPATH,
'description' => '',
'type' => 'string',
'default' => 'comments',
'permission' => 'siteConfiguration',
'flags' => array('ifEmpty')),
)
);

View File

@ -96,8 +96,6 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
} elseif (preg_match(PAT_JS, $uri, $matches)) {
serveJS($matches[1]);
exit;
} else if (preg_match(PAT_COMMENTS, $uri, $matches)) {
serveComments();
} else if (preg_match('@/(index(\.php|\.html)?)|'. preg_quote($serendipity['indexFile']) .'@', $uri) ||
preg_match('@^/' . preg_quote(trim($serendipity['serendipityHTTPPath'], '/')) . '/?(\?.*)?$@', $uri)) {
serveIndex();