Skip to content

Commit

Permalink
Fix change_info if account_country is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Apr 15, 2024
1 parent ef62b53 commit 62d3c19
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions system/pages/account/change_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@
defined('MYAAC') or die('Direct access not allowed!');

$show_form = true;
$new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : NULL;
$new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : NULL;
$new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : NULL;
$new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : '';
$new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : '';
$new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : '';
if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) {
if(!isset($config['countries'][$new_country]))
if(config('account_country') && !isset($config['countries'][$new_country])) {
$errors[] = 'Country is not correct.';
}

if(empty($errors)) {
//save data from form
$account_logged->setCustomField("rlname", $new_rlname);
$account_logged->setCustomField("location", $new_location);
$account_logged->setCustomField("country", $new_country);
$account_logged->logAction('Changed Real Name to <b>' . $new_rlname . '</b>, Location to <b>' . $new_location . '</b> and Country to <b>' . $config['countries'][$new_country] . '</b>.');

$log = 'Changed Real Name to <b>' . $new_rlname . '</b>, Location to <b>' . $new_location . '</b>';
if (config('account_country')) {
$log .= ' and Country to <b>' . $config['countries'][$new_country] . '</b>';
}
$log .= '.';

$account_logged->logAction($log);

$twig->display('success.html.twig', array(
'title' => 'Public Information Changed',
'description' => 'Your public information has been changed.'
Expand Down Expand Up @@ -59,4 +68,4 @@
'account_country' => isset($account_country) ? $account_country : ''
));
}
?>
?>

0 comments on commit 62d3c19

Please sign in to comment.