Skip to content

Commit

Permalink
Plugin: OnlyOffice: Fix E_NOTICEs when api_get_setting is not returni…
Browse files Browse the repository at this point in the history
…ng an array value
  • Loading branch information
AngelFQC committed Dec 19, 2024
1 parent 9511cee commit c60a4e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions plugin/onlyoffice/lib/onlyofficeAppSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,22 @@ public function getSetting($settingName)
}
switch ($settingName) {
case $this->jwtHeader:
$value = api_get_setting($settingName)[$this->plugin->getPluginName()];
$settings = api_get_setting($settingName);
$value = is_array($settings) && array_key_exists($this->plugin->getPluginName(), $settings)
? $settings[$this->plugin->getPluginName()]
: null;

if (empty($value)) {
$value = 'Authorization';
}
break;
case $this->documentServerInternalUrl:
$value = api_get_setting($settingName)[$this->plugin->getPluginName()];
$settings = api_get_setting($settingName);
$value = is_array($settings) ? ($settings[$this->plugin->getPluginName()] ?? null) : null;
break;
case $this->useDemoName:
$value = api_get_setting($settingName)[0];
$settings = api_get_setting($settingName);
$value = is_array($settings) ? ($settings[0] ?? null) : null;
break;
case $this->jwtPrefix:
$value = 'Bearer ';
Expand Down

0 comments on commit c60a4e2

Please sign in to comment.