Skip to content

Commit

Permalink
change access to global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasse committed Dec 5, 2021
1 parent 02c133a commit 7b9bb9c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions adm_program/system/classes/ProfileFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ public function getHtmlValue($fieldNameIntern, $value, $value2 = null)
*/
public function getValue($fieldNameIntern, $format = '')
{
global $gL10n, $gSettingsManager;

$value = '';

// exists a profile field with that name ?
Expand All @@ -339,7 +337,7 @@ public function getValue($fieldNameIntern, $format = '')
if ($fieldNameIntern === 'COUNTRY') {
if ($value !== '') {
// read the language name of the country
$value = $gL10n->getCountryName($value);
$value = $GLOBALS['gL10n']->getCountryName($value);
}
} else {
switch ($this->mProfileFields[$fieldNameIntern]->getValue('usf_type')) {
Expand All @@ -353,7 +351,7 @@ public function getValue($fieldNameIntern, $format = '')

// if no format or html is set then show date format from Admidio settings
if ($format === '' || $format === 'html') {
$value = $date->format($gSettingsManager->getString('system_date'));
$value = $date->format($GLOBALS['gSettingsManager']->getString('system_date'));
} else {
$value = $date->format($format);
}
Expand Down Expand Up @@ -401,10 +399,8 @@ public function hasColumnsValueChanged()
*/
public function isEditable($fieldNameIntern, $allowedToEditProfile)
{
global $gCurrentUser;

return $this->isVisible($fieldNameIntern, $allowedToEditProfile)
&& ($gCurrentUser->editUsers() || $this->mProfileFields[$fieldNameIntern]->getValue('usf_disabled') == 0);
&& ($GLOBALS['gCurrentUser']->editUsers() || $this->mProfileFields[$fieldNameIntern]->getValue('usf_disabled') == 0);
}

/**
Expand All @@ -419,11 +415,9 @@ public function isEditable($fieldNameIntern, $allowedToEditProfile)
*/
public function isVisible($fieldNameIntern, $allowedToEditProfile = false)
{
global $gCurrentUser;

// check a special case where the field is only visible for users who can edit the profile but must therefore
// have the right to edit all users
if (!$gCurrentUser->editUsers()
if (!$GLOBALS['gCurrentUser']->editUsers()
&& $this->mProfileFields[$fieldNameIntern]->getValue('usf_disabled') == 1
&& $this->mProfileFields[$fieldNameIntern]->getValue('usf_hidden') == 1) {
return false;
Expand Down

0 comments on commit 7b9bb9c

Please sign in to comment.