function ShowVoucherPage() { global $LNG, $USER; $template = new template(); if ($_GET['mode'] == 'delete' && !empty($_GET['i'])) { //delete an entry $GLOBALS['DATABASE']->query("DELETE from `uni1_reward` where `rewardId` = " . $GLOBALS['DATABASE']->sql_escape($_GET['i']) . " ;"); $template->message("Voucher Code deleted"); die; } if ($_POST) { $SQL = ""; foreach ($_POST as $key => $value) { $SQL .= "'" . $value . "',"; } $SQL = substr($SQL, 0, -1); $GLOBALS['DATABASE']->query("INSERT INTO `uni1_reward` VALUES (NULL," . $SQL . ");"); $template->message("Voucher Added"); die; } $AllVouchers = array(); $GetAll = $GLOBALS['DATABASE']->query("SELECT * FROM `uni1_reward` ;"); if ($GLOBALS['DATABASE']->numRows($GetAll) > 0) { while ($x = $GLOBALS['DATABASE']->fetch_array($GetAll)) { $AllVouchers[] = $x; } } $template->assign_vars(array('AllVouchers' => $AllVouchers)); $template->show('VoucherEditor.tpl'); }
private function UpdateTicket($TicketID) { global $USER, $db, $LNG; $text = request_var('text', '', true); $template = new template(); if (empty($text)) { exit($template->message($LNG['sendit_error_msg'], "game.php?page=support", 3)); } $ticket = $db->uniquequery("SELECT text FROM " . SUPP . " WHERE `id` = '" . $TicketID . "';"); $text = $ticket['text'] . '<br><br><hr>' . $USER['username'] . ' schreib am ' . date("d. M Y H:i:s", TIMESTAMP) . '<br><br>' . makebr($text) . ''; $db->query("UPDATE " . SUPP . " SET `text` = '" . $db->sql_escape($text) . "',`status` = '3' WHERE `id` = '" . $db->sql_escape($TicketID) . "';"); $template->message($LNG['sendit_a'], "game.php?page=support", 3); }
function ShowGiveaway() { global $LNG, $resource, $reslist; $template = new template(); $action = HTTP::_GP('action', ''); if ($action == 'send') { $planet = HTTP::_GP('planet', 0); $moon = HTTP::_GP('moon', 0); $mainplanet = HTTP::_GP('mainplanet', 0); $no_inactive = HTTP::_GP('no_inactive', 0); if (!$planet && !$moon) { $template->message($LNG['ga_selectplanettype']); exit; } $planetIN = array(); if ($planet) { $planetIN[] = "'1'"; } if ($moon) { $planetIN[] = "'3'"; } $data = array(); $DataIDs = array_merge($reslist['resstype'][1], $reslist['resstype'][3], $reslist['build'], $reslist['tech'], $reslist['fleet'], $reslist['defense'], $reslist['officier']); $logOld = array(); $logNew = array(); foreach ($DataIDs as $ID) { $amount = max(0, round(HTTP::_GP('element_' . $ID, 0.0))); $data[] = $resource[$ID] . " = " . $resource[$ID] . " + " . $amount; $logOld[$ID] = 0; $logNew[$ID] = $amount; } $SQL = "UPDATE " . PLANETS . " p INNER JOIN " . USERS . " u ON p.id_owner = u.id"; if ($mainplanet == true) { $SQL .= " AND CONCAT_WS(':', p.universe, p.galaxy, p.system, p.planet) = CONCAT_WS(':', u.universe, u.galaxy, u.system, u.planet)"; } if ($no_inactive == true) { $SQL .= " AND u.onlinetime < " . (TIMESTAMP - INACTIVE); } $SQL .= " SET " . implode(', ', $data) . " WHERE p.universe = " . $_SESSION['adminuni'] . " AND p.planet_type IN (" . implode(',', $planetIN) . ")"; $GLOBALS['DATABASE']->query($SQL); $LOG = new Log(4); $LOG->target = 0; $LOG->old = $logOld; $LOG->new = $logNew; $LOG->save(); $template->message($LNG['ga_success']); exit; } $template->assign_vars(array('reslist' => $reslist)); $template->show("giveaway.tpl"); }
function ShowUpdatePage() { global $LNG, $CONF; $template = new template(); $template->message('<p>This Site is currently under construction, because the update system brings somtimes inconsistent game installations.</p><p>Alternate update process: <a href="http://2moons.cc/b4-support/b7-installation-update-und-konvertierung/t1721-howto-update-your-2moons-game-with-private-modifications-without-edit-files-one-by-one/" target="blank"><u>2moons.cc Board</u></a></p><p>We apologize for any inconvenience.</p>'); exit; if (!function_exists('curl_init')) { $template = new template(); $template->message($LNG['up_need_curl']); } if (isset($_REQUEST['version'])) { $Temp = explode('.', $_REQUEST['version']); $Temp = array_map('intval', $Temp); if (count(GetLogs($Temp[2]), COUNT_RECURSIVE) > 8) { Config::update(array('VERSION' => $Temp[0] . '.' . $Temp[1] . '.' . $Temp[2])); } } $ACTION = HTTP::_GP('action', ''); switch ($ACTION) { case "download": DownloadUpdates(); break; case "check": CheckPermissions(); break; case "update": ExecuteUpdates(); break; default: DisplayUpdates(); break; } }
function ShowClearCachePage() { global $LNG; ClearCache(); $template = new template(); $template->message($LNG['cc_cache_clear']); }
function message($mes, $dest = "", $time = "3", $topnav = false, $menu = true) { require_once ROOT_PATH . 'includes/classes/class.template.php'; $template = new template(); $template->message($mes, $dest, $time, !$topnav); exit; }
function ShowStatUpdatePage() { global $LNG; require_once 'includes/classes/class.statbuilder.php'; $stat = new statbuilder(); $result = $stat->MakeStats(); $memory_p = str_replace(array("%p", "%m"), $result['memory_peak'], $LNG['sb_top_memory']); $memory_e = str_replace(array("%e", "%m"), $result['end_memory'], $LNG['sb_final_memory']); $memory_i = str_replace(array("%i", "%m"), $result['initial_memory'], $LNG['sb_start_memory']); $stats_end_time = sprintf($LNG['sb_stats_update'], $result['totaltime']); $stats_sql = sprintf($LNG['sb_sql_counts'], $result['sql_count']); $template = new template(); $template->message($LNG['sb_stats_updated'] . $stats_end_time . $memory_i . $memory_e . $memory_p . $stats_sql, false, 0, true); }
function ShowClearCachePage() { global $LNG; $DIRS = array('cache/UserBanner/', 'cache/'); foreach ($DIRS as $DIR) { $FILES = array_diff(scandir($DIR), array('..', '.', '.htaccess')); foreach ($FILES as $FILE) { if (is_dir(ROOT_PATH . $DIR . $FILE)) { continue; } unlink(ROOT_PATH . $DIR . $FILE); } } $template = new template(); $template->message($LNG['cc_cache_clear']); }
function ShowDumpPage() { global $LNG; switch ($_REQUEST['action']) { case 'dump': $dbTables = HTTP::_GP('dbtables', array()); if (empty($dbTables)) { $template = new template(); $template->message($LNG['du_not_tables_selected']); exit; } $fileName = '2MoonsBackup_' . date('d_m_Y_H_i_s', TIMESTAMP) . '.sql'; $filePath = 'includes/backups/' . $fileName; require 'includes/classes/SQLDumper.class.php'; $dump = new SQLDumper(); $dump->dumpTablesToFile($dbTables, $filePath); $template = new template(); $template->message(sprintf($LNG['du_success'], 'includes/backups/' . $fileName)); break; default: $dumpData['perRequest'] = 100; $dumpData = array(); $prefixCounts = strlen(DB_PREFIX); $dumpData['sqlTables'] = array(); $sqlTableRaw = $GLOBALS['DATABASE']->query("SHOW TABLE STATUS FROM `" . DB_NAME . "`;"); while ($table = $GLOBALS['DATABASE']->fetchArray($sqlTableRaw)) { if (DB_PREFIX == substr($table['Name'], 0, $prefixCounts)) { $dumpData['sqlTables'][] = $table['Name']; } } $template = new template(); $template->assign_vars(array('dumpData' => $dumpData)); $template->show('DumpPage.tpl'); break; } }
public function __construct() { global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist; include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.' . PHP_EXT; include_once ROOT_PATH . 'includes/functions/GetElementPrice.' . PHP_EXT; $template = new template(); $template->page_header(); $template->page_topnav(); $template->page_leftmenu(); $template->page_planetmenu(); $template->page_footer(); if ($PLANET[$resource[31]] == 0) { $template->message($LNG['bd_lab_required']); exit; } $bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false; $PLANET[$resource[31] . '_inter'] = $this->CheckAndGetLabLevel($USER, $PLANET); $TheCommand = request_var('cmd', ''); $Element = request_var('tech', 0); $PlanetRess = new ResourceUpdate(); if ($USER['urlaubs_modus'] == 0 && !empty($TheCommand) && $bContinue) { switch ($TheCommand) { case 'cancel': if (empty($USER['b_tech'])) { break; } $costs = GetBuildingPrice($USER, $PLANET, $USER['b_tech_id']); if ($PLANET['id'] == $USER['b_tech_planet']) { $PLANET['metal'] += $costs['metal']; $PLANET['crystal'] += $costs['crystal']; $PLANET['deuterium'] += $costs['deuterium']; } else { $db->query("UPDATE " . PLANETS . " SET `metal` = `metal` + '" . $costs['metal'] . "', `crystal` = `crystal` + '" . $costs['crystal'] . "', `deuterium` = `deuterium` + '" . $costs['deuterium'] . "' WHERE `id` = '" . $USER['b_tech_planet'] . "';"); } $USER['darkmatter'] += $costs['darkmatter']; $USER['b_tech_id'] = 0; $USER['b_tech'] = 0; $USER['b_tech_planet'] = 0; break; case 'search': if (!empty($USER['b_tech']) || empty($Element) || !in_array($Element, $reslist['tech']) || $USER[$resource[$Element]] >= $pricelist[$Element]['max'] || !IsTechnologieAccessible($USER, $PLANET, $Element) || !IsElementBuyable($USER, $PLANET, $Element)) { break; } $costs = GetBuildingPrice($USER, $PLANET, $Element); $PLANET['metal'] -= $costs['metal']; $PLANET['crystal'] -= $costs['crystal']; $PLANET['deuterium'] -= $costs['deuterium']; $USER['darkmatter'] -= $costs['darkmatter']; $USER['b_tech_id'] = $Element; $USER['b_tech'] = TIMESTAMP + GetBuildingTime($USER, $PLANET, $Element); $USER['b_tech_planet'] = $PLANET['id']; break; } } $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $ScriptInfo = array(); foreach ($reslist['tech'] as $ID => $Element) { if (IsTechnologieAccessible($USER, $PLANET, $Element)) { $CanBeDone = IsElementBuyable($USER, $PLANET, $Element); if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) { $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>"; } elseif ($USER['b_tech_id'] == 0) { $LevelToDo = 1 + $USER[$resource[$Element]]; if ($CanBeDone && $this->CheckLabSettingsInQueue($PLANET)) { $TechnoLink = "<a href=\"game.php?page=buildings&mode=research&cmd=search&tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>"; } else { $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>"; } } else { if ($USER['b_tech_id'] == $Element) { if ($USER['b_tech_planet'] == $PLANET['id']) { $template->loadscript('research.js'); $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']); } else { $THEPLANET = $db->uniquequery("SELECT `name` FROM " . PLANETS . " WHERE `id` = '" . $USER['b_tech_planet'] . "';"); $template->loadscript('research.js'); $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $THEPLANET['name'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']); } $TechnoLink = '<div id="research"></div>'; } else { $TechnoLink = '<center>-</center>'; } } $ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * ESPION . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * COMMANDANT . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink); } } $template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time'])); $template->show('buildings_research.tpl'); }
function ShowAccountEditorPage() { global $LNG, $reslist, $resource; $template = new template(); switch ($_GET['edit']) { case 'resources': $id = HTTP::_GP('id', 0); $id_dark = HTTP::_GP('id_dark', 0); $metal = max(0, round(HTTP::_GP('metal', 0.0))); $cristal = max(0, round(HTTP::_GP('cristal', 0.0))); $deut = max(0, round(HTTP::_GP('deut', 0.0))); $dark = HTTP::_GP('dark', 0); if ($_POST) { if (!empty($id)) { $before = $GLOBALS['DATABASE']->getFirstRow("SELECT `metal`,`crystal`,`deuterium`,`universe` FROM " . PLANETS . " WHERE `id` = '" . $id . "';"); } if (!empty($id_dark)) { $before_dm = $GLOBALS['DATABASE']->getFirstRow("SELECT `darkmatter` FROM " . USERS . " WHERE `id` = '" . $id_dark . "';"); } if ($_POST['add']) { if (!empty($id)) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`metal` = `metal` + '" . $metal . "', "; $SQL .= "`crystal` = `crystal` + '" . $cristal . "', "; $SQL .= "`deuterium` = `deuterium` + '" . $deut . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); $after = array('metal' => $before['metal'] + $metal, 'crystal' => $before['crystal'] + $cristal, 'deuterium' => $before['deuterium'] + $deut); } if (!empty($id_dark)) { $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`darkmatter` = `darkmatter` + '" . $dark . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id_dark . "' AND `universe` = '" . Universe::getEmulated() . "' "; $GLOBALS['DATABASE']->query($SQL); $after_dm = array('darkmatter' => $before_dm['darkmatter'] + $dark); } } elseif ($_POST['delete']) { if (!empty($id)) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`metal` = `metal` - '" . $metal . "', "; $SQL .= "`crystal` = `crystal` - '" . $cristal . "', "; $SQL .= "`deuterium` = `deuterium` - '" . $deut . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); $after = array('metal' => $before['metal'] - $metal, 'crystal' => $before['crystal'] - $cristal, 'deuterium' => $before['deuterium'] - $deut); } if (!empty($id_dark)) { $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`darkmatter` = `darkmatter` - '" . $dark . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id_dark . "';"; $GLOBALS['DATABASE']->query($SQL); $after_dm = array('darkmatter' => $before_dm['darkmatter'] - $dark); } } if (!empty($id)) { $LOG = new Log(2); $LOG->target = $id; $LOG->universe = $before_dm['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); } if (!empty($id_dark)) { $LOG = new Log(1); $LOG->target = $id_dark; $LOG->universe = $before_dm['universe']; $LOG->old = $before_dm; $LOG->new = $after_dm; $LOG->save(); } if ($_POST['add']) { $template->message($LNG['ad_add_res_sucess'], '?page=accounteditor&edit=resources'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_res_sucess'], '?page=accounteditor&edit=resources'); } } exit; } $template->show('AccountEditorPageResources.tpl'); break; case 'ships': if ($_POST) { $before1 = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); $before = array(); $after = array(); foreach ($reslist['fleet'] as $ID) { $before[$ID] = $before1[$resource[$ID]]; } if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`eco_hash` = '', "; foreach ($reslist['fleet'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = $before[$ID] + max(0, round(HTTP::_GP($resource[$ID], 0.0))); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`eco_hash` = '', "; foreach ($reslist['fleet'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = max($before[$ID] - max(0, round(HTTP::_GP($resource[$ID], 0.0))), 0); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } $LOG = new Log(2); $LOG->target = HTTP::_GP('id', 0); $LOG->universe = $before1['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); if ($_POST['add']) { $template->message($LNG['ad_add_ships_sucess'], '?page=accounteditor&edit=ships'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_ships_sucess'], '?page=accounteditor&edit=ships'); } } exit; } $parse['ships'] = ""; foreach ($reslist['fleet'] as $ID) { $INPUT[$ID] = array('type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT)); $template->show('AccountEditorPageShips.tpl'); break; case 'defenses': if ($_POST) { $before1 = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); $before = array(); $after = array(); foreach ($reslist['defense'] as $ID) { $before[$ID] = $before1[$resource[$ID]]; } if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['defense'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = $before[$ID] + max(0, round(HTTP::_GP($resource[$ID], 0.0))); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['defense'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = max($before[$ID] - max(0, round(HTTP::_GP($resource[$ID], 0.0))), 0); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); $Name = $LNG['log_nomoree']; } $LOG = new Log(2); $LOG->target = HTTP::_GP('id', 0); $LOG->universe = $before1['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); if ($_POST['add']) { $template->message($LNG['ad_add_defenses_success'], '?page=accounteditor&edit=defenses'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_defenses_success'], '?page=accounteditor&edit=defenses'); } } exit; } foreach ($reslist['defense'] as $ID) { $INPUT[$ID] = array('type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT)); $template->show('AccountEditorPageDefenses.tpl'); break; break; case 'buildings': if ($_POST) { $PlanetData = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); if (!isset($PlanetData)) { $template->message($LNG['ad_add_not_exist'], '?page=accounteditor&edit=buildings'); } $before = array(); $after = array(); foreach ($reslist['allow'][$PlanetData['planet_type']] as $ID) { $before[$ID] = $PlanetData[$resource[$ID]]; } if ($_POST['add']) { $Fields = 0; $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`eco_hash` = '', "; foreach ($reslist['allow'][$PlanetData['planet_type']] as $ID) { $Count = max(0, round(HTTP::_GP($resource[$ID], 0.0))); $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . $Count . "'"; $after[$ID] = $before[$ID] + $Count; $Fields += $Count; } $SQL .= implode(", ", $QryUpdate); $SQL .= ", `field_current` = `field_current` + '" . $Fields . "'"; $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } elseif ($_POST['delete']) { $Fields = 0; $QryUpdate = array(); $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`eco_hash` = '', "; foreach ($reslist['allow'][$PlanetData['planet_type']] as $ID) { $Count = max(0, round(HTTP::_GP($resource[$ID], 0.0))); $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . $Count . "'"; $after[$ID] = max($before[$ID] - $Count, 0); $Fields += $Count; } $SQL .= implode(", ", $QryUpdate); $SQL .= ", `field_current` = `field_current` - '" . $Fields . "'"; $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } $LOG = new Log(2); $LOG->target = HTTP::_GP('id', 0); $LOG->universe = Universe::getEmulated(); $LOG->old = $before; $LOG->new = $after; $LOG->save(); if ($_POST['add']) { $template->message($LNG['ad_add_build_success'], '?page=accounteditor&edit=buildings'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_build_success'], '?page=accounteditor&edit=buildings'); } } exit; } foreach ($reslist['build'] as $ID) { $INPUT[$ID] = array('type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT)); $template->show('AccountEditorPageBuilds.tpl'); break; case 'researchs': if ($_POST) { $before1 = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); $before = array(); $after = array(); foreach ($reslist['tech'] as $ID) { $before[$ID] = $before1[$resource[$ID]]; } if ($_POST['add']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['tech'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = $before[$ID] + max(0, round(HTTP::_GP($resource[$ID], 0.0))); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } elseif ($_POST['delete']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['tech'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = max($before[$ID] - max(0, round(HTTP::_GP($resource[$ID], 0.0))), 0); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } $LOG = new Log(1); $LOG->target = HTTP::_GP('id', 0); $LOG->universe = $before1['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); if ($_POST['add']) { $template->message($LNG['ad_add_tech_success'], '?page=accounteditor&edit=researchs'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_tech_success'], '?page=accounteditor&edit=researchs'); } } exit; } foreach ($reslist['tech'] as $ID) { $INPUT[$ID] = array('type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT)); $template->show('AccountEditorPageResearch.tpl'); break; case 'personal': if ($_POST) { $id = HTTP::_GP('id', 0); $username = HTTP::_GP('username', '', UTF8_SUPPORT); $password = HTTP::_GP('password', '', true); $email = HTTP::_GP('email', ''); $email_2 = HTTP::_GP('email_2', ''); $vacation = HTTP::_GP('vacation', ''); $before = $GLOBALS['DATABASE']->getFirstRow("SELECT `username`,`email`,`email_2`,`password`,`urlaubs_modus`,`urlaubs_until` FROM " . USERS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); $after = array(); $PersonalQuery = "UPDATE " . USERS . " SET "; if (!empty($username) && $id != ROOT_USER) { $PersonalQuery .= "`username` = '" . $GLOBALS['DATABASE']->sql_escape($username) . "', "; $after['username'] = $username; } if (!empty($email) && $id != ROOT_USER) { $PersonalQuery .= "`email` = '" . $GLOBALS['DATABASE']->sql_escape($email) . "', "; $after['email'] = $email; } if (!empty($email_2) && $id != ROOT_USER) { $PersonalQuery .= "`email_2` = '" . $GLOBALS['DATABASE']->sql_escape($email_2) . "', "; $after['email_2'] = $email_2; } if (!empty($password) && $id != ROOT_USER) { $PersonalQuery .= "`password` = '" . $GLOBALS['DATABASE']->sql_escape(cryptPassword($password)) . "', "; $after['password'] = cryptPassword($password) != $before['password'] ? 'CHANGED' : ''; } $before['password'] = ''; $Answer = 0; $TimeAns = 0; if ($vacation == 'yes') { $Answer = 1; $after['urlaubs_modus'] = 1; $TimeAns = TIMESTAMP + $_POST['d'] * 86400 + $_POST['h'] * 3600 + $_POST['m'] * 60 + $_POST['s']; $after['urlaubs_until'] = $TimeAns; } $PersonalQuery .= "`urlaubs_modus` = '" . $Answer . "', `urlaubs_until` = '" . $TimeAns . "' "; $PersonalQuery .= "WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "'"; $GLOBALS['DATABASE']->query($PersonalQuery); $LOG = new Log(1); $LOG->target = $id; $LOG->universe = $before['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); $template->message($LNG['ad_personal_succes'], '?page=accounteditor&edit=personal'); exit; } $template->assign_vars(array('Selector' => array('' => $LNG['select_option'], 'yes' => $LNG['one_is_yes'][1], 'no' => $LNG['one_is_yes'][0]))); $template->show('AccountEditorPagePersonal.tpl'); break; case 'officiers': if ($_POST) { $before1 = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . HTTP::_GP('id', 0) . "';"); $before = array(); $after = array(); foreach ($reslist['officier'] as $ID) { $before[$ID] = $before1[$resource[$ID]]; } if ($_POST['add']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['officier'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = $before[$ID] + max(0, round(HTTP::_GP($resource[$ID], 0.0))); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } elseif ($_POST['delete']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['officier'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . max(0, round(HTTP::_GP($resource[$ID], 0.0))) . "'"; $after[$ID] = max($before[$ID] - max(0, round(HTTP::_GP($resource[$ID], 0.0))), 0); } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . HTTP::_GP('id', 0) . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } $LOG = new Log(1); $LOG->target = HTTP::_GP('id', 0); $LOG->universe = $before1['universe']; $LOG->old = $before; $LOG->new = $after; $LOG->save(); if ($_POST['add']) { $template->message($LNG['ad_add_offi_success'], '?page=accounteditor&edit=officiers'); } else { if ($_POST['delete']) { $template->message($LNG['ad_delete_offi_success'], '?page=accounteditor&edit=officiers'); } } exit; } foreach ($reslist['officier'] as $ID) { $INPUT[$ID] = array('type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT)); $template->show('AccountEditorPageOfficiers.tpl'); break; case 'planets': if ($_POST) { $id = HTTP::_GP('id', 0); $name = HTTP::_GP('name', '', UTF8_SUPPORT); $diameter = HTTP::_GP('diameter', 0); $fields = HTTP::_GP('fields', 0); $buildings = HTTP::_GP('0_buildings', ''); $ships = HTTP::_GP('0_ships', ''); $defenses = HTTP::_GP('0_defenses', ''); $c_hangar = HTTP::_GP('0_c_hangar', ''); $c_buildings = HTTP::_GP('0_c_buildings', ''); $change_pos = HTTP::_GP('change_position', ''); $galaxy = HTTP::_GP('g', 0); $system = HTTP::_GP('s', 0); $planet = HTTP::_GP('p', 0); if (!empty($name)) { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `name` = '" . $GLOBALS['DATABASE']->sql_escape($name) . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($buildings == 'on') { foreach ($reslist['build'] as $ID) { $BUILD[] = "`" . $resource[$ID] . "` = '0'"; } $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET " . implode(', ', $BUILD) . " WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($ships == 'on') { foreach ($reslist['fleet'] as $ID) { $SHIPS[] = "`" . $resource[$ID] . "` = '0'"; } $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET " . implode(', ', $SHIPS) . " WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($defenses == 'on') { foreach ($reslist['defense'] as $ID) { $DEFS[] = "`" . $resource[$ID] . "` = '0'"; } $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET " . implode(', ', $DEFS) . " WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($c_hangar == 'on') { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `b_hangar` = '0', `b_hangar_plus` = '0', `b_hangar_id` = '' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($c_buildings == 'on') { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `b_building` = '0', `b_building_id` = '' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if (!empty($diameter)) { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `diameter` = '" . $diameter . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if (!empty($fields)) { $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `field_max` = '" . $fields . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } if ($change_pos == 'on' && $galaxy > 0 && $system > 0 && $planet > 0 && $galaxy <= Config::get(Universe::getEmulated())->max_galaxy && $system <= Config::get(Universe::getEmulated())->max_system && $planet <= Config::get(Universe::getEmulated())->max_planets) { $P = $GLOBALS['DATABASE']->getFirstRow("SELECT galaxy,system,planet,planet_type FROM " . PLANETS . " WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); if ($P['planet_type'] == '1') { if (PlayerUtil::checkPosition(Universe::getEmulated(), $galaxy, $system, $planet, $P['planet_type'])) { $template->message($LNG['ad_pla_error_planets3'], '?page=accounteditor&edit=planets'); exit; } $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); } else { if (PlayerUtil::checkPosition(Universe::getEmulated(), $galaxy, $system, $planet, $P['planet_type'])) { $template->message($LNG['ad_pla_error_planets5'], '?page=accounteditor&edit=planets'); exit; } $Target = $GLOBALS['DATABASE']->getFirstRow("SELECT id_luna FROM " . PLANETS . " WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '1';"); if ($Target['id_luna'] != '0') { $template->message($LNG['ad_pla_error_planets4'], '?page=accounteditor&edit=planets'); exit; } $GLOBALS['DATABASE']->multi_query("UPDATE " . PLANETS . " SET `id_luna` = '0' WHERE `galaxy` = '" . $P['galaxy'] . "' AND `system` = '" . $P['system'] . "' AND `planet` = '" . $P['planet'] . "' AND `planet_type` = '1';UPDATE " . PLANETS . " SET `id_luna` = '" . $id . "' WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND planet_type = '1';UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "';"); $QMOON2 = $GLOBALS['DATABASE']->getFirstRow("SELECT id_owner FROM " . PLANETS . " WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "';"); $GLOBALS['DATABASE']->query("UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "', `id_owner` = '" . $QMOON2['id_owner'] . "' WHERE `id` = '" . $id . "' AND `universe` = '" . Universe::getEmulated() . "' AND `planet_type` = '3';"); } } $template->message($LNG['ad_pla_succes'], '?page=accounteditor&edit=planets'); exit; } $template->show('AccountEditorPagePlanets.tpl'); break; case 'alliances': if ($_POST) { $id = HTTP::_GP('id', 0); $name = HTTP::_GP('name', '', UTF8_SUPPORT); $changeleader = HTTP::_GP('changeleader', 0); $tag = HTTP::_GP('tag', '', UTF8_SUPPORT); $externo = HTTP::_GP('externo', '', true); $interno = HTTP::_GP('interno', '', true); $solicitud = HTTP::_GP('solicitud', '', true); $delete = HTTP::_GP('delete', ''); $delete_u = HTTP::_GP('delete_u', ''); $QueryF = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . ALLIANCE . " WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); if (!empty($name)) { $GLOBALS['DATABASE']->query("UPDATE " . ALLIANCE . " SET `ally_name` = '" . $name . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); } if (!empty($tag)) { $GLOBALS['DATABASE']->query("UPDATE " . ALLIANCE . " SET `ally_tag` = '" . $tag . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); } $QueryF2 = $GLOBALS['DATABASE']->getFirstRow("SELECT ally_id FROM " . USERS . " WHERE `id` = '" . $changeleader . "';"); $GLOBALS['DATABASE']->multi_query("UPDATE " . ALLIANCE . " SET `ally_owner` = '" . $changeleader . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';UPDATE " . USERS . " SET `ally_rank_id` = '0' WHERE `id` = '" . $changeleader . "';"); if (!empty($externo)) { $GLOBALS['DATABASE']->query("UPDATE " . ALLIANCE . " SET `ally_description` = '" . $externo . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); } if (!empty($interno)) { $GLOBALS['DATABASE']->query("UPDATE " . ALLIANCE . " SET `ally_text` = '" . $interno . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); } if (!empty($solicitud)) { $GLOBALS['DATABASE']->query("UPDATE " . ALLIANCE . " SET `ally_request` = '" . $solicitud . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';"); } if ($delete == 'on') { $GLOBALS['DATABASE']->multi_query("DELETE FROM " . ALLIANCE . " WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';UPDATE " . USERS . " SET `ally_id` = '0', `ally_rank_id` = '0', `ally_register_time` = '0' WHERE `ally_id` = '" . $id . "';"); } if (!empty($delete_u)) { $GLOBALS['DATABASE']->multi_query("UPDATE " . ALLIANCE . " SET `ally_members` = ally_members - 1 WHERE `id` = '" . $id . "' AND `ally_universe` = '" . Universe::getEmulated() . "';UPDATE " . USERS . " SET `ally_id` = '0', `ally_rank_id` = '0', `ally_register_time` = '0' WHERE `id` = '" . $delete_u . "' AND `ally_id` = '" . $id . "';"); } $template->message($LNG['ad_ally_succes'], '?page=accounteditor&edit=alliances'); exit; } $template->show('AccountEditorPageAlliance.tpl'); break; default: $template->show('AccountEditorPageMenu.tpl'); break; } }
function ShowUpdatePage() { global $LNG, $CONF, $db; $Patchlevel = explode(".", VERSION); if ($_REQUEST['action'] == 'history') { $Level = 0; } elseif (isset($Patchlevel[2])) { $Level = $Patchlevel[2]; } else { $Level = 1159; } $opts = array('http' => array('method' => "GET", 'header' => "Patchlevel: " . $Level . "\r\nUser-Agent: 2Moons Update API (Rev " . $Patchlevel[2] . ")\r\n")); $context = stream_context_create($opts); switch ($_REQUEST['action']) { case "download": require_once ROOT_PATH . 'includes/libs/zip/zip.lib.' . PHP_EXT; $UpdateArray = unserialize(file_get_contents("http://update.2moons-systems.com/index.php?action=getupdate", FALSE, $context)); if (!is_array($UpdateArray['revs'])) { exitupdate(array('debug' => array('noupdate' => "Kein Update vorhanden!"))); } $SVN_ROOT = $UpdateArray['info']['svn']; $zipfile = new zipfile(); $TodoDelete = ""; foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if (!empty($RevInfo['add'])) { foreach ($RevInfo['add'] as $File) { if (strpos($File, '.') !== false) { $zipfile->addFile(file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']); } } } if (!empty($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $File) { if (strpos($File, '.') !== false) { $zipfile->addFile(file_get_contents($SVN_ROOT . $File), str_replace("/trunk/", "", $File), $RevInfo['timestamp']); } } } if (!empty($RevInfo['del'])) { foreach ($RevInfo['del'] as $File) { if (strpos($File, '.') !== false) { $TodoDelete .= str_replace("/trunk/", "", $File) . "\r\n"; } } } $LastRev = $Rev; } if (!empty($TodoDelete)) { $zipfile->addFile($TodoDelete, "!TodoDelete!.txt", $RevInfo['timestamp']); } update_config('VERSION', str_replace("RC", "", $Patchlevel[0]) . "." . $Patchlevel[1] . "." . $LastRev); // Header für Download senden header("HTTP/1.1 200 OK"); header("Content-Type: application/force-download"); header('Content-Disposition: attachment; filename="patch_' . $Level . '_to_' . $LastRev . '.zip"'); header("Content-Transfer-Encoding: binary"); // Zip File senden echo $zipfile->file(); exit; break; case "update": require_once ROOT_PATH . 'includes/libs/ftp/ftp.class.' . PHP_EXT; require_once ROOT_PATH . 'includes/libs/ftp/ftpexception.class.' . PHP_EXT; $UpdateArray = unserialize(file_get_contents("http://update.2moons-systems.com/index.php?action=getupdate", FALSE, $context)); if (!is_array($UpdateArray['revs'])) { exitupdate(array('debug' => array('noupdate' => "Kein Update vorhanden!"))); } $SVN_ROOT = $UpdateArray['info']['svn']; $CONFIG = array("host" => $CONF['ftp_server'], "username" => $CONF['ftp_user_name'], "password" => $CONF['ftp_user_pass'], "port" => 21); try { $ftp = FTP::getInstance(); $ftp->connect($CONFIG); $LOG['debug']['connect'] = "FTP-Verbindungsaufbau: OK!"; } catch (FTPException $error) { $LOG['debug']['connect'] = "FTP-Verbindungsaufbau: ERROR! " . $error->getMessage(); exitupdate($LOG); } if ($ftp->changeDir($CONF['ftp_root_path'])) { $LOG['debug']['chdir'] = "FTP-Changedir(" . $CONF['ftp_root_path'] . "): OK!"; } else { $LOG['debug']['chdir'] = "FTP-Changedir(" . $CONF['ftp_root_path'] . "): ERROR! Pfad nicht gefunden!"; exitupdate($LOG); } foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if (!empty($RevInfo['add'])) { foreach ($RevInfo['add'] as $File) { if ($File == "/trunk/updates/update_" . $Rev . ".sql") { $db->multi_query(str_replace("prefix_", DB_PREFIX, file_get_contents($SVN_ROOT . $File))); continue; } elseif ($File == "/trunk/updates/update_" . $Rev . ".php") { require $SVN_ROOT . $File; } else { if (strpos($File, '.') !== false) { $Data = fopen($SVN_ROOT . $File, "r"); if ($ftp->uploadFromFile($Data, str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = "OK! - Updated"; } else { $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht hochladen"; } fclose($Data); } else { if ($ftp->makeDir(str_replace("/trunk/", "", $File), 1)) { if (PHP_SAPI == 'apache2handler') { $ftp->chmod(str_replace("/trunk/", "", $File), '0777'); } else { $ftp->chmod(str_replace("/trunk/", "", $File), '0755'); } $LOG['update'][$Rev][$File] = "OK! - Updated"; } else { $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht hochladen"; } } } } } if (!empty($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $File) { if (strpos($File, '.') !== false) { if ($File == "/trunk/updates/update_" . $Rev . ".sql") { $db->multi_query(str_replace("prefix_", DB_PREFIX, file_get_contents($SVN_ROOT . $File))); continue; } else { $Data = fopen($SVN_ROOT . $File, "r"); if ($ftp->uploadFromFile($Data, str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = "OK! - Updated"; } else { $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht hochladen"; } fclose($Data); } } } } if (!empty($RevInfo['del'])) { foreach ($RevInfo['del'] as $File) { if (strpos($File, '.') !== false) { if ($ftp->delete(str_replace("/trunk/", "", $File))) { $LOG['update'][$Rev][$File] = "OK! - Gelöscht"; } else { $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht löschen"; } } else { if ($ftp->removeDir(str_replace("/trunk/", "", $File), 1)) { $LOG['update'][$Rev][$File] = "OK! - Gelöscht"; } else { $LOG['update'][$Rev][$File] = "ERROR! - Konnte Datei nicht löschen"; } } } } $LastRev = $Rev; } $LOG['finish']['atrev'] = "UPDATE: OK! At Revision: " . $LastRev; // Verbindung schließen update_config('VERSION', str_replace("RC", "", $Patchlevel[0]) . "." . $Patchlevel[1] . "." . $LastRev); exitupdate($LOG); break; default: $template = new template(); $template->page_header(); $RevList = ''; $Update = ''; $Info = ''; if (!function_exists('file_get_contents') || !function_exists('fsockopen')) { $template->message('Function file_get_contents oder fsockopen deactive', false, 0, true); } elseif (($RAW = @file_get_contents("http://update.2moons-systems.com/index.php?action=update", FALSE, $context)) !== false) { $UpdateArray = unserialize($RAW); if (is_array($UpdateArray['revs'])) { foreach ($UpdateArray['revs'] as $Rev => $RevInfo) { if (!(empty($RevInfo['add']) && empty($RevInfo['edit'])) && $Patchlevel[2] < $Rev) { $Update = "<tr><th><a href=\"?page=update&action=update\">Update</a> - <a href=\"?page=update&action=download\">Download Patch Files</a></th></tr>"; $Info = "<tr><td class=\"c\" colspan=\"5\">Aktuelle Updates</td></tr>"; } $edit = ""; if (!empty($RevInfo['edit']) || is_array($RevInfo['edit'])) { foreach ($RevInfo['edit'] as $file) { $edit .= '<a href="http://code.google.com/p/2moons/source/diff?spec=svn' . $Rev . '&r=' . $Rev . '&format=side&path=' . $file . '" target="diff">' . str_replace("/trunk/", "", $file) . '</a><br>'; } } $RevList .= "<tr>\r\n\t\t\t\t\t\t" . ($Patchlevel[2] == $Rev ? "<td class=c colspan=5>Momentane Version</td></tr><tr>" : ($Patchlevel[2] - 1 == $Rev ? "<td class=c colspan=5>Alte Updates</td></tr><tr>" : "")) . "\r\n\t\t\t\t\t\t<td class=c >" . ($Patchlevel[2] == $Rev ? "<font color=\"red\">" : "") . "Revision " . $Rev . " " . date("d. M y H:i:s", $RevInfo['timestamp']) . " von " . $RevInfo['author'] . ($Patchlevel[2] == $Rev ? "</font>" : "") . "</td></tr>\r\n\t\t\t\t\t\t<tr><th>" . makebr($RevInfo['log']) . "</th></tr>\r\n\t\t\t\t\t\t" . (!empty($RevInfo['add']) ? "<tr><th>ADD:<br>" . str_replace("/trunk/", "", implode("<br>\n", $RevInfo['add'])) . "</b></th></tr>" : "") . "\r\n\t\t\t\t\t\t" . (!empty($RevInfo['edit']) ? "<tr><th>EDIT:<br>" . $edit . "</b></th></tr>" : "") . "\r\n\t\t\t\t\t\t" . (!empty($RevInfo['del']) ? "<tr><th>DEL:<br>" . str_replace("/trunk/", "", implode("<br>\n", $RevInfo['del'])) . "</b></th></tr>" : "") . "\r\n\t\t\t\t\t\t</tr>"; } } $template->assign_vars(array('RevList' => $RevList, 'Update' => $Update, 'Info' => $Info)); $template->show('adm/UpdatePage.tpl'); } else { $template->message('Update Server currently not available', false, 0, true); } break; } }
function ShowBanPage() { global $LNG, $db, $USER; if ($_GET['order'] == 'id') { $ORDER = "id"; } else { $ORDER = "username"; } if ($_GET['view'] == 'bana') { $WHEREBANA = "AND `bana` = '1'"; } $UserList = $db->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;"); $UserSelect = array('List' => '', 'ListBan' => ''); $Users = 0; while ($a = $db->fetch_array($UserList)) { $UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . ' (ID: ' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>'; $Users++; } $db->free_result($UserList); if ($_GET['order2'] == 'id') { $ORDER2 = "id"; } else { $ORDER2 = "username"; } $Banneds = 0; $UserListBan = $db->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' ORDER BY " . $ORDER2 . " ASC;"); while ($b = $db->fetch_array($UserListBan)) { $UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . ' (ID: ' . $b['id'] . ')</option>'; $Banneds++; } $db->free_result($UserListBan); $template = new template(); $template->loadscript('filterlist.js'); $template->page_header(); if (isset($_POST['panel'])) { $Name = request_var('ban_name', '', true); $BANUSER = $db->uniquequery("SELECT b.theme, b.longer, u.id, u.urlaubs_modus, u.banaday FROM " . USERS . " as u LEFT JOIN " . BANNED . " as b ON u.`username` = b.`who` WHERE u.`username` = '" . $db->sql_escape($Name) . "';"); if ($BANUSER['banaday'] <= TIMESTAMP) { $title = $LNG['bo_bbb_title_1']; $changedate = $LNG['bo_bbb_title_2']; $changedate_advert = ''; $reas = ''; $timesus = ''; } else { $title = $LNG['bo_bbb_title_3']; $changedate = $LNG['bo_bbb_title_6']; $changedate_advert = '<td class="c" width="18px"><img src="./styles/images/Adm/i.gif" onMouseOver="return overlib(\'' . $LNG['bo_bbb_title_4'] . '\', CENTER, OFFSETX, -80, OFFSETY, -65, WIDTH, 250);" onMouseOut="return nd();"></td>'; $reas = $BANUSER['theme']; $timesus = "<tr>\r\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\r\n\t\t\t\t\t<th height=25 colspan=2>" . date("d-m-Y H:i:s", $BANUSER['longer']) . "</th>\r\n\t\t\t\t</tr>"; } $vacation = $BANUSER['urlaubs_modus'] == 1 ? true : false; $template->assign_vars(array('name' => $Name, 'bantitle' => $title, 'changedate' => $changedate, 'reas' => $reas, 'changedate_advert' => $changedate_advert, 'timesus' => $timesus, 'vacation' => $vacation, 'bo_characters_1' => $LNG['bo_characters_1'], 'bo_reason' => $LNG['bo_reason'], 'bo_username' => $LNG['bo_username'], 'bo_vacation_mode' => $LNG['bo_vacation_mode'], 'bo_vacaations' => $LNG['bo_vacaations'], 'time_seconds' => $LNG['time_seconds'], 'time_minutes' => $LNG['time_minutes'], 'time_hours' => $LNG['time_hours'], 'time_days' => $LNG['time_days'])); } elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) { $Name = request_var('ban_name', '', true); $reas = request_var('why', '', true); $days = request_var('days', 0); $hour = request_var('hour', 0); $mins = request_var('mins', 0); $secs = request_var('secs', 0); $admin = $USER['username']; $mail = $USER['email']; $BanTime = $days * 86400 + $hour * 3600 + $mins * 60 + $secs; if ($BANUSER['longer'] > TIMESTAMP) { $BanTime += $BANUSER['longer'] - TIMESTAMP; } if ($BanTime + TIMESTAMP < TIMESTAMP) { $BannedUntil = TIMESTAMP; } else { $BannedUntil = TIMESTAMP + $BanTime; } if ($BANUSER['banaday'] > TIMESTAMP) { $SQL = "UPDATE " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`who2` = '" . $Name . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`email` = '" . $mail . "' "; $SQL .= "WHERE `who2` = '" . $Name . "';"; $db->query($SQL); } else { $SQL = "INSERT INTO " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`who2` = '" . $Name . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`email` = '" . $mail . "';"; $db->query($SQL); } $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`bana` = '1', "; $SQL .= "`banaday` = '" . $BannedUntil . "', "; if (isset($_POST['vacat'])) { $SQL .= "`urlaubs_modus` = '1'"; } else { $SQL .= "`urlaubs_modus` = '0'"; } $SQL .= "WHERE "; $SQL .= "`username` = '" . $Name . "';"; $db->query($SQL); $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans'); exit; } elseif (isset($_POST['unban_name'])) { $Name = request_var('unban_name', '', true); $db->multi_query("DELETE FROM " . BANNED . " WHERE who = '" . $db->sql_escape($Name) . "';UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******';"); $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans'); exit; } $template->assign_vars(array('UserSelect' => $UserSelect, 'bo_ban_player' => $LNG['bo_ban_player'], 'bo_select_title' => $LNG['bo_select_title'], 'bo_order_banned' => $LNG['bo_order_banned'], 'bo_order_id' => $LNG['bo_order_id'], 'bo_order_username' => $LNG['bo_order_username'], 'button_filter' => $LNG['button_filter'], 'button_reset' => $LNG['button_reset'], 'button_deselect' => $LNG['button_deselect'], 'button_submit' => $LNG['button_submit'], 'bo_total_users' => $LNG['bo_total_users'], 'bo_total_banneds' => $LNG['bo_total_banneds'], 'bo_unban_player' => $LNG['bo_unban_player'], 'usercount' => $Users, 'bancount' => $Banneds)); $template->show('adm/BanPage.tpl'); }
$quickStartFile = 'includes/FIRST_INSTALL'; // If include/FIRST_INSTALL is present and can be deleted, automatically create include/ENABLE_INSTALL_TOOL if (is_file($quickStartFile) && is_writeable($quickStartFile) && unlink($quickStartFile)) { @touch($enableInstallToolFile); } // Only allow Install Tool access if the file "include/ENABLE_INSTALL_TOOL" is found if (is_file($enableInstallToolFile) && time() - filemtime($enableInstallToolFile) > 3600) { $content = file_get_contents($enableInstallToolFile); $verifyString = 'KEEP_FILE'; if (trim($content) !== $verifyString) { // Delete the file if it is older than 3600s (1 hour) unlink($enableInstallToolFile); } } if (!is_file($enableInstallToolFile)) { $template->message($LNG->getTemplate('locked_install'), false, 0, true); exit; } $language = HTTP::_GP('lang', ''); if (!empty($language) && in_array($language, $LNG->getAllowedLangs())) { setcookie('lang', $language); } $mode = HTTP::_GP('mode', ''); switch ($mode) { case 'ajax': require 'includes/libs/ftp/ftp.class.php'; require 'includes/libs/ftp/ftpexception.class.php'; $LNG->includeData(array('ADMIN')); $connectionConfig = array("host" => $_GET['host'], "username" => $_GET['user'], "password" => $_GET['pass'], "port" => 21); try { $ftp = FTP::getInstance();
public static function MissilesAjax() { global $USER, $PLANET, $LNG, $CONF, $db, $reslist, $resource; include_once ROOT_PATH . 'includes/functions/IsVacationMode.' . PHP_EXT; $iraks = $PLANET['interplanetary_misil']; $TargetGalaxy = request_var('galaxy', 0); $TargetSystem = request_var('system', 0); $TargetPlanet = request_var('planet', 0); $anz = min(request_var('SendMI', 0), $iraks); $pziel = request_var('Target', ""); $PlanetRess = new ResourceUpdate($USER, $PLANET); $Target = $db->uniquequery("SELECT `id_owner`, `id_level` FROM " . PLANETS . " WHERE `galaxy` = '" . $TargetGalaxy . "' AND `system` = '" . $TargetSystem . "' AND `planet` = '" . $TargetPlanet . "' AND `planet_type` = '1';"); $Distance = abs($TargetSystem - $PLANET['system']); require_once ROOT_PATH . 'includes/classes/class.GalaxyRows.' . PHP_EXT; $GalaxyRows = new GalaxyRows(); if (IsVacationMode($USER)) { $error = $LNG['fl_vacation_mode_active']; } elseif ($PLANET['silo'] < 4) { $error = $LNG['ma_silo_level']; } elseif ($USER['impulse_motor_tech'] == 0) { $error = $LNG['ma_impulse_drive_required']; } elseif ($TargetGalaxy != $PLANET['galaxy'] || $Distance > $GalaxyRows->GetMissileRange($USER[$resource[117]])) { $error = $LNG['ma_not_send_other_galaxy']; } elseif (!$Target) { $error = $LNG['ma_planet_doesnt_exists']; } elseif (!in_array($pziel, $reslist['defense']) && $pziel != 0) { $error = $LNG['ma_wrong_target']; } elseif ($iraks == 0) { $error = $LNG['ma_no_missiles']; } elseif ($anz == 0) { $error = $LNG['ma_add_missile_number']; } elseif ($Target['id_level'] > $USER['authlevel'] && $CONF['adm_attack'] == 0) { $error = $LNG['fl_admins_cannot_be_attacked']; } $TargetUser = GetUserByID($Target['id_owner'], array('onlinetime')); $UserPoints = $USER; $User2Points = $db->uniquequery("SELECT `total_points` FROM " . STATPOINTS . " WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $Target['id_owner'] . "';"); $IsNoobProtec = CheckNoobProtec($UserPoints, $User2Points, $TargetUser['onlinetime']); if ($IsNoobProtec['NoobPlayer']) { $error = $LNG['fl_week_player']; } elseif ($IsNoobProtec['StrongPlayer']) { $error = $LNG['fl_strong_player']; } $template = new template(); $template->page_header(); $template->page_topnav(); $template->page_leftmenu(); $template->page_planetmenu(); $template->page_footer(); if ($error != "") { $template->message($error); exit; } $SpeedFactor = parent::GetGameSpeedFactor(); $Duration = max(round(30 + 60 * $Distance / $SpeedFactor), 30); $DefenseLabel = $pziel == 0 ? $LNG['ma_all'] : $LNG['tech'][$pziel]; if (connection_aborted()) { exit; } $sql = "INSERT INTO " . FLEETS . " SET\r\n\t\t\t\tfleet_owner = '" . $USER['id'] . "',\r\n\t\t\t\tfleet_mission = '10',\r\n\t\t\t\tfleet_amount = '" . $anz . "',\r\n\t\t\t\tfleet_array = '503," . $anz . "',\r\n\t\t\t\tfleet_start_time = '" . (TIMESTAMP + $Duration) . "',\r\n\t\t\t\tfleet_start_galaxy = '" . $PLANET['galaxy'] . "',\r\n\t\t\t\tfleet_start_system = '" . $PLANET['system'] . "',\r\n\t\t\t\tfleet_start_planet ='" . $PLANET['planet'] . "',\r\n\t\t\t\tfleet_start_type = '1',\r\n\t\t\t\tfleet_end_time = '" . (TIMESTAMP + $Duration + 50) . "',\r\n\t\t\t\tfleet_end_stay = '0',\r\n\t\t\t\tfleet_end_galaxy = '" . $TargetGalaxy . "',\r\n\t\t\t\tfleet_end_system = '" . $TargetSystem . "',\r\n\t\t\t\tfleet_end_planet = '" . $TargetPlanet . "',\r\n\t\t\t\tfleet_end_type = '1',\r\n\t\t\t\tfleet_target_obj = '" . $db->sql_escape($pziel) . "',\r\n\t\t\t\tfleet_resource_metal = '0',\r\n\t\t\t\tfleet_resource_crystal = '0',\r\n\t\t\t\tfleet_resource_deuterium = '0',\r\n\t\t\t\tfleet_target_owner = '" . $Target["id_owner"] . "',\r\n\t\t\t\tfleet_group = '0',\r\n\t\t\t\tfleet_mess = '0',\r\n\t\t\t\tstart_time = " . TIMESTAMP . ";\r\n\t\t\t\tUPDATE " . PLANETS . " SET \r\n\t\t\t\tinterplanetary_misil = (interplanetary_misil - " . $anz . ") WHERE id = '" . $PLANET['id'] . "';"; $db->multi_query($sql); $template->message("<b>" . $anz . "</b>" . $LNG['ma_missiles_sended'] . $DefenseLabel, "game.php?page=overview", 3); }
function ShowBanPage() { global $LNG, $USER; $ORDER = $_GET['order'] == 'id' ? "id" : "username"; if ($_GET['view'] == 'bana') { $WHEREBANA = "AND `bana` = '1'"; } $UserList = $GLOBALS['DATABASE']->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '1' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;"); $UserSelect = array('List' => '', 'ListBan' => ''); $Users = 0; while ($a = $GLOBALS['DATABASE']->fetch_array($UserList)) { $UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . ' (ID: ' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>'; $Users++; } $GLOBALS['DATABASE']->free_result($UserList); $ORDER2 = $_GET['order2'] == 'id' ? "id" : "username"; $Banneds = 0; $UserListBan = $GLOBALS['DATABASE']->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' AND `universe` = '1' ORDER BY " . $ORDER2 . " ASC;"); while ($b = $GLOBALS['DATABASE']->fetch_array($UserListBan)) { $UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . ' (ID: ' . $b['id'] . ')</option>'; $Banneds++; } $GLOBALS['DATABASE']->free_result($UserListBan); $template = new template(); $template->loadscript('filterlist.js'); if (isset($_POST['panel'])) { $Name = HTTP::_GP('ban_name', '', true); $BANUSER = $GLOBALS['DATABASE']->getFirstRow("SELECT b.theme, b.longer, u.id, u.urlaubs_modus, u.timezone, u.banaday, u.username, u.email FROM " . USERS . " as u LEFT JOIN " . BANNED . " as b ON u.`username` = b.`who` WHERE u.`username` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND u.`universe` = '1';"); if ($BANUSER['banaday'] <= TIMESTAMP) { $title = $LNG['bo_bbb_title_1']; $changedate = $LNG['bo_bbb_title_2']; $changedate_advert = ''; $reas = ''; $timesus = ''; } else { $title = $LNG['bo_bbb_title_3']; $changedate = $LNG['bo_bbb_title_6']; $changedate_advert = '<td class="c" width="18px"><img src="./styles/resource/images/admin/i.gif" class="tooltip" data-tooltip-content="' . $LNG['bo_bbb_title_4'] . '"></td>'; $reas = $BANUSER['theme']; $timesus = "<tr>\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\n\t\t\t\t\t<th height=25 colspan=2>" . date($LNG['php_tdformat'], $BANUSER['longer']) . "</th>\n\t\t\t\t</tr>"; } $vacation = $BANUSER['urlaubs_modus'] == 1 ? true : false; $template->assign_vars(array('name' => $Name, 'bantitle' => $title, 'changedate' => $changedate, 'reas' => $reas, 'changedate_advert' => $changedate_advert, 'timesus' => $timesus, 'vacation' => $vacation)); } elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) { $Name = HTTP::_GP('ban_name', '', true); $reas = HTTP::_GP('why', '', true); $days = HTTP::_GP('days', 0); $hour = HTTP::_GP('hour', 0); $mins = HTTP::_GP('mins', 0); $secs = HTTP::_GP('secs', 0); $admin = $USER['username']; $mail = $USER['email']; $BanTime = $days * 86400 + $hour * 3600 + $mins * 60 + $secs; if ($BANUSER['longer'] > TIMESTAMP) { $BanTime += $BANUSER['longer'] - TIMESTAMP; } if (isset($_POST['permanent'])) { $BannedUntil = 2147483647; } else { $BannedUntil = $BanTime + TIMESTAMP < TIMESTAMP ? TIMESTAMP : TIMESTAMP + $BanTime; } if ($BANUSER['banaday'] > TIMESTAMP) { $SQL = "UPDATE " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`email` = '" . $mail . "' "; $SQL .= "WHERE `who2` = '" . $Name . "' AND `universe` = '1';"; $GLOBALS['DATABASE']->query($SQL); } else { $SQL = "INSERT INTO " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`universe` = '1', "; $SQL .= "`email` = '" . $mail . "';"; $GLOBALS['DATABASE']->query($SQL); } $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`bana` = '1', "; $SQL .= "`banaday` = '" . $BannedUntil . "', "; $SQL .= isset($_POST['vacat']) ? "`urlaubs_modus` = '1'" : "`urlaubs_modus` = '0'"; $SQL .= "WHERE "; $SQL .= "`username` = '" . $Name . "' AND `universe` = '1';"; $GLOVERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `username` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND `universe` = '1';"); while ($UserData = $GLOBALS['DATABASE']->fetch_array($GLOVERS)) { $timeofban = _date($LNG['php_tdformat'], $BannedUntil, $UserData['timezone']); require_once 'includes/functions/BBCode.php'; require 'includes/classes/Mail.class.php'; if (isset($_POST['permanent'])) { $pmMessage = "Hello " . $UserData['username'] . ",<br> Your Dark-Space: Empire account is permanently suspended for the following reason: " . $reas . ".<br> You might still open a forum thread if you want to resolve your ban issue: <a href=http://forum.dark-space.org/index.php?/forum/17-locked-account/>Click here</a><br><br> Regards<br>The Development Team."; } else { $pmMessage = "Hello " . $UserData['username'] . ",<br> Your Dark-Space: Empire account account is suspended for the following reason: " . $reas . " until '" . $timeofban . "'.<br> You might still open a forum thread if you want to resolve your ban issue: <a href=http://forum.dark-space.org/index.php?/forum/17-locked-account/>Click here</a><br><br> Regards<br>The Development Team."; } $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage); // Dans le cas où nos lignes comportent plus de 70 caractères, nous les coupons en utilisant wordwrap() $to = $UserData['email']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: support@dark-space.org' . "\r\n"; $headers .= 'Reply-To: support@dark-space.org' . "\r\n"; mail($to, 'Your account is suspended', $sendMessage, $headers); } $GLOBALS['DATABASE']->query($SQL); $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans'); exit; } elseif (isset($_POST['unban_name'])) { $Name = HTTP::_GP('unban_name', '', true); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******'DATABASE']->sql_escape($Name) . "' AND `universe` = '1';"); #DELETE FROM ".BANNED." WHERE who = '".$GLOBALS['DATABASE']->sql_escape($Name)."' AND `universe` = '1'; $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans'); exit; } $template->assign_vars(array('UserSelect' => $UserSelect, 'usercount' => $Users, 'bancount' => $Banneds)); $template->show('BanPage.tpl'); }
function ShowUniversePage() { global $LNG, $USER; $template = new template(); $action = HTTP::_GP('action', ''); $universe = HTTP::_GP('uniID', 0); switch ($action) { case 'open': $config = Config::get($universe); $config->game_disable = 1; $config->save(); break; case 'closed': $config = Config::get($universe); $config->game_disable = 0; $config->save(); break; case 'delete': if (!empty($universe) && $universe != ROOT_UNI && $universe != Universe::current()) { $GLOBALS['DATABASE']->query("DELETE FROM " . ALLIANCE . ", " . ALLIANCE_RANK . ", " . ALLIANCE_REQUEST . " \n\t\t\t\tUSING " . ALLIANCE . " \n\t\t\t\tLEFT JOIN " . ALLIANCE_RANK . " ON " . ALLIANCE . ".id = " . ALLIANCE_RANK . ".allianceID\n\t\t\t\tLEFT JOIN " . ALLIANCE_REQUEST . " ON " . ALLIANCE . ".id = " . ALLIANCE_REQUEST . " .allianceID\n\t\t\t\tWHERE ally_universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . BANNED . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . BUDDY . ", " . BUDDY_REQUEST . "\n\t\t\t\tUSING " . BUDDY . "\n\t\t\t\tLEFT JOIN " . BUDDY_REQUEST . " ON " . BUDDY . ".id = " . BUDDY_REQUEST . ".id\n\t\t\t\tWHERE " . BUDDY . ".universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . CONFIG . " WHERE uni = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . DIPLO . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . FLEETS . ", " . FLEETS_EVENT . ", " . AKS . ", " . LOG_FLEETS . "\n\t\t\t\tUSING " . FLEETS . "\n\t\t\t\tLEFT JOIN " . FLEETS_EVENT . " ON " . FLEETS . ".fleet_id = " . FLEETS_EVENT . ".fleetID\n\t\t\t\tLEFT JOIN " . AKS . " ON " . FLEETS . ".fleet_group = " . AKS . ".id\n\t\t\t\tLEFT JOIN " . LOG_FLEETS . " ON " . FLEETS . ".fleet_id = " . LOG_FLEETS . ".fleet_id\n\t\t\t\tWHERE " . FLEETS . ".fleet_universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . MESSAGES . " WHERE message_universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . NOTES . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . PLANETS . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . STATPOINTS . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . TICKETS . ", " . TICKETS_ANSWER . "\n\t\t\t\tUSING " . TICKETS . "\n\t\t\t\tLEFT JOIN " . TICKETS_ANSWER . " ON " . TICKETS . ".ticketID = " . TICKETS_ANSWER . ".ticketID\n\t\t\t\tWHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . TOPKB . " WHERE universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . USERS . ", " . USERS_ACS . ", " . USERS_AUTH . ", " . TOPKB_USERS . ", " . SESSION . ", " . SHORTCUTS . ", " . RECORDS . "\n\t\t\t\tUSING " . USERS . "\n\t\t\t\tLEFT JOIN " . USERS_ACS . " ON " . USERS . ".id = " . USERS_ACS . ".userID\n\t\t\t\tLEFT JOIN " . USERS_AUTH . " ON " . USERS . ".id = " . USERS_AUTH . ".id\n\t\t\t\tLEFT JOIN " . TOPKB_USERS . " ON " . USERS . ".id = " . TOPKB_USERS . ".uid\n\t\t\t\tLEFT JOIN " . SESSION . " ON " . USERS . ".id = " . SESSION . ".userID\n\t\t\t\tLEFT JOIN " . SHORTCUTS . " ON " . USERS . ".id = " . SHORTCUTS . ".ownerID\n\t\t\t\tLEFT JOIN " . RECORDS . " ON " . USERS . ".id = " . RECORDS . ".userID\n\t\t\t\tLEFT JOIN " . LOSTPASSWORD . " ON " . USERS . ".id = " . LOSTPASSWORD . ".userID\n\t\t\t\tWHERE " . USERS . ".universe = " . $universe . ";"); $GLOBALS['DATABASE']->query("DELETE FROM " . USERS_VALID . " WHERE universe = " . $universe . ";"); if (Universe::getEmulated() == $universe) { Universe::setEmulated(Universe::current()); } if (count(Universe::availableUniverses()) == 2) { // Hack The Session setcookie(session_name(), session_id(), SESSION_LIFETIME, HTTP_BASE, NULL, HTTPS, true); HTTP::redirectTo("../admin.php?reload=r"); } } break; case 'create': $universeCount = count(Universe::availableUniverses()); // Check Multiuniverse Support $ch = curl_init(); if ($universeCount == 1) { curl_setopt($ch, CURLOPT_URL, PROTOCOL . HTTP_HOST . HTTP_BASE . "uni" . ROOT_UNI . "/"); } else { curl_setopt($ch, CURLOPT_URL, PROTOCOL . HTTP_HOST . HTTP_BASE); } curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; 2Moons/" . Config::get()->VERSION . "; +http://2moons.cc)"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3", "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4")); curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode != 302) { $template = new template(); $template->message(str_replace(array('{NGINX-CODE}'), array('rewrite /(.*)/?uni[0-9]+/?(.*) /$1/$2 break;'), $LNG->getTemplate('createUniverseInfo')) . '<a href="javascript:window.history.back();"><button>' . $LNG['uvs_back'] . '</button></a>' . '<a href="javascript:window.location.reload();"><button>' . $LNG['uvs_reload'] . '</button></a>'); exit; } $config = Config::get(); $configSQL = array(); foreach (Config::getGlobalConfigKeys() as $basicConfigKey) { $configSQL[] = '`' . $basicConfigKey . '` = "' . $config->{$basicConfigKey} . '"'; } $configSQL[] = '`uni_name` = "' . $LNG['fcm_universe'] . ' ' . ($universeCount + 1) . '"'; $configSQL[] = '`close_reason` = ""'; $configSQL[] = '`OverviewNewsText` = "' . $GLOBALS['DATABASE']->escape($config->OverviewNewsText) . '"'; $GLOBALS['DATABASE']->query("INSERT INTO " . CONFIG . " SET " . implode(', ', $configSQL) . ";"); $newUniverse = $GLOBALS['DATABASE']->GetInsertID(); Config::reload(); list($userID, $planetID) = PlayerUtil::createPlayer($newUniverse, $USER['username'], '', $USER['email'], $USER['lang'], 1, 1, 1, NULL, AUTH_ADM); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET password = '******'password'] . "' WHERE id = " . $userID . ";"); if ($universeCount === 1) { // Hack The Session setcookie(session_name(), session_id(), SESSION_LIFETIME, HTTP_ROOT . 'uni' . $USER['universe'] . '/', NULL, HTTPS, true); HTTP::redirectTo("uni" . $USER['universe'] . "/admin.php?reload=r"); } break; } $uniList = array(); $uniResult = $GLOBALS['DATABASE']->query("SELECT uni, users_amount, game_disable, energySpeed, halt_speed, resource_multiplier, fleet_speed, game_speed, uni_name, COUNT(DISTINCT inac.id) as inactive, COUNT(planet.id) as planet\n\tFROM " . CONFIG . " conf\n\tLEFT JOIN " . USERS . " as inac ON uni = inac.universe AND inac.onlinetime < " . (TIMESTAMP - INACTIVE) . "\n\tLEFT JOIN " . PLANETS . " as planet ON uni = planet.universe\n\tGROUP BY conf.uni, inac.universe, planet.universe\n\tORDER BY uni ASC;"); while ($uniRow = $GLOBALS['DATABASE']->fetch_array($uniResult)) { $uniList[$uniRow['uni']] = $uniRow; } $template->assign_vars(array('uniList' => $uniList, 'SID' => session_id())); $template->show('UniversePage.tpl'); }
function ShowRightsPage() { global $LNG, $USER; $mode = HTTP::_GP('mode', ''); switch ($mode) { case 'rights': $template = new template(); $template->loadscript('filterlist.js'); if ($_POST) { $id = HTTP::_GP('id_1', 0); if ($USER['id'] != ROOT_USER && $id == ROOT_USER) { $template->message($LNG['ad_authlevel_error_3'], '?page=rights&mode=rights&sid=' . session_id()); exit; } if (!isset($_POST['rights'])) { $_POST['rights'] = array(); } if ($_POST['action'] == 'send') { $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET `rights` = '" . serialize(array_map('intval', $_POST['rights'])) . "' WHERE `id` = '" . $id . "';"); } $Rights = $GLOBALS['DATABASE']->getFirstRow("SELECT rights FROM " . USERS . " WHERE `id` = '" . $id . "';"); if (($Rights['rights'] = unserialize($Rights['rights'])) === false) { $Rights['rights'] = array(); } $Files = array_map('prepare', array_diff(scandir('includes/pages/adm/'), array('.', '..', '.svn', 'index.html', '.htaccess', 'ShowIndexPage.php', 'ShowOverviewPage.php', 'ShowMenuPage.php', 'ShowTopnavPage.php'))); $template->assign_vars(array('Files' => $Files, 'Rights' => $Rights['rights'], 'id' => $id, 'yesorno' => $LNG['one_is_yes'], 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'button_submit' => $LNG['button_submit'], 'sid' => session_id())); $template->show('ModerrationRightsPostPage.tpl'); exit; } if ($_GET['get'] == 'adm') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_ADM . "'"; } elseif ($_GET['get'] == 'ope') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_OPS . "'"; } elseif ($_GET['get'] == 'mod') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_MOD . "'"; } elseif ($_GET['get'] == 'pla') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_USR . "'"; } $QueryUsers = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . $WHEREUSERS . ";"); $UserList = ""; while ($List = $GLOBALS['DATABASE']->fetch_array($QueryUsers)) { $UserList .= '<option value="' . $List['id'] . '">' . $List['username'] . ' (' . $LNG['rank'][$List['authlevel']] . ')</option>'; } $template->assign_vars(array('Selector' => array(0 => $LNG['rank'][0], 1 => $LNG['rank'][1], 2 => $LNG['rank'][2], 3 => $LNG['rank'][3]), 'UserList' => $UserList, 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'bo_select_title' => $LNG['bo_select_title'], 'button_submit' => $LNG['button_submit'], 'button_deselect' => $LNG['button_deselect'], 'button_filter' => $LNG['button_filter'], 'ad_authlevel_insert_id' => $LNG['ad_authlevel_insert_id'], 'ad_authlevel_auth' => $LNG['ad_authlevel_auth'], 'ad_authlevel_aa' => $LNG['ad_authlevel_aa'], 'ad_authlevel_oo' => $LNG['ad_authlevel_oo'], 'ad_authlevel_mm' => $LNG['ad_authlevel_mm'], 'ad_authlevel_jj' => $LNG['ad_authlevel_jj'], 'ad_authlevel_tt' => $LNG['ad_authlevel_tt'], 'sid' => session_id())); $template->show('ModerrationRightsPage.tpl'); break; case 'users': $template = new template(); $template->loadscript('filterlist.js'); if ($_POST) { $id = HTTP::_GP('id_1', 0); $authlevel = HTTP::_GP('authlevel', 0); if ($id == 0) { $id = HTTP::_GP('id_2', 0); } if ($USER['id'] != ROOT_USER && $id == ROOT_USER) { $template->message($LNG['ad_authlevel_error_3'], '?page=rights&mode=users&sid=' . session_id()); exit; } $GLOBALS['DATABASE']->multi_query("UPDATE " . USERS . " SET `authlevel` = '" . HTTP::_GP('authlevel', 0) . "' WHERE `id` = '" . $id . "';"); $template->message($LNG['ad_authlevel_succes'], '?page=rights&mode=users&sid=' . session_id()); exit; } if ($_GET['get'] == 'adm') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_ADM . "'"; } elseif ($_GET['get'] == 'ope') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_OPS . "'"; } elseif ($_GET['get'] == 'mod') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_MOD . "'"; } elseif ($_GET['get'] == 'pla') { $WHEREUSERS = "AND `authlevel` = '" . AUTH_USR . "'"; } $QueryUsers = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . $WHEREUSERS . ";"); $UserList = ""; while ($List = $GLOBALS['DATABASE']->fetch_array($QueryUsers)) { $UserList .= '<option value="' . $List['id'] . '">' . $List['username'] . ' (' . $LNG['rank'][$List['authlevel']] . ')</option>'; } $template->assign_vars(array('Selector' => array(0 => $LNG['rank'][0], 1 => $LNG['rank'][1], 2 => $LNG['rank'][2], 3 => $LNG['rank'][3]), 'UserList' => $UserList, 'ad_authlevel_title' => $LNG['ad_authlevel_title'], 'bo_select_title' => $LNG['bo_select_title'], 'button_submit' => $LNG['button_submit'], 'button_deselect' => $LNG['button_deselect'], 'button_filter' => $LNG['button_filter'], 'ad_authlevel_insert_id' => $LNG['ad_authlevel_insert_id'], 'ad_authlevel_auth' => $LNG['ad_authlevel_auth'], 'ad_authlevel_aa' => $LNG['ad_authlevel_aa'], 'ad_authlevel_oo' => $LNG['ad_authlevel_oo'], 'ad_authlevel_mm' => $LNG['ad_authlevel_mm'], 'ad_authlevel_jj' => $LNG['ad_authlevel_jj'], 'ad_authlevel_tt' => $LNG['ad_authlevel_tt'], 'sid' => session_id())); $template->show('ModerrationUsersPage.tpl'); break; } }
public function __construct() { global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist, $OfficerInfo; include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php'; include_once ROOT_PATH . 'includes/functions/GetElementPrice.php'; $template = new template(); if ($PLANET[$resource[31]] == 0) { $template->message($LNG['bd_lab_required']); exit; } $bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false; $TheCommand = request_var('cmd', ''); $Element = request_var('tech', 0); $ListID = request_var('listid', 0); $PlanetRess = new ResourceUpdate(); $PLANET[$resource[31] . '_inter'] = $PlanetRess->CheckAndGetLabLevel($USER, $PLANET); $PlanetRess->CalcResource(); if (!empty($Element) && $bContinue && $USER['urlaubs_modus'] == 0 && ($USER[$resource[$Element]] < $pricelist[$Element]['max'] && IsTechnologieAccessible($USER, $PLANET, $Element) && in_array($Element, $reslist['tech'])) || $TheCommand == "cancel" || $TheCommand == "remove") { switch ($TheCommand) { case 'cancel': $this->CancelBuildingFromQueue($PlanetRess); break; case 'remove': $this->RemoveBuildingFromQueue($ListID, $PlanetRess); break; case 'insert': $this->AddBuildingToQueue($Element, true); break; case 'destroy': $this->AddBuildingToQueue($Element, false); break; } } $PlanetRess->SavePlanetToDB(); $ScriptInfo = array(); $TechQueue = $this->ShowTechQueue(); foreach ($reslist['tech'] as $ID => $Element) { if (!IsTechnologieAccessible($USER, $PLANET, $Element)) { continue; } $CanBeDone = IsElementBuyable($USER, $PLANET, $Element); if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) { $TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>"; } elseif (MAX_RESEACH_QUEUE_SIZE > 1) { $LevelToDo = 1 + $USER[$resource[$Element]]; $TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&mode=research&cmd=insert&tech=" . $Element . "\"><font color=\"#00FF00\">" . ($USER['b_tech_id'] != 0 ? $LNG['bd_add_to_list'] : $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo)) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>"; if ($USER['b_tech_id'] != 0) { $template->loadscript('researchlist.js'); $template->execscript('ReBuildView();Techlist();'); $ScriptInfo = array('bd_cancel' => $LNG['bd_cancel'], 'bd_continue' => $LNG['bd_continue'], 'bd_finished' => $LNG['bd_finished'], 'build' => $TechQueue); } } else { if ($USER['b_tech_id'] == 0) { $LevelToDo = 1 + $USER[$resource[$Element]]; $TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&mode=research&cmd=insert&tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>"; } else { if ($USER['b_tech_id'] == $Element) { $template->loadscript('research.js'); if ($USER['b_tech_planet'] == $PLANET['id']) { $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']); } else { $ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $TechQueue['planet'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']); } $TechnoLink = '<div id="research"></div>'; } else { $TechnoLink = '<center>-</center>'; } } } $ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * $OfficerInfo[610]['info'] . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * $OfficerInfo[611]['info'] . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink, 'oldlink' => MAX_RESEACH_QUEUE_SIZE == 1, 'queue' => $TechQueue); } $template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time'])); $template->show('buildings_research.tpl'); }
public function DefensesBuildingPage() { global $USER, $PLANET, $LNG, $resource, $dpath, $reslist; include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php'; include_once ROOT_PATH . 'includes/functions/GetElementPrice.php'; $template = new template(); if ($PLANET[$resource[21]] == 0) { $template->message($LNG['bd_shipyard_required']); exit; } $fmenge = $_POST['fmenge']; $cancel = request_var('auftr', range(0, MAX_FLEET_OR_DEFS_IN_BUILD - 1)); $action = request_var('action', ''); $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $NotBuilding = true; if (!empty($PLANET['b_building_id'])) { $CurrentQueue = $PLANET['b_building_id']; $QueueArray = explode(";", $CurrentQueue); for ($i = 0; $i < count($QueueArray); $i++) { $ListIDArray = explode(",", $QueueArray[$i]); if ($ListIDArray[0] == 21 || $ListIDArray[0] == 15) { $NotBuilding = false; break; } } } if (isset($fmenge) && $NotBuilding == true && $USER['urlaubs_modus'] == 0) { $ebuild = explode(";", $PLANET['b_hangar_id']); if (count($ebuild) - 1 >= MAX_FLEET_OR_DEFS_IN_BUILD) { $template->message(sprintf($LNG['bd_max_builds'], MAX_FLEET_OR_DEFS_IN_BUILD), "?page=buildings&mode=fleet", 3); exit; } $Missiles[502] = $PLANET[$resource[502]]; $Missiles[503] = $PLANET[$resource[503]]; $SiloSize = $PLANET[$resource[44]]; $MaxMissiles = $SiloSize * 10; $BuildQueue = $PLANET['b_hangar_id']; $BuildArray = explode(";", $BuildQueue); for ($QElement = 0; $QElement < count($BuildArray); $QElement++) { $ElmentArray = explode(",", $BuildArray[$QElement]); if (isset($Missiles[$ElmentArray[0]])) { $Missiles[$ElmentArray[0]] += $ElmentArray[1]; } } foreach ($fmenge as $Element => $Count) { if (empty($Count) || !in_array($Element, $reslist['defense'])) { continue; } $Count = is_numeric($Count) ? $Count : 0; $Count = max(min($Count, MAX_FLEET_OR_DEFS_PER_ROW), 0); $MaxElements = $this->GetMaxConstructibleElements($Element); if (empty($Element) || empty($Count) || empty($MaxElements) || !IsTechnologieAccessible($USER, $PLANET, $Element)) { continue; } if ($Element == 502 || $Element == 503) { $ActuMissiles = $Missiles[502] + 2 * $Missiles[503]; $MissilesSpace = $MaxMissiles - $ActuMissiles; $Count = $Element == 502 ? min($Count, $MissilesSpace) : min($Count, floor($MissilesSpace / 2)); $Count = min($Count, $MaxElements); $Missiles[$Element] += $Count; } elseif (in_array($Element, $reslist['one'])) { $Count = $PLANET[$resource[$Element]] == 0 && strpos($PLANET['b_hangar_id'], $Element . ',') === false ? 1 : 0; } else { $Count = min($Count, $MaxElements); } if ($Count < 1) { continue; } $Ressource = $this->GetElementRessources($Element, $Count); $PLANET['metal'] -= $Ressource['metal']; $PLANET['crystal'] -= $Ressource['crystal']; $PLANET['deuterium'] -= $Ressource['deuterium']; $PLANET['norio'] -= $Ressource['norio']; $USER['darkmatter'] -= $Ressource['darkmatter']; $PLANET['b_hangar_id'] .= $Element . ',' . floattostring($Count) . ';'; } } if ($action == "delete" && is_array($cancel) && $USER['urlaubs_modus'] == 0) { $this->CancelAuftr($cancel); } $PlanetRess->SavePlanetToDB(); foreach ($reslist['defense'] as $Element) { if (!IsTechnologieAccessible($USER, $PLANET, $Element)) { continue; } $DefenseList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element, false), 'restprice' => $this->GetRestPrice($Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'IsAvailable' => IsElementBuyable($USER, $PLANET, $Element, false), 'GetMaxAmount' => floattostring($this->GetMaxConstructibleElements($Element)), 'Available' => pretty_number($PLANET[$resource[$Element]]), 'AlreadyBuild' => in_array($Element, $reslist['one']) && (strpos($PLANET['b_hangar_id'], $Element . ",") !== false || $PLANET[$resource[$Element]] != 0) ? true : false); } $Buildlist = array(); if (!empty($PLANET['b_hangar_id'])) { $ElementQueue = explode(';', $PLANET['b_hangar_id']); $Shipyard = array(); $QueueTime = 0; foreach ($ElementQueue as $ElementLine => $Element) { if (empty($Element)) { continue; } $Element = explode(',', $Element); $ElementTime = GetBuildingTime($USER, $PLANET, $Element[0]); $QueueTime += $ElementTime * $Element[1]; $Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime); } $template->loadscript('bcmath.js'); $template->loadscript('shipyard.js'); $template->execscript('ShipyardInit();'); $Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0))); } $template->assign_vars(array('DefenseList' => $DefenseList, 'NotBuilding' => $NotBuilding, 'bd_available' => $LNG['bd_available'], 'bd_remaining' => $LNG['bd_remaining'], 'fgf_time' => $LNG['fgf_time'], 'bd_build_ships' => $LNG['bd_build_ships'], 'bd_building_shipyard' => $LNG['bd_building_shipyard'], 'bd_protection_shield_only_one' => $LNG['bd_protection_shield_only_one'], 'bd_cancel_warning' => $LNG['bd_cancel_warning'], 'bd_cancel_send' => $LNG['bd_cancel_send'], 'bd_operating' => $LNG['bd_operating'], 'bd_actual_production' => $LNG['bd_actual_production'], 'BuildList' => json_encode($Buildlist), 'maxlength' => strlen(MAX_FLEET_OR_DEFS_PER_ROW))); $template->show("shipyard_defense.tpl"); }
/** * 2Moons * Copyright (C) 2011 Slaver * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ */ function ShowTraderPage() { global $USER, $PLANET, $LNG, $db; $ress = request_var('ress', ''); $action = request_var('action', ''); $metal = round(request_var('metal', 0.0), 0); $crystal = round(request_var('crystal', 0.0), 0); $deut = round(request_var('deuterium', 0.0), 0); $PlanetRess = new ResourceUpdate(); $template = new template(); $template->loadscript("trader.js"); if ($ress != '') { switch ($ress) { case 'metal': if ($action == "trade") { if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) { $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1); } elseif ($crystal < 0 || $deut < 0) { $template->message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1); } else { $trade = $crystal * 2 + $deut * 4; $PlanetRess->CalcResource(); if ($PLANET['metal'] > $trade) { $PLANET['metal'] -= $trade; $PLANET['crystal'] += $crystal; $PLANET['deuterium'] += $deut; $USER['darkmatter'] -= DARKMATTER_FOR_TRADER; $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1); } else { $template->message($LNG['tr_not_enought_metal'], "game.php?page=trader", 1); } $PlanetRess->SavePlanetToDB(); } } else { $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_metal' => $LNG['tr_sell_metal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "2", 'mod_ma_res_b' => "4", 'ress' => $ress)); $template->show("trader_metal.tpl"); } break; case 'crystal': if ($action == "trade") { if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) { $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1); } elseif ($metal < 0 || $deut < 0) { $template->message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1); } else { $trade = $metal * 0.5 + $deut * 2; $PlanetRess->CalcResource(); if ($PLANET['crystal'] > $trade) { $PLANET['metal'] += $metal; $PLANET['crystal'] -= $trade; $PLANET['deuterium'] += $deut; $USER['darkmatter'] -= DARKMATTER_FOR_TRADER; $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1); } else { $template->message($LNG['tr_not_enought_crystal'], "game.php?page=trader", 1); } $PlanetRess->SavePlanetToDB(); } } else { $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_crystal' => $LNG['tr_sell_crystal'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.5", 'mod_ma_res_b' => "2", 'ress' => $ress)); $template->show("trader_crystal.tpl"); } break; case 'deuterium': if ($action == "trade") { if ($USER['darkmatter'] < DARKMATTER_FOR_TRADER) { $template->message(sprintf($LNG['tr_empty_darkmatter'], $LNG['Darkmatter']), "game.php?page=trader", 1); } elseif ($metal < 0 || $crystal < 0) { message($LNG['tr_only_positive_numbers'], "game.php?page=trader", 1); } else { $trade = $metal * 0.25 + $crystal * 0.5; $PlanetRess->CalcResource(); if ($PLANET['deuterium'] > $trade) { $PLANET['metal'] += $metal; $PLANET['crystal'] += $crystal; $PLANET['deuterium'] -= $trade; $USER['darkmatter'] -= DARKMATTER_FOR_TRADER; $template->message($LNG['tr_exchange_done'], "game.php?page=trader", 1); } else { $template->message($LNG['tr_not_enought_deuterium'], "game.php?page=trader", 1); } $PlanetRess->SavePlanetToDB(); } } else { $template->assign_vars(array('tr_resource' => $LNG['tr_resource'], 'tr_sell_deuterium' => $LNG['tr_sell_deuterium'], 'tr_amount' => $LNG['tr_amount'], 'tr_exchange' => $LNG['tr_exchange'], 'tr_quota_exchange' => $LNG['tr_quota_exchange'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'mod_ma_res_a' => "0.25", 'mod_ma_res_b' => "0.5", 'ress' => $ress)); $template->show("trader_deuterium.tpl"); } break; } } else { $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $template->assign_vars(array('tr_cost_dm_trader' => sprintf($LNG['tr_cost_dm_trader'], pretty_number(DARKMATTER_FOR_TRADER), $LNG['Darkmatter']), 'tr_call_trader_who_buys' => $LNG['tr_call_trader_who_buys'], 'tr_call_trader' => $LNG['tr_call_trader'], 'tr_exchange_quota' => $LNG['tr_exchange_quota'], 'tr_call_trader_submit' => $LNG['tr_call_trader_submit'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'])); $template->show("trader_overview.tpl"); } }
/** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ function ShowPhalanxPage() { global $USER, $PLANET, $LNG, $db, $UNI; include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.php'; include_once ROOT_PATH . 'includes/classes/class.FlyingFleetsTable.php'; include_once ROOT_PATH . 'includes/classes/class.GalaxyRows.php'; $FlyingFleetsTable = new FlyingFleetsTable(); $GalaxyRows = new GalaxyRows(); $template = new template(); $template->isPopup(true); $template->loadscript('phalanx.js'); $template->execscript('FleetTime();window.setInterval("FleetTime()", 1000);'); $PhRange = $GalaxyRows->GetPhalanxRange($PLANET['phalanx']); $Galaxy = request_var('galaxy', 0); $System = request_var('system', 0); $Planet = request_var('planet', 0); if ($Galaxy != $PLANET['galaxy'] || $System > $PLANET['system'] + $PhRange || $System < max(1, $PLANET['system'] - $PhRange)) { $template->message($LNG['px_out_of_range'], false, 0, true); exit; } if ($PLANET['deuterium'] < 5000) { $template->message($LNG['px_no_deuterium'], false, 0, true); exit; } $PLANET['deuterium'] -= 5000; $db->query("UPDATE " . PLANETS . " SET `deuterium` = `deuterium` - '5000' WHERE `id` = '" . $PLANET['id'] . "';"); $TargetInfo = $db->uniquequery("SELECT id, name, id_owner FROM " . PLANETS . " WHERE`universe` = '" . $UNI . "' AND `galaxy` = '" . $Galaxy . "' AND `system` = '" . $System . "' AND `planet` = '" . $Planet . "' AND `planet_type` = '1';"); if (empty($TargetInfo)) { $template->message($LNG['px_out_of_range'], false, 0, true); exit; } $FleetToTarget = $db->query("SELECT * FROM " . FLEETS . " WHERE `fleet_start_id` = '" . $TargetInfo['id'] . "' OR `fleet_end_id` = '" . $TargetInfo['id'] . "' ORDER BY `fleet_start_time`;"); $fpage = array(); $FleetData = array(); $_SESSION['USER']['spy_tech'] = 8; while ($FleetRow = $db->fetch_array($FleetToTarget)) { $Record++; $IsOwner = $FleetRow['fleet_owner'] == $TargetInfo['id_owner'] ? true : false; $FleetRow['fleet_resource_metal'] = 0; $FleetRow['fleet_resource_crystal'] = 0; $FleetRow['fleet_resource_deuterium'] = 0; $FleetRow['fleet_resource_norio'] = 0; $FleetRow['fleet_resource_darkmatter'] = 0; if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] > TIMESTAMP) { $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $IsOwner, 'fs', $Record); $FleetData[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']]['fleet_return']; } if ($FleetRow['fleet_mission'] == 4) { continue; } if ($FleetRow['fleet_mess'] != 1 && $FleetRow['fleet_end_stay'] > TIMESTAMP) { $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $IsOwner, 'ft', $Record); $FleetData[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']]['fleet_return']; } if ($IsOwner == false) { continue; } if ($FleetRow['fleet_end_time'] > TIMESTAMP) { $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, $IsOwner, 'fe', $Record); $FleetData[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']]['fleet_return']; } } $_SESSION['USER']['spy_tech'] = $USER['spy_tech']; $db->free_result($FleetToTarget); if (!empty($fpage)) { ksort($fpage); } $template->assign_vars(array('phl_pl_galaxy' => $Galaxy, 'phl_pl_system' => $System, 'phl_pl_place' => $Planet, 'phl_pl_name' => $TargetInfo['name'], 'fleets' => $fpage, 'FleetData' => json_encode($FleetData), 'px_scan_position' => $LNG['px_scan_position'], 'px_no_fleet' => $LNG['px_no_fleet'], 'px_fleet_movement' => $LNG['px_fleet_movement'])); $template->show('phalax_body.tpl'); }
function ShowCreatorPage() { global $LNG, $USER; $template = new template(); switch ($_GET['mode']) { case 'user': $LNG->includeData(array('PUBLIC')); if ($_POST) { $UserName = HTTP::_GP('name', '', UTF8_SUPPORT); $UserPass = HTTP::_GP('password', ''); $UserPass2 = HTTP::_GP('password2', ''); $UserMail = HTTP::_GP('email', ''); $UserMail2 = HTTP::_GP('email2', ''); $UserAuth = HTTP::_GP('authlevel', 0); $Galaxy = HTTP::_GP('galaxy', 0); $System = HTTP::_GP('system', 0); $Planet = HTTP::_GP('planet', 0); $Language = HTTP::_GP('lang', ''); $ExistsUser = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND username = '******'DATABASE']->sql_escape($UserName) . "') + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND username = '******'DATABASE']->sql_escape($UserName) . "')"); $ExistsMails = $GLOBALS['DATABASE']->getFirstCell("SELECT (SELECT COUNT(*) FROM " . USERS . " WHERE universe = " . Universe::getEmulated() . " AND (email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "' OR email_2 = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')) + (SELECT COUNT(*) FROM " . USERS_VALID . " WHERE universe = " . Universe::getEmulated() . " AND email = '" . $GLOBALS['DATABASE']->sql_escape($UserMail) . "')"); $errors = ""; $config = Config::get(Universe::getEmulated()); if (!PlayerUtil::isMailValid($UserMail)) { $errors .= $LNG['invalid_mail_adress']; } if (empty($UserName)) { $errors .= $LNG['empty_user_field']; } if (strlen($UserPass) < 6) { $errors .= $LNG['password_lenght_error']; } if ($UserPass != $UserPass2) { $errors .= $LNG['different_passwords']; } if ($UserMail != $UserMail2) { $errors .= $LNG['different_mails']; } if (!PlayerUtil::isNameValid($UserName)) { $errors .= $LNG['user_field_specialchar']; } if ($ExistsUser != 0) { $errors .= $LNG['user_already_exists']; } if ($ExistsMails != 0) { $errors .= $LNG['mail_already_exists']; } if (!PlayerUtil::isPositionFree(Universe::getEmulated(), $Galaxy, $System, $Planet)) { $errors .= $LNG['planet_already_exists']; } if ($Galaxy > $config->max_galaxy || $System > $config->max_system || $Planet > $config->max_planets) { $errors .= $LNG['po_complete_all2']; } if (!empty($errors)) { $template->message($errors, '?page=create&mode=user', 10, true); exit; } $Language = array_key_exists($Language, $LNG->getAllowedLangs(false)) ? $Language : $config->lang; PlayerUtil::createPlayer(Universe::getEmulated(), $UserName, PlayerUtil::cryptPassword($UserPass), $UserMail, $Language, $Galaxy, $System, $Planet, $LNG['fcm_planet'], $UserAuth); $template->message($LNG['new_user_success'], '?page=create&mode=user', 5, true); exit; } $AUTH = array(); $AUTH[AUTH_USR] = $LNG['user_level'][AUTH_USR]; if ($USER['authlevel'] >= AUTH_OPS) { $AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS]; } if ($USER['authlevel'] >= AUTH_MOD) { $AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD]; } if ($USER['authlevel'] >= AUTH_ADM) { $AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM]; } $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'universe' => $LNG['mu_universe'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'lang_reg' => $LNG['lang_reg'], 'new_title' => $LNG['new_title'], 'Selector' => array('auth' => $AUTH, 'lang' => $LNG->getAllowedLangs(false)))); $template->show('CreatePageUser.tpl'); break; case 'moon': if ($_POST) { $PlanetID = HTTP::_GP('add_moon', 0); $MoonName = HTTP::_GP('name', '', UTF8_SUPPORT); $Diameter = HTTP::_GP('diameter', 0); $MoonPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT temp_max, temp_min, id_luna, galaxy, system, planet, planet_type, destruyed, id_owner FROM " . PLANETS . " WHERE id = '" . $PlanetID . "' AND universe = '" . Universe::getEmulated() . "' AND planet_type = '1' AND destruyed = '0';"); if (!isset($MoonPlanet)) { $template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true); exit; } $moonId = PlayerUtil::createMoon(Universe::getEmulated(), $MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $MoonPlanet['id_owner'], 20, $_POST['diameter_check'] == 'on' ? NULL : $Diameter, $MoonName); if ($moonId !== false) { $template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true); } else { $template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true); } exit; } $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'universum' => $LNG['mu_universe'], 'po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('CreatePageMoon.tpl'); break; case 'planet': if ($_POST) { $id = HTTP::_GP('id', 0); $Galaxy = HTTP::_GP('galaxy', 0); $System = HTTP::_GP('system', 0); $Planet = HTTP::_GP('planet', 0); $name = HTTP::_GP('name', '', UTF8_SUPPORT); $field_max = HTTP::_GP('field_max', 0); $config = Config::get(Universe::getEmulated()); if ($Galaxy > $config->max_galaxy || $System > $config->max_system || $Planet > $config->max_planets) { $template->message($LNG['po_complete_all2'], '?page=create&mode=planet', 3, true); exit; } $ISUser = $GLOBALS['DATABASE']->getFirstRow("SELECT id, authlevel FROM " . USERS . " WHERE id = '" . $id . "' AND universe = '" . Universe::getEmulated() . "';"); if (!PlayerUtil::checkPosition(Universe::getEmulated(), $Galaxy, $System, $Planet) || !isset($ISUser)) { $template->message($LNG['po_complete_all'], '?page=create&mode=planet', 3, true); exit; } $planetId = PlayerUtil::createPlanet($Galaxy, $System, $Planet, Universe::getEmulated(), $id, NULL, false, $ISUser['authlevel']); $SQL = "UPDATE " . PLANETS . " SET "; if ($_POST['diameter_check'] != 'on' || $field_max > 0) { $SQL .= "field_max = '" . $field_max . "' "; } if (!empty($name)) { $SQL .= ", name = '" . $GLOBALS['DATABASE']->sql_escape($name) . "' "; } $SQL .= "WHERE "; $SQL .= "id = '" . $planetId . "'"; $GLOBALS['DATABASE']->query($SQL); $template->message($LNG['po_complete_succes'], '?page=create&mode=planet', 3, true); exit; } $template->assign_vars(array('admin_auth' => $USER['authlevel'], 'po_add_planet' => $LNG['po_add_planet'], 'po_galaxy' => $LNG['po_galaxy'], 'po_system' => $LNG['po_system'], 'po_planet' => $LNG['po_planet'], 'input_id_user' => $LNG['input_id_user'], 'new_creator_coor' => $LNG['new_creator_coor'], 'po_name_planet' => $LNG['po_name_planet'], 'po_fields_max' => $LNG['po_fields_max'], 'button_add' => $LNG['button_add'], 'po_colony' => $LNG['fcp_colony'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'])); $template->show('CreatePagePlanet.tpl'); break; default: $template->assign_vars(array('new_creator_title_u' => $LNG['new_creator_title_u'], 'new_creator_title_p' => $LNG['new_creator_title_p'], 'new_creator_title_l' => $LNG['new_creator_title_l'], 'new_creator_title' => $LNG['new_creator_title'])); $template->show('CreatePage.tpl'); break; } }
function ShowCronjobOverview() { if (isset($_GET['lock'])) { $GLOBALS['DATABASE']->query("UPDATE " . CRONJOBS . " SET `lock` = " . (HTTP::_GP('lock', 0) ? 'MD5(UNIX_TIMESTAMP())' : 'NULL') . " WHERE cronjobID = " . HTTP::_GP('id', 0) . ";"); } if (isset($_GET['active'])) { $GLOBALS['DATABASE']->query("UPDATE " . CRONJOBS . " SET `isActive` = " . HTTP::_GP('active', 0) . " WHERE cronjobID = " . HTTP::_GP('id', 0) . ";"); } $data = $GLOBALS['DATABASE']->query("SELECT * FROM " . CRONJOBS . ";"); $template = new template(); if (!$data) { $template->message($LNG['cronjob_no_data']); } $CronjobArray = array(); while ($CronjobRow = $GLOBALS['DATABASE']->fetch_array($data)) { $CronjobArray[] = array('id' => $CronjobRow['cronjobID'], 'isActive' => $CronjobRow['isActive'], 'name' => $CronjobRow['name'], 'min' => $CronjobRow['min'], 'hours' => $CronjobRow['hours'], 'dom' => $CronjobRow['dom'], 'month' => getCronjobTimes($CronjobRow['month'], 12), 'dow' => getCronjobTimes($CronjobRow['dow'], 6), 'class' => $CronjobRow['class'], 'nextTime' => $CronjobRow['nextTime'], 'lock' => !empty($CronjobRow['lock'])); } $template = new template(); $template->assign_vars(array('CronjobArray' => $CronjobArray)); $template->show("CronjobOverview.tpl"); }
function ShowAccountDataPage() { global $USER, $reslist, $resource, $LNG; $template = new template(); $id_u = HTTP::_GP('id_u', 0); if (!empty($id_u)) { $OnlyQueryLogin = $GLOBALS['DATABASE']->getFirstRow("SELECT `id`, `authlevel` FROM " . USERS . " WHERE `id` = '" . $id_u . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); if (!isset($OnlyQueryLogin)) { exit($template->message($LNG['ac_username_doesnt'], '?page=accoutdata')); } else { foreach (array_merge($reslist['officier'], $reslist['tech']) as $ID) { $SpecifyItemsUQ .= "u.`" . $resource[$ID] . "`,"; } // COMIENZA SAQUEO DE DATOS DE LA TABLA DE USUARIOS $SpecifyItemsU = "u.id,u.username,u.email,u.email_2,u.authlevel,u.id_planet,u.galaxy,u.system,u.planet,u.user_lastip,u.ip_at_reg,u.darkmatter,u.register_time,u.onlinetime,u.urlaubs_modus,u.\n\t\t\t urlaubs_until,u.ally_id,a.ally_name," . $SpecifyItemsUQ . "\n\t\t\t u.ally_register_time,u.ally_rank_id,u.bana,u.banaday"; $UserQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsU . " FROM " . USERS . " as u LEFT JOIN " . SESSION . " as s ON s.userID = u.id LEFT JOIN " . ALLIANCE . " a ON a.id = u.ally_id WHERE u.`id` = '" . $id_u . "';"); $reg_time = _date($LNG['php_tdformat'], $UserQuery['register_time'], $USER['timezone']); $onlinetime = _date($LNG['php_tdformat'], $UserQuery['onlinetime'], $USER['timezone']); $id = $UserQuery['id']; $nombre = $UserQuery['username']; $email_1 = $UserQuery['email']; $email_2 = $UserQuery['email_2']; $ip = $UserQuery['ip_at_reg']; $ip2 = $UserQuery['user_lastip']; $id_p = $UserQuery['id_planet']; $g = $UserQuery['galaxy']; $s = $UserQuery['system']; $p = $UserQuery['planet']; $info = $UserQuery['user_ua']; $alianza = $UserQuery['ally_name']; $nivel = $LNG['rank'][$UserQuery['authlevel']]; $vacas = $LNG['one_is_yes'][$UserQuery['urlaubs_modus']]; $suspen = $LNG['one_is_yes'][$UserQuery['bana']]; $mo = "<a title=\"" . pretty_number($UserQuery['darkmatter']) . "\">" . shortly_number($UserQuery['darkmatter']) . "</a>"; foreach ($reslist['officier'] as $ID) { $officier[] = $ID; } foreach ($reslist['tech'] as $ID) { $techno[] = $ID; } $techoffi = ""; for ($i = 0; $i < max(count($reslist['officier']), count($reslist['tech'])); $i++) { $techoffi .= isset($techno[$i]) ? "<tr><td>" . $LNG['tech'][$techno[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$techno[$i]]] . "</font></td>" : "<tr><td> </td>"; $techoffi .= isset($officier[$i]) ? "<td>" . $LNG['tech'][$officier[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$officier[$i]]] . "</font></td></tr>" : "<td> </td></tr>"; } if ($UserQuery['bana'] != 0) { $mas = '<a ref="#" onclick="$(\'#banned\').slideToggle();return false"> ' . $LNG['ac_more'] . '</a>'; $BannedQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT theme,time,longer,author FROM " . BANNED . " WHERE `who` = '" . $UserQuery['username'] . "';"); $sus_longer = _date($LNG['php_tdformat'], $BannedQuery['longer'], $USER['timezone']); $sus_time = _date($LNG['php_tdformat'], $BannedQuery['time'], $USER['timezone']); $sus_reason = $BannedQuery['theme']; $sus_author = $BannedQuery['author']; } // COMIENZA EL SAQUEO DE DATOS DE LA TABLA DE PUNTAJE $SpecifyItemsS = "tech_count,defs_count,fleet_count,build_count,build_points,tech_points,defs_points,fleet_points,tech_rank,build_rank,defs_rank,fleet_rank,total_points,\n\t\t\tstat_type"; $StatQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $id_u . "' AND `stat_type` = '1';"); $count_tecno = pretty_number($StatQuery['tech_count']); $count_def = pretty_number($StatQuery['defs_count']); $count_fleet = pretty_number($StatQuery['fleet_count']); $count_builds = pretty_number($StatQuery['build_count']); $point_builds = pretty_number($StatQuery['build_points']); $point_tecno = pretty_number($StatQuery['tech_points']); $point_def = pretty_number($StatQuery['defs_points']); $point_fleet = pretty_number($StatQuery['fleet_points']); $ranking_tecno = $StatQuery['tech_rank']; $ranking_builds = $StatQuery['build_rank']; $ranking_def = $StatQuery['defs_rank']; $ranking_fleet = $StatQuery['fleet_rank']; $total_points = pretty_number($StatQuery['total_points']); // COMIENZA EL SAQUEO DE DATOS DE LA ALIANZA $AliID = $UserQuery['ally_id']; if ($alianza == 0 && $AliID == 0) { $alianza = $LNG['ac_no_ally']; $AllianceHave = "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/> \n\t\t\t\t\t\t\t" . $LNG['ac_alliance'] . " " . $LNG['ac_no_alliance'] . "</span>"; } elseif ($alianza != NULL && $AliID != 0) { include_once 'includes/functions/BBCode.php'; $AllianceHave = '<a href="#" onclick="$(\'#alianza\').slideToggle();return false" class="link"> <img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"> ' . $LNG['ac_alliance'] . '</a>'; $SpecifyItemsA = "ally_owner,id,ally_tag,ally_name,ally_web,ally_description,ally_text,ally_request,ally_image,ally_members,ally_register_time"; $AllianceQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsA . " FROM " . ALLIANCE . " WHERE `ally_name` = '" . $alianza . "';"); $alianza = $alianza; $id_ali = " (" . $LNG['ac_ali_idid'] . " " . $AliID . ")"; $id_aliz = $AllianceQuery['id']; $tag = $AllianceQuery['ally_tag']; $ali_nom = $AllianceQuery['ally_name']; $ali_cant = $AllianceQuery['ally_members']; $ally_register_time = _date($LNG['php_tdformat'], $AllianceQuery['ally_register_time'], $USER['timezone']); $ali_lider = $AllianceQuery['ally_owner']; $ali_web = $AllianceQuery['ally_web'] != NULL ? "<a href=" . $AllianceQuery['ally_web'] . " target=_blank>" . $AllianceQuery['ally_web'] . "</a>" : $LNG['ac_no_web']; if ($AllianceQuery['ally_description'] != NULL) { $ali_ext2 = bbcode($AllianceQuery['ally_description']); $ali_ext = "<a href=\"#\" rel=\"toggle[externo]\">" . $LNG['ac_view_text_ext'] . "</a>"; } else { $ali_ext = $LNG['ac_no_text_ext']; } if ($AllianceQuery['ally_text'] != NULL) { $ali_int2 = bbcode($AllianceQuery['ally_text']); $ali_int = "<a href=\"#\" rel=\"toggle[interno]\">" . $LNG['ac_view_text_int'] . "</a>"; } else { $ali_int = $LNG['ac_no_text_int']; } if ($AllianceQuery['ally_request'] != NULL) { $ali_sol2 = bbcode($AllianceQuery['ally_request']); $ali_sol = "<a href=\"#\" rel=\"toggle[solicitud]\">" . $LNG['ac_view_text_sol'] . "</a>"; } else { $ali_sol = $LNG['ac_no_text_sol']; } if ($AllianceQuery['ally_image'] != NULL) { $ali_logo2 = $AllianceQuery['ally_image']; $ali_logo = "<a href=\"#\" rel=\"toggle[imagen]\">" . $LNG['ac_view_image2'] . "</a>"; } else { $ali_logo = $LNG['ac_no_img']; } $SearchLeader = $GLOBALS['DATABASE']->getFirstRow("SELECT `username` FROM " . USERS . " WHERE `id` = '" . $ali_lider . "';"); $ali_lider = $SearchLeader['username']; $StatQueryAlly = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $ali_lider . "' AND `stat_type` = '2';"); $count_tecno_ali = pretty_number($StatQueryAlly['tech_count']); $count_def_ali = pretty_number($StatQueryAlly['defs_count']); $count_fleet_ali = pretty_number($StatQueryAlly['fleet_count']); $count_builds_ali = pretty_number($StatQueryAlly['build_count']); $point_builds_ali = pretty_number($StatQueryAlly['build_points']); $point_tecno_ali = pretty_number($StatQueryAlly['tech_points']); $point_def_ali = pretty_number($StatQueryAlly['defs_points']); $point_fleet_ali = pretty_number($StatQueryAlly['fleet_points']); $ranking_tecno_ali = pretty_number($StatQueryAlly['tech_rank']); $ranking_builds_ali = pretty_number($StatQueryAlly['build_rank']); $ranking_def_ali = pretty_number($StatQueryAlly['defs_rank']); $ranking_fleet_ali = pretty_number($StatQueryAlly['fleet_rank']); $total_points_ali = pretty_number($StatQueryAlly['total_points']); } foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) { $SpecifyItemsPQ .= "`" . $resource[$ID] . "`,"; $RES[$resource[$ID]] = "<tr><td width=\"150\">" . $LNG['tech'][$ID] . "</td>"; } $names = "<tr><th class=\"center\" width=\"150\"> </th>"; // COMIENZA EL SAQUEO DE DATOS DE LOS PLANETAS $SpecifyItemsP = "planet_type,id,name,galaxy,system,planet,destruyed,diameter,field_current,field_max,temp_min,temp_max,metal,crystal,deuterium,energy," . $SpecifyItemsPQ . "energy_used"; $PlanetsQuery = $GLOBALS['DATABASE']->query("SELECT " . $SpecifyItemsP . " FROM " . PLANETS . " WHERE `id_owner` = '" . $id_u . "';"); while ($PlanetsWhile = $GLOBALS['DATABASE']->fetch_array($PlanetsQuery)) { if ($PlanetsWhile['planet_type'] == 3) { $Planettt = $PlanetsWhile['name'] . " (" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>"; $MoonZ = 0; $Moons = $PlanetsWhile['name'] . " (" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>"; $MoonZ++; } else { $Planettt = $PlanetsWhile['name'] . "<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>"; } if ($PlanetsWhile["destruyed"] == 0) { $planets_moons .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['diameter']) . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number(CalculateMaxPlanetFields($PlanetsWhile)) . " (" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number($PlanetsWhile['field_max']) . ")</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['temp_min']) . " / " . pretty_number($PlanetsWhile['temp_max']) . "</td>" . (allowedTo('ShowQuickEditorPage') ? "<td><a href=\"javascript:openEdit('" . $PlanetsWhile['id'] . "', 'planet');\" border=\"0\"><img src=\"./styles/resource/images/admin/GO.png\" title=" . $LNG['se_search_edit'] . "></a></td>" : "") . "</tr>"; $SumOfEnergy = $PlanetsWhile['energy'] + $PlanetsWhile['energy_used']; if ($SumOfEnergy < 0) { $Color = "<font color=#FF6600>" . shortly_number($SumOfEnergy) . "</font>"; } elseif ($SumOfEnergy > 0) { $Color = "<font color=lime>" . shortly_number($SumOfEnergy) . "</font>"; } else { $Color = shortly_number($SumOfEnergy); } $resources .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['metal']) . "\">" . shortly_number($PlanetsWhile['metal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['crystal']) . "\">" . shortly_number($PlanetsWhile['crystal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['deuterium']) . "\">" . shortly_number($PlanetsWhile['deuterium']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($SumOfEnergy) . "\">" . $Color . "</a>/<a title=\"" . pretty_number($PlanetsWhile['energy']) . "\">" . shortly_number($PlanetsWhile['energy']) . "</a></td>\n\t\t\t\t\t</tr>"; $names .= "<th class=\"center\" width=\"60\">" . $Planettt . "</th>"; foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) { $RES[$resource[$ID]] .= "<td width=\"60\"><a title=\"" . pretty_number($PlanetsWhile[$resource[$ID]]) . "\">" . shortly_number($PlanetsWhile[$resource[$ID]]) . "</a></td>"; } $MoonHave = $MoonZ != 0 ? '<a href="#" onclick="$(\'#especiales\').slideToggle();return false" class="link"><img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"/> ' . $LNG['moon_build'] . "</a>" : "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/>" . $LNG['moon_build'] . " " . $LNG['ac_moons_no'] . "</span>"; } $DestruyeD = 0; if ($PlanetsWhile["destruyed"] > 0) { $destroyed .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['name'] . "</td>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t\t<td>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</td>\n\t\t\t\t\t\t\t<td>" . date("d-m-Y H:i:s", $PlanetsWhile['destruyed']) . "</td>\n\t\t\t\t\t\t</tr>"; $DestruyeD++; } } $names .= "</tr>"; foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) { $RES[$resource[$ID]] .= "</tr>"; } foreach ($reslist['build'] as $ID) { $build .= $RES[$resource[$ID]]; } foreach ($reslist['fleet'] as $ID) { $fleet .= $RES[$resource[$ID]]; } foreach ($reslist['defense'] as $ID) { $defense .= $RES[$resource[$ID]]; } $template->assign_vars(array('DestruyeD' => $DestruyeD, 'destroyed' => $destroyed, 'resources' => $resources, 'mo' => $mo, 'names' => $names, 'build' => $build, 'fleet' => $fleet, 'defense' => $defense, 'planets_moons' => $planets_moons, 'ali_lider' => $ali_lider, 'AllianceHave' => $AllianceHave, 'point_tecno' => $point_tecno, 'count_tecno' => $count_tecno, 'ranking_tecno' => $ranking_tecno, 'defenses_title' => $defenses_title, 'point_def' => $point_def, 'count_def' => $count_def, 'ranking_def' => $ranking_def, 'point_fleet' => $point_fleet, 'count_fleet' => $count_fleet, 'ranking_fleet' => $ranking_fleet, 'point_builds' => $point_builds, 'count_builds' => $count_builds, 'ranking_builds' => $ranking_builds, 'total_points' => $total_points, 'point_tecno_ali' => $point_tecno_ali, 'count_tecno_ali' => $count_tecno_ali, 'ranking_tecno_ali' => $ranking_tecno_ali, 'point_def_ali' => $point_def_ali, 'count_def_ali' => $count_def_ali, 'ranking_def_ali' => $ranking_def_ali, 'point_fleet_ali' => $point_fleet_ali, 'count_fleet_ali' => $count_fleet_ali, 'ranking_fleet_ali' => $ranking_fleet_ali, 'point_builds_ali' => $point_builds_ali, 'count_builds_ali' => $count_builds_ali, 'ranking_builds_ali' => $ranking_builds_ali, 'total_points_ali' => $total_points_ali, 'input_id' => $input_id, 'id_aliz' => $id_aliz, 'tag' => $tag, 'ali_nom' => $ali_nom, 'ali_ext' => $ali_ext, 'ali_ext' => $ali_ext2, 'ali_int' => $ali_int, 'ali_int' => $ali_int2, 'ali_sol2' => $ali_sol2, 'ali_sol' => $ali_sol, 'ali_logo' => $ali_logo, 'ali_logo2' => $ali_logo2, 'ali_web' => $ali_web, 'ally_register_time' => $ally_register_time, 'ali_cant' => $ali_cant, 'alianza' => $alianza, 'input_id' => $input_id, 'id' => $id, 'nombre' => $nombre, 'nivel' => $nivel, 'vacas' => $vacas, 'suspen' => $suspen, 'mas' => $mas, 'id_ali' => $id_ali, 'ip' => $ip, 'ip2' => $ip2, 'ipcheck' => true, 'reg_time' => $reg_time, 'onlinetime' => $onlinetime, 'id_p' => $id_p, 'g' => $g, 's' => $s, 'p' => $p, 'info' => $info, 'email_1' => $email_1, 'email_2' => $email_2, 'sus_time' => $sus_time, 'sus_longer' => $sus_longer, 'sus_reason' => $sus_reason, 'sus_author' => $sus_author, 'techoffi' => $techoffi, 'canedit' => allowedTo('ShowQuickEditorPage'), 'buildings_title' => $LNG['buildings_title'], 'buildings_title' => $LNG['buildings_title'], 'researchs_title ' => $LNG['researchs_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_recent_destroyed_planets' => $LNG['ac_recent_destroyed_planets'], 'ac_isnodestruyed' => $LNG['ac_isnodestruyed'], 'ac_note_k' => $LNG['ac_note_k'], 'ac_leyend' => $LNG['ac_leyend'], 'ac_account_data' => $LNG['ac_account_data'], 'ac_name' => $LNG['ac_name'], 'ac_mail' => $LNG['ac_mail'], 'ac_perm_mail' => $LNG['ac_perm_mail'], 'ac_auth_level' => $LNG['ac_auth_level'], 'ac_on_vacation' => $LNG['ac_on_vacation'], 'ac_banned' => $LNG['ac_banned'], 'ac_alliance' => $LNG['ac_alliance'], 'ac_reg_ip' => $LNG['ac_reg_ip'], 'ac_last_ip' => $LNG['ac_last_ip'], 'ac_checkip_title' => $LNG['ac_checkip_title'], 'ac_register_time' => $LNG['ac_register_time'], 'ac_act_time' => $LNG['ac_act_time'], 'ac_home_planet_id' => $LNG['ac_home_planet_id'], 'ac_home_planet_coord' => $LNG['ac_home_planet_coord'], 'ac_user_system' => $LNG['ac_user_system'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_user_ranking' => $LNG['ac_user_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_suspended_title' => $LNG['ac_suspended_title'], 'ac_suspended_time' => $LNG['ac_suspended_time'], 'ac_suspended_longer' => $LNG['ac_suspended_longer'], 'ac_suspended_reason' => $LNG['ac_suspended_reason'], 'ac_suspended_autor' => $LNG['ac_suspended_autor'], 'ac_info_ally' => $LNG['ac_info_ally'], 'ac_leader' => $LNG['ac_leader'], 'ac_tag' => $LNG['ac_tag'], 'ac_name_ali' => $LNG['ac_name_ali'], 'ac_ext_text ' => $LNG['ac_ext_text'], 'ac_int_text' => $LNG['ac_int_text'], 'ac_sol_text' => $LNG['ac_sol_text'], 'ac_image' => $LNG['ac_image'], 'ac_ally_web' => $LNG['ac_ally_web'], 'ac_total_members' => $LNG['ac_total_members'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_view_image' => $LNG['ac_view_image'], 'ac_urlnow' => $LNG['ac_urlnow'], 'ac_ally_ranking' => $LNG['ac_ally_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_id_names_coords' => $LNG['ac_id_names_coords'], 'ac_name' => $LNG['ac_name'], 'ac_diameter' => $LNG['ac_diameter'], 'ac_fields' => $LNG['ac_fields'], 'ac_temperature' => $LNG['ac_temperature'], 'se_search_edit' => $LNG['se_search_edit'], 'resources_title' => $LNG['resources_title'], 'ac_name' => $LNG['ac_name'], 'Metal' => $LNG['tech'][901], 'Crystal' => $LNG['tech'][902], 'Deuterium' => $LNG['tech'][903], 'Energy' => $LNG['tech'][911], 'Darkmatter' => $LNG['tech'][921], 'buildings_title' => $LNG['buildings_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_officier_research' => $LNG['ac_officier_research'], 'researchs_title' => $LNG['researchs_title'], 'officiers_title' => $LNG['officiers_title'], 'ac_name' => $LNG['ac_name'], 'input_id' => $LNG['input_id'], 'ac_coords' => $LNG['ac_coords'], 'ac_time_destruyed' => $LNG['ac_time_destruyed'])); $template->show('AccountDataPageDetail.tpl'); } exit; } $Userlist = ""; $UserWhileLogin = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '" . $_SESSION['adminuni'] . "' ORDER BY `username` ASC;"); while ($UserList = $GLOBALS['DATABASE']->fetch_array($UserWhileLogin)) { $Userlist .= "<option value=\"" . $UserList['id'] . "\">" . $UserList['username'] . " (" . $LNG['rank'][$UserList['authlevel']] . ")</option>"; } $template->loadscript('filterlist.js'); $template->assign_vars(array('Userlist' => $Userlist, 'ac_enter_user_id' => $LNG['ac_enter_user_id'], 'bo_select_title' => $LNG['bo_select_title'], 'button_filter' => $LNG['button_filter'], 'button_deselect' => $LNG['button_deselect'], 'ac_select_id_num' => $LNG['ac_select_id_num'], 'button_submit' => $LNG['button_submit'])); $template->show('AccountDataPageIntro.tpl'); }
function ShowBanPage() { global $LNG, $USER; $ORDER = $_GET['order'] == 'id' ? "id" : "username"; if ($_GET['view'] == 'bana') { $WHEREBANA = "AND `bana` = '1'"; } $UserList = $GLOBALS['DATABASE']->query("SELECT `username`, `id`, `bana` FROM " . USERS . " WHERE `id` != 1 AND `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '" . Universe::getEmulated() . "' " . $WHEREBANA . " ORDER BY " . $ORDER . " ASC;"); $UserSelect = array('List' => '', 'ListBan' => ''); $Users = 0; while ($a = $GLOBALS['DATABASE']->fetch_array($UserList)) { $UserSelect['List'] .= '<option value="' . $a['username'] . '">' . $a['username'] . ' (ID: ' . $a['id'] . ')' . ($a['bana'] == '1' ? $LNG['bo_characters_suus'] : '') . '</option>'; $Users++; } $GLOBALS['DATABASE']->free_result($UserList); $ORDER2 = $_GET['order2'] == 'id' ? "id" : "username"; $Banneds = 0; $UserListBan = $GLOBALS['DATABASE']->query("SELECT `username`, `id` FROM " . USERS . " WHERE `bana` = '1' AND `universe` = '" . Universe::getEmulated() . "' ORDER BY " . $ORDER2 . " ASC;"); while ($b = $GLOBALS['DATABASE']->fetch_array($UserListBan)) { $UserSelect['ListBan'] .= '<option value="' . $b['username'] . '">' . $b['username'] . ' (ID: ' . $b['id'] . ')</option>'; $Banneds++; } $GLOBALS['DATABASE']->free_result($UserListBan); $template = new template(); $template->loadscript('filterlist.js'); $Name = HTTP::_GP('ban_name', '', true); $BANUSER = $GLOBALS['DATABASE']->getFirstRow("SELECT b.theme, b.longer, u.id, u.urlaubs_modus, u.banaday FROM " . USERS . " as u LEFT JOIN " . BANNED . " as b ON u.`username` = b.`who` WHERE u.`username` = '" . $GLOBALS['DATABASE']->sql_escape($Name) . "' AND u.`universe` = '" . Universe::getEmulated() . "';"); if (isset($_POST['panel'])) { if ($BANUSER['banaday'] <= TIMESTAMP) { $title = $LNG['bo_bbb_title_1']; $changedate = $LNG['bo_bbb_title_2']; $changedate_advert = ''; $reas = ''; $timesus = ''; } else { $title = $LNG['bo_bbb_title_3']; $changedate = $LNG['bo_bbb_title_6']; $changedate_advert = '<td class="c" width="18px"><img src="./styles/resource/images/admin/i.gif" class="tooltip" data-tooltip-content="' . $LNG['bo_bbb_title_4'] . '"></td>'; $reas = $BANUSER['theme']; $timesus = "<tr>\n\t\t\t\t\t<th>" . $LNG['bo_bbb_title_5'] . "</th>\n\t\t\t\t\t<th height=25 colspan=2>" . date($LNG['php_tdformat'], $BANUSER['longer']) . "</th>\n\t\t\t\t</tr>"; } $vacation = $BANUSER['urlaubs_modus'] == 1 ? true : false; $template->assign_vars(array('name' => $Name, 'bantitle' => $title, 'changedate' => $changedate, 'reas' => $reas, 'changedate_advert' => $changedate_advert, 'timesus' => $timesus, 'vacation' => $vacation)); } elseif (isset($_POST['bannow']) && $BANUSER['id'] != 1) { $Name = HTTP::_GP('ban_name', '', true); $reas = HTTP::_GP('why', '', true); $days = HTTP::_GP('days', 0); $hour = HTTP::_GP('hour', 0); $mins = HTTP::_GP('mins', 0); $secs = HTTP::_GP('secs', 0); $admin = $USER['username']; $mail = $USER['email']; $BanTime = $days * 86400 + $hour * 3600 + $mins * 60 + $secs; if ($BANUSER['longer'] > TIMESTAMP) { $BanTime += $BANUSER['longer'] - TIMESTAMP; } if (isset($_POST['permanent'])) { $BannedUntil = 2147483647; } else { $BannedUntil = $BanTime + TIMESTAMP < TIMESTAMP ? TIMESTAMP : TIMESTAMP + $BanTime; } if ($BANUSER['banaday'] > TIMESTAMP) { $SQL = "UPDATE " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`email` = '" . $mail . "' "; $SQL .= "WHERE `who2` = '" . $Name . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); } else { $SQL = "INSERT INTO " . BANNED . " SET "; $SQL .= "`who` = '" . $Name . "', "; $SQL .= "`theme` = '" . $reas . "', "; $SQL .= "`time` = '" . TIMESTAMP . "', "; $SQL .= "`longer` = '" . $BannedUntil . "', "; $SQL .= "`author` = '" . $admin . "', "; $SQL .= "`universe` = '" . Universe::getEmulated() . "', "; $SQL .= "`email` = '" . $mail . "';"; $GLOBALS['DATABASE']->query($SQL); } $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`bana` = '1', "; $SQL .= "`banaday` = '" . $BannedUntil . "', "; $SQL .= isset($_POST['vacat']) ? "`urlaubs_modus` = '1'" : "`urlaubs_modus` = '0'"; $SQL .= "WHERE "; $SQL .= "`username` = '" . $Name . "' AND `universe` = '" . Universe::getEmulated() . "';"; $GLOBALS['DATABASE']->query($SQL); $template->message($LNG['bo_the_player'] . $Name . $LNG['bo_banned'], '?page=bans'); exit; } elseif (isset($_POST['unban_name'])) { $Name = HTTP::_GP('unban_name', '', true); $GLOBALS['DATABASE']->query("UPDATE " . USERS . " SET bana = '0', banaday = '0' WHERE username = '******'DATABASE']->sql_escape($Name) . "' AND `universe` = '" . Universe::getEmulated() . "';"); #DELETE FROM ".BANNED." WHERE who = '".$GLOBALS['DATABASE']->sql_escape($Name)."' AND `universe` = '".Universe::getEmulated()."'; $template->message($LNG['bo_the_player2'] . $Name . $LNG['bo_unbanned'], '?page=bans'); exit; } $template->assign_vars(array('UserSelect' => $UserSelect, 'usercount' => $Users, 'bancount' => $Banneds)); $template->show('BanPage.tpl'); }
function ShowResetPage() { global $db, $LNG, $reslist, $resource; $template = new template(); if ($_POST) { foreach ($reslist['build'] as $ID) { $dbcol['build'][$ID] = "`" . $resource[$ID] . "` = '0'"; } foreach ($reslist['tech'] as $ID) { $dbcol['tech'][$ID] = "`" . $resource[$ID] . "` = '0'"; } foreach ($reslist['fleet'] as $ID) { $dbcol['fleet'][$ID] = "`" . $resource[$ID] . "` = '0'"; } foreach ($reslist['defense'] as $ID) { $dbcol['defense'][$ID] = "`" . $resource[$ID] . "` = '0'"; } foreach ($reslist['officier'] as $ID) { $dbcol['officier'][$ID] = "`" . $resource[$ID] . "` = '0'"; } // Players and Planets if ($_POST['players'] == 'on') { $ID = $db->countquery("SELECT `id_owner` FROM " . PLANETS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "' AND `galaxy` = '1' AND `system` = '1' AND `planet` = '1';"); $db->multi_query("DELETE FROM " . USERS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "' AND `id` != '" . $ID . "';DELETE FROM " . PLANETS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "' AND `galaxy` != '1' AND `system` != '1' AND `planet` != '1';"); } if ($_POST['planets'] == 'on') { $db->multi_query("DELETE FROM " . PLANETS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "' AND `id` NOT IN (SELECT id_planet FROM " . USERS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "');UPDATE " . PLANETS . " SET `id_luna` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['moons'] == 'on') { $db->multi_query("DELETE FROM " . PLANETS . " WHERE `planet_type` = '3' AND `universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . PLANETS . " SET `id_luna` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } // HANGARES Y DEFENSAS if ($_POST['defenses'] == 'on') { $db->query("UPDATE " . PLANETS . " SET " . implode(", ", $dbcol['defense']) . " AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['ships'] == 'on') { $db->query("UPDATE " . PLANETS . " SET " . implode(", ", $dbcol['fleet']) . " AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['h_d'] == 'on') { $db->query("UPDATE " . PLANETS . " SET `b_hangar` = '0', `b_hangar_plus` = '0', `b_hangar_id` = '' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } // EDIFICIOS if ($_POST['edif_p'] == 'on') { $db->query("UPDATE " . PLANETS . " SET " . implode(", ", $dbcol['build']) . ", `field_current` = '0' WHERE `planet_type` = '1' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['edif_l'] == 'on') { $db->query("UPDATE " . PLANETS . " SET " . implode(", ", $dbcol['build']) . ", `field_current` = '0' WHERE `planet_type` = '3' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['edif'] == 'on') { $db->query("UPDATE " . PLANETS . " SET `b_building` = '0', `b_building_id` = '' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } // INVESTIGACIONES Y OFICIALES if ($_POST['inves'] == 'on') { $db->query("UPDATE " . USERS . " SET " . implode(", ", $dbcol['tech']) . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['ofis'] == 'on') { $db->query("UPDATE " . USERS . " SET " . implode(", ", $dbcol['officier']) . " WHERE`universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['inves_c'] == 'on') { $db->query("UPDATE " . USERS . " SET `b_tech_planet` = '0', `b_tech` = '0', `b_tech_id` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } // RECURSOS if ($_POST['dark'] == 'on') { $db->query("UPDATE " . USERS . " SET `darkmatter` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['resources'] == 'on') { $db->query("UPDATE " . PLANETS . " SET `metal` = '" . BUILD_METAL . "', `crystal` = '" . BUILD_CRISTAL . "', `deuterium` = '" . BUILD_DEUTERIUM . "' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } // GENERAL if ($_POST['notes'] == 'on') { $db->query("DELETE FROM " . NOTES . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['rw'] == 'on') { $TKBRW = $db->query("SELECT `rid` FROM " . TOPKB . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); if (isset($TKBRW)) { while ($RID = $db->fetch_array($TKBRW)) { @unlink(ROOT_PATH . 'raports/topkb_' . $RID['rid'] . '.php'); } $db->query("DELETE FROM " . TOPKB . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } } if ($_POST['friends'] == 'on') { $db->query("DELETE FROM " . BUDDY . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['alliances'] == 'on') { $db->multi_query("DELETE FROM " . ALLIANCE . " WHERE `ally_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `ally_id` = '0', `ally_name` = '', `ally_request` = '0', `ally_request_text` = 'NULL', `ally_register_time` = '0', `ally_rank_id` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['fleets'] == 'on') { $db->query("DELETE FROM " . FLEETS . " WHERE `fleet_universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['banneds'] == 'on') { $db->multi_query("DELETE FROM " . BANNED . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `bana` = '0', `banaday` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['messages'] == 'on') { $db->multi_query("DELETE FROM " . MESSAGES . " WHERE `message_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `new_message` = '0' WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($_POST['statpoints'] == 'on') { $db->query("DELETE FROM " . STATPOINTS . " WHERE `universe` = '" . $_SESSION['adminuni'] . "';"); } $template->message($LNG['re_reset_excess'], '?page=reset&sid=' . session_id(), 3); exit; } $template->assign_vars(array('button_submit' => $LNG['button_submit'], 're_reset_universe_confirmation' => $LNG['re_reset_universe_confirmation'], 're_reset_all' => $LNG['re_reset_all'], 're_reset_all' => $LNG['re_reset_all'], 're_defenses_and_ships' => $LNG['re_defenses_and_ships'], 're_reset_buldings' => $LNG['re_reset_buldings'], 're_buildings_lu' => $LNG['re_buildings_lu'], 're_buildings_pl' => $LNG['re_buildings_pl'], 're_buldings' => $LNG['re_buldings'], 're_reset_hangar' => $LNG['re_reset_hangar'], 're_ships' => $LNG['re_ships'], 're_defenses' => $LNG['re_defenses'], 're_resources_met_cry' => $LNG['re_resources_met_cry'], 're_resources_dark' => $LNG['re_resources_dark'], 're_resources' => $LNG['re_resources'], 're_reset_invest' => $LNG['re_reset_invest'], 're_investigations' => $LNG['re_investigations'], 're_ofici' => $LNG['re_ofici'], 're_inve_ofis' => $LNG['re_inve_ofis'], 're_reset_statpoints' => $LNG['re_reset_statpoints'], 're_reset_messages' => $LNG['re_reset_messages'], 're_reset_banned' => $LNG['re_reset_banned'], 're_reset_errors' => $LNG['re_reset_errors'], 're_reset_fleets' => $LNG['re_reset_fleets'], 're_reset_allys' => $LNG['re_reset_allys'], 're_reset_buddies' => $LNG['re_reset_buddies'], 're_reset_rw' => $LNG['re_reset_rw'], 're_reset_notes' => $LNG['re_reset_notes'], 're_reset_moons' => $LNG['re_reset_moons'], 're_reset_planets' => $LNG['re_reset_planets'], 're_reset_player' => $LNG['re_reset_player'], 're_player_and_planets' => $LNG['re_player_and_planets'], 're_general' => $LNG['re_general'])); $template->show('adm/ResetPage.tpl'); }
function ShowAccountEditorPage() { global $USER, $db, $LNG, $reslist, $resource, $UNI; $template = new template(); switch ($_GET['edit']) { case 'resources': $id = request_var('id', 0); $id_dark = request_var('id_dark', 0); $metal = floattostring(round(abs(request_var('metal', 0.0)), 0)); $cristal = floattostring(round(abs(request_var('cristal', 0.0)), 0)); $deut = floattostring(round(abs(request_var('deut', 0.0)), 0)); $norio = floattostring(round(abs(request_var('norio', 0.0)), 0)); $dark = request_var('dark', 0); if ($_POST) { if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`metal` = `metal` + '" . $metal . "', "; $SQL .= "`crystal` = `crystal` + '" . $cristal . "', "; $SQL .= "`deuterium` = `deuterium` + '" . $deut . "', "; $SQL .= "`norio` = `norio` + '" . $norio . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); if (!empty($id_dark)) { $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`darkmatter` = `darkmatter` + '" . $dark . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id_dark . "' AND `universe` = '" . $_SESSION['adminuni'] . "' "; $db->query($SQL); } $template->message($LNG['ad_add_sucess'], '?page=accounteditor&edit=resources'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; $SQL .= "`metal` = `metal` - '" . $metal . "', "; $SQL .= "`crystal` = `crystal` - '" . $cristal . "', "; $SQL .= "`deuterium` = `deuterium` - '" . $deut . "', "; $SQL .= "`norio` = `norio` - '" . $norio . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); if (!empty($id_dark)) { $SQL = "UPDATE " . USERS . " SET "; $SQL .= "`darkmatter` = `darkmatter` - '" . $dark . "' "; $SQL .= "WHERE "; $SQL .= "`id` = '" . $id_dark . "';"; $db->query($SQL); } $template->message($LNG['ad_delete_sucess'], '?page=accounteditor&edit=resources'); } exit; } $template->assign_vars(array('button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Norio' => $LNG['Norio'], 'Darkmatter' => $LNG['Darkmatter'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_user' => $LNG['input_id_user'], 'resources_title' => $LNG['resources_title'], 'input_id_p_m' => $LNG['input_id_p_m'])); $template->show('adm/AccountEditorPageResources.tpl'); break; case 'ships': if ($_POST) { if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['fleet'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_add_sucess_ships'], '?page=accounteditor&edit=ships'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['fleet'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_delete_sucess_ships'], '?page=accounteditor&edit=ships'); } exit; } $parse['ships'] = ""; foreach ($reslist['fleet'] as $ID) { $INPUT[$ID] = array('name' => $LNG['tech'][$ID], 'type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT, 'button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_p_m' => $LNG['input_id_p_m'], 'ships_title' => $LNG['ad_ships_title'], 'ad_number' => $LNG['ad_number'], 'ships_count' => $LNG['ad_count'])); $template->show('adm/AccountEditorPageShips.tpl'); break; case 'defenses': if ($_POST) { if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['defense'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_add_defenses_succes'], '?page=accounteditor&edit=defenses'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['defense'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $Name = $LNG['log_nomoree']; $template->message($LNG['ad_delete_defenses_succes'], '?page=accounteditor&edit=defenses'); } exit; } foreach ($reslist['defense'] as $ID) { $INPUT[$ID] = array('name' => $LNG['tech'][$ID], 'type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT, 'button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_p_m' => $LNG['input_id_p_m'], 'defenses_title' => $LNG['ad_defenses_title'], 'ad_number' => $LNG['ad_number'], 'defenses_count' => $LNG['ad_count'])); $template->show('adm/AccountEditorPageDefenses.tpl'); break; break; case 'buildings': if ($_POST) { $PlanetData = $db->uniquequery("SELECT `planet_type` FROM " . PLANETS . " WHERE `id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); if (!isset($PlanetData)) { $template->message($LNG['ad_add_not_exist'], '?page=accounteditor&edit=buildings'); } if ($_POST['add']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['allow'][$PlanetData['planet_type']] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_add_succes'], '?page=accounteditor&edit=buildings'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . PLANETS . " SET "; foreach ($reslist['allow'][$PlanetData['planet_type']] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_delete_succes'], '?page=accounteditor&edit=buildings'); } exit; } foreach ($reslist['build'] as $ID) { $INPUT[$ID] = array('name' => $LNG['tech'][$ID], 'type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT, 'button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_p_m' => $LNG['input_id_p_m'], 'buildings_title' => $LNG['ad_buildings_title'], 'ad_number' => $LNG['ad_number'], 'ad_levels' => $LNG['ad_levels'])); $template->show('adm/AccountEditorPageBuilds.tpl'); break; case 'researchs': if ($_POST) { if ($_POST['add']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['tech'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_add_succes'], '?page=accounteditor&edit=researchs'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['tech'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_delete_succes'], '?page=accounteditor&edit=researchs'); } exit; } foreach ($reslist['tech'] as $ID) { $INPUT[$ID] = array('name' => $LNG['tech'][$ID], 'type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT, 'button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_user' => $LNG['input_id_user'], 'research_title' => $LNG['ad_research_title'], 'ad_number' => $LNG['ad_number'], 'research_count' => $LNG['ad_count'])); $template->show('adm/AccountEditorPageResearch.tpl'); break; case 'personal': if ($_POST) { $id = request_var('id', 0); $username = request_var('username', '', UTF8_SUPPORT); $password = request_var('password', '', true); $email = request_var('email', ''); $email_2 = request_var('email_2', ''); $vacation = request_var('vacation', ''); $PersonalQuery = "UPDATE " . USERS . " SET "; if (!empty($username) && $id != 1) { $PersonalQuery .= "`username` = '" . $db->sql_escape($username) . "', "; } if (!empty($email) && $id != 1) { $PersonalQuery .= "`email` = '" . $db->sql_escape($email) . "', "; } if (!empty($email_2) && $id != 1) { $PersonalQuery .= "`email_2` = '" . $db->sql_escape($email_2) . "', "; } if (!empty($password) && $id != 1) { $PersonalQuery .= "`password` = '" . $db->sql_escape(md5($password)) . "', "; } $Answer = 0; $TimeAns = 0; if ($vacation == 'yes') { $Answer = 1; $TimeAns = TIMESTAMP + $_POST['d'] * 86400 + $_POST['h'] * 3600 + $_POST['m'] * 60 + $_POST['s']; } $PersonalQuery .= "`urlaubs_modus` = '" . $Answer . "', `urlaubs_until` = '" . $TimeAns . "' "; $PersonalQuery .= "WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "'"; $db->query($PersonalQuery); $template->message($LNG['ad_personal_succes'], '?page=accounteditor&edit=personal'); exit; } $template->assign_vars(array('button_submit' => $LNG['button_submit'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id' => $LNG['input_id'], 'ad_personal_vacat' => $LNG['ad_personal_vacat'], 'ad_personal_email2' => $LNG['ad_personal_email2'], 'ad_personal_email' => $LNG['ad_personal_email'], 'ad_personal_pass' => $LNG['ad_personal_pass'], 'ad_personal_name' => $LNG['ad_personal_name'], 'ad_personal_title' => $LNG['ad_personal_title'], 'time_seconds' => $LNG['time_seconds'], 'time_minutes' => $LNG['time_minutes'], 'time_hours' => $LNG['time_hours'], 'time_days' => $LNG['time_days'], 'Selector' => array('' => $LNG['select_option'], 'yes' => $LNG['one_is_yes'][1], 'no' => $LNG['one_is_yes'][0]))); $template->show('adm/AccountEditorPagePersonal.tpl'); break; case 'officiers': if ($_POST) { if ($_POST['add']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['dmfunc'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` + '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_offi_succes_add'], '?page=accounteditor&edit=officiers'); } elseif ($_POST['delete']) { $SQL = "UPDATE " . USERS . " SET "; foreach ($reslist['dmfunc'] as $ID) { $QryUpdate[] = "`" . $resource[$ID] . "` = `" . $resource[$ID] . "` - '" . floattostring(round(abs(request_var($resource[$ID], 0.0)), 0)) . "'"; } $SQL .= implode(", ", $QryUpdate); $SQL .= "WHERE "; $SQL .= "`id` = '" . request_var('id', 0) . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"; $db->query($SQL); $template->message($LNG['ad_offi_succes_delete'], '?page=accounteditor&edit=officiers'); } exit; } foreach ($reslist['dmfunc'] as $ID) { $INPUT[$ID] = array('name' => $LNG['tech'][$ID], 'type' => $resource[$ID]); } $template->assign_vars(array('inputlist' => $INPUT, 'button_reset' => $LNG['button_reset'], 'button_delete' => $LNG['button_delete'], 'button_add' => $LNG['button_add'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'input_id_user' => $LNG['input_id_user'], 'officiers_title' => $LNG['ad_offi_title'], 'ad_number' => $LNG['ad_number'], 'officiers_count' => $LNG['ad_count'])); $template->show('adm/AccountEditorPageOfficiers.tpl'); break; case 'planets': if ($_POST) { $id = request_var('id', 0); $name = request_var('name', '', UTF8_SUPPORT); $diameter = request_var('diameter', 0); $fields = request_var('fields', 0); $buildings = request_var('0_buildings', ''); $ships = request_var('0_ships', ''); $defenses = request_var('0_defenses', ''); $c_hangar = request_var('0_c_hangar', ''); $c_buildings = request_var('0_c_buildings', ''); $change_pos = request_var('change_position', ''); $galaxy = request_var('g', 0); $system = request_var('s', 0); $planet = request_var('p', 0); if (!empty($name)) { $db->query("UPDATE " . PLANETS . " SET `name` = '" . $db->sql_escape($name) . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($buildings == 'on') { foreach ($reslist['build'] as $ID) { $BUILD[] = "`" . $resource[$ID] . "` = '0'"; } $db->query("UPDATE " . PLANETS . " SET " . implode(', ', $BUILD) . " WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($ships == 'on') { foreach ($reslist['fleet'] as $ID) { $SHIPS[] = "`" . $resource[$ID] . "` = '0'"; } $db->query("UPDATE " . PLANETS . " SET " . implode(', ', $SHIPS) . " WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($defenses == 'on') { foreach ($reslist['defense'] as $ID) { $DEFS[] = "`" . $resource[$ID] . "` = '0'"; } $db->query("UPDATE " . PLANETS . " SET " . implode(', ', $DEFS) . " WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($c_hangar == 'on') { $db->query("UPDATE " . PLANETS . " SET `b_hangar` = '0', `b_hangar_plus` = '0', `b_hangar_id` = '' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($c_buildings == 'on') { $db->query("UPDATE " . PLANETS . " SET `b_building` = '0', `b_building_id` = '' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if (!empty($diameter)) { $db->query("UPDATE " . PLANETS . " SET `diameter` = '" . $diameter . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if (!empty($fields)) { $db->query("UPDATE " . PLANETS . " SET `field_max` = '" . $fields . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } if ($change_pos == 'on' && $galaxy > 0 && $system > 0 && $planet > 0 && $galaxy <= MAX_GALAXY_IN_WORLD && $system <= MAX_SYSTEM_IN_GALAXY && $planet <= MAX_PLANET_IN_SYSTEM) { $P = $db->uniquequery("SELECT galaxy,system,planet,planet_type FROM " . PLANETS . " WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); if ($P['planet_type'] == '1') { if (CheckPlanetIfExist($galaxy, $system, $planet, $UNI, $P['planet_type'])) { $template->message($LNG['ad_pla_error_planets3'], '?page=accounteditor&edit=planets'); exit; } $db->query("UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } else { if (CheckPlanetIfExist($galaxy, $system, $planet, $UNI, $P['planet_type'])) { $template->message($LNG['ad_pla_error_planets5'], '?page=accounteditor&edit=planets'); exit; } $Target = $db->uniquequery("SELECT id_luna FROM " . PLANETS . " WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND `planet_type` = '1';"); if ($Target['id_luna'] != '0') { $template->message($LNG['ad_pla_error_planets4'], '?page=accounteditor&edit=planets'); exit; } $db->multi_query("UPDATE " . PLANETS . " SET `id_luna` = '0' WHERE `galaxy` = '" . $P['galaxy'] . "' AND `system` = '" . $P['system'] . "' AND `planet` = '" . $P['planet'] . "' AND `planet_type` = '1';UPDATE " . PLANETS . " SET `id_luna` = '" . $id . "' WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "' AND planet_type = '1';UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); $QMOON2 = $db->uniquequery("SELECT id_level, id_owner FROM " . PLANETS . " WHERE `galaxy` = '" . $galaxy . "' AND `system` = '" . $system . "' AND `planet` = '" . $planet . "';"); $db->query("UPDATE " . PLANETS . " SET `galaxy` = '" . $galaxy . "', `system` = '" . $system . "', `planet` = '" . $planet . "', `id_owner` = '" . $QMOON2['id_owner'] . "', `id_level` = '" . $QMOON2['id_level'] . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "' AND `planet_type` = '3';"); } } $template->message($LNG['ad_pla_succes'], '?page=accounteditor&edit=planets'); exit; } $template->assign_vars(array('button_submit' => $LNG['button_submit'], 'button_reset' => $LNG['button_reset'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'ad_pla_title' => $LNG['ad_pla_title'], 'input_id_p_m' => $LNG['input_id_p_m'], 'ad_pla_edit_name' => $LNG['ad_pla_edit_name'], 'ad_pla_edit_diameter' => $LNG['ad_pla_edit_diameter'], 'ad_pla_edit_fields' => $LNG['ad_pla_edit_fields'], 'ad_pla_delete_b' => $LNG['ad_pla_delete_b'], 'ad_pla_delete_s' => $LNG['ad_pla_delete_s'], 'ad_pla_delete_d' => $LNG['ad_pla_delete_d'], 'ad_pla_delete_hd' => $LNG['ad_pla_delete_hd'], 'ad_pla_delete_cb' => $LNG['ad_pla_delete_cb'], 'ad_pla_title_l' => $LNG['ad_pla_title_l'], 'ad_pla_change_p' => $LNG['ad_pla_change_p'], 'ad_pla_change_pp' => $LNG['ad_pla_change_pp'])); $template->show('adm/AccountEditorPagePlanets.tpl'); break; case 'alliances': if ($_POST) { $id = request_var('id', 0); $name = request_var('name', '', UTF8_SUPPORT); $changeleader = request_var('changeleader', 0); $tag = request_var('tag', '', UTF8_SUPPORT); $externo = request_var('externo', '', true); $interno = request_var('interno', '', true); $solicitud = request_var('solicitud', '', true); $delete = request_var('delete', ''); $delete_u = request_var('delete_u', ''); #$QueryF = $db->uniquequery("SELECT * FROM ".ALLIANCE." WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';"); $QueryF = $db->uniquequery("SELECT * FROM " . ALLIANCE . " WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';"); if (!empty($name)) { #$db->multi_query("UPDATE ".ALLIANCE." SET `ally_name` = '".$name."' WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';UPDATE ".USERS." SET `ally_name` = '".$name."' WHERE `ally_id` = '".$id."';"); $db->multi_query("UPDATE " . ALLIANCE . " SET `ally_name` = '" . $name . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `ally_name` = '" . $name . "' WHERE `ally_id` = '" . $id . "';"); } if (!empty($tag)) { #$db->query("UPDATE ".ALLIANCE." SET `ally_tag` = '".$tag."' WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';"); $db->query("UPDATE " . ALLIANCE . " SET `ally_tag` = '" . $tag . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';"); } $QueryF2 = $db->uniquequery("SELECT ally_id FROM " . USERS . " WHERE `id` = '" . $changeleader . "';"); #$db->multi_query("UPDATE ".ALLIANCE." SET `ally_owner` = '".$changeleader."' WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';UPDATE ".USERS." SET `ally_rank_id` = '0' WHERE `id` = '".$changeleader."';"); $db->multi_query("UPDATE " . ALLIANCE . " SET `ally_owner` = '" . $changeleader . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `ally_rank_id` = '0' WHERE `id` = '" . $changeleader . "';"); if (!empty($externo)) { #$db->query("UPDATE ".ALLIANCE." SET `ally_description` = '".$externo."' WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';"); $db->query("UPDATE " . ALLIANCE . " SET `ally_description` = '" . $externo . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';"); } if (!empty($interno)) { #$db->query("UPDATE ".ALLIANCE." SET `ally_text` = '".$interno."' WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';"); $db->query("UPDATE " . ALLIANCE . " SET `ally_text` = '" . $interno . "' WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';"); } if (!empty($solicitud)) { $db->query("UPDATE " . ALLIANCE . " SET `ally_request` = '" . $solicitud . "' WHERE `id` = '" . $id . "' AND `universe` = '" . $_SESSION['adminuni'] . "';"); } #$db->query("UPDATE ".ALLIANCE." SET `ally_request` = '".$solicitud."' WHERE `id` = '".$id."' AND `ally_universe` = '".$_SESSION['adminuni']."';"); if ($delete == 'on') { #$db->multi_query("DELETE FROM ".ALLIANCE." WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';UPDATE ".USERS." SET `ally_id` = '0', `ally_name` = '', `ally_request` = '0', `ally_rank_id` = '0', `ally_register_time` = '0', `ally_request` = '0' WHERE `ally_id` = '".$id."';"); $db->multi_query("DELETE FROM " . ALLIANCE . " WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `ally_id` = '0', `ally_name` = '', `ally_request` = '0', `ally_rank_id` = '0', `ally_register_time` = '0', `ally_request` = '0' WHERE `ally_id` = '" . $id . "';"); } if (!empty($delete_u)) { #$db->multi_query("UPDATE ".ALLIANCE." SET `ally_members` = ally_members - 1 WHERE `id` = '".$id."' AND `universe` = '".$_SESSION['adminuni']."';UPDATE ".USERS." SET `ally_id` = '0', `ally_name` = '', `ally_request` = '0', `ally_rank_id` = '0', `ally_register_time` = '0', `ally_request` = '0' WHERE `id` = '".$delete_u."' AND `ally_id` = '".$id."';"); $db->multi_query("UPDATE " . ALLIANCE . " SET `ally_members` = ally_members - 1 WHERE `id` = '" . $id . "' AND `ally_universe` = '" . $_SESSION['adminuni'] . "';UPDATE " . USERS . " SET `ally_id` = '0', `ally_name` = '', `ally_request` = '0', `ally_rank_id` = '0', `ally_register_time` = '0', `ally_request` = '0' WHERE `id` = '" . $delete_u . "' AND `ally_id` = '" . $id . "';"); } $template->message($LNG['ad_ally_succes'], '?page=accounteditor&edit=alliances'); exit; } $template->assign_vars(array('button_submit' => $LNG['button_submit'], 'ad_back_to_menu' => $LNG['ad_back_to_menu'], 'ad_pla_title' => $LNG['ad_pla_title'], 'ad_ally_title' => $LNG['ad_ally_title'], 'input_id_ally' => $LNG['input_id_ally'], 'ad_ally_change_id' => $LNG['ad_ally_change_id'], 'ad_ally_name' => $LNG['ad_ally_name'], 'ad_ally_tag' => $LNG['ad_ally_tag'], 'ad_ally_delete_u' => $LNG['ad_ally_delete_u'], 'ad_ally_user_id' => $LNG['ad_ally_user_id'], 'ad_ally_delete' => $LNG['ad_ally_delete'], 'ad_ally_text1' => $LNG['ad_ally_text1'], 'ad_ally_text2' => $LNG['ad_ally_text2'], 'ad_ally_text3' => $LNG['ad_ally_text3'])); $template->show('adm/AccountEditorPageAlliance.tpl'); break; default: $template->assign_vars(array('ad_editor_personal' => $LNG['ad_editor_personal'], 'ad_editor_alliances' => $LNG['ad_editor_alliances'], 'ad_editor_planets' => $LNG['ad_editor_planets'], 'ad_editor_resources' => $LNG['ad_editor_resources'], 'ad_editor_officiers' => $LNG['ad_editor_officiers'], 'ad_editor_researchs' => $LNG['ad_editor_researchs'], 'ad_editor_defenses' => $LNG['ad_editor_defenses'], 'ad_editor_ships' => $LNG['ad_editor_ships'], 'ad_editor_buildings' => $LNG['ad_editor_buildings'], 'ad_editor_title' => $LNG['ad_editor_title'])); $template->show('adm/AccountEditorPageMenu.tpl'); break; } }
function ShowSupportPage() { global $USER, $LNG, $db; $template = new template(); $ID = request_var('id', 0); switch ($_GET['action']) { case 'send': $text = nl2br(request_var('text', '', true)); if (empty($text)) { $template->message($LNG['sendit_error_msg'], '?page=support&action=detail&id=' . $ID); exit; } $ticket = $db->uniquequery("SELECT `player_id`, `text` FROM " . SUPP . " WHERE `id` = '" . $ID . "';"); $newtext = $ticket['text'] . '<br><br><hr>' . sprintf($LNG['sp_admin_answer'], $USER['username'], date(TDFORMAT, TIMESTAMP), $text); $SQL = "UPDATE " . SUPP . " SET "; $SQL .= "`text` = '" . $db->sql_escape($newtext) . "',"; $SQL .= "`status` = '2'"; $SQL .= "WHERE "; $SQL .= "`id` = '" . $ID . "' "; $db->query($SQL); SendSimpleMessage($ticket['player_id'], '', TIMESTAMP, 4, $USER['username'], sprintf($LNG['sp_answer_message_title'], $ID), sprintf($LNG['sp_answer_message'], $ID)); break; case 'open': $ticket = $db->uniquequery("SELECT text FROM " . SUPP . " WHERE `id` = '" . $ID . "';"); $newtext = $ticket['text'] . '<br><br><hr>' . sprintf($LNG['sp_admin_open'], $USER['username'], date(TDFORMAT, TIMESTAMP)); $SQL = "UPDATE " . SUPP . " SET "; $SQL .= "`text` = '" . $db->sql_escape($newtext) . "',"; $SQL .= "`status` = '2'"; $SQL .= "WHERE "; $SQL .= "`id` = '" . $ID . "' "; $db->query($SQL); break; case 'close': $ticket = $db->uniquequery("SELECT text FROM " . SUPP . " WHERE `id` = '" . $ID . "';"); $newtext = $ticket['text'] . '<br><br><hr>' . sprintf($LNG['sp_admin_closed'], $USER['username'], date(TDFORMAT, TIMESTAMP)); $SQL = "UPDATE " . SUPP . " SET "; $SQL .= "`text` = '" . $db->sql_escape($newtext) . "',"; $SQL .= "`status` = '0'"; $SQL .= "WHERE "; $SQL .= "`id` = '" . $ID . "' "; $db->query($SQL); break; } $tickets = array('open' => array(), 'closed' => array()); $query = $db->query("SELECT s.*, u.username FROM " . SUPP . " as s, " . USERS . " as u WHERE u.id = s.player_id ORDER BY s.time;"); while ($ticket = $db->fetch_array($query)) { switch ($ticket['status']) { case 0: $status = '<font color="red">' . $LNG['supp_close'] . '</font>'; break; case 1: $status = '<font color="green">' . $LNG['supp_open'] . '</font>'; break; case 2: $status = '<font color="orange">' . $LNG['supp_admin_answer'] . '</font>'; break; case 3: $status = '<font color="green">' . $LNG['supp_player_answer'] . '</font>'; break; } if ($_GET['action'] == 'detail' && $ID == $ticket['ID']) { $TINFO = $ticket; } if ($ticket['status'] == 0) { $tickets['closed'][] = array('id' => $ticket['ID'], 'username' => $ticket['username'], 'subject' => $ticket['subject'], 'status' => $status, 'date' => date(TDFORMAT, $ticket['time'])); } else { $tickets['open'][] = array('id' => $ticket['ID'], 'username' => $ticket['username'], 'subject' => $ticket['subject'], 'status' => $status, 'date' => date(TDFORMAT, $ticket['time'])); } } if ($_GET['action'] == 'detail') { if ($TINFO['status'] != 0) { unset($tickets['closed']); } switch ($TINFO['status']) { case 0: $status = '<font color="red">' . $LNG['supp_close'] . '</font>'; break; case 1: $status = '<font color="green">' . $LNG['supp_open'] . '</font>'; break; case 2: $status = '<font color="orange">' . $LNG['supp_admin_answer'] . '</font>'; break; case 3: $status = '<font color="green">' . $LNG['supp_player_answer'] . '</font>'; break; } $template->assign_vars(array('t_id' => $TINFO['ID'], 't_username' => $TINFO['username'], 't_statustext' => $status, 't_status' => $TINFO['status'], 't_text' => $TINFO['text'], 't_subject' => $TINFO['subject'], 't_date' => date(TDFORMAT, $TINFO['time']), 'text' => $LNG['text'], 'answer_new' => $LNG['answer_new'], 'button_submit' => $LNG['button_submit'], 'open_ticket' => $LNG['open_ticket'], 'close_ticket' => $LNG['close_ticket'])); } $template->assign_vars(array('tickets' => $tickets, 'supp_header' => $LNG['supp_header'], 'supp_header_g' => $LNG['supp_header_g'], 'ticket_id' => $LNG['ticket_id'], 'player' => $LNG['player'], 'subject' => $LNG['subject'], 'status' => $LNG['status'], 'ticket_posted' => $LNG['ticket_posted'])); $template->show('adm/SupportPage.tpl'); }