本文整理汇总了PHP中Functions_Lib::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::redirect方法的具体用法?PHP Functions_Lib::redirect怎么用?PHP Functions_Lib::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
if ($_POST) {
$login = parent::$db->query_fetch("SELECT `user_id`, `user_name`, `user_password`, `user_banned`\n\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\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['login']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `user_password` = '" . sha1($_POST['pass']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1");
if ($login['user_banned'] <= time()) {
$this->remove_ban($login['user_name']);
}
if ($login) {
// User login
if (parent::$users->user_login($login['user_id'], $login['user_name'], $login['user_password'])) {
// Update current planet
parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`user_current_planet` = `user_home_planet_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` ='" . $login['user_id'] . "'");
// Redirect to game
Functions_Lib::redirect('game.php?page=overview');
}
}
// If login fails
Functions_Lib::redirect('index.php');
} else {
$parse['year'] = date('Y');
$parse['version'] = VERSION;
$parse['servername'] = Functions_Lib::read_config('game_name');
$parse['game_logo'] = Functions_Lib::read_config('game_logo');
$parse['forum_url'] = Functions_Lib::read_config('forum_url');
$parse['js_path'] = JS_PATH . 'home/';
$parse['css_path'] = CSS_PATH . 'home/';
$parse['img_path'] = IMG_PATH . 'home/';
$parse['base_path'] = BASE_PATH;
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('home/index_body'), $parse), FALSE, '', FALSE);
}
}
示例2: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$load_template = parent::$page->get_template('adm/errors_row_view');
$deleteall = isset($_GET['deleteall']) ? $_GET['deleteall'] : '';
$file = XGP_ROOT . LOGS_PATH . 'ErrorLog.php';
$errors_all = file_get_contents($file);
$i = 0;
$parse['errors_list'] = '';
if ($errors_all != "") {
$errors_all = explode('||', $errors_all);
foreach ($errors_all as $error) {
$errors_row = explode('|', $error);
if (isset($errors_row[3])) {
$i++;
$parse['errors_list'] .= parent::$page->parse_template($load_template, $errors_row);
}
}
}
$parse['errors_list_resume'] = $i . $this->_lang['er_errors'];
if ($deleteall == 'yes') {
$fh = fopen($file, 'w');
fclose($fh);
Functions_Lib::redirect('admin.php?page=errors');
}
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/errors_view'), $parse));
}
示例3: build_page
/**
* method build_page
* param
* return the statistics page
*/
private function build_page()
{
$parse = $this->_lang;
$parse['dpath'] = DPATH;
$bloc = $this->_lang;
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$time = isset($_GET['time']) ? $_GET['time'] : '';
if ($mode == 2 && ($time == 'month' or $time == 'week')) {
$Selected = $_GET['offi'];
$time = 'darkmatter_' . $time;
$set_time = $time == 'darkmatter_month' ? 3600 * 24 * 30 * 3 : 3600 * 24 * 7;
if (in_array($Selected, $this->_reslist['officier'])) {
$Result = $this->is_officier_accesible($Selected, $time);
$Price = $this->get_officier_price($Selected, $time);
if ($Result !== FALSE) {
$this->_current_user['premium_dark_matter'] -= $Price;
// IF THE OFFICIER IS ACTIVE
if (Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Selected]])) {
$this->_current_user[$this->_resource[$Selected]] += $set_time;
// ADD TIME
} else {
$this->_current_user[$this->_resource[$Selected]] = time() + $set_time;
// SET TIME
}
parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_dark_matter` = '" . $this->_current_user['premium_dark_matter'] . "',\n\t\t\t\t\t\t\t\t\t\t\t`" . $this->_resource[$Selected] . "` = '" . $this->_current_user[$this->_resource[$Selected]] . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `premium_user_id` = '" . $this->_current_user['user_id'] . "';");
}
}
Functions_Lib::redirect('game.php?page=officier');
} else {
$OfficierRowTPL = parent::$page->get_template('officier/officier_row');
$parse['disp_off_tbl'] = '';
$parse['premium_pay_url'] = Functions_Lib::read_config('premium_url') != '' ? Functions_Lib::read_config('premium_url') : 'game.php?page=officier';
foreach ($this->_lang['tech'] as $Element => $ElementName) {
if ($Element >= 601 && $Element <= 605) {
$bloc['dpath'] = DPATH;
$bloc['off_id'] = $Element;
$bloc['off_status'] = Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Element]]) ? '<font color=lime>' . $this->_lang['of_active'] . ' ' . date(Functions_Lib::read_config('date_format'), $this->_current_user[$this->_resource[$Element]]) . '</font>' : '<font color=red>' . $this->_lang['of_inactive'] . '</font>';
$bloc['off_name'] = $ElementName;
$bloc['off_desc'] = $this->_lang['res']['descriptions'][$Element];
$bloc['off_desc_short'] = $this->_lang['info'][$Element]['description'];
$bloc['month_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_month'));
$bloc['week_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_week'));
$bloc['img_big'] = $this->get_officier_image($Element, 'img_big');
$bloc['img_small'] = $this->get_officier_image($Element, 'img_small');
$bloc['off_link_month'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=month";
$bloc['off_link_week'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=week";
$parse['disp_off_tbl'] .= parent::$page->parse_template($OfficierRowTPL, $bloc);
}
}
}
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('officier/officier_table'), $parse));
}
示例4: __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->_lang = parent::$lang;
$this->_current_user = parent::$users->get_user_data();
if (!Officiers_Lib::is_officier_active($this->_current_user['premium_officier_commander'])) {
Functions_Lib::redirect('game.php?page=officier');
} else {
$this->build_page();
}
}
示例5: do_command
/**
* method do_command
* param
* return void
*/
private function do_command()
{
$cmd = isset($_GET['cmd']) ? $_GET['cmd'] : NULL;
if (!is_null($cmd)) {
$technology = (int) $_GET['tech'];
if (in_array($technology, $this->_reslist['tech'])) {
if (is_array($this->_is_working['working_on'])) {
$working_planet = $this->_is_working['working_on'];
} else {
$working_planet = $this->_current_planet;
}
switch ($cmd) {
// cancel a research
case 'cancel':
if ($this->_is_working['working_on']['planet_b_tech_id'] == $technology) {
$costs = Developments_Lib::development_price($this->_current_user, $working_planet, $technology);
$working_planet['planet_metal'] += $costs['metal'];
$working_planet['planet_crystal'] += $costs['crystal'];
$working_planet['planet_deuterium'] += $costs['deuterium'];
$working_planet['planet_b_tech_id'] = 0;
$working_planet['planet_b_tech'] = 0;
$this->_current_user['research_current_research'] = 0;
$update_data = TRUE;
$this->_is_working['is_working'] = FALSE;
}
break;
// start a research
// start a research
case 'search':
if (Developments_Lib::is_development_allowed($this->_current_user, $working_planet, $technology) && Developments_Lib::is_development_payable($this->_current_user, $working_planet, $technology) && !parent::$users->is_on_vacations($this->_current_user)) {
$costs = Developments_Lib::development_price($this->_current_user, $working_planet, $technology);
$working_planet['planet_metal'] -= $costs['metal'];
$working_planet['planet_crystal'] -= $costs['crystal'];
$working_planet['planet_deuterium'] -= $costs['deuterium'];
$working_planet['planet_b_tech_id'] = $technology;
$working_planet['planet_b_tech'] = time() + Developments_Lib::development_time($this->_current_user, $working_planet, $technology, FALSE, $this->_lab_level);
$this->_current_user['research_current_research'] = $working_planet['id'];
$update_data = TRUE;
$this->_is_working['is_working'] = TRUE;
}
break;
}
if ($update_data == TRUE) {
parent::$db->query("UPDATE " . PLANETS . " AS p, " . RESEARCH . " AS r SET\r\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_b_tech_id` = '" . $working_planet['planet_b_tech_id'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_b_tech` = '" . $working_planet['planet_b_tech'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_metal` = '" . $working_planet['planet_metal'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_crystal` = '" . $working_planet['planet_crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_deuterium` = '" . $working_planet['planet_deuterium'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\tr.`research_current_research` = '" . $this->_current_user['research_current_research'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_id` = '" . $working_planet['planet_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND r.`research_user_id` = '" . $this->_current_user['user_id'] . "';");
}
$this->_current_planet = $working_planet;
if (is_array($this->_is_working['working_on'])) {
$this->_is_working['working_on'] = $working_planet;
} else {
$this->_current_planet = $working_planet;
if ($cmd == 'search') {
$this->_is_working['working_on'] = $this->_current_planet;
}
}
}
Functions_Lib::redirect('game.php?page=research');
}
}
示例6: check_session
/**
* method check_session
* param
* return (void)
*/
public function check_session()
{
if (!$this->is_session_set()) {
Functions_Lib::redirect(XGP_ROOT);
}
}
示例7: CombatReport
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'CombatReport':
include_once XGP_ROOT . GAME_PATH . 'combatreport.php';
new CombatReport();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'infos':
include_once XGP_ROOT . GAME_PATH . 'infos.php';
new Infos();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'logout':
$session->delete();
Functions_Lib::redirect(XGP_ROOT);
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
default:
if (!isset($_GET['page'])) {
Functions_Lib::redirect('game.php?page=overview');
}
if (!$hooks->call_hook('new_page')) {
Functions_Lib::redirect('game.php?page=overview');
}
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
}
/* end of game.php */
示例8: deleteFleetShortcuts
private function deleteFleetShortcuts($id)
{
$scarray = explode(";", $this->_current_user['user_fleet_shortcuts']);
unset($scarray[$id]);
$this->_current_user['user_fleet_shortcuts'] = implode(";", $scarray);
parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\tuser_fleet_shortcuts='" . $this->_current_user['user_fleet_shortcuts'] . "'\n\t\t\t\t\t\t\tWHERE user_id=" . $this->_current_user['user_id']);
Functions_Lib::redirect('game.php?page=shortcuts');
}
示例9: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
// some values by default
$parse = $this->_lang;
$parse['js_path'] = XGP_ROOT . JS_PATH;
// display an specific category of items
if (isset($_GET['dsp']) && $_GET['dsp'] == 1 && $this->_have_premium) {
$mode = '';
$get_messages = '';
foreach ($_GET as $field => $value) {
if (Functions_Lib::in_multiarray($field, $this->_message_type)) {
$type_id = Functions_lib::recursive_array_search($field, $this->_message_type);
$get_messages .= $type_id . ',';
$active[$type_id] = 1;
}
}
// get list of messages
$message_list = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . MESSAGES . "`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `message_receiver` = " . $this->_current_user['user_id'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `message_type` IN (" . rtrim($get_messages, ',') . ");");
// set messages as read
parent::$db->query("UPDATE `" . MESSAGES . "`\n\t\t\t\t\t\t\t\t\tSET `message_read` = '1'\n\t\t\t\t\t\t\t\t\tWHERE `message_receiver` = " . $this->_current_user['user_id'] . "\n\t\t\t\t\t\t\t\t\t\tAND `message_type` IN (" . rtrim($get_messages, ',') . ");");
} else {
$mode = isset($_GET['mode']) ? $_GET['mode'] : NULL;
}
// to delete something
$to_delete = isset($_POST['deletemessages']) ? $_POST['deletemessages'] : NULL;
if (isset($to_delete)) {
$mode = "delete";
}
$write_to = isset($_GET['id']) ? (int) $_GET['id'] : NULL;
switch ($mode) {
case 'write':
$text = '';
$error_page = '';
if (!is_numeric($write_to)) {
Functions_Lib::redirect('game.php?page=messages');
} else {
$OwnerHome = parent::$db->query_fetch("SELECT u.`user_name`, p.`planet_galaxy`, p.`planet_system`, p.`planet_planet`\n\t\t\t\t\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\t\t\t\t\tINNER JOIN " . USERS . " as u ON p.planet_user_id = u.user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_user_id` = '" . (int) $write_to . "';");
if (!$OwnerHome) {
Functions_Lib::redirect('game.php?page=messages');
}
}
if ($_POST) {
$error = 0;
if (!$_POST['subject']) {
$error++;
$parse['error_text'] = $this->_lang['mg_no_subject'];
$parse['error_color'] = '#FF0000';
$error_page = parent::$page->parse_template(parent::$page->get_template('messages/messages_error_table'), $parse);
}
if (!$_POST['text']) {
$error++;
$parse['error_text'] = $this->_lang['mg_no_text'];
$parse['error_color'] = '#FF0000';
$error_page = parent::$page->parse_template(parent::$page->get_template('messages/messages_error_table'), $parse);
}
if ($error == 0) {
$parse['error_text'] = $this->_lang['mg_msg_sended'];
$parse['error_color'] = '#00FF00';
$error_page = parent::$page->parse_template(parent::$page->get_template('messages/messages_error_table'), $parse);
$Owner = $write_to;
$Sender = $this->_current_user['user_id'];
$From = $this->_current_user['user_name'] . ' [' . $this->_current_user['user_galaxy'] . ':' . $this->_current_user['user_system'] . ':' . $this->_current_user['user_planet'] . ']';
$Subject = $_POST['subject'];
$Message = Functions_Lib::format_text($_POST['text']);
Functions_Lib::send_message($Owner, $Sender, '', 4, $From, $Subject, $Message);
$subject = '';
$text = '';
}
}
$parse['id'] = $write_to;
$parse['to'] = $OwnerHome['user_name'] . ' [' . $OwnerHome['planet_galaxy'] . ':' . $OwnerHome['planet_system'] . ':' . $OwnerHome['planet_planet'] . ']';
$parse['subject'] = !isset($subject) ? $this->_lang['mg_no_subject'] : $subject;
$parse['text'] = $text;
$parse['status_message'] = $error_page;
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('messages/messages_pm_form_view'), $parse));
break;
case 'delete':
if ($to_delete == 'deleteall') {
parent::$db->query("DELETE FROM " . MESSAGES . "\n\t\t\t\t\t\t\t\t\t\tWHERE `message_receiver` = '" . $this->_current_user['user_id'] . "';");
} elseif ($to_delete == 'deletemarked') {
foreach ($_POST as $Message => $Answer) {
if (preg_match("/delmes/i", $Message) && $Answer == 'on') {
$MessId = str_replace("delmes", "", $Message);
$MessHere = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . MESSAGES . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `message_id` = '" . (int) $MessId . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`message_receiver` = '" . $this->_current_user['user_id'] . "';");
if ($MessHere) {
parent::$db->query("DELETE FROM " . MESSAGES . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `message_id` = '" . (int) $MessId . "';");
}
}
}
} elseif ($to_delete == 'deleteunmarked') {
foreach ($_POST as $Message => $Answer) {
$CurMess = preg_match("/showmes/i", $Message);
$MessId = str_replace("showmes", "", $Message);
$Selected = "delmes" . $MessId;
$IsSelected = $_POST[$Selected];
//.........这里部分代码省略.........
示例10: Reset
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'reset':
include_once XGP_ROOT . ADMIN_PATH . 'reset.php';
new Reset();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'queries':
include_once XGP_ROOT . ADMIN_PATH . 'queries.php';
new Queries();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'logout':
Functions_Lib::redirect(XGP_ROOT . 'game.php?page=overview');
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'server':
include_once XGP_ROOT . ADMIN_PATH . 'server.php';
new Server();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
case 'modules':
include_once XGP_ROOT . ADMIN_PATH . 'modules.php';
new Modules();
break;
// ----------------------------------------------------------------------------------------------------------------------------------------------//
// ----------------------------------------------------------------------------------------------------------------------------------------------//
示例11: show_ban
/**
* method show_ban
* param
* return build the ban page
*/
private function show_ban()
{
$parse = $this->_lang;
$parse['js_path'] = XGP_ROOT . JS_PATH;
$ban_name = isset($_GET['ban_name']) ? parent::$db->escape_value($_GET['ban_name']) : NULL;
if (isset($_GET['banuser']) && isset($_GET['ban_name'])) {
$parse['name'] = $ban_name;
$parse['banned_until'] = '';
$parse['changedate'] = $this->_lang['bn_auto_lift_ban_message'];
$parse['vacation'] = '';
$banned_user = parent::$db->query_fetch("SELECT b.*, s.`setting_user_id`, s.`setting_vacations_status`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . BANNED . "` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN `" . SETTINGS . "` AS s\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON s.`setting_user_id` = (SELECT `user_id`\n\t\t\t\t\t\t\t\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\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . $ban_name . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `banned_who` = '" . $ban_name . "'");
if ($banned_user) {
$parse['banned_until'] = $this->_lang['bn_banned_until'] . ' (' . date(Functions_Lib::read_config('date_format_extended'), $banned_user['banned_longer']) . ')';
$parse['reason'] = $banned_user['banned_theme'];
$parse['changedate'] = '<div style="float:left">' . $this->_lang['bn_change_date'] . '</div><div style="float:right">' . Administration_Lib::show_pop_up($this->_lang['bn_edit_ban_help']) . '</div>';
}
$parse['vacation'] = $banned_user['setting_vacations_status'] ? 'checked="checked"' : '';
if (isset($_POST['bannow']) && $_POST['bannow']) {
if (!is_numeric($_POST['days']) or !is_numeric($_POST['hour'])) {
$parse['alert'] = Administration_Lib::save_message('warning', $this->_lang['bn_all_fields_required']);
} else {
$reas = (string) $_POST['why'];
$days = (int) $_POST['days'];
$hour = (int) $_POST['hour'];
$admin_name = $this->_current_user['user_name'];
$admin_mail = $this->_current_user['user_email'];
$current_time = time();
$ban_time = $days * 86400;
$ban_time += $hour * 3600;
if ($banned_user['banned_longer'] > time()) {
$ban_time += $banned_user['banned_longer'] - time();
}
if ($ban_time + $current_time < time()) {
$banned_until = $current_time;
} else {
$banned_until = $current_time + $ban_time;
}
if ($banned_user) {
parent::$db->query("UPDATE " . BANNED . " SET\n\t\t\t\t\t\t\t\t\t\t\t`banned_who` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_theme` = '" . $reas . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_who2` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_time` = '" . $current_time . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_longer` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_author` = '" . $admin_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_email` = '" . $admin_mail . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `banned_who2` = '" . $ban_name . "';");
} else {
parent::$db->query("INSERT INTO " . BANNED . " SET\n\t\t\t\t\t\t\t\t\t\t\t`banned_who` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_theme` = '" . $reas . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_who2` = '" . $ban_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_time` = '" . $current_time . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_longer` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_author` = '" . $admin_name . "',\n\t\t\t\t\t\t\t\t\t\t\t`banned_email` = '" . $admin_mail . "';");
}
$user_id = parent::$db->query_fetch("SELECT `user_id`\n\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\tWHERE `user_name` = '" . $ban_name . "' LIMIT 1");
parent::$db->query("UPDATE " . USERS . " AS u, " . SETTINGS . " AS s, " . PLANETS . " AS p SET\n\t\t\t\t\t\t\t\t\t\t\tu.`user_banned` = '" . $banned_until . "',\n\t\t\t\t\t\t\t\t\t\t\ts.`setting_vacations_status` = '" . (isset($_POST['vacat']) ? 1 : 0) . "',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_metal_mine_porcent` = '0',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_crystal_mine_porcent` = '0',\n\t\t\t\t\t\t\t\t\t\t\tp.`planet_building_deuterium_sintetizer_porcent` = '0'\n\t\t\t\t\t\t\t\t\t\t\tWHERE u.`user_id` = " . $user_id['user_id'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND s.`setting_user_id` = " . $user_id['user_id'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND p.`planet_user_id` = " . $user_id['user_id'] . ";");
$parse['alert'] = Administration_Lib::save_message('ok', str_replace('%s', $ban_name, $this->_lang['bn_ban_success']));
}
}
} else {
Functions_Lib::redirect('admin.php?page=ban');
}
return parent::$page->parse_template(parent::$page->get_template("adm/ban_result_view"), $parse);
}
示例12: install_navbar
/**
* method install_navbar
* param
* return install navigation bar
*/
private function install_navbar()
{
// Update config language to the new setted value
if (isset($_POST['language'])) {
Functions_Lib::update_config('lang', $_POST['language']);
Functions_Lib::redirect(XGP_ROOT . 'install/');
}
$current_page = isset($_GET['page']) ? $_GET['page'] : NULL;
$items = '';
$pages = array(0 => array('install', $this->_lang['ins_overview'], 'overview'), 1 => array('install', $this->_lang['ins_license'], 'license'), 2 => array('install', $this->_lang['ins_install'], 'step1'), 3 => array('update', $this->_lang['ins_update'], ''), 4 => array('migrate', $this->_lang['ins_migrate'], ''));
// BUILD THE MENU
foreach ($pages as $key => $data) {
if ($data[2] != '') {
// URL
$items .= '<li' . ($current_page == $data[0] ? ' class="active"' : '') . '><a href="index.php?page=' . $data[0] . '&mode=' . $data[2] . '">' . $data[1] . '</a></li>';
} else {
// URL
$items .= '<li' . ($current_page == $data[0] ? ' class="active"' : '') . '><a href="index.php?page=' . $data[0] . '">' . $data[1] . '</a></li>';
}
}
// PARSE THE MENU AND OTHER DATA
$parse = $this->_lang;
$parse['menu_items'] = $items;
$parse['language_select'] = Functions_Lib::get_languages(Functions_Lib::read_config('lang'));
return $this->parse_template($this->get_template('install/topnav_view'), $parse);
}
示例13: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
if (!isset($_POST) or empty($_POST)) {
Functions_Lib::redirect('game.php?page=fleet1');
}
$resource = parent::$objects->get_objects();
$pricelist = parent::$objects->get_price();
$reslist = parent::$objects->get_objects_list();
$lang = $this->_lang;
#####################################################################################################
// SOME DEFAULT VALUES
#####################################################################################################
// ARRAYS
$exp_values = array(1, 2, 3, 4, 5);
$hold_values = array(0, 1, 2, 4, 8, 16, 32);
// LANG
$this->_lang['js_path'] = XGP_ROOT . JS_PATH;
$parse = $this->_lang;
// LOAD TEMPLATES REQUIRED
$mission_row_template = parent::$page->get_template('fleet/fleet3_mission_row');
$input_template = parent::$page->get_template('fleet/fleet3_inputs');
$stay_template = parent::$page->get_template('fleet/fleet3_stay_row');
$options_template = parent::$page->get_template('fleet/fleet_options');
// OTHER VALUES
$galaxy = (int) $_POST['galaxy'];
$system = (int) $_POST['system'];
$planet = (int) $_POST['planet'];
$planettype = (int) $_POST['planettype'];
$fleet_acs = (int) $_POST['fleet_group'];
$YourPlanet = FALSE;
$UsedPlanet = FALSE;
$MissionSelector = '';
// QUERYS
$select = parent::$db->query_fetch("SELECT `planet_user_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . PLANETS . "`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_system` = '" . $system . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_planet` = '" . $planet . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_type` = '" . $planettype . "';");
if ($select) {
if ($select['planet_user_id'] == $this->_current_user['user_id']) {
$YourPlanet = TRUE;
$UsedPlanet = TRUE;
} else {
$UsedPlanet = TRUE;
}
}
if ($_POST['planettype'] == 2) {
if ($_POST['ship209'] >= 1) {
$missiontype = array(8 => $this->_lang['type_mission'][8]);
} else {
$missiontype = array();
}
} elseif ($_POST['planettype'] == 1 or $_POST['planettype'] == 3) {
if ($_POST['ship208'] >= 1 && !$UsedPlanet) {
$missiontype = array(7 => $this->_lang['type_mission'][7]);
} elseif ($_POST['ship210'] >= 1 && !$YourPlanet) {
$missiontype = array(6 => $this->_lang['type_mission'][6]);
}
if ($_POST['ship202'] >= 1 or $_POST['ship203'] >= 1 or $_POST['ship204'] >= 1 or $_POST['ship205'] >= 1 or $_POST['ship206'] >= 1 or $_POST['ship207'] >= 1 or $_POST['ship210'] >= 1 or $_POST['ship211'] >= 1 or $_POST['ship213'] >= 1 or $_POST['ship214'] >= 1 or $_POST['ship215'] >= 1) {
if (!$YourPlanet) {
$missiontype[1] = $this->_lang['type_mission'][1];
}
$missiontype[3] = $this->_lang['type_mission'][3];
$missiontype[5] = $this->_lang['type_mission'][5];
}
} elseif ($_POST['ship209'] >= 1 or $_POST['ship208']) {
$missiontype[3] = $this->_lang['type_mission'][3];
}
if ($YourPlanet) {
$missiontype[4] = $this->_lang['type_mission'][4];
}
if ($_POST['planettype'] == 3 || $_POST['planettype'] == 1 && $fleet_acs > 0 && $UsedPlanet) {
$acs = parent::$db->query_fetch("SELECT `acs_fleet_galaxy`, `acs_fleet_planet``, `acs_fleet_system`, `acs_fleet_planet_type`\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . ACS_FLEETS . "`\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `acs_fleet_id` = '" . $fleet_acs . "';");
if ($acs['acs_fleet_galaxy'] == $galaxy && $acs['acs_fleet_planet'] == $planet && $acs['acs_fleet_system'] == $system && $acs['acs_fleet_planet_type'] == $planettype) {
$missiontype[2] = $this->_lang['type_mission'][2];
}
}
if ($_POST['planettype'] == 3 && $_POST['ship214'] >= 1 && !$YourPlanet && $UsedPlanet) {
$missiontype[9] = $this->_lang['type_mission'][9];
}
$fleetarray = unserialize(base64_decode(str_rot13($_POST['usedfleet'])));
$mission = $_POST['target_mission'];
$SpeedFactor = $_POST['speedfactor'];
$AllFleetSpeed = Fleets_Lib::fleet_max_speed($fleetarray, 0, $this->_current_user);
$GenFleetSpeed = $_POST['speed'];
$MaxFleetSpeed = min($AllFleetSpeed);
$distance = Fleets_Lib::target_distance($_POST['thisgalaxy'], $_POST['galaxy'], $_POST['thissystem'], $_POST['system'], $_POST['thisplanet'], $_POST['planet']);
$duration = Fleets_Lib::mission_duration($GenFleetSpeed, $MaxFleetSpeed, $distance, $SpeedFactor);
$consumption = Fleets_Lib::fleet_consumption($fleetarray, $SpeedFactor, $duration, $distance, $MaxFleetSpeed, $this->_current_user);
#####################################################################################################
// INPUTS DATA
#####################################################################################################
$parse['metal'] = floor($this->_current_planet['planet_metal']);
$parse['crystal'] = floor($this->_current_planet['planet_crystal']);
$parse['deuterium'] = floor($this->_current_planet['planet_deuterium']);
$parse['consumption'] = $consumption;
$parse['distance'] = $distance;
$parse['speedfactor'] = $_POST['speedfactor'];
$parse['thisgalaxy'] = $_POST['thisgalaxy'];
//.........这里部分代码省略.........
示例14: have_access
/**
* method have_access
* param $alliance_owner
* param $permission
* return checks if the user is allowed to access a section
*/
private function have_access($alliance_owner, $permission)
{
if ($alliance_owner != $this->_current_user['user_id'] && !$permission) {
Functions_Lib::redirect('game.php?page=alliance');
} else {
return TRUE;
}
}
示例15: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
Functions_Lib::redirect(Functions_Lib::read_config('forum_url'));
}