本文整理汇总了PHP中Functions_Lib::message方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::message方法的具体用法?PHP Functions_Lib::message怎么用?PHP Functions_Lib::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
$this->_lang = parent::$lang;
if ($this->server_requirementes()) {
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ins_no_server_requirements']));
}
}
示例2: process_request
/**
* process_request()
* param $mail
* return process the user request for a new password
**/
private function process_request($mail)
{
$lang = parent::$lang;
$ExistMail = parent::$db->query_fetch("SELECT `user_name`\r\n\t\t\t\t\t\t\t\t\t\t \t\t\tFROM " . USERS . "\r\n\t\t\t\t\t\t\t\t\t\t \t\t\tWHERE `user_email` = '" . parent::$db->escape_value($mail) . "' LIMIT 1;");
if (empty($ExistMail['user_name'])) {
Functions_Lib::message($lang['mail_not_exist'], "index.php?page=recoverpassword", 2, FALSE, FALSE);
} else {
$new_password = $this->send_pass_email($mail, $ExistMail['user_name']);
parent::$db->query("UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t`user_password` ='" . sha1($new_password) . "'\r\n\t\t\t\t\t\t\t\t\tWHERE `user_email`='" . parent::$db->escape_value($mail) . "' LIMIT 1;");
}
}
示例3: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
$this->_lang = parent::$lang;
if (Functions_Lib::read_config('reg_enable') == 1) {
$this->_creator = Functions_Lib::load_library('Creator_Lib');
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['re_disabled'], 'index.php', '5', FALSE, FALSE));
}
}
示例4: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (!Administration_Lib::have_access($this->_current_user['user_authlevel'])) {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
} else {
$this->build_page();
}
}
示例5: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && Administration_Lib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) {
$this->_game_config = Functions_Lib::read_config('', TRUE);
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例6: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_creator = Functions_Lib::load_library('Creator_Lib');
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && Administration_Lib::authorization($this->_current_user['user_authlevel'], 'edit_users') == 1) {
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例7: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
$this->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
// Check if the user is allowed to access
if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && $this->_current_user['user_authlevel'] == 3) {
include_once XGP_ROOT . 'application/libraries/Creator_Lib.php';
$this->_creator = new Creator_Lib();
$this->build_page();
} else {
die(Functions_Lib::message($this->_lang['ge_no_permissions']));
}
}
示例8: __construct
/**
* __construct()
*/
public function __construct()
{
parent::__construct();
// check if session is active
parent::$users->check_session();
// Check module access
Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID));
$this->_current_user = parent::$users->get_user_data();
$this->_current_planet = parent::$users->get_planet_data();
$this->_lang = parent::$lang;
$this->_resource = parent::$objects->get_objects();
$this->_reslist = parent::$objects->get_objects_list();
if ($this->_current_planet[$this->_resource[31]] == 0) {
Functions_Lib::message($this->_lang['bd_lab_required'], '', '', TRUE);
} else {
$this->handle_technologie_build();
$this->build_page();
}
}
示例9: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
if (!array_key_exists($this->_element_id, $this->_resource)) {
Functions_Lib::redirect('game.php?page=techtree');
}
$GateTPL = '';
$DestroyTPL = '';
$TableHeadTPL = '';
$TableFooterTPL = '';
$parse = $this->_lang;
$parse['dpath'] = DPATH;
$parse['name'] = $this->_lang['info'][$this->_element_id]['name'];
$parse['image'] = $this->_element_id;
$parse['description'] = $this->_lang['info'][$this->_element_id]['description'];
if ($this->_element_id < 13 or $this->_element_id == 43 && $this->_current_planet[$this->_resource[43]] > 0) {
$PageTPL = parent::$page->get_template('infos/info_buildings_table');
} elseif ($this->_element_id < 200) {
$PageTPL = parent::$page->get_template('infos/info_buildings_general');
} elseif ($this->_element_id < 400) {
$PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
} elseif ($this->_element_id < 600) {
$PageTPL = parent::$page->get_template('infos/info_buildings_defense');
} else {
$PageTPL = parent::$page->get_template('infos/info_officiers_general');
}
//S�lo hay destroy en <200
if ($this->_element_id < 200 && $this->_element_id != 33 && $this->_element_id != 41) {
$DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
}
if ($this->_element_id >= 1 && $this->_element_id <= 3) {
$PageTPL = parent::$page->get_template('infos/info_buildings_table');
$TableHeadTPL = parent::$page->get_template('infos/info_production_header');
$TableTPL = parent::$page->get_template('infos/info_production_body');
} elseif ($this->_element_id == 4) {
$PageTPL = parent::$page->get_template('infos/info_buildings_table');
$TableHeadTPL = parent::$page->get_template('infos/info_production_simple_header');
$TableTPL = parent::$page->get_template('infos/info_production_simple_body');
} elseif ($this->_element_id >= 22 && $this->_element_id <= 24) {
$PageTPL = parent::$page->get_template('infos/info_buildings_table');
$DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
$TableHeadTPL = parent::$page->get_template('infos/info_storage_header');
$TableTPL = parent::$page->get_template('infos/info_storage_table');
} elseif ($this->_element_id == 12) {
$TableHeadTPL = parent::$page->get_template('infos/info_energy_header');
$TableTPL = parent::$page->get_template('infos/info_energy_body');
} elseif ($this->_element_id == 42) {
$TableHeadTPL = parent::$page->get_template('infos/info_range_header');
$TableTPL = parent::$page->get_template('infos/info_range_body');
} elseif ($this->_element_id == 43) {
$GateTPL = parent::$page->get_template('infos/info_gate_table');
if ($_POST) {
Functions_Lib::message($this->DoFleetJump(), "game.php?page=infos&gid=43", 2);
}
} elseif ($this->_element_id == 124) {
$PageTPL = parent::$page->get_template('infos/info_buildings_table');
$DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
$TableHeadTPL = parent::$page->get_template('infos/info_astrophysics_header');
$TableTPL = parent::$page->get_template('infos/info_astrophysics_table');
$TableFooterTPL = parent::$page->get_template('infos/info_astrophysics_footer');
} elseif ($this->_element_id >= 202 && $this->_element_id <= 250) {
$PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
$parse['element_typ'] = $this->_lang['tech'][200];
$parse['rf_info_to'] = $this->ShowRapidFireTo();
$parse['rf_info_fr'] = $this->ShowRapidFireFrom();
$parse['hull_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
$parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
$parse['attack_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
$parse['capacity_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['capacity']);
$parse['base_speed'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed']);
$parse['base_conso'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption']);
if ($this->_element_id == 202) {
$parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
$parse['upd_conso'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption2']) . ")</font>";
} elseif ($this->_element_id == 211) {
$parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
}
} elseif ($this->_element_id >= 401 && $this->_element_id <= 550) {
$PageTPL = parent::$page->get_template('infos/info_buildings_defense');
$parse['element_typ'] = $this->_lang['tech'][400];
if ($this->_element_id < 500) {
$parse['rf_info_to'] = $this->ShowRapidFireTo();
$parse['rf_info_fr'] = $this->ShowRapidFireFrom();
}
$parse['hull_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
$parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
$parse['attack_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
}
if ($TableHeadTPL != '') {
$parse['table_head'] = parent::$page->parse_template($TableHeadTPL, $this->_lang);
if ($this->_element_id >= 22 && $this->_element_id <= 24) {
$parse['table_data'] = $this->storage_table($TableTPL);
} elseif ($this->_element_id == 124) {
$parse['table_data'] = $this->astrophysics_table($TableTPL);
} else {
$parse['table_data'] = $this->ShowProductionTable($TableTPL);
//.........这里部分代码省略.........
示例10: set_user_data
/**
* method set_user_data
* param
* return (void)
*/
private function set_user_data()
{
$user_row = array();
$this->_user_data = parent::$db->query("SELECT u.*,\n\t \t\t\t\t\t\t\t\t\t\t\tpre.*,\n\t \t\t\t\t\t\t\t\t\t\t\tse.*,\n\t \t\t\t\t\t\t\t\t\t\t\tusul.user_statistic_total_rank,\n\t \t\t\t\t\t\t\t\t\t\t\tusul.user_statistic_total_points,\n\t \t\t\t\t\t\t\t\t\t\t\tr.*,\n\t \t\t\t\t\t\t\t\t\t\t\ta.alliance_name,\n\t \t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(`message_id`) AS `new_message` FROM `" . MESSAGES . "` WHERE `message_receiver` = u.`user_id` AND `message_read` = 0) AS `new_message`\n\t \t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\n\t \t\t\t\t\t\t\t\t\tINNER JOIN " . SETTINGS . " AS se ON se.setting_user_id = u.user_id\n\t \t\t\tINNER JOIN " . USERS_STATISTICS . " AS usul ON usul.user_statistic_user_id = u.user_id\n\t \t\t\tINNER JOIN " . PREMIUM . " AS pre ON pre.premium_user_id = u.user_id\n\t \t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = u.user_id\n\t \t\t\tLEFT JOIN " . ALLIANCE . " AS a ON a.alliance_id = u.user_ally_id\n\t \t\t\t\t\t\t\t\t\tWHERE (u.user_name = '" . parent::$db->escape_value($_SESSION['user_name']) . "')\n\t \t\t\t\t\t\t\t\t\tLIMIT 1;");
if (parent::$db->num_rows($this->_user_data) != 1) {
Functions_Lib::message($this->_lang['ccs_multiple_users'], XGP_ROOT, 3, FALSE, FALSE);
}
$user_row = parent::$db->fetch_array($this->_user_data);
if ($user_row['user_id'] != $_SESSION['user_id']) {
Functions_Lib::message($this->_lang['ccs_other_user'], XGP_ROOT, 3, FALSE, FALSE);
}
if (sha1($user_row['user_password'] . "-" . SECRETWORD) != $_SESSION['user_password']) {
Functions_Lib::message($this->_lang['css_different_password'], XGP_ROOT, 5, FALSE, FALSE);
}
if ($user_row['user_banned'] > 0) {
$parse = $this->_lang;
$parse['banned_until'] = date(Functions_Lib::read_config('date_format_extended'), $user_row['user_banned']);
die(parent::$page->parse_template(parent::$page->get_template('home/banned_message'), $parse));
}
parent::$db->query("UPDATE " . USERS . " SET\n \t\t\t\t\t`user_onlinetime` = '" . time() . "',\n \t\t\t\t\t`user_current_page` = '" . parent::$db->escape_value($_SERVER['REQUEST_URI']) . "',\n \t\t\t\t\t`user_lastip` = '" . parent::$db->escape_value($_SERVER['REMOTE_ADDR']) . "',\n \t\t\t\t\t`user_agent` = '" . parent::$db->escape_value($_SERVER['HTTP_USER_AGENT']) . "'\n \t\t\t\t\tWHERE `user_id` = '" . parent::$db->escape_value($_SESSION['user_id']) . "'\n \t\t\t\t\tLIMIT 1;");
// pass the data
$this->_user_data = $user_row;
// unset the old data
unset($user_row);
}
示例11: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$mode = isset($_GET['mode']) ? intval($_GET['mode']) : NULL;
$bid = isset($_GET['bid']) ? intval($_GET['bid']) : NULL;
$sm = isset($_GET['sm']) ? intval($_GET['sm']) : NULL;
$user = isset($_GET['u']) ? intval($_GET['u']) : NULL;
$this->_lang['js_path'] = XGP_ROOT . JS_PATH;
$parse = $this->_lang;
$requestsSended = '';
$requestsReceived = '';
$budys = '';
switch ($mode) {
case 1:
switch ($sm) {
// REJECT / CANCEL
case 1:
$senderID = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "'");
if ($senderID['buddy_status'] == 0) {
if ($senderID['buddy_sender'] != $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_rejected_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_rejected_text']));
} elseif ($senderID['buddy_sender'] == $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_receiver'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_rejected_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_rejected_title']));
}
} else {
if ($senderID['buddy_sender'] != $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_deleted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_deleted_text']));
} elseif ($senderID['buddy_sender'] == $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_receiver'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_deleted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_deleted_text']));
}
}
parent::$db->query("DELETE FROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(`buddy_receiver`='" . $this->_current_user['user_id'] . "' OR `buddy_sender`='" . $this->_current_user['user_id'] . "') ");
Functions_Lib::redirect('game.php?page=buddy');
break;
// ACCEPT
// ACCEPT
case 2:
$senderID = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "'");
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_accepted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_accepted_text']));
parent::$db->query("UPDATE " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\tSET `buddy_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id` ='" . intval($bid) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . $this->_current_user['user_id'] . "'");
Functions_Lib::redirect('game.php?page=buddy');
break;
// SEND REQUEST
// SEND REQUEST
case 3:
$query = parent::$db->query_fetch("SELECT `buddy_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (`buddy_receiver`='" . intval($this->_current_user['user_id']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($_POST['user']) . "') OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(`buddy_receiver`='" . intval($_POST['user']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($this->_current_user['user_id']) . "')");
if (!$query) {
$text = parent::$db->escape_value(strip_tags($_POST['text']));
Functions_Lib::send_message(intval($_POST['user']), $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_to_accept_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_to_accept_text']));
parent::$db->query("INSERT INTO " . BUDDY . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($this->_current_user['user_id']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . intval($_POST['user']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_status`='0',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_request_text`='" . $text . "'");
Functions_Lib::redirect('game.php?page=buddy');
} else {
Functions_Lib::message($this->_lang['bu_request_exists'], 'game.php?page=buddy', 2, FALSE, FALSE, FALSE);
}
break;
// ANY OTHER OPTION EXIT
// ANY OTHER OPTION EXIT
default:
Functions_Lib::redirect('game.php?page=buddy');
break;
}
break;
// FRIENDSHIP REQUEST
// FRIENDSHIP REQUEST
case 2:
// IF USER = REQUESTED USER, SHOW ERROR.
if ($user == $this->_current_user['user_id']) {
Functions_Lib::message($this->_lang['bu_cannot_request_yourself'], 'game.php?page=buddy', 2, FALSE, FALSE, FALSE);
} else {
// SEARCH THE PLAYER
$player = parent::$db->query_fetch("SELECT `user_name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id`='" . intval($user) . "'");
// IF PLAYER EXISTS, PROCEED
if ($player) {
$parse['user'] = $user;
$parse['player'] = $player['user_name'];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buddy/buddy_request'), $parse), FALSE, '', FALSE);
} else {
Functions_Lib::redirect('game.php?page=buddy');
}
}
break;
// NOTHING SELECTED
// NOTHING SELECTED
default:
$getBuddys = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_sender`='" . intval($this->_current_user['user_id']) . "' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . intval($this->_current_user['user_id']) . "'");
$subTemplate = parent::$page->get_template('buddy/buddy_row');
while ($buddy = parent::$db->fetch_assoc($getBuddys)) {
if ($buddy['buddy_status'] == 0) {
if ($buddy['buddy_sender'] == $this->_current_user['user_id']) {
$buddy_receiver = parent::$db->query_fetch("SELECT u.`user_id`, u.`user_name`, u.`user_galaxy`, u.`user_system`, u.`user_planet`, u.`user_ally_id`, a.`alliance_name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . ALLIANCE . "` AS a ON a.`alliance_id` = u.`user_ally_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE u.`user_id`='" . intval($buddy['buddy_receiver']) . "'");
$parse['id'] = $buddy_receiver['user_id'];
$parse['username'] = $buddy_receiver['user_name'];
$parse['ally_id'] = $buddy_receiver['user_ally_id'];
$parse['alliance_name'] = $buddy_receiver['alliance_name'];
$parse['galaxy'] = $buddy_receiver['user_galaxy'];
$parse['system'] = $buddy_receiver['user_system'];
//.........这里部分代码省略.........
示例12: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$resource = parent::$objects->get_objects();
$pricelist = parent::$objects->get_price();
$reslist = parent::$objects->get_objects_list();
$parse = $this->_lang;
if (parent::$users->is_on_vacations($this->_current_user)) {
exit(Functions_Lib::message($this->_lang['fl_vacation_mode_active'], "game.php?page=overview", 2));
}
$fleet_group_mr = 0;
if ($_POST['fleet_group'] > 0) {
if ($_POST['mission'] == 2) {
$target = 'g' . (int) $_POST['galaxy'] . 's' . (int) $_POST['system'] . 'p' . (int) $_POST['planet'] . 't' . (int) $_POST['planettype'];
if ($_POST['acs_target_mr'] == $target) {
$aks_count_mr = parent::$db->query("SELECT COUNT(`acs_fleet_id`)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . ACS_FLEETS . "`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `acs_fleet_id` = '" . (int) $_POST['fleet_group'] . "'");
if ($aks_count_mr > 0) {
$fleet_group_mr = $_POST['fleet_group'];
}
}
}
}
if ($_POST['fleet_group'] == 0 && $_POST['mission'] == 2) {
$_POST['mission'] = 1;
}
$TargetPlanet = parent::$db->query_fetch("SELECT `planet_user_id`,`planet_destroyed`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . PLANETS . "`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE `planet_galaxy` = '" . (int) $_POST['galaxy'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t`planet_system` = '" . (int) $_POST['system'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t`planet_planet` = '" . (int) $_POST['planet'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t`planet_type` = '" . (int) $_POST['planettype'] . "';");
$MyDBRec = parent::$db->query_fetch("SELECT u.`user_id`, u.`user_onlinetime`, u.`user_ally_id`, s.`setting_vacations_status`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u, " . SETTINGS . " AS s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE u.`user_id` = '" . $this->_current_user['user_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND s.`setting_user_id` = '" . $this->_current_user['user_id'] . "';");
$fleetarray = unserialize(base64_decode(str_rot13($_POST['usedfleet'])));
if ($TargetPlanet['planet_destroyed'] != 0) {
Functions_Lib::redirect('game.php?page=movement');
}
if (!is_array($fleetarray)) {
Functions_Lib::redirect('game.php?page=movement');
}
foreach ($fleetarray as $Ship => $Count) {
$Count = intval($Count);
if ($Count > $this->_current_planet[$resource[$Ship]]) {
Functions_Lib::redirect('game.php?page=movement');
}
}
$error = 0;
$galaxy = (int) $_POST['galaxy'];
$system = (int) $_POST['system'];
$planet = (int) $_POST['planet'];
$planettype = (int) $_POST['planettype'];
$fleetmission = (int) $_POST['mission'];
//fix by jstar
if ($fleetmission == 7 && !isset($fleetarray[208])) {
Functions_Lib::redirect('game.php?page=movement');
}
if ($planettype != 1 && $planettype != 2 && $planettype != 3) {
Functions_Lib::redirect('game.php?page=movement');
}
//fix invisible debris like ogame by jstar
if ($fleetmission == 8) {
$YourPlanet = FALSE;
$UsedPlanet = FALSE;
$select = parent::$db->query_fetch("SELECT COUNT(*) AS count, p.*\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . PLANETS . "` AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = 1;");
if ($select['planet_debris_metal'] == 0 && $select['planet_debris_crystal'] == 0 && time() > $select['planet_invisible_start_time'] + DEBRIS_LIFE_TIME) {
Functions_Lib::redirect('game.php?page=movement');
}
} else {
$YourPlanet = FALSE;
$UsedPlanet = FALSE;
$select = parent::$db->query_fetch("SELECT COUNT(*) AS count, p.`planet_user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . PLANETS . "` AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = '" . $planettype . "'");
}
if ($this->_current_planet['planet_galaxy'] == $galaxy && $this->_current_planet['planet_system'] == $system && $this->_current_planet['planet_planet'] == $planet && $this->_current_planet['planet_type'] == $planettype) {
Functions_Lib::redirect('game.php?page=movement');
}
if ($_POST['mission'] != 15) {
if ($select['count'] < 1 && $fleetmission != 7) {
Functions_Lib::redirect('game.php?page=movement');
} elseif ($fleetmission == 9 && $select['count'] < 1) {
Functions_Lib::redirect('game.php?page=movement');
}
} else {
$MaxExpedition = $this->_current_user[$resource[124]];
if ($MaxExpedition >= 1) {
$maxexpde = parent::$db->query_fetch("SELECT COUNT(fleet_owner) AS `expedi`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `fleet_owner` = '" . $this->_current_user['user_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `fleet_mission` = '15';");
$ExpeditionEnCours = $maxexpde['expedi'];
$EnvoiMaxExpedition = Fleets_Lib::get_max_expeditions($MaxExpedition);
} else {
$ExpeditionEnCours = 0;
$EnvoiMaxExpedition = 0;
}
if ($EnvoiMaxExpedition == 0) {
Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_expedition_tech_required'] . "</b></font>", "game.php?page=movement", 2);
} elseif ($ExpeditionEnCours >= $EnvoiMaxExpedition) {
Functions_Lib::message("<font color=\"red\"><b>" . $this->_lang['fl_expedition_fleets_limit'] . "</b></font>", "game.php?page=movement", 2);
}
}
if ($select['planet_user_id'] == $this->_current_user['user_id']) {
$YourPlanet = TRUE;
$UsedPlanet = TRUE;
} elseif (!empty($select['planet_user_id'])) {
$YourPlanet = FALSE;
//.........这里部分代码省略.........
示例13: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$mode = isset($_GET['mode']) ? $_GET['mode'] : NULL;
if ($_POST && $mode == 'exit') {
if (isset($_POST['exit_modus']) && $_POST['exit_modus'] == 'on' and $this->_current_user['setting_vacations_until'] <= time()) {
$urlaubs_modus = '0';
parent::$db->query("UPDATE " . SETTINGS . ", " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_status` = '0',\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_until` = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_metal_mine_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_crystal_mine_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_deuterium_sintetizer_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_solar_plant_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_fusion_reactor_porcent = '10',\r\n\t\t\t\t\t\t\t\t\t\tplanet_ship_solar_satellite_porcent = '10'\r\n\t\t\t\t\t\t\t\t\t\tWHERE `setting_user_id` = '" . intval($this->_current_user['user_id']) . "' AND planet_user_id = '" . intval($this->_current_user['user_id']) . "'");
Functions_Lib::redirect('game.php?page=options');
} else {
$urlaubs_modus = '1';
Functions_Lib::redirect('game.php?page=options');
}
}
if ($_POST && $mode == "change") {
// < ------------------------------------------------- COMPROBACION DE IP -------------------------------------------------- >
if (isset($_POST['noipcheck']) && $_POST['noipcheck'] == 'on') {
$noipcheck = '1';
} else {
$noipcheck = '0';
}
// < ------------------------------------------------- NOMBRE DE USUARIO --------------------------------------------------- >
if (isset($_POST['db_character']) && $_POST['db_character'] != '') {
$username = parent::$db->escape_value($_POST['db_character']);
} else {
$username = parent::$db->escape_value($this->_current_user['user_name']);
}
// < ------------------------------------------------- DIRECCION DE EMAIL -------------------------------------------------- >
if (isset($_POST['db_email']) && $_POST['db_email'] != '') {
$db_email = parent::$db->escape_value($_POST['db_email']);
} else {
$db_email = parent::$db->escape_value($this->_current_user['user_email']);
}
// < ------------------------------------------------- CANTIDAD DE SONDAS -------------------------------------------------- >
if (isset($_POST['spio_anz']) && is_numeric($_POST['spio_anz'])) {
$spio_anz = intval($_POST['spio_anz']);
} else {
$spio_anz = '1';
}
// < ------------------------------------------------- MENSAJES DE FLOTAS -------------------------------------------------- >
if (isset($_POST['settings_fleetactions']) && is_numeric($_POST['settings_fleetactions'])) {
$settings_fleetactions = intval($_POST['settings_fleetactions']);
} else {
$settings_fleetactions = '1';
}
// < ------------------------------------------------- SONDAS DE ESPIONAJE ------------------------------------------------- >
if (isset($_POST['settings_esp']) && $_POST['settings_esp'] == 'on') {
$settings_esp = '1';
} else {
$settings_esp = '0';
}
// < ------------------------------------------------- ESCRIBIR MENSAJE ---------------------------------------------------- >
if (isset($_POST['settings_wri']) && $_POST['settings_wri'] == 'on') {
$settings_wri = '1';
} else {
$settings_wri = '0';
}
// < --------------------------------------------- AÑADIR A LISTA DE AMIGOS ------------------------------------------------ >
if (isset($_POST['settings_bud']) && $_POST['settings_bud'] == 'on') {
$settings_bud = '1';
} else {
$settings_bud = '0';
}
// < ------------------------------------------------- ATAQUE CON MISILES -------------------------------------------------- >
if (isset($_POST['settings_mis']) && $_POST['settings_mis'] == 'on') {
$settings_mis = '1';
} else {
$settings_mis = '0';
}
// < ------------------------------------------------- VER REPORTE --------------------------------------------------------- >
if (isset($_POST['settings_rep']) && $_POST['settings_rep'] == 'on') {
$settings_rep = '1';
} else {
$settings_rep = '0';
}
// < ------------------------------------------------- MODO VACACIONES ----------------------------------------------------- >
if (isset($_POST['urlaubs_modus']) && $_POST['urlaubs_modus'] == 'on') {
if ($this->CheckIfIsBuilding()) {
Functions_Lib::message($this->_lang['op_cant_activate_vacation_mode'], "game.php?page=options", 2);
}
$urlaubs_modus = '1';
$time = Functions_Lib::get_default_vacation_time();
parent::$db->query("UPDATE " . SETTINGS . ", " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_status` = '{$urlaubs_modus}',\r\n\t\t\t\t\t\t\t\t\t\t`setting_vacations_until` = '{$time}',\r\n\t\t\t\t\t\t\t\t\t\tplanet_metal_perhour = '" . Functions_Lib::read_config('metal_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_crystal_perhour = '" . Functions_Lib::read_config('crystal_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_deuterium_perhour = '" . Functions_Lib::read_config('deuterium_basic_income') . "',\r\n\t\t\t\t\t\t\t\t\t\tplanet_energy_used = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_energy_max = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_metal_mine_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_crystal_mine_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_deuterium_sintetizer_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_solar_plant_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_building_fusion_reactor_porcent = '0',\r\n\t\t\t\t\t\t\t\t\t\tplanet_ship_solar_satellite_porcent = '0'\r\n\t\t\t\t\t\t\t\t\t\tWHERE `setting_user_id` = '" . intval($this->_current_user['user_id']) . "' AND planet_user_id = '" . intval($this->_current_user['user_id']) . "'");
} else {
$urlaubs_modus = '0';
}
// < ------------------------------------------------- BORRAR CUENTA ------------------------------------------------------- >
if (isset($_POST['db_deaktjava']) && $_POST['db_deaktjava'] == 'on') {
$db_deaktjava = time();
} else {
$db_deaktjava = '0';
}
$SetSort = parent::$db->escape_value($_POST['settings_sort']);
$SetOrder = parent::$db->escape_value($_POST['settings_order']);
//// < -------------------------------------- ACTUALIZAR TODO LO SETEADO ANTES --------------------------------------------- >
parent::$db->query("UPDATE " . USERS . " AS u, " . SETTINGS . " AS s SET\r\n\t\t\t\t\t\t\t\t\tu.`user_email` = '{$db_email}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_no_ip_check` = '{$noipcheck}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_sort` = '{$SetSort}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_planet_order` = '{$SetOrder}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_probes_amount` = '{$spio_anz}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_fleet_actions` = '{$settings_fleetactions}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_espionage` = '{$settings_esp}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_write` = '{$settings_wri}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_buddy` = '{$settings_bud}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_galaxy_missile` = '{$settings_mis}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_vacations_status` = '{$urlaubs_modus}',\r\n\t\t\t\t\t\t\t\t\ts.`setting_delete_account` = '{$db_deaktjava}'\r\n\t\t\t\t\t\t\t\t\tWHERE u.`user_id` = '" . $this->_current_user['user_id'] . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\ts.`setting_user_id` = '" . $this->_current_user['user_id'] . "'");
//.........这里部分代码省略.........
示例14: build_page
public function build_page()
{
$parse = $this->_lang;
if (isset($_POST['fmenge'])) {
$Missiles[502] = $this->_current_planet[$this->_resource[502]];
$Missiles[503] = $this->_current_planet[$this->_resource[503]];
$SiloSize = $this->_current_planet[$this->_resource[44]];
$MaxMissiles = $SiloSize * 10;
$BuildQueue = $this->_current_planet['planet_b_hangar_id'];
$BuildArray = explode(";", $BuildQueue);
$totalCount = 0;
for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
$ElmentArray = explode(",", $BuildArray[$QElement]);
if ($ElmentArray[0] == 502) {
$Missiles[502] += $ElmentArray[1];
} elseif ($ElmentArray[0] == 503) {
$Missiles[503] += $ElmentArray[1];
}
}
foreach ($_POST['fmenge'] as $Element => $Count) {
if ($Element < 300 or $Element > 550) {
continue;
}
$Element = (int) $Element;
$Count = (int) $Count;
$totalCount += $Count;
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
if ($Element == 407 or $Element == 408) {
if (!$this->is_shield_in_queue($BuildQueue, $Element)) {
$Count = 1;
} else {
$Count = 0;
}
}
if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $Element)) {
$MaxElements = $this->GetMaxConstructibleElements($Element, $this->_current_planet);
if ($Element == 502 || $Element == 503) {
$ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
$MissilesSpace = $MaxMissiles - $ActuMissiles;
if ($Element == 502) {
if ($Count > $MissilesSpace) {
$Count = $MissilesSpace;
}
} else {
if ($Count > floor($MissilesSpace / 2)) {
$Count = floor($MissilesSpace / 2);
}
}
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Missiles[$Element] += $Count;
} else {
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
}
$Ressource = $this->GetElementRessources($Element, $Count);
if ($Count >= 1) {
$this->_current_planet['planet_metal'] -= $Ressource['metal'];
$this->_current_planet['planet_crystal'] -= $Ressource['crystal'];
$this->_current_planet['planet_deuterium'] -= $Ressource['deuterium'];
$this->_current_planet['planet_b_hangar_id'] .= '' . $Element . ',' . $Count . ';';
}
}
}
}
if ($totalCount > 0) {
parent::$db->query("UPDATE " . PLANETS . " AS p SET\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_b_hangar_id` = '" . $this->_current_planet['planet_b_hangar_id'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_metal` = '" . $this->_current_planet['planet_metal'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_crystal` = '" . $this->_current_planet['planet_crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t\tp.`planet_deuterium` = '" . $this->_current_planet['planet_deuterium'] . "'\r\n\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_id` = '" . $this->_current_planet['planet_id'] . "';");
}
Functions_Lib::redirect('game.php?page=defense');
}
if ($this->_current_planet[$this->_resource[21]] == 0) {
Functions_Lib::message($this->_lang['bd_shipyard_required'], '', '', TRUE);
}
$NotBuilding = TRUE;
if ($this->_current_planet['planet_b_building_id'] != 0) {
$CurrentQueue = $this->_current_planet['planet_b_building_id'];
if (strpos($CurrentQueue, ";")) {
// FIX BY LUCKY - IF THE SHIPYARD IS IN QUEUE THE USER CANT RESEARCH ANYTHING...
$QueueArray = explode(";", $CurrentQueue);
for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
$ListIDArray = explode(",", $QueueArray[$i]);
$Element = $ListIDArray[0];
if ($Element == 21 or $Element == 14 or $Element == 15) {
break;
}
}
// END - FIX
} else {
$CurrentBuilding = $CurrentQueue;
}
if ($CurrentBuilding == 21 or $CurrentBuilding == 14 or $CurrentBuilding == 15 or ($Element == 21 or $Element == 14 or $Element == 15)) {
$parse['message'] = "<font color=\"red\">" . $this->_lang['bd_building_shipyard'] . "</font>";
$NotBuilding = FALSE;
}
}
//.........这里部分代码省略.........
示例15: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
if ($this->_current_user['premium_dark_matter'] < $this->_tr_dark_matter) {
Functions_Lib::message(str_replace('%s', $this->_tr_dark_matter, $this->_lang['tr_darkmatter_needed']), '', '', TRUE);
die;
}
if (isset($_POST['ress']) && $_POST['ress'] != '') {
switch ($_POST['ress']) {
case 'metal':
if ($_POST['cristal'] < 0 or $_POST['deut'] < 0) {
Functions_Lib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
} else {
$necessaire = $_POST['cristal'] * 2 + $_POST['deut'] * 4;
$amout = array('metal' => 0, 'crystal' => $_POST['cristal'], 'deuterium' => $_POST['deut']);
$storage = $this->check_storage($amout);
if (is_string($storage)) {
die(Functions_Lib::message($storage, 'game.php?page=trader', '2'));
}
if ($this->_current_planet['planet_metal'] > $necessaire) {
parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` - " . round($necessaire) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` + " . round($_POST['cristal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` + " . round($_POST['deut']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
$this->_current_planet['planet_metal'] -= $necessaire;
$this->_current_planet['planet_crystal'] += isset($_POST['cristal']) ? $_POST['cristal'] : 0;
$this->_current_planet['planet_deuterium'] += isset($_POST['deut']) ? $_POST['deut'] : 0;
$this->discount_dark_matter();
// REDUCE DARKMATTER
} else {
Functions_Lib::message($this->_lang['tr_not_enought_metal'], "game.php?page=trader", 1);
}
}
break;
case 'cristal':
if ($_POST['metal'] < 0 or $_POST['deut'] < 0) {
Functions_Lib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
} else {
$necessaire = abs($_POST['metal']) * 0.5 + abs($_POST['deut']) * 2;
$amout = array('metal' => $_POST['metal'], 'crystal' => 0, 'deuterium' => $_POST['deut']);
$storage = $this->check_storage($amout);
if (is_string($storage)) {
die(Functions_Lib::message($storage, 'game.php?page=trader', '2'));
}
if ($this->_current_planet['planet_crystal'] > $necessaire) {
parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` + " . round($_POST['metal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` - " . round($necessaire) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` + " . round($_POST['deut']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
$this->_current_planet['planet_metal'] += isset($_POST['metal']) ? $_POST['metal'] : 0;
$this->_current_planet['planet_crystal'] -= $necessaire;
$this->_current_planet['planet_deuterium'] += isset($_POST['deut']) ? $_POST['deut'] : 0;
$this->discount_dark_matter($this->_current_user);
// REDUCE DARKMATTER
} else {
Functions_Lib::message($this->_lang['tr_not_enought_crystal'], "game.php?page=trader", 1);
}
}
break;
case 'deuterium':
if ($_POST['cristal'] < 0 or $_POST['metal'] < 0) {
Functions_Lib::message($this->_lang['tr_only_positive_numbers'], "game.php?page=trader", 1);
} else {
$necessaire = abs($_POST['metal']) * 0.25 + abs($_POST['cristal']) * 0.5;
$amout = array('metal' => $_POST['metal'], 'crystal' => $_POST['cristal'], 'deuterium' => 0);
$storage = $this->check_storage($amout);
if (is_string($storage)) {
die(message($storage, 'game.php?page=trader', '2'));
}
if ($this->_current_planet['planet_deuterium'] > $necessaire) {
parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` + " . round($_POST['metal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` + " . round($_POST['cristal']) . ",\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` - " . round($necessaire) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';");
$this->_current_planet['planet_metal'] += isset($_POST['metal']) ? $_POST['metal'] : 0;
$this->_current_planet['planet_crystal'] += isset($_POST['cristal']) ? $_POST['cristal'] : 0;
$this->_current_planet['planet_deuterium'] -= $necessaire;
$this->discount_dark_matter($this->_current_user);
// REDUCE DARKMATTER
} else {
Functions_Lib::message($this->_lang['tr_not_enought_deuterium'], "game.php?page=trader", 1);
}
}
break;
}
Functions_Lib::message($this->_lang['tr_exchange_done'], "game.php?page=trader", 1);
} else {
$template = parent::$page->get_template('trader/trader_main');
if (isset($_POST['action'])) {
$parse['mod_ma_res'] = '1';
switch (isset($_POST['choix']) ? $_POST['choix'] : NULL) {
case 'metal':
$template = parent::$page->get_template('trader/trader_metal');
$parse['mod_ma_res_a'] = '2';
$parse['mod_ma_res_b'] = '4';
break;
case 'cristal':
$template = parent::$page->get_template('trader/trader_cristal');
$parse['mod_ma_res_a'] = '0.5';
$parse['mod_ma_res_b'] = '2';
break;
case 'deut':
$template = parent::$page->get_template('trader/trader_deuterium');
$parse['mod_ma_res_a'] = '0.25';
//.........这里部分代码省略.........