-
Notifications
You must be signed in to change notification settings - Fork 1
/
missions.php
211 lines (155 loc) · 5.71 KB
/
missions.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
require 'config.php';
require 'classes/Session.class.php';
require 'classes/Player.class.php';
require 'classes/Mission.class.php';
require 'classes/System.class.php';
$session = new Session();
$system = new System();
ob_start();
require 'template/contentStart.php';
$mission = new Mission();
$finances = new Finances();
$sub = 'Missions';
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST)){
$mission->handlePost();
}
$available = 'active';
$availableLink = 'missions.php';
$current = '';
$currentLink = '';
$completed = '';
if($session->issetMissionSession()){
if($system->issetGet('id')){
$idInfo = $system->verifyNumericGet('id');
if($idInfo['GET_VALUE'] == $_SESSION['MISSION_ID']){
$available = '';
$availableLink = 'missions?view=all';
$current = 'active';
}
} else {
$available = '';
$availableLink = 'missions?view=all';
$current = 'active';
}
$currentLink = 'missions.php';
}
if($system->issetGet('view')){
$viewInfo = $system->verifyStringGet('view');
if($viewInfo['GET_VALUE'] == 'all'){
$available = 'active';
$current = '';
$completed = '';
} elseif($viewInfo['GET_VALUE'] == 'completed'){
$available = '';
$current = '';
$completed = 'active';
}
}
if($current == 'active' || $system->issetGet('id')){
$span = 'span12';
} else {
$span = 'span9';
}
//DONT TOUCH
if($session->issetMissionSession()){
if($_SESSION['MISSION_TYPE'] > 49){
if(!$system->issetGet('view')){
$span = 'span12';
}
}
}
?>
<div class="span12">
<?php
if($session->issetMsg()){
$session->returnMsg();
}
?>
<div class="widget-box">
<div class="widget-title">
<ul class="nav nav-tabs">
<li class="link <?php echo $available; ?>"><a href="<?php echo $availableLink; ?>"><span class="he16-missions icon-tab"></span><span class="hide-phone"><?php echo _('Available missions'); ?></span></a></li>
<?php
if($session->issetMissionSession()){
?>
<li class="link <?php echo $current; ?>"><a href="<?php echo $currentLink; ?>"><span class="he16-missions_current icon-tab"></span><span class="hide-phone"><?php echo _('Current mission'); ?></span></a></li>
<?php
}
?>
<li class="link <?php echo $completed; ?>"><a href="?view=completed"><span class="he16-missions_completed icon-tab"></span><span class="hide-phone"><?php echo _('Completed missions'); ?></span></a></li>
<a href="<?php echo $session->help('missions'); ?>"><span class="label label-info"><?php echo _("Help"); ?></span></a>
</ul>
</div>
<div class="widget-content padding noborder">
<div class="<?php echo $span; ?>">
<?php
// 2019: User has mission
if($session->issetMissionSession() && !$system->issetGet('view') && !$system->issetGet('id')){ //tem missao
if($mission->issetMission($_SESSION['MISSION_ID'])){
$mission->showMission($_SESSION['MISSION_ID']);
} else {
$session->deleteMissionSession();
}
// 2019: No mission, but there may be storyline mission (checking DB)
} elseif($mission->storyline_hasMission() && !$system->issetGet('view') && !$system->issetGet('id')){ //nao tem sessão de missão, mas pode ter missão de storyline (olhando no banco)
$mission->showMission($_SESSION['MISSION_ID']);
// 2019: Definitely no mission; let me list all of them
} else { //nao ta em nenhuma misssao, vou listar todas
if($system->issetGet('id')){
$idInfo = $system->verifyNumericGet('id');
if($idInfo['IS_NUMERIC'] == '1'){
if($mission->issetMission($idInfo['GET_VALUE'])){
if($system->issetGet('action')){
$actionInfo = $system->verifyStringGet('action');
} else {
$mission->showMission($idInfo['GET_VALUE']);
}
} else {
echo 'This mission doesnt exists anymore';
}
} else {
echo 'Invalid ID';
}
} else {
if($system->issetGet('view')){
$viewInfo = $system->switchGet('view', 'all', 'completed');
if($viewInfo['ISSET_GET'] == '1'){
switch($viewInfo['GET_VALUE']){
case 'all':
if($session->issetMissionSession()){
?>
<div class="alert center">
<?php echo _('You are currently in a mission.'); ?>
</div>
<?php
}
$mission->listMissions();
break;
case 'completed':
$mission->listCompletedMissions();
break;
}
} else {
die("Invalid view option");
}
} else {
$mission->listMissions();
}
}
}
if($span == 'span12'){
?>
</div>
</div>
<?php
}
?>
</div>
<div class="nav nav-tabs" style="clear: both;"> </div>
<?php
ob_end_flush();
ob_start();
require 'template/contentEnd.php';
ob_end_flush();
?>