# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . define('TITLE', __('Register ')); global $db; global $_USER; global $mailing; if ($_USER) header('Location: '.BASE); $allowed = check_invitation($_REQUEST['token']); if ($_GET) { if ($_GET['status'] == 'done') { if (!defined('NO_CONFIRMATION_EMAIL') || (NO_CONFIRMATION_EMAIL == false)) { echo showStatus(__('Check your email (including SPAM) to activate your account'), 'ok'); } else { echo showStatus(__('You can access now with your account, thank you!'), 'ok'); } } if (($_GET['key']) and ($_GET['uid'])) { $result = $db->checkRegKey($_GET['key'], $_GET['uid']); if ($result) { echo showStatus(__('You can access now with your account, thank you!'), 'ok'); $db->updateStatus($_GET['uid'], 'ok'); $db->deleteKey($_GET['key'], $_GET['uid']); $userInfo = $db->getUserInfo($_GET['uid']); $mailing->registrationSuccess($userInfo['email'], $userInfo['username']); if (defined('ADMIN_MAIL') && (defined('ALERT_ON_NEWUSER'))) { if (ALERT_ON_NEWUSER == true) $mailing->alertNewUser($userInfo['username']); } die; } else { echo showStatus(__('Invalid confirmation code!'), 'error'); die; } } } if ($_POST) { if ($allowed) { echo register(); } else { echo showStatus(__('You need a valid token to register an account'), 'warning'); } } if ((!$_GET['status']) and (!$_GET['confirm'])) { if ($allowed) { doRegisterForm(); } else { echo showStatus(__('You need a valid token to register an account'), 'warning'); } }