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 @@