From 1698f993dced9850183ad1f0ced61ec2f266fb1b Mon Sep 17 00:00:00 2001 From: paintballrefjosh Date: Sat, 25 Mar 2017 01:34:24 -0500 Subject: [PATCH] Finalized Admin->Updates page and function Rewrote the entire update system. No longer support updating the php files on the fly due to huge security risk. Created custom updater script which can be used for multiple versions. Changed install & update redirects to happen if directories exist. User should delete these directories when complete. --- README.txt | 98 +-- core/class.update.php | 399 ++---------- core/core.php | 8 +- inc/account/account.login.php | 2 +- inc/account/account.register.php | 4 +- inc/admin/body_header.php | 34 +- inc/admin/script_files/admin.updates.php | 163 ++--- inc/admin/template_files/admin.info.php | 2 +- inc/admin/template_files/admin.updates.php | 58 +- index.php | 24 +- install/index.php | 258 ++++---- install/sql/full_install.sql | 609 ++++++++++-------- install/sql/updates/index.html | 0 install/sql/updates/update_4.0.5.sql | 8 - install/sql/updates/update_4.0.9.sql | 101 --- .../blizzlike/account/account.register.php | 6 +- update/index.php | 66 ++ update/scripts/update_4.0.5.php | 32 + update/scripts/update_4.1.0.php | 297 +++++++++ update/update_list.txt | 3 + 20 files changed, 1027 insertions(+), 1145 deletions(-) delete mode 100644 install/sql/updates/index.html delete mode 100644 install/sql/updates/update_4.0.5.sql delete mode 100644 install/sql/updates/update_4.0.9.sql create mode 100644 update/index.php create mode 100644 update/scripts/update_4.0.5.php create mode 100644 update/scripts/update_4.1.0.php create mode 100644 update/update_list.txt diff --git a/README.txt b/README.txt index 3b9a39e..e1eae93 100644 --- a/README.txt +++ b/README.txt @@ -1,97 +1,7 @@ -// === MangosWeb v3.0.0 Beta 1 README === // +// === MaNGOS Web README === // -Please note that this is just a Beta readme and is not finished! -Also, there are many features in the site that arenent included yet, or that are unfinished -These will be finished by release! +Installation guide - https://github.com/paintballrefjosh/MaNGOSWebV4/wiki/Installation -Oficial support forums: http://keyswow.com/forums/ +Upgrade guide - https://github.com/paintballrefjosh/MaNGOSWebV4/wiki/Upgrading --- 1.1 Full Install -- - - 1.1a Requirements: - - Apache with Mysql & PhP support - - Apache v2.2 or higher - - MySQL 5 or higher - - Php version 5.2.0 or higher - - GD compiled into Php (In windows, enable GD exetension in php.ini file). - - 1.1b Installing The Site - - NOTE: If you used v2 or older, use the "install/sql/delete_v2_tables.sql" before installing v3! - - 1. Make sure all files are in the same folder under you "htdocs" or "www" folder - 2. Enter your site url in your Internet Browswer (Ex: http://yourdomain.com) - 3. You will be automatically redirected to the installer. - 4. Just follow the on screen instructions. - 5. On step 2, if you arent able to use mangosweb, you will see the reason why. - 6. Once completed, you need to edit line 3 of the installer. change "$disabled = FALSE;" to "$disabled = TRUE;" - 7. Go straight to the admin panel! and go to site config. Configure the site :P - 8. Go to Realms next, and for each realm you want users to use, you need to edit that realms DB information - and turn "Site Enabled" from "Disabled" to "Enabled" - - - 1.1c How To Update - 1. Go to your Admin Control Panel and click "Check For Updates" on the last row. - 2. If there are any updates, it will show you a list of files that will be updated. Click "Update MangosWeb" to begin the update process. - 3. The update process is automatic and will end in just a few seconds. Once done click "Return" - 4. Continue the process untill there are no more updates. Its that easy. - - --- 1.2 Upgrading From older versions of MangosWeb -- -As of right now, it is impossible to use your old MangosWeb Enahnced tables. Because of this You will need to do a fresh install of v3. - - --- 2.1 Setting up Remote Access -- - - 1. To setup remote access to your server, you must have it enabled in your server config. Its best to have it look like this: - Console.Enable = 1 - Ra.Enable = 1 - Ra.IP = 0.0.0.0 - Ra.Port = 3443 - Ra.MinLevel = 3 - Ra.Secure = 1 - Ra.Stricted = 0 - - SOAP.Enabled = 1 - SOAP.IP = 0.0.0.0 - SOAP.Port = 7878 - 2. Next you need to create an account to be the remote access "bot" account. I found that with mangos especially, you need - to create this account either A) Through the server console B) Through the site, then going into the DB and uppercasing - the whole username... EX: test -> TEST. - 3. Go into the ACP -> Realms -> your realm name. Scroll down to the bottom where it says "Remote Access" - 4. Enter your information. the account name DOES NOT need to be in caps :) - --- 3.1 Setting the Donation System -- - - 1. If you dont already, create a premier paypal account. (It's free) - 2. From the PayPal menu, go to Profile > More Options > Under selling Preferences > Instant Payment Notification Preferences. - 3. Select Instant notification
- 4. Enter the full path including your domain name to ipn.php in the root of your - MaNGOS directory.
- Example: http://you-domain-or-ip/ipn.php - 5. In the ACP -> Site Config. Make sure you have the paypal email address set! - 6. To test using sandbox: - A) open 'ipn.php' and edit line 21: "$Paypal->testMode(FALSE);" set the FALSE to TRUE. - B) Go to https://developer.paypal.com and create a developer account - C) click "Simulate Instant Payment Notification" - D) Click "eCheck Complete" and then Enter some random information and hit send - E) You should get confirmation that the data was sent - F) Check you DB "mw_donate_transactions" and you should see your test IPN there. If not then check the IPN Log - "core/logs/ipn.txt" - NOTE: Paypal sandbox has been really buggy lately. But i have tested the donation system myself over and over - since re-writting it with no errors at all ;) - --- 4.1 Setting up Forum Bridges -- - - 1. In v3, I have included some php classes (Not written by me, credits are in the php class files themselves), that - will create forum accounts when a user logs into the site. If the account exists it will log the user in the forums - as well. Please note that i was only able to test the PHPBB3 bridge as i donot have vbulletin. But the vbulletin one should - work just fine. - 2. Go to your ACP -> Site Config. In the sub nav click "Forum Integration Settings" - 3. You can only have ONE bridge enabled at a time! - 4. For the forum path, you must enter the the PATH, not the url! If the forum is NOT in the same htdocs or www folder as MangosWeb, - then the bridge will not work! - 5. To test if the bridge works, logout and try to log back in the site. If a white screen displays, or there is an error, - Then chances are your path is wrong. Dont worry, you will still be logged in the site, but not in the forums - 6. I Cant gaurenty results on the vBulletin bridge until users like yourself test it out. The PHPBB3 bridge has been tested and works. \ No newline at end of file +Please report any bugs to the issue tracker - https://github.com/paintballrefjosh/MaNGOSWebV4/issues diff --git a/core/class.update.php b/core/class.update.php index 4ff392a..ba4afd4 100644 --- a/core/class.update.php +++ b/core/class.update.php @@ -10,22 +10,16 @@ class Update { - var $current_version; - var $server_version; - var $update_version; - var $updated_files_list = array(); - var $update_delete = array(); - var $update_make_dir = array(); - var $update_remove_dir = array(); - var $writable_files; - var $charlen_file; - var $updates; + private $local_version; + public $latest_version; + public $next_db_version; + private $server_address; + private $update_list; - function Update() + function __construct(Core $Core) { - global $Core; - $this->server_address = 'http://update.keyswow.com/mangoswebv3/'; - $this->current_version = $Core->version; + $this->server_address = 'https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/'; + $this->local_version = $Core->version; $this->handle = FALSE; } @@ -34,9 +28,10 @@ function Update() function connect() { - $this->handle = @fsockopen('www.keyswow.com', 80, $errno, $errstr, 5); - if($this->handle) + $this->handle = @fsockopen('raw.githubusercontent.com', 443, $errno, $errstr, 5); + if(is_resource($this->handle)) { + fclose($this->handle); return TRUE; } else @@ -46,376 +41,80 @@ function connect() } // ************************************************************ -// This function should always be used FIRST! checks to see if server is online, +// This function should always be used FIRST! checks to see if server is online, // and if there's updates function check_for_updates() { $connection = $this->connect(); - if($connection == TRUE) + if($connection) { - $this->updates = file_get_contents("". $this->server_address ."updates.txt"); - $ups = explode(",", $this->updates ); - $this->newest = $ups['0']; - if($this->current_version != $this->newest) + //$this->server_version = file_get_contents($this->server_address . "core/core.php"); + //preg_match('/\$version = \'(.*)\';/i', $this->server_version, $ups); + + // update file should be in the following format: + // code_ver,db_ver + if(file_exists("update_list.txt")) { - return 1; + // check if local list file exists, this is only used when the update/ directory exists + $this->update_list = file("update_list.txt"); } - else + elseif(file_exists("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/update_list.txt")) { - return 2; + // check if GitHub list file exists + $this->update_list = file("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/update_list.txt"); } - } - else - { - return 0; - } - } -// ************************************************************ -// If there is updates, then this function returns the next update version number. + $this->latest_version = preg_replace("~[\r\n]+~", "", explode(",", $this->update_list[0])[0]); + $this->get_next_db_update(); - function get_next_update() - { - $ups = explode(",", $this->updates ); - - // Ok, so we need the next update, but first we need to find, where in the array is out current version - foreach($ups as $key => $value) - { - if($value == $this->current_version) + if((string)$this->local_version != (string)$this->latest_version) { - $tmp_version = $key; - // Now that we have our postion, we subtract 1, to get the next update version - $newkey = $tmp_version - 1; - } - } - $this->update_version = $ups[$newkey]; - $this->get_server_variables(); - return $this->update_version; - } - -// ************************************************************ -// This function get the list of all update variables such as -// make dir, remove file, update file etc etc. - - function get_server_variables() - { - $variables_file_address = $this->server_address."update_". (string)$this->update_version ."/update_vars.php"; - $file = file($variables_file_address); - foreach ($file as $line) - { - if(strstr($line,"[update_version]") !== false) - { - $this->server_version = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[update_info]") !== false) - { - $this->update_info[] = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[update_make_dir]") !== false) - { - $this->update_make_dir[] = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[update_remove_dir]") !== false) - { - $this->update_remove_dir[] = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[update_delete]") !== false) - { - $this->update_delete[] = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[update_file_list]") !== false) - { - $this->updated_files_list[] = trim(substr($line,strpos($line,"=")+1)); - } - elseif(strstr($line,"[charlen_file]") !== false) - { - $this->charlen_file[] = trim(substr($line,strpos($line,"=")+1)); + // there is an update available + return 1; } - } - } - -// ************************************************************ -// Prints updated file list - - function print_updated_files_list() - { - $filelist = ""; - foreach ($this->updated_files_list as $filename) - { - $filelist .= $filename."
"; - } - return $filelist; - } - -// ************************************************************ -// Prints Delete File list - - function print_delete_files_list() - { - $filelist = ""; - if(count($this->update_delete) > 0) - { - foreach($this->update_delete as $filename) + else { - $filelist .= $filename."
"; + // no updates are available + return 2; } } else { - echo "None"; - } - return $filelist; - } - -// ************************************************************ -// Prints the Update information info - - function print_update_info() - { - $infolist = ""; - foreach ($this->update_info as $desc) - { - $infolist .= $desc."
"; - } - return $infolist; - } - -// ************************************************************ -// This function checks to see if a file is writable - - private function is__writable($path) - { - //Make sure to use a "/" after trailing folders - if ($path{strlen($path)-1} == '/') // recursively return a temporary file path - { - return is__writable($path.uniqid(mt_rand()).'.tmp'); - } - else if (is_dir($path)) - { - return is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); - } - // check tmp file for read/write capabilities - $rm = file_exists($path); - $f = @fopen($path, 'a'); - if ($f == false) - { - return FALSE; - } - fclose($f); - if (!$rm) - { - unlink($path); + // could not connect to update server + return 0; } - return TRUE; } // ************************************************************ -// Checks if the all the files in the update are writable +// If there is updates, then this function returns the next update version number. - function check_if_are_writable() + function get_next_db_update() { - $err = 0; - foreach ($this->updated_files_list as $filename) - { - if($this->is__writable($filename) == TRUE) - { - $this->writable_files[$filename] = "yes"; - } - else - { - $this->writable_files[$filename] = "no"; - $err++; - } - } - if($err == 0) - { - $return = TRUE; - } - else - { - $return = FALSE; - } - return $return; - } + global $DB; -// ************************************************************ -// Gets the total character length of all updated files -// Can be used for like a progress bar + $newkey = -1; + $db_act_ver = $DB->selectCell("SELECT `dbver` FROM `mw_db_version` ORDER BY `dbdate` DESC LIMIT 0,1"); - function get_total_charlen() - { - $total_len = 0; - foreach($this->charlen_file as $len) + // update_list.txt lists the updates in descending order (latest, or greatest, code version first) + foreach($this->update_list as $key => $value) { - $total_len += $len; - } - return $total_len; - } - -// ************************************************************ -// Makes all the directories from the update list - - function makeDirs() - { - $mkerr = 0; - $count = count($this->update_make_dir); - if($count > 0) - { - foreach($this->update_make_dir as $mkdir) - { - // First check to see if the directory already exists - $check = @opendir($mkdir); - if($check) - { - @closedir($check); - } - else - { - // We need to make the directory - $make = @mkdir($mkdir, 0775); - if(!$make) - { - $mkerr++; - } - } - } - if($mkerr == 0) + if(preg_replace("~[\r\n]+~", "", explode(",", $value)[1]) == $db_act_ver) { - return TRUE; - } - else - { - return FALSE; + // Now that we have our postion, we subtract 1, to get the next update version + $newkey = $key - 1; + break; } } - else - { - return TRUE; - } - } - -// ************************************************************ -// Removes all the directories from the update list - function removeDirs() - { - $rmerr = 0; - $count = count($this->update_remove_dir); - if($count > 0) + if($newkey == -1) { - foreach($this->update_remove_dir as $remove) - { - // First check to see if the directory already exists - $check = @opendir($remove); - if($check) - { - @closedir($check); - } - else - { - return FALSE; - } - - // We need to revmove the directory - $rm = @rmdir($remove); - if(!$rm) - { - $rmerr++; - } - } - if($rmerr == 0) - { - return TRUE; - } - else - { - return FALSE; - } + return null; } else { - return TRUE; - } - } - -// ************************************************************ -// Main update function - - function update_files() - { - $err = ""; - - // Delete files - if(count($this->update_delete) > 0) - { - foreach($this->update_delete as $unlinkf) - { - $unlink = @unlink($unlinkf); - if(!$unlink) - { - echo $filename." Problem Removing File!
"; - } - else - { - echo $filename." Removed Successfully!
"; - } - } - } - - if($this->check_if_are_writable() == TRUE) - { - $i = 0; - $len_till_now = 0; - - // Update Files Loop - foreach($this->updated_files_list as $filename) - { - // Start by replacing .php to .upd, and using file_get_contents - $updated_file_url = $this->server_address."/update_".$this->update_version."/".str_replace(".php",".upd",$filename); - $updated_file_contents = file_get_contents($updated_file_url); - - // As long as the file isnt empty, lets use fopen, and fwrite to put the contents in the file. - if($updated_file_contents != "") - { - $file = fopen($filename,"w"); - fwrite($file, $updated_file_contents); - fclose($file); - } - - // next 2 lines can be used for a future progress bar. Calculates the total - // character length of all update files, and turns that into a percentage - $len_till_now += $this->charlen_file[$i]; - $perc = $len_till_now * 100 / $this->get_total_charlen(); - - echo $filename." Updated Successfully!
"; - ob_flush(); - flush(); - $i++; - } - - // These next few lines are for the server to get statistics. The update server will log your servers - // Address so we can get a good count on how many users are using mangosweb, and how many are updating - $open_add = $this->server_address ."index.php?server=".$_SERVER['HTTP_HOST']."&update=".$this->update_version; - $calc = @fopen($open_add, 'r'); - if($calc) - { - @fclose($calc); - } - return TRUE; - } - else - { - $err .= "An error occured while updating. Some files where not writable by the server!"; - foreach ($this->writable_files as $id => $value) - { - if($value == "no") - { - echo $id." file is not writable!
"; - } - } - $err .= "No file(s) were updated.
"; - return $err; + $this->next_db_version = preg_replace("~[\r\n]+~", "", explode(",", $this->update_list[$newkey])[1]); + return $this->next_db_version; } } } diff --git a/core/core.php b/core/core.php index 551a67c..e1abc6b 100644 --- a/core/core.php +++ b/core/core.php @@ -10,9 +10,9 @@ class Core { - public $version = '4.0.9'; - public $version_date = '2017-02-05, 22:16'; - public $exp_dbversion = '4.0.9'; + public $version = '4.1.0'; + public $version_date = '2017-03-16, 23:23'; + public $db_version = '4.1.0'; private $conf; public function __construct(array $conf) @@ -29,7 +29,7 @@ public function __construct(array $conf) //************************************************************** private function Initialize() { - $this->copyright = 'Powered by MangosWeb version ' . $this->version . ' © 2017, Mistvale Dev Team. All Rights Reserved.'; + $this->copyright = 'Powered by MaNGOS Web Enhanced version ' . $this->version . ' © 2017, Mistvale Dev Team. All Rights Reserved.'; // Fill in the config with the proper directory info if the directory info is wrong define('SITE_DIR', dirname( $_SERVER['PHP_SELF'] ).'/'); diff --git a/inc/account/account.login.php b/inc/account/account.login.php index 023a74d..8fec784 100644 --- a/inc/account/account.login.php +++ b/inc/account/account.login.php @@ -33,7 +33,7 @@ // If account login was successful if($Login == 1) - { + { // Make sure account exists in mw_account_extend table, if not then insert one of type "member" aka registered user $mw_account = $DB->selectCell("SELECT account_id FROM mw_account_extend WHERE account_id = '".$account_id."'"); if(!$mw_account) diff --git a/inc/account/account.register.php b/inc/account/account.register.php index a34f231..007dae4 100644 --- a/inc/account/account.register.php +++ b/inc/account/account.register.php @@ -56,10 +56,10 @@ // ************************************************************ // If users are limited to how many accounts per IP, we find out how many this IP has. -if($mwe_config['max_act_per_ip') > 0) +if($mwe_config['max_act_per_ip'] > 0) { $count_ip = $DB->count("SELECT account_id FROM mw_account_extend WHERE registration_ip='".$_SERVER['REMOTE_ADDR']."'"); - if($count_ip >= (int)$mwe_config['max_act_per_ip')) + if($count_ip >= (int)$mwe_config['max_act_per_ip']) { $allow_reg = FALSE; $err_array[] = $lang['register_acct_limit']; diff --git a/inc/admin/body_header.php b/inc/admin/body_header.php index a15f551..88d87ef 100644 --- a/inc/admin/body_header.php +++ b/inc/admin/body_header.php @@ -56,22 +56,26 @@

- : version; ?> -     |     + : version; ?> +     |     : selectCell("SELECT `dbver` FROM `mw_db_version` ORDER BY `dbdate` DESC LIMIT 0,1"); - if($db_act_ver < $Core->exp_dbversion) - { - echo "".$db_act_ver." ( 'db')) ."' />Needs Updated)"; - } - elseif($db_act_ver > $Core->exp_dbversion) - { - echo "".$db_act_ver." (Database outdates the core!)"; - } - else - { - echo $db_act_ver; - } ?> + $db_act_ver = $DB->selectCell("SELECT `dbver` FROM `mw_db_version` ORDER BY `dbdate` DESC LIMIT 0,1"); + if($db_act_ver < $Core->db_version) + { +?> + (Update Required) + $Core->db_version) + { +?> + (Database ahead of the core!) +
diff --git a/inc/admin/script_files/admin.updates.php b/inc/admin/script_files/admin.updates.php index a74b4bc..1d929da 100644 --- a/inc/admin/script_files/admin.updates.php +++ b/inc/admin/script_files/admin.updates.php @@ -15,149 +15,78 @@ //=======================// include('core/class.update.php'); -$Update = new Update; +$Update = new Update($Core); +$Check = $Update->check_for_updates(); // Here we check for updates, and get the list of files for that update. -function checkUpdates() +function checkCoreUpdates() { - global $Update, $Core; - $Check = $Update->check_for_updates(); + global $Update, $Core, $Check; + if($Check == 1) { - echo "
Updates found! New verision: ".$Update->get_next_update()."
"; - echo "
Update Info:
"; - echo $Update->print_update_info()."
"; - echo "
Update / Add File list:
"; - echo $Update->print_updated_files_list(); - echo "
File Remove list:
"; - echo $Update->print_delete_files_list(); - echo "
-
- To find out more about this update, click here. Updates can sometimes take up to 30 seconds depending - on server load. Also note that these updates are incremental and you should re-check for updates after this update."; - echo "
"; - echo ""; - echo "

-
-
-
- "; +?> + There are updates available!

+ Local Version: version; ?>

+ Latest Version: latest_version; ?>
+ +There are no new updates. Your version ". $Core->version ." is up to date."; +?> + There are no core updates. Your version version; ?> is up to date. +
Cant Connect to update server. The server may be too busy, Try and refresh your page. If the problem persists, - Please check here for any news pretaining to this error
"; +?> +
Cant Connect to update server. The server may be too busy, Try and refresh your page. If the problem persists, + please check here for any news related to this error.
+check_for_updates() == 1) - { - $Update->get_next_update(); - echo "
1. Building file list:
"; - ob_flush(); - flush(); - - // If making new file directories fails, then end right now - // Directories must be made before attempting to add / edit files! - if($Update->makeDirs() != TRUE) - { - output_message('error', 'Could not create the required directories for update files!'); - return FALSE; - } - - // Echo the update list of files - echo "
Added / Updated Files:
"; - echo $Update->print_updated_files_list(); - ob_flush(); - flush(); + global $DB, $Core; + $db_act_ver = $DB->selectCell("SELECT `dbver` FROM `mw_db_version` ORDER BY `dbdate` DESC LIMIT 0,1"); - echo "
Remove Files:
"; - echo $Update->print_delete_files_list(); - ob_flush(); - flush(); - - echo "

2. Checking for write permissions:
"; - ob_flush(); - flush(); - - // Check if all files are writable by the server, and list - // the results from each file - if($Update->check_if_are_writable() == TRUE) - { - echo "All files are writable!
"; - ob_flush(); - flush(); - - echo "
3. Starting to update files...
Updating...
"; - ob_flush(); - flush(); - - // Update the files - $gogogo = $Update->update_files(); - if($gogogo == TRUE) - { - echo "

All the files where succesfuly updated.

"; - echo ""; - echo " -
-
-
- "; - ob_flush(); - flush(); - } - else - { - echo "
Some errors ocured while updating the files. Please inform Wilson212 @ http://keyswow.com/forum/ - ... Along with a picture of your screen
"; - ob_flush(); - flush(); - } - } - else - { - echo "Some files are not writable! Listing un-writable files...
"; - foreach ($Update->writable_files as $file => $value) - { - if($value == 'no') - { - $e_val = "Not Writable!"; - } - echo $file." = ".$e_val."
"; - ob_flush(); - flush(); - } - } - } - else + if((string)$db_act_ver != (string)$Core->db_version) + { +?> + There is a database update required!

+ Local Version:

+ Expected Version: db_version; ?>

+
+

+No update neccesary.
"; - ob_flush(); - flush(); +?> + There are no database updates. Your version db_version; ?> is up to date. +exp_dbversion .'.sql')) + global $Core, $DB, $Update; + + if(file_exists("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/install/sql/updates/update_" . $Update->next_db_version . ".sql")) { - $DB->runSQL('install/sql/updates/update_'. $Core->exp_dbversion .'.sql'); - output_message('success', 'Database Successfully Updated'); + // check for online copy if no local copy exists of the SQL script + $DB->runSQL("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/install/sql/updates/update_" . $Update->next_db_version . ".sql"); + output_message("success", "Database Successfully Updated"); + redirect("?p=admin&sub=updates"); } else { - output_message('error' , 'Update SQL File not found!'); + output_message("error" , "SQL update file not found!"); } } ?> \ No newline at end of file diff --git a/inc/admin/template_files/admin.info.php b/inc/admin/template_files/admin.info.php index f20f6cd..1f95922 100644 --- a/inc/admin/template_files/admin.info.php +++ b/inc/admin/template_files/admin.info.php @@ -25,7 +25,7 @@ Core Expected Database Version: - exp_dbversion; ?> + db_version; ?> MangosWeb Database Version: diff --git a/inc/admin/template_files/admin.updates.php b/inc/admin/template_files/admin.updates.php index f123767..1ee7115 100644 --- a/inc/admin/template_files/admin.updates.php +++ b/inc/admin/template_files/admin.updates.php @@ -12,39 +12,47 @@

Main Menu / Updates

-
+
+ + + + + +
Core Update Info
+
+ + + + +
+

+ - +
Update Info
Database Update Info

- +
diff --git a/index.php b/index.php index dbd0b04..cdeca8c 100644 --- a/index.php +++ b/index.php @@ -16,6 +16,17 @@ ini_set('html_errors', FALSE); ini_set('display_errors', TRUE); +if(file_exists("install/index.php")) +{ + // Check if the install/ directorcy exists, redirect if so + header("location: install/"); +} +elseif(file_exists("update/index.php")) +{ + // Check if the update/ directorcy exists, redirect if so + header("location: update/"); +} + /*************************************************************** * Define INCLUDED so we can see if pages are included by this one ***************************************************************/ @@ -35,7 +46,7 @@ /*************************************************************** * Setup the Database class and Database connections ***************************************************************/ -require ('core/class.database.php'); +require('core/class.database.php'); $DB = new Database( $dbconf['db_host'], $dbconf['db_port'], @@ -47,11 +58,10 @@ // Check the database status. 0 = cannot connect, 1 = success, 2 = DB doesnt exist if($DB->status() != 1) { - echo "Cannot connect to the MaNGOS Web database. Please make sure you have run the installer to properly set the DB info in the database.
"; + echo "Cannot connect to the MaNGOS Web database. Please make sure you have edited the config/config-protected.php file with the correct values.
"; die(); } -$mwe_config = array(); $mwe_config = $DB->selectRow("SELECT * FROM mw_config LIMIT 1"); /*************************************************************** @@ -69,14 +79,6 @@ exit(); } -/*************************************************************** - * See if the site is installed by checking config defualts - ***************************************************************/ -if($dbconf['db_username'] == 'default') -{ - header('location: install/'); -} - /*************************************************************** * Include the site functions and classes ***************************************************************/ diff --git a/install/index.php b/install/index.php index 90df31d..a1d0564 100644 --- a/install/index.php +++ b/install/index.php @@ -19,7 +19,7 @@ function output_message($type, $text) - MangosWeb Enhanced v3 Installer + MaNGOS Web Enhanced V4 Installer @@ -48,8 +48,8 @@ function output_message($type, $text)

- Welcome to the MangosWeb v3 Installer!. Before we start the installation proccess, we need to make sure your - web server is compatible with MangosWeb. Please click the start at the bottom to begin. + Welcome to the MaNGOS Web V4 Installer!. Before we start the installation proccess, we need to make sure your + web server is compatible with MaNGOS Web. Please click the start at the bottom to begin.

@@ -108,7 +108,7 @@ function output_message($type, $text) } else { - echo "
Sorry, You Cannot Go To Step 3.
"; + echo "
Sorry, You cannot Go To Step 3.
"; } ?>
@@ -118,44 +118,44 @@ function output_message($type, $text) + { + ?>
- + -

Enter you database host.

+

Enter the realm database host.

- + -

Enter the port number of your database.

+

Enter the realm port number of the database.

- - -

Enter you database username.

+ + +

Enter the realm database username.

- - -

Enter you database Password.

+ + +

Enter the realm database Password.

- + -

Enter your Realm database.

+

Enter the realm database name.


-
@@ -164,102 +164,42 @@ function output_message($type, $text) } elseif($step == 4) { - // Check if everything is given - if (!$_POST['db_host'] | !$_POST['db_port'] | !$_POST['db_username'] | !$_POST['db_password'] | !$_POST['db_name']) - { - echo '
One or more fields are blank. Please Go Back and correct it.
'; - die(); - } - // Check if provided info is correct - $link = @mysqli_connect($_POST['db_host'], $_POST['db_username'], $_POST['db_password'], $_POST['db_name'], $_POST['db_port']) - or die('
Couldn\'t connect to MySQL Database. Please Go Back and re-enter MySQL Database Information.

MySql error log:
+ // Check database connection + include("../config/config-protected.php"); + $link = @mysqli_connect($dbconf['db_host'], $dbconf['db_username'], $dbconf['db_password'], $dbconf['db_name'], $dbconf['db_port']) + or die('
Couldn\'t connect to MySQL Database. Please edit config/config-protected.php with the correct info.

MySql error log:
'.mysqli_connect_error().'Counld Not select Realm database! Please go back and re-submit realm DB information.
'); - output_message('success', 'Successfully Connected to Realm DB.'); + output_message('success', 'Successfully Connected to the MaNGOS Web DB.'); - // Check if "account" table exsists, so we make (almost) sure mangos is actually installed (which is necesarry for this whole thing to work) - @mysqli_query($link, "SELECT * FROM `account` LIMIT 1") or die('
Error!

Account table not found! Cannot Continue with the installation without an Account - table!

MySql error log:
'.mysqli_error().'
'); - - // Everthing should be fine, so first insert info into protected config file - $conffile = "../config/config-protected.php"; - $build = ''; - $build .= " '".$_POST['db_host']."',\n"; - $build .= "'db_port' => '".$_POST['db_port']."',\n"; - $build .= "'db_username' => '".$_POST['db_username']."',\n"; - $build .= "'db_password' => '".$_POST['db_password']."',\n"; - $build .= "'db_name' => '".$_POST['db_name']."',\n"; - $build .= "'db_encoding' => 'utf8',\n"; - $build .= ");\n"; - $build .= "?>"; + $realm_link = @mysqli_connect($_POST['db_host'], $_POST['db_username'], $_POST['db_password'], $_POST['db_name'], $_POST['db_port']) + or die('
Couldn\'t connect to MySQL Database. Please edit config/config-protected.php with the correct info.

MySql error log:
+ '.mysqli_connect_error().'Go back, and try again.'); - die(); - } - + + // Check if "account" table exsists, so we make (almost) sure mangos is actually installed (which is necesarry for this whole thing to work) + @mysqli_query($realm_link, "SELECT * FROM `account` LIMIT 1") or die('
Error!

Account table not found! Cannot continue with the installation without an Account + table! Ensure your MaNGOS database is installed properly.

MySql error log:
'.mysqli_error().'
'); + // Preparing for sql injection... (prashing, etc...) $checker = @mysqli_query($link, "SELECT * FROM `account_extend` LIMIT 1"); - if(!isset($_POST['skip'])) - { - // Dealing with the full install sql file - $sqlopen = @fopen("sql/full_install.sql", "r"); - if ($sqlopen) - { - while (!feof($sqlopen)) - { - $queries[] = fgets($sqlopen); - } - fclose($sqlopen); - } - else - { - output_message('error', 'Couldn\'t open file full_install.sql. Check if it\'s presented in wwwroot/sql/ and if it\'s readable by webserver!'); - $errmsg = error_get_last(); - echo "

PHP error log:
".$errmsg['message']; - exit(); - } - foreach ($queries as $key => $aquery) - { - if (trim($aquery) == "" || strpos ($aquery, "--") === 0 || strpos ($aquery, "#") === 0) - { - unset($queries[$key]); - } - } - unset($key, $aquery); - - foreach ($queries as $key => $aquery) - { - $aquery = rtrim($aquery); - $compare = rtrim($aquery, ";"); - if ($compare != $aquery) - { - $queries[$key] = $compare . "|br3ak|"; - } - } - unset($key, $aquery); - $queries = implode($queries); - $queries = explode("|br3ak|", $queries); + if(!file_exists("sql/full_install.sql")) + { + output_message('error', "Couldn't open file full_install.sql. Check if it's presented in sql/ and if it's readable by webserver!"); + $errmsg = error_get_last(); + die("

PHP error log:
".$errmsg['message']); + } - // Sql injection - foreach ($queries as $query) - { - mysqli_query($link, $query); - } + $sql = file_get_contents("sql/full_install.sql"); + if(!mysqli_multi_query($link, $sql)) + { + die('
Error!

Could not run the sql/full_install.sql file.

MySql error log:
'.mysqli_error().'
'); } - $get_name = mysqli_query($link, "SELECT `name` FROM `realmlist` WHERE `id`=1 LIMIT 1") or die('
'.mysqli_error().'
'); + + $get_name = mysqli_query($realm_link, "SELECT `name` FROM `realmlist` WHERE `id`=1 LIMIT 1") or die('
'.mysqli_error().'
'); $DB_name = mysqli_fetch_assoc($get_name); ?> @@ -271,8 +211,8 @@ function output_message($type, $text)
- In order for MangosWeb Enhanced to function properly, we need at least 1 realm to have its information stored in the DB correctly. - Please fill out the information for the realm "" + In order for MaNGOS Web to function properly, we need at least 1 realm to have its information stored in the DB correctly. + Please fill out the information for the realm ""
@@ -284,33 +224,33 @@ function output_message($type, $text)
- + -

Enter you database host.

+

Enter the character database host.

- +

Enter the port number of your database.

- - -

Enter you database username.

+ + +

Enter the character database username.

- - -

Enter you database Password.

+ + +

Enter the character database Password.

- + -

Enter your Character DB name, for your realm id #1.

+

Enter the Character DB name.

@@ -323,33 +263,33 @@ function output_message($type, $text)
- + -

Enter you database host.

+

Enter the world database host.

- + -

Enter the port number of your database.

+

Enter the port number of the world database.

- - -

Enter you database username.

+ + +

Enter the World database username.

- - -

Enter you database Password.

+ + +

Enter the world database Password.

- + -

Enter your World DB name, for your realm id #1.

+

Enter the World DB name.

@@ -367,20 +307,33 @@ function output_message($type, $text) { $char_link = @mysqli_connect($_POST['char_db_host'], $_POST['char_db_username'], $_POST['char_db_password'], $_POST['char_db_name'], $_POST['char_db_port']) or die('
Couldn\'t connect to the character MySQL Database. Please Go Back and re-enter MySQL Database Information.
'); - @mysqli_select_db($char_link, $_POST['char_db_name']) or die('
Couldn\'t select Characters db, most likely the given name is wrong. Please Go Back and correct it.
'); $world_link = @mysqli_connect($_POST['w_db_host'], $_POST['w_db_username'], $_POST['w_db_password'], $_POST['w_db_name'], $_POST['w_db_port']) or die('
Couldn\'t connect to the world MySQL Database. Please Go Back and re-enter MySQL Database Information.
'); - @mysqli_select_db($world_link, $_POST['w_db_name']) or die('
Couldn\'t select World db, most likely the given name is wrong. Please Go Back and correct it.
'); $realm_link = @mysqli_connect($_POST['db_host'], $_POST['db_username'], $_POST['db_password'], $_POST['db_name'], $_POST['db_port']); - @mysqli_select_db($realm_link, $_POST['db_name']) or die('Unable to select Realm Database!'); - // Extra sql query with db settings - $dbinfo = $_POST['char_db_host'].";".$_POST['char_db_port'].";".$_POST['char_db_username'].";".$_POST['char_db_password'].";".$_POST['char_db_name'].";".$_POST['w_db_host'].";".$_POST['w_db_port'].";".$_POST['w_db_username'].";".$_POST['w_db_password'].";".$_POST['w_db_name'].";"; - mysqli_query($realm_link, "UPDATE `realmlist` SET `dbinfo` = '".$dbinfo."', `site_enabled`=1 WHERE `id` = 1 LIMIT 1") or die('
'.mysqli_error($realm_link).'
'); + include("../config/config-protected.php"); + $link = @mysqli_connect($dbconf['db_host'], $dbconf['db_username'], $dbconf['db_password'], $dbconf['db_name'], $dbconf['db_port']); + + $sql = "INSERT INTO `mw_realm` SET + realm_id = 1, + site_enabled = 1, + db_world_host = '".$_POST['w_db_host']."', + db_world_port = '".$_POST['w_db_port']."', + db_world_name = '".$_POST['w_db_name']."', + db_world_user = '".$_POST['w_db_username']."', + db_world_pass = '".$_POST['w_db_password']."', + db_char_host = '".$_POST['char_db_host']."', + db_char_port = '".$_POST['char_db_port']."', + db_char_name = '".$_POST['char_db_name']."', + db_char_user = '".$_POST['char_db_username']."', + db_char_pass = '".$_POST['char_db_password']."' + "; + + mysqli_query($link, $sql) or die('
'.mysqli_error($link).'
'); - output_message('success', 'Successfully Connected to Character and World DB\'s'); + output_message('success', 'Successfully saved Character and World DB info.'); ?> @@ -436,17 +389,28 @@ function sha_password($user, $pass) return SHA1($user.':'.$pass); } $realm_link = mysqli_connect($_POST['db_host'], $_POST['db_username'], $_POST['db_password'], $_POST['db_name'], $_POST['db_port']); - mysqli_select_db($realm_link, $_POST['db_name']); - - $accountid = mysqli_query($realm_link, "SELECT `id` FROM `account` WHERE `username` LIKE '".$_POST['account']."'"); + + include("../config/config-protected.php"); + $link = mysqli_connect($dbconf['db_host'], $dbconf['db_username'], $dbconf['db_password'], $dbconf['db_name'], $dbconf['db_port']); + + $sql = "UPDATE `mw_config` SET + `db_logon_host` = '".$_POST['db_host']."', + `db_logon_port` = '".$_POST['db_port']."', + `db_logon_name` = '".$_POST['db_name']."', + `db_logon_user` = '".$_POST['db_username']."', + `db_logon_pass` = '".$_POST['db_password']."' + "; + mysqli_query($link, $sql); + + $accountid = mysqli_query($realm_link, "SELECT `id` FROM `account` WHERE `username` = '".$_POST['account']."'"); $checkacc = mysqli_num_rows($accountid); if ($checkacc == 1) { // Account exsist - $accountid = mysqli_fetch_assoc($accountid); - mysqli_query($realm_link, "UPDATE `mw_account_extend` SET `account_level` = '4' WHERE `account_id` = ".$accountid['id']." LIMIT 1 ;"); + $row = mysqli_fetch_assoc($accountid); + mysqli_query($link, "INSERT INTO `mw_account_extend` (`account_id`, `account_level`) VALUES ('".$row['id']."', '4')"); $return = 1; - } + } else { // No such account, creating one, in this case pwd is needed, so checking whether it's provided... @@ -454,7 +418,7 @@ function sha_password($user, $pass) mysqli_query($realm_link, "INSERT INTO `account` (`username`, `sha_pass_hash`) VALUES ('".$_POST['account']."', '".$password."' );"); $accountid = mysqli_query("SELECT `id` FROM `account` WHERE `username` LIKE '".$_POST['account']."'"); $acct = mysqli_fetch_assoc($accountid); - mysqli_query($realm_link, "INSERT INTO `mw_account_extend` (`account_id`, `account_level`) VALUES ('".$acct['id']."', '4')"); + mysqli_query($link, "INSERT INTO `mw_account_extend` (`account_id`, `account_level`) VALUES ('".$acct['id']."', '4')"); $return = 2; } ?> @@ -462,9 +426,9 @@ function sha_password($user, $pass)

0) { ?> - Congradulations! MangosWeb v3 is installed and ready for use! Please log in and visit the admin panel to further configure the site! - Also, remember to EDIT the install file! (install/index.php). Set the FALSE to TRUE on line 3 to prevent users from - hacking your site.

Click Here To go to your MangosWeb home page. + Congradulations! MaNGOS Web v4 is installed and ready for use! Please delete the install/ directory from your webserver. + Once deleted you can log in and visit the admin panel to further configure the site! +

Click Here To go to your MaNGOS Web home page.

diff --git a/install/sql/full_install.sql b/install/sql/full_install.sql index 975f59b..fe546bd 100644 --- a/install/sql/full_install.sql +++ b/install/sql/full_install.sql @@ -1,339 +1,416 @@ -SET FOREIGN_KEY_CHECKS=0; --- ---------------------------- --- Table structure for `mw_account_extend` --- ---------------------------- +/*Table structure for table `mw_account_extend` */ + DROP TABLE IF EXISTS `mw_account_extend`; + CREATE TABLE `mw_account_extend` ( - `account_id` int(10) UNSIGNED NOT NULL, - `account_level` smallint(3) UNSIGNED NOT NULL DEFAULT '1', - `theme` smallint(3) UNSIGNED NOT NULL DEFAULT '0', - `last_visit` int(25) DEFAULT NULL, - `registration_ip` varchar(15) NOT NULL DEFAULT '0.0.0.0', - `activation_code` varchar(255) DEFAULT NULL, - `avatar` varchar(255) DEFAULT NULL, - `secret_q1` text, - `secret_a1` text, - `secret_q2` text, - `secret_a2` text, - `web_points` int(3) NOT NULL DEFAULT '0', - `points_earned` int(11) NOT NULL DEFAULT '0', - `points_spent` int(11) NOT NULL DEFAULT '0', - `date_points` varchar(100) NOT NULL DEFAULT '0', - `points_today` int(11) NOT NULL DEFAULT '0', - `total_donations` varchar(5) NOT NULL DEFAULT '0.00', - `total_votes` smallint(5) NOT NULL DEFAULT '0', + `account_id` INT(10) UNSIGNED NOT NULL, + `account_level` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '1', + `theme` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '0', + `last_visit` INT(25) DEFAULT NULL, + `registration_ip` VARCHAR(15) CHARACTER SET latin1 NOT NULL DEFAULT '0.0.0.0', + `activation_code` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `avatar` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `secret_q1` TEXT CHARACTER SET latin1, + `secret_a1` TEXT CHARACTER SET latin1, + `secret_q2` TEXT CHARACTER SET latin1, + `secret_a2` TEXT CHARACTER SET latin1, + `web_points` INT(3) NOT NULL DEFAULT '0', + `points_earned` INT(11) NOT NULL DEFAULT '0', + `points_spent` INT(11) NOT NULL DEFAULT '0', + `date_points` VARCHAR(100) CHARACTER SET latin1 NOT NULL DEFAULT '0', + `points_today` INT(11) NOT NULL DEFAULT '0', + `total_donations` VARCHAR(5) CHARACTER SET latin1 NOT NULL DEFAULT '0.00', + `total_votes` SMALLINT(5) NOT NULL DEFAULT '0', PRIMARY KEY (`account_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_account_extend --- ---------------------------- +/*Table structure for table `mw_account_groups` */ --- ---------------------------- --- Table structure for `mw_account_groups` --- ---------------------------- DROP TABLE IF EXISTS `mw_account_groups`; + CREATE TABLE `mw_account_groups` ( - `account_level` smallint(2) UNSIGNED NOT NULL DEFAULT '1', - `title` text, + `account_level` SMALLINT(2) UNSIGNED NOT NULL DEFAULT '1', + `title` TEXT CHARACTER SET latin1, PRIMARY KEY (`account_level`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of mw_account_groups --- ---------------------------- -INSERT INTO `mw_account_groups` VALUES ('1', 'Guest'); -INSERT INTO `mw_account_groups` VALUES ('2', 'Member'); -INSERT INTO `mw_account_groups` VALUES ('3', 'Admin'); -INSERT INTO `mw_account_groups` VALUES ('4', 'Super Admin'); -INSERT INTO `mw_account_groups` VALUES ('5', 'Banned'); - --- ---------------------------- --- Table structure for `mw_account_keys` --- ---------------------------- +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_account_groups` */ + +INSERT INTO `mw_account_groups`(`account_level`,`title`) VALUES + +(1,'Guest'), + +(2,'Member'), + +(3,'Admin'), + +(4,'Super Admin'), + +(5,'Banned'); + +/*Table structure for table `mw_account_keys` */ + DROP TABLE IF EXISTS `mw_account_keys`; + CREATE TABLE `mw_account_keys` ( - `id` int(11) UNSIGNED NOT NULL, - `key` varchar(40) CHARACTER SET utf8 DEFAULT NULL, - `assign_time` int(11) UNSIGNED DEFAULT NULL, + `id` INT(11) UNSIGNED NOT NULL, + `key` VARCHAR(40) CHARACTER SET utf8 DEFAULT NULL, + `assign_time` INT(11) UNSIGNED DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; - --- ---------------------------- --- Records of mw_account_keys --- ---------------------------- +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Table structure for table `mw_config` */ + +DROP TABLE IF EXISTS `mw_config`; + +CREATE TABLE `mw_config` ( + `site_title` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT 'MaNGOS Web V4', + `site_email` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT 'admin@mistvale.com', + `site_cookie` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT 'MaNGOSWebV4', + `site_href` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT '/', + `site_base_href` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT 'http://www.mistvale.com', + `site_armory` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT 'http://realmplayers.com', + `site_forums` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT '/forum/', + `emulator` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT 'mangos', + `templates` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT 'WotLK,Cataclysm_1,illidan,sunwell,Mists_of_Pandaria_v1.0,Burning_Crusade', + `default_lang` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT 'English', + `available_lang` VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT 'English', + `reg_allow` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `reg_require_activation` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `reg_require_invite` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `reg_require_recaptcha` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `reg_recaptcha_private_key` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `reg_recaptcha_public_key` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `reg_require_secret_questions` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `allow_user_pass_change` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `allow_user_email_change` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `max_account_per_ip` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10', + `default_component` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT 'frontpage', + `flash_display_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_vote_banner` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_newbie_guide` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_hitcounter` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_info` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_realm_status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_players_online` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_ip` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_pop` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_lang` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_act` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_active_act` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_chars` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `fp_server_more_info` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `email_type` TINYINT(3) UNSIGNED NOT NULL DEFAULT '2', + `email_smtp_host` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT 'smtp.gmail.com', + `email_smtp_port` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '465', + `email_use_secure` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `email_smtp_secure` VARCHAR(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'SSL', + `email_smtp_user` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `email_smtp_pass` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `paypal_email` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT 'admin@mistvale.com', + `site_notice_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_online_list` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_fp_ssotd` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_vote_system` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_vote_online_check` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_news_items` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10', + `module_news_open` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3', + `module_char_rename` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_char_rename_pts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '2', + `module_char_customize` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_char_customize_pts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '5', + `module_char_faction_change` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_char_faction_change_pts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '15', + `module_char_race_change` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `module_char_race_change_pts` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10', + `enable_debugging` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `default_realm_id` TINYINT(3) UNSIGNED NOT NULL DEFAULT '1', + `db_logon_host` VARCHAR(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '127.0.0.1', + `db_logon_port` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '3306', + `db_logon_name` VARCHAR(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `db_logon_user` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', + `db_logon_pass` VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_config` */ + +INSERT INTO `mw_config`() VALUES (); + +/*Table structure for table `mw_db_version` */ --- ---------------------------- --- Table structure for `mw_db_version` --- ---------------------------- -DROP TABLE IF EXISTS `mw_db_version`; -CREATE TABLE `mw_db_version` ( - `dbver` varchar(20) NOT NULL DEFAULT '', - `dbdate` int(10) UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (`dbver`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for `mw_db_version` --- ---------------------------- DROP TABLE IF EXISTS `mw_db_version`; + CREATE TABLE `mw_db_version` ( - `dbver` varchar(20) NOT NULL DEFAULT '', - `dbdate` int(10) UNSIGNED NOT NULL DEFAULT '0' - PRIMARY KEY (`entry`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of mw_db_version --- ---------------------------- -INSERT INTO `mw_db_version` VALUES ('1.0a', '1292781212'); -INSERT INTO `mw_db_version` VALUES ('4.0.9', UNIX_TIMESTAMP()); - --- ---------------------------- --- Table structure for `mw_donate_packages` --- ---------------------------- + `dbver` VARCHAR(20) CHARACTER SET latin1 NOT NULL DEFAULT '', + `dbdate` INT(10) UNSIGNED NOT NULL DEFAULT '0' +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_db_version` */ + +INSERT INTO `mw_db_version`(`dbver`,`dbdate`) VALUES ('4.1.0',1490069033); + +/*Table structure for table `mw_donate_packages` */ + DROP TABLE IF EXISTS `mw_donate_packages`; + CREATE TABLE `mw_donate_packages` ( - `id` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT, - `desc` varchar(255) DEFAULT NULL, - `cost` varchar(11) NOT NULL DEFAULT '1.00', - `points` int(11) NOT NULL DEFAULT '1', + `id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, + `desc` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `cost` VARCHAR(11) CHARACTER SET latin1 NOT NULL DEFAULT '1.00', + `points` INT(11) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_donate_packages --- ---------------------------- +/*Table structure for table `mw_donate_transactions` */ --- ---------------------------- --- Table structure for `mw_donate_transactions` --- ---------------------------- DROP TABLE IF EXISTS `mw_donate_transactions`; + CREATE TABLE `mw_donate_transactions` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `trans_id` varchar(255) DEFAULT NULL, - `account` int(8) UNSIGNED DEFAULT NULL, - `item_number` int(11) UNSIGNED DEFAULT NULL, - `buyer_email` varchar(255) DEFAULT NULL, - `payment_type` varchar(255) DEFAULT NULL, - `payment_status` varchar(255) DEFAULT NULL, - `pending_reason` varchar(255) DEFAULT NULL, - `reason_code` varchar(255) DEFAULT NULL, - `amount` varchar(10) DEFAULT NULL, - `item_given` tinyint(1) UNSIGNED NOT NULL DEFAULT '0', + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `trans_id` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `account` INT(8) UNSIGNED DEFAULT NULL, + `item_number` INT(11) UNSIGNED DEFAULT NULL, + `buyer_email` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `payment_type` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `payment_status` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `pending_reason` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `reason_code` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `amount` VARCHAR(10) CHARACTER SET latin1 DEFAULT NULL, + `item_given` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_donate_transactions --- ---------------------------- +/*Table structure for table `mw_faq` */ --- ---------------------------- --- Table structure for `mw_faq` --- ---------------------------- DROP TABLE IF EXISTS `mw_faq`; + CREATE TABLE `mw_faq` ( - `id` smallint(3) UNSIGNED NOT NULL AUTO_INCREMENT, - `question` text NOT NULL, - `answer` text NOT NULL, + `id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `question` TEXT CHARACTER SET latin1 NOT NULL, + `answer` TEXT CHARACTER SET latin1 NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_faq --- ---------------------------- +/*Table structure for table `mw_gallery` */ --- ---------------------------- --- Table structure for `mw_gallery` --- ---------------------------- DROP TABLE IF EXISTS `mw_gallery`; + CREATE TABLE `mw_gallery` ( - `id` int(3) UNSIGNED NOT NULL AUTO_INCREMENT, - `img` text NOT NULL, - `comment` text NOT NULL, - `autor` text NOT NULL, - `date` int(11) UNSIGNED NOT NULL, - `cat` varchar(255) NOT NULL, + `id` INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `img` TEXT CHARACTER SET cp1251 NOT NULL, + `comment` TEXT CHARACTER SET cp1251 NOT NULL, + `autor` TEXT CHARACTER SET cp1251 NOT NULL, + `date` INT(11) UNSIGNED NOT NULL, + `cat` VARCHAR(255) CHARACTER SET cp1251 NOT NULL, UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=cp1251 ROW_FORMAT=DYNAMIC; +) ENGINE=MYISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC; + +/*Data for the table `mw_gallery` */ + +INSERT INTO `mw_gallery`(`id`,`img`,`comment`,`autor`,`date`,`cat`) VALUES --- ---------------------------- --- Records of mw_gallery --- ---------------------------- -INSERT INTO `mw_gallery` VALUES ('1', 'Mangosweb_wall.jpg', 'Test Wallpaper', 'MangosWeb', '1485927282', 'wallpaper'); -INSERT INTO `mw_gallery` VALUES ('2', 'Mangosweb_scr.jpg', 'Test Screenshot', 'MangosWeb', '1485927282', 'screenshot'); +(1,'Mangosweb_wall.jpg','Test Wallpaper','MangosWeb',1485927282,'wallpaper'), + +(2,'Mangosweb_scr.jpg','Test Screenshot','MangosWeb',1485927282,'screenshot'); + +/*Table structure for table `mw_menu_items` */ --- ---------------------------- --- Table structure for `mw_menu_items` --- ---------------------------- DROP TABLE IF EXISTS `mw_menu_items`; + CREATE TABLE `mw_menu_items` ( - `menu_id` int(3) UNSIGNED NOT NULL DEFAULT '1', - `link_title` varchar(100) DEFAULT NULL, - `link` varchar(255) DEFAULT NULL, - `order` int(3) UNSIGNED NOT NULL DEFAULT '1', - `account_level` int(3) NOT NULL DEFAULT '1', - `guest_only` int(3) NOT NULL DEFAULT '0', - `id` int(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `menu_id` INT(3) UNSIGNED NOT NULL DEFAULT '1', + `link_title` VARCHAR(100) CHARACTER SET latin1 DEFAULT NULL, + `link` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `order` INT(3) UNSIGNED NOT NULL DEFAULT '1', + `account_level` INT(3) NOT NULL DEFAULT '1', + `guest_only` INT(3) NOT NULL DEFAULT '0', + `id` INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of mw_menu_items --- ---------------------------- -INSERT INTO `mw_menu_items` VALUES ('1', 'News', './', '1', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('1', 'RSS', 'rss.php', '2', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('2', 'Admin Panel', '?p=admin', '1', '3', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('2', 'Manage Account', '?p=account', '2', '2', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('2', 'Register', '?p=account&sub=register', '3', '1', '1', NULL); -INSERT INTO `mw_menu_items` VALUES ('2', 'Account Restore', '?p=account&sub=restore', '4', '1', '1', NULL); -INSERT INTO `mw_menu_items` VALUES ('4', 'Top Kills', '?p=server&sub=topkills', '1', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('4', 'Characters', '?p=server&sub=chars', '2', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('4', 'Players Online', '?p=server&sub=playersonline', '3', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('4', 'Realm Status', '?p=server&sub=realmstatus', '4', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('4', 'Server Statistics', '?p=server&sub=statistic', '5', '1', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('7', 'Donate', '?p=donate', '1', '2', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('7', 'Vote', '?p=vote', '2', '2', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('7', 'Shop', '?p=shop', '3', '2', '0', NULL); -INSERT INTO `mw_menu_items` VALUES ('8', 'FAQ', '?p=support&sub=faq', '1', '1', '0', NULL); - --- ---------------------------- --- Table structure for `mw_news` --- ---------------------------- +) ENGINE=MYISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_menu_items` */ + +INSERT INTO `mw_menu_items`(`menu_id`,`link_title`,`link`,`order`,`account_level`,`guest_only`,`id`) VALUES + +(1,'News','./',1,1,0,1), + +(1,'RSS','rss.php',2,1,0,2), + +(2,'Admin Panel','?p=admin',1,3,0,3), + +(2,'Manage Account','?p=account',2,2,0,4), + +(2,'Register','?p=account&sub=register',3,1,1,5), + +(2,'Account Restore','?p=account&sub=restore',4,1,1,6), + +(4,'Top Kills','?p=server&sub=topkills',1,1,0,7), + +(4,'Characters','?p=server&sub=chars',2,1,0,8), + +(4,'Players Online','?p=server&sub=playersonline',3,1,0,9), + +(4,'Realm Status','?p=server&sub=realmstatus',4,1,0,10), + +(4,'Server Statistics','?p=server&sub=statistic',5,1,0,11), + +(7,'Donate','?p=donate',1,2,0,12), + +(7,'Vote','?p=vote',2,2,0,13), + +(7,'Shop','?p=shop',3,2,0,14), + +(8,'FAQ','?p=support&sub=faq',1,1,0,15); + +/*Table structure for table `mw_news` */ + DROP TABLE IF EXISTS `mw_news`; + CREATE TABLE `mw_news` ( - `id` smallint(3) UNSIGNED NOT NULL AUTO_INCREMENT, - `title` text, - `message` longtext, - `posted_by` INT UNSIGNED NOT NULL DEFAULT 0, - `post_time` int(15) UNSIGNED DEFAULT NULL, + `id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `title` TEXT CHARACTER SET latin1, + `message` LONGTEXT CHARACTER SET latin1, + `posted_by` TEXT CHARACTER SET latin1, + `post_time` INT(15) UNSIGNED DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_news` */ --- ---------------------------- --- Records of mw_news --- ---------------------------- -INSERT INTO `mw_news` VALUES (NULL, 'Welcome!', '

Thank you for installing MaNGOS Web v4!

Please login with your Admin account username and password to configure the CMS further.

', 0, UNIX_TIMESTAMP()); +INSERT INTO `mw_news`(`id`,`title`,`message`,`posted_by`,`post_time`) VALUES +(1,'Welcome!','

Thank you for installing MaNGOS Web V4!

Please login with your Admin account username and password to configure the CMS further.

','Mistvale.com Dev',1485753669); + +/*Table structure for table `mw_online` */ --- ---------------------------- --- Table structure for `mw_online` --- ---------------------------- DROP TABLE IF EXISTS `mw_online`; + CREATE TABLE `mw_online` ( - `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, - `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0', - `user_name` varchar(200) NOT NULL DEFAULT 'Guest', - `user_ip` varchar(15) NOT NULL DEFAULT '0.0.0.0', - `logged` int(10) UNSIGNED NOT NULL DEFAULT '0', - `currenturl` varchar(255) NOT NULL DEFAULT './', + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `user_name` VARCHAR(200) CHARACTER SET utf8 NOT NULL DEFAULT 'Guest', + `user_ip` VARCHAR(15) CHARACTER SET utf8 NOT NULL DEFAULT '0.0.0.0', + `logged` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `currenturl` VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT './', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=1191 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_online --- ---------------------------- +/*Table structure for table `mw_pms` */ --- ---------------------------- --- Table structure for `mw_pms` --- ---------------------------- DROP TABLE IF EXISTS `mw_pms`; + CREATE TABLE `mw_pms` ( - `id` int(8) UNSIGNED NOT NULL AUTO_INCREMENT, - `owner_id` int(8) UNSIGNED NOT NULL DEFAULT '0', - `subject` varchar(255) NOT NULL, - `message` text, - `sender_id` int(8) UNSIGNED NOT NULL DEFAULT '0', - `posted` int(10) UNSIGNED NOT NULL DEFAULT '0', - `sender_ip` varchar(15) DEFAULT '0.0.0.0', - `showed` tinyint(1) DEFAULT '0', + `id` INT(8) UNSIGNED NOT NULL AUTO_INCREMENT, + `owner_id` INT(8) UNSIGNED NOT NULL DEFAULT '0', + `subject` VARCHAR(255) CHARACTER SET utf8 NOT NULL, + `message` TEXT CHARACTER SET utf8, + `sender_id` INT(8) UNSIGNED NOT NULL DEFAULT '0', + `posted` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `sender_ip` VARCHAR(15) CHARACTER SET utf8 DEFAULT '0.0.0.0', + `showed` TINYINT(1) DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of mw_pms --- ---------------------------- +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Table structure for table `mw_realm` */ + +DROP TABLE IF EXISTS `mw_realm`; + +CREATE TABLE `mw_realm` ( + `realm_id` INT(10) UNSIGNED NOT NULL, + `site_enabled` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', + `db_world_host` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT '127.0.0.1', + `db_world_port` SMALLINT(5) UNSIGNED DEFAULT '3306', + `db_world_name` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT '', + `db_world_user` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + `db_world_pass` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + `db_char_host` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT '127.0.0.1', + `db_char_port` SMALLINT(5) UNSIGNED DEFAULT '3306', + `db_char_name` VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT '', + `db_char_user` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + `db_char_pass` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + `ra_type` TINYINT(3) UNSIGNED DEFAULT '0', + `ra_port` SMALLINT(5) UNSIGNED DEFAULT '3443', + `ra_user` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + `ra_pass` VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT '', + PRIMARY KEY (`realm_id`) +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Table structure for table `mw_regkeys` */ --- ---------------------------- --- Table structure for `mw_regkeys` --- ---------------------------- DROP TABLE IF EXISTS `mw_regkeys`; + CREATE TABLE `mw_regkeys` ( - `id` smallint(9) UNSIGNED NOT NULL AUTO_INCREMENT, - `key` varchar(255) NOT NULL DEFAULT '0', - `used` smallint(3) NOT NULL DEFAULT '0', + `id` SMALLINT(9) UNSIGNED NOT NULL AUTO_INCREMENT, + `key` VARCHAR(255) CHARACTER SET latin1 NOT NULL DEFAULT '0', + `used` SMALLINT(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_regkeys --- ---------------------------- +/*Table structure for table `mw_secret_questions` */ --- ---------------------------- --- Table structure for `mw_secret_questions` --- ---------------------------- DROP TABLE IF EXISTS `mw_secret_questions`; + CREATE TABLE `mw_secret_questions` ( - `id` int(3) UNSIGNED NOT NULL AUTO_INCREMENT, - `question` varchar(60) DEFAULT NULL, + `id` INT(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `question` VARCHAR(60) CHARACTER SET latin1 DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- ---------------------------- --- Records of mw_secret_questions --- ---------------------------- -INSERT INTO `mw_secret_questions` VALUES ('1', 'What is your mothers maiden name?'); -INSERT INTO `mw_secret_questions` VALUES ('2', 'What is your favorite color?'); -INSERT INTO `mw_secret_questions` VALUES ('3', 'What street did you grow up on?'); -INSERT INTO `mw_secret_questions` VALUES ('4', 'What is your fathers middle name?'); -INSERT INTO `mw_secret_questions` VALUES ('5', 'What is the name of your first pet?'); - --- ---------------------------- --- Table structure for `mw_shop_items` --- ---------------------------- +) ENGINE=MYISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_secret_questions` */ + +INSERT INTO `mw_secret_questions`(`id`,`question`) VALUES + +(1,'What is your mothers maiden name?'), + +(2,'What is your favorite color?'), + +(3,'What street did you grow up on?'), + +(4,'What is your fathers middle name?'), + +(5,'What is the name of your first pet?'); + +/*Table structure for table `mw_shop_items` */ + DROP TABLE IF EXISTS `mw_shop_items`; + CREATE TABLE `mw_shop_items` ( - `id` smallint(3) UNSIGNED NOT NULL AUTO_INCREMENT, - `item_number` varchar(255) NOT NULL DEFAULT '0', - `itemset` int(10) UNSIGNED NOT NULL DEFAULT '0', - `gold` int(25) NOT NULL DEFAULT '0', - `quanity` int(25) UNSIGNED NOT NULL DEFAULT '1', - `desc` varchar(255) DEFAULT NULL, - `wp_cost` varchar(5) NOT NULL DEFAULT '0', - `realms` int(100) UNSIGNED NOT NULL DEFAULT '1', + `id` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, + `item_number` VARCHAR(255) CHARACTER SET latin1 NOT NULL DEFAULT '0', + `itemset` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `gold` INT(25) NOT NULL DEFAULT '0', + `quanity` INT(25) UNSIGNED NOT NULL DEFAULT '1', + `desc` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `wp_cost` VARCHAR(5) CHARACTER SET latin1 NOT NULL DEFAULT '0', + `realms` INT(100) UNSIGNED NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_shop_items --- ---------------------------- +/*Table structure for table `mw_vote_sites` */ --- ---------------------------- --- Table structure for `mw_vote_sites` --- ---------------------------- DROP TABLE IF EXISTS `mw_vote_sites`; + CREATE TABLE `mw_vote_sites` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `hostname` varchar(255) NOT NULL, - `votelink` varchar(255) NOT NULL, - `image_url` varchar(255) DEFAULT NULL, - `points` int(11) DEFAULT NULL, - `reset_time` int(16) UNSIGNED NOT NULL DEFAULT '1', + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `hostname` VARCHAR(255) CHARACTER SET latin1 NOT NULL, + `votelink` VARCHAR(255) CHARACTER SET latin1 NOT NULL, + `image_url` VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL, + `points` INT(11) DEFAULT NULL, + `reset_time` INT(16) UNSIGNED NOT NULL DEFAULT '1', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- ---------------------------- --- Records of mw_vote_sites --- ---------------------------- +/*Table structure for table `mw_voting` */ --- ---------------------------- --- Table structure for `mw_voting` --- ---------------------------- DROP TABLE IF EXISTS `mw_voting`; + CREATE TABLE `mw_voting` ( - `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, - `user_ip` varchar(30) NOT NULL, - `site` int(10) UNSIGNED NOT NULL DEFAULT '0', - `time` int(10) UNSIGNED NOT NULL DEFAULT '0', + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `user_ip` VARCHAR(30) CHARACTER SET utf8 NOT NULL, + `site` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `time` INT(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file +) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +/*Data for the table `mw_voting` */ \ No newline at end of file diff --git a/install/sql/updates/index.html b/install/sql/updates/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/install/sql/updates/update_4.0.5.sql b/install/sql/updates/update_4.0.5.sql deleted file mode 100644 index 4582afe..0000000 --- a/install/sql/updates/update_4.0.5.sql +++ /dev/null @@ -1,8 +0,0 @@ --- Drop unused table mw_gallery_ssotd -DROP TABLE `mw_gallery_ssotd`; - --- Modify `mw_gallery` to use a unix timestamp instead of date and preserve existing data -ALTER TABLE `mw_gallery` ADD COLUMN `date_2` INT(11) unsigned NOT NULL; -UPDATE `mw_gallery` SET `date_2` = UNIX_TIMESTAMP(`date`); -ALTER TABLE `mw_gallery` DROP COLUMN `date`; -ALTER TABLE `mw_gallery` CHANGE `date_2` `date` INT(11) unsigned NOT NULL; \ No newline at end of file diff --git a/install/sql/updates/update_4.0.9.sql b/install/sql/updates/update_4.0.9.sql deleted file mode 100644 index 3faa0a3..0000000 --- a/install/sql/updates/update_4.0.9.sql +++ /dev/null @@ -1,101 +0,0 @@ -ALTER TABLE `mw_db_version` - DROP COLUMN `entry`, - DROP PRIMARY KEY; - -INSERT INTO `mw_db_version` VALUES ('4.0.9', UNIX_TIMESTAMP()); - -DROP TABLE IF EXISTS `mw_config`; - -CREATE TABLE `mw_config`( - `site_title` VARCHAR(64) DEFAULT 'MaNGOS Web V4', - `site_email` VARCHAR(64) DEFAULT 'admin@mistvale.com', - `site_cookie` VARCHAR(255) DEFAULT 'MaNGOSWebV4', - `site_href` VARCHAR(255) DEFAULT '/', - `site_base_href` VARCHAR(255) DEFAULT 'http://www.mistvale.com', - `site_armory` VARCHAR(32) DEFAULT 'http://realmplayers.com', - `site_forums` VARCHAR(32) DEFAULT '/forum/', - `emulator` VARCHAR(32) DEFAULT 'mangos', - `templates` VARCHAR(255) DEFAULT 'WotLK,Cataclysm_1,illidan,sunwell,Mists_of_Pandaria_v1.0,Burning_Crusade', - `default_lang` VARCHAR(32) DEFAULT 'English', - `available_lang` VARCHAR(255) DEFAULT 'English', - `reg_allow` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `reg_require_activation` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `reg_require_invite` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `reg_require_recaptcha` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `reg_recaptcha_private_key` VARCHAR(64), - `reg_recaptcha_public_key` VARCHAR(64), - `reg_require_secret_questions` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `allow_user_pass_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `allow_user_email_change` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `max_account_per_ip` TINYINT UNSIGNED NOT NULL DEFAULT 10, - `default_component` VARCHAR(64) DEFAULT 'frontpage', - `flash_display_type` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_vote_banner` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_newbie_guide` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_hitcounter` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_info` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_realm_status` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_players_online` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_ip` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_type` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_pop` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_lang` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_act` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_active_act` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_chars` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `fp_server_more_info` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `email_type` TINYINT UNSIGNED NOT NULL DEFAULT 2, - `email_smtp_host` VARCHAR(64) DEFAULT 'smtp.gmail.com', - `email_smtp_port` SMALLINT UNSIGNED NOT NULL DEFAULT 465, - `email_use_secure` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `email_smtp_secure` VARCHAR(32) NOT NULL DEFAULT 'SSL', - `email_smtp_user` VARCHAR(64), - `email_smtp_pass` VARCHAR(64), - `paypal_email` VARCHAR(64) DEFAULT 'admin@mistvale.com', - `site_notice_enable` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_online_list` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_fp_ssotd` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_vote_system` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_vote_online_check` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_news_items` TINYINT UNSIGNED NOT NULL DEFAULT 10, - `module_news_open` TINYINT UNSIGNED NOT NULL DEFAULT 3, - `module_char_rename` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_char_rename_pts` TINYINT UNSIGNED NOT NULL DEFAULT 2, - `module_char_customize` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_char_customize_pts` TINYINT UNSIGNED NOT NULL DEFAULT 5, - `module_char_faction_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_char_faction_change_pts` TINYINT UNSIGNED NOT NULL DEFAULT 15, - `module_char_race_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `module_char_race_change_pts` TINYINT UNSIGNED NOT NULL DEFAULT 10, - `enable_debugging` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `default_realm_id` TINYINT UNSIGNED NOT NULL DEFAULT 1, - `db_logon_host` VARCHAR(32) NOT NULL DEFAULT '127.0.0.1', - `db_logon_port` SMALLINT UNSIGNED NOT NULL DEFAULT 3306, - `db_logon_name` VARCHAR(32) NOT NULL DEFAULT '', - `db_logon_user` VARCHAR(64) NOT NULL DEFAULT '', - `db_logon_pass` VARCHAR(64) NOT NULL DEFAULT '' -) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; - -INSERT INTO mw_config () VALUES (); - -DROP TABLE IF EXISTS `mw_realm`; - -CREATE TABLE `mw_realm` ( - `realm_id` INT UNSIGNED NOT NULL, - `site_enabled` TINYINT UNSIGNED NOT NULL DEFAULT 0, - `db_world_host` VARCHAR(32) DEFAULT '127.0.0.1', - `db_world_port` SMALLINT UNSIGNED DEFAULT 3306, - `db_world_name` VARCHAR(32) DEFAULT '', - `db_world_user` VARCHAR(64) DEFAULT '', - `db_world_pass` VARCHAR(64) DEFAULT '', - `db_char_host` VARCHAR(32) DEFAULT '127.0.0.1', - `db_char_port` SMALLINT UNSIGNED DEFAULT 3306, - `db_char_name` VARCHAR(32) DEFAULT '', - `db_char_user` VARCHAR(64) DEFAULT '', - `db_char_pass` VARCHAR(64) DEFAULT '', - `ra_type` TINYINT UNSIGNED DEFAULT 0, - `ra_port` SMALLINT UNSIGNED DEFAULT 3443, - `ra_user` VARCHAR(64) DEFAULT '', - `ra_pass` VARCHAR(64) DEFAULT '', - PRIMARY KEY (`realm_id`) -) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/templates/blizzlike/account/account.register.php b/templates/blizzlike/account/account.register.php index 5413583..fa747fd 100644 --- a/templates/blizzlike/account/account.register.php +++ b/templates/blizzlike/account/account.register.php @@ -38,7 +38,7 @@ } else { - if($mwe_config['reg_invite'] == 1 && (!isset($_GET['r_key']) || !$Account->isValidRegkey($_GET['r_key']))) + if($mwe_config['reg_require_invite'] == 1 && (!isset($_GET['r_key']) || !$Account->isValidRegkey($_GET['r_key']))) { // require invite / registration code to create an account if(isset($_GET['r_key']) && !$Account->isValidRegkey($_GET['r_key'])) @@ -131,7 +131,7 @@ /> @@ -171,7 +171,7 @@

diff --git a/update/index.php b/update/index.php new file mode 100644 index 0000000..91cf768 --- /dev/null +++ b/update/index.php @@ -0,0 +1,66 @@ +selectRow("SHOW DATABASES LIKE '" . $dbconf['db_name'] . "'")) +{ + if($DB->count("SHOW TABLES LIKE 'mw_db_version'") > 0) + { + $db_act_ver = $DB->selectCell("SELECT `dbver` FROM `mw_db_version` ORDER BY `dbdate` DESC LIMIT 0,1"); + if($db_act_ver == $Core->db_version) + { + die("Your MaNGOS Web install is up to date. Please delete the update/ directory from your webserver to continue. +

Click Here To go to your MaNGOS Web home page."); + } + } +} + +$Update->check_for_updates(); +//die($db_act_ver . "---".$Core->db_version."---".$Update->next_db_version); +if(file_exists("scripts/update_" . $Update->next_db_version . ".php")) +{ + // check to see if there is a local PHP script to handle the SQL update + include("scripts/update_" . $Update->next_db_version . ".php"); +} +elseif(file_exists("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/scripts/update_" . $Update->next_db_version . ".php")) +{ + // check for online copy if no local copy exists of the PHP script + include("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/scripts/update_" . $Update->next_db_version . ".php"); +} +else +{ + // no script required for this DB update, proceed + if(file_exists("scripts/update_" . $Update->next_db_version . ".sql")) + { + // check to see if there is a local SQL script and run + $DB->runSQL("scripts/update_" . $Update->next_db_version . ".sql"); + } + elseif(file_exists("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/scripts/update_" . $Update->next_db_version . ".sql")) + { + // check for online copy if no local copy exists of the SQL script + $DB->runSQL("https://raw.githubusercontent.com/paintballrefjosh/MaNGOSWebV4/master/update/scripts/update_" . $Update->next_db_version . ".sql"); + } + else + { + die("SQL update file not found!"); + } +} diff --git a/update/scripts/update_4.0.5.php b/update/scripts/update_4.0.5.php new file mode 100644 index 0000000..c13d534 --- /dev/null +++ b/update/scripts/update_4.0.5.php @@ -0,0 +1,32 @@ + */ +/* Copyright (C) <2017> */ +/* < http://www.mistvale.com > */ +/****************************************************************************/ + +// This PHP file is the script to update your MWE database to version 4.0.5 +// It will be executed from the web interface. + +// First check to see if the database is already at version 4.0.5 but the mw_db_version simply wasn't added. + +$row = $DB->selectRow("SHOW FIELDS FROM mw_gallery"); + +if(substr($row['Type'], 0, 3) === "int") +{ + // database was updated, but mw_db_version was not + $DB->query("INSERT INTO `mw_db_version` VALUES ('4.0.5', UNIX_TIMESTAMP(), 2)"); +} +else +{ + $DB->query("ALTER TABLE `mw_gallery` ADD COLUMN `date_2` INT(11) unsigned NOT NULL"); + $DB->query("UPDATE `mw_gallery` SET `date_2` = UNIX_TIMESTAMP(`date`)"); + $DB->query("ALTER TABLE `mw_gallery` DROP COLUMN `date`"); + $DB->query("ALTER TABLE `mw_gallery` CHANGE `date_2` `date` INT(11) unsigned NOT NULL"); + $DB->query("INSERT INTO `mw_db_version` VALUES ('4.0.5', UNIX_TIMESTAMP(), '2')"); +} + +?> + +Database successfully updated!!

+Go back to check for additional updates.
\ No newline at end of file diff --git a/update/scripts/update_4.1.0.php b/update/scripts/update_4.1.0.php new file mode 100644 index 0000000..f408755 --- /dev/null +++ b/update/scripts/update_4.1.0.php @@ -0,0 +1,297 @@ + */ +/* Copyright (C) <2017> */ +/* < http://www.mistvale.com > */ +/****************************************************************************/ + +// This PHP file is the script to update your MWE database to version 4.1.0 +// It will be executed from the web interface. + +if(isset($_POST['db_admin_user'])) +{ + executeDBScript(); +} +else +{ + +?> + + WARNING! Before proceeding with the database upgrade you should take a backup of your database (structure + data).

+ This will upgrade your database to version 4.1.0. You must supply database admin credentials in order to create the new MWE database.

+ + + DB Admin Username:
+ DB Admin Password:
+ DB Host:
+ Port:

+ New MaNGOS Web DB Name:
+ New MaNGOS Web DB Username:
+ New MaNGOS Web DB Password:

+ + + +query($sql); +} + +function migrateRealmlist(Database $dbAdmin) +{ + // migrate realmlist data to new DB & structure + global $DB; + $getrealms = $DB->select("SELECT * FROM `realmlist` WHERE site_enabled = 1"); + foreach($getrealms as $row) + { + $connectInfo = explode(";", $row['dbinfo']); + $raInfo = explode(";", $row['ra_info']); + if($raInfo[1] == "port") + { + $raInfo[1] = 0; + } + $dbAdmin->query("INSERT INTO `".$_POST['mw_db_name']."`.`mw_realm` SET + realm_id = '".$row['id']."', + db_world_host = '".$connectInfo[5]."', + db_world_port = '".$connectInfo[6]."', + db_world_name = '".$connectInfo[9]."', + db_world_user = '".$connectInfo[7]."', + db_world_pass = '".$connectInfo[8]."', + db_char_host = '".$connectInfo[0]."', + db_char_port = '".$connectInfo[1]."', + db_char_name = '".$connectInfo[4]."', + db_char_user = '".$connectInfo[2]."', + db_char_pass = '".$connectInfo[3]."', + ra_type = '".$raInfo[0]."', + ra_port = '".$raInfo[1]."', + ra_user = '".$raInfo[2]."', + ra_pass = '".$raInfo[3]."', + site_enabled = 1 + "); + } +} + +function executeDBScript() +{ + global $Update, $DB, $dbconf; + + // run the SQL script as the provided DB admin + $dbAdmin = New Database( + $_POST['db_admin_host'], + $_POST['db_admin_port'], + $_POST['db_admin_user'], + $_POST['db_admin_pass'], + "" // db name + ); + + $dbAdmin->query("CREATE DATABASE `".$_POST['mw_db_name']."`"); + + $dbAdmin->query("CREATE TABLE `".$_POST['mw_db_name']."`.`mw_config`( + `site_title` VARCHAR(64) DEFAULT 'MaNGOS Web V4', + `site_email` VARCHAR(64) DEFAULT 'admin@mistvale.com', + `site_cookie` VARCHAR(255) DEFAULT 'MaNGOSWebV4', + `site_href` VARCHAR(255) DEFAULT '/', + `site_base_href` VARCHAR(255) DEFAULT 'http://www.mistvale.com', + `site_armory` VARCHAR(32) DEFAULT 'http://realmplayers.com', + `site_forums` VARCHAR(32) DEFAULT '/forum/', + `emulator` VARCHAR(32) DEFAULT 'mangos', + `templates` VARCHAR(255) DEFAULT 'WotLK,Cataclysm_1,illidan,sunwell,Mists_of_Pandaria_v1.0,Burning_Crusade', + `default_lang` VARCHAR(32) DEFAULT 'English', + `available_lang` VARCHAR(255) DEFAULT 'English', + `reg_allow` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `reg_require_activation` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `reg_require_invite` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `reg_require_recaptcha` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `reg_recaptcha_private_key` VARCHAR(64), + `reg_recaptcha_public_key` VARCHAR(64), + `reg_require_secret_questions` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `allow_user_pass_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `allow_user_email_change` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `max_account_per_ip` TINYINT UNSIGNED NOT NULL DEFAULT 10, + `default_component` VARCHAR(64) DEFAULT 'frontpage', + `flash_display_type` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_vote_banner` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_newbie_guide` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_hitcounter` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_info` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_realm_status` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_players_online` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_ip` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_type` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_pop` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_lang` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_act` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_active_act` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_chars` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `fp_server_more_info` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `email_type` TINYINT UNSIGNED NOT NULL DEFAULT 2, + `email_smtp_host` VARCHAR(64) DEFAULT 'smtp.gmail.com', + `email_smtp_port` SMALLINT UNSIGNED NOT NULL DEFAULT 465, + `email_use_secure` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `email_smtp_secure` VARCHAR(32) NOT NULL DEFAULT 'SSL', + `email_smtp_user` VARCHAR(64), + `email_smtp_pass` VARCHAR(64), + `paypal_email` VARCHAR(64) DEFAULT 'admin@mistvale.com', + `site_notice_enable` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_online_list` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_fp_ssotd` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_vote_system` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_vote_online_check` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_news_items` TINYINT UNSIGNED NOT NULL DEFAULT 10, + `module_news_open` TINYINT UNSIGNED NOT NULL DEFAULT 3, + `module_char_rename` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_char_rename_pts` TINYINT UNSIGNED NOT NULL DEFAULT 2, + `module_char_customize` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_char_customize_pts` TINYINT UNSIGNED NOT NULL DEFAULT 5, + `module_char_faction_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_char_faction_change_pts` TINYINT UNSIGNED NOT NULL DEFAULT 15, + `module_char_race_change` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `module_char_race_change_pts` TINYINT UNSIGNED NOT NULL DEFAULT 10, + `enable_debugging` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `default_realm_id` TINYINT UNSIGNED NOT NULL DEFAULT 1, + `db_logon_host` VARCHAR(32) NOT NULL DEFAULT '127.0.0.1', + `db_logon_port` SMALLINT UNSIGNED NOT NULL DEFAULT 3306, + `db_logon_name` VARCHAR(32) NOT NULL DEFAULT '', + `db_logon_user` VARCHAR(64) NOT NULL DEFAULT '', + `db_logon_pass` VARCHAR(64) NOT NULL DEFAULT '' + ) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_unicode_ci + "); + + $dbAdmin->query("INSERT INTO `".$_POST['mw_db_name']."`.`mw_config` () VALUES ()"); + + $dbAdmin->query("CREATE TABLE `".$_POST['mw_db_name']."`.`mw_realm` ( + `realm_id` INT UNSIGNED NOT NULL, + `site_enabled` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `db_world_host` VARCHAR(32) DEFAULT '127.0.0.1', + `db_world_port` SMALLINT UNSIGNED DEFAULT 3306, + `db_world_name` VARCHAR(32) DEFAULT '', + `db_world_user` VARCHAR(64) DEFAULT '', + `db_world_pass` VARCHAR(64) DEFAULT '', + `db_char_host` VARCHAR(32) DEFAULT '127.0.0.1', + `db_char_port` SMALLINT UNSIGNED DEFAULT 3306, + `db_char_name` VARCHAR(32) DEFAULT '', + `db_char_user` VARCHAR(64) DEFAULT '', + `db_char_pass` VARCHAR(64) DEFAULT '', + `ra_type` TINYINT UNSIGNED DEFAULT 0, + `ra_port` SMALLINT UNSIGNED DEFAULT 3443, + `ra_user` VARCHAR(64) DEFAULT '', + `ra_pass` VARCHAR(64) DEFAULT '', + PRIMARY KEY (`realm_id`) + ) ENGINE=MYISAM CHARSET=utf8 COLLATE=utf8_unicode_ci + "); + + // setup permissions for realm user to access new mangosweb database + $dbAdmin->query("GRANT ALL PRIVILEGES ON `" . $_POST['mw_db_name'] . "` . * to '".$_POST['mw_db_user']."'@'".$_POST['mw_admin_host']."' + IDENTIFIED BY '" . $_POST['mw_db_pass'] . "'"); + + // migrate the mw_ tables over to new mangosweb database + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_account_extend` RENAME `".$_POST['mw_db_name']."`.`mw_account_extend`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_account_groups` RENAME `".$_POST['mw_db_name']."`.`mw_account_groups`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_account_keys` RENAME `".$_POST['mw_db_name']."`.`mw_account_keys`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_db_version` RENAME `".$_POST['mw_db_name']."`.`mw_db_version`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_donate_packages` RENAME `".$_POST['mw_db_name']."`.`mw_donate_packages`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_donate_transactions` RENAME `".$_POST['mw_db_name']."`.`mw_donate_transactions`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_faq` RENAME `".$_POST['mw_db_name']."`.`mw_faq`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_gallery` RENAME `".$_POST['mw_db_name']."`.`mw_gallery`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_menu_items` RENAME `".$_POST['mw_db_name']."`.`mw_menu_items`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_news` RENAME `".$_POST['mw_db_name']."`.`mw_news`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_online` RENAME `".$_POST['mw_db_name']."`.`mw_online`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_pms` RENAME `".$_POST['mw_db_name']."`.`mw_pms`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_regkeys` RENAME `".$_POST['mw_db_name']."`.`mw_regkeys`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_secret_questions` RENAME `".$_POST['mw_db_name']."`.`mw_secret_questions`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_shop_items` RENAME `".$_POST['mw_db_name']."`.`mw_shop_items`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_vote_sites` RENAME `".$_POST['mw_db_name']."`.`mw_vote_sites`"); + $dbAdmin->query("ALTER TABLE `".$dbconf['db_name']."`.`mw_voting` RENAME `".$_POST['mw_db_name']."`.`mw_voting`"); + + migrateConfig($dbAdmin); + migrateRealmlist($dbAdmin); + $dbAdmin->query("ALTER TABLE `".$_POST['mw_db_name']."`.`mw_db_version` DROP COLUMN `entry`, DROP PRIMARY KEY"); + $dbAdmin->query("INSERT INTO `".$_POST['mw_db_name']."`.`mw_db_version` VALUES ('4.1.0', UNIX_TIMESTAMP())"); + +?> + + Database successfully updated!!

+ Please update your config/config-protected.php. Change the database name & credentials to the new database.

+ Go back to check for additional updates.
+ +