php 8 compat fixes for comment section
This commit is contained in:
@ -13,7 +13,7 @@ $errormsg = array();
|
||||
$msg = array();
|
||||
|
||||
if (isset($serendipity['POST']['formAction']) && $serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 && serendipity_checkFormToken()) {
|
||||
if ($serendipity['POST']['togglemoderate'] != '') {
|
||||
if (($serendipity['POST']['togglemoderate'] ?? null) != '') {
|
||||
foreach ( $serendipity['POST']['delete'] as $k => $v ) {
|
||||
$ac = serendipity_approveComment((int)$k, (int)$v, false, 'flip');
|
||||
if ($ac > 0) {
|
||||
@ -54,7 +54,7 @@ if (isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActio
|
||||
$comment['comment'] = trim($serendipity['POST']['comment']);
|
||||
$comment['name'] = $serendipity['POST']['name'];
|
||||
$comment['email'] = $serendipity['POST']['email'];
|
||||
$comment['subscribe'] = $serendipity['POST']['subscribe'];
|
||||
$comment['subscribe'] = $serendipity['POST']['subscribe'] ?? false;
|
||||
$comment['parent_id'] = $serendipity['POST']['replyTo'];
|
||||
|
||||
if (!empty($comment['comment'])) {
|
||||
@ -131,7 +131,8 @@ if (isset($serendipity['GET']['adminAction']) && ($serendipity['GET']['adminActi
|
||||
'body' => $serendipity['POST']['comment'],
|
||||
'url' => $serendipity['POST']['url'],
|
||||
'timestamp' => time(),
|
||||
'parent_id' => $serendipity['GET']['id']
|
||||
'parent_id' => $serendipity['GET']['id'],
|
||||
'id' => null
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
|
||||
|
||||
$comment['comment'] = (is_string($comment['body']) ? serendipity_specialchars(strip_tags($comment['body'])) : '');
|
||||
$comment['url'] = (is_string($comment['url']) ? strip_tags($comment['url']) : '');
|
||||
$comment['link_delete'] = $serendipity['baseURL'] . 'comment.php?serendipity[delete]=' . $comment['id'] . '&serendipity[entry]=' . $comment['entry_id'] . '&serendipity[type]=comments&' . $formToken;
|
||||
$comment['link_delete'] = $serendipity['baseURL'] . 'comment.php?serendipity[delete]=' . ($comment['id'] ?? '') . '&serendipity[entry]=' . ($comment['entry_id'] ?? '') . '&serendipity[type]=comments&' . $formToken;
|
||||
|
||||
/* Fix invalid cases in protocoll part */
|
||||
if (!empty($comment['url'])) {
|
||||
@ -406,7 +406,7 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
|
||||
}
|
||||
|
||||
if (serendipity_userLoggedIn()) {
|
||||
if ($comment['subscribed'] == 'true') {
|
||||
if (($comment['subscribed'] ?? null) == 'true') {
|
||||
if ($comment['status'] == 'approved') {
|
||||
$comment['body'] .= '<div class="serendipity_subscription_on"><em>' . ACTIVE_COMMENT_SUBSCRIPTION . '</em></div>';
|
||||
} else {
|
||||
@ -418,7 +418,7 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace
|
||||
}
|
||||
|
||||
$_smartyComments[] = $comment;
|
||||
if ($comment['id'] && $parentid !== VIEWMODE_LINEAR ) {
|
||||
if (isset($comment['id']) && $comment['id'] && $parentid !== VIEWMODE_LINEAR ) {
|
||||
serendipity_printComments($comments, $comment['id'], ($depth+1), ($trace . $i . '.'), $smarty_block, $smarty_file);
|
||||
}
|
||||
}
|
||||
|
@ -135,11 +135,11 @@
|
||||
<dt>{$CONST.EMAIL}:</dt>
|
||||
<dd>{if empty($comment.email)}N/A{else}<a href="mailto:{$comment.email|escape}" title="{$comment.email|escape}">{$comment.email|escape|truncate:40:"…"}</a>{if $comment.subscribed == 'true'} <i>({$CONST.ACTIVE_COMMENT_SUBSCRIPTION})</i>{/if}{/if} {$comment.action_email}</dd>
|
||||
<dt>IP:</dt>
|
||||
<dd>{if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {$comment.action_ip}</dd>
|
||||
<dd>{if empty($comment.ip)}N/A{else}{$comment.ip|escape}{/if} {if isset($comment.action_ip)}{$comment.action_ip}{/if}</dd>
|
||||
<dt>URL:</dt>
|
||||
<dd>{if empty($comment.url)}N/A{else}<a href="{$comment.url|escape}" title="{$comment.url|escape}">{$comment.url|escape|truncate:40:"…"}</a> {/if} {$comment.action_url}</dd>
|
||||
<dd>{if empty($comment.url)}N/A{else}<a href="{$comment.url|escape}" title="{$comment.url|escape}">{$comment.url|escape|truncate:40:"…"}</a> {/if} {if isset($comment.action_url)}{$comment.action_url}{/if}</dd>
|
||||
<dt>{$CONST.REFERER}:</dt>
|
||||
<dd>{if empty($comment.referer)}N/A{else}<a href="{$comment.referer|escape}" title="{$comment.referer|escape}">{$comment.referer|escape|truncate:40:"…"}</a>{/if} {$comment.action_referer}</dd>
|
||||
<dd>{if empty($comment.referer)}N/A{else}<a href="{$comment.referer|escape}" title="{$comment.referer|escape}">{$comment.referer|escape|truncate:40:"…"}</a>{/if} {if isset($comment.action_referer)}{$comment.action_referer}{/if}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@ -163,7 +163,9 @@
|
||||
<li><button class="button_link toggle_comment_full" type="button" data-href="#c{$comment.id}_full" title="{$CONST.TOGGLE_ALL}"><span class="icon-right-dir" aria-hidden="true"></span><span class="visuallyhidden"> {$CONST.TOGGLE_ALL}</span></button></li>
|
||||
{/if}
|
||||
</ul>
|
||||
{if isset($comment.action_more)}
|
||||
{$comment.action_more}
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{foreach from=$comments item=comment name="comments"}
|
||||
<article id="c{$comment.id}" class="serendipity_comment{if $entry.author == $comment.author} serendipity_comment_author_self{/if} {cycle values="odd,even"} {if $comment.depth > 8}commentlevel-9{else}commentlevel-{$comment.depth}{/if}">
|
||||
<article id="c{$comment.id}" class="serendipity_comment{if isset($entry.author) && $entry.author == $comment.author} serendipity_comment_author_self{/if} {cycle values="odd,even"} {if $comment.depth > 8}commentlevel-9{else}commentlevel-{$comment.depth}{/if}">
|
||||
<header class="clearfix">
|
||||
<h4{if 'spice_twitter_name'|array_key_exists:$comment and $comment.spice_twitter_name && $comment.spice_twitter_followme} class="short-heading"{/if}>{if $comment.url}<a href="{$comment.url}">{/if}{$comment.author|default:$CONST.ANONYMOUS}{if $comment.url}</a>{/if}{if 'spice_twitter_name'|array_key_exists:$comment and $comment.spice_twitter_name and not $comment.spice_twitter_followme} (<a href="{$comment.spice_twitter_url}"{if $comment.spice_twitter_nofollow} rel="nofollow"{/if}>@{$comment.spice_twitter_name}</a>){/if} {$CONST.ON} <time datetime="{$comment.timestamp|@serendipity_html5time}">{$comment.timestamp|@formatTime:$template_option.date_format}</time>:</h4>
|
||||
{if 'spice_twitter_name'|array_key_exists:$comment and $comment.spice_twitter_name && $comment.spice_twitter_followme}
|
||||
@ -21,7 +21,7 @@
|
||||
<footer>
|
||||
<time>{$comment.timestamp|@formatTime:'%H:%M'}</time>
|
||||
| <a class="comment_source_trace" href="#c{$comment.id}" title="{$CONST.TWOK11_PLINK_TITLE}">{$CONST.TWOK11_PLINK_TEXT}</a>
|
||||
{if 'is_entry_owner'|array_key_exists:$entry and $entry.is_entry_owner}
|
||||
{if isset($entry) and 'is_entry_owner'|array_key_exists:$entry and $entry.is_entry_owner}
|
||||
| <a class="comment_source_ownerlink" href="{$comment.link_delete}" title="{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.author}">{$CONST.DELETE}</a>
|
||||
{/if}
|
||||
{if $template_option.refcomments == true}
|
||||
|
Reference in New Issue
Block a user