This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
executable file
·837 lines (571 loc) · 22.2 KB
/
index.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
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
<?php
$actual_url = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
if (!isset($_COOKIE["referrer"])) {
setcookie("referrer", $actual_url, 0, "/");
$_COOKIE["referrer"] = $actual_url;
}
if (!isset($_COOKIE["token"])) {
$token = bin2hex(openssl_random_pseudo_bytes(16));
setcookie("token", "$token", 0, "/");
$_COOKIE["token"] = $token;
}
$token = $_COOKIE["token"];
if (!isset($_COOKIE["login"])) {
setcookie("login", "", 0, "/");
$_COOKIE["login"] = "";
}
if (isset($_GET["url"])) {
$url = urlencode($_GET["url"]);
}
if (isset($_GET["problem"])) {
if (isset($url)) {
header('Location: https://www.gvsu.edu/library/support');
} else {
header('Location: https://www.gvsu.edu/library/support');
}
}
//echo $_SERVER['HTTP_REFERER'];
//loads required config file
require 'resources/config/config.php';
//markdown is used to display the status entries for issues and the text of updates
require $markdown_path;
//functions for doing various things
require 'resources/php/functions.php';
//sets session and other variables that have to be initialized when any page of the status app is loaded
date_default_timezone_set('America/Detroit');
//if the user is trying to log out, send them to the logout script with a flag set
if (isset($_GET["logout"])) {
setcookie("login", "", 0, "/");
$_COOKIE["login"] = "";
Location ("https://prod.library.gvsu.edu/loginstatus/?>logout=true");
}
//if using native login, set the URL
if ($use_native_login == true){
$loginUrl = "login.php";
} else {
$loginUrl = $non_native_login_url;
}
//can we connect to the database? If not, display an error and cease loading the app
$db = new mysqli($db_host, $db_user, $db_pass, $db_database);
if ($db->connect_errno) {
HTML_error_message($db->connect_error);
exit;
}
$db->set_charset('utf8');
//holds system messages we want to show to the user. By default, there are none
$userMessage = NULL;
//variable to track if user is logged in
$logged_in = 0;
//uncomment to force a login
//$_COOKIE['login'] = "felkerk";
if ($_COOKIE['login'] != "") { // User has logged in
//attempt to make a user object
$user = MakeUserArray($_COOKIE['login'], '', $db);
if (is_array($user)) {
$logged_in = 1;
} else {
//set a message for the user if they couldn't be found
$userMessage = "<div class=\"alert alert-danger\">" . $user . "</div>";
}
}
// User has filled out the asana problem submission form, process and submit
if (isset($_POST["email-asana"])) {
$chck_errmsg = "";
//verify the captcha
if (isset($_POST["g-recaptcha-response"]) && $_POST["g-recaptcha-response"] != "") {
$verify = verifyRecaptcha($_POST["g-recaptcha-response"], $recaptchaSecretKey);
} else {
$verify = false;
}
if ($verify === false) {
$check_errmsg = "Captcha not correct. ";
}
//now verify the token to prevent CSRF attacks
$verify_token = false;
if (isset($_COOKIE["token"]) && isset($_POST["token"])) {
if ($_COOKIE["token"] == $_POST["token"]) {
$verify_token = true;
} else {
$check_errmsg .= "Cookie not correct. ";
}
} else {
$check_errmsg .= "Cookie not set. ";
}
//check the referrer cookie-if this was submitted from our form, it should be the url of the form.
$verify_ref = false;
if (isset($_SERVER['HTTP_REFERER'])) {
if (strpos($_SERVER['HTTP_REFERER'], 'prod.library.gvsu.edu/status') !== false) {
$verify_ref = true;
} else {
$chck_errmsg .= "Referrer not correct. ";
}
} else {
$chck_errmsg .= "Referrer not set. ";
}
$verify_honeypot = false;
if (isset($_POST["comments"])) {
if ($_POST["comments"] == "") {
$verify_honeypot = true;
} else {
$check_errmsg .= "Honeypot not empty. ";
}
} else {
$check_errmsg .= "Honeypot not set. ";
}
if ($verify === true && $verify_token === true && $verify_ref===true && $verify_honeypot === true) {
if (isset($_POST["name"])) {$name = $_POST["name"];} else {$name = "none";}
if (isset($_POST["email"])) {$email = $_POST["email"];} else {$email = "";}
$message = $_POST["feedback"];
if (isset($_POST["url"])) {
$url = $_POST["url"];
} else {
$url = "";
}
if ($use_SMTP) {
$result = send_email_SMTP($name,$email,$message, $url, $_POST["browser"], $_POST["onOffCampus"], $_POST["description"]);
} else {
$result = send_email($name,$email,$message, $url);
}
if ($result === true) {
$userMessage = '<div class="alert alert-success">Report sent! We will get on it ASAP!</div>';
} else {
$userMessage = '<div class="alert-danger">Uh-oh. There was a problem sending your report. Maybe try calling the library at ' . $library_phone . '? Error message:' . $result . ' </div>';
}
} else {
$userMessage = '<div class="alert-danger">There was a problem submitting the form. ' . $chck_errmsg .'</div>';
}
}
// post a new issue or update to the database
if (isset($_POST['submit_issue']) && $logged_in == 1) {
if (isset($_POST["public"])) {
$public = 1;
} else {
$public = 0;
}
$text = $_POST['issue_text'];
$systemid = $_POST['system_id'];
$statusid = $_POST['status_type_id'];
$userid = $_POST['userid'];
$time = $_POST['when'];
if (!isset($_POST['end_time'])) {
$end_time = '';
} else {
$end_time = $_POST['end_time'];
}
if ($time == "Now") {
$time = date("Y-m-d H:i:s");
}
//check data for problems
$verify = verifyReportFormData($time, $end_time, $statusid, $systemid, $db);
if ($verify !== true) {
$userMessage = '<div class="alert alert-danger">' . $verify . '</div>';
$verify = false;
}
if($statusid == 0 && $verify) { // Update
$created = createNewUpdate($userid, $text, $time, $systemid, $public, $db);
if ($created != 1) {
$userMessage = '<div class="alert alert-danger">' . $created . '</div>';
$submitted = false;
} else {
$userMessage = '<div class="alert alert-success">update created.</div>';
}
} else if ($statusid != 0 && $verify) {//otherwise issue
//is someone trying to report a building problem?
$building = getBuilding($_POST['system_id'], $db);
//if not, post away
if ($building === false) {
$can_post = TRUE;
} else {
//if so, then do you have access? if not, stop and give error
if ($_POST['status_type_id'] == 7 && ($user["access"] != 2 || $user["access"] != 9)) {
$can_post = false;
$userMessage = '<div class="alert alert-danger">You are not authorized to log this type of issue on this system.</div>';
} else {
//if you do, post away
$can_post = TRUE;
}
}
if ($can_post) {
$created = createNewIssue($systemid,$statusid,$time,$end_time,$userid,$text,$public,$db);
if (is_string($created)) {
$userMessage = '<div class="alert alert-danger">' . $created . '</div>';
$submitted = false;
} else {
$userMessage = '<div class="alert alert-success">issue created.</div>';
}
}
}
}
// create new status post for an existing issue
if (isset($_POST['submit_status']) && $logged_in = 1) {
$userid = $_POST['user_id'];
$issue_id = $_POST['issue_id'];
$status_text = $_POST['status'];
//is the user closing the issue? If so, try to close it, and if that doesn't work, STOP
//if it does work, or the user is not closing the issue, make the new status update
if (isset($_POST['issue_resolved'])) {
$closed = closeIssue($issue_id, $db);
if (is_string($closed)) {
$userMessage = "<div class=\"alert alert-danger\">Problem Closing this issue: " . $closed . "</div>";
} else {
$statusCreated = createNewStatus( $issue_id, $userid, $status_text, $db);
if ($statusCreated === true) {
$userMessage = '<div class="alert alert-success">Your status has been added.</div>';
} else {
$userMessage = '<div class="alert alert-danger">There was a problem adding your status. ' . $statusCreated . '</div>';
}
}
} else {
$statusCreated = createNewStatus( $issue_id, $userid, $status_text, $db);
if ($statusCreated === true) {
$userMessage = '<div class="alert alert-success">Your status has been added.</div>';
} else {
$userMessage = '<div class="alert alert-danger">There was a problem adding your status. ' . $statusCreated . '</div>';
}
}
}
//has the user chosen to look at building issues?
//if so set the $system variable so we can build the correct status table later
$system = 0;
if (isset($_GET['system'])) {
if ($_GET['system'] != 0) {
$system = $_GET['system'];
settype($system, "integer");
}
} else if (isset($_POST['system'])) {
if ($_POST['system'] != 0) {
$filter = $_POST['system'];
settype($filter, "integer");
}
}
//has the user chosen to filter the issues?
// 0 = all issues, 1 = unresolved, 2= resolved 3 = updates
$filter = 0; // all issues by default
if (isset($_GET['filter'])) {
if ($_GET['filter'] != 0) {
$filter = $_GET['filter'];
settype($filter, "integer");
}
} else if (isset($_POST['filter'])) {
if ($_POST['filter'] != 0) {
$filter = $_POST['filter'];
settype($filter, "integer");
}
}
//has the user asked to look at issues for a specific system?
if (isset($_GET['systemID'])) {
$systemID = $_GET['systemID'];
settype($systemID, "integer");
} else {
$systemID = 0;
}
if(isset($_GET['url'])) {
$problem_url = urldecode($_GET['url']);
}
//load the header HTML
include 'resources/php/header.php';
?>
<div id="cms-body-wrapper">
<div id="cms-body">
<div id="cms-body-inner">
<div id="cms-body-table">
<div id="cms-content">
<div class="row row-gutter break">
<div class="col-12 unit left">
<h2><a href="index.php"><?php echo $library_name; ?> Status</a></h2>
</div> <!-- end span -->
</div>
<div class="row row-gutter">
<div class="col-4 col-sm-12"> </div>
<!--login link-->
<div class="col-8 col-sm-12 unit right lib-horizontal-list" style="text-align: right;margin-top:.65em; overflow:visible;">
<ul>
<li style="float:right;margin-right: 8%;"><?php echo (($logged_in == 1) ? 'Hello, ' . $user["fn"] . ' // <a href="' . $loginUrl . "/index.php?logout=true" . '" title="Log out" style="text-decoration: none; font-size: .9em;">Log out</a>' : "<a href=\"$loginUrl\" title=\"Log in\" style=\"text-decoration: none; font-size: .9em;\">Log in</a>"); ?></li>
</ul>
</div>
</div> <!-- end line -->
<div class="clear"></div>
<div class="row row-gutter break" style="margin-top: 1em;">
<div class="col-12">
<?php
if ($userMessage != "") {
echo $userMessage;
}
$systemQuery = "SELECT i.issue_id FROM issue_entries i, systems s WHERE s.system_id = i.system_id AND s.building IS NULL AND i.status_type_id = 2 AND start_time < NOW() AND (i.end_time IS NULL OR i.end_time > NOW()) ";
$unResolvedIssues = $db->query($systemQuery);
if ($unResolvedIssues === false) {
$status = '<div class="alert alert-danger" style="margin: 0;"> <p>Unable to retrieve status information.</p>' . $db->error . '</div>';
} elseif ($unResolvedIssues->num_rows > 0) {
$status = '<div class="alert alert-danger" style="margin: 0;">
<p>Uh-oh, we have a system down. You can bet that we’re working on it!</p>
</div>';
} else {
$status = '<div class="alert alert-success" style="margin: 0;"> <p>All systems are online.</p></div>';
}
echo $status;
?>
</div>
</div> <!-- end line -->
<div class="row row-gutter status-bar" style="clear: both; margin: 2em 0; padding: .75em 1%; background: #eee; border: 1px solid #bbb;">
<!--select wether you want to look at systems or buildings.
0=systems, 1=building issues, 3 = both-->
<div class="col-8 col-sm-12 unit left lib-horizontal-list">
<ul>
<li><a href="index.php?system=0&filter=<?php echo $filter; ?>&systemID=<?php echo $systemID; ?>" class="status-button btn btn-default <?php echo ($system == 0 ? 'active' : ''); ?>" style="margin-top: -.5em" id="filter-recent"><?php echo ($system == 0 ? 'Showing' : 'Show'); ?> Systems</a></li>
<li><a href="index.php?system=1&filter=<?php echo $filter; ?>&systemID=<?php echo $systemID; ?>" class="status-button btn btn-default <?php echo ($system == 1 ? 'active' : ''); ?>" style="margin-top: -.5em" id="filter-unresolved"><?php echo ($system == 1 ? 'Showing' : 'Show'); ?> Buildings</a></li>
<li><a href="index.php?system=2&filter=<?php echo $filter; ?>&systemID=<?php echo $systemID; ?>" class="status-button btn btn-default <?php echo ($system == 2 ? 'active' : ''); ?>" style="margin-top: -.5em" id="filter-resolved"><?php echo ($system == 2 ? 'Showing' : 'Show'); ?> All</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div class="row row-gutter break status-table">
<div class="col-6 col-sm-12">
<!-- build the status table for systems -->
<?php
//get all the systems from the database for the tab the user has chosen
//also prepare an array of systems for the user to filter blog posts by
$systemArray = array();
if ($system == 2) {
$building = '';
} elseif ($system == 0) {
$building = ' WHERE building IS NULL';
} else {
$building = ' WHERE building IS NOT NULL';
}
$query = "SELECT * FROM systems $building ORDER BY system_name ASC";
$result = $db->query($query);
if (!$result) {
echo "There was an error accessing the database: " . $db->error;
} elseif ($result->num_rows < 1) {
echo "No systems found.";
} else {
$i = 0;
$system_count = $result->num_rows;
// Calculate where to drop in the code for a second column
$half = round($system_count/2);
// loop through each system
while($row = $result->fetch_assoc()) {
if($i == $half) {
echo '</div><div class="half">';
}
//populate the array of systems for later filtering
$systemArray[$row['system_id']] = $row["system_name"];
echo '<dl class="system">';
echo '<dt>' . $row["system_name"];
if (!is_null($row["building"])){
echo '<br>' . $row["building"];
}
echo '</dt> ';
echo '<dd class = "col2 name" style="';
$status = getSystemStatus($row['system_id'], $db);
if ($status == "Online") {
echo 'color: #147D11;">Online';
} else {
echo 'color: #cb0000;">' . $status;
}
echo '</a></dd>'; // close currently displayed
$i++;
echo '</dl>'; // close row
}
}
?>
</div>
</div> <!-- end line -->
<div class="clear"></div>
<!--
if the user is logged in, show the report form for logged in users.
Otherwise, show the form for non-logged in users (submits to Asana)
-->
<?php
if ($logged_in == 1) {
require "resources/php/report_problem_logged_in.php";
} else {
// require "resources/php/report_problem_not_logged_in.php";
}
?>
<!-- Add blog-like view of incidents -->
<div class="clear"></div>
<div class="row row-gutter status-bar">
<div class="col-8 col-sm-12 unit left">
<form action="index.php" method="get">
<input type="hidden" name="system" value="<?php echo $system; ?>">
<label for="filter"> Filter by type of post:</label>
<select name="filter">
<option value="0" <?php if ($filter == "0") {echo "selected";}?>>All Recent</option>
<option value="1" <?php if ($filter == "1") {echo "selected";}?>>Unresolved</option>
<option value="2" <?php if ($filter == "2") {echo "selected";}?>>Resolved</option>
<option value="3" <?php if ($filter == "3") {echo "selected";}?>>Updates</option>
</select>
</div>
<div class="col-4 col-sm-12 unit right">
<label for="systemID"> Filter by system:</label>
<select name="systemID">
<option value="0">All</option>
<?php
foreach ($systemArray as $id => $name) {
if ($id == $systemID) {$selected = "selected";} else {$selected = "";}
echo '<option value="' . $id . '" '. $selected .'>' . $name . '</option>';
}
?>
</select>
<input type="submit" value="Filter">
</form>
</div>
<div class="clear"></div>
</div>
<div class="row row-gutter">
<div class="col-12 unit left subscription-list" style="text-align:right;">
<p>Subscribe: <a href="<?php echo $rss_url; ?>" title="Subscribe to the RSS feed">RSS</a>
//
<a href="<?php echo $email_subscription_url; ?>" title="Subscribe to updates via Email">Email</a></p>
</div>
</div>
<div class="clear"></div>
<?php
//Get ready to retrieve issues and updates based on the system and filter criteria the user has chosen for the blog display
//for the blog display, we don't want a limit, but we are setting recent to be true, which will only bring us
//issues and updates created in the past year.
$limit = false;
//are they asking to see building or nonbuilding data?
if ($system == 0) {
$building = "NONE";
} else if ($system == 1) {
$building = "ALL";
} else {
$building = "EVERYTHING";
}
//don't show non-public issues if you aren't logged in
if ($logged_in == 1) {
$public = false;
} else {
$public = true;
}
if ($systemID == 0) {
$systemID = '';
}
//get issues and updates. Depending on the filter, we may want issues, updates, or both. This will return them as
//multidimesional arrays, sorted
//by the most recently updated (see the functions to see how this works). If both are requested, we need to do some work to
//merge and sort the resulting arrays by most recent update
if ($filter == 0 ) {
$open = "ALL";
$issues = getIssues($building, '', $systemID, $open, $public, "", $limit, true, $db);
$updates = getUpdates($building, $systemID, $public, '', $limit, true, $db);
$results = array();
//if there's an error, echo it and set the variable to be an empty array
if (is_string($issues) || is_string($updates)) {
echo "problem getting data: " . $issues;
$issues = array();
$updates = array();
} else if ($issues == false && $updates == false) {
echo '<P>No entries found. Try changing your filter options.</P>';
}
if ($issues == false) {$issues = array();}
if (is_string($issues)) {$issues = array();}
if (is_string($updates)) {$updates = array();}
if ($updates == false) {$updates = array();}
while (count($issues) != 0 || count($updates != 0)) {
//if we've run out of updates, append all the remaining issues to the array in order
if (count($updates) == 0) {
foreach ($issues as $issue){
$results[] = $issue;
}
break;
}
//ditto for issues
if (count($issues) == 0) {
foreach ($updates as $update){
$results[] = $update;
}
break;
}
//still got both? compare times, pull the more recent one and append to array
if (strtotime($issues[0]["last_updated"]) >= strtotime($updates[0]["timestamp"])) {
$results[] = array_shift($issues);
} else {
$results[] = array_shift($updates);
}
}
} else if ($filter == 1) {
$open = "OPEN";
$results = getIssues($building, '', $systemID, $open, $public, "", $limit, true, $db);
if (is_string($results)) {
echo "problem getting issues: " . $results;
$results = array();
} else if ($results === false) {
echo "<P>No entries found. Try changing your filter options.</P>";
$results = array();
}
} else if ($filter == 2) {
$open = "CLOSED";
$results = getIssues($building, '', $systemID, $open, $public, "", $limit, true, $db);
if (is_string($results)) {
echo "problem getting issues: " . $results;
$results = array();
} else if ($results === false) {
echo "<P>No entries found. Try changing your filter options.</P>";
$results = array();
}
} else if ($filter == 3) {
$results = getUpdates($building, $systemID, $public, '', $limit, true, $db);
if (is_string($results)) {
echo "problem getting updates: " . $results;
$results = array();
} else if ($results === false) {
echo "<P>No entries found. Try changing your filter options.</P>";
$results = array();
}
}
//display results if we have 'em
foreach ($results as $result) {
if ($result["type"] == "issue") {
echo '<!-- Issue --> <div class = "row row-gutter issue-box" id="'. $result["id"] . '">';
echo '<div class="col-12">';
displayIssue($result);
//now start getting the status updates for this issue. The function should sort them by date, we just have to display them
$status_ids = getStatusIDs($result["id"], $db); //this should always return something, all issues have at least one status
foreach ($status_ids as $statusid) {
$status = getStatusData($statusid, $db);
displayStatus($status, $db);
}
if ($logged_in == 1) {echo '<P><a href="detail.php?type=' . $result["type"] . '&id=' . $result["id"] . '">Edit, delete, or reopen this issue</a></P>';}
//if the user is logged in and the issue is open, display a status update form
if (strtotime($result["end_time"]) > time() || is_null($result["end_time"])) {
$resolved = false;
} else {
$resolved = true;
}
if ($logged_in == 1 && $resolved === false) {
$issueid = $result["id"];
//has the user already tried to submit this form? If so, retain the data.
if (isset($_POST["status_form"]) && $_POST['issue_id'] == $result['id']){
$text = $_POST["text"];
$when = $_POST["when"];
if (isset($_POST["resolved"])) {$resolved = true;} else {$resolved = false;}
$userid = $_POST["user_id"];
} else {
$text = '';
$when = "Now";
$resolved = false;
$userid = $user["id"];
}
echo displayNewStatusForm($issueid, $userid, $text, $resolved, $when, $system, $filter);
}
echo '</div></div>';
} else if ($result["type"] == "update") {
echo '<!-- Issue --> <div class = "row row-gutter issue-box" id="'. $result["update_id"] . '">';
echo '<div class="col-12">';
displayUpdate($result, $db);
if ($logged_in == 1 && $user["id"] == $result["user"]) {echo '<a href="detail.php?type=' . $result["type"] . '&id=' . $result["update_id"] . '">Edit or delete this update</a>';}
echo '</div></div>';
}
}
?>
</div><!-- End #cms-content -->
</div><!-- End #cms-body-table -->
</div><!-- End #cms-body-inner -->
</div><!-- end #cms-body -->
</div><!-- end #cms-body-wrapper -->
<?php include "resources/php/footer.php"; ?>
</body>
</html>