From 7e8ddb88b82cf18a546c8038d07e1669a5fd3f0e Mon Sep 17 00:00:00 2001 From: azett Date: Sat, 13 Feb 2021 13:03:09 +0100 Subject: [PATCH] Fixed more template errors in order to get everything running with PHP 8.0. Also: Fixed some tiny PHP errors. Thanks for reporting, Matthias! --- admin/panels/maintain/admin.maintain.php | 50 ++-- .../maintain/admin.maintain.updates.tpl | 6 +- fp-includes/core/core.layout.php | 257 +++++++++--------- fp-interface/sharedtpls/comment-atom.tpl | 2 +- fp-interface/sharedtpls/comment-rss.tpl | 2 +- fp-plugins/prettyurls/plugin.prettyurls.php | 4 +- 6 files changed, 163 insertions(+), 158 deletions(-) diff --git a/admin/panels/maintain/admin.maintain.php b/admin/panels/maintain/admin.maintain.php index 5b0511f..19c58dd 100755 --- a/admin/panels/maintain/admin.maintain.php +++ b/admin/panels/maintain/admin.maintain.php @@ -17,7 +17,7 @@ class tpl_deleter extends fs_filelister { function __construct() { - + // $this->smarty = $GLOBALS['_FP_SMARTY']; $this->_directory = CACHE_DIR; parent::__construct(); @@ -31,7 +31,7 @@ class tpl_deleter extends fs_filelister { // trigger_error($file, E_USER_NOTICE); return 0; } - + } class s_entry_crawler extends fs_filelister { @@ -48,18 +48,18 @@ class s_entry_crawler extends fs_filelister { if (is_dir($f) && ctype_digit($file)) { return 1; } - + if (fnmatch('entry*' . EXT, $file)) { $id = basename($file, EXT); $arr = entry_parse($id, true); - + echo "[POST] $id => {$arr['subject']}\n"; $this->index->add($id, $arr); - + return 0; } } - + } /** @@ -73,7 +73,7 @@ class admin_maintain extends AdminPanel { 'default' => false, 'updates' => false ); - + } class admin_maintain_updates extends AdminPanelAction { @@ -93,9 +93,9 @@ class admin_maintain_updates extends AdminPanelAction { 'stable' => 'unknown', 'unstable' => 'unknown' ); - + $file = utils_geturl($this->web); - + if ($file) { $ver = utils_kexplode($file ['content']); if (!isset($ver ['stable'])) { @@ -108,13 +108,15 @@ class admin_maintain_updates extends AdminPanelAction { } else { $success = -1; } - - $this->smarty->assign('updates', $ver); + + $this->smarty->assign('stableversion', $ver ['stable']); + $this->smarty->assign('unstableversion', $ver ['unstable']); + $this->smarty->assign('notice', $ver ['notice']); $this->smarty->assign('fpweb', $this->fpweb); $this->smarty->assign('sfweb', $this->sfweb); $this->smarty->assign('success', $success); } - + } class admin_maintain_default extends AdminPanelAction { @@ -127,27 +129,27 @@ class admin_maintain_default extends AdminPanelAction { switch ($do) { case 'rebuild': { - + if (substr(INDEX_DIR, -1) == '/') $oldidx = substr(INDEX_DIR, 0, -1); - + $movedir = $oldidx . time(); - + header('Content-Type: text/plain'); echo "ENTERING LOWRES MODE\n\n"; - + if (file_exists(INDEX_DIR)) { - + echo "BACKUP INDEX to $movedir\n"; $ret = @rename($oldidx, $movedir); if (!$ret) trigger_error('Cannot backup old index. STOP.', E_USER_ERROR); } fs_mkdir(INDEX_DIR); - + new s_entry_crawler(); exit("\nDONE \nPlease, select the back arrow in your browser"); - + return PANEL_NOREDIRECT; } case 'restorechmods': @@ -167,10 +169,10 @@ class admin_maintain_default extends AdminPanelAction { $this->smarty->compile_check = true; $this->smarty->force_compile = true; $this->smarty->assign('success', 1); - + if (!file_exists(CACHE_DIR)) fs_mkdir(CACHE_DIR); - + return PANEL_NOREDIRECT; } case 'phpinfo': @@ -179,17 +181,17 @@ class admin_maintain_default extends AdminPanelAction { phpinfo(); $info = ob_get_contents(); ob_end_clean(); - + $this->smarty->assign('phpinfo', preg_replace('%^.*(.*).*$%ms', '$1', $info)); } - + return PANEL_NOREDIRECT; } } function main() { } - + } ?> diff --git a/admin/panels/maintain/admin.maintain.updates.tpl b/admin/panels/maintain/admin.maintain.updates.tpl index 2c7a64c..312889b 100644 --- a/admin/panels/maintain/admin.maintain.updates.tpl +++ b/admin/panels/maintain/admin.maintain.updates.tpl @@ -1,7 +1,7 @@

{$panelstrings.head}

{include file=shared:errorlist.tpl} -{$panelstrings.list|sprintf:$smarty.const.SYSTEM_VER:$sfweb:$updates.stable:$fpweb:$updates.unstable} -{if $updates.notice} +{$panelstrings.list|sprintf:$smarty.const.SYSTEM_VER:$sfweb:$stableversion:$fpweb:$unstableversion} +{if $notice}
{$panelstrings.notice}
-

{$updates.notice}

+

{$notice}

{/if} \ No newline at end of file diff --git a/fp-includes/core/core.layout.php b/fp-includes/core/core.layout.php index d1397fc..7498956 100644 --- a/fp-includes/core/core.layout.php +++ b/fp-includes/core/core.layout.php @@ -1,137 +1,140 @@ pagecontent = $content; - $this->pagecontent = $content; - - $this->fpdb =& new FPDB; - $GLOBALS['fpdb'] =& $this->fpdb; + $this->fpdb =& new FPDB(); + $GLOBALS ['fpdb'] = & $this->fpdb; - $this->fp_widgets =& new widget_indexer; - $GLOBALS['fp_widgets'] =& $this->fp_widgets; - - $this->smarty =& $GLOBALS['_FP_SMARTY']; - - $GLOBALS['fp_config'] =& $this->config; - $this->config = $GLOBALS['fp_config']['general']; - - - $this->theme = theme_loadsettings(); - $GLOBALS['theme'] =& $this->theme; - - $this->lang = lang_load(); - $GLOBALS['lang'] =& $this->lang; - - // user_loggedin() or sess_setup(); - - plugin_loadall(); - - // init smarty - - $this->smarty->compile_dir = CACHE_DIR; - $this->smarty->cache_dir = SMARTY_DIR . 'cache/'; - $this->smarty->caching = 0; - - - - do_action('init'); + $this->fp_widgets =& new widget_indexer(); + $GLOBALS ['fp_widgets'] = & $this->fp_widgets; - } - - - function display() { - $this->main(); - theme_init($this->smarty, $this); - $this->smarty->display($this->tpl); - - unset($this->smarty); - - do_action('shutdown'); - - } - /* - - function post_message($module, $ring, $message) { - $this->message_queue[$module][$ring][]=$message; - - } - - function flush_messages($module, $ring=-1) { - - $msg_arr=array(); - if ($ring<0) - $ring_arr = - array_keys($this->message_queue[$module]); - else - $ring_arr = array($ring); - - foreach($ring_arr as $this_ring) { - $localq=& $this->message_queue[$module][$this_ring]; - foreach ($localq as $msg) { - $msg_arr[]=$msg; - } - } - - $this->smarty->append('err', $msg_arr); - return $msg_arr; - } - */ - - } - - class Abstract_LayoutIndex extends LayoutDefault { - - var $tpl = 'index.tpl'; - - } - - class Abstract_LayoutComment extends LayoutDefault { - - var $tpl = 'comments.tpl'; - - } - - class Abstract_LayoutDialog extends LayoutDefault { - - var $tpl = 'default.tpl'; - - function page($subject, $content, $rawcontent=false) { - $this->pagecontent = array( - 'subject'=>$subject, - 'content'=>$content - ); - - if ($rawcontent) $this->smarty->assign('rawcontent', true); - - } - - function pagecontent($params, $content, &$smarty, &$repeat) { - if ($this->pagecontent) { - $this->smarty->assign($this->pagecontent); - return $content; - } else return; - - } - - function display() { - $this->smarty->register_block('page', array(&$this, 'pagecontent')); - parent::display(); - } - - + $this->smarty = & $GLOBALS ['_FP_SMARTY']; + + $GLOBALS ['fp_config'] = & $this->config; + $this->config = $GLOBALS ['fp_config'] ['general']; + + $this->theme = theme_loadsettings(); + $GLOBALS ['theme'] = & $this->theme; + + $this->lang = lang_load(); + $GLOBALS ['lang'] = & $this->lang; + + // user_loggedin() or sess_setup(); + + plugin_loadall(); + + // init smarty + + $this->smarty->compile_dir = CACHE_DIR; + $this->smarty->cache_dir = SMARTY_DIR . 'cache/'; + $this->smarty->caching = 0; + + do_action('init'); } + function display() { + $this->main(); + theme_init($this->smarty, $this); + $this->smarty->display($this->tpl); + + unset($this->smarty); + + do_action('shutdown'); + } + + /* + * + * function post_message($module, $ring, $message) { + * $this->message_queue[$module][$ring][]=$message; + * + * } + * + * function flush_messages($module, $ring=-1) { + * + * $msg_arr=array(); + * if ($ring<0) + * $ring_arr = + * array_keys($this->message_queue[$module]); + * else + * $ring_arr = array($ring); + * + * foreach($ring_arr as $this_ring) { + * $localq=& $this->message_queue[$module][$this_ring]; + * foreach ($localq as $msg) { + * $msg_arr[]=$msg; + * } + * } + * + * $this->smarty->append('err', $msg_arr); + * return $msg_arr; + * } + */ +} + +class Abstract_LayoutIndex extends LayoutDefault { + + var $tpl = 'index.tpl'; + +} + +class Abstract_LayoutComment extends LayoutDefault { + + var $tpl = 'comments.tpl'; + +} + +class Abstract_LayoutDialog extends LayoutDefault { + + var $tpl = 'default.tpl'; + + function page($subject, $content, $rawcontent = false) { + $this->pagecontent = array( + 'subject' => $subject, + 'content' => $content + ); + + if ($rawcontent) { + $this->smarty->assign('rawcontent', true); + } else { + $this->smarty->assign('rawcontent', false); + } + } + + function pagecontent($params, $content, &$smarty, &$repeat) { + if ($this->pagecontent) { + $this->smarty->assign($this->pagecontent); + return $content; + } else + return; + } + + function display() { + $this->smarty->register_block('page', array( + &$this, + 'pagecontent' + )); + parent::display(); + } + +} ?> diff --git a/fp-interface/sharedtpls/comment-atom.tpl b/fp-interface/sharedtpls/comment-atom.tpl index 1d8a17b..15d8d50 100644 --- a/fp-interface/sharedtpls/comment-atom.tpl +++ b/fp-interface/sharedtpls/comment-atom.tpl @@ -5,7 +5,7 @@ {$flatpress.subtitle} - + FlatPress {$flatpress.author} {$smarty.now|date_format:'%Y'} diff --git a/fp-interface/sharedtpls/comment-rss.tpl b/fp-interface/sharedtpls/comment-rss.tpl index d69f214..e95ab8c 100644 --- a/fp-interface/sharedtpls/comment-rss.tpl +++ b/fp-interface/sharedtpls/comment-rss.tpl @@ -8,7 +8,7 @@ {$flatpress.title} ยป {$subject} {$the_comment_link} - Copyright {$smarty.now|date_format:"$Y"}, {$flatpress.author} + Copyright {'Y'|date}, {$flatpress.author} {*{$flatpress.email} ({$flatpress.author})*} {$fp_config.locale.lang} diff --git a/fp-plugins/prettyurls/plugin.prettyurls.php b/fp-plugins/prettyurls/plugin.prettyurls.php index 8e33283..8a3f72f 100644 --- a/fp-plugins/prettyurls/plugin.prettyurls.php +++ b/fp-plugins/prettyurls/plugin.prettyurls.php @@ -71,7 +71,7 @@ class Plugin_PrettyURLs { function permalink($str, $id) { global $fpdb, $post; - if (PRETTYURLS_TITLES) + if (isset($post) && PRETTYURLS_TITLES) $title = sanitize_title($post ['subject']); else $title = $id; @@ -499,7 +499,7 @@ class Plugin_PrettyURLs { if (isset($this->fp_params ['paged']) && $this->fp_params ['paged'] > 1) $page = $this->fp_params ['paged']; - $page += $v; + $page += ($v . ''); if ($page > 0) { $l .= 'page/' . $page . '/';