/** * Index function * * Currently the index consists of following possible requests: * register - registration form to page content * confirm - confirmation redirect to signup * * @param void */ public function index($args = false) { // In case Signup is closed if (isset($_SESSION['Param']->FeatureSignupClose) && $_SESSION['Param']->FeatureSignupClose == "Yes") { return new SignupClosedPage(); } /* * Enable to check against DNS Blocklists if (MOD_dnsblock::get()->checkRemoteIp()) { return new SignupDNSBlockPage(); } */ $request = $args->request; $model = new SignupModel(); if (isset($_SESSION['IdMember']) && !MOD_right::get()->hasRight('words')) { if (!isset($_SESSION['Username'])) { unset($_SESSION['IdMember']); $page = new SignupProblemPage(); } else { $this->redirect('members/' . $_SESSION['Username']); } } else { switch (isset($request[1]) ? $request[1] : '') { // copied from TB: // checks e-mail address for validity and availability case 'checkemail': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($_GET['email'])) { echo '0'; PPHP::PExit(); } if (!PFunctions::isEmailAddress($_GET['email'])) { echo '0'; PPHP::PExit(); } $users = $model->takeCareForNonUniqueEmailAddress($_GET['email']); if ($users == '') { echo "1"; } else { echo "0"; } PPHP::PExit(); break; // copied from TB: rewiewed by JeanYves // checks Username for validity and availability // copied from TB: rewiewed by JeanYves // checks Username for validity and availability case 'checkhandle': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { echo '0'; PPHP::PExit(); } if (!preg_match(User::HANDLE_PREGEXP, $request[2])) { echo '0'; PPHP::PExit(); } if (strpos($request[2], 'xn--') !== false) { // Don't allow IDN-Prefixes echo '0'; PPHP::PExit(); } echo (bool) (!$model->UsernameInUse($request[2])); PPHP::PExit(); break; case 'getRegions': // ignore current request, so we can use the last request PRequest::ignoreCurrentRequest(); if (!isset($request[2])) { PPHP::PExit(); } case 'terms': MOD_log::get()->write("Viewing terms", "Signup"); // the termsandconditions popup $page = new SignupTermsPopup(); break; case 'privacy': MOD_log::get()->write("Viewing privacy", "Signup"); $page = new SignupPrivacyPopup(); break; case 'confirm': // or give it a different name? // this happens when you click the link in the confirmation email if (!isset($request[2]) || !isset($request[3]) || !preg_match(User::HANDLE_PREGEXP, $request[2]) || !$model->UsernameInUse($request[2]) || !preg_match('/^[a-f0-9]{16}$/', $request[3])) { $error = 'InvalidLink'; } else { $error = $model->confirmSignup($request[2], $request[3]); } $page = new SignupMailConfirmPage(); $page->error = $error; break; case 'resendmail': // shown when clicking on the link in the MailToConfirm error message $error = ''; if (!isset($request[2])) { $error = 'InvalidLink'; } else { $resent = $model->resendConfirmationMail($request[2]); if ($resent !== true) { $error = $resent; } } $page = new SignupResentMailPage(); $page->error = $error; break; case 'finish': $page = new SignupFinishPage(); break; default: $page = new SignupPage(); $page->step = isset($request[1]) && $request[1] ? $request[1] : '1'; $StrLog = "Entering Signup step: #" . $page->step; MOD_log::get()->write($StrLog, "Signup"); $page->model = $model; } } return $page; }