forked from khoegenauer/tickets-cad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
3255 lines (3015 loc) · 185 KB
/
config.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
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @package config.php
* @author John Doe <[email protected]>
* @since 2008-05-28
* @version 2013-09-10
*/
/*
5/28/08 - revised map center to allow icon drag
6/4/08 - added do_log($GLOBALS['LOG_INCIDENT_DELETE']
6/4/08 - added submit()
6/4/08 - corrected table names
6/9/08 - added user type 'super'
9/13/08 - refresh upper frame
9/16/08 remove 'responder.php'
9/16/08 draggable false, pending getting it to work
9/21/08 revised 'top load' via body tag
9/24/08 permissions revised per suggestion JB
10/8/08 'User' revised to 'Operator'
10/8/08 hide 'Unit types'
10/19/08 added trim()
10/23/08 revised notify validation and for severity handling
10/23/08 profile validation added
11/30/08 table user - added md5 password conversion, skip passwd edit if blank
12/1/08 revised profile edit passwd handling
12/2/08 check for dupl userid's added
12/15/08 added member level
1/17/09 added `auto_route` setting to config.inc.php
1/21/09 show_butts, addr lookup button
1/27/09 added super-only notify execute, quote_smart added
3/3/09 correction for MEMBER user type
4/5/09 default map zoom added
5/4/09 handle usng as input
6/4/09 added Constituents and City tables
6/27/09 added function do_glat() - hidden 7/23/09
6/30/09 added do_mail_win(), renamed to do_all_mail
7/16/09 floating div for 'settings' buttons
7/24/09 hide Glat();
7/28/09 Open Glat()
7/28/09 Add function do_gtrack and function do_locatea for test scripts plus links
10/6/09 Added links to Facility Status and Facility Types settings
11/5/09 Changed window caption, per IE complaint
11/17/09 removed password update from 'edit my profile'
9/26/09 corrections to floating div, per IE
11/30/09 dump-to-screen copy function added
1/23/10 table 'session' removed, revised 'settings applied' message and avoid re-load of top frame
3/11/10 Cities table link removed
4/10/10 hide 'board' button if setting = 0
5/30/10 function do_about() added
6/22/10 audio alarm test added
6/25/10 NULL dob handling
7/5/10 super only, per KJ email
7/11/10 function $() added, corr's to type='unit'
7/16/10 settings edit limited to Super's, $asterisk PIN control added
8/8/10 bypass map operations if internet false
8/13/10 map.setUIToDefault();
8/13/10 gettext/captions table processing added
8/21/10 captions table processor link added
8/27/10 profile change now includes passwords
9/8/10 $mode handling added
10/28/10 revised user edit permissions to limit admin edits to self only
10/28/10 added config setting for add tickets module
11/11/10 incident numbering added
11/13/10 - top notice added
12/1/10 get_text patient added
12/5/10 UTM, OSGB conversion added
1/22/11 allow UC in email addr's
2/3/11 added hints processor
2/28/11 added places processor
3/15/11 added css color tables configuration capability, add base64encode/decode to incident numbering function
4/23/11 cloud admin links added
5/4/11 get_new_colors() added
5/23/11 notifies corrected, Cancel button changed to submit can_form;
5/26/11 added intrusion detection, sql insertion prevention
6/10/11 added changes required to support regional capability (user region assignment).
7/5/11 added Open GTS test
7/30/11 Map markup and categories replaces landb
9/27/11 Added Internal Tracker test
3/11/11 Added link to cleanse regions file.
12/19/11 courses table tandling, per request T Carswell
3/4/12 disbled 86-char key check
3/5/12 obtain key from ...
3/22/12 ics 213 link
4/25/12 audio window correction
6/20/12 applied get_text() to 'Unit'
10/23/12 Added Level 'Service User' for Portal, added messaging
3/29/2013 added include for GMaps V3 setcenter
5/24/2013 ics 213 link made conditional on setting
6/18/2013 added link for insurance table maint.
7/5/13 Added link to native mail test script
9/10/13 Added links for road conditions, local maps, personnel table for roster user and Warn locations
*/
$asterisk = FALSE; // user: change to TRUE in order to make the Pin Control table accessible.
if ( !defined( 'E_DEPRECATED' ) ) { define( 'E_DEPRECATED',8192 );} // 11/7/09
error_reporting (E_ALL ^ E_DEPRECATED);
session_start();
require_once './incs/functions.inc.php';
do_login(basename(__FILE__)); // session_start()
require_once './incs/config.inc.php';
require_once './incs/usng.inc.php'; // 9/16/08
// dump($_REQUEST);
$st_size = (get_variable("locale") ==0)? 2: 4;
// $istest = TRUE;
if ($istest) {
foreach ($_POST as $VarName=>$VarValue) {echo "POST:$VarName => $VarValue, <BR />";};
foreach ($_GET as $VarName=>$VarValue) {echo "GET:$VarName => $VarValue, <BR />";};
echo "<BR/>";
}
$mode = (array_key_exists('mode',$_REQUEST))? $_REQUEST['mode']: ""; // 9/8/10
$patient = get_text("Patient"); // 12/1/10
extract($_REQUEST);
if (!isset($func)) {$func = "summ";}
$reload_top = FALSE;
$query = "SELECT `user` FROM `$GLOBALS[mysql_prefix]user` WHERE `id` <> '{$_SESSION['user_id']}'"; // 12/2/08
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
$users = "";
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$users .= trim($row['user']) . "\t";
}
// function get_org_control($the_userid) {
// $sel1 = ($the_userid == 0) ? "SELECTED" : "";
// $query = "SELECT * FROM `$GLOBALS[mysql_prefix]organisations`"; // 12/2/08
// $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
// $org_cntl = "<SELECT NAME='frm_org_cntl'><OPTION value=0 " . $sel1 . ">SELECT ONE</OPTION>";
// while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
// $sel2 = ($the_userid == $row['id']) ? "SELECTED" : "";
// $org_cntl .= "<OPTION value=" . $row['id'] . " " . $sel2 . ">" . $row['name'] . "</OPTION>";
// }
// $org_cntl .= "</SELECT>";
// return $org_cntl;
// }
/**
* dump_db
* Insert description here
*
*
* @return
*
* @access
* @static
* @see
* @since
*/
function dump_db() {
require_once './incs/MySQLDump.class.php';
include './incs/mysql.inc.php';
$the_now = strtotime(mysql_format_date(time() - (get_variable('delta_mins')*60)));
$backup = new MySQLDump(); //create new instance of MySQLDump
$the_db = $mysql_prefix . $mysql_db;
$backup->connect($mysql_host,$mysql_user,$mysql_passwd,$the_db); // connect
if (!$backup->connected) { die('Error: '.$backup->mysql_error); } // MySQL parameters from mysql.inc.php
$backup->list_tables(); // list all tables
$broj = count($backup->tables); // count all tables, $backup->tables
// will be array of table names
$the_db_dump ="\n\n-- " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . gettext('start') . " " . "\n";
$the_db_dump .="\n-- " . gettext('Dumping tables for database') . ": $mysql_db\n"; //write "intro" ;)
for ($i=0;$i<$broj;$i++) { //dump all tables:
$table_name = $backup->tables[$i]; //get table name
if (($mysql_prefix == "") || (strrpos($table_name, $mysql_prefix) === 0)) {
$backup->dump_table($table_name); //dump it to output (buffer)
$the_db_dump .=htmlspecialchars($backup->output); //write output
}
}
// for ($i=0;$i<$broj;$i++) { //dump all tables:
// $table_name = $backup->tables[$i]; //get table name
// $backup->dump_table($table_name); //dump it to output (buffer)
// $the_db_dump .=htmlspecialchars($backup->output); //write output
// }
$the_db_dump .="\n\n-- " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . gettext('end') . " " . "\n";
$file = './backups/' . $the_now . '_tickets_backup.sql';
$fh = fopen($file, 'w');
if (!fwrite($fh, $the_db_dump)) {
print "<LI>DB Backup failed";
fclose($fh);
} else {
print '<LI>' . gettext('Tickets Database backup complete.') . '..</LI>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE><?php print gettext('Tickets - Configuration Module');?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" />
<META HTTP-EQUIV="Expires" CONTENT="0" />
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE" />
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript" />
<META HTTP-EQUIV="Script-date" CONTENT="<?php print date("n/j/y G:i", filemtime(basename(__FILE__)));?>" />
<LINK REL="StyleSheet" HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css" /> <!-- 3/15/11 -->
<STYLE>
LI { margin-left: 20px;}
.spl { FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000099; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none}
#bar { width: auto; height: auto; background:transparent; z-index: 100; }
* html #bar { /*\*/position: absolute; top: expression((60 + (ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)) + 'px'); right: expression((320 + (ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft)) + 'px');/**/ }
#foo > #bar { position: fixed; top: 60px; right: 320px; }
</STYLE>
<SCRIPT SRC="./js/misc_function.js"></SCRIPT> <!-- 1/25/13 JSON call-->
<SCRIPT SRC='./js/md5.js'></SCRIPT> <!-- 11/30/08 -->
<SCRIPT SRC='./js/jscoord.js'></SCRIPT> <!-- coordinate conversion 12/4/10 -->
<SCRIPT SRC="./js/jscolor/jscolor.js"></SCRIPT> <!-- 01/24/11 -->
<SCRIPT>
// for messages
/**
*
* @returns {undefined}
*/
function get_msgs() { // 10/23/12
var randomnumber=Math.floor(Math.random()*99999999);
// alert("getting messages");
// call the server to execute the server side operation
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "./ajax/get_messages.php?mode=all&version=" + randomnumber, true);
xmlHttp.onreadystatechange = handleRequestStateChange;
xmlHttp.send(null);
}
}
/**
*
* @returns {undefined}
*/
function handleRequestStateChange() { // 10/23/12
var the_resp;
var the_val;
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var response = JSON.decode(xmlHttp.responseText);
alert(xmlHttp.responseText);
for (var key in response[0]) {
the_resp = key;
the_val = response[0][key];
un_stat_chg(the_resp, the_val);
}
var the_mess = response[1][0];
var the_stored = response[1][1];
if (the_stored > 0) {
show_msg("<?php print gettext('There are " + the_stored + " new messages');?>");
}
}
}
}
/**
*
* @returns {undefined}
*/
function checkAll() { // 9/10/13
var theField = document.user_add_Form.elements["frm_group[]"];
for (i = 0; i < theField.length; i++) {
theField[i].checked = true ;
}
}
/**
*
* @returns {undefined}
*/
function uncheckAll() { // 9/10/13
var theField = document.user_add_Form.elements["frm_group[]"];
for (i = 0; i < theField.length; i++) {
theField[i].checked = false ;
}
}
/**
*
* @returns {Array}
*/
function $() { // 7/11/10
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
try {
parent.frames["upper"].document.getElementById("whom").innerHTML = "<?php print $_SESSION['user'];?>";
parent.frames["upper"].document.getElementById("level").innerHTML = "<?php print get_level_text($_SESSION['level']);?>";
parent.frames["upper"].document.getElementById("script").innerHTML = "<?php print LessExtension(basename( __FILE__));?>";
}
catch(e) {
}
<?php
if (intval(get_variable('call_board')) == 0) { // hide the button - 4/10/10
print "\t parent.frames['upper'].document.getElementById('call').style.display = 'none';";
}
?>
/**
*
* @returns {undefined}
*/
function ck_frames() {
<?php
if ($mode==1) { // 9/8/10
print "return;\n";
}
else {
?>
if (self.location.href==parent.location.href) {
self.location.href = 'index.php';
}
else {
parent.upper.show_butts(); // 1/21/09
}
<?php
}
?>
} // end function ck_frames()
/**
*
* @returns {undefined}
*/
function get_new_colors() { // 5/4/11
window.location.href = '<?php print basename(__FILE__);?>';
}
/**
*
* @param {type} val
* @returns {Boolean}
*/
function isNull(val) { // checks var stuff = null;
return val === null;
}
/**
*
* @returns {unresolved}
*/
String.prototype.trim = function () { // 10/19/08
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
/**
*
* @param {type} ary
* @param {type} val
* @returns {Boolean}
*/
function in_array(ary, val) { // 12/2/08
for (var i = 0; i<ary.length; i++) {
if (ary[i] == val) {
return true;
}
}
return false;
} // end function in array
starting=false;
/**
*
* @returns {unresolved}
*/
function do_mail_win() { // 6/13/09, 11/5/09
if (starting) {return;}
starting=true;
newwindow_am=window.open("do_all_mail.php", "E_mail", "titlebar, resizable=1, scrollbars, height=480,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=150,screenX=100,screenY=300");
if (isNull(newwindow_am)) {
alert ("<?php print gettext('This requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_am.focus();
starting = false;
}
/**
*
* @returns {unresolved}
*/
function do_audio_test() { // 8/2/08 - 11/5/09 - 4/25/12
var newwindow_au=window.open("audio.php", "Test_Audio", "titlebar, resizable=1, scrollbars, height=540,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_au.focus();
if (isNull(newwindow_au)) {
alert ("<?php print gettext('Audio test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_au.focus();
}
/**
*
* @returns {unresolved}
*/
function do_ogts() { // 8/2/08 - 11/5/09
var newwindow_t=window.open("opengts.php", "Test_OGTS", "titlebar, resizable=1, scrollbars, height=600,width=540,status=0,toolbar=0,menubar=0,location=0, left=150,top=150,screenX=150,screenY=150"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_t_tracker() { // 9/27/11
var newwindow_t=window.open("t_tracker.php", "Test_Internal_Tracker", "titlebar, resizable=1, scrollbars, height=600,width=540,status=0,toolbar=0,menubar=0,location=0, left=150,top=150,screenX=150,screenY=150"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_test() { // 8/2/08 - 11/5/09
var newwindow_t=window.open("opena.php", "Test_APRS", "titlebar, resizable=1, scrollbars, height=400,width=600,status=0,toolbar=0,menubar=0,location=0, left=150,top=150,screenX=150,screenY=150"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_smtp() { // 8/2/08 - 11/5/09
var newwindow_t=window.open("smtp_test.php", "Test_SMTP", "titlebar, resizable=1, scrollbars, height=600,width=900,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {undefined}
*/
function file_window() { // 9/10/13
var url = "file_upload.php";
var nfWindow = window.open(url, 'NewFileWindow', 'resizable=1, scrollbars, height=600, width=600, left=100,top=100,screenX=100,screenY=100');
setTimeout(function () { nfWindow.focus(); }, 1);
}
/**
*
* @returns {unresolved}
*/
function do_native() { // 8/2/08 - 11/5/09
var newwindow_t=window.open("native.php", "Test_Native_Email", "titlebar, resizable=1, scrollbars, height=600,width=900,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_instam() { // 7/26/09 - 11/5/09
var newwindow_t=window.open("test_instam.php", "Test_InstaMapper", "titlebar, resizable=1, scrollbars, height=400,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_glat() { // 7/29/09 - 11/5/09
var newwindow_t=window.open("latitude.php", "Test_Google_Latitude", "titlebar, resizable=1, scrollbars, height=400,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_locatea() { // 7/29/09 - 11/5/09
var newwindow_t=window.open("locatea.php", "Test_Locatea", "titlebar, resizable=1, scrollbars, height=400,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @returns {unresolved}
*/
function do_gtrack() { // 7/29/09 - 11/5/09
var newwindow_t=window.open("gtrack.php", "Test_Gtrack", "titlebar, resizable=1, scrollbars, height=400,width=600,status=0,toolbar=0,menubar=0,location=0, left=50,top=50,screenX=50,screenY=50"); newwindow_t.focus();
if (isNull(newwindow_t)) {
alert ("<?php print gettext('Test operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
newwindow_t.focus();
}
/**
*
* @param {type} the_table
* @returns {undefined}
*/
function do_Post(the_table) {
document.tables.tablename.value=the_table;
document.tables.submit();
}
var type; // Global variable - identifies browser family
BrowserSniffer();
/**
*
* @returns {undefined}
*/
function BrowserSniffer() { //detects the capabilities of the browser
if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP"; //Opera
else if (document.all) type="IE"; //Internet Explorer e.g. IE4 upwards
else if (document.layers) type="NN"; //Netscape Communicator 4
else if (!document.all && document.getElementById) type="MO"; //Mozila e.g. Netscape 6 upwards
else type = "IE"; //????????????
}
/**
*
* @returns {undefined}
*/
function whatBrows() { //Displays the generic browser type
window.alert("Browser is : " + type);
}
/**
*
* @param {type} id
* @param {type} action
* @returns {undefined}
*/
function ShowLayer(id, action) { // Show and hide a span/layer -- Seems to work with all versions NN4 plus other browsers
if (type=="IE") eval("document.all." + id + ".style.display='" + action + "'"); // id is the span/layer, action is either hidden or visible
if (type=="NN") eval("document." + id + ".display='" + action + "'");
if (type=="MO" || type=="OP") eval("document.getElementById('" + id + "').style.display='" + action + "'");
}
/**
*
* @param {type} elid
* @returns {undefined}
*/
function hideit(elid) {
ShowLayer(elid, "none");
}
/**
*
* @param {type} elid
* @returns {undefined}
*/
function showit(elid) {
ShowLayer(elid, "block");
}
/**
*
* @param {type} theForm
* @returns {Boolean}
*/
function validate_cen(theForm) { // Map center validation
var errmsg="";
if (theForm.frm_lat.value=="") {errmsg+="\t<?php print gettext('Map center is required.');?>\n";}
if (theForm.frm_map_caption.value=="") {errmsg+="\t<?php print gettext('Map caption is required.');?>\n";}
if (errmsg!="") {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else { // good to go!
// theForm.frm_lat.disabled = false;
// theForm.frm_lng.disabled = false;
theForm.frm_zoom.disabled = false;
return true;
}
} // end function validate cen(theForm)
var str_users = "<?php print $users;?>"; // 12/2/08
var ary_users = str_users.split("\t"); // see usage in function validate_user()
/**
*
* @param {type} theForm
* @returns {Boolean}
*/
function validate_user(theForm) { // user form contents validation
// alert("280 " + theForm.frm_responder_id.value);
if (theForm.frm_remove) {
if (theForm.frm_remove.checked) {
if (confirm("<?php print gettext('Please confirm this removal.');?>")) {return true;}
else {return false;}
}
}
var errmsg="";
if (theForm.frm_user.value=="") {errmsg+="\t<?php print gettext('UserID is required.');?>\n";}
var got_level = false;
for (i=0; i<theForm.frm_level.length; i++) {
if (theForm.frm_level[i].checked) { got_level = true; }
}
if (!got_level) {errmsg+="\t<?php print gettext('User LEVEL is required.');?>\n";}
if ((theForm.frm_func.value=="a") && (in_array(ary_users, theForm.frm_user.value.length>0))&& (in_array(ary_users, theForm.frm_user.value.trim())))
{errmsg+="\t<?php print gettext('UserID duplicates existing one.');?>\n";}
if (theForm.frm_passwd.value!=theForm.frm_passwd_confirm.value) {errmsg+="\t<?php print gettext('PASSWORD and CONFIRM fail to match.');?>\n";}
if ((theForm.frm_func.value=="a") && (theForm.frm_passwd.value=="")) {errmsg+="\t<?php print gettext('PASSWORD is required.');?>\n";} // only for ADD
if ((theForm.frm_passwd.value.trim().length>0) && (theForm.frm_passwd.value.trim().length<5))
{errmsg+="\t<?php print gettext('Passwd length 5 or more is required.');?>\n";}
if ((theForm.frm_level[<?php echo $GLOBALS['LEVEL_UNIT'];?>].checked) && (theForm.frm_responder_id.value==0))
{errmsg+="\t<?php print get_text("Units") . " " . gettext('selection is required.');?>\n";}
if (errmsg!="") {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else { // good to go!
theForm.frm_hash.value = (theForm.frm_passwd.value.trim()=="")? "": hex_md5(theForm.frm_passwd.value.trim().toLowerCase());
theForm.frm_passwd.value=""; // hide them
theForm.frm_passwd_confirm.value="";
return true;
}
} // end function validate user()
/**
*
* @param {type} in_val
* @returns {undefined}
*/
function do_set_unit(in_val) { // selected value to hidden
document.user_add_Form.frm_responder_id.value = in_val;
}
/**
*
* @param {type} theForm
* @returns {Boolean}
*/
function validate_set(theForm) { // limited form contents validation
var errmsg="";
// if (theForm.gmaps_api_key.value.length!=86) {errmsg+= "\tInvalid GMaps API key\n";} // 3/4/12
if (errmsg!="") {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else { // good to go!
return true;
}
} // end function validate set(theForm)
/**
*
* @param {type} theForm
* @returns {Boolean}
*/
function validate_css_day(theForm) { // limited form contents validation css colors day 3/15/11
var errmsg="";
if (errmsg!="") {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else {
return true;
}
} // end function validate set(theForm)
/**
*
* @param {type} theForm
* @returns {Boolean}
*/
function validate_css_night(theForm) { // limited form contents validation css night colors 3/15/11
var errmsg="";
if (errmsg!="") {
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else {
return true;
}
} // end function validate set(theForm)
/**
*
* @returns {undefined}
*/
function add_res() { // turns on add responder form
showit('res_add_form');
hideit('tbl_responders');
hideIcons(); // hides responder icons
map.setCenter(new GLatLng(<?php echo get_variable('def_lat'); ?>, <?php echo get_variable('def_lng'); ?>), <?php echo get_variable('def_zoom'); ?>);
}
/**
*
* @returns {undefined}
*/
function hideIcons() {
map.clearOverlays();
} // end function hideicons()
/**
*
* @param {type} lat
* @returns {undefined}
*/
function do_lat(lat) {
var num = new Number(lat);
document.cen_Form.frm_lat.value=num.toFixed(6); // 9/9/08
document.cen_Form.show_lat.disabled=false; // permit read/write
document.cen_Form.show_lat.value=do_lat_fmt(document.cen_Form.frm_lat.value);
document.cen_Form.show_lat.disabled=true;
}
/**
*
* @param {type} lng
* @returns {undefined}
*/
function do_lng(lng) {
var num = new Number(lng);
document.cen_Form.frm_lng.value=num.toFixed(6);
document.cen_Form.show_lng.disabled=false;
document.cen_Form.show_lng.value=do_lng_fmt(document.cen_Form.frm_lng.value);
document.cen_Form.show_lng.disabled=true;
}
/**
*
* @param {type} theForm
* @returns {undefined}
*/
function do_grids(theForm) { // 8/23/08, 12/5/10
theForm.frm_ngs.value = LLtoUSNG(theForm.frm_lat.value, theForm.frm_lng.value, 5); // USNG
do_utm (theForm);
do_osgb (theForm);
}
/**
*
* @param {type} theForm
* @returns {undefined}
*/
function do_utm(theForm) {
var ll_in = new LatLng(parseFloat(theForm.frm_lat.value), parseFloat(theForm.frm_lng.value));
var utm_out = ll_in.toUTMRef().toString();
temp_ary = utm_out.split(" ");
theForm.frm_utm.value = (temp_ary.length == 3)? temp_ary[0] + " " + parseInt(temp_ary[1]) + " " + parseInt(temp_ary[2]) : "";
}
/**
*
* @param {type} theForm
* @returns {undefined}
*/
function do_osgb(theForm) {
var ll_in = new LatLng(parseFloat(theForm.frm_lat.value), parseFloat(theForm.frm_lng.value));
var osgb_out = ll_in.toOSRef();
theForm.frm_osgb.value = osgb_out.toSixFigureString();
}
/**
*
* @param {type} zoom
* @returns {undefined}
*/
function do_zoom(zoom) {
document.cen_Form.frm_zoom.disabled=false;
document.cen_Form.frm_zoom.value=zoom;
document.cen_Form.frm_zoom.disabled=true;
}
/**
*
* @returns {undefined}
*/
function collect() { // constructs a string of id's for deletion
var str = sep = "";
for (i=0; i< document.del_Form.elements.length; i++) {
if (document.del_Form.elements[i].type == 'checkbox' && (document.del_Form.elements[i].checked==true)) {
str += (sep + document.del_Form.elements[i].name.substring(1)); // drop T
sep = ",";
}
}
document.del_Form.idstr.value=str;
document.del_Form.submit(); // 6/4/08 - added
}
/**
*
* @param {type} bool_val
* @returns {undefined}
*/
function all_ticks(bool_val) { // set checkbox = true/false
for (i=0; i< document.del_Form.elements.length; i++) {
if (document.del_Form.elements[i].type == 'checkbox') {
document.del_Form.elements[i].checked = bool_val;
}
} // end for (...)
} // end function all_ticks()
<?php
print "// file as of " . date("l, dS F, Y @ h:ia", filemtime(basename(__FILE__))) . "\n";
print "//" . date("n/j/y", filemtime(basename(__FILE__))) . "\n";
?>
starting=false;
/**
*
* @returns {unresolved}
*/
function do_about() { // 5/30/10
if (starting) {return;}
parent.upper.do_set_sess_exp(); // session expiration update
if (window.focus() && window_about) {window_about.focus();} // if window exists
starting=true;
params = 'width='+screen.width;
params += ', height='+screen.height;
params += ', top=0, left=0', scrollbars = 1;
params += ', fullscreen=no';
window_about=window.open("about.php", "About_this_version", params);
if (isNull(window_about)) {
alert ("<?php print gettext('This operation requires popups to be enabled. Please adjust your browser options.');?>");
return;
}
window_about.focus();
starting = false;
} // end function do full_scr()
/**
*
* @returns {unresolved}
*/
function do_night_color_check() { // Load color checker popup from night config screen 3/15/11
var bgc = document.css_night_Form.page_background.value;
var txt = document.css_night_Form.normal_text.value;
var rl = document.css_night_Form.row_light.value;
var rd = document.css_night_Form.row_dark.value;
var plain = document.css_night_Form.row_plain.value;
var tbt = document.css_night_Form.titlebar_text.value;
var hdgb = document.css_night_Form.row_heading_background.value;
var hdgt = document.css_night_Form.row_heading_text.value;
var spacer = document.css_night_Form.row_spacer.value;
var inpb = document.css_night_Form.form_input_background.value;
var inpt = document.css_night_Form.form_input_text.value;
var otxt = document.css_night_Form.other_text.value;
var links = document.css_night_Form.links.value;
var headings = document.css_night_Form.header_text.value;
var smb = document.css_night_Form.select_menu_background.value;
var smf = document.css_night_Form.select_menu_text.value;
var legend = document.css_night_Form.legend.value;
if (starting) {return;} // dbl-click catcher
starting=true;
var url = "do_color_checker.php?mode=day&func=main&bgc=" + escape(bgc) + "&txt=" + escape(txt) + "&rl=" + escape(rl) + "&rd=" + escape(rd) + "&plain=" + escape(plain) + "&hdgb=" + escape(hdgb) + "&hdgt=" + escape(hdgt) + "&spacer=" + escape(spacer) + "&links=" + escape(links) + "&header=" + escape(headings) + "&inpb=" + escape(inpb) + "&inpt=" + escape(inpt) + "&otxt=" + escape(otxt) + "&smb=" + escape(smb) + "&smt=" + escape(smf) + "&legend=" + escape(legend) + "&titlebar=" + escape(tbt);
newwindow_colcheck=window.open(url, "colour_checker", "titlebar, location=0, resizable=1, scrollbars, height=700px,width=1000px,status=0,toolbar=0,menubar=0,location=0, left=100,top=200,screenX=100,screenY=200");
if (isNull(newwindow_colcheck)) {
alert ("<?php print gettext('This operation requires popups to be enabled -- please adjust your browser options.');?>");
return;
}
newwindow_colcheck.focus();
starting = false;
} // end function do night color_check()
/**
*
* @returns {unresolved}
*/
function do_day_color_check() { // Load color checker popup from day config screen 3/15/11
var bgc = document.css_day_Form.page_background.value;
var txt = document.css_day_Form.normal_text.value;
var rl = document.css_day_Form.row_light.value;
var rd = document.css_day_Form.row_dark.value;
var plain = document.css_day_Form.row_plain.value;
var tbt = document.css_day_Form.titlebar_text.value;
var hdgb = document.css_day_Form.row_heading_background.value;
var hdgt = document.css_day_Form.row_heading_text.value;
var spacer = document.css_day_Form.row_spacer.value;
var inpb = document.css_day_Form.form_input_background.value;
var inpt = document.css_day_Form.form_input_text.value;
var otxt = document.css_day_Form.other_text.value;
var links = document.css_day_Form.links.value;
var headings = document.css_day_Form.header_text.value;
var smb = document.css_day_Form.select_menu_background.value;
var smf = document.css_day_Form.select_menu_text.value;
var legend = document.css_day_Form.legend.value;
if (starting) {return;} // dbl-click catcher
starting=true;
var url = "do_color_checker.php?mode=night&func=main&bgc=" + escape(bgc) + "&txt=" + escape(txt) + "&rl=" + escape(rl) + "&rd=" + escape(rd) + "&plain=" + escape(plain) + "&hdgb=" + escape(hdgb) + "&hdgt=" + escape(hdgt) + "&spacer=" + escape(spacer) + "&links=" + escape(links) + "&header=" + escape(headings) + "&inpb=" + escape(inpb) + "&inpt=" + escape(inpt) + "&otxt=" + escape(otxt) + "&smb=" + escape(smb) + "&smt=" + escape(smf) + "&legend=" + escape(legend) + "&titlebar=" + escape(tbt);
newwindow_colcheck=window.open(url, "colour_checker", "titlebar, location=0, resizable=1, scrollbars, height=700px, width=1000px,status=0,toolbar=0,menubar=0,location=0, left=100,top=200,screenX=100,screenY=200");
if (isNull(newwindow_colcheck)) {
alert ("<?php print gettext('This operation requires popups to be enabled -- please adjust your browser options.');?>");
return;
}
newwindow_colcheck.focus();
starting = false;
} // end function do daycolor_check()
</SCRIPT>
<?php
if (array_key_exists('func', ($_REQUEST))) { // 11/11/10
switch ($func) {
case 'notify':
print "</HEAD>\n<BODY onLoad = 'ck_frames();'>\n";
if (array_key_exists('id', ($_GET))) { // 0 -> all tickets notify
print "<FONT CLASS='header' STYLE = 'margin-left:80px'>" . gettext('Add Notify') . "</FONT><BR /><BR />";
if (!get_variable('allow_notify')) {print "<FONT CLASS='warn'>" . gettext('Warning: Notification is disabled by administrator') . "</FONT><BR /><BR />";}
if ($_GET['id']!=0) {
$query = "SELECT `id`, `scope` FROM `$GLOBALS[mysql_prefix]ticket` WHERE `id` = ${_GET['id']} LIMIT 1";
// dump($query);
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
$row = stripslashes_deep(mysql_fetch_assoc($result));
$the_ticket_name = $row['scope'];
unset($result);
}
else {
$the_ticket_name = "<I>" . gettext('All tickets') . "</I>";
}
// 5/22/11
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]notify`";
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
if (mysql_num_rows($result)>0) {
print "<FONT CLASS='header'>" . gettext('Current Notifies') . "<BR /><BR />";
print "<TABLE BORDER='0'>";
print "<TR CLASS='even'><TD CLASS='td_label'>" . gettext('Ticket') . "</TD><TD CLASS='td_label'> " . gettext('Email') . "</TD>";
print "<TD CLASS='td_label'> " . gettext('Execute') . "</B></TD><TD CLASS='td_label'> " . gettext('On Action') . " </TD><TD CLASS='td_label'> " . gettext('On {$patient}') . " </TD><TD CLASS='td_label'> " . gettext('On Ticket Change') . " </TD><TD CLASS='td_label'>" . gettext('Delete') . "</TD></TR>\n";
$i = 0;
while ($row = stripslashes_deep(mysql_fetch_array($result))) {
$mg_select = "<SELECT NAME='frm_mailgroup[$i]'>";
$mg_select .= "<OPTION VALUE=0>" . gettext('Select Mail List') . "</OPTION>";
$query_mg = "SELECT * FROM `$GLOBALS[mysql_prefix]mailgroup` ORDER BY `id` ASC";
$result_mg = mysql_query($query_mg) or do_error($query_mg, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
while ($row_mg = stripslashes_deep(mysql_fetch_assoc($result_mg))) {
$sel = ($row['mailgroup'] == $row_mg['id']) ? "SELECTED" : "";
$mg_select .= "\t<OPTION {$sel} VALUE='{$row_mg['id']}'>{$row_mg['name']} </OPTION>\n";
}
$mg_select .= "</SELECT>";
if ($row['ticket_id']==0) {
print "\n<TR CLASS='{$colors[$i%2]}'><TD><B>" . gettext('All') . "</B></TD>\n";
}
else {
print "\n<TR CLASS='" .$colors[$i%2] . "'><TD><A HREF='main.php?id=" . $row['ticket_id'] . "'>#" . $row['ticket_id'] . "</A></TD>\n";
}
print "<TD><INPUT MAXLENGTH=\"70\" SIZE=\"32\" VALUE=\"" . $row['email_address'] . "\" TYPE=\"text\" NAME=\"frm_email[$i]\" DISABLED /></TD>\n";
print "<TD>" . $mg_select . "</TD>\n";
print "<TD><INPUT MAXLENGTH=\"150\" SIZE=\"40\" TYPE=\"text\" VALUE=\"" . $row['execute_path'] . "\" NAME=\"frm_execute[$i]\" DISABLED /></TD>\n";
print "<TD ALIGN='center'><INPUT TYPE='checkbox' VALUE='1' NAME='frm_on_action[$i]'"; print $row['on_action'] ? " checked DISABLED /></TD>\n" : " DISABLED /></TD>\n";
print "<TD ALIGN='center'><INPUT TYPE='checkbox' VALUE='1' NAME='frm_on_patient[$i]'"; print $row['on_patient'] ? " checked DISABLED /></TD>\n" : " DISABLED /></TD>\n";
print "<TD ALIGN='center'><INPUT TYPE='checkbox' VALUE='1' NAME='frm_on_ticket[$i]'"; print $row['on_ticket'] ? " checked DISABLED/></TD>\n" : " DISABLED /></TD>\n";
print "<TD ALIGN='center'><INPUT TYPE='checkbox' VALUE='1' NAME='frm_delete[$i]' DISABLED /></TD>\n";
print "<INPUT TYPE='hidden' NAME='frm_id[$i]' VALUE='" . $row['id'] . "'/></TR>\n";
$i++;
}
print "</TABLE><BR />";
} // end if (mysql_num_rows($result)>0)
// _________________________________________
print "<SPAN STYLE = 'margin-left:80px;margin-top:40px'><FONT CLASS='header' >" . gettext('Add Notify') . "</FONT><BR /><BR /></SPAN>";
$mg_select2 = "<SELECT NAME='frm_mailgroup'>";
$mg_select2 .= "<OPTION VALUE=0>" . gettext('Select Mail List') . "</OPTION>";
$query_mg2 = "SELECT * FROM `$GLOBALS[mysql_prefix]mailgroup`"; // 12/18/10
$result_mg2 = mysql_query($query_mg2) or do_error($query_mg2, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
while ($row_mg2 = stripslashes_deep(mysql_fetch_assoc($result_mg2))) {
$mg_select2 .= "<OPTION VALUE=" . $row_mg2['id'] . ">" . $row_mg2['name'] . "</OPTION>";
}
$mg_select2 .= "</SELECT>";
?>
<TABLE BORDER="0" STYLE = 'margin-left:80px'>
<FORM METHOD="POST" NAME="notify_form" ACTION="config.php?func=notify&add=true">