diff --git a/web/edit_profile.php b/web/edit_profile.php index 665a20dd2e1be0c9463fed56ca9e4df040d66dd6..29a9bd8097723ee3758d0d88ecd90de7dc13f981 100644 --- a/web/edit_profile.php +++ b/web/edit_profile.php @@ -26,10 +26,10 @@ require_once('data/TagCloud.php'); # This function tends to be quite useful. Might move it somewhere else so # that it can be included and reused in other files. -function ifsetor (&$value, $fallback) +function getPostVar ($postvar, $fallback) { - if (isset($value)) - return $value; + if (isset($_POST[$postvar])) + return $_POST[$postvar]; return $fallback; } @@ -110,13 +110,13 @@ if(isset($user->name)) $smarty->assign('email', $user->email); # This is what we're going to let them change. - $smarty->assign("id", ifsetor($_POST['id'], $user->id)); - $smarty->assign('fullname', ifsetor($_POST['fullname'], $user->fullname)); - $smarty->assign('bio', ifsetor($_POST['bio'], $user->bio)); - $smarty->assign('homepage', ifsetor($_POST['homepage'], $user->homepage)); - $smarty->assign('location', ifsetor($_POST['location'], $user->location)); - $smarty->assign('location_uri', ifsetor($_POST['location_uri'], $user->location_uri)); - $smarty->assign('avatar_uri', ifsetor($_POST['avatar_uri'], $user->avatar_uri)); + $smarty->assign("id", getPostVar('id', $user->id)); + $smarty->assign('fullname', getPostVar('fullname', $user->fullname)); + $smarty->assign('bio', getPostVar('bio', $user->bio)); + $smarty->assign('homepage', getPostVar('homepage', $user->homepage)); + $smarty->assign('location', getPostVar('location', $user->location)); + $smarty->assign('location_uri', getPostVar('location_uri', $user->location_uri)); + $smarty->assign('avatar_uri', getPostVar('avatar_uri', $user->avatar_uri)); # And display the page. $smarty->assign('errors', $errors);