This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
fleetback.php
96 lines (88 loc) · 3.7 KB
/
fleetback.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
* 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 <http://www.gnu.org/licenses/>.
*
* --> 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';
includeLang('fleet');
$BoxTitle = $lang['fl_error'];
$TxtColor = "red";
$BoxMessage = $lang['fl_notback'];
if ( is_numeric($_POST['fleetid']) ) {
$fleetid = intval($_POST['fleetid']);
$FleetRow = doquery("SELECT * FROM {{table}} WHERE `fleet_id` = '". $fleetid ."';", 'fleets', true);
$i = 0;
if ($FleetRow['fleet_owner'] == $user['id']) {
if ($FleetRow['fleet_mess'] == 0) {
if ($FleetRow['fleet_end_stay'] != 0) {
// Faut calculer le temps reel de retour
if ($FleetRow['fleet_start_time'] < time()) {
// On a pas encore entamé le stationnement
// Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte
$CurrentFlyingTime = time() - $FleetRow['start_time'];
} else {
// On est deja en stationnement
// Il faut donc directement calculer la durée d'un vol aller ou retour
$CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time'];
}
} else {
// C'est quoi le stationnement ??
// On calcule sagement la parcelle de temps ecoulée depuis le depart
$CurrentFlyingTime = time() - $FleetRow['start_time'];
}
// Allez houste au bout du compte y a la maison !! (E.T. phone home.............)
$ReturnFlyingTime = $CurrentFlyingTime + time();
$QryUpdateFleet = "UPDATE {{table}} SET ";
$QryUpdateFleet .= "`fleet_start_time` = '". (time() - 1) ."', ";
$QryUpdateFleet .= "`fleet_end_stay` = '0', ";
$QryUpdateFleet .= "`fleet_end_time` = '". ($ReturnFlyingTime + 1) ."', ";
$QryUpdateFleet .= "`fleet_target_owner` = '". $user['id'] ."', ";
$QryUpdateFleet .= "`fleet_mess` = '1' ";
$QryUpdateFleet .= "WHERE ";
$QryUpdateFleet .= "`fleet_id` = '" . $fleetid . "';";
doquery( $QryUpdateFleet, 'fleets');
$BoxTitle = $lang['fl_sback'];
$TxtColor = "lime";
$BoxMessage = $lang['fl_isback'];
} elseif ($FleetRow['fleet_mess'] == 1) {
$BoxMessage = $lang['fl_notback'];
}
} else {
$BoxMessage = $lang['fl_onlyyours'];
}
}
message ("<font color=\"".$TxtColor."\">". $BoxMessage ."</font>", $BoxTitle, "fleet.php", 2);
// -----------------------------------------------------------------------------------------------------------
// History version
// Updated by Chlorel. 22 Jan 2008 (String extraction, bug corrections, code uniformisation
// Created by DxPpLmOs. All rights reversed (C) 2007
// Updated by -= MoF =- for Deutsches Ugamela Forum
// 06.12.2007 - 08:41
// Open Source
// (c) by MoF