Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:add array declarations to installer #1604

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions htdocs/install/class/IcmsInstallWizard.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<?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() {
protected array $pages = array();
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
protected array $pagesNames = array();
protected array $pagesTitles = array();
protected int $currentPage = 0;
protected string $currentPageName;
protected int $lastpage;
protected int $secondlastpage;
protected string $language = 'english';
protected bool $no_php5 = false;
protected bool $safe_mode = false;

function xoInit(): bool {
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove error control operator '@' on line 19.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove error control operator '@' on line 33.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xoInit accesses the super-global variable $_SERVER.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xoInit accesses the super-global variable $_SERVER.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visibility must be declared on method "xoInit"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xoInit accesses the super-global variable $_COOKIE.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xoInit accesses the super-global variable $_COOKIE.

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 < 74000) {
$this->no_php5 = true;
}
/*
Expand Down Expand Up @@ -99,7 +101,7 @@ function xoInit() {
return true;
}

function checkAccess() {
function checkAccess():bool {
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkAccess accesses the super-global variable $_SERVER.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkAccess accesses the super-global variable $_SERVER.

fiammybe marked this conversation as resolved.
Show resolved Hide resolved
if (INSTALL_USER && INSTALL_PASSWORD) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="ImpressCMS Installer"');
Expand Down Expand Up @@ -166,18 +168,18 @@ function setPage($page) {
return $this->currentPage;
}

function baseLocation() {
function baseLocation(): string {
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
$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) {
function pageURI($page) : string {
fiammybe marked this conversation as resolved.
Show resolved Hide resolved
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 {
Expand All @@ -192,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");
}
}
}