Skip to content
This repository was archived by the owner on Sep 11, 2022. It is now read-only.

Commit

Permalink
- Beta 9 release
Browse files Browse the repository at this point in the history
- Several changes are included in this version, mainly: fixes and
improvements.
- Replaced config.xml files for a _options table.-
  • Loading branch information
LucasKovacs committed Mar 1, 2016
1 parent 08d020a commit 0ce196b
Show file tree
Hide file tree
Showing 39 changed files with 2,069 additions and 1,847 deletions.
187 changes: 0 additions & 187 deletions src/xgp3.0.0/upload/application/config/config.xml.cfg

This file was deleted.

125 changes: 59 additions & 66 deletions src/xgp3.0.0/upload/application/controllers/adm/maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
*/
class Maker extends XGPCore
{

private $_current_user;
private $_creator;
private $_alert;
Expand Down Expand Up @@ -181,82 +180,76 @@ private function make_moon()
$temp_max = (int) $_POST['planet_temp_max'];
$max_fields = (int) $_POST['planet_field_max'];

$moon_planet = parent::$db->queryFetch("SELECT p.*, (SELECT `planet_id`
FROM " . PLANETS . "
WHERE `planet_galaxy` = (SELECT `planet_galaxy`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_system` = (SELECT `planet_system`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_planet` = (SELECT `planet_planet`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_type` = 3) AS id_moon
FROM " . PLANETS . " AS p
WHERE p.`planet_id` = '" . $planet_id . "' AND
p.`planet_type` = '1'");
$moon_planet = parent::$db->queryFetch(
"SELECT p.*, (SELECT `planet_id`
FROM " . PLANETS . "
WHERE `planet_galaxy` = (SELECT `planet_galaxy`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_system` = (SELECT `planet_system`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_planet` = (SELECT `planet_planet`
FROM " . PLANETS . "
WHERE `planet_id` = '" . $planet_id . "'
AND `planet_type` = 1)
AND `planet_type` = 3) AS id_moon
FROM " . PLANETS . " AS p
WHERE p.`planet_id` = '" . $planet_id . "' AND
p.`planet_type` = '1'"
);


if ($moon_planet && is_numeric($planet_id)) {
if ($moon_planet['id_moon'] == '' && $moon_planet['planet_type'] == 1 && $moon_planet['planet_destroyed'] == 0) {

$galaxy = $moon_planet['planet_galaxy'];
$system = $moon_planet['planet_system'];
$planet = $moon_planet['planet_planet'];
$owner = $moon_planet['planet_user_id'];

if (isset($_POST['diameter_check']) && $_POST['diameter_check'] == 'on') {
$size = mt_rand(4500, 9999);
$owner = $moon_planet['planet_user_id'];

$size = 0;
$errors = 0;
$mintemp = 0;
$maxtemp = 0;

if (!isset($_POST['diameter_check'])) {
if (is_numeric($diameter)) {
$size = $diameter;
} else {
$errors++;
$this->_alert = AdministrationLib::saveMessage('warning', $this->_lang['mk_moon_only_numbers']);
}
}

if (isset($_POST['diameter_check']) && $_POST['diameter_check'] != 'on' && is_numeric($diameter)) {
$size = $diameter;
} else {
$this->_alert = AdministrationLib::saveMessage('warning', $this->_lang['mk_moon_only_numbers']);
if (!isset($_POST['temp_check'])) {
if (is_numeric($temp_max) && is_numeric($temp_min)) {
$mintemp = $temp_min;
$maxtemp = $temp_max;
} else {
$errors++;
$this->_alert = AdministrationLib::saveMessage('warning', $this->_lang['mk_moon_only_numbers']);
}
}


if (isset($_POST['temp_check']) && $_POST['temp_check'] == 'on') {
$maxtemp = $moon_planet['planet_temp_max'] - mt_rand(10, 45);
$mintemp = $moon_planet['planet_temp_min'] - mt_rand(10, 45);
} elseif (isset($_POST['temp_check']) && $_POST['temp_check'] != 'on' && is_numeric($temp_max) && is_numeric($temp_min)) {
$maxtemp = $temp_max;
$mintemp = $temp_min;
} else {
$this->_alert = AdministrationLib::saveMessage('warning', $this->_lang['mk_moon_only_numbers']);

if ($errors == 0) {
$this->_creator->setNewMoon(
$galaxy,
$system,
$planet,
$owner,
$moon_name,
0,
$size,
$max_fields,
$mintemp,
$maxtemp
);

$this->_alert = AdministrationLib::saveMessage('ok', $this->_lang['mk_moon_added']);
}

parent::$db->query(
"INSERT INTO " . PLANETS . " SET
`planet_name` = '" . $moon_name . "',
`planet_user_id` = '" . $owner . "',
`planet_galaxy` = '" . $galaxy . "',
`planet_system` = '" . $system . "',
`planet_planet` = '" . $planet . "',
`planet_last_update` = '" . time() . "',
`planet_type` = '3',
`planet_image` = 'mond',
`planet_diameter` = '" . $size . "',
`planet_field_max` = '" . $max_fields . "',
`planet_temp_min` = '" . $mintemp . "',
`planet_temp_max` = '" . $maxtemp . "';"
);

$last_id = parent::$db->insertId();

parent::$db->query("INSERT INTO " . BUILDINGS . " SET
`building_planet_id` = '" . $last_id . "';");

parent::$db->query("INSERT INTO " . DEFENSES . " SET
`defense_planet_id` = '" . $last_id . "';");

parent::$db->query("INSERT INTO " . SHIPS . " SET
`ship_planet_id` = '" . $last_id . "';");

$this->_alert = AdministrationLib::saveMessage('ok', $this->_lang['mk_moon_added']);
} else {
$this->_alert = AdministrationLib::saveMessage('warning', $this->_lang['mk_moon_add_errors']);
}
Expand Down
1 change: 1 addition & 0 deletions src/xgp3.0.0/upload/application/controllers/adm/reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use application\core\XGPCore;
use application\libraries\adm\AdministrationLib;
use application\libraries\FunctionsLib;

/**
* Reset Class
Expand Down
1 change: 1 addition & 0 deletions src/xgp3.0.0/upload/application/controllers/adm/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct()

// Check if the user is allowed to access
if (AdministrationLib::haveAccess($this->_current_user['user_authlevel']) && AdministrationLib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) {

$this->_game_config = FunctionsLib::readConfig('', true);

$this->build_page();
Expand Down
12 changes: 7 additions & 5 deletions src/xgp3.0.0/upload/application/controllers/game/alliance.php
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,13 @@ private function ally_admin()
$_POST['text'] = trim(nl2br(strip_tags($_POST['text'], '<br>')));
$_POST['text'] = str_replace('rn', '\\r\\n', $_POST['text']);

parent::$db->query("UPDATE " . USERS . " SET
user_ally_request_text = '',
user_ally_request = '0',
user_ally_id = '" . $this->_ally['alliance_id'] . "'
WHERE user_id = '" . $show . "'");
parent::$db->query(
"UPDATE " . USERS . " SET
user_ally_request_text = '',
user_ally_request = '0',
user_ally_id = '" . $this->_ally['alliance_id'] . "'
WHERE user_id = '" . $show . "'"
);

FunctionsLib::sendMessage($show, $this->_current_user['user_id'], '', 3, $this->_ally['alliance_tag'], $this->_lang['al_you_was_acceted'] . $this->_ally['alliance_name'], $this->_lang['al_hi_the_alliance'] . $this->_ally['alliance_name'] . $this->_lang['al_has_accepted'] . $_POST['text']);

Expand Down
10 changes: 6 additions & 4 deletions src/xgp3.0.0/upload/application/controllers/game/buildings.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,12 @@ private function can_build($building, $list_id)
*/
private function start_building()
{
parent::$db->query("UPDATE " . PLANETS . " SET
`planet_b_building_id` = '" . $this->_current_planet['planet_b_building_id'] . "',
`planet_b_building` = '" . $this->_current_planet['planet_b_building'] . "'
WHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
parent::$db->query(
"UPDATE " . PLANETS . " SET
`planet_b_building_id` = '" . $this->_current_planet['planet_b_building_id'] . "',
`planet_b_building` = '" . $this->_current_planet['planet_b_building'] . "'
WHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';"
);

return;
}
Expand Down
Loading

0 comments on commit 0ce196b

Please sign in to comment.