check if xml node in configuration exists before accessing it

This commit is contained in:
Uwe Steinmann 2018-04-12 06:46:35 +02:00
parent dfe2e3f167
commit 0b4b3fb9d9

View File

@ -476,51 +476,57 @@ class Settings { /* {{{ */
// XML Path: /configuration/site/calendar // XML Path: /configuration/site/calendar
$node = $xml->xpath('/configuration/site/calendar'); $node = $xml->xpath('/configuration/site/calendar');
$tab = $node[0]->attributes(); if($node) {
$this->_enableCalendar = Settings::boolVal($tab["enableCalendar"]); $tab = $node[0]->attributes();
$this->_calendarDefaultView = strval($tab["calendarDefaultView"]); $this->_enableCalendar = Settings::boolVal($tab["enableCalendar"]);
$this->_firstDayOfWeek = intval($tab["firstDayOfWeek"]); $this->_calendarDefaultView = strval($tab["calendarDefaultView"]);
$this->_firstDayOfWeek = intval($tab["firstDayOfWeek"]);
}
// XML Path: /configuration/system/server // XML Path: /configuration/system/server
$node = $xml->xpath('/configuration/system/server'); $node = $xml->xpath('/configuration/system/server');
$tab = $node[0]->attributes(); if($node) {
$this->_rootDir = strval($tab["rootDir"]); $tab = $node[0]->attributes();
$this->_httpRoot = strval($tab["httpRoot"]); $this->_rootDir = strval($tab["rootDir"]);
$this->_contentDir = strval($tab["contentDir"]); $this->_httpRoot = strval($tab["httpRoot"]);
if($this->_contentDir && substr($this->_contentDir, -1, 1) != DIRECTORY_SEPARATOR) $this->_contentDir = strval($tab["contentDir"]);
$this->_contentDir .= DIRECTORY_SEPARATOR; if($this->_contentDir && substr($this->_contentDir, -1, 1) != DIRECTORY_SEPARATOR)
$this->_cacheDir = strval($tab["cacheDir"]); $this->_contentDir .= DIRECTORY_SEPARATOR;
$this->_stagingDir = strval($tab["stagingDir"]); $this->_cacheDir = strval($tab["cacheDir"]);
$this->_luceneDir = strval($tab["luceneDir"]); $this->_stagingDir = strval($tab["stagingDir"]);
$this->_dropFolderDir = strval($tab["dropFolderDir"]); $this->_luceneDir = strval($tab["luceneDir"]);
$this->_backupDir = strval($tab["backupDir"]); $this->_dropFolderDir = strval($tab["dropFolderDir"]);
$this->_repositoryUrl = strval($tab["repositoryUrl"]); $this->_backupDir = strval($tab["backupDir"]);
$this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]); $this->_repositoryUrl = strval($tab["repositoryUrl"]);
$this->_logFileRotation = strval($tab["logFileRotation"]); $this->_logFileEnable = Settings::boolVal($tab["logFileEnable"]);
$this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]); $this->_logFileRotation = strval($tab["logFileRotation"]);
$this->_partitionSize = strval($tab["partitionSize"]); $this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]);
$this->_maxUploadSize = strval($tab["maxUploadSize"]); $this->_partitionSize = strval($tab["partitionSize"]);
$this->_maxUploadSize = strval($tab["maxUploadSize"]);
}
// XML Path: /configuration/system/authentication // XML Path: /configuration/system/authentication
$node = $xml->xpath('/configuration/system/authentication'); $node = $xml->xpath('/configuration/system/authentication');
$tab = $node[0]->attributes(); if($node) {
$this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]); $tab = $node[0]->attributes();
$this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]); $this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]);
$this->_enablePasswordForgotten = Settings::boolVal($tab["enablePasswordForgotten"]); $this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]);
$this->_passwordStrength = intval($tab["passwordStrength"]); $this->_enablePasswordForgotten = Settings::boolVal($tab["enablePasswordForgotten"]);
$this->_passwordStrengthAlgorithm = strval($tab["passwordStrengthAlgorithm"]); $this->_passwordStrength = intval($tab["passwordStrength"]);
$this->_passwordExpiration = intval($tab["passwordExpiration"]); $this->_passwordStrengthAlgorithm = strval($tab["passwordStrengthAlgorithm"]);
$this->_passwordHistory = intval($tab["passwordHistory"]); $this->_passwordExpiration = intval($tab["passwordExpiration"]);
$this->_loginFailure = intval($tab["loginFailure"]); $this->_passwordHistory = intval($tab["passwordHistory"]);
$this->_autoLoginUser = intval($tab["autoLoginUser"]); $this->_loginFailure = intval($tab["loginFailure"]);
$this->_quota = intval($tab["quota"]); $this->_autoLoginUser = intval($tab["autoLoginUser"]);
$this->_undelUserIds = strval($tab["undelUserIds"]); $this->_quota = intval($tab["quota"]);
$this->_encryptionKey = strval($tab["encryptionKey"]); $this->_undelUserIds = strval($tab["undelUserIds"]);
$this->_cookieLifetime = intval($tab["cookieLifetime"]); $this->_encryptionKey = strval($tab["encryptionKey"]);
$this->_defaultAccessDocs = intval($tab["defaultAccessDocs"]); $this->_cookieLifetime = intval($tab["cookieLifetime"]);
$this->_restricted = Settings::boolVal($tab["restricted"]); $this->_defaultAccessDocs = intval($tab["defaultAccessDocs"]);
$this->_enableUserImage = Settings::boolVal($tab["enableUserImage"]); $this->_restricted = Settings::boolVal($tab["restricted"]);
$this->_disableSelfEdit = Settings::boolVal($tab["disableSelfEdit"]); $this->_enableUserImage = Settings::boolVal($tab["enableUserImage"]);
$this->_disableSelfEdit = Settings::boolVal($tab["disableSelfEdit"]);
}
// XML Path: /configuration/system/authentication/connectors/connector // XML Path: /configuration/system/authentication/connectors/connector
// attributs mandatories : type enable // attributs mandatories : type enable
@ -566,13 +572,15 @@ class Settings { /* {{{ */
// XML Path: /configuration/system/database // XML Path: /configuration/system/database
$node = $xml->xpath('/configuration/system/database'); $node = $xml->xpath('/configuration/system/database');
$tab = $node[0]->attributes(); if($node) {
$this->_dbDriver = strval($tab["dbDriver"]); $tab = $node[0]->attributes();
$this->_dbHostname = strval($tab["dbHostname"]); $this->_dbDriver = strval($tab["dbDriver"]);
$this->_dbDatabase = strval($tab["dbDatabase"]); $this->_dbHostname = strval($tab["dbHostname"]);
$this->_dbUser = strval($tab["dbUser"]); $this->_dbDatabase = strval($tab["dbDatabase"]);
$this->_dbPass = strval($tab["dbPass"]); $this->_dbUser = strval($tab["dbUser"]);
$this->_doNotCheckDBVersion = Settings::boolVal($tab["doNotCheckDBVersion"]); $this->_dbPass = strval($tab["dbPass"]);
$this->_doNotCheckDBVersion = Settings::boolVal($tab["doNotCheckDBVersion"]);
}
// XML Path: /configuration/system/smtp // XML Path: /configuration/system/smtp
$node = $xml->xpath('/configuration/system/smtp'); $node = $xml->xpath('/configuration/system/smtp');
@ -601,34 +609,40 @@ class Settings { /* {{{ */
// XML Path: /configuration/advanced/display // XML Path: /configuration/advanced/display
$node = $xml->xpath('/configuration/advanced/display'); $node = $xml->xpath('/configuration/advanced/display');
$tab = $node[0]->attributes(); if($node) {
$this->_siteDefaultPage = strval($tab["siteDefaultPage"]); $tab = $node[0]->attributes();
$this->_rootFolderID = intval($tab["rootFolderID"]); $this->_siteDefaultPage = strval($tab["siteDefaultPage"]);
$this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]); $this->_rootFolderID = intval($tab["rootFolderID"]);
$this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]); $this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]);
$this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]);
}
// XML Path: /configuration/advanced/authentication // XML Path: /configuration/advanced/authentication
$node = $xml->xpath('/configuration/advanced/authentication'); $node = $xml->xpath('/configuration/advanced/authentication');
$tab = $node[0]->attributes(); if($node) {
$this->_guestID = intval($tab["guestID"]); $tab = $node[0]->attributes();
$this->_adminIP = strval($tab["adminIP"]); $this->_guestID = intval($tab["guestID"]);
$this->_adminIP = strval($tab["adminIP"]);
}
// XML Path: /configuration/advanced/edition // XML Path: /configuration/advanced/edition
$node = $xml->xpath('/configuration/advanced/edition'); $node = $xml->xpath('/configuration/advanced/edition');
$tab = $node[0]->attributes(); if($node) {
$this->_enableAdminRevApp = Settings::boolval($tab["enableAdminRevApp"]); $tab = $node[0]->attributes();
$this->_enableOwnerRevApp = Settings::boolval($tab["enableOwnerRevApp"]); $this->_enableAdminRevApp = Settings::boolval($tab["enableAdminRevApp"]);
$this->_enableSelfRevApp = Settings::boolval($tab["enableSelfRevApp"]); $this->_enableOwnerRevApp = Settings::boolval($tab["enableOwnerRevApp"]);
$this->_enableUpdateRevApp = Settings::boolval($tab["enableUpdateRevApp"]); $this->_enableSelfRevApp = Settings::boolval($tab["enableSelfRevApp"]);
$this->_presetExpirationDate = strval($tab["presetExpirationDate"]); $this->_enableUpdateRevApp = Settings::boolval($tab["enableUpdateRevApp"]);
$this->_versioningFileName = strval($tab["versioningFileName"]); $this->_presetExpirationDate = strval($tab["presetExpirationDate"]);
$this->_workflowMode = strval($tab["workflowMode"]); $this->_versioningFileName = strval($tab["versioningFileName"]);
$this->_allowReviewerOnly = Settings::boolval($tab["allowReviewerOnly"]); $this->_workflowMode = strval($tab["workflowMode"]);
$this->_enableVersionDeletion = Settings::boolval($tab["enableVersionDeletion"]); $this->_allowReviewerOnly = Settings::boolval($tab["allowReviewerOnly"]);
$this->_enableVersionModification = Settings::boolval($tab["enableVersionModification"]); $this->_enableVersionDeletion = Settings::boolval($tab["enableVersionDeletion"]);
$this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]); $this->_enableVersionModification = Settings::boolval($tab["enableVersionModification"]);
$this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]); $this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]);
$this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]); $this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]);
$this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]);
}
// XML Path: /configuration/advanced/notification // XML Path: /configuration/advanced/notification
$node = $xml->xpath('/configuration/advanced/notification'); $node = $xml->xpath('/configuration/advanced/notification');
@ -641,18 +655,20 @@ class Settings { /* {{{ */
// XML Path: /configuration/advanced/server // XML Path: /configuration/advanced/server
$node = $xml->xpath('/configuration/advanced/server'); $node = $xml->xpath('/configuration/advanced/server');
$tab = $node[0]->attributes(); if($node) {
$this->_coreDir = strval($tab["coreDir"]); $tab = $node[0]->attributes();
$this->_luceneClassDir = strval($tab["luceneClassDir"]); $this->_coreDir = strval($tab["coreDir"]);
$this->_extraPath = strval($tab["extraPath"]); $this->_luceneClassDir = strval($tab["luceneClassDir"]);
$this->_contentOffsetDir = strval($tab["contentOffsetDir"]); $this->_extraPath = strval($tab["extraPath"]);
$this->_maxDirID = intval($tab["maxDirID"]); $this->_contentOffsetDir = strval($tab["contentOffsetDir"]);
$this->_updateNotifyTime = intval($tab["updateNotifyTime"]); $this->_maxDirID = intval($tab["maxDirID"]);
$this->_cmdTimeout = intval($tab["cmdTimeout"]); $this->_updateNotifyTime = intval($tab["updateNotifyTime"]);
if (isset($tab["maxExecutionTime"])) $this->_cmdTimeout = intval($tab["cmdTimeout"]);
$this->_maxExecutionTime = intval($tab["maxExecutionTime"]); if (isset($tab["maxExecutionTime"]))
else $this->_maxExecutionTime = intval($tab["maxExecutionTime"]);
$this->_maxExecutionTime = ini_get("max_execution_time"); else
$this->_maxExecutionTime = ini_get("max_execution_time");
}
// XML Path: /configuration/system/advanced/converters // XML Path: /configuration/system/advanced/converters
$convertergroups = $xml->xpath('/configuration/advanced/converters'); $convertergroups = $xml->xpath('/configuration/advanced/converters');