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,13 +476,16 @@ class Settings { /* {{{ */
// XML Path: /configuration/site/calendar
$node = $xml->xpath('/configuration/site/calendar');
if($node) {
$tab = $node[0]->attributes();
$this->_enableCalendar = Settings::boolVal($tab["enableCalendar"]);
$this->_calendarDefaultView = strval($tab["calendarDefaultView"]);
$this->_firstDayOfWeek = intval($tab["firstDayOfWeek"]);
}
// XML Path: /configuration/system/server
$node = $xml->xpath('/configuration/system/server');
if($node) {
$tab = $node[0]->attributes();
$this->_rootDir = strval($tab["rootDir"]);
$this->_httpRoot = strval($tab["httpRoot"]);
@ -500,9 +503,11 @@ class Settings { /* {{{ */
$this->_enableLargeFileUpload = Settings::boolVal($tab["enableLargeFileUpload"]);
$this->_partitionSize = strval($tab["partitionSize"]);
$this->_maxUploadSize = strval($tab["maxUploadSize"]);
}
// XML Path: /configuration/system/authentication
$node = $xml->xpath('/configuration/system/authentication');
if($node) {
$tab = $node[0]->attributes();
$this->_enableGuestLogin = Settings::boolVal($tab["enableGuestLogin"]);
$this->_enableGuestAutoLogin = Settings::boolVal($tab["enableGuestAutoLogin"]);
@ -521,6 +526,7 @@ class Settings { /* {{{ */
$this->_restricted = Settings::boolVal($tab["restricted"]);
$this->_enableUserImage = Settings::boolVal($tab["enableUserImage"]);
$this->_disableSelfEdit = Settings::boolVal($tab["disableSelfEdit"]);
}
// XML Path: /configuration/system/authentication/connectors/connector
// attributs mandatories : type enable
@ -566,6 +572,7 @@ class Settings { /* {{{ */
// XML Path: /configuration/system/database
$node = $xml->xpath('/configuration/system/database');
if($node) {
$tab = $node[0]->attributes();
$this->_dbDriver = strval($tab["dbDriver"]);
$this->_dbHostname = strval($tab["dbHostname"]);
@ -573,6 +580,7 @@ class Settings { /* {{{ */
$this->_dbUser = strval($tab["dbUser"]);
$this->_dbPass = strval($tab["dbPass"]);
$this->_doNotCheckDBVersion = Settings::boolVal($tab["doNotCheckDBVersion"]);
}
// XML Path: /configuration/system/smtp
$node = $xml->xpath('/configuration/system/smtp');
@ -601,20 +609,25 @@ class Settings { /* {{{ */
// XML Path: /configuration/advanced/display
$node = $xml->xpath('/configuration/advanced/display');
if($node) {
$tab = $node[0]->attributes();
$this->_siteDefaultPage = strval($tab["siteDefaultPage"]);
$this->_rootFolderID = intval($tab["rootFolderID"]);
$this->_titleDisplayHack = Settings::boolval($tab["titleDisplayHack"]);
$this->_showMissingTranslations = Settings::boolval($tab["showMissingTranslations"]);
}
// XML Path: /configuration/advanced/authentication
$node = $xml->xpath('/configuration/advanced/authentication');
if($node) {
$tab = $node[0]->attributes();
$this->_guestID = intval($tab["guestID"]);
$this->_adminIP = strval($tab["adminIP"]);
}
// XML Path: /configuration/advanced/edition
$node = $xml->xpath('/configuration/advanced/edition');
if($node) {
$tab = $node[0]->attributes();
$this->_enableAdminRevApp = Settings::boolval($tab["enableAdminRevApp"]);
$this->_enableOwnerRevApp = Settings::boolval($tab["enableOwnerRevApp"]);
@ -629,6 +642,7 @@ class Settings { /* {{{ */
$this->_enableDuplicateDocNames = Settings::boolval($tab["enableDuplicateDocNames"]);
$this->_overrideMimeType = Settings::boolval($tab["overrideMimeType"]);
$this->_removeFromDropFolder = Settings::boolval($tab["removeFromDropFolder"]);
}
// XML Path: /configuration/advanced/notification
$node = $xml->xpath('/configuration/advanced/notification');
@ -641,6 +655,7 @@ class Settings { /* {{{ */
// XML Path: /configuration/advanced/server
$node = $xml->xpath('/configuration/advanced/server');
if($node) {
$tab = $node[0]->attributes();
$this->_coreDir = strval($tab["coreDir"]);
$this->_luceneClassDir = strval($tab["luceneClassDir"]);
@ -653,6 +668,7 @@ class Settings { /* {{{ */
$this->_maxExecutionTime = intval($tab["maxExecutionTime"]);
else
$this->_maxExecutionTime = ini_get("max_execution_time");
}
// XML Path: /configuration/system/advanced/converters
$convertergroups = $xml->xpath('/configuration/advanced/converters');