summaryrefslogtreecommitdiff
path: root/extensions/tmwa/backend
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/tmwa/backend')
-rw-r--r--extensions/tmwa/backend/libs/libladmin-db.php34
-rw-r--r--extensions/tmwa/backend/libs/libladmin.php139
-rw-r--r--extensions/tmwa/backend/libs/libtmwauth.php300
-rw-r--r--extensions/tmwa/backend/models/account.php127
-rw-r--r--extensions/tmwa/backend/models/email.php87
-rw-r--r--extensions/tmwa/backend/models/packets.php22
6 files changed, 709 insertions, 0 deletions
diff --git a/extensions/tmwa/backend/libs/libladmin-db.php b/extensions/tmwa/backend/libs/libladmin-db.php
new file mode 100644
index 0000000..2b1ba9b
--- /dev/null
+++ b/extensions/tmwa/backend/libs/libladmin-db.php
@@ -0,0 +1,34 @@
+<?php
+/*
+dbLadmin by wushin AGPL
+*/
+
+class dbLadmin {
+
+ public function __construct() {
+ $this->socket = True;
+ }
+
+ public function account_exists($username) {
+ $dbr = wfGetDB(DB_SLAVE);
+ $res = $dbr->select('tmw_accounts', array('USERNAME'), 'USERNAME = "'.$username.'"', __METHOD__, array());
+ foreach ($res as $row) {
+ return True;
+ }
+ return False;
+ }
+
+ public function create_account($username, $userpass, $sex, $email) {
+ $dbw = wfGetDB(DB_MASTER);
+ $dbw->insert('tmw_accounts', array('USERNAME' => $username, 'PASSWORD' => $userpass, 'GENDER' => $sex, 'EMAIL' => $email), __METHOD__, 'IGNORE');
+ if ( $dbw->affectedRows() ) {
+ return True;
+ } else {
+ return False;
+ }
+ }
+
+ public function close() {
+ return True;
+ }
+}
diff --git a/extensions/tmwa/backend/libs/libladmin.php b/extensions/tmwa/backend/libs/libladmin.php
new file mode 100644
index 0000000..698e898
--- /dev/null
+++ b/extensions/tmwa/backend/libs/libladmin.php
@@ -0,0 +1,139 @@
+<?php
+/*
+phpLadmin by wushin AGPL
+*/
+ob_implicit_flush();
+
+class phpLadmin {
+
+ public function __construct() {
+ global $wgLadminHost,$wgLadminPort,$wgLadminPass;
+ $tmwa = new TMWA();
+ $this->packets = $tmwa->packets;
+
+ $address = gethostbyname($wgLadminHost);
+ $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+ socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 5, 'usec' => 0));
+ socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 5, 'usec' => 0));
+ if ($socket === False) {
+ $this->socket = False;
+ return False;
+ }
+ if(socket_connect($socket, $address, $wgLadminPort)) {
+ $this->socket = $socket;
+ if (self::admin_login()) {
+ return True;
+ }
+ }
+ $this->socket = False;
+ return False;
+ }
+
+ private function ladmin_sendrecv($packet_data) {
+ $packet_send = '';
+ foreach ($this->packets[$packet_data['packet']]['packet'] as $pack_name => $pack_item) {
+ $packet_send .= pack($pack_item, $packet_data[$pack_name]);
+ }
+ socket_write($this->socket, $packet_send);
+ $packet_send = '';
+ socket_recv($this->socket, $packet_pack, 2, MSG_PEEK);
+ $packet_recv = unpack('vpacket/', $packet_pack);
+ socket_recv($this->socket, $packet_pack, $this->packets[$packet_recv['packet']]['len'], MSG_DONTWAIT);
+ $unpack_payload = '';
+ foreach ($this->packets[$packet_recv['packet']]['packet'] as $pack_name => $pack_item) {
+ $unpack_payload .= $pack_item.$pack_name.'/';
+ }
+ $payload_recv = unpack($unpack_payload, $packet_pack);
+ return $payload_recv;
+ }
+
+ private function admin_login() {
+ // Admin Login
+ $login_response = self::ladmin_sendrecv(array('packet' => 0x7918, 'encryption_zero' => 0,'account_pass' => get_cfg_var("tmwa.cfg.LADMIN_PASS")));
+ if($login_response['error'] != 0) {
+ return False;
+ }
+ return self::login_version();
+ }
+
+ private function login_version() {
+ // Login version
+ $packet_data['packet'] = 0x7530;
+ return self::ladmin_sendrecv($packet_data);
+ }
+
+ private function add_account($args) {
+ // Add Account
+ $packet_data['packet'] = 0x7930;
+ $user_check = self::ladmin_sendrecv(array_merge($packet_data, $args));
+ return ($user_check['account_id'] > 0 ? True : False);
+ }
+
+ private function check_password($args) {
+ // Check Password
+ $packet_data['packet'] = 0x793a;
+ $user_check = self::ladmin_sendrecv(array_merge($packet_data, $args));
+ return ($user_check['account_id'] > 0 ? True : False);
+ }
+
+ private function who_account($args) {
+ // Who Account
+ $packet_data['packet'] = 0x7952;
+ return self::ladmin_sendrecv(array_merge($packet_data, $args));
+ }
+
+ private function change_password($args) {
+ // Change Password
+ $packet_data['packet'] = 0x7934;
+ $pass_result = self::ladmin_sendrecv(array_merge($packet_data, $args));
+ return ($pass_result['account_id'] > 0 ? True : False);
+ }
+
+ public function close() {
+ socket_close($this->socket);
+ }
+
+ public function account_info($username) {
+ $args = array('account_name' => $username);
+ $account_info = self::who_account($args);
+ return $account_info;
+ }
+
+ public function account_exists($username) {
+ $args = array('account_name' => $username);
+ $user_name_exists = self::who_account($args);
+ return ($user_name_exists['account_id'] > 0 ? True : False);
+ }
+
+ public function check_auth($username, $userpass) {
+ $args = array('account_name' => $username, 'account_password' => $userpass);
+ return self::check_password($args);
+ }
+
+ public function check_ban($username) {
+ $account_info = self::account_info($username);
+ if ($account_info['state'] > 0) {
+ return True;
+ } elseif ($account_info['ban_until'] > 0) {
+ return True;
+ }
+ return False;
+ }
+
+ public function change_pass($username, $userpass) {
+ $args = array('account_name' => $username, 'account_password' => $userpass);
+ return self::change_password($args);
+ }
+
+ public function reset_password($username, $userpass, $newuserpass) {
+ $args = array('account_name' => $username, 'account_password' => $userpass);
+ $user_check = self::check_password($args);
+ return ($user_check ? self::change_pass($username, $newuserpass) : False);
+ }
+
+ public function create_account($username, $userpass, $sex, $email) {
+ $user_name_exists = self::account_exists($username);
+ $args = array('account_name' => $username, 'account_password' => $userpass, 'sex' => $sex, 'email' => $email);
+ return (!$user_name_exists ? self::add_account($args) : False);
+ }
+}
diff --git a/extensions/tmwa/backend/libs/libtmwauth.php b/extensions/tmwa/backend/libs/libtmwauth.php
new file mode 100644
index 0000000..33a4331
--- /dev/null
+++ b/extensions/tmwa/backend/libs/libtmwauth.php
@@ -0,0 +1,300 @@
+<?php
+/**
+ * Tmw Auth Interface (Requires Ladmin socket) by wushin
+ * Based on mediawiki AuthPlugin
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * http://www.mediawiki.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Authentication plugin interface. Instantiate a subclass of AuthPlugin
+ * and set $wgAuth to it to authenticate against some external tool.
+ *
+ * The default behavior is not to do anything, and use the local user
+ * database for all authentication. A subclass can require that all
+ * accounts authenticate externally, or use it only as a fallback; also
+ * you can transparently create internal wiki accounts the first time
+ * someone logs in who can be authenticated externally.
+ */
+class TMWAuth extends AuthPlugin {
+ /**
+ * Check whether there exists a user account with the given name.
+ * The name will be normalized to MediaWiki's requirements, so
+ * you might need to munge it (for instance, for lowercase initial
+ * letters).
+ *
+ * @param $username String: username.
+ * @return bool
+ */
+ public function userExists( $username ) {
+ global $wgTMWAccountLib;
+ $ladmin = New $wgTMWAccountLib();
+ $user_exists = ($ladmin->check_ban($username, $password) ? False : $ladmin->check_auth($username, $password));
+ $ladmin->close();
+ return $user_exists;
+ }
+
+ /**
+ * Check if a username+password pair is a valid login.
+ * The name will be normalized to MediaWiki's requirements, so
+ * you might need to munge it (for instance, for lowercase initial
+ * letters).
+ *
+ * @param $username String: username.
+ * @param $password String: user password.
+ * @return bool
+ */
+ public function authenticate( $username, $password ) {
+ global $wgTMWAccountLib;
+ $ladmin = New $wgTMWAccountLib();
+ $auth_result = $ladmin->check_auth($username, $password);
+ $ladmin->close();
+ return $auth_result;
+ }
+
+ /**
+ * Modify options in the login template.
+ *
+ * @param $template UserLoginTemplate object.
+ * @param $type String 'signup' or 'login'. Added in 1.16.
+ */
+ public function modifyUITemplate( &$template, &$type ) {
+ $template->set( 'usedomain', False );
+ }
+
+ /**
+ * Set the domain this plugin is supposed to use when authenticating.
+ *
+ * @param $domain String: authentication domain.
+ */
+ public function setDomain( $domain ) {
+ $this->domain = $domain;
+ }
+
+ /**
+ * Check to see if the specific domain is a valid domain.
+ *
+ * @param $domain String: authentication domain.
+ * @return bool
+ */
+ public function validDomain( $domain ) {
+ # Override this!
+ return True;
+ }
+
+ /**
+ * When a user logs in, optionally fill in preferences and such.
+ * For instance, you might pull the email address or real name from the
+ * external user database.
+ *
+ * The User object is passed by reference so it can be modified; don't
+ * forget the & on your function declaration.
+ *
+ * @param $user User object
+ */
+ public function updateUser( &$user ) {
+ # Override this and do something
+ return True;
+ }
+
+ /**
+ * Return True if the wiki should create a new local account automatically
+ * when asked to login a user who doesn't exist locally but does in the
+ * external auth database.
+ *
+ * If you don't automatically create accounts, you must still create
+ * accounts in some way. It's not possible to authenticate without
+ * a local account.
+ *
+ * This is just a question, and shouldn't perform any actions.
+ *
+ * @return Boolean
+ */
+ public function autoCreate() {
+ return True;
+ }
+
+ /**
+ * Allow a property change? Properties are the same as preferences
+ * and use the same keys. 'Realname' 'Emailaddress' and 'Nickname'
+ * all reference this.
+ *
+ * @param $prop string
+ *
+ * @return Boolean
+ */
+ public function allowPropChange( $prop = '' ) {
+ if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) {
+ return $this->allowRealNameChange();
+ } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) {
+ return $this->allowEmailChange();
+ } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) {
+ return $this->allowNickChange();
+ } else {
+ return True;
+ }
+ }
+
+ /**
+ * Can users change their passwords?
+ *
+ * @return bool
+ */
+ public function allowPasswordChange() {
+ return True;
+ }
+
+ /**
+ * Should MediaWiki store passwords in its local database?
+ *
+ * @return bool
+ */
+ public function allowSetLocalPassword() {
+ return True;
+ }
+
+ /**
+ * Set the given password in the authentication database.
+ * As a special case, the password may be set to null to request
+ * locking the password to an unusable value, with the expectation
+ * that it will be set later through a mail reset or other method.
+ *
+ * Return True if successful.
+ *
+ * @param $user User object.
+ * @param $password String: password.
+ * @return bool
+ */
+ public function setPassword( $user, $password ) {
+ global $wgTMWAccountLib;
+ $ladmin = New $wgTMWAccountLib();
+ $set_pass_res = $ladmin->change_pass($user, $password);
+ $ladmin->close();
+ return $set_pass_res;
+ }
+
+ /**
+ * Update user information in the external authentication database.
+ * Return True if successful.
+ *
+ * @param $user User object.
+ * @return Boolean
+ */
+ public function updateExternalDB( $user ) {
+ return False;
+ }
+
+ /**
+ * Check to see if external accounts can be created.
+ * Return True if external accounts can be created.
+ * @return Boolean
+ */
+ public function canCreateAccounts() {
+ return True;
+ }
+
+ /**
+ * Add a user to the external authentication database.
+ * Return True if successful.
+ *
+ * @param $user User: only the name should be assumed valid at this point
+ * @param $password String
+ * @param $email String
+ * @param $realname String
+ * @return Boolean
+ */
+ public function addUser( $user, $password, $email = '', $realname = '' ) {
+ global $wgTMWAccountLib;
+ // Gender is currently hard set
+ $sex = 'M';
+ $ladmin = New $wgTMWAccountLib();
+ $add_user_res = $ladmin->create_account($user, $password, $sex, $email);
+ $ladmin->close();
+ return $add_user_res;
+ }
+
+ /**
+ * Return True to prevent logins that don't authenticate here from being
+ * checked against the local database's password fields.
+ *
+ * This is just a question, and shouldn't perform any actions.
+ *
+ * @return Boolean
+ */
+ public function strict() {
+ return False;
+ }
+
+ /**
+ * Check if a user should authenticate locally if the global authentication fails.
+ * If either this or strict() returns True, local authentication is not used.
+ *
+ * @param $username String: username.
+ * @return Boolean
+ */
+ public function strictUserAuth( $username ) {
+ return False;
+ }
+
+ /**
+ * When creating a user account, optionally fill in preferences and such.
+ * For instance, you might pull the email address or real name from the
+ * external user database.
+ *
+ * The User object is passed by reference so it can be modified; don't
+ * forget the & on your function declaration.
+ *
+ * @param $user User object.
+ * @param $autocreate Boolean: True if user is being autocreated on login
+ */
+ public function initUser( &$user, $autocreate = False ) {
+ # Override this to do something.
+ }
+
+ /**
+ * If you want to munge the case of an account name before the final
+ * check, now is your chance.
+ */
+ public function getCanonicalName( $username ) {
+ return ucwords(strtolower($username));
+ }
+
+ /**
+ * Get an instance of a User object
+ *
+ * @param $user User
+ *
+ * @return AuthPluginUser
+ */
+ public function getUserInstance( User &$user ) {
+ return new AuthPluginUser( $user );
+ }
+
+ /**
+ * Get a list of domains (in HTMLForm options format) used.
+ *
+ * @return array
+ */
+ public function domainList() {
+ return array();
+ }
+}
+?>
diff --git a/extensions/tmwa/backend/models/account.php b/extensions/tmwa/backend/models/account.php
new file mode 100644
index 0000000..7f5b0fe
--- /dev/null
+++ b/extensions/tmwa/backend/models/account.php
@@ -0,0 +1,127 @@
+<?php
+class TMWAccount
+{
+ const GENDER_MALE = 'M';
+ const GENDER_FEMALE = 'F';
+ const BAD_STRING_DESC = 'Only alphanumeric characters are allowed.';
+
+ private $errors;
+ private $ladmin;
+ private $ladmin_result;
+
+ private static function existsUsername($str)
+ {
+ global $wgTMWAccountLib;
+ $ladmin = New $wgTMWAccountLib;
+ $ladmin_result = $ladmin->account_exists($str);
+ $ladmin->close();
+ return $ladmin_result;
+ }
+
+ public function setUsername($name){ $this->username = $name; }
+ public function setPassword1($pwd){ $this->password1 = $pwd; }
+ public function setPassword2($pwd){ $this->password2 = $pwd; }
+ public function setEMail($email){ $this->email = $email; }
+ public function setGender($gender){ $this->gender = $gender; }
+
+ public function validate()
+ {
+ $errors = array();
+
+ // check here for correct values..
+ if (strlen($this->username) < 4) {
+ $errors[] = "Username is too short";
+ }
+
+ if (strlen($this->username) >= 24) {
+ $errors[] = "Username is too long";
+ }
+
+ if (strlen($this->password1) < 4) {
+ $errors[] = "Password is too short";
+ }
+
+ if (strlen($this->password1) >= 24) {
+ $errors[] = "Password is too long";
+ }
+
+ if (strlen($this->email) < 4) {
+ $errors[] = "EMail is too short";
+ }
+
+ if (strlen($this->email) >= 40) {
+ $errors[] = "EMail is too long";
+ }
+
+ if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) {
+ $errors[] = "EMail is not valid";
+ }
+
+ if (!self::check_chars($this->username)) {
+ $errors[] = 'Username contains invalid characters.<br/> '.self::BAD_STRING_DESC;
+ }
+
+ if (!self::check_chars($this->password1)) {
+ $errors[] = 'Password contains invalid characters.<br/> '.self::BAD_STRING_DESC;
+ }
+
+ if ($this->password1 != $this->password2)
+ {
+ $errors[] = "The given passwords don't match!";
+ }
+
+ if ($this->gender != self::GENDER_MALE &&
+ $this->gender != self::GENDER_FEMALE )
+ {
+ $errors[] = 'Gender has to be Male or Female!';
+ }
+
+ if (!filter_var($this->email, FILTER_VALIDATE_EMAIL))
+ {
+ $errors[] = 'EMail has wrong format.';
+ }
+
+ if (self::existsUsername($this->username))
+ {
+ $errors[] = "The username is in use!";
+ }
+
+ if (count($errors) > 0)
+ {
+ return $errors;
+ }
+ return null;
+ }
+
+ public function check_chars($string) {
+ return ctype_alnum($string) && (strpos($string, '"') === FALSE);
+ }
+
+ private function sendEMail() {
+ $email = New TMWMail();
+ $email->mail_to = $this->email;
+ $email->subject = "The Mana World Registration";
+ $data = "== Account Created ==\n";
+ $data .= " Welcome ".$this->username." to The Mana World! Your account should now be enabled. If you have any problems with your login contact The Mana World via the Support (live) or Forums (maybe a delay) for help. Game tips & walkthroughs are available on the Wiki. Our Forums are a great place to ask for advice and discuss possible changes. News is available in the client or on the Home Site.
+ Godspeed Adventurer,
+ The Mana World\n";
+ $email->getEmailTemplate($data);
+
+ return $email->sendEMail();
+ }
+
+ public function createAccount()
+ {
+ global $wgTMWAccountLib;
+ $ladmin = New $wgTMWAccountLib;
+ $ladmin_result = $ladmin->create_account($this->username, $this->password1, $this->gender, $this->email);
+ $ladmin->close();
+ if($ladmin_result) {
+ $this->sendEMail();
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+?>
diff --git a/extensions/tmwa/backend/models/email.php b/extensions/tmwa/backend/models/email.php
new file mode 100644
index 0000000..29f1a1c
--- /dev/null
+++ b/extensions/tmwa/backend/models/email.php
@@ -0,0 +1,87 @@
+<?php
+// Email Template Header
+// Image Mapped for Html Email
+// Base/Default Links
+
+class TMWMail {
+
+ public function __construct() {
+ global $wgTMWAccountEmail;
+ $this->mail_to = '';
+ $this->boundary = uniqid('np');
+ $this->subject = '';
+ $this->headers = "From: Accounts <".$wgTMWAccountEmail.">\r\nReply-To: Accounts <".$wgTMWAccountEmail.">\r\n";
+ $this->message = "";
+ }
+
+ public function sendEMail() {
+ return mail($this->mail_to,$this->subject,$this->message,$this->headers);
+ }
+
+ public function appendheaders($headers) {
+ $this->headers .= $headers;
+ }
+
+ public function appendmessage($message) {
+ $this->message .= $message;
+ }
+
+ public function getEmailTemplate($emailText) {
+ self::appendheaders("MIME-Version: 1.0\r\nContent-type: multipart/alternative;boundary=".$this->boundary."\r\n");
+ $data = "This is a MIME encoded message.";
+
+ $data .= "\r\n\r\n--" . $this->boundary . "\r\n";
+ $data .= "Content-type: text/plain;charset=utf-8\r\n\r\n";
+ $data .= "###############################################################\n";
+ $data .= "# ___________.__ _____ #\n";
+ $data .= "# \__ ___/| |__ ____ / \ ____ ____ ____ #\n";
+ $data .= "# | | | | \_/ __ \ / \ / \ \__ \ / __ \ \__ \ #\n";
+ $data .= "# | | | Y \ ___/ / Y \/ __ \| | \ \/ __ \_ #\n";
+ $data .= "# |____| |___|__/\____> \____|____(______/__| \(______/ #\n";
+ $data .= "# __ __ .__ .___ #\n";
+ $data .= "# / \ / \___________| | __| _/ #\n";
+ $data .= "# \ \/\/ / _ \_ __ \ | / __ | #\n";
+ $data .= "# \ ( <_> ) | \/ |__/ /_/ | #\n";
+ $data .= "# \__/\ / \____/|__| |____/\____ | #\n";
+ $data .= "# \/ \/ #\n";
+ $data .= "# #\n";
+ $data .= "###############################################################\n";
+ $data .= $emailText;
+
+ $data .= "\r\n\r\n--" . $this->boundary . "\r\n";
+ $data .= "Content-type: text/html;charset=utf-8\r\n\r\n";
+
+ $data .= '<html><body>
+ <img id="Image-Maps-Com-image-maps-2014-05-22-121954" src="https://www.themanaworld.org/images/TMW-email-temaplate-mailer.png" border="0" width="640" height="272" orgWidth="640" orgHeight="272" usemap="#image-maps-2014-05-22-121954" alt="" />
+ <map name="image-maps-2014-05-22-121954" id="ImageMapsCom-image-maps-2014-05-22-121954">
+ <area alt="Home Page" title="The Mana World" href="https://www.themanaworld.org/" shape="rect" coords="0,0,197,201" style="outline:none;" target="_self" />
+ <area alt="Home Page" title="The Mana World" href="https://www.themanaworld.org/" shape="rect" coords="197,0,465,168" style="outline:none;" target="_self" />
+ <area alt="Official Client Mana Plus" title="Official Client Mana Plus" href="http://manaplus.org" shape="rect" coords="465,0,640,168" style="outline:none;" target="_self" />
+ <area alt="The Mana World News" title="The Mana World News" href="https://www.themanaworld.org/index.php" shape="rect" coords="196,168,275,201" style="outline:none;" target="_self" />
+ <area alt="The Mana World Wiki" title="The Mana World Wiki" href="https://wiki.themanaworld.org/index.php/Main_Page" shape="rect" coords="274,168,375,201" style="outline:none;" target="_self" />
+ <area alt="The Mana World Forums" title="The Mana World Forums" href="https://forums.themanaworld.org/" shape="rect" coords="372,168,490,201" style="outline:none;" target="_self" />
+ <area alt="The Mana World Support (IRC)" title="The Mana World Support (IRC)" href="https://webchat.freenode.net/?channels=#themanaworld" shape="rect" coords="488,168,640,201" style="outline:none;" target="_self" />
+ <area alt="About The Mana World" title="About The Mana World" href="https://www.themanaworld.org/about.php" shape="rect" coords="0,201,84,272" style="outline:none;" target="_self" />
+ <area alt="Creative Commons" title="Creative Commons" href="http://creativecommons.org/" shape="rect" coords="84,201,121,272" style="outline:none;" target="_self" />
+ <area alt="GNU General Public License" title="GNU General Public License " href="http://www.gnu.org/copyleft/gpl.html" shape="rect" coords="121,201,155,272" style="outline:none;" target="_self" />
+ <area alt="Open Source Initiative" title="Open Source Initiative" href="http://opensource.org/" shape="rect" coords="155,202,189,272" style="outline:none;" target="_self" />
+ <area alt="The Mana World on Facebook" title="The Mana World on Facebook" href="https://www.facebook.com/themanaworld" shape="rect" coords="191,204,308,272" style="outline:none;" target="_self" />
+ <area alt="The Mana World on G+" title="The Mana World on G+" href="https://plus.google.com/+TheManaWorldOrg" shape="rect" coords="310,204,344,272" style="outline:none;" target="_self" />
+ <area alt="The Mana World on Youtube" title="The Mana World on Youtube" href="https://www.youtube.com/user/TheManaWorldOfficial" shape="rect" coords="345,203,379,271" style="outline:none;" target="_self" />
+ <area alt="Official Client Mana Plus" title="Official Client Mana Plus" href="http://manaplus.org" shape="rect" coords="382,203,501,272" style="outline:none;" target="_self" />
+ <area alt="Mac OS Downloads" title="Mac OS Downloads" href="http://download.evolonline.org/manaplus/macosx/" shape="rect" coords="502,203,537,272" style="outline:none;" target="_self" />
+ <area alt="Windows Installer" title="Windows Installer" href="http://manaplus.org/windowsinstaller" shape="rect" coords="537.8000001907349,202.8000030517578,572.8000001907349,271.8000030517578" style="outline:none;" target="_self" />
+ <area alt="Linux Versions" title="Linux Versions" href="http://manaplus.org/" shape="rect" coords="575,203,640,272" style="outline:none;" target="_self" />
+ <area shape="rect" coords="638,270,640,272" alt="Image Map" style="outline:none;" title="Image Map" href="http://www.image-maps.com/index.php?aff=mapped_users_0" />
+ </map><br/>
+ '.nl2br($emailText).'
+ <div style="font-size:10px;">
+ &copy; 2004-2014 The Mana World
+ </div>
+ </body>
+ </html>';
+ $data .= "\r\n\r\n--" . $this->boundary . "--";
+ self::appendmessage($data);
+ }
+}
+?>
diff --git a/extensions/tmwa/backend/models/packets.php b/extensions/tmwa/backend/models/packets.php
new file mode 100644
index 0000000..ae80c1a
--- /dev/null
+++ b/extensions/tmwa/backend/models/packets.php
@@ -0,0 +1,22 @@
+<?php
+// To be dynamically generated eventually from TMWA protocols.py
+class TMWA {
+
+ public function __construct() {
+ $this->packets = array(
+ 0x7918 => array('packet' => array('packet' => 'v','encryption_zero' => 'v','account_pass' => 'a24'), 'len' => '28'),
+ 0x7530 => array('packet' => array('packet' => 'v'), 'len' => '2'),
+ 0x7934 => array('packet' => array('packet' => 'v','account_name' => 'a24','account_password' => 'a24'), 'len' => '50'),
+ 0x7930 => array('packet' => array('packet' => 'v','account_name' => 'a24','account_password' => 'a24', 'sex' => 'a1','email' => 'a40'), 'len' => '91'),
+ 0x793a => array('packet' => array('packet' => 'v','account_name' => 'a24','account_password' => 'a24'), 'len' => '50'),
+ 0x7952 => array('packet' => array('packet' => 'v','account_name' => 'a24'), 'len' => '26'),
+ 0x7919 => array('packet' => array('packet' => 'v','error' => 'C'), 'len' => 3),
+ 0x7531 => array('packet' => array('packet' => 'v','version' => 'C*'), 'len' => 10),
+ 0x7935 => array('packet' => array('packet' => 'v','account_id' => 'V','account_name' => 'a24'), 'len' => 30),
+ 0x7931 => array('packet' => array('packet' => 'v','account_id' => 'V','account_name' => 'a24'), 'len' => 30),
+ 0x793b => array('packet' => array('packet' => 'v','account_id' => 'V','account_name' => 'a24'), 'len' => 30),
+ 0x7953 => array('packet' => array('packet' => 'v','account_id' => 'V','gm_level' => 'C','account_name' => 'a24','sex' => 'C','login_count' => 'V','state' => 'V','error_message' => 'a20','last_login_string' => 'a24','ip_string' => 'a16','email' => 'a40','connect_until' => 'V','ban_until' => 'V','packet' => 'v'), 'len' => 151)
+ );
+ }
+}
+?>