err = array(); parent::__construct('GameAccount'); } public function execute( $par ) { $request = $this->getRequest(); $output = $this->getOutput(); $this->setHeaders(); $output->setRobotPolicy('index,nofollow'); $output->addMeta('description', 'Create a Game Account for The Mana World'); $output->addMeta('keywords', 'Create Account, free game account, online free game account, mmorpg account, account, sign up'); global $wgTMWAccountLib; $check_ladmin = new $wgTMWAccountLib(); if($check_ladmin->socket) { $check_ladmin->close(); if(!self::processForm($request)) { $wikitext = self::showForm(); $output->addWikiText($wikitext); } } else { $wikitext = self::accountsOffline(); $output->addWikiText($wikitext); } } public function processForm($request) { if ($request->getText('register') == "true") { $acc = new TMWAccount(); $acc->setUsername($request->getText('username')); $acc->setPassword1($request->getText('password1')); $acc->setPassword2($request->getText('password2')); $acc->setEMail($request->getText('email')); $acc->setGender('N'); $this->err = $acc->validate(); global $wgCaptchaClass; global $wgCaptchaClass, $wgConfirmAccountCaptchas; if ($wgConfirmAccountCaptchas) { $captcha = new $wgCaptchaClass; if (!$captcha->passCaptcha()) { $this->err[] = "The captcha was incorrect!"; } } if (count($this->err) > 0) { return false; } // create the account if (!$acc->createAccount()) { $this->err[] = "The was an unknown error while creating the account"; return false; } else { self::showSuccess(); return true; } } return false; } public function showForm() { $output = $this->getOutput(); $form = ('

With this form you can register for a new account. We will never give your email to someone else or send you spam! Its only purpose is to be able to send you back whether account creation succeeded.

Security warning: Do not use the same username and password on two different servers. It happened a lot in the past that users of the official server got "hacked" because they ignored this important precaution.

'); $form .= '
'; $form .= ''; foreach($this->err as $message) { $form .= ""; } $form .= '
".$message."
Username:
Password:
Retype password:
EMail:
'; global $wgCaptchaClass, $wgConfirmAccountCaptchas; if ($wgConfirmAccountCaptchas) { $captcha = new $wgCaptchaClass; $form .= $captcha->getForm(); } $form .= '
'; $output->addHTML($form); } public function showSuccess() { $thank_you = "

Your account was created! In a few minutes you should receive an email with verification of your new account.

If the account doesn't work, please ask for help on the Forums or Support (IRC).

"; $output = $this->getOutput(); $output->addHTML($thank_you); } public function accountsOffline() { $output = $this->getOutput(); $offline_msg = "

The Mana World Account service is currently offlineplease ask for help on the Forums or Support (IRC).

"; $output->addHTML($offline_msg); } } ?>