Skip to content

Commit

Permalink
Use Config, not global vars, in Server::prepareServerSettingsContext()
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Stovell <[email protected]>
  • Loading branch information
Sesquipedalian committed Jul 3, 2024
1 parent 627cc91 commit f649ad4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Sources/Actions/Admin/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,9 +1126,6 @@ public static function prepareServerSettingsContext(array &$config_vars): void
if (!is_array($config_var) || !isset($config_var[1])) {
Utils::$context['config_vars'][] = $config_var;
} else {
$varname = $config_var[0];
global $$varname;

// Set the subtext in case it's part of the label.
// @todo Temporary. Preventing divs inside label tags.
$divPos = strpos($config_var[1], '<div');
Expand All @@ -1146,7 +1143,7 @@ public static function prepareServerSettingsContext(array &$config_vars): void
'size' => !empty($config_var[4]) && !is_array($config_var[4]) ? $config_var[4] : 0,
'data' => isset($config_var[4]) && is_array($config_var[4]) && $config_var[3] != 'select' ? $config_var[4] : [],
'name' => $config_var[0],
'value' => $config_var[2] == 'file' ? Utils::htmlspecialchars((string) $$varname) : (isset(Config::$modSettings[$config_var[0]]) ? Utils::htmlspecialchars(Config::$modSettings[$config_var[0]]) : (in_array($config_var[3], ['int', 'float']) ? 0 : '')),
'value' => $config_var[2] == 'file' ? Utils::htmlspecialchars((string) Config::${$config_var[0]}) : (isset(Config::$modSettings[$config_var[0]]) ? Utils::htmlspecialchars(Config::$modSettings[$config_var[0]]) : (in_array($config_var[3], ['int', 'float']) ? 0 : '')),
'disabled' => !empty(Utils::$context['settings_not_writable']) || !empty($config_var['disabled']),
'invalid' => false,
'subtext' => !empty($config_var['subtext']) ? $config_var['subtext'] : $subtext,
Expand Down

0 comments on commit f649ad4

Please sign in to comment.