Merge pull request #526 from th-h/thh-comment-messages
Fix display of messages for comment editing.
This commit is contained in:
commit
440b189372
@ -9,23 +9,23 @@ $data = array();
|
|||||||
$commentsPerPage = (int)(!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10);
|
$commentsPerPage = (int)(!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10);
|
||||||
$summaryLength = 200;
|
$summaryLength = 200;
|
||||||
|
|
||||||
$errormsg = '';
|
$errormsg = array();
|
||||||
$msg = '';
|
$msg = array();
|
||||||
|
|
||||||
if ($serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) {
|
if ($serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) {
|
||||||
if ($serendipity['POST']['togglemoderate'] != '') {
|
if ($serendipity['POST']['togglemoderate'] != '') {
|
||||||
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
|
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
|
||||||
$ac = serendipity_approveComment((int)$k, (int)$v, false, 'flip');
|
$ac = serendipity_approveComment((int)$k, (int)$v, false, 'flip');
|
||||||
if ($ac > 0) {
|
if ($ac > 0) {
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_APPROVED, (int)$k);
|
$msg[] = DONE . ': '. sprintf(COMMENT_APPROVED, (int)$k);
|
||||||
} else {
|
} else {
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_MODERATED, (int)$k);
|
$msg[] = DONE . ': '. sprintf(COMMENT_MODERATED, (int)$k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
|
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
|
||||||
serendipity_deleteComment($k, $v);
|
serendipity_deleteComment($k, $v);
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_DELETED, (int)$k);
|
$msg[] = DONE . ': '. sprintf(COMMENT_DELETED, (int)$k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio
|
|||||||
entry_id = " . (int)$serendipity['POST']['entry_id'];
|
entry_id = " . (int)$serendipity['POST']['entry_id'];
|
||||||
serendipity_db_query($sql);
|
serendipity_db_query($sql);
|
||||||
serendipity_plugin_api::hook_event('backend_updatecomment', $serendipity['POST'], $serendipity['GET']['id']);
|
serendipity_plugin_api::hook_event('backend_updatecomment', $serendipity['POST'], $serendipity['GET']['id']);
|
||||||
$msg .= COMMENT_EDITED;
|
$msg[] = COMMENT_EDITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Submit a new comment */
|
/* Submit a new comment */
|
||||||
@ -63,11 +63,11 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio
|
|||||||
echo serendipity_smarty_show('admin/comments.inc.tpl', $data);
|
echo serendipity_smarty_show('admin/comments.inc.tpl', $data);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$errormsg .= COMMENT_NOT_ADDED;
|
$errormsg[] = COMMENT_NOT_ADDED;
|
||||||
$serendipity['GET']['adminAction'] = 'reply';
|
$serendipity['GET']['adminAction'] = 'reply';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$errormsg .= COMMENT_NOT_ADDED;
|
$errormsg[] = COMMENT_NOT_ADDED;
|
||||||
$serendipity['GET']['adminAction'] = 'reply';
|
$serendipity['GET']['adminAction'] = 'reply';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,10 +82,10 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio
|
|||||||
$rs = serendipity_db_query($sql, true);
|
$rs = serendipity_db_query($sql, true);
|
||||||
|
|
||||||
if ($rs === false) {
|
if ($rs === false) {
|
||||||
$errormsg .= ERROR .': '. sprintf(COMMENT_ALREADY_APPROVED, (int)$serendipity['GET']['id']);
|
$errormsg[] = ERROR .': '. sprintf(COMMENT_ALREADY_APPROVED, (int)$serendipity['GET']['id']);
|
||||||
} else {
|
} else {
|
||||||
serendipity_approveComment((int)$serendipity['GET']['id'], (int)$rs['entry_id']);
|
serendipity_approveComment((int)$serendipity['GET']['id'], (int)$rs['entry_id']);
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_APPROVED, (int)$serendipity['GET']['id']);
|
$msg[] = DONE . ': '. sprintf(COMMENT_APPROVED, (int)$serendipity['GET']['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,17 +98,17 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio
|
|||||||
$rs = serendipity_db_query($sql, true);
|
$rs = serendipity_db_query($sql, true);
|
||||||
|
|
||||||
if ($rs === false) {
|
if ($rs === false) {
|
||||||
$errormsg .= ERROR .': '. sprintf(COMMENT_ALREADY_APPROVED, (int)$serendipity['GET']['id']);
|
$errormsg[] = ERROR .': '. sprintf(COMMENT_ALREADY_APPROVED, (int)$serendipity['GET']['id']);
|
||||||
} else {
|
} else {
|
||||||
serendipity_approveComment((int)$serendipity['GET']['id'], (int)$rs['entry_id'], true, true);
|
serendipity_approveComment((int)$serendipity['GET']['id'], (int)$rs['entry_id'], true, true);
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_MODERATED, (int)$serendipity['GET']['id']);
|
$msg[] = DONE . ': '. sprintf(COMMENT_MODERATED, (int)$serendipity['GET']['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are asked to delete a comment */
|
/* We are asked to delete a comment */
|
||||||
if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminAction'] == 'delete' && serendipity_checkFormToken()) {
|
if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminAction'] == 'delete' && serendipity_checkFormToken()) {
|
||||||
serendipity_deleteComment($serendipity['GET']['id'], $serendipity['GET']['entry_id']);
|
serendipity_deleteComment($serendipity['GET']['id'], $serendipity['GET']['entry_id']);
|
||||||
$msg .= DONE . ': '. sprintf(COMMENT_DELETED, (int)$serendipity['GET']['id']);
|
$msg[] = DONE . ': '. sprintf(COMMENT_DELETED, (int)$serendipity['GET']['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are either in edit mode, or preview mode */
|
/* We are either in edit mode, or preview mode */
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
{if !empty($errormsg)}
|
{if !empty($errormsg)}
|
||||||
<span class="msg_error"><span class="icon-attention" aria-hidden="true"></span> {$errormsg}</span>
|
{foreach $errormsg as $show_errormsg}
|
||||||
|
<span class="msg_error"><span class="icon-attention" aria-hidden="true"></span> {$show_errormsg}</span>
|
||||||
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
{if !empty($msg)}
|
{if !empty($msg)}
|
||||||
<span class="msg_notice"><span class="icon-info-circled" aria-hidden="true"></span> {$msg}</span>
|
{foreach $msg as $show_msg}
|
||||||
|
<span class="msg_notice"><span class="icon-info-circled" aria-hidden="true"></span> {$show_msg}</span>
|
||||||
|
{/foreach}
|
||||||
{/if}
|
{/if}
|
||||||
{if $commentReplied}
|
{if $commentReplied}
|
||||||
<span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> {$CONST.COMMENT_ADDED}</span>
|
<span class="msg_success"><span class="icon-ok-circled" aria-hidden="true"></span> {$CONST.COMMENT_ADDED}</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user