Skip to content

Commit

Permalink
fix:add array declarations to installer (#1604)
Browse files Browse the repository at this point in the history
* fix:add array declarations to installer to fix deprecated dynamic properties error

* fix:update variable declarations + add return declarations

* fix:update variable declarations + add return declarations - correctly this time
  • Loading branch information
fiammybe authored Dec 29, 2024
1 parent 3acb39d commit 7909145
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions htdocs/install/class/IcmsInstallWizard.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
<?php

class IcmsInstallWizard {
var $pages = array();
var $titles = array();
var $currentPage = 0;
var $lastpage;
var $secondlastpage;
var $language = 'english';
var $no_php5 = false;
var $safe_mode = false;

function xoInit() {
public array $pages = array();
public array $pagesNames = array();
public array $pagesTitles = array();
public array $titles = array();
public int $currentPage = 0;
public string $currentPageName;
public string $lastpage;
public string $secondlastpage = '';
public string $language = 'english';
public bool $no_php5 = false;
public bool $safe_mode = false;

public function xoInit(): bool {
if (!$this->checkAccess()) {
return false;
}
if (@empty($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = htmlentities($_SERVER['PHP_SELF']);
}

if (PHP_VERSION_ID < 70000) {
if (PHP_VERSION_ID < 70400) {
$this->no_php5 = true;
}
/*
Expand Down Expand Up @@ -99,7 +102,7 @@ function xoInit() {
return true;
}

function checkAccess() {
public function checkAccess(): bool {
if (INSTALL_USER && INSTALL_PASSWORD) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="ImpressCMS Installer"');
Expand All @@ -121,15 +124,15 @@ function checkAccess() {
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 {
include_once "./language/english/$file.php";
}
}

function initLanguage($language) {
public function initLanguage($language) {
$language = preg_replace('/[^A-Za-z]+/', '', $language);
if (!file_exists("./language/$language/install.php")) {
$language = 'english';
Expand All @@ -138,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
*/
Expand Down Expand Up @@ -166,15 +169,15 @@ function setPage($page) {
return $this->currentPage;
}

function baseLocation() {
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']);
$base = substr($server_php_self, 0, strrpos($server_php_self, '/'));
return "$proto://$host$base";
}

function pageURI($page) {
public function pageURI($page): string {
if (!(int) $page[0]) {
if ($page[0] === '+') {
$page = $this->currentPage + substr($page, 1);
Expand All @@ -188,11 +191,11 @@ function pageURI($page) {
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");
}
}
}

0 comments on commit 7909145

Please sign in to comment.