timeline: PHP 8 compat fixes

This commit is contained in:
onli 2021-07-04 19:35:23 +02:00
parent d2a7784073
commit 1b162d33a8
5 changed files with 39 additions and 35 deletions

View File

@ -14,7 +14,7 @@
<li id="comment-{$comment.id}" class="comment-list-item"> <li id="comment-{$comment.id}" class="comment-list-item">
<a id="c{$comment.id}"></a> <a id="c{$comment.id}"></a>
<div id="div-comment-{$comment.id}" class="comment_any{cycle values=" comment_odd, comment_even"} comment_author_{$comment.author|@makeFilename} {if ($entry.author == $comment.author) && ($entry.email == $commentform_entry.email)}comment_author_self{/if}"> <div id="div-comment-{$comment.id}" class="comment_any{cycle values=" comment_odd, comment_even"} comment_author_{$comment.author|@makeFilename} {if ($entry.author == $comment.author) && ($entry.email == $commentform_entry.email)}comment_author_self{/if}">
{if $comment.avatar} {if isset($comment.avatar) and $comment.avatar}
{$comment.avatar} {$comment.avatar}
{/if} {/if}
<div class="comment-list-item-body"> <div class="comment-list-item-body">
@ -42,7 +42,7 @@
{/if} {/if}
{if $entry.allow_comments AND $comment.body != 'COMMENT_DELETED'} {if $entry.allow_comments AND $comment.body != 'COMMENT_DELETED'}
<a class="comment-reply-link btn btn-sm btn-default btn-theme" href="#serendipity_CommentForm" id="serendipity_reply_{$comment.id}" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}'; {$comment_onchange}" title="{$CONST.REPLY}"><i class="fas fa-lg fa-reply"></i><span class="sr-only"> {$CONST.REPLY}</span></a> <a class="comment-reply-link btn btn-sm btn-default btn-theme" href="#serendipity_CommentForm" id="serendipity_reply_{$comment.id}" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}'; {if isset($comment_onchange)}{$comment_onchange}{/if}" title="{$CONST.REPLY}"><i class="fas fa-lg fa-reply"></i><span class="sr-only"> {$CONST.REPLY}</span></a>
<div id="serendipity_replyform_{$comment.id}"></div> <div id="serendipity_replyform_{$comment.id}"></div>
{/if} {/if}
</div> </div>

View File

@ -9,23 +9,27 @@ $serendipity['smarty']->assign(array('currpage' => "http://".$_SERVER['HTTP_HOS
$serendipity['smarty']->assign('archiveURL', serendipity_rewriteURL(PATH_ARCHIVE)); $serendipity['smarty']->assign('archiveURL', serendipity_rewriteURL(PATH_ARCHIVE));
if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') { if (isset($serendipity['GET']['adminModule']) || isset($serendipity['POST']['adminModule'])) {
$css_files = glob(dirname(__FILE__) . '/*_style.css'); if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') {
foreach($css_files AS $css_file) { $css_files = glob(dirname(__FILE__) . '/*_style.css');
$css_file = str_replace('_style.css', '', basename($css_file)); foreach($css_files AS $css_file) {
if (!isset($colorsets[$css_file])) { $css_file = str_replace('_style.css', '', basename($css_file));
$colorsets[$css_file] = $css_file; if (!isset($colorsets[$css_file])) {
$colorsets[$css_file] = $css_file;
}
} }
} }
} }
if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') { if (isset($serendipity['GET']['adminModule']) || isset($serendipity['POST']['adminModule'])) {
$skin_files = glob(dirname(__FILE__) . '/*_skin.css'); if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') {
$skinsets[$skin_file] = 'light'; // light is default, but light_skin.css does not exist as light styles are written into style.css $skin_files = glob(dirname(__FILE__) . '/*_skin.css');
foreach($skin_files AS $skin_file) { $skinsets[$skin_file] = 'light'; // light is default, but light_skin.css does not exist as light styles are written into style.css
$skin_file = str_replace('_skin.css', '', basename($skin_file)); foreach($skin_files AS $skin_file) {
if (!isset($skinsets[$skin_file])) { $skin_file = str_replace('_skin.css', '', basename($skin_file));
$skinsets[$skin_file] = $skin_file; if (!isset($skinsets[$skin_file])) {
$skinsets[$skin_file] = $skin_file;
}
} }
} }
} }
@ -122,14 +126,14 @@ $template_config = array(
'name' => THEME_COLORSET, 'name' => THEME_COLORSET,
'type' => 'select', 'type' => 'select',
'default' => 'green', 'default' => 'green',
'select_values' => $colorsets 'select_values' => $colorsets ?? []
), ),
array( array(
'var' => 'skinset', 'var' => 'skinset',
'name' => THEME_SKINSET, 'name' => THEME_SKINSET,
'type' => 'select', 'type' => 'select',
'default' => 'light', 'default' => 'light',
'select_values' => $skinsets 'select_values' => $skinsets ?? []
), ),
array( array(
'var' => 'header_img', 'var' => 'header_img',
@ -229,7 +233,7 @@ $serendipity['smarty']->assign_by_ref('FooterSidebarElements', $FooterSidebarEle
$template_global_config = array('navigation' => true); $template_global_config = array('navigation' => true);
$serendipity['template_loaded_config'] = $template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option'], true); $serendipity['template_loaded_config'] = $template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option'] ?? '', true);
serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config); serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config);
@ -297,8 +301,8 @@ for ($i = 0; $i < $template_loaded_config['social_icons_amount']; $i++) {
'default' => '#', 'default' => '#',
); );
$socialicons[] = array( $socialicons[] = array(
'service' => $template_loaded_config['social_icon' . $i . 'service'], 'service' => $template_loaded_config['social_icon' . $i . 'service'] ?? '',
'url' => $template_loaded_config['social_icon' . $i . 'url'], 'url' => $template_loaded_config['social_icon' . $i . 'url'] ?? '',
); );
} }
$serendipity['smarty']->assign_by_ref('socialicons', $socialicons); $serendipity['smarty']->assign_by_ref('socialicons', $socialicons);

View File

@ -67,7 +67,7 @@
</div> </div>
</div> </div>
{elseif $subscribe_confirm_error} {elseif isset($subscribe_confirm_error) and $subscribe_confirm_error}
<div id="search-block" class="row"> <div id="search-block" class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
<div id="search-response" class="panel panel-danger"> <div id="search-response" class="panel panel-danger">
@ -82,7 +82,7 @@
</div> </div>
</div> </div>
{elseif $subscribe_confirm_success} {elseif isset($subscribe_confirm_success) and $subscribe_confirm_success}
<div id="search-block" class="row"> <div id="search-block" class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
<div id="search-response" class="panel panel-success"> <div id="search-response" class="panel panel-success">
@ -96,7 +96,7 @@
</div> </div>
</div> </div>
</div> </div>
{elseif $content_message} {elseif isset($content_message) and $content_message}
<div id="search-block" class="row"> <div id="search-block" class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
<div class="alert alert-info alert-dismissible fade in" role="alert"> <div class="alert alert-info alert-dismissible fade in" role="alert">

View File

@ -1,6 +1,6 @@
{serendipity_hookPlugin hook="entries_header" addData="$entry_id"} {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
{if $template_option.display_as_timeline and $entries and !$is_single_entry and not $entry.is_extended and not $is_preview}{* THIS IS OUR FRONTPAGE SCENARIO - OPEN TIMELINE*} {if $template_option.display_as_timeline and $entries and !$is_single_entry and not isset($entry.is_extended) and not $is_preview}{* THIS IS OUR FRONTPAGE SCENARIO - OPEN TIMELINE*}
<ul class="timeline"> <ul class="timeline">
{assign var="prevmonth" value=''} {assign var="prevmonth" value=''}
{/if} {/if}
@ -25,10 +25,10 @@
<div class="timeline-badge"><i class="far fa-dot-circle" aria-hidden="true"></i></div> <div class="timeline-badge"><i class="far fa-dot-circle" aria-hidden="true"></i></div>
<div class="timeline-panel"> <div class="timeline-panel">
<div class="timeline-heading"> <div class="timeline-heading">
{if $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *} {if isset($entry.properties.timeline_image) and $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *}
{$entry.properties.timeline_image} {$entry.properties.timeline_image}
{else} {else}
<a href="{$entry.link}" title="{$entry.title}"><img class="img-responsive" {if $entry.properties.timeline_image}src="{$entry.properties.timeline_image}"{else}src="{serendipity_getFile file='img/image_unavailable.jpg'}"{/if} alt=""/></a> <a href="{$entry.link}" title="{$entry.title}"><img class="img-responsive" {if isset($entry.properties.timeline_image) and $entry.properties.timeline_image}src="{$entry.properties.timeline_image}"{else}src="{serendipity_getFile file='img/image_unavailable.jpg'}"{/if} alt=""/></a>
{/if} {/if}
</div> </div>
<div class="timeline-body"> <div class="timeline-body">
@ -46,13 +46,13 @@
</li> </li>
{assign var="prevmonth" value=$entry.timestamp|@formatTime:"%B"} {assign var="prevmonth" value=$entry.timestamp|@formatTime:"%B"}
{else}{* not using timeline - use blog format instead *} {else}{* not using timeline - use blog format instead *}
{if $entry.body || $entry.properties.timeline_image} {if $entry.body || isset($entry.properties.timeline_image) and $entry.properties.timeline_image}
<div class="row each-blogstyle-entry"> <div class="row each-blogstyle-entry">
<div class="col-md-5 blogstyle-post-thumb"> <div class="col-md-5 blogstyle-post-thumb">
{if $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *} {if isset($entry.properties.timeline_image) and $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *}
<div>{$entry.properties.timeline_image}</div> <div>{$entry.properties.timeline_image}</div>
{else} {else}
<a href="{$entry.link}" title="{$entry.title}"><img class="img-responsive" {if $entry.properties.timeline_image}src="{$entry.properties.timeline_image}"{else}src="{serendipity_getFile file='img/image_unavailable.jpg'}"{/if} alt=""/></a> <a href="{$entry.link}" title="{$entry.title}"><img class="img-responsive" {if isset($entry.properties.timeline_image) and $entry.properties.timeline_image}src="{$entry.properties.timeline_image}"{else}src="{serendipity_getFile file='img/image_unavailable.jpg'}"{/if} alt=""/></a>
{/if} {/if}
</div> </div>
<div class="col-md-7 blogstyle-post-body"> <div class="col-md-7 blogstyle-post-body">
@ -83,7 +83,7 @@
{if $is_preview} {if $is_preview}
{append var='entry' value=$smarty.session.save_entry_POST.properties index='properties'}{* gives us access to entry properties in preview *} {append var='entry' value=$smarty.session.save_entry_POST.properties index='properties'}{* gives us access to entry properties in preview *}
{/if} {/if}
{if $entry.properties.timeline_image} {if isset($entry.properties.timeline_image) and $entry.properties.timeline_image}
{if $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *} {if $entry.properties.timeline_image|is_in_string:'<iframe,<embed,<object'}{* we assume this is a video, just emit the contents of the var *}
{$entry.properties.timeline_image} {$entry.properties.timeline_image}
{else} {else}
@ -277,7 +277,7 @@
{/if} {/if}
{if $footer_info or $footer_prev_page or $footer_next_page} {if not $is_single_entry and ($footer_info or $footer_prev_page or $footer_next_page)}
<div class='serendipity_pageSummary'> <div class='serendipity_pageSummary'>
{if $footer_info} {if $footer_info}
<p class="summary serendipity_center">{$footer_info}</p> <p class="summary serendipity_center">{$footer_info}</p>

View File

@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Serendipity v.{$serendipityVersion}"> <meta name="generator" content="Serendipity v.{$serendipityVersion}">
{if ($view == "entry" || $view == "start" || $view == "feed" || $view == "plugin" || $staticpage_pagetitle != "" || $robots_index == 'index')} {if ($view == "entry" || $view == "start" || $view == "feed" || $view == "plugin" || (isset($staticpage_pagetitle) and $staticpage_pagetitle != "") || (isset($robots_index) and $robots_index == 'index'))}
<meta name="robots" content="index,follow"> <meta name="robots" content="index,follow">
{else} {else}
<meta name="robots" content="noindex,follow"> <meta name="robots" content="noindex,follow">
@ -112,7 +112,7 @@
{/if} {/if}
</h2> </h2>
{if $footer_totalPages >1 && !isset($staticpage_pagetitle)} {if isset($footer_totalPages) and $footer_totalPages > 1 && !isset($staticpage_pagetitle)}
<nav class="pagination pull-right"> <nav class="pagination pull-right">
{assign var="paginationStartPage" value="`$footer_currentPage-3`"} {assign var="paginationStartPage" value="`$footer_currentPage-3`"}
{if $footer_currentPage+3 > $footer_totalPages} {if $footer_currentPage+3 > $footer_totalPages}
@ -154,7 +154,7 @@
{* MAIN CONTENT *} {* MAIN CONTENT *}
<div class="container content"> <div class="container content">
<div class="row"> <div class="row">
<main class="{if ($rightSidebarElements > 0 && $staticpage_pagetitle =='') || ($rightSidebarElements > 0 && $staticpage_pagetitle !='' && $staticpage_custom.show_sidebars != 'false')}col-md-9{else}col-md-12{/if} mainpanel"> <main class="{if isset($rightSidebarElements) and ($rightSidebarElements > 0 && (!isset($staticpage_pagetitle) or $staticpage_pagetitle =='')) || isset($rightSidebarElements) and ($rightSidebarElements > 0 && (isset($staticpage_pagetitle) and $staticpage_pagetitle != '') && $staticpage_custom.show_sidebars != 'false')}col-md-9{else}col-md-12{/if} mainpanel">
{if $view=='404'} {if $view=='404'}
<div id="search-block" class="row"> <div id="search-block" class="row">
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
@ -205,7 +205,7 @@
{$CONTENT} {$CONTENT}
{/if} {/if}
</main> </main>
{if ($rightSidebarElements > 0 && $staticpage_pagetitle =='') || ($rightSidebarElements > 0 && $staticpage_pagetitle !='' && $staticpage_custom.show_sidebars != 'false')} {if isset($rightSidebarElements) && ($rightSidebarElements > 0 && (! isset($staticpage_pagetitle) or $staticpage_pagetitle == '')) || isset($rightSidebarElements) && ($rightSidebarElements > 0 && isset($staticpage_pagetitle) and $staticpage_pagetitle !='' && $staticpage_custom.show_sidebars != 'false')}
<aside class="col-md-3 RightSideBarContainer"> <aside class="col-md-3 RightSideBarContainer">
<div id="serendipityRightSideBar" class="RightSideBar"> <div id="serendipityRightSideBar" class="RightSideBar">
{serendipity_printSidebar side="right"} {serendipity_printSidebar side="right"}