* All rights reserved.
*
* 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 .
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing XNova.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $planetrow['id_owner'] . "' AND `galaxy` = '" . $planetrow['galaxy'] . "' AND `system` = '" . $planetrow['system'] . "' AND `lunapos` = '" . $planetrow['planet'] . "';", 'lunas', true);
//CheckPlanetUsedFields ($lunarow);
$mode = isset($_GET['mode']) ? $_GET['mode'] : '';
$_POST['deleteid'] = intval($_POST['deleteid']);
$pl = mysql_real_escape_string(isset($_GET['pl']) ? $_GET['pl'] : 0);
includeLang('resources');
includeLang('overview');
switch ($mode) {
case 'renameplanet':
// -----------------------------------------------------------------------------------------------
if ($_POST['action'] == $lang['namer']) {
// Reponse au changement de nom de la planete
$UserPlanet = addslashes(CheckInputStrings ($_POST['newname']));
$newname = mysql_escape_string(trim($UserPlanet));
if ($newname != "") {
// Deja on met jour la planete qu'on garde en memoire (pour le nom)
$planetrow['name'] = $newname;
// Ensuite, on enregistre dans la base de données
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $user['current_planet'] . "' LIMIT 1;", "planets");
// Est ce qu'il sagit d'une lune ??
if ($planetrow['planet_type'] == 3) {
// Oui ... alors y a plus qu'a changer son nom dans la table des lunes aussi !!!
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `galaxy` = '" . $planetrow['galaxy'] . "' AND `system` = '" . $planetrow['system'] . "' AND `lunapos` = '" . $planetrow['planet'] . "' LIMIT 1;", "lunas");
}
}
} elseif ($_POST['action'] == $lang['colony_abandon']) {
// Cas d'abandon d'une colonie
// Affichage de la forme d'abandon de colonie
$parse = $lang;
$parse['planet_id'] = $planetrow['id'];
$parse['galaxy_galaxy'] = $planetrow['galaxy'];
$parse['galaxy_system'] = $planetrow['system'];
$parse['galaxy_planet'] = $planetrow['planet'];
$parse['planet_name'] = $planetrow['name'];
$page .= parsetemplate(gettemplate('overview_deleteplanet'), $parse);
// On affiche la forme pour l'abandon de la colonie
display($page, $lang['rename_and_abandon_planet']);
} elseif ($_POST['kolonieloeschen'] == 1 && $_POST['deleteid'] == $user['current_planet']) {
// Controle du mot de passe pour abandon de colonie
if (md5($_POST['pw']) == $user["password"] && $user['id_planet'] != $user['current_planet']) {
include_once(ROOT_PATH . 'includes/functions/AbandonColony.' . PHPEXT);
if (CheckFleets($planetrow)){
$strMessage = "Vous ne pouvez pas abandonner la colonie, il y a de la flotte en vol !";
message($strMessage, $lang['colony_abandon'], 'overview.php?mode=renameplanet',3);
}
AbandonColony($user,$planetrow);
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`current_planet` = `id_planet` ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $user['id'] . "' LIMIT 1";
doquery($QryUpdateUser, "users");
// Tout s'est bien pass� ! La colo a �t� effac�e !!
message($lang['deletemessage_ok'] , $lang['colony_abandon'], 'overview.php',3);
} elseif ($user['id_planet'] == $user["current_planet"]) {
// Et puis quoi encore ??? On ne peut pas effacer la planete mere ..
// Uniquement les colonies cr�es apres coup !!!
message($lang['deletemessage_wrong'], $lang['colony_abandon'], 'overview.php?mode=renameplanet');
} else {
// Erreur de saisie du mot de passe je n'efface pas !!!
message($lang['deletemessage_fail'] , $lang['colony_abandon'], 'overview.php?mode=renameplanet');
}
}
$parse = $lang;
$parse['planet_id'] = $planetrow['id'];
$parse['galaxy_galaxy'] = $planetrow['galaxy'];
$parse['galaxy_system'] = $planetrow['system'];
$parse['galaxy_planet'] = $planetrow['planet'];
$parse['planet_name'] = $planetrow['name'];
$page .= parsetemplate(gettemplate('overview_renameplanet'), $parse);
// On affiche la page permettant d'abandonner OU de renomme une Colonie / Planete
display($page, $lang['rename_and_abandon_planet']);
break;
default:
if ($user['id'] != '') {
// --- Gestion des messages ----------------------------------------------------------------------
$Have_new_message = "";
if ($user['new_message'] != 0) {
$Have_new_message .= "
";
if ($user['new_message'] == 1) {
$Have_new_message .= "