diff --git a/setup/dbupdate.php b/setup/dbupdate.php index 4a2a0b3..5b0065d 100644 --- a/setup/dbupdate.php +++ b/setup/dbupdate.php @@ -22,9 +22,9 @@ if (!defined('CON_FRAMEWORK')) { define('CON_FRAMEWORK', true); } -define('CON_SETUP_PATH', str_replace('\\', '/', realpath(dirname(__FILE__)))); +define('CON_SETUP_PATH', str_replace('\\', '/', realpath(__DIR__))); -define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../'))); +define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(__DIR__ . '/../'))); include_once('lib/startup.php'); @@ -113,7 +113,7 @@ if (cFileHandler::exists('data/tables_pi.txt')) { } } -$pluginChunks = array(); +$pluginChunks = []; $baseChunks = txtFileToArray('data/base.txt'); @@ -128,20 +128,12 @@ $contentChunks = txtFileToArray('data/examples.txt'); $sysadminChunk = txtFileToArray('data/sysadmin.txt'); if ($_SESSION['setuptype'] == 'setup') { - switch ($_SESSION['clientmode']) { - case 'CLIENT': - $fullChunks = array_merge($baseChunks, $sysadminChunk, $clientNoContentChunks); - break; - case 'CLIENTMODULES': - $fullChunks = array_merge($baseChunks, $sysadminChunk, $clientNoContentChunks, $moduleChunks); - break; - case 'CLIENTEXAMPLES': - $fullChunks = array_merge($baseChunks, $sysadminChunk, $clientChunks, $moduleChunks, $contentChunks); - break; - default: - $fullChunks = array_merge($baseChunks, $sysadminChunk); - break; - } + $fullChunks = match ($_SESSION['clientmode']) { + 'CLIENT' => array_merge($baseChunks, $sysadminChunk, $clientNoContentChunks), + 'CLIENTMODULES' => array_merge($baseChunks, $sysadminChunk, $clientNoContentChunks, $moduleChunks), + 'CLIENTEXAMPLES' => array_merge($baseChunks, $sysadminChunk, $clientChunks, $moduleChunks, $contentChunks), + default => array_merge($baseChunks, $sysadminChunk), + }; } else { $fullChunks = $baseChunks; } @@ -149,22 +141,19 @@ if ($_SESSION['setuptype'] == 'setup') { $fullChunks = array_merge($fullChunks, $pluginChunks); -list($root_path, $root_http_path) = getSystemDirectories(); +[$root_path, $root_http_path] = getSystemDirectories(); $totalsteps = ceil($fullcount / 50) + count($fullChunks) + 1; foreach ($fullChunks as $fullChunk) { $step++; if ($step == $currentstep) { - $failedChunks = array(); + $failedChunks = []; - $replacements = array( - '' => addslashes($root_path), - '' => addslashes($root_http_path) - ); + $replacements = ['' => addslashes($root_path), '' => addslashes($root_http_path)]; injectSQL($db, $_SESSION['dbprefix'], 'data/' . $fullChunk, $failedChunks, $replacements); - if (count($failedChunks) > 0) { + if ((is_countable($failedChunks) ? count($failedChunks) : 0) > 0) { $fp = fopen('../data/logs/setuplog.txt', 'w'); foreach ($failedChunks as $failedChunk) { fwrite($fp, sprintf("Setup was unable to execute SQL. MySQL-Error: %s, MySQL-Message: %s, SQL-Statements:\n%s", $failedChunk['errno'], $failedChunk['error'], $failedChunk['sql'])); @@ -189,14 +178,14 @@ if ($currentstep < $totalsteps) { // For import mod_history rows to versioning if ($_SESSION['setuptype'] == 'migration' || $_SESSION['setuptype'] == 'upgrade') { - $cfgClient = array(); + $cfgClient = []; rereadClients_Setup(); $oVersion = new VersionImport($cfg, $cfgClient, $db, $client, $area, $frame); $oVersion->CreateHistoryVersion(); } - $tables = array(); + $tables = []; while ($db->next_record()) { $tables[] = $db->f(0); @@ -240,7 +229,7 @@ if ($currentstep < $totalsteps) { } // Update Keys - $aNothing = array(); + $aNothing = []; injectSQL($db, $_SESSION['dbprefix'], 'data/indexes.sql', $aNothing); @@ -259,7 +248,7 @@ if ($currentstep < $totalsteps) { } function txtFileToArray($sFile) { - $aFileArray = array(); + $aFileArray = []; if (file_exists($sFile) && is_readable($sFile)) { $aFileArray = explode("\n", file_get_contents($sFile)); } diff --git a/setup/index.php b/setup/index.php index 5523328..daf8eb8 100644 --- a/setup/index.php +++ b/setup/index.php @@ -28,9 +28,9 @@ if (!defined('CON_FRAMEWORK')) { define('CON_FRAMEWORK', true); } -define('CON_SETUP_PATH', str_replace('\\', '/', realpath(dirname(__FILE__)))); +define('CON_SETUP_PATH', str_replace('\\', '/', realpath(__DIR__))); -define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../'))); +define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(__DIR__ . '/../'))); include_once('lib/startup.php'); @@ -70,7 +70,7 @@ if (is_array($_REQUEST)) { } -if (getPHPIniSetting('session.use_cookies') == 0) { +if (ini_get('session.use_cookies') == 0) { $sNotInstallableReason = 'session_use_cookies'; checkAndInclude('steps/notinstallable.php'); } @@ -104,92 +104,35 @@ if (array_key_exists('step', $_REQUEST)) { $iStep = ''; } -switch ($iStep) { - case 'setuptype': - checkAndInclude('steps/setuptype.php'); - break; - case 'setup1': - checkAndInclude('steps/setup/step1.php'); - break; - case 'setup2': - checkAndInclude('steps/setup/step2.php'); - break; - case 'setup3': - checkAndInclude('steps/setup/step3.php'); - break; - case 'setup4': - checkAndInclude('steps/setup/step4.php'); - break; - case 'setup5': - checkAndInclude('steps/setup/step5.php'); - break; - case 'setup6': - checkAndInclude('steps/setup/step6.php'); - break; - case 'setup7': - checkAndInclude('steps/setup/step7.php'); - break; - case 'setup8': - checkAndInclude('steps/setup/step8.php'); - break; - case 'migration1': - checkAndInclude('steps/migration/step1.php'); - break; - case 'migration2': - checkAndInclude('steps/migration/step2.php'); - break; - case 'migration3': - checkAndInclude('steps/migration/step3.php'); - break; - case 'migration4': - checkAndInclude('steps/migration/step4.php'); - break; - case 'migration5': - checkAndInclude('steps/migration/step5.php'); - break; - case 'migration6': - checkAndInclude('steps/migration/step6.php'); - break; - case 'migration7': - checkAndInclude('steps/migration/step7.php'); - break; - case 'migration8': - checkAndInclude('steps/migration/step8.php'); - break; - case 'upgrade1': - checkAndInclude('steps/upgrade/step1.php'); - break; - case 'upgrade2': - checkAndInclude('steps/upgrade/step2.php'); - break; - case 'upgrade3': - checkAndInclude('steps/upgrade/step3.php'); - break; - case 'upgrade4': - checkAndInclude('steps/upgrade/step4.php'); - break; - case 'upgrade5': - checkAndInclude('steps/upgrade/step5.php'); - break; - case 'upgrade6': - checkAndInclude('steps/upgrade/step6.php'); - break; - case 'upgrade7': - checkAndInclude('steps/upgrade/step7.php'); - break; - case 'domigration': - checkAndInclude('steps/migration/domigration.php'); - break; - case 'doupgrade': - checkAndInclude('steps/upgrade/doupgrade.php'); - break; - case 'doinstall': - checkAndInclude('steps/setup/doinstall.php'); - break; - case 'languagechooser': - default: - checkAndInclude('steps/languagechooser.php'); - break; -} +match ($iStep) { + 'setuptype' => checkAndInclude('steps/setuptype.php'), + 'setup1' => checkAndInclude('steps/setup/step1.php'), + 'setup2' => checkAndInclude('steps/setup/step2.php'), + 'setup3' => checkAndInclude('steps/setup/step3.php'), + 'setup4' => checkAndInclude('steps/setup/step4.php'), + 'setup5' => checkAndInclude('steps/setup/step5.php'), + 'setup6' => checkAndInclude('steps/setup/step6.php'), + 'setup7' => checkAndInclude('steps/setup/step7.php'), + 'setup8' => checkAndInclude('steps/setup/step8.php'), + 'migration1' => checkAndInclude('steps/migration/step1.php'), + 'migration2' => checkAndInclude('steps/migration/step2.php'), + 'migration3' => checkAndInclude('steps/migration/step3.php'), + 'migration4' => checkAndInclude('steps/migration/step4.php'), + 'migration5' => checkAndInclude('steps/migration/step5.php'), + 'migration6' => checkAndInclude('steps/migration/step6.php'), + 'migration7' => checkAndInclude('steps/migration/step7.php'), + 'migration8' => checkAndInclude('steps/migration/step8.php'), + 'upgrade1' => checkAndInclude('steps/upgrade/step1.php'), + 'upgrade2' => checkAndInclude('steps/upgrade/step2.php'), + 'upgrade3' => checkAndInclude('steps/upgrade/step3.php'), + 'upgrade4' => checkAndInclude('steps/upgrade/step4.php'), + 'upgrade5' => checkAndInclude('steps/upgrade/step5.php'), + 'upgrade6' => checkAndInclude('steps/upgrade/step6.php'), + 'upgrade7' => checkAndInclude('steps/upgrade/step7.php'), + 'domigration' => checkAndInclude('steps/migration/domigration.php'), + 'doupgrade' => checkAndInclude('steps/upgrade/doupgrade.php'), + 'doinstall' => checkAndInclude('steps/setup/doinstall.php'), + default => checkAndInclude('steps/languagechooser.php'), +}; ?> \ No newline at end of file diff --git a/setup/lib/class.setupcontrols.php b/setup/lib/class.setupcontrols.php index ccac2aa..18894d8 100644 --- a/setup/lib/class.setupcontrols.php +++ b/setup/lib/class.setupcontrols.php @@ -33,12 +33,12 @@ class cHTMLAlphaImage extends cHTMLImage { - var $_sClickImage; - var $_sMouseoverClickImage; - var $_sMouseoverSrc; + public $_sClickImage; + public $_sMouseoverClickImage; + public $_sMouseoverSrc; - function __construct() { - parent::__construct(); + public function __construct() + { } function setMouseover ($sMouseoverSrc) @@ -78,7 +78,7 @@ class cHTMLAlphaImage extends cHTMLImage { } - return parent::toHTML(); + return null; } } @@ -89,8 +89,7 @@ class cHTMLErrorMessageList extends cHTMLDiv { */ public function __construct() { $this->_oTable = new cHTMLTable(); - $this->_oTable->setWidth("100%"); - parent::__construct(); + $this->_oTable->setWidth("100%"); $this->setClass("errorlist"); $this->setStyle("width: 450px; height: 218px; overflow: auto; border: 1px solid black;"); } @@ -101,7 +100,7 @@ class cHTMLErrorMessageList extends cHTMLDiv { function toHTML() { $this->_setContent($this->_oTable->render()); - return parent::toHTML(); + return null; } } @@ -143,7 +142,7 @@ class cHTMLFoldableErrorMessage extends cHTMLTableRow { $this->_oContent->setVerticalAlignment("top"); $this->_oContent->setClass("entry"); - $this->_oContent->setContent(array($this->_oTitle, $this->_oMessage)); + $this->_oContent->setContent([$this->_oTitle, $this->_oMessage]); $this->_oIcon->setClass("icon"); $this->_oIcon->setVerticalAlignment("top"); @@ -162,13 +161,11 @@ class cHTMLFoldableErrorMessage extends cHTMLTableRow { } else { $this->_oIcon->setContent(" "); } - - parent::__construct(); } function toHTML() { - $this->setContent(array($this->_oFolding, $this->_oContent, $this->_oIcon)); - return parent::toHTML(); + $this->setContent([$this->_oFolding, $this->_oContent, $this->_oIcon]); + return null; } } @@ -190,13 +187,11 @@ class cHTMLInfoMessage extends cHTMLTableRow { $this->_oTitle->setVerticalAlignment("top"); $this->_oMessage->setContent($sMessage); $this->_oMessage->setClass("entry_nowrap"); - - parent::__construct(); } function toHTML() { - $this->setContent(array($this->_oTitle, $this->_oMessage)); - return parent::toHTML(); + $this->setContent([$this->_oTitle, $this->_oMessage]); + return null; } } @@ -209,8 +204,6 @@ class cHTMLLanguageLink extends cHTMLDiv { * @param int $stepnumber */ function __construct($langcode, $langname, $stepnumber) { - parent::__construct(); - $linkImage = new cHTMLAlphaImage(); $linkImage->setAlt(""); $linkImage->setSrc("../conlite/images/submit.gif"); @@ -249,8 +242,6 @@ class cHTMLButtonLink extends cHTMLDiv { * @param string $title */ function __construct($href, $title) { - parent::__construct(); - $linkImage = new cHTMLAlphaImage(); $linkImage->setSrc("../conlite/images/submit.gif"); $linkImage->setMouseover("../conlite/images/submit_hover.gif"); diff --git a/setup/lib/class.setupmask.php b/setup/lib/class.setupmask.php index 0b3a550..66f1bc8 100644 --- a/setup/lib/class.setupmask.php +++ b/setup/lib/class.setupmask.php @@ -35,18 +35,6 @@ class cSetupMask { */ protected $_oStepTemplate; - /** - * - * @var string - */ - protected $_sStepTemplate; - - /** - * - * @var int - */ - protected $_iStep; - /** * * @var bool @@ -59,12 +47,13 @@ class cSetupMask { */ protected $_sHeader; - public function __construct($sStepTemplate, $iStep = false) { + /** + * @param string $sStepTemplate + * @param int $iStep + */ + public function __construct(protected $_sStepTemplate, protected $_iStep = false) { $this->_oTpl = new Template(); $this->_oStepTemplate = new Template(); - - $this->_sStepTemplate = $sStepTemplate; - $this->_iStep = $iStep; } public function setNavigation($sBackstep, $sNextstep) { @@ -80,20 +69,12 @@ class cSetupMask { $sSetupType = ""; } - switch ($sSetupType) { - case "setup": - $this->_sHeader = "Setup - " . $sHeader; - break; - case "upgrade": - $this->_sHeader = "Upgrade - " . $sHeader; - break; - case "migration": - $this->_sHeader = "Migration - " . $sHeader; - break; - default: - $this->_sHeader = $sHeader; - break; - } + $this->_sHeader = match ($sSetupType) { + "setup" => "Setup - " . $sHeader, + "upgrade" => "Upgrade - " . $sHeader, + "migration" => "Migration - " . $sHeader, + default => $sHeader, + }; } public function _createNavigation() { diff --git a/setup/lib/class.template.php b/setup/lib/class.template.php index d57b243..8f8e993 100644 --- a/setup/lib/class.template.php +++ b/setup/lib/class.template.php @@ -29,55 +29,55 @@ class Template { * Needles (static) * @var array */ - var $needles = array(); + public $needles = []; /** * Replacements (static) * @var array */ - var $replacements = array(); + public $replacements = []; /** * Dyn_Needles (dynamic) * @var array */ - var $Dyn_needles = array(); + public $Dyn_needles = []; /** * Dyn_Replacements (dynamic) * @var array */ - var $Dyn_replacements = array(); + public $Dyn_replacements = []; /** * Database instance * @var object */ - var $db; + public $db; /** * Template cache * @var array */ - var $tplcache; + public $tplcache; /** * Template name cache * @var array */ - var $tplnamecache; + public $tplnamecache; /** * Dynamic counter * @var int */ - var $dyn_cnt = 0; + public $dyn_cnt = 0; /** * Tags array (for dynamic blocks); * @var array */ - var $tags = array('static' => '{%s}', 'start' => '', 'end' => ''); + public $tags = ['static' => '{%s}', 'start' => '', 'end' => '']; protected $_sDomain; protected $_encoding; @@ -87,8 +87,8 @@ class Template { * @return void */ public function __construct($tags = false) { - $this->tplcache = Array(); - $this->tplnamecache = Array(); + $this->tplcache = []; + $this->tplnamecache = []; if (is_array($tags)) { $this->tags = $tags; @@ -160,10 +160,10 @@ class Template { */ public function reset() { $this->dyn_cnt = 0; - $this->needles = array(); - $this->replacements = array(); - $this->Dyn_needles = array(); - $this->Dyn_replacements = array(); + $this->needles = []; + $this->replacements = []; + $this->Dyn_needles = []; + $this->Dyn_replacements = []; } /** @@ -187,7 +187,7 @@ class Template { $content = (($note) ? "\n" : "") . $content; - $pieces = array(); + $pieces = []; //if content has dynamic blocks if (preg_match("/^.*" . preg_quote($this->tags['start'], "/") . ".*?" . preg_quote($this->tags['end'], "/") . ".*$/s", $content)) { @@ -246,7 +246,7 @@ class Template { * @param $functionName string Name of the translation function (e.g. i18n) */ public function replacei18n(& $template, $functionName) { - $matches = array(); + $matches = []; //if template contains functionName + parameter store all matches preg_match_all("/" . preg_quote($functionName, "/") . "\\(([\\\"\\'])(.*?)\\1\\)/s", $template, $matches); diff --git a/setup/lib/defines.php b/setup/lib/defines.php index 4ea1ba8..1451073 100644 --- a/setup/lib/defines.php +++ b/setup/lib/defines.php @@ -41,7 +41,7 @@ define('C_SETUP_MIN_PHP_VERSION', '7.4.0'); define('C_SETUP_MAX_PHP_VERSION', '8.3.0'); define('C_SETUP_VERSION', '3.0.0'); -$sDefLocalPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'defines.local.php'; +$sDefLocalPath = __DIR__.DIRECTORY_SEPARATOR.'defines.local.php'; if(file_exists($sDefLocalPath)) { include_once $sDefLocalPath; } \ No newline at end of file diff --git a/setup/lib/functions.environment.php b/setup/lib/functions.environment.php index 15c34d5..a349819 100644 --- a/setup/lib/functions.environment.php +++ b/setup/lib/functions.environment.php @@ -48,7 +48,7 @@ function getServerUID () return posix_getuid(); } - $sFilename = md5(mt_rand()) . ".txt"; + $sFilename = md5(random_int(0, mt_getrandmax())) . ".txt"; if (isWriteable(".")) { @@ -81,7 +81,7 @@ function getServerGID () return posix_getgid(); } - $sFilename = md5(mt_rand()) . ".txt"; + $sFilename = md5(random_int(0, mt_getrandmax())) . ".txt"; if (isWriteable(".")) { @@ -131,7 +131,7 @@ function cInitializeArrayKey (&$aArray, $sKey, $mDefault = "") return false; } - $aArray = array(); + $aArray = []; } if (!array_key_exists($sKey, $aArray)) diff --git a/setup/lib/functions.filesystem.php b/setup/lib/functions.filesystem.php index bf5b40b..89b38f4 100644 --- a/setup/lib/functions.filesystem.php +++ b/setup/lib/functions.filesystem.php @@ -101,7 +101,7 @@ function canWriteFile($sFilename) { #try to find a random filename for write test, which does not exist while (file_exists($sRandFilenamePath) && $i < 100) { - $sRandFilename = 'con_test' . rand(0, 1000000000) . 'con_test'; + $sRandFilename = 'con_test' . random_int(0, 1_000_000_000) . 'con_test'; $sRandFilenamePath = ''; if ($sFilename[strlen($sFilename) - 1] == '/') { @@ -225,7 +225,7 @@ function getFileInfo($sFilename) { break; } - $aFileinfo = array(); + $aFileinfo = []; $aFileinfo["info"] = $info; $aFileinfo["type"] = $type; $aFileinfo["owner"]["read"] = ($oiFilePermissions & 0x0100) ? true : false; @@ -240,7 +240,7 @@ function getFileInfo($sFilename) { } function checkOpenBasedirCompatibility() { - $value = getPHPIniSetting("open_basedir"); + $value = ini_get("open_basedir"); if (isWindows()) { $aBasedirEntries = explode(";", $value); diff --git a/setup/lib/functions.libraries.php b/setup/lib/functions.libraries.php index 024913e..33e5591 100644 --- a/setup/lib/functions.libraries.php +++ b/setup/lib/functions.libraries.php @@ -80,7 +80,7 @@ function isImageMagickAvailable () } } - $output = array(); + $output = []; $retval = ""; @@ -91,7 +91,7 @@ function isImageMagickAvailable () return false; } - if (strpos($output[0],"ImageMagick") !== false) + if (str_contains($output[0],"ImageMagick")) { $_imagemagickAvailable = true; return true; diff --git a/setup/lib/functions.mysql.php b/setup/lib/functions.mysql.php index 2ffd7ed..e4a0c12 100644 --- a/setup/lib/functions.mysql.php +++ b/setup/lib/functions.mysql.php @@ -51,46 +51,25 @@ function hasMySQLiExtension() { } function doMySQLConnect($host, $username, $password) { - $aOptions = array( - 'connection' => array( - 'host' => $host, - 'user' => $username, - 'password' => $password, - ), - ); + $aOptions = ['connection' => ['host' => $host, 'user' => $username, 'password' => $password]]; $db = new DB_Contenido($aOptions); //$sFile = '../data/logs/setup_queries.txt'; //file_put_contents($sFile, $db->getServerInfo(), FILE_APPEND); //chmod($sFile, 0666); if (empty($db->connect())) { - return array($db, false); + return [$db, false]; } else { - return array($db, true); + return [$db, true]; } } function getSetupMySQLDBConnection($full = true) { if ($full === false) { // host, user and password - $aOptions = array( - 'connection' => array( - 'host' => $_SESSION["dbhost"], - 'user' => $_SESSION["dbuser"], - 'password' => $_SESSION["dbpass"] - ), - 'sequenceTable' => $_SESSION['dbprefix'] . '_sequence' - ); + $aOptions = ['connection' => ['host' => $_SESSION["dbhost"], 'user' => $_SESSION["dbuser"], 'password' => $_SESSION["dbpass"]], 'sequenceTable' => $_SESSION['dbprefix'] . '_sequence']; } else { // host, database, user and password - $aOptions = array( - 'connection' => array( - 'host' => $_SESSION["dbhost"], - 'database' => $_SESSION["dbname"], - 'user' => $_SESSION["dbuser"], - 'password' => $_SESSION["dbpass"] - ), - 'sequenceTable' => $_SESSION['dbprefix'] . '_sequence' - ); + $aOptions = ['connection' => ['host' => $_SESSION["dbhost"], 'database' => $_SESSION["dbname"], 'user' => $_SESSION["dbuser"], 'password' => $_SESSION["dbpass"]], 'sequenceTable' => $_SESSION['dbprefix'] . '_sequence']; } //$aOptions['enableProfiling'] = TRUE; @@ -253,7 +232,7 @@ function checkMySQLDropDatabase($db, $database) { function fetchMySQLStorageEngines($db) { $db->query("SHOW ENGINES"); - $engines = array(); + $engines = []; while ($db->next_record()) { $engines[] = $db->f(0); diff --git a/setup/lib/functions.phpinfo.php b/setup/lib/functions.phpinfo.php index e98ac9a..abe79b0 100644 --- a/setup/lib/functions.phpinfo.php +++ b/setup/lib/functions.phpinfo.php @@ -37,118 +37,72 @@ define("E_EXTENSION_AVAILABLE", 1); define("E_EXTENSION_UNAVAILABLE", 2); define("E_EXTENSION_CANTCHECK", 3); -/** - * getPHPIniSetting ($setting) - * - * Retrieves the setting $setting from the PHP setup. - * Wrapper to avoid warnings if ini_get is in the - * disable_functions directive. - */ -function getPHPIniSetting($setting) { - /* Avoid errors if ini_get is in the disable_functions directive */ - $value = @ini_get($setting); - - return $value; -} - /** * canPHPurlfopen: Checks if PHP is able to use * allow_url_fopen. */ -function canPHPurlfopen() { - return getPHPIniSetting("allow_url_fopen"); +function canPHPurlfopen(): bool|string +{ + return ini_get("allow_url_fopen"); } -/** - * checkPHPiniget: Checks if the ini_get function - * is available and not disabled. Returns true if the - * function is available. - * - * Uses the PHP configuration value y2k_compilance which - * is available in all PHP4 versions. - */ -function checkPHPiniget() { - $value = @ini_get("y2k_compliance"); - - if ($value === NULL) { - return false; - } else { - return true; - } +function getPHPDisplayErrorSetting(): bool|string +{ + return ini_get("display_errors"); } -function getPHPDisplayErrorSetting() { - return getPHPIniSetting("display_errors"); +function getPHPFileUploadSetting(): bool|string +{ + return ini_get("file_uploads"); } -function getPHPFileUploadSetting() { - return getPHPIniSetting("file_uploads"); +function getPHPGPCOrder(): bool|string +{ + return ini_get("gpc_order"); } -function getPHPGPCOrder() { - return getPHPIniSetting("gpc_order"); +function getPHPMagicQuotesRuntime(): bool|string +{ + return ini_get("magic_quotes_runtime"); } -function getPHPMagicQuotesGPC() { - return getPHPIniSetting("magic_quotes_gpc"); +function getPHPMagicQuotesSybase(): bool|string +{ + return ini_get("magic_quotes_sybase"); } -function getPHPMagicQuotesRuntime() { - return getPHPIniSetting("magic_quotes_runtime"); +function getPHPMaxExecutionTime(): bool|string +{ + return ini_get("max_execution_time"); } -function getPHPMagicQuotesSybase() { - return getPHPIniSetting("magic_quotes_sybase"); +function getPHPOpenBasedirSetting(): bool|string +{ + return ini_get("open_basedir"); } -function getPHPMaxExecutionTime() { - return getPHPIniSetting("max_execution_time"); +function checkPHPSQLSafeMode(): bool|string +{ + return ini_get("sql.safe_mode"); } -function getPHPOpenBasedirSetting() { - return getPHPIniSetting("open_basedir"); -} - -function getPHPMaxPostSize() { - return getPHPIniSetting("post_max_size"); -} - -function checkPHPSQLSafeMode() { - return getPHPIniSetting("sql.safe_mode"); -} - -function checkPHPUploadMaxFilesize() { - return getPHPIniSetting("upload_max_filesize"); -} - -function return_bytes($val) { +function return_bytes($val): float|int|string +{ if (strlen($val) == 0) { return 0; } $val = trim($val); $last = $val[strlen($val) - 1]; - switch ($last) { - case 'k': - case 'K': - return (int) $val * 1024; - break; - case 'm': - case 'M': - return (int) $val * 1048576; - break; - default: - return $val; - } + return match ($last) { + 'k', 'K' => (int) $val * 1024, + 'm', 'M' => (int) $val * 1_048_576, + default => $val, + }; } function isPHPExtensionLoaded($extension) { $value = extension_loaded($extension); - - if ($value === NULL) { - return E_EXTENSION_CANTCHECK; - } - if ($value === true) { return E_EXTENSION_AVAILABLE; } @@ -156,16 +110,10 @@ function isPHPExtensionLoaded($extension) { if ($value === false) { return E_EXTENSION_UNAVAILABLE; } -} -function isRegisterLongArraysActive() { - if (version_compare(phpversion(), "5.0.0", ">=") == true) { - if (getPHPIniSetting("register_long_arrays") == false) { - return false; - } + if ($value === NULL) { + return E_EXTENSION_CANTCHECK; } - - return true; } /** @@ -174,12 +122,7 @@ function isRegisterLongArraysActive() { * @param string $sVersion phpversion to test * @return boolean */ -function isPHPCompatible($sVersion = "5.2.0") { - if (version_compare(phpversion(), $sVersion, ">=") == true) { - return true; - } else { - return false; - } -} - -?> \ No newline at end of file +function isPHPCompatible($sVersion = "8.0.0"): bool +{ + return version_compare(phpversion(), $sVersion, ">="); +} \ No newline at end of file diff --git a/setup/lib/functions.safe_mode.php b/setup/lib/functions.safe_mode.php index 1340c6e..a402fa6 100644 --- a/setup/lib/functions.safe_mode.php +++ b/setup/lib/functions.safe_mode.php @@ -34,7 +34,7 @@ function getSafeModeStatus () { - if (getPHPIniSetting("safe_mode") == "1") + if (ini_get("safe_mode") == "1") { return true; } else { @@ -44,7 +44,7 @@ function getSafeModeStatus () function getSafeModeGidStatus () { - if (getPHPIniSetting("safe_mode_gid") == "1") + if (ini_get("safe_mode_gid") == "1") { return true; } else { @@ -54,16 +54,16 @@ function getSafeModeGidStatus () function getSafeModeIncludeDir () { - return getPHPIniSetting("safe_mode_include_dir"); + return ini_get("safe_mode_include_dir"); } function getOpenBasedir () { - return getPHPIniSetting("open_basedir"); + return ini_get("open_basedir"); } function getDisabledFunctions () { - return getPHPIniSetting("disable_functions"); + return ini_get("disable_functions"); } ?> \ No newline at end of file diff --git a/setup/lib/functions.sql.php b/setup/lib/functions.sql.php index 4d22595..d2b0ba2 100644 --- a/setup/lib/functions.sql.php +++ b/setup/lib/functions.sql.php @@ -32,7 +32,7 @@ if (!defined('CON_FRAMEWORK')) { die('Illegal call'); } -function injectSQL(&$db, $prefix, $file, &$failedChunks, $replacements = array()) { +function injectSQL(&$db, $prefix, $file, &$failedChunks, $replacements = []) { $file = trim($file); if (!isReadable($file)) { @@ -56,7 +56,7 @@ function injectSQL(&$db, $prefix, $file, &$failedChunks, $replacements = array() $db->query($sqlChunk); if ($db->Errno != 0) { - $failedChunks[] = array("sql" => $sqlChunk, "errno" => $db->Errno, "error" => $db->Error); + $failedChunks[] = ["sql" => $sqlChunk, "errno" => $db->Errno, "error" => $db->Error]; } } @@ -130,10 +130,10 @@ function split_sql_file($sql, $delimiter) { // try to save mem. $sql = ""; - $output = array(); + $output = []; // we don't actually care about the matches preg gives us. - $matches = array(); + $matches = []; // this is faster than calling count($oktens) every time thru the loop. $token_count = count($tokens); diff --git a/setup/lib/functions.system.php b/setup/lib/functions.system.php index 5c117a8..b70525c 100644 --- a/setup/lib/functions.system.php +++ b/setup/lib/functions.system.php @@ -48,27 +48,13 @@ function checkExistingPlugin($db, $sPluginname) { $sTable = $_SESSION["dbprefix"] . "_nav_sub"; $sSql = ""; - switch ($sPluginname) { - case 'plugin_conman': - $sSql = "SELECT * FROM %s WHERE idnavs='900'"; - break; - - case 'plugin_content_allocation': - $sSql = "SELECT * FROM %s WHERE idnavs='800'"; - break; - - case 'plugin_newsletter': - $sSql = "SELECT * FROM %s WHERE idnavs='610'"; - break; - - case 'mod_rewrite': - $sSql = "SELECT * FROM %s WHERE idnavs='700' OR location='mod_rewrite/xml/;navigation/content/mod_rewrite'"; - break; - - default: - $sSql = ""; - break; - } + $sSql = match ($sPluginname) { + 'plugin_conman' => "SELECT * FROM %s WHERE idnavs='900'", + 'plugin_content_allocation' => "SELECT * FROM %s WHERE idnavs='800'", + 'plugin_newsletter' => "SELECT * FROM %s WHERE idnavs='610'", + 'mod_rewrite' => "SELECT * FROM %s WHERE idnavs='700' OR location='mod_rewrite/xml/;navigation/content/mod_rewrite'", + default => "", + }; if ($sSql) { $db->query(sprintf($sSql, $sTable)); @@ -86,21 +72,7 @@ function checkExistingPlugin($db, $sPluginname) { * @param string $table db-table name */ function updateSystemProperties($db, $table) { - $aStandardvalues = array(array('type' => 'pw_request', 'name' => 'enable', 'value' => 'true'), - array('type' => 'system', 'name' => 'mail_sender_name', 'value' => 'noreply%40conlite.org'), - array('type' => 'system', 'name' => 'mail_sender', 'value' => 'ConLite+Backend'), - array('type' => 'system', 'name' => 'mail_host', 'value' => 'localhost'), - array('type' => 'maintenance', 'name' => 'mode', 'value' => 'disabled'), - array('type' => 'edit_area', 'name' => 'activated', 'value' => 'true'), - array('type' => 'update', 'name' => 'check', 'value' => 'false'), - array('type' => 'update', 'name' => 'news_feed', 'value' => 'false'), - array('type' => 'update', 'name' => 'check_period', 'value' => '60'), - array('type' => 'system', 'name' => 'clickmenu', 'value' => 'false'), - array('type' => 'versioning', 'name' => 'activated', 'value' => 'true'), - array('type' => 'versioning', 'name' => 'prune_limit', 'value' => '0'), - array('type' => 'versioning', 'name' => 'path', 'value' => ''), - array('type' => 'system', 'name' => 'insight_editing_activated', 'value' => 'true') - ); + $aStandardvalues = [['type' => 'pw_request', 'name' => 'enable', 'value' => 'true'], ['type' => 'system', 'name' => 'mail_sender_name', 'value' => 'noreply%40conlite.org'], ['type' => 'system', 'name' => 'mail_sender', 'value' => 'ConLite+Backend'], ['type' => 'system', 'name' => 'mail_host', 'value' => 'localhost'], ['type' => 'maintenance', 'name' => 'mode', 'value' => 'disabled'], ['type' => 'edit_area', 'name' => 'activated', 'value' => 'true'], ['type' => 'update', 'name' => 'check', 'value' => 'false'], ['type' => 'update', 'name' => 'news_feed', 'value' => 'false'], ['type' => 'update', 'name' => 'check_period', 'value' => '60'], ['type' => 'system', 'name' => 'clickmenu', 'value' => 'false'], ['type' => 'versioning', 'name' => 'activated', 'value' => 'true'], ['type' => 'versioning', 'name' => 'prune_limit', 'value' => '0'], ['type' => 'versioning', 'name' => 'path', 'value' => ''], ['type' => 'system', 'name' => 'insight_editing_activated', 'value' => 'true']]; foreach ($aStandardvalues as $aData) { $sql = "SELECT value FROM %s WHERE type='" . $aData['type'] . "' AND name='" . $aData['name'] . "'"; @@ -163,10 +135,10 @@ function listClients($db, $table) { $db->query(sprintf($sql, Contenido_Security::escapeDB($table, $db))); - $clients = array(); + $clients = []; while ($db->next_record()) { - $clients[$db->f("idclient")] = array("name" => $db->f("name"), "frontendpath" => $db->f("frontendpath"), "htmlpath" => $db->f("htmlpath")); + $clients[$db->f("idclient")] = ["name" => $db->f("name"), "frontendpath" => $db->f("frontendpath"), "htmlpath" => $db->f("htmlpath")]; } return $clients; @@ -192,8 +164,8 @@ function getSystemDirectories($bOriginalPath = false) { $root_path = str_replace("\\", "/", $root_path); - $root_path = dirname(dirname(dirname($root_path))); - $root_http_path = dirname(dirname($_SERVER["PHP_SELF"])); + $root_path = dirname($root_path, 3); + $root_http_path = dirname($_SERVER["PHP_SELF"], 2); $root_path = str_replace("\\", "/", $root_path); $root_http_path = str_replace("\\", "/", $root_http_path); @@ -216,7 +188,7 @@ function getSystemDirectories($bOriginalPath = false) { } if ($bOriginalPath == true) { - return array($root_path, $root_http_path); + return [$root_path, $root_http_path]; } if (isset($_SESSION["override_root_path"])) { @@ -230,7 +202,7 @@ function getSystemDirectories($bOriginalPath = false) { $root_path = stripLastSlash($root_path); $root_http_path = stripLastSlash($root_http_path); - return array($root_path, $root_http_path); + return [$root_path, $root_http_path]; } function findSimilarText($string1, $string2) { diff --git a/setup/makeconfig.php b/setup/makeconfig.php index 442969c..5fdf92c 100644 --- a/setup/makeconfig.php +++ b/setup/makeconfig.php @@ -33,13 +33,13 @@ if (!defined('CON_FRAMEWORK')) { define('CON_FRAMEWORK', true); } -define('CON_SETUP_PATH', str_replace('\\', '/', realpath(dirname(__FILE__)))); +define('CON_SETUP_PATH', str_replace('\\', '/', realpath(__DIR__))); -define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(dirname(__FILE__) . '/../'))); +define('CON_FRONTEND_PATH', str_replace('\\', '/', realpath(__DIR__ . '/../'))); include_once('lib/startup.php'); -list($root_path, $root_http_path) = getSystemDirectories(); +[$root_path, $root_http_path] = getSystemDirectories(); $tpl = new Template(); $tpl->set('s', 'CONTENIDO_ROOT', $root_path); @@ -94,7 +94,7 @@ if ($_SESSION['configmode'] == 'save') { } } else { header('Content-Type: application/octet-stream'); - header('Etag: ' . md5(mt_rand())); + header('Etag: ' . md5(random_int(0, mt_getrandmax()))); header('Content-Disposition: attachment;filename=config.php'); $tpl->generate('templates/config.php.tpl', false, false); } diff --git a/setup/steps/forms/additionalplugins.php b/setup/steps/forms/additionalplugins.php index 7c84bb3..f1f37ec 100644 --- a/setup/steps/forms/additionalplugins.php +++ b/setup/steps/forms/additionalplugins.php @@ -57,7 +57,7 @@ class cSetupAdditionalPlugins extends cSetupMask { $this->_oStepTemplate->set("s", "DESCRIPTION", i18n_setup("Please select Plugins to be installed")); // add new plugins to this array and you're done. - $aPlugins = array(); + $aPlugins = []; //$aPlugins['plugin_newsletter'] = array('label' => i18n_setup('Newsletter'), 'desc' => i18n_setup('Newsletterfunctionality for dispatching text newsletters and HTML-Newsletters, extensible with professional newsletter extensions. Definition of newsletter recipients and groups of recipients. Layout design of the HTML-Newsletters by ConLite articles.')); //$aPlugins['plugin_content_allocation'] = array('label' => i18n_setup('Content Allocation'), 'desc' => i18n_setup('For the representation and administration of content, 4fb developed the Content Allocation and content include technology. This technology dynamically allows on basis of a Template, to put the content in different places and in different formats according to several criteria.')); //$aPlugins['plugin_mod_rewrite'] = array('label' => i18n_setup('Mod Rewrite'), 'desc' => i18n_setup('Creates so called Clean URLs for a ConLite installation')); diff --git a/setup/steps/forms/clientadjust.php b/setup/steps/forms/clientadjust.php index e7ffff9..0eb7a79 100644 --- a/setup/steps/forms/clientadjust.php +++ b/setup/steps/forms/clientadjust.php @@ -50,11 +50,11 @@ class cSetupClientAdjust extends cSetupMask { $cHTMLErrorMessageList = new cHTMLErrorMessageList; $cHTMLErrorMessageList->setStyle("width: 580px; height: 200px; overflow: auto; border: 1px solid black;"); - $cHTMLFoldableErrorMessages = array(); + $cHTMLFoldableErrorMessages = []; - $aPathList = array(); + $aPathList = []; - list($a_root_path, $a_root_http_path) = getSystemDirectories(); + [$a_root_path, $a_root_http_path] = getSystemDirectories(); @include($a_root_path . "data/config/" . CL_ENVIRONMENT . "/config.php"); @@ -91,7 +91,7 @@ class cSetupClientAdjust extends cSetupMask { $oSystemPathBox = new cHTMLTextbox("frontendpath[$iIdClient]", $_SESSION["frontendpath"][$iIdClient]); $oSystemPathBox->setWidth(100); $oSystemPathBox->setClass("small"); - $oClientSystemPath = new cHTMLInfoMessage(array($sName, $oSystemPathBox), " "); + $oClientSystemPath = new cHTMLInfoMessage([$sName, $oSystemPathBox], " "); $oClientSystemPath->_oTitle->setStyle("padding-left: 8px; padding-bottom: 8px"); $aPathList[] = $oClientSystemPath; @@ -103,7 +103,7 @@ class cSetupClientAdjust extends cSetupMask { $oSystemPathBox = new cHTMLTextbox("htmlpath[$iIdClient]", $_SESSION["htmlpath"][$iIdClient]); $oSystemPathBox->setWidth(100); $oSystemPathBox->setClass("small"); - $oClientSystemPath = new cHTMLInfoMessage(array($sName, $oSystemPathBox), " "); + $oClientSystemPath = new cHTMLInfoMessage([$sName, $oSystemPathBox], " "); $oClientSystemPath->_oTitle->setStyle("padding-left: 8px; padding-bottom: 8px"); diff --git a/setup/steps/forms/clientmode.php b/setup/steps/forms/clientmode.php index ca9be72..41fd43c 100644 --- a/setup/steps/forms/clientmode.php +++ b/setup/steps/forms/clientmode.php @@ -41,7 +41,7 @@ class cSetupClientMode extends cSetupMask { cInitializeArrayKey($_SESSION, "clientmode", ""); - $aChoices = array(); + $aChoices = []; $aChoices["CLIENTEXAMPLES"] = "none"; //i18n_setup("Client with example modules and example content"); $aChoices["CLIENTMODULES"] = "none"; //i18n_setup("Client with example modules, but without example content"); diff --git a/setup/steps/forms/pathinfo.php b/setup/steps/forms/pathinfo.php index 8936413..2b26777 100644 --- a/setup/steps/forms/pathinfo.php +++ b/setup/steps/forms/pathinfo.php @@ -39,13 +39,13 @@ class cSetupPath extends cSetupMask { $this->_oStepTemplate->set("s", "TITLE", i18n_setup("System Directories")); $this->_oStepTemplate->set("s", "DESCRIPTION", i18n_setup("Please check the directories identified by the system. If you need to change a path, click on the name and enter the new path in the available input box.")); - list($root_path, $root_http_path) = getSystemDirectories(true); + [$root_path, $root_http_path] = getSystemDirectories(true); $cHTMLErrorMessageList = new cHTMLErrorMessageList; $cHTMLErrorMessageList->setStyle("width: 580px; height: 200px; overflow: auto; border: 1px solid black;"); - $cHTMLFoldableErrorMessages = array(); + $cHTMLFoldableErrorMessages = []; - list($a_root_path, $a_root_http_path) = getSystemDirectories(); + [$a_root_path, $a_root_http_path] = getSystemDirectories(); $oRootPath = new cHTMLTextbox("override_root_path", $a_root_path); $oRootPath->setWidth(100); $oRootPath->setClass("small"); diff --git a/setup/steps/forms/setupresults.php b/setup/steps/forms/setupresults.php index fd1fe6d..9d84692 100644 --- a/setup/steps/forms/setupresults.php +++ b/setup/steps/forms/setupresults.php @@ -37,7 +37,7 @@ class cSetupResults extends cSetupMask { $this->_oStepTemplate->set("s", "FINISHTEXT", i18n_setup("You can now start using ConLite. Please delete the folder named 'setup'!")); - list($root_path, $root_http_path) = getSystemDirectories(); + [$root_path, $root_http_path] = getSystemDirectories(); @@ -64,7 +64,7 @@ class cSetupResults extends cSetupMask { - list($sRootPath, $rootWebPath) = getSystemDirectories(); + [$sRootPath, $rootWebPath] = getSystemDirectories(); if (file_exists($sRootPath . "/data/logs/setuplog.txt")) { $sErrorLink = 'setuplog.txt'; diff --git a/setup/steps/forms/setupsummary.php b/setup/steps/forms/setupsummary.php index 3b911a4..8e69155 100644 --- a/setup/steps/forms/setupsummary.php +++ b/setup/steps/forms/setupsummary.php @@ -64,27 +64,21 @@ class cSetupSetupSummary extends cSetupMask { break; } - $messages = array( - i18n_setup("Installation type") . ":" => $sType, - i18n_setup("Database parameters") . ":" => i18n_setup("Database host") . ": " . $_SESSION["dbhost"] . "
" . i18n_setup("Database name") . ": " . $_SESSION["dbname"] . "
" . i18n_setup("Database username") . ": " . $_SESSION["dbuser"] . "
" . i18n_setup("Database prefix") . ": " . $_SESSION["dbprefix"], - ); + $messages = [i18n_setup("Installation type") . ":" => $sType, i18n_setup("Database parameters") . ":" => i18n_setup("Database host") . ": " . $_SESSION["dbhost"] . "
" . i18n_setup("Database name") . ": " . $_SESSION["dbname"] . "
" . i18n_setup("Database username") . ": " . $_SESSION["dbuser"] . "
" . i18n_setup("Database prefix") . ": " . $_SESSION["dbprefix"]]; if ($_SESSION["setuptype"] == "setup") { - $aChoices = array("CLIENTEXAMPLES" => i18n_setup("Client with example modules and example content"), - "CLIENTMODULES" => i18n_setup("Client with example modules but without example content"), - "CLIENT" => i18n_setup("Client without examples"), - "NOCLIENT" => i18n_setup("Don't create a client")); + $aChoices = ["CLIENTEXAMPLES" => i18n_setup("Client with example modules and example content"), "CLIENTMODULES" => i18n_setup("Client with example modules but without example content"), "CLIENT" => i18n_setup("Client without examples"), "NOCLIENT" => i18n_setup("Don't create a client")]; $messages[i18n_setup("Client installation") . ":"] = $aChoices[$_SESSION["clientmode"]]; } // additional plugins $aPlugins = $this->_getSelectedAdditionalPlugins(); - if (count($aPlugins) > 0) { + if ((is_countable($aPlugins) ? count($aPlugins) : 0) > 0) { $messages[i18n_setup("Additional Plugins") . ":"] = implode('
', $aPlugins); ; } - $cHTMLFoldableErrorMessages = array(); + $cHTMLFoldableErrorMessages = []; foreach ($messages as $key => $message) { $cHTMLFoldableErrorMessages[] = new cHTMLInfoMessage($key, $message); @@ -98,7 +92,7 @@ class cSetupSetupSummary extends cSetupMask { } public function _getSelectedAdditionalPlugins() { - $aPlugins = array(); + $aPlugins = []; if (isset($_SESSION['plugin_newsletter']) && $_SESSION['plugin_newsletter'] == 'true') { $aPlugins[] = i18n_setup('Newsletter'); } diff --git a/setup/steps/forms/systemdata.php b/setup/steps/forms/systemdata.php index a5a4557..9f635ae 100644 --- a/setup/steps/forms/systemdata.php +++ b/setup/steps/forms/systemdata.php @@ -36,7 +36,7 @@ class cSetupSystemData extends cSetupMask { public function __construct($step, $previous, $next) { parent::__construct("templates/setup/forms/systemdata.tpl", $step); - list($a_root_path, $a_root_http_path) = getSystemDirectories(); + [$a_root_path, $a_root_http_path] = getSystemDirectories(); cInitializeArrayKey($_SESSION, "dbprefix", ""); cInitializeArrayKey($_SESSION, "dbhost", ""); @@ -58,11 +58,7 @@ class cSetupSystemData extends cSetupMask { @include($a_root_path . "/data/config/" . CL_ENVIRONMENT . "/config.php"); } - $aVars = array("dbhost" => $contenido_host, - "dbuser" => $contenido_user, - "dbname" => $contenido_database, - "dbpass" => $contenido_password, - "dbprefix" => $cfg["sql"]["sqlprefix"]); + $aVars = ["dbhost" => $contenido_host, "dbuser" => $contenido_user, "dbname" => $contenido_database, "dbpass" => $contenido_password, "dbprefix" => $cfg["sql"]["sqlprefix"]]; foreach ($aVars as $aVar => $sValue) { if ($_SESSION[$aVar] == "") { diff --git a/setup/steps/forms/systemtest.php b/setup/steps/forms/systemtest.php index 4dc6120..c28a077 100644 --- a/setup/steps/forms/systemtest.php +++ b/setup/steps/forms/systemtest.php @@ -34,7 +34,7 @@ class cSetupSystemtest extends cSetupMask { $cHTMLErrorMessageList = new cHTMLErrorMessageList; - $this->_aMessages = array(); + $this->_aMessages = []; /* Run PHP tests */ $this->doPHPTests(); @@ -58,7 +58,7 @@ class cSetupSystemtest extends cSetupMask { $this->doExistingOldPluginTests(); } - $cHTMLFoldableErrorMessages = array(); + $cHTMLFoldableErrorMessages = []; foreach ($this->_aMessages as $iSeverity => $aMessageEntry) { switch ($iSeverity) { @@ -99,7 +99,7 @@ class cSetupSystemtest extends cSetupMask { $sMessage = ''; //get all tables in database and list it into array - $aAvariableTableNames = array(); + $aAvariableTableNames = []; $aTableNames = $db->table_names(); //print_r($db); @@ -112,10 +112,7 @@ class cSetupSystemtest extends cSetupMask { } //list of plugin tables to copy into new plugin tables - $aOldPluginTables = array('Workflow' => array('piwf_actions', 'piwf_allocation', 'piwf_art_allocation', - 'piwf_items', 'piwf_user_sequences', 'piwf_workflow'), - 'Content Allocation' => array('pica_alloc', 'pica_alloc_con', 'pica_lang'), - 'Linkchecker' => array('pi_externlinks', 'pi_linkwhitelist')); + $aOldPluginTables = ['Workflow' => ['piwf_actions', 'piwf_allocation', 'piwf_art_allocation', 'piwf_items', 'piwf_user_sequences', 'piwf_workflow'], 'Content Allocation' => ['pica_alloc', 'pica_alloc_con', 'pica_lang'], 'Linkchecker' => ['pi_externlinks', 'pi_linkwhitelist']]; foreach ($aOldPluginTables as $sPlugin => $aTables) { $bPluginExists = false; @@ -162,7 +159,7 @@ class cSetupSystemtest extends cSetupMask { * @todo: Store results into an external file */ if ($mResult == false && $iSeverity != C_SEVERITY_NONE) { - $this->_aMessages[$iSeverity][] = array($sHeadline, $sErrorMessage); + $this->_aMessages[$iSeverity][] = [$sHeadline, $sErrorMessage]; } } @@ -210,7 +207,7 @@ class cSetupSystemtest extends cSetupMask { } - $iMemoryLimit = return_bytes(getPHPIniSetting("memory_limit")); + $iMemoryLimit = return_bytes(ini_get("memory_limit")); if ($iMemoryLimit > 0) { $this->runTest(($iMemoryLimit > 1024 * 1024 * 32), C_SEVERITY_WARNING, i18n_setup("PHP memory_limit directive too small"), i18n_setup("The memory_limit directive is set to 32 MB or lower. This might be not enough for ConLite to operate correctly. We recommend to disable this setting completely, as this can cause problems with large ConLite projects.")); @@ -261,7 +258,7 @@ class cSetupSystemtest extends cSetupMask { public function doMySQLTests() { - list($handle, $status) = doMySQLConnect($_SESSION["dbhost"], $_SESSION["dbuser"], $_SESSION["dbpass"]); + [$handle, $status] = doMySQLConnect($_SESSION["dbhost"], $_SESSION["dbuser"], $_SESSION["dbpass"]); if (hasMySQLiExtension() && !hasMySQLExtension()) { $sErrorMessage = mysqli_error($handle->Link_ID); @@ -507,6 +504,7 @@ class cSetupSystemtest extends cSetupMask { } public function logFilePrediction($sFile, $iSeverity = C_SEVERITY_WARNING) { + $sPredictMessage = null; $status = canWriteFile("../" . $sFile); $sTitle = sprintf(i18n_setup("Can't write %s"), $sFile); $sMessage = sprintf(i18n_setup("Setup or ConLite can't write to the file %s. Please change the file permissions to correct this problem."), $sFile); diff --git a/setup/steps/languagechooser.php b/setup/steps/languagechooser.php index 76b7a7a..56f73d4 100644 --- a/setup/steps/languagechooser.php +++ b/setup/steps/languagechooser.php @@ -45,7 +45,7 @@ class cSetupLanguageChooser extends cSetupMask { $this->_oStepTemplate->set("s", "DE_HINT_LANG", "Wählen Sie bitte die gewünschte Sprache für das Setup aus."); $this->_oStepTemplate->set("s", "EN_HINT_LANG", "Please choose your language to continue."); - $langs = array("de_DE" => "Deutsch", "C" => "English"); + $langs = ["de_DE" => "Deutsch", "C" => "English"]; $m = "";