-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhibernation.php
More file actions
383 lines (364 loc) · 14.1 KB
/
hibernation.php
File metadata and controls
383 lines (364 loc) · 14.1 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<?php
/**
* Hibernation Mode Info Page
*
* Displays information about the current hibernation status,
* paused features, and what continues to run.
*
* Stats section fetches from /api/data/hibernation_stats.php via AJAX
*/
include("sessions/handler.php");
include("load/config.php");
include("load/i18n.php");
$deepHibernation = defined('DEEP_HIBERNATION_MODE') && DEEP_HIBERNATION_MODE;
?>
<!DOCTYPE html>
<html lang="<?= substr(PERTII18nPHP::getLocale(), 0, 2) ?>">
<head>
<?php $page_title = __('hibernation.title'); include("load/header.php"); ?>
<style>
.hibernation-hero {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
padding: 80px 0 60px;
text-align: center;
position: relative;
overflow: hidden;
}
.hibernation-hero::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: radial-gradient(circle at 30% 50%, rgba(93,173,226,0.08) 0%, transparent 50%),
radial-gradient(circle at 70% 30%, rgba(52,152,219,0.06) 0%, transparent 50%);
}
.hibernation-hero h1 {
font-size: 2.5rem;
font-weight: 700;
color: #fff;
margin-bottom: 10px;
}
.hibernation-hero .snowflake-icon {
font-size: 3rem;
color: #5dade2;
margin-bottom: 20px;
display: block;
opacity: 0.8;
}
.hibernation-hero .subtitle {
font-size: 1.15rem;
color: rgba(255,255,255,0.7);
max-width: 600px;
margin: 0 auto;
}
.hibernation-card {
background: #fff;
border: 1px solid #dee2e6;
border-radius: 10px;
padding: 30px;
margin-bottom: 30px;
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.hibernation-card h3 {
color: #2c3e50;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #e9ecef;
}
.hibernation-card h3 i {
margin-right: 8px;
}
.feature-list {
list-style: none;
padding: 0;
margin: 0;
}
.feature-list li {
padding: 8px 0;
border-bottom: 1px solid #f1f3f5;
display: flex;
align-items: center;
}
.feature-list li:last-child {
border-bottom: none;
}
.feature-list .status-icon {
width: 28px;
text-align: center;
margin-right: 12px;
flex-shrink: 0;
}
.feature-list .paused {
color: #e74c3c;
}
.feature-list .active {
color: #27ae60;
}
.timeframe-badge {
display: inline-block;
background: #2c3e50;
color: #5dade2;
padding: 6px 16px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 600;
margin-top: 15px;
}
.data-note {
background: #e8f8f5;
border-left: 4px solid #27ae60;
padding: 15px 20px;
border-radius: 0 8px 8px 0;
margin-top: 20px;
}
.data-note i {
color: #27ae60;
margin-right: 8px;
}
.stats-summary {
display: flex;
gap: 20px;
margin-bottom: 25px;
}
.stat-box {
flex: 1;
background: #f8f9fa;
border-radius: 8px;
padding: 20px;
text-align: center;
}
.stat-box .stat-value {
font-size: 2rem;
font-weight: 700;
color: #2c3e50;
line-height: 1.2;
}
.stat-box .stat-label {
font-size: 0.85rem;
color: #6c757d;
margin-top: 4px;
}
.stats-table {
width: 100%;
border-collapse: collapse;
}
.stats-table th {
background: #f8f9fa;
padding: 10px 12px;
text-align: left;
font-size: 0.8rem;
text-transform: uppercase;
color: #6c757d;
border-bottom: 2px solid #dee2e6;
}
.stats-table td {
padding: 8px 12px;
border-bottom: 1px solid #f1f3f5;
font-size: 0.9rem;
}
.stats-table tr:last-child td {
border-bottom: none;
}
.stats-table .type-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 10px;
font-size: 0.75rem;
font-weight: 600;
}
.stats-table .type-page { background: #e3f2fd; color: #1565c0; }
.stats-table .type-api { background: #fce4ec; color: #c62828; }
.stats-spinner {
text-align: center;
padding: 30px;
color: #6c757d;
}
</style>
</head>
<body>
<?php include('load/nav_public.php'); ?>
<!-- Hero Section -->
<div class="hibernation-hero">
<div class="container position-relative">
<span class="snowflake-icon"><i class="fas fa-snowflake"></i></span>
<h1><?= __('hibernation.heroTitle') ?></h1>
<p class="subtitle">
<?php if ($deepHibernation): ?>
<?= __('hibernation.deepHeroSubtitle') ?>
<?php else: ?>
<?= __('hibernation.heroSubtitle') ?>
<?php endif; ?>
</p>
<span class="timeframe-badge"><i class="fas fa-clock mr-1"></i> <?= __('hibernation.timeframeBadge') ?></span>
</div>
</div>
<!-- Main Content -->
<div class="container mt-5 mb-5">
<div class="row">
<!-- Paused Features -->
<div class="col-lg-6">
<div class="hibernation-card">
<h3><i class="fas fa-pause-circle" style="color:#e74c3c;"></i> <?= __('hibernation.pausedFeatures') ?></h3>
<ul class="feature-list">
<?php
$paused_keys = [
'demandCharts', 'nodDisplay', 'gdtDisplay',
'postEventReview', 'vatswimApi', 'atcSimulator', 'suaDisplay',
'eventAarConfig', 'routeParsingBoundary'
];
foreach ($paused_keys as $k): ?>
<li>
<span class="status-icon paused"><i class="fas fa-times-circle"></i></span>
<span><?= __('hibernation.' . $k) ?></span>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<!-- Still Active -->
<div class="col-lg-6">
<div class="hibernation-card">
<h3><i class="fas fa-check-circle" style="color:#27ae60;"></i> <?= __('hibernation.stillActive') ?></h3>
<ul class="feature-list">
<?php
$active_keys = [
'plansSheets', 'airportConfig', 'routeVisualization', 'playbookCdr',
'sectorSplits', 'navigationData', 'eventSchedule', 'tmiPublisher',
'discordTmiPosting', 'jatocIncident', 'systemStatus', 'loginAuth'
];
foreach ($active_keys as $k): ?>
<li>
<span class="status-icon active"><i class="fas fa-check-circle"></i></span>
<span><?= __('hibernation.' . $k) ?></span>
</li>
<?php endforeach; ?>
</ul>
<div class="data-note">
<i class="fas fa-database"></i>
<strong><?= __('hibernation.dataNote') ?></strong>
<?= __('hibernation.dataNoteDetail') ?>
</div>
<?php if ($deepHibernation): ?>
<div class="data-note" style="background:#fff3e0;border-left-color:#ff9800;">
<i class="fas fa-archive" style="color:#ff9800;"></i>
<strong><?= __('hibernation.deepDataNote') ?></strong>
<?= __('hibernation.deepDataNoteDetail') ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Access Attempt Stats -->
<div class="row mt-2">
<div class="col-12">
<div class="hibernation-card">
<h3><i class="fas fa-chart-bar" style="color:#3498db;"></i> <?= __('hibernation.statsTitle') ?></h3>
<p style="color:#6c757d;margin-top:-10px;margin-bottom:20px;"><?= __('hibernation.statsSubtitle') ?></p>
<div id="hib-stats-loading" class="stats-spinner">
<i class="fas fa-spinner fa-spin fa-lg"></i>
<div style="margin-top:8px;"><?= __('hibernation.statsLoading') ?></div>
</div>
<div id="hib-stats-content" style="display:none;">
<div class="stats-summary">
<div class="stat-box">
<div class="stat-value" id="stat-total-hits">0</div>
<div class="stat-label"><?= __('hibernation.statsTotalHits') ?></div>
</div>
<div class="stat-box">
<div class="stat-value" id="stat-unique-ips">0</div>
<div class="stat-label"><?= __('hibernation.statsUniqueVisitors') ?></div>
</div>
</div>
<div class="row">
<div class="col-lg-7">
<h6 style="color:#6c757d;text-transform:uppercase;font-size:0.8rem;margin-bottom:10px;">
<?= __('hibernation.statsColPage') ?>
</h6>
<table class="stats-table">
<thead>
<tr>
<th><?= __('hibernation.statsColPage') ?></th>
<th><?= __('hibernation.statsColType') ?></th>
<th><?= __('hibernation.statsColHits') ?></th>
<th><?= __('hibernation.statsColUnique') ?></th>
</tr>
</thead>
<tbody id="stats-by-page"></tbody>
</table>
<div id="stats-no-data" style="display:none;text-align:center;padding:20px;color:#6c757d;">
<?= __('hibernation.statsNoData') ?>
</div>
</div>
<div class="col-lg-5">
<h6 style="color:#6c757d;text-transform:uppercase;font-size:0.8rem;margin-bottom:10px;">
<?= __('hibernation.statsDailyTrend') ?>
</h6>
<table class="stats-table">
<thead>
<tr>
<th><?= __('hibernation.statsColDate') ?></th>
<th><?= __('hibernation.statsColHits') ?></th>
<th><?= __('hibernation.statsColUnique') ?></th>
</tr>
</thead>
<tbody id="stats-by-day"></tbody>
</table>
</div>
</div>
</div>
<div id="hib-stats-error" style="display:none;text-align:center;padding:20px;color:#e74c3c;">
<i class="fas fa-exclamation-triangle"></i> <?= __('hibernation.statsError') ?>
</div>
</div>
</div>
</div>
</div>
<script>
(function() {
var pageLabel = <?= json_encode(__('hibernation.statsTypePage')) ?>;
var apiLabel = <?= json_encode(__('hibernation.statsTypeApi')) ?>;
$.getJSON('/api/data/hibernation_stats.php')
.done(function(data) {
$('#hib-stats-loading').hide();
$('#hib-stats-content').show();
$('#stat-total-hits').text(data.totals.hits.toLocaleString());
$('#stat-unique-ips').text(data.totals.unique_ips.toLocaleString());
var pageBody = $('#stats-by-page');
if (data.by_page && data.by_page.length > 0) {
$.each(data.by_page, function(i, row) {
var isApi = row.hit_type === 'api';
var typeClass = isApi ? 'type-api' : 'type-page';
var typeText = isApi ? apiLabel : pageLabel;
pageBody.append(
'<tr>' +
'<td>' + $('<span>').text(row.page).html() + '</td>' +
'<td><span class="type-badge ' + typeClass + '">' + typeText + '</span></td>' +
'<td>' + parseInt(row.hits).toLocaleString() + '</td>' +
'<td>' + parseInt(row.unique_ips).toLocaleString() + '</td>' +
'</tr>'
);
});
} else {
$('#stats-no-data').show();
}
var dayBody = $('#stats-by-day');
if (data.by_day && data.by_day.length > 0) {
$.each(data.by_day, function(i, row) {
dayBody.append(
'<tr>' +
'<td>' + row.date + '</td>' +
'<td>' + parseInt(row.hits).toLocaleString() + '</td>' +
'<td>' + parseInt(row.unique_ips).toLocaleString() + '</td>' +
'</tr>'
);
});
}
})
.fail(function() {
$('#hib-stats-loading').hide();
$('#hib-stats-error').show();
});
})();
</script>
</body>
<?php include('load/footer.php'); ?>
</html>