PHP 7.4 fixes
Dieser Commit ist enthalten in:
Ursprung
0feff6b9f5
Commit
b6fcfc7f13
3 geänderte Dateien mit 303 neuen und 364 gelöschten Zeilen
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -26,24 +27,24 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(!defined('CON_FRAMEWORK')) {
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
define("C_PREDICT_SUFFICIENT", 1);
|
|
||||||
define("C_PREDICT_NOTPREDICTABLE", 2);
|
|
||||||
define("C_PREDICT_CHANGEPERM_SAMEOWNER", 3);
|
|
||||||
define("C_PREDICT_CHANGEPERM_SAMEGROUP", 4);
|
|
||||||
define("C_PREDICT_CHANGEPERM_OTHERS", 5);
|
|
||||||
define("C_PREDICT_CHANGEUSER", 6);
|
|
||||||
define("C_PREDICT_CHANGEGROUP", 7);
|
|
||||||
define("C_PREDICT_WINDOWS", 8);
|
|
||||||
|
|
||||||
define("E_BASEDIR_NORESTRICTION", 1);
|
define("C_PREDICT_SUFFICIENT", 1);
|
||||||
define("E_BASEDIR_DOTRESTRICTION", 2);
|
define("C_PREDICT_NOTPREDICTABLE", 2);
|
||||||
define("E_BASEDIR_RESTRICTIONSUFFICIENT", 3);
|
define("C_PREDICT_CHANGEPERM_SAMEOWNER", 3);
|
||||||
define("E_BASEDIR_INCOMPATIBLE", 4);
|
define("C_PREDICT_CHANGEPERM_SAMEGROUP", 4);
|
||||||
|
define("C_PREDICT_CHANGEPERM_OTHERS", 5);
|
||||||
|
define("C_PREDICT_CHANGEUSER", 6);
|
||||||
|
define("C_PREDICT_CHANGEGROUP", 7);
|
||||||
|
define("C_PREDICT_WINDOWS", 8);
|
||||||
|
|
||||||
|
define("E_BASEDIR_NORESTRICTION", 1);
|
||||||
|
define("E_BASEDIR_DOTRESTRICTION", 2);
|
||||||
|
define("E_BASEDIR_RESTRICTIONSUFFICIENT", 3);
|
||||||
|
define("E_BASEDIR_INCOMPATIBLE", 4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* isWriteable:
|
* isWriteable:
|
||||||
|
@ -55,19 +56,17 @@ define("E_BASEDIR_INCOMPATIBLE", 4);
|
||||||
* @param $file string Path to the file, accepts absolute and relative files
|
* @param $file string Path to the file, accepts absolute and relative files
|
||||||
* @return boolean true if the file exists and is writeable, false otherwise
|
* @return boolean true if the file exists and is writeable, false otherwise
|
||||||
*/
|
*/
|
||||||
function isWriteable ($file)
|
function isWriteable($file) {
|
||||||
{
|
clearstatcache();
|
||||||
clearstatcache();
|
if (!file_exists($file)) {
|
||||||
if (!file_exists($file))
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$bStatus = is_writable($file);
|
$bStatus = is_writable($file);
|
||||||
/* PHP 4.0.4 workaround */
|
/* PHP 4.0.4 workaround */
|
||||||
settype($bStatus, "boolean");
|
settype($bStatus, "boolean");
|
||||||
|
|
||||||
return $bStatus;
|
return $bStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,28 +76,23 @@ function isWriteable ($file)
|
||||||
* @param $file string Path to the file, accepts absolute and relative files
|
* @param $file string Path to the file, accepts absolute and relative files
|
||||||
* @return boolean true if the file exists and is readable, false otherwise
|
* @return boolean true if the file exists and is readable, false otherwise
|
||||||
*/
|
*/
|
||||||
function isReadable ($file)
|
function isReadable($file) {
|
||||||
{
|
return is_readable($file);
|
||||||
return is_readable($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function canReadFile ($sFilename)
|
function canReadFile($sFilename) {
|
||||||
{
|
if (isReadable(dirname($sFilename))) {
|
||||||
if (isReadable(dirname($sFilename)))
|
if (isReadable($sFilename)) {
|
||||||
{
|
$fp = fopen($sFilename, "r");
|
||||||
if (isReadable($sFilename))
|
fclose($fp);
|
||||||
{
|
|
||||||
$fp = fopen($sFilename, "r");
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canWriteFile ($sFilename)
|
function canWriteFile($sFilename) {
|
||||||
{
|
|
||||||
#check dir perms, create a new file read it and delete it
|
#check dir perms, create a new file read it and delete it
|
||||||
if (is_dir($sFilename)) {
|
if (is_dir($sFilename)) {
|
||||||
|
|
||||||
|
@ -106,14 +100,14 @@ function canWriteFile ($sFilename)
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
#try to find a random filename for write test, which does not exist
|
#try to find a random filename for write test, which does not exist
|
||||||
while (file_exists($sRandFilenamePath) && $i < 100) {
|
while (file_exists($sRandFilenamePath) && $i < 100) {
|
||||||
$sRandFilename = 'con_test'.rand(0,1000000000).'con_test';
|
$sRandFilename = 'con_test' . rand(0, 1000000000) . 'con_test';
|
||||||
$sRandFilenamePath = '';
|
$sRandFilenamePath = '';
|
||||||
|
|
||||||
if ($sFilename{strlen($sFilename)-1} == '/') {
|
if ($sFilename[strlen($sFilename) - 1] == '/') {
|
||||||
$sRandFilenamePath = $sFilename.$sRandFilename;
|
$sRandFilenamePath = $sFilename . $sRandFilename;
|
||||||
} else {
|
} else {
|
||||||
$sRandFilenamePath = $sFilename.'/'.$sRandFilename;
|
$sRandFilenamePath = $sFilename . '/' . $sRandFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -125,9 +119,9 @@ function canWriteFile ($sFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore errors in case isWriteable() returns
|
/* Ignore errors in case isWriteable() returns
|
||||||
* a wrong information
|
* a wrong information
|
||||||
*/
|
*/
|
||||||
$fp = @fopen($sRandFilenamePath, "w");
|
$fp = @fopen($sRandFilenamePath, "w");
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
unlink($sRandFilenamePath);
|
unlink($sRandFilenamePath);
|
||||||
|
@ -137,235 +131,204 @@ function canWriteFile ($sFilename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWriteable(dirname($sFilename)))
|
if (isWriteable(dirname($sFilename))) {
|
||||||
{
|
if (file_exists($sFilename)) {
|
||||||
if (file_exists($sFilename))
|
if (!isWriteable($sFilename)) {
|
||||||
{
|
return false;
|
||||||
if (!isWriteable($sFilename))
|
} else {
|
||||||
{
|
return true;
|
||||||
return false;
|
}
|
||||||
} else {
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ignore errors in case isWriteable() returns
|
/* Ignore errors in case isWriteable() returns
|
||||||
* a wrong information
|
* a wrong information
|
||||||
*/
|
*/
|
||||||
$fp = @fopen($sFilename, "w");
|
$fp = @fopen($sFilename, "w");
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
|
|
||||||
if (file_exists($sFilename))
|
if (file_exists($sFilename)) {
|
||||||
{
|
@unlink($sFilename);
|
||||||
@unlink($sFilename);
|
return true;
|
||||||
return true;
|
} else {
|
||||||
} else {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
if (file_exists($sFilename)) {
|
||||||
if (file_exists($sFilename))
|
if (!isWriteable($sFilename)) {
|
||||||
{
|
return false;
|
||||||
if (!isWriteable($sFilename))
|
} else {
|
||||||
{
|
return true;
|
||||||
return false;
|
}
|
||||||
} else {
|
}
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function canDeleteFile ($sFilename)
|
function canDeleteFile($sFilename) {
|
||||||
{
|
if (isWriteable($sFilename)) {
|
||||||
if (isWriteable($sFilename))
|
unlink($sFilename);
|
||||||
{
|
|
||||||
unlink($sFilename);
|
|
||||||
|
|
||||||
if (file_exists($sFilename))
|
if (file_exists($sFilename)) {
|
||||||
{
|
return false;
|
||||||
return false;
|
} else {
|
||||||
} else {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFileInfo ($sFilename)
|
function getFileInfo($sFilename) {
|
||||||
{
|
if (!file_exists($sFilename)) {
|
||||||
if (!file_exists($sFilename))
|
return false;
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oiFilePermissions = fileperms($sFilename);
|
$oiFilePermissions = fileperms($sFilename);
|
||||||
|
|
||||||
if ($oiFilePermissions === false)
|
if ($oiFilePermissions === false) {
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (true)
|
switch (true) {
|
||||||
{
|
case (($oiFilePermissions & 0xC000) == 0xC000):
|
||||||
case (($oiFilePermissions & 0xC000) == 0xC000):
|
$info = 's';
|
||||||
$info = 's';
|
$type = "socket";
|
||||||
$type = "socket";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0xA000) == 0xA000):
|
||||||
case (($oiFilePermissions & 0xA000) == 0xA000):
|
$info = 'l';
|
||||||
$info = 'l';
|
$type = "symbolic link";
|
||||||
$type = "symbolic link";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0x8000) == 0x8000):
|
||||||
case (($oiFilePermissions & 0x8000) == 0x8000):
|
$info = '-';
|
||||||
$info = '-';
|
$type = "regular file";
|
||||||
$type = "regular file";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0x6000) == 0x6000):
|
||||||
case (($oiFilePermissions & 0x6000) == 0x6000):
|
$info = 'b';
|
||||||
$info = 'b';
|
$type = "block special";
|
||||||
$type = "block special";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0x4000) == 0x4000):
|
||||||
case (($oiFilePermissions & 0x4000) == 0x4000):
|
$info = 'd';
|
||||||
$info = 'd';
|
$type = "directory";
|
||||||
$type = "directory";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0x2000) == 0x2000):
|
||||||
case (($oiFilePermissions & 0x2000) == 0x2000):
|
$info = 'c';
|
||||||
$info = 'c';
|
$type = "character special";
|
||||||
$type = "character special";
|
break;
|
||||||
break;
|
case (($oiFilePermissions & 0x1000) == 0x1000):
|
||||||
case (($oiFilePermissions & 0x1000) == 0x1000):
|
$info = 'p';
|
||||||
$info = 'p';
|
$type = "FIFO pipe";
|
||||||
$type = "FIFO pipe";
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
$info = "u";
|
||||||
$info = "u";
|
$type = "Unknown";
|
||||||
$type = "Unknown";
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$aFileinfo = array();
|
$aFileinfo = array();
|
||||||
$aFileinfo["info"] = $info;
|
$aFileinfo["info"] = $info;
|
||||||
$aFileinfo["type"] = $type;
|
$aFileinfo["type"] = $type;
|
||||||
$aFileinfo["owner"]["read"] = ($oiFilePermissions & 0x0100) ? true : false;
|
$aFileinfo["owner"]["read"] = ($oiFilePermissions & 0x0100) ? true : false;
|
||||||
$aFileinfo["owner"]["write"] = ($oiFilePermissions & 0x0080) ? true : false;
|
$aFileinfo["owner"]["write"] = ($oiFilePermissions & 0x0080) ? true : false;
|
||||||
$aFileinfo["group"]["read"] = ($oiFilePermissions & 0x0020) ? true : false;
|
$aFileinfo["group"]["read"] = ($oiFilePermissions & 0x0020) ? true : false;
|
||||||
$aFileinfo["group"]["write"] = ($oiFilePermissions & 0x0010) ? true : false;
|
$aFileinfo["group"]["write"] = ($oiFilePermissions & 0x0010) ? true : false;
|
||||||
$aFileinfo["others"]["read"] = ($oiFilePermissions & 0x0004) ? true : false;
|
$aFileinfo["others"]["read"] = ($oiFilePermissions & 0x0004) ? true : false;
|
||||||
$aFileinfo["others"]["write"] = ($oiFilePermissions & 0x0002) ? true : false;
|
$aFileinfo["others"]["write"] = ($oiFilePermissions & 0x0002) ? true : false;
|
||||||
$aFileinfo["owner"]["id"] = fileowner($sFilename);
|
$aFileinfo["owner"]["id"] = fileowner($sFilename);
|
||||||
$aFileinfo["group"]["id"] = filegroup($sFilename);
|
$aFileinfo["group"]["id"] = filegroup($sFilename);
|
||||||
return ($aFileinfo);
|
return ($aFileinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkOpenBasedirCompatibility ()
|
function checkOpenBasedirCompatibility() {
|
||||||
{
|
$value = getPHPIniSetting("open_basedir");
|
||||||
$value = getPHPIniSetting("open_basedir");
|
|
||||||
|
|
||||||
if (isWindows())
|
if (isWindows()) {
|
||||||
{
|
$aBasedirEntries = explode(";", $value);
|
||||||
$aBasedirEntries = explode(";", $value);
|
} else {
|
||||||
} else {
|
$aBasedirEntries = explode(":", $value);
|
||||||
$aBasedirEntries = explode(":", $value);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (count($aBasedirEntries) == 1 && $aBasedirEntries[0] == $value)
|
if (count($aBasedirEntries) == 1 && $aBasedirEntries[0] == $value) {
|
||||||
{
|
return E_BASEDIR_NORESTRICTION;
|
||||||
return E_BASEDIR_NORESTRICTION;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array(".", $aBasedirEntries) && count($aBasedirEntries) == 1)
|
if (in_array(".", $aBasedirEntries) && count($aBasedirEntries) == 1) {
|
||||||
{
|
return E_BASEDIR_DOTRESTRICTION;
|
||||||
return E_BASEDIR_DOTRESTRICTION;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$sCurrentDirectory = getcwd();
|
$sCurrentDirectory = getcwd();
|
||||||
|
|
||||||
foreach ($aBasedirEntries as $entry)
|
foreach ($aBasedirEntries as $entry) {
|
||||||
{
|
if (stristr($sCurrentDirectory, $entry)) {
|
||||||
if (stristr($sCurrentDirectory, $entry))
|
return E_BASEDIR_RESTRICTIONSUFFICIENT;
|
||||||
{
|
}
|
||||||
return E_BASEDIR_RESTRICTIONSUFFICIENT;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return E_BASEDIR_INCOMPATIBLE;
|
return E_BASEDIR_INCOMPATIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function predictCorrectFilepermissions ($file)
|
function predictCorrectFilepermissions($file) {
|
||||||
{
|
/* Check if the system is a windows system. If yes,
|
||||||
/* Check if the system is a windows system. If yes,
|
* we can't predict anything.
|
||||||
* we can't predict anything.
|
*/
|
||||||
*/
|
if (isWindows()) {
|
||||||
if (isWindows())
|
return C_PREDICT_WINDOWS;
|
||||||
{
|
}
|
||||||
return C_PREDICT_WINDOWS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the file is read- and writeable. If yes, we don't need
|
/* Check if the file is read- and writeable. If yes, we don't need
|
||||||
* to do any further checks.
|
* to do any further checks.
|
||||||
*/
|
*/
|
||||||
if (isWriteable($file) && isReadable($file))
|
if (isWriteable($file) && isReadable($file)) {
|
||||||
{
|
return C_PREDICT_SUFFICIENT;
|
||||||
return C_PREDICT_SUFFICIENT;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$iServerUID = getServerUID();
|
$iServerUID = getServerUID();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we can't find out the web server UID, we cannot
|
* If we can't find out the web server UID, we cannot
|
||||||
* predict the correct mask.
|
* predict the correct mask.
|
||||||
*/
|
*/
|
||||||
if ($iServerUID === false)
|
if ($iServerUID === false) {
|
||||||
{
|
return C_PREDICT_NOTPREDICTABLE;
|
||||||
return C_PREDICT_NOTPREDICTABLE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$iServerGID = getServerGID();
|
$iServerGID = getServerGID();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we can't find out the web server GID, we cannot
|
* If we can't find out the web server GID, we cannot
|
||||||
* predict the correct mask.
|
* predict the correct mask.
|
||||||
*/
|
*/
|
||||||
if ($iServerGID === false)
|
if ($iServerGID === false) {
|
||||||
{
|
return C_PREDICT_NOTPREDICTABLE;
|
||||||
return C_PREDICT_NOTPREDICTABLE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$aFilePermissions = getFileInfo($file);
|
$aFilePermissions = getFileInfo($file);
|
||||||
|
|
||||||
if (getSafeModeStatus())
|
if (getSafeModeStatus()) {
|
||||||
{
|
/* SAFE-Mode related checks */
|
||||||
/* SAFE-Mode related checks */
|
if ($iServerUID == $aFilePermissions["owner"]["id"]) {
|
||||||
if ($iServerUID == $aFilePermissions["owner"]["id"])
|
return C_PREDICT_CHANGEPERM_SAMEOWNER;
|
||||||
{
|
}
|
||||||
return C_PREDICT_CHANGEPERM_SAMEOWNER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getSafeModeGidStatus())
|
if (getSafeModeGidStatus()) {
|
||||||
{
|
/* SAFE-Mode GID related checks */
|
||||||
/* SAFE-Mode GID related checks */
|
if ($iServerGID == $aFilePermissions["group"]["id"]) {
|
||||||
if ($iServerGID == $aFilePermissions["group"]["id"])
|
return C_PREDICT_CHANGEPERM_SAMEGROUP;
|
||||||
{
|
}
|
||||||
return C_PREDICT_CHANGEPERM_SAMEGROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return C_PREDICT_CHANGEGROUP;
|
return C_PREDICT_CHANGEGROUP;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Regular checks */
|
||||||
|
|
||||||
|
if ($iServerUID == $aFilePermissions["owner"]["id"]) {
|
||||||
|
return C_PREDICT_CHANGEPERM_SAMEOWNER;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
if ($iServerGID == $aFilePermissions["group"]["id"]) {
|
||||||
/* Regular checks */
|
return C_PREDICT_CHANGEPERM_SAMEGROUP;
|
||||||
|
}
|
||||||
|
|
||||||
if ($iServerUID == $aFilePermissions["owner"]["id"])
|
return C_PREDICT_CHANGEPERM_OTHERS;
|
||||||
{
|
}
|
||||||
return C_PREDICT_CHANGEPERM_SAMEOWNER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($iServerGID == $aFilePermissions["group"]["id"])
|
|
||||||
{
|
|
||||||
return C_PREDICT_CHANGEPERM_SAMEGROUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return C_PREDICT_CHANGEPERM_OTHERS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project:
|
* Project:
|
||||||
* Contenido Content Management System
|
* Contenido Content Management System
|
||||||
|
@ -27,15 +28,14 @@
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(!defined('CON_FRAMEWORK')) {
|
if (!defined('CON_FRAMEWORK')) {
|
||||||
die('Illegal call');
|
die('Illegal call');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
define("E_EXTENSION_AVAILABLE", 1);
|
define("E_EXTENSION_AVAILABLE", 1);
|
||||||
define("E_EXTENSION_UNAVAILABLE", 2);
|
define("E_EXTENSION_UNAVAILABLE", 2);
|
||||||
define("E_EXTENSION_CANTCHECK", 3);
|
define("E_EXTENSION_CANTCHECK", 3);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getPHPIniSetting ($setting)
|
* getPHPIniSetting ($setting)
|
||||||
|
@ -44,21 +44,19 @@ define("E_EXTENSION_CANTCHECK", 3);
|
||||||
* Wrapper to avoid warnings if ini_get is in the
|
* Wrapper to avoid warnings if ini_get is in the
|
||||||
* disable_functions directive.
|
* disable_functions directive.
|
||||||
*/
|
*/
|
||||||
function getPHPIniSetting ($setting)
|
function getPHPIniSetting($setting) {
|
||||||
{
|
/* Avoid errors if ini_get is in the disable_functions directive */
|
||||||
/* Avoid errors if ini_get is in the disable_functions directive */
|
$value = @ini_get($setting);
|
||||||
$value = @ini_get($setting);
|
|
||||||
|
return $value;
|
||||||
return $value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* canPHPurlfopen: Checks if PHP is able to use
|
* canPHPurlfopen: Checks if PHP is able to use
|
||||||
* allow_url_fopen.
|
* allow_url_fopen.
|
||||||
*/
|
*/
|
||||||
function canPHPurlfopen ()
|
function canPHPurlfopen() {
|
||||||
{
|
return getPHPIniSetting("allow_url_fopen");
|
||||||
return getPHPIniSetting("allow_url_fopen");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,81 +67,67 @@ function canPHPurlfopen ()
|
||||||
* Uses the PHP configuration value y2k_compilance which
|
* Uses the PHP configuration value y2k_compilance which
|
||||||
* is available in all PHP4 versions.
|
* is available in all PHP4 versions.
|
||||||
*/
|
*/
|
||||||
function checkPHPiniget ()
|
function checkPHPiniget() {
|
||||||
{
|
$value = @ini_get("y2k_compliance");
|
||||||
$value = @ini_get("y2k_compliance");
|
|
||||||
|
if ($value === NULL) {
|
||||||
if ($value === NULL)
|
return false;
|
||||||
{
|
} else {
|
||||||
return false;
|
return true;
|
||||||
} else {
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPDisplayErrorSetting ()
|
function getPHPDisplayErrorSetting() {
|
||||||
{
|
return getPHPIniSetting("display_errors");
|
||||||
return getPHPIniSetting("display_errors");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPFileUploadSetting ()
|
function getPHPFileUploadSetting() {
|
||||||
{
|
return getPHPIniSetting("file_uploads");
|
||||||
return getPHPIniSetting("file_uploads");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPGPCOrder ()
|
function getPHPGPCOrder() {
|
||||||
{
|
return getPHPIniSetting("gpc_order");
|
||||||
return getPHPIniSetting("gpc_order");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPMagicQuotesGPC ()
|
function getPHPMagicQuotesGPC() {
|
||||||
{
|
return getPHPIniSetting("magic_quotes_gpc");
|
||||||
return getPHPIniSetting("magic_quotes_gpc");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPMagicQuotesRuntime ()
|
function getPHPMagicQuotesRuntime() {
|
||||||
{
|
return getPHPIniSetting("magic_quotes_runtime");
|
||||||
return getPHPIniSetting("magic_quotes_runtime");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPMagicQuotesSybase ()
|
function getPHPMagicQuotesSybase() {
|
||||||
{
|
return getPHPIniSetting("magic_quotes_sybase");
|
||||||
return getPHPIniSetting("magic_quotes_sybase");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPMaxExecutionTime ()
|
function getPHPMaxExecutionTime() {
|
||||||
{
|
return getPHPIniSetting("max_execution_time");
|
||||||
return getPHPIniSetting("max_execution_time");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPOpenBasedirSetting ()
|
function getPHPOpenBasedirSetting() {
|
||||||
{
|
return getPHPIniSetting("open_basedir");
|
||||||
return getPHPIniSetting("open_basedir");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPHPMaxPostSize ()
|
function getPHPMaxPostSize() {
|
||||||
{
|
return getPHPIniSetting("post_max_size");
|
||||||
return getPHPIniSetting("post_max_size");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPHPSQLSafeMode ()
|
function checkPHPSQLSafeMode() {
|
||||||
{
|
return getPHPIniSetting("sql.safe_mode");
|
||||||
return getPHPIniSetting("sql.safe_mode");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPHPUploadMaxFilesize ()
|
function checkPHPUploadMaxFilesize() {
|
||||||
{
|
return getPHPIniSetting("upload_max_filesize");
|
||||||
return getPHPIniSetting("upload_max_filesize");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function return_bytes($val) {
|
function return_bytes($val) {
|
||||||
if (strlen($val) == 0)
|
if (strlen($val) == 0) {
|
||||||
{
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
$val = trim($val);
|
$val = trim($val);
|
||||||
$last = $val{strlen($val)-1};
|
$last = $val[strlen($val) - 1];
|
||||||
switch($last) {
|
switch ($last) {
|
||||||
case 'k':
|
case 'k':
|
||||||
case 'K':
|
case 'K':
|
||||||
return (int) $val * 1024;
|
return (int) $val * 1024;
|
||||||
|
@ -157,38 +141,31 @@ function return_bytes($val) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPHPExtensionLoaded ($extension)
|
function isPHPExtensionLoaded($extension) {
|
||||||
{
|
$value = extension_loaded($extension);
|
||||||
$value = extension_loaded($extension);
|
|
||||||
|
|
||||||
|
if ($value === NULL) {
|
||||||
if ($value === NULL)
|
return E_EXTENSION_CANTCHECK;
|
||||||
{
|
}
|
||||||
return E_EXTENSION_CANTCHECK;
|
|
||||||
}
|
if ($value === true) {
|
||||||
|
return E_EXTENSION_AVAILABLE;
|
||||||
if ($value === true)
|
}
|
||||||
{
|
|
||||||
return E_EXTENSION_AVAILABLE;
|
if ($value === false) {
|
||||||
}
|
return E_EXTENSION_UNAVAILABLE;
|
||||||
|
}
|
||||||
if ($value === false)
|
|
||||||
{
|
|
||||||
return E_EXTENSION_UNAVAILABLE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRegisterLongArraysActive ()
|
function isRegisterLongArraysActive() {
|
||||||
{
|
if (version_compare(phpversion(), "5.0.0", ">=") == true) {
|
||||||
if (version_compare(phpversion(), "5.0.0", ">=") == true)
|
if (getPHPIniSetting("register_long_arrays") == false) {
|
||||||
{
|
return false;
|
||||||
if (getPHPIniSetting("register_long_arrays") == false)
|
}
|
||||||
{
|
}
|
||||||
return false;
|
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,7 +178,8 @@ function isPHPCompatible($sVersion = "5.2.0") {
|
||||||
if (version_compare(phpversion(), $sVersion, ">=") == true) {
|
if (version_compare(phpversion(), $sVersion, ">=") == true) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -446,7 +446,7 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function doFileSystemTests() {
|
public function doFileSystemTests() {
|
||||||
if(!is_readable(CON_SETUP_PATH."/data")) {
|
if (!is_readable(CON_SETUP_PATH . "/data")) {
|
||||||
$this->runTest(false, C_SEVERITY_ERROR, i18n_setup("Setup data folder not readable!"), i18n_setup("Please check the Folder setup/data! Maybe it' s missing or not readable."));
|
$this->runTest(false, C_SEVERITY_ERROR, i18n_setup("Setup data folder not readable!"), i18n_setup("Please check the Folder setup/data! Maybe it' s missing or not readable."));
|
||||||
}
|
}
|
||||||
// old logs
|
// old logs
|
||||||
|
@ -461,7 +461,7 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
$this->logFilePrediction("data/logs/errorlog.txt");
|
$this->logFilePrediction("data/logs/errorlog.txt");
|
||||||
$this->logFilePrediction("data/logs/setuplog.txt");
|
$this->logFilePrediction("data/logs/setuplog.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
// new folders in data-folder
|
// new folders in data-folder
|
||||||
$this->logFilePrediction("data/cache/");
|
$this->logFilePrediction("data/cache/");
|
||||||
$this->logFilePrediction("data/temp/");
|
$this->logFilePrediction("data/temp/");
|
||||||
|
@ -471,18 +471,18 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
|
|
||||||
// cronjobs
|
// cronjobs
|
||||||
$sFolder = 'data/cronlog/';
|
$sFolder = 'data/cronlog/';
|
||||||
$this->logFilePrediction($sFolder."pseudo-cron.log");
|
$this->logFilePrediction($sFolder . "pseudo-cron.log");
|
||||||
$this->logFilePrediction($sFolder."session_cleanup.php.job");
|
$this->logFilePrediction($sFolder . "session_cleanup.php.job");
|
||||||
$this->logFilePrediction($sFolder."send_reminder.php.job");
|
$this->logFilePrediction($sFolder . "send_reminder.php.job");
|
||||||
$this->logFilePrediction($sFolder."optimize_database.php.job");
|
$this->logFilePrediction($sFolder . "optimize_database.php.job");
|
||||||
$this->logFilePrediction($sFolder."move_old_stats.php.job");
|
$this->logFilePrediction($sFolder . "move_old_stats.php.job");
|
||||||
$this->logFilePrediction($sFolder."move_articles.php.job");
|
$this->logFilePrediction($sFolder . "move_articles.php.job");
|
||||||
$this->logFilePrediction($sFolder."linkchecker.php.job");
|
$this->logFilePrediction($sFolder . "linkchecker.php.job");
|
||||||
$this->logFilePrediction($sFolder."run_newsletter_job.php.job");
|
$this->logFilePrediction($sFolder . "run_newsletter_job.php.job");
|
||||||
$this->logFilePrediction($sFolder."setfrontenduserstate.php.job");
|
$this->logFilePrediction($sFolder . "setfrontenduserstate.php.job");
|
||||||
$this->logFilePrediction($sFolder."advance_workflow.php.job");
|
$this->logFilePrediction($sFolder . "advance_workflow.php.job");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($_SESSION["setuptype"] == "setup" || ($_SESSION["setuptype"] == "migration" && is_dir("../cms/"))) {
|
if ($_SESSION["setuptype"] == "setup" || ($_SESSION["setuptype"] == "migration" && is_dir("../cms/"))) {
|
||||||
$this->logFilePrediction("cms/cache/");
|
$this->logFilePrediction("cms/cache/");
|
||||||
|
@ -527,19 +527,19 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_SAMEOWNER:
|
case C_PREDICT_CHANGEPERM_SAMEOWNER:
|
||||||
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
||||||
$mfileperms{0} = intval($mfileperms{0}) | 0x6;
|
$mfileperms[0] = intval($mfileperms[0]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server and the owner of your files are identical. You need to enable write access for the owner, e.g. using chmod u+rw %s, setting the file mask to %s or set the owner to allow writing the file."), $sFile, $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server and the owner of your files are identical. You need to enable write access for the owner, e.g. using chmod u+rw %s, setting the file mask to %s or set the owner to allow writing the file."), $sFile, $mfileperms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_SAMEGROUP:
|
case C_PREDICT_CHANGEPERM_SAMEGROUP:
|
||||||
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
||||||
$mfileperms{1} = intval($mfileperms{1}) | 0x6;
|
$mfileperms[1] = intval($mfileperms[1]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server's group and the group of your files are identical. You need to enable write access for the group, e.g. using chmod g+rw %s, setting the file mask to %s or set the group to allow writing the file."), $sFile, $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server's group and the group of your files are identical. You need to enable write access for the group, e.g. using chmod g+rw %s, setting the file mask to %s or set the group to allow writing the file."), $sFile, $mfileperms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_OTHERS:
|
case C_PREDICT_CHANGEPERM_OTHERS:
|
||||||
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
$mfileperms = substr(sprintf("%o", fileperms("../" . $sFile)), -3);
|
||||||
$mfileperms{2} = intval($mfileperms{2}) | 0x6;
|
$mfileperms[2] = intval($mfileperms[2]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server is not equal to the file owner, and is not in the webserver's group. It would be highly insecure to allow world write acess to the files. If you want to install anyways, enable write access for all others, e.g. using chmod o+rw %s, setting the file mask to %s or set the others to allow writing the file."), $sFile, $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server is not equal to the file owner, and is not in the webserver's group. It would be highly insecure to allow world write acess to the files. If you want to install anyways, enable write access for all others, e.g. using chmod o+rw %s, setting the file mask to %s or set the others to allow writing the file."), $sFile, $mfileperms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -558,19 +558,19 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_SAMEOWNER:
|
case C_PREDICT_CHANGEPERM_SAMEOWNER:
|
||||||
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
||||||
$mfileperms{0} = intval($mfileperms{0}) | 0x6;
|
$mfileperms[0] = intval($mfileperms[0]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server and the owner of your directory are identical. You need to enable write access for the owner, e.g. using chmod u+rw %s, setting the directory mask to %s or set the owner to allow writing the directory."), dirname($sFile), $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server and the owner of your directory are identical. You need to enable write access for the owner, e.g. using chmod u+rw %s, setting the directory mask to %s or set the owner to allow writing the directory."), dirname($sFile), $mfileperms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_SAMEGROUP:
|
case C_PREDICT_CHANGEPERM_SAMEGROUP:
|
||||||
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
||||||
$mfileperms{1} = intval($mfileperms{1}) | 0x6;
|
$mfileperms[1] = intval($mfileperms[1]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server's group and the group of your directory are identical. You need to enable write access for the group, e.g. using chmod g+rw %s, setting the directory mask to %s or set the group to allow writing the directory."), dirname($sFile), $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server's group and the group of your directory are identical. You need to enable write access for the group, e.g. using chmod g+rw %s, setting the directory mask to %s or set the group to allow writing the directory."), dirname($sFile), $mfileperms);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_PREDICT_CHANGEPERM_OTHERS:
|
case C_PREDICT_CHANGEPERM_OTHERS:
|
||||||
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
$mfileperms = substr(sprintf("%o", @fileperms($sTarget)), -3);
|
||||||
$mfileperms{2} = intval($mfileperms{2}) | 0x6;
|
$mfileperms[2] = intval($mfileperms[2]) | 0x6;
|
||||||
$sPredictMessage = sprintf(i18n_setup("Your web server is not equal to the directory owner, and is not in the webserver's group. It would be highly insecure to allow world write acess to the directory. If you want to install anyways, enable write access for all others, e.g. using chmod o+rw %s, setting the directory mask to %s or set the others to allow writing the directory."), dirname($sFile), $mfileperms);
|
$sPredictMessage = sprintf(i18n_setup("Your web server is not equal to the directory owner, and is not in the webserver's group. It would be highly insecure to allow world write acess to the directory. If you want to install anyways, enable write access for all others, e.g. using chmod o+rw %s, setting the directory mask to %s or set the others to allow writing the directory."), dirname($sFile), $mfileperms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -580,5 +580,3 @@ class cSetupSystemtest extends cSetupMask {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
Laden …
In neuem Issue referenzieren