diff --git a/account.php b/account.php index 3391e46bcb2da1fd1cb8c1db83b33ac3f28475f2..4a5f96d7e2ccc10dba3576158ecfc25b35cf14ee 100644 --- a/account.php +++ b/account.php @@ -20,12 +20,26 @@ require 'client.inc.php'; $inc = 'register.inc.php'; +$errors = array(); + if (!$cfg || !$cfg->isClientRegistrationEnabled()) { Http::redirect('index.php'); } +elseif ($thisclient) { + $inc = 'profile.inc.php'; + $user = User::lookup($thisclient->getId()); +} + +if ($user && $_POST) { + if ($acct = $thisclient->getAccount()) { + $acct->update($_POST, $errors); + } + if (!$errors && $user->updateInfo($_POST, $errors)) + Http::redirect('tickets.php'); +} + elseif ($_POST) { - $errors = array(); $user_form = UserForm::getUserForm()->getForm($_POST); if (!$user_form->isValid(function($f) { return !$f->get('internal'); })) $errors['err'] = 'Incomplete client information'; diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 107cf479c43884bf362b57f72378c40bc1a5be78..1fe599486ca1451365a7465cb9107edf6861739b 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -46,7 +46,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); if($thisclient && is_object($thisclient) && $thisclient->isValid()) { echo Format::htmlchars($thisclient->getName()).' |'; ?> - <a href="<?php echo ROOT_PATH; ?>profile.php">Profile</a> | + <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> | <?php if($cfg->showRelatedTickets()) {?> <a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> -