missing commit

This commit is contained in:
Garvin Hicking 2010-12-21 19:41:19 +00:00
parent aca4ba7d60
commit e46563693c
4 changed files with 46 additions and 8 deletions

View File

@ -3,6 +3,8 @@
Version 1.6 () Version 1.6 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Allow to moderate multiple selected comments (garvinhicking)
* Allow to pass 'template' variable to serendipity_showPlugin * Allow to pass 'template' variable to serendipity_showPlugin
* Make CSS permalink pattern compatible to 1&1 servers, * Make CSS permalink pattern compatible to 1&1 servers,
@ -83,6 +85,14 @@ Version 1.6 ()
* Added event hook backend_sendcomment for sending comments and * Added event hook backend_sendcomment for sending comments and
being able to chang via plugin API (onli) being able to chang via plugin API (onli)
Version 1.5.5 (December 21st, 2010)
------------------------------------------------------------------------
* Due to security issues in the bundled Xinha WYSIWYG,
disabled the PHP-based plugins (which are not utilized by
serendipity unless manually enabled), until a proper security
fix is available
Version 1.5.4 (August 26th, 2010) Version 1.5.4 (August 26th, 2010)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View File

@ -14,10 +14,21 @@ $commentsPerPage = (int)(!empty($serendipity['GET']['filter']['perpage']) ? $ser
$summaryLength = 200; $summaryLength = 200;
if ($serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) { if ($serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) {
foreach ( $serendipity['POST']['delete'] as $k => $v ) { if ($serendipity['POST']['togglemoderate'] != '') {
serendipity_deleteComment($k, $v); foreach ( $serendipity['POST']['delete'] as $k => $v ) {
echo DONE . ': '. sprintf(COMMENT_DELETED, (int)$k) . '<br />'; $ac = serendipity_approveComment($k, $v, false, 'flip');
} if ($ac > 0) {
echo DONE . ': '. sprintf(COMMENT_APPROVED, (int)$k) . '<br />';
} else {
echo DONE . ': '. sprintf(COMMENT_MODERATED, (int)$k) . '<br />';
}
}
} else {
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
# serendipity_deleteComment($k, $v);
echo DONE . ': '. sprintf(COMMENT_DELETED, (int)$k) . '<br />';
}
}
} }
@ -544,7 +555,10 @@ foreach ($sql as $rs) {
</tr> </tr>
<?php } ?> <?php } ?>
<tr> <tr>
<td><input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS ?>" onclick="invertSelection()" class="serendipityPrettyButton input_button" /> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_COMMENTS ?>" onclick="return confirm('<?php echo COMMENTS_DELETE_CONFIRM ?>')" tabindex="<?php echo ($i+1) ?>" class="serendipityPrettyButton input_button" /></td> <td><input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS ?>" onclick="invertSelection()" class="serendipityPrettyButton input_button" />
<input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_COMMENTS ?>" onclick="return confirm('<?php echo COMMENTS_DELETE_CONFIRM ?>')" tabindex="<?php echo ($i+1) ?>" class="serendipityPrettyButton input_button" />
<input type="submit" name="serendipity[togglemoderate]" value="<?php echo MODERATE_SELECTED_COMMENTS ?>" class="serendipityPrettyButton input_button" />
</td>
</tr> </tr>
</table> </table>
<table width="100%" cellpadding="3" border="0" cellspacing="0"> <table width="100%" cellpadding="3" border="0" cellspacing="0">

View File

@ -635,8 +635,18 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
". (($force === true) ? "" : "AND status = 'pending'"); ". (($force === true) ? "" : "AND status = 'pending'");
$rs = serendipity_db_query($sql, true); $rs = serendipity_db_query($sql, true);
$flip = false;
if ($moderate === 'flip') {
$flip = true;
if ($moderate) { if ($rs['status'] == 'pending') {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
$moderate = false;
} else {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
$moderate = true;
}
} elseif ($moderate) {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'pending' WHERE id = ". (int)$cid;
} else { } else {
$sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid; $sql = "UPDATE {$serendipity['dbPrefix']}comments SET status = 'approved' WHERE id = ". (int)$cid;
@ -689,6 +699,11 @@ function serendipity_approveComment($cid, $entry_id, $force = false, $moderate =
serendipity_plugin_api::hook_event('backend_approvecomment', $rs); serendipity_plugin_api::hook_event('backend_approvecomment', $rs);
} }
if ($flip) {
if ($moderate) return -1; // comment set to pending
if (!$moderate) return 1; // comment set to approved
}
return true; return true;
} }

View File

@ -513,14 +513,13 @@ function serendipity_smarty_hookPlugin($params, &$smarty) {
'entries_footer', 'entries_footer',
'frontend_comment', 'frontend_comment',
'frontend_footer'); 'frontend_footer');
if (!isset($params['hook'])) { if (!isset($params['hook'])) {
$smarty->trigger_error(__FUNCTION__ .": missing 'hook' parameter"); $smarty->trigger_error(__FUNCTION__ .": missing 'hook' parameter");
return; return;
} }
if (!in_array($params['hook'], $hookable) && $params['hookAll'] != 'true') { if (!in_array($params['hook'], $hookable) && $params['hookAll'] != 'true') {
$smarty->trigger_error(__FUNCTION__ .": illegal hook '". $params['hook'] ."'"); $smarty->trigger_error(__FUNCTION__ .": illegal hook '". $params['hook'] ."' (" . $params['hookAll'] . ")");
return; return;
} }