From 8c614420af75816fd9c276bf08738a8da84e16ed Mon Sep 17 00:00:00 2001 From: David Janssens Date: Sat, 28 Dec 2024 16:05:59 +0000 Subject: [PATCH 1/3] fix:add array declarations to installer to fix deprecated dynamic properties error --- htdocs/install/class/IcmsInstallWizard.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/class/IcmsInstallWizard.php b/htdocs/install/class/IcmsInstallWizard.php index 3f227fa620ed..f01735003a28 100644 --- a/htdocs/install/class/IcmsInstallWizard.php +++ b/htdocs/install/class/IcmsInstallWizard.php @@ -2,8 +2,11 @@ class IcmsInstallWizard { var $pages = array(); + var $pagesNames = array(); + var $pagesTitles = array(); var $titles = array(); var $currentPage = 0; + var $currentPageName; var $lastpage; var $secondlastpage; var $language = 'english'; @@ -18,7 +21,7 @@ function xoInit() { $_SERVER['REQUEST_URI'] = htmlentities($_SERVER['PHP_SELF']); } - if (PHP_VERSION_ID < 70000) { + if (PHP_VERSION_ID < 74000) { $this->no_php5 = true; } /* @@ -195,4 +198,4 @@ function redirectToPage($page, $status = 303, $message = 'See other') { // header( "Status: $status $message" ); header("Location: $location"); } -} \ No newline at end of file +} From ff43490854389910482e3aa4177c3a18a883718c Mon Sep 17 00:00:00 2001 From: David Janssens Date: Sat, 28 Dec 2024 18:11:03 +0000 Subject: [PATCH 2/3] fix:update variable declarations + add return declarations --- htdocs/install/class/IcmsInstallWizard.php | 34 ++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/htdocs/install/class/IcmsInstallWizard.php b/htdocs/install/class/IcmsInstallWizard.php index f01735003a28..b043f24b9915 100644 --- a/htdocs/install/class/IcmsInstallWizard.php +++ b/htdocs/install/class/IcmsInstallWizard.php @@ -1,19 +1,18 @@ checkAccess()) { return false; } @@ -102,7 +101,7 @@ function xoInit() { return true; } - function checkAccess() { + function checkAccess():bool { if (INSTALL_USER && INSTALL_PASSWORD) { if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="ImpressCMS Installer"'); @@ -169,7 +168,7 @@ function setPage($page) { return $this->currentPage; } - function baseLocation() { + function baseLocation(): string { $proto = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on')) ? 'https' : 'http'; $host = htmlentities($_SERVER['HTTP_HOST']); $server_php_self = htmlentities($_SERVER['PHP_SELF']); @@ -177,10 +176,10 @@ function baseLocation() { return "$proto://$host$base"; } - function pageURI($page) { + function pageURI($page) : string { if (!(int) $page[0]) { if ($page[0] === '+') { - $page = $this->currentPage + substr($page, 1); + $page = $this->currentPage . substr($page, 1); } elseif ($page[0] === '-') { $page = $this->currentPage - substr($page, 1); } else { @@ -195,7 +194,6 @@ function redirectToPage($page, $status = 303, $message = 'See other') { $location = $this->pageURI($page); $proto = !@empty($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; header("$proto $status $message"); - // header( "Status: $status $message" ); header("Location: $location"); } } From 6dd83b76e4132e6df78fdb620b1cb79864ead1c9 Mon Sep 17 00:00:00 2001 From: David Janssens Date: Sat, 28 Dec 2024 20:17:41 +0000 Subject: [PATCH 3/3] fix:update variable declarations + add return declarations - correctly this time --- htdocs/install/class/IcmsInstallWizard.php | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/install/class/IcmsInstallWizard.php b/htdocs/install/class/IcmsInstallWizard.php index b043f24b9915..c7bb039809ff 100644 --- a/htdocs/install/class/IcmsInstallWizard.php +++ b/htdocs/install/class/IcmsInstallWizard.php @@ -1,18 +1,19 @@ checkAccess()) { return false; } @@ -20,7 +21,7 @@ function xoInit(): bool { $_SERVER['REQUEST_URI'] = htmlentities($_SERVER['PHP_SELF']); } - if (PHP_VERSION_ID < 74000) { + if (PHP_VERSION_ID < 70400) { $this->no_php5 = true; } /* @@ -101,7 +102,7 @@ function xoInit(): bool { return true; } - function checkAccess():bool { + public function checkAccess(): bool { if (INSTALL_USER && INSTALL_PASSWORD) { if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="ImpressCMS Installer"'); @@ -123,7 +124,7 @@ function checkAccess():bool { return true; } - function loadLangFile($file) { + public function loadLangFile($file) { if (file_exists("./language/$this->language/$file.php")) { include_once "./language/$this->language/$file.php"; } else { @@ -131,7 +132,7 @@ function loadLangFile($file) { } } - function initLanguage($language) { + public function initLanguage($language) { $language = preg_replace('/[^A-Za-z]+/', '', $language); if (!file_exists("./language/$language/install.php")) { $language = 'english'; @@ -140,7 +141,7 @@ function initLanguage($language) { $this->loadLangFile('install'); } - function setPage($page) { + public function setPage($page): string { /** * If server is PHP 4, display the php4 page and stop the install */ @@ -168,7 +169,7 @@ function setPage($page) { return $this->currentPage; } - function baseLocation(): string { + public function baseLocation(): string { $proto = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on')) ? 'https' : 'http'; $host = htmlentities($_SERVER['HTTP_HOST']); $server_php_self = htmlentities($_SERVER['PHP_SELF']); @@ -176,10 +177,10 @@ function baseLocation(): string { return "$proto://$host$base"; } - function pageURI($page) : string { + public function pageURI($page): string { if (!(int) $page[0]) { if ($page[0] === '+') { - $page = $this->currentPage . substr($page, 1); + $page = $this->currentPage + substr($page, 1); } elseif ($page[0] === '-') { $page = $this->currentPage - substr($page, 1); } else { @@ -190,10 +191,11 @@ function pageURI($page) : string { return $this->baseLocation() . "/page_$page.php"; } - function redirectToPage($page, $status = 303, $message = 'See other') { + public function redirectToPage($page, $status = 303, $message = 'See other') { $location = $this->pageURI($page); $proto = !@empty($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; header("$proto $status $message"); + // header( "Status: $status $message" ); header("Location: $location"); } }