if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
- document.getElementById(id + '_text').innerHTML = '<?php echo VIEW ?>';
+ document.getElementById(id + '_text').innerHTML = '<?php echo TOGGLE_ALL ?>';
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=approve&serendipity[id]=<?php echo $comment['id'] ?>&<?php echo serendipity_setFormToken('url'); ?>" class="serendipityIconLink" title="<?php echo APPROVE; ?>"><img src="<?php echo serendipity_getTemplateFile('admin/img/accept.png'); ?>" alt="<?php echo APPROVE ?>" /><?php echo APPROVE ?></a>
<?php } ?>
<?php if ($comment['excerpt']) { ?>
- <a href="#c<?php echo $comment['id'] ?>" onclick="FT_toggle(<?php echo $comment['id'] ?>); return false;" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo VIEW; ?>" /><span id="<?php echo $comment['id'] ?>_text"><?php echo VIEW ?></span></a>
+ <a href="#c<?php echo $comment['id'] ?>" onclick="FT_toggle(<?php echo $comment['id'] ?>); return false;" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo TOGGLE_ALL; ?>" /><span id="<?php echo $comment['id'] ?>_text"><?php echo TOGGLE_ALL ?></span></a>
<?php } ?>
- <a target="_blank" href="<?php echo $entrylink; ?>" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo EDIT; ?>" /><?php echo VIEW ?></a>
+ <a target="_blank" href="<?php echo $entrylink; ?>" title="<?php echo VIEW; ?>" class="serendipityIconLink"><img src="<?php echo serendipity_getTemplateFile('admin/img/zoom.png'); ?>" alt="<?php echo VIEW; ?>" /><?php echo VIEW ?></a>
<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']; ?>
function serendipity_deleteComment($id, $entry_id, $type='comments') {
global $serendipity;
+ $id = (int)$id;
+ $entry_id = (int)$entry_id;
+ if ($id < 1 OR $entry_id < 1) {
+ return false;
+ }
+
if ($_SESSION['serendipityAuthedUser'] === true) {
$admin = '';
if (!serendipity_checkPermission('adminEntriesMaintainOthers')) {
/* We have to figure out if the comment we are about to delete, is awaiting approval,
if so - we should *not* subtract it from the entries table */
- $sql = serendipity_db_query("SELECT status, parent_id, body FROM {$serendipity['dbPrefix']}comments
- WHERE entry_id = ". (int)$entry_id ."
- AND id = ". (int)$id ."
- $admin", true);
+ $sql = serendipity_db_query("SELECT type, status, parent_id, body FROM {$serendipity['dbPrefix']}comments
+ WHERE entry_id = ". $entry_id ."
+ AND id = ". $id, true);
/* Check to see if the comment has children
to delete a tree, delete children first */
$has_parent = serendipity_db_query("SELECT count(id) AS count
FROM {$serendipity['dbPrefix']}comments
- WHERE parent_id = ". (int)$id . "
+ WHERE parent_id = ". $id . "
LIMIT 1", true);
if (is_array($has_parent) && isset($has_parent['count']) && $has_parent['count'] > 0 && $sql['body'] != 'COMMENT_DELETED') {
// Comment has childs, so don't delete it.
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments
SET body = 'COMMENT_DELETED'
- WHERE id = " . (int)$id);
+ WHERE id = " . $id);
} else {
// Comment has no childs or had already been deleted., it can be safely removed.
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}comments
- WHERE entry_id = '". (int)$entry_id ."'
- AND id = '". (int)$id ."'
- $admin");
+ WHERE entry_id = ". $entry_id ."
+ AND id = ". $id);
if (is_array($sql) && $sql['status'] !== 'pending') {
- serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = '". (int)$entry_id ."' $admin");
+ if (!empty($sql['type']) && $sql['type'] != 'NORMAL') {
+ $type = 'trackbacks';
+ } else {
+ $type = 'comments';
+ }
+ serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id ." $admin");
}
- serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = '" . (int)$id . "'");
+ serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id);
}
return true;
} else {