Completed
Push — master ( b35b0f...acc097 )
by Greg
05:21
created

dashboard/index.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * /dashboard/index.php
4
 *
5
 * This file is part of DomainMOD, an open source domain and internet asset manager.
6
 * Copyright (c) 2010-2017 Greg Chetcuti <[email protected]>
7
 *
8
 * Project: http://domainmod.org   Author: http://chetcuti.com
9
 *
10
 * DomainMOD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
11
 * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
12
 * version.
13
 *
14
 * DomainMOD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
15
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License along with DomainMOD. If not, see
18
 * http://www.gnu.org/licenses/.
19
 *
20
 */
21
?>
22
<?php
23
require_once('../_includes/start-session.inc.php');
24
require_once('../_includes/init.inc.php');
25
26
require_once(DIR_ROOT . '/classes/Autoloader.php');
27
spl_autoload_register('DomainMOD\Autoloader::classAutoloader');
28
29
$system = new DomainMOD\System();
30
$error = new DomainMOD\Error();
31
$time = new DomainMOD\Time();
32
33
require_once(DIR_INC . '/head.inc.php');
34
require_once(DIR_INC . '/config.inc.php');
35
require_once(DIR_INC . '/software.inc.php');
36
require_once(DIR_INC . '/debug.inc.php');
37
require_once(DIR_INC . '/settings/dashboard-main.inc.php');
38
require_once(DIR_INC . '/database.inc.php');
39
40
$system->authCheck();
41
?>
42
<?php require_once(DIR_INC . '/doctype.inc.php'); ?>
43
<html>
44
<head>
45
    <title><?php echo $system->pageTitle($page_title); ?></title>
46
    <?php require_once(DIR_INC . '/layout/head-tags.inc.php'); ?>
47
</head>
48
<body class="hold-transition skin-red sidebar-mini" onLoad="document.forms[0].elements[0].focus()">
49
<?php require_once(DIR_INC . '/layout/header.inc.php'); ?>
50
51
<!-- Small boxes (Stat box) -->
52
<div class="row">
53
54
    <!-- Expiring Boxes -->
55
    <?php
56
    $tmpq = $system->db()->query("
57
        SELECT expiration_days
58
        FROM settings");
59
    $expiration_days = $tmpq->fetchColumn();
60
61
    $start_date = '2000-01-01';
62
    $end_date = $time->timeBasicPlusDays($expiration_days);
63
    $daterange = $start_date . ' - ' . $end_date;
64
    ?>
65
    <h3 style="padding-left:20px;">Expiring in the next <?php echo $expiration_days; ?> days</h3>
66
    <div class="col-lg-3 col-xs-6">
67
        <!-- small box -->
68
        <div class="small-box bg-red">
69
            <div class="inner">
70
                <?php
71
                $tmpq = $system->db()->prepare("
72
                    SELECT id, expiry_date, domain
73
                    FROM domains
74
                    WHERE active NOT IN ('0', '10')
75
                      AND expiry_date <= :end_date
76
                    ORDER BY expiry_date, domain");
77
                $tmpq->execute(array('end_date' => $end_date));
78
                $result = $tmpq->fetchAll();
79
80 View Code Duplication
                if (!$result) {
1 ignored issue
show
Bug Best Practice introduced by
The expression $result of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
81
82
                    $to_display = '0';
83
84
                } else {
85
86
                    $tmpq = $system->db()->prepare("
87
                        SELECT count(*)
88
                        FROM domains
89
                        WHERE active NOT IN ('0', '10')
90
                          AND expiry_date <= :end_date");
91
                    $tmpq->execute(array('end_date' => $end_date));
92
                    $to_display = $tmpq->fetchColumn();
93
94
                }
95
                ?>
96
                <h3><?php echo number_format($to_display); ?></h3>
97
                <p>Domains</p>
98
            </div>
99
            <div class="icon">
100
                <i class="ion ion-close-circled" style="padding-top:16px;"></i>
101
            </div>
102
            <a href="<?php echo $web_root; ?>/domains/index.php?daterange=<?php echo urlencode($daterange); ?>" class="small-box-footer">View <i
103
                    class="fa fa-arrow-circle-right"></i></a>
104
        </div>
105
    </div>
106
    <!-- ./col -->
107
108
    <div class="col-lg-3 col-xs-6">
109
        <!-- small box -->
110
        <div class="small-box bg-red">
111
            <div class="inner">
112
                <?php
113
                $tmpq = $system->db()->prepare("
114
                    SELECT sslc.id, sslc.expiry_date, sslc.name, sslt.type
115
                    FROM ssl_certs AS sslc, ssl_cert_types AS sslt
116
                    WHERE sslc.type_id = sslt.id
117
                      AND sslc.active NOT IN ('0')
118
                      AND sslc.expiry_date <= :end_date
119
                    ORDER BY sslc.expiry_date, sslc.name");
120
                $tmpq->execute(array('end_date' => $end_date));
121
                $result = $tmpq->fetchAll();
122
123 View Code Duplication
                if (!$result) {
1 ignored issue
show
Bug Best Practice introduced by
The expression $result of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
124
125
                    $to_display = '0';
126
127
                } else {
128
129
                    $tmpq = $system->db()->prepare("
130
                        SELECT count(*)
131
                        FROM ssl_certs AS sslc, ssl_cert_types AS sslt
132
                        WHERE sslc.type_id = sslt.id
133
                          AND sslc.active NOT IN ('0')
134
                          AND sslc.expiry_date <= :end_date");
135
                    $tmpq->execute(array('end_date' => $end_date));
136
                    $to_display = $tmpq->fetchColumn();
137
138
                }
139
                ?>
140
                <h3><?php echo number_format($to_display); ?></h3>
141
                <p>SSL Certificates</p>
142
            </div>
143
            <div class="icon">
144
                <i class="ion ion-close-circled" style="padding-top:16px;"></i>
145
            </div>
146
            <a href="<?php echo $web_root; ?>/ssl/index.php?daterange=<?php echo urlencode($daterange); ?>" class="small-box-footer">View <i
147
                    class="fa fa-arrow-circle-right"></i></a>
148
        </div>
149
    </div>
150
    <!-- ./col -->
151
152
</div>
153
154
<div class="row">
155
156
    <!-- Main Boxes -->
157
    <h3 style="padding-left:20px;">System Totals</h3>
158
159
160
    <?php // only display the queue widget if there are results
161
    $sql = "SELECT id
162
            FROM domain_queue
163
            LIMIT 1";
164
    $result = mysqli_query($dbcon, $sql);
165
166
    if (mysqli_num_rows($result) > 0) { ?>
167
168
        <!-- ./col -->
169
        <div class="col-lg-3 col-xs-6">
170
            <!-- small box -->
171
            <div class="small-box bg-yellow">
172
                <div class="inner">
173
                    <?php
174
                    $sql = "SELECT count(*) AS total_count
175
                            FROM domain_queue";
176
                    $result = mysqli_query($dbcon, $sql);
177
                    while ($row = mysqli_fetch_object($result)) {
178
                        $total_count = $row->total_count;
179
                    }
180
                    ?>
181
                    <h3><?php echo number_format($total_count); ?></h3>
182
183
                    <p>Domains in Queue</p>
184
                </div>
185
                <div class="icon">
186
                    <i class="ion ion-clock" style="padding-top:16px;"></i>
187
                </div>
188
                <a href="<?php echo $web_root; ?>/queue/" class="small-box-footer">View <i
189
                        class="fa fa-arrow-circle-right"></i></a>
190
            </div>
191
        </div>
192
        <!-- ./col --><?php
193
194
    } ?>
195
196
    <div class="col-lg-3 col-xs-6">
197
        <!-- small box -->
198
        <div class="small-box bg-green">
199
            <div class="inner">
200
                <?php
201
                $sql = "SELECT count(*) AS total_count
202
                        FROM domains
203
                        WHERE active NOT IN ('0', '10')";
204
                $result = mysqli_query($dbcon, $sql);
205
                while ($row = mysqli_fetch_object($result)) {
206
                    $total_count = $row->total_count;
207
                }
208
                ?>
209
                <h3><?php echo number_format($total_count); ?></h3>
210
211
                <p>Domains</p>
212
            </div>
213
            <div class="icon">
214
                <i class="ion ion-checkmark-circled" style="padding-top:17px;"></i>
215
            </div>
216
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=LIVE" class="small-box-footer">View <i
217
                    class="fa fa-arrow-circle-right"></i></a>
218
        </div>
219
    </div>
220
221
    <div class="col-lg-3 col-xs-6">
222
        <!-- small box -->
223
        <div class="small-box bg-green">
224
            <div class="inner">
225
                <?php
226
                $sql = "SELECT count(*) AS total_count
227
                        FROM ssl_certs
228
                        WHERE active NOT IN ('0', '10')";
229
                $result = mysqli_query($dbcon, $sql);
230
                while ($row = mysqli_fetch_object($result)) {
231
                    $total_count = $row->total_count;
232
                }
233
                ?>
234
                <h3><?php echo number_format($total_count); ?></h3>
235
236
                <p>SSL Certificates</p>
237
            </div>
238
            <div class="icon">
239
                <i class="ion ion-checkmark-circled" style="padding-top:17px;"></i>
240
            </div>
241
            <a href="<?php echo $web_root; ?>/ssl/index.php?is_active=LIVE" class="small-box-footer">View <i
242
                    class="fa fa-arrow-circle-right"></i></a>
243
        </div>
244
    </div>
245
246
    <div class="col-lg-3 col-xs-6">
247
        <!-- small box -->
248
        <div class="small-box bg-aqua">
249
            <div class="inner">
250
                <?php
251
                $sql = "SELECT count(*) AS total_count
252
                        FROM domains
253
                        WHERE active = '10'";
254
                $result = mysqli_query($dbcon, $sql);
255
                while ($row = mysqli_fetch_object($result)) {
256
                    $total_count = $row->total_count;
257
                }
258
                ?>
259
                <h3><?php echo number_format($total_count); ?></h3>
260
                <p>Sold Domains</p>
261
            </div>
262
            <div class="icon">
263
                <i class="ion ion-android-cart" style="padding-top:17px;"></i>
264
            </div>
265
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=10" class="small-box-footer">View <i
266
                    class="fa fa-arrow-circle-right"></i></a>
267
        </div>
268
    </div>
269
    <!-- ./col -->
270
271
</div>
272
273
<!-- Small boxes (Stat box) -->
274
<div class="row">
275
276
    <!-- Domain Panels -->
277
    <h3 style="padding-left:20px;">Domains</h3>
278
    <div class="col-lg-3 col-xs-6">
279
        <!-- small box -->
280
        <div class="small-box bg-red">
281
            <div class="inner">
282
                <?php
283
                $sql = "SELECT count(*) AS total_count
284
                        FROM domains
285
                        WHERE active = '3'";
286
                $result = mysqli_query($dbcon, $sql);
287
                while ($row = mysqli_fetch_object($result)) {
288
                    $total_count = $row->total_count;
289
                }
290
                ?>
291
                <h3><?php echo number_format($total_count); ?></h3>
292
293
                <p>Pending Renewals</p>
294
            </div>
295
            <div class="icon">
296
                <i class="ion ion-clock" style="padding-top:16px;"></i>
297
            </div>
298
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=3" class="small-box-footer">View <i
299
                    class="fa fa-arrow-circle-right"></i></a>
300
        </div>
301
    </div>
302
    <!-- ./col -->
303
304
    <!-- ./col -->
305
    <div class="col-lg-3 col-xs-6">
306
        <!-- small box -->
307
        <div class="small-box bg-yellow">
308
            <div class="inner">
309
                <?php
310
                $sql = "SELECT count(*) AS total_count
311
                        FROM domains
312
                        WHERE active = '5'";
313
                $result = mysqli_query($dbcon, $sql);
314
                while ($row = mysqli_fetch_object($result)) {
315
                    $total_count = $row->total_count;
316
                }
317
                ?>
318
                <h3><?php echo number_format($total_count); ?></h3>
319
320
                <p>Pending Registrations</p>
321
            </div>
322
            <div class="icon">
323
                <i class="ion ion-clock" style="padding-top:16px;"></i>
324
            </div>
325
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=5" class="small-box-footer">View <i
326
                    class="fa fa-arrow-circle-right"></i></a>
327
        </div>
328
    </div>
329
    <!-- ./col -->
330
331
    <div class="col-lg-3 col-xs-6">
332
        <!-- small box -->
333
        <div class="small-box bg-aqua">
334
            <div class="inner">
335
                <?php
336
                $sql = "SELECT count(*) AS total_count
337
                        FROM domains
338
                        WHERE active = '2'";
339
                $result = mysqli_query($dbcon, $sql);
340
                while ($row = mysqli_fetch_object($result)) {
341
                    $total_count = $row->total_count;
342
                }
343
                ?>
344
                <h3><?php echo number_format($total_count); ?></h3>
345
                <p>Pending Transfers</p>
346
            </div>
347
            <div class="icon">
348
                <i class="ion ion-clock" style="padding-top:16px;"></i>
349
            </div>
350
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=2" class="small-box-footer">View <i
351
                    class="fa fa-arrow-circle-right"></i></a>
352
        </div>
353
    </div>
354
    <!-- ./col -->
355
356
    <div class="col-lg-3 col-xs-6">
357
        <!-- small box -->
358
        <div class="small-box bg-green">
359
            <div class="inner">
360
                <?php
361
                $sql = "SELECT count(*) AS total_count
362
                        FROM domains
363
                        WHERE active = '4'";
364
                $result = mysqli_query($dbcon, $sql);
365
                while ($row = mysqli_fetch_object($result)) {
366
                    $total_count = $row->total_count;
367
                }
368
                ?>
369
                <h3><?php echo number_format($total_count); ?></h3>
370
371
                <p>Pending (Other)</p>
372
            </div>
373
            <div class="icon">
374
                <i class="ion ion-clock" style="padding-top:16px;"></i>
375
            </div>
376
            <a href="<?php echo $web_root; ?>/domains/index.php?is_active=4" class="small-box-footer">View <i
377
                    class="fa fa-arrow-circle-right"></i></a>
378
        </div>
379
    </div>
380
381
</div>
382
383
<div class="row">
384
385
    <!-- SSL Certificate Panels -->
386
    <h3 style="padding-left:20px;">SSL Certificates</h3>
387
    <div class="col-lg-3 col-xs-6">
388
        <!-- small box -->
389
        <div class="small-box bg-red">
390
            <div class="inner">
391
                <?php
392
                $sql = "SELECT count(*) AS total_count
393
                        FROM ssl_certs
394
                        WHERE active = '3'";
395
                $result = mysqli_query($dbcon, $sql);
396
                while ($row = mysqli_fetch_object($result)) {
397
                    $total_count = $row->total_count;
398
                }
399
                ?>
400
                <h3><?php echo number_format($total_count); ?></h3>
401
402
                <p>Pending Renewals</p>
403
            </div>
404
            <div class="icon">
405
                <i class="ion ion-clock" style="padding-top:16px;"></i>
406
            </div>
407
            <a href="<?php echo $web_root; ?>/ssl/index.php?is_active=3" class="small-box-footer">View <i
408
                    class="fa fa-arrow-circle-right"></i></a>
409
        </div>
410
    </div>
411
    <!-- ./col -->
412
413
    <!-- ./col -->
414
    <div class="col-lg-3 col-xs-6">
415
        <!-- small box -->
416
        <div class="small-box bg-yellow">
417
            <div class="inner">
418
                <?php
419
                $sql = "SELECT count(*) AS total_count
420
                        FROM ssl_certs
421
                        WHERE active = '5'";
422
                $result = mysqli_query($dbcon, $sql);
423
                while ($row = mysqli_fetch_object($result)) {
424
                    $total_count = $row->total_count;
425
                }
426
                ?>
427
                <h3><?php echo number_format($total_count); ?></h3>
428
429
                <p>Pending Registrations</p>
430
            </div>
431
            <div class="icon">
432
                <i class="ion ion-clock" style="padding-top:16px;"></i>
433
            </div>
434
            <a href="<?php echo $web_root; ?>/ssl/index.php?is_active=5" class="small-box-footer">View <i
435
                    class="fa fa-arrow-circle-right"></i></a>
436
        </div>
437
    </div>
438
    <!-- ./col -->
439
440
    <div class="col-lg-3 col-xs-6">
441
        <!-- small box -->
442
        <div class="small-box bg-green">
443
            <div class="inner">
444
                <?php
445
                $sql = "SELECT count(*) AS total_count
446
                        FROM ssl_certs
447
                        WHERE active = '4'";
448
                $result = mysqli_query($dbcon, $sql);
449
                while ($row = mysqli_fetch_object($result)) {
450
                    $total_count = $row->total_count;
451
                }
452
                ?>
453
                <h3><?php echo number_format($total_count); ?></h3>
454
455
                <p>Pending (Other)</p>
456
            </div>
457
            <div class="icon">
458
                <i class="ion ion-clock" style="padding-top:16px;"></i>
459
            </div>
460
            <a href="<?php echo $web_root; ?>/ssl/index.php?is_active=4" class="small-box-footer">View <i
461
                    class="fa fa-arrow-circle-right"></i></a>
462
        </div>
463
    </div>
464
465
</div>
466
<!-- /.row -->
467
468
<?php require_once(DIR_INC . '/layout/footer.inc.php'); ?>
469
</body>
470
</html>
471