-
Notifications
You must be signed in to change notification settings - Fork 2
/
AST_timeonVDADallcounted.php
4475 lines (4112 loc) · 225 KB
/
AST_timeonVDADallcounted.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
# AST_timeonVDADall.php
#
# Copyright (C) 2022 Matt Florell <[email protected]> LICENSE: AGPLv2
#
# live real-time stats for the VICIDIAL Auto-Dialer all servers
#
# STOP=4000, SLOW=40, GO=4 seconds refresh interval
#
# CHANGELOG:
# 50406-0920 - Added Paused agents < 1 min
# 51130-1218 - Modified layout and info to show all servers in a vicidial system
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
# 60511-1343 - Added leads and drop info at the top of the screen
# 60608-1539 - Fixed CLOSER tallies for active calls
# 60619-1658 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 60626-1453 - Added display of system load to bottom (Angelito Manansala)
# 60901-1123 - Changed display elements at the top of the screen
# 60905-1342 - Fixed non INCALL|QUEUE timer column
# 61002-1642 - Added TRUNK SHORT/FILL stats
# 61101-1318 - Added SIP and IAX Listen and Barge links option
# 61101-1647 - Added Usergroup column and user name option as well as sorting
# 61102-1155 - Made display of columns more modular, added ability to hide server info
# 61215-1131 - Added answered calls and drop percent taken from answered calls
# 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns
# 70123-1151 - Added non_latin options for substr in display variables, thanks Marin Blu
# 70206-1140 - Added call-type statuses to display(A-Auto, M-Manual, I-Inbound/Closer)
# 70619-1339 - Added Status Category tally display
# 71029-1900 - Changed CLOSER-type to not require campaign_id restriction
# 80227-0418 - Added priority to waiting calls display
# 80311-1550 - Added calls_today on all agents and wait time/in-group for inbound calls
# 80422-0033 - Added phonediaplay option, allow for toggle-sorting on sortable fields
# 80422-1001 - Fixed sort by phone login
# 80424-0515 - Added non_latin lookup from system_settings
# 80525-1040 - Added IVR status display and summary for inbound calls
# 80619-2047 - Added DISPO status for post-call-work while paused
# 80704-0543 - Added DEAD status for agents INCALL with no live call
# 80822-1222 - Added option for display of customer phone number
# 81011-0335 - Fixed remote agent display bug
# 81022-1500 - Added inbound call stats display option
# 81029-1023 - Changed drop percent calculation for multi-stat reports
# 81029-1706 - Added pause code display if enabled per campaign
# 81108-2337 - Added inbound-only section
# 90105-1153 - Changed monitor links to use 0 prefix instead of 6
# 90202-0108 - Changed options to pop-out frame, added outbound_autodial_active option
# 90310-0906 - Added admin header
# 90428-0727 - Changed listen and barge to use the API and manager must enter phone
# 90508-0623 - Changed to PHP long tags
# 90518-0930 - Fixed $CALLSdisplay static assignment bug for some links(bug #210)
# 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion
# 90602-0405 - Added list mix display in statuses and order if active
# 90603-1845 - Fixed color coding bug
# 90627-0608 - Some Formatting changes, added in-group name display
# 90701-0657 - Fixed inbound=No calculation issues
# 90808-0212 - Fixed inbound only non-ALL bug, changed times to use agent last_state_change
# 90907-0915 - Added PARK status
# 90914-1154 - Added AgentOnly display column to waiting calls section
# 91102-2013 - Changed in-group color styles for incoming calls waiting
# 91204-1548 - Added ability to change agent in-groups and blended
# 100214-1127 - Added no-dialable-leads alert and in-groups stats option
# 100301-1229 - Added 3-WAY status for consultative transfer agents
# 100303-0930 - Added carrier stats display option
# 100424-0943 - Added realtime_block_user_info option
# 100709-1054 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100805-0704 - Fixed minor bug in campaigns restrictions
# 100815-0002 - Added optional display of preset dials if presets are enabled in the campaign
# 100912-0839 - Changed several stats to limit to 2 or 3 decimal spaces
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# 101024-0832 - Added Agent time stats option and agents-in-dispo counter
# 101109-1448 - Added Auto Hopper Level display (MikeC)
# 101216-1358 - Added functions to work with new realtime_report.php script
# 110218-1037 - Fixed query that was causing load spikes on systems with millions of log entries
# 110303-2125 - Added agent on-hook phone indication and RING status and color
# 110314-1735 - Fixed another query that was causing load spikes on systems with millions of log entries
# 111103-1220 - Added admin_hide_phone_data and admin_hide_lead_data options
# 120223-1934 - Added user group options
# 120612-2150 - Added percentages to counts for carrier stats and TOTAL line to carrier display stats as well
# 121222-2151 - Added email status
# 130214-1323 - Added link to in-group selected users report for in-queue inbound calls
# 130424-1357 - Fixed issue with pause codes display
# 130610-0905 - Finalized changing of all ereg instances to preg
# 130620-2303 - Added filtering of input to prevent SQL injection attacks and new user auth
# 130901-2008 - Changed to mysqli PHP functions
# 131120-1543 - Fixed small display bug when customer phone view is enabled
# 140213-1705 - Fixed division by zero bug
# 140328-0006 - Converted division calculations to use MathZDC function
# 140624-1424 - Added droppedOFtotal options.php option
# 140918-1614 - Added QXZ function formatting of output
# 141128-0857 - Code cleanup for QXZ functions
# 141230-0030 - Added code for on-the-fly language translations display
# 150211-2342 - Added hopper link, issue #825
# 150307-0825 - small cosmetic fix
# 150804-0956 - Added WHISPER option agent monitoring
# 150919-0238 - Added display for chats in queue
# 150925-2223 - Added User option to hide users from real-time report
# 160104-1059 - Added detection of dead chat sessions
# 160227-1031 - Added INGROUPcolorOVERRIDE option
# 160327-1259 - Added report_display_type option and several design changes
# 160331-1947 - Fix for non-pausecode display in HTML format
# 160406-1858 - Added WALL options for report_display_type
# 160413-2004 - Added WALL_4 option
# 160418-2141 - Fixed issue with WALL displays
# 160515-1300 - Added UK OFCOM feature
# 160803-1901 - Fixed issue with ERROR in campaign/ingroup name
# 170321-1145 - Added pause code time limits colors
# 170409-1556 - Added IP List validation code
# 170615-0023 - Added DIAL status for manual dial agent calls that have not been answered
# 180204-1538 - Added display of LIVE Inbound Callback Queue Calls
# 190206-1616 - Added mobile device display variable
# 190313-0607 - Fix for columns display issue #1141
# 190420-1728 - Added RS_ListenBarge options.php setting
# 190513-1711 - Added ingroup filter
# 190525-2133 - Added new agent time segment display
# 190531-1454 - Upgraded ingroup filter
# 190927-1759 - Fixed PHP7 array issue
# 191113-2027 - Fixed cached carrier stats bug
# 200401-1930 - Added option to show more customer info for level 9 users and customize the color chart times
# 200428-1337 - Added RS_INcolumnsHIDE, RS_report_default_format & RS_AGENTstatusTALLY options.php settings
# 200506-1642 - Added RS_CUSTINFOminUL options.php setting
# 200815-0930 - Added agent-paused 10 & 15 minute indicators
# 201107-2253 - Added display of parked calls, inbound SLA stats and LIMITED report type
# 210314-2040 - Added optional DID Description display for inbound calls
# 210615-2241 - Fix for issue #1314
# 210618-1011 - Added CORS support
# 210625-1432 - Added options.php RS_BargeSwap variable
# 220217-2045 - Added input variable filters
# 220221-1535 - Added allow_web_debug system setting
#
$version = '2.14-112';
$build = '220221-1536';
$php_script='AST_timeonVDADallcounted.php';
require("dbconnect_mysqli.php");
require("functions.php");
### CUSTOMIZE TIMES FOR REALTIME DISPLAY ###
$rt_report_times["waiting_short_time"]=30;
$rt_report_times["waiting_medium_time"]=60;
$rt_report_times["waiting_long_time"]=300;
$rt_report_times["incall_short_time"]=10;
$rt_report_times["incall_medium_time"]=60;
$rt_report_times["incall_long_time"]=300;
$rt_report_times["paused_short_time"]=10;
$rt_report_times["paused_medium_time"]=60;
$rt_report_times["paused_long_time"]=300;
$rt_report_times["paused_long_time10"]=600;
$rt_report_times["paused_long_time15"]=900;
$rt_report_times["threeway_short_time"]=10;
$rt_report_times["dead_short_time"]=10;
$rt_report_times["pause_limit"]=999999;
$container_stmt="select container_entry from vicidial_settings_containers where container_id='REALTIME_REPORT_TIMES'";
$container_rslt=mysql_to_mysqli($container_stmt, $link);
while ($crow=mysqli_fetch_row($container_rslt))
{
$realtime_times=$crow[0];
$rt_times=explode("\n", $realtime_times);
for ($q=0; $q<count($rt_times); $q++)
{
$rt_array=explode("=>", $rt_times[$q]);
$var_name=trim($rt_array[0]);
$var_value=preg_replace('/[^0-9]/', '', trim($rt_array[1]));
$rt_report_times["$var_name"]=$var_value;
}
}
###### END CUSTOM REALTIMES SECTION ########
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
$PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF);
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["RR"])) {$RR=$_GET["RR"];}
elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];}
if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];}
elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["groups"])) {$groups=$_GET["groups"];}
elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];}
if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];}
elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];}
elseif (isset($_POST["adastats"])) {$adastats=$_POST["adastats"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
if (isset($_GET["SIPmonitorLINK"])) {$SIPmonitorLINK=$_GET["SIPmonitorLINK"];}
elseif (isset($_POST["SIPmonitorLINK"])) {$SIPmonitorLINK=$_POST["SIPmonitorLINK"];}
if (isset($_GET["IAXmonitorLINK"])) {$IAXmonitorLINK=$_GET["IAXmonitorLINK"];}
elseif (isset($_POST["IAXmonitorLINK"])) {$IAXmonitorLINK=$_POST["IAXmonitorLINK"];}
if (isset($_GET["UGdisplay"])) {$UGdisplay=$_GET["UGdisplay"];}
elseif (isset($_POST["UGdisplay"])) {$UGdisplay=$_POST["UGdisplay"];}
if (isset($_GET["UidORname"])) {$UidORname=$_GET["UidORname"];}
elseif (isset($_POST["UidORname"])) {$UidORname=$_POST["UidORname"];}
if (isset($_GET["orderby"])) {$orderby=$_GET["orderby"];}
elseif (isset($_POST["orderby"])) {$orderby=$_POST["orderby"];}
if (isset($_GET["SERVdisplay"])) {$SERVdisplay=$_GET["SERVdisplay"];}
elseif (isset($_POST["SERVdisplay"])) {$SERVdisplay=$_POST["SERVdisplay"];}
if (isset($_GET["CALLSdisplay"])) {$CALLSdisplay=$_GET["CALLSdisplay"];}
elseif (isset($_POST["CALLSdisplay"])) {$CALLSdisplay=$_POST["CALLSdisplay"];}
if (isset($_GET["PHONEdisplay"])) {$PHONEdisplay=$_GET["PHONEdisplay"];}
elseif (isset($_POST["PHONEdisplay"])) {$PHONEdisplay=$_POST["PHONEdisplay"];}
if (isset($_GET["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_GET["CUSTPHONEdisplay"];}
elseif (isset($_POST["CUSTPHONEdisplay"])) {$CUSTPHONEdisplay=$_POST["CUSTPHONEdisplay"];}
if (isset($_GET["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_GET["CUSTINFOdisplay"];}
elseif (isset($_POST["CUSTINFOdisplay"])) {$CUSTINFOdisplay=$_POST["CUSTINFOdisplay"];}
if (isset($_GET["NOLEADSalert"])) {$NOLEADSalert=$_GET["NOLEADSalert"];}
elseif (isset($_POST["NOLEADSalert"])) {$NOLEADSalert=$_POST["NOLEADSalert"];}
if (isset($_GET["DROPINGROUPstats"])) {$DROPINGROUPstats=$_GET["DROPINGROUPstats"];}
elseif (isset($_POST["DROPINGROUPstats"])) {$DROPINGROUPstats=$_POST["DROPINGROUPstats"];}
if (isset($_GET["ALLINGROUPstats"])) {$ALLINGROUPstats=$_GET["ALLINGROUPstats"];}
elseif (isset($_POST["ALLINGROUPstats"])) {$ALLINGROUPstats=$_POST["ALLINGROUPstats"];}
if (isset($_GET["with_inbound"])) {$with_inbound=$_GET["with_inbound"];}
elseif (isset($_POST["with_inbound"])) {$with_inbound=$_POST["with_inbound"];}
if (isset($_GET["monitor_active"])) {$monitor_active=$_GET["monitor_active"];}
elseif (isset($_POST["monitor_active"])) {$monitor_active=$_POST["monitor_active"];}
if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];}
elseif (isset($_POST["monitor_phone"])) {$monitor_phone=$_POST["monitor_phone"];}
if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];}
elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];}
if (isset($_GET["PRESETstats"])) {$PRESETstats=$_GET["PRESETstats"];}
elseif (isset($_POST["PRESETstats"])) {$PRESETstats=$_POST["PRESETstats"];}
if (isset($_GET["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_GET["AGENTtimeSTATS"];}
elseif (isset($_POST["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_POST["AGENTtimeSTATS"];}
if (isset($_GET["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_GET["INGROUPcolorOVERRIDE"];}
elseif (isset($_POST["INGROUPcolorOVERRIDE"])) {$INGROUPcolorOVERRIDE=$_POST["INGROUPcolorOVERRIDE"];}
if (isset($_GET["RTajax"])) {$RTajax=$_GET["RTajax"];}
elseif (isset($_POST["RTajax"])) {$RTajax=$_POST["RTajax"];}
if (isset($_GET["RTuser"])) {$RTuser=$_GET["RTuser"];}
elseif (isset($_POST["RTuser"])) {$RTuser=$_POST["RTuser"];}
if (isset($_GET["RTpass"])) {$RTpass=$_GET["RTpass"];}
elseif (isset($_POST["RTpass"])) {$RTpass=$_POST["RTpass"];}
if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];}
elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];}
if (isset($_GET["ingroup_filter"])) {$ingroup_filter=$_GET["ingroup_filter"];}
elseif (isset($_POST["ingroup_filter"])) {$ingroup_filter=$_POST["ingroup_filter"];}
if (isset($_GET["droppedOFtotal"])) {$droppedOFtotal=$_GET["droppedOFtotal"];}
elseif (isset($_POST["droppedOFtotal"])) {$droppedOFtotal=$_POST["droppedOFtotal"];}
if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];}
elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];}
if (isset($_GET["mobile_device"])) {$mobile_device=$_GET["mobile_device"];}
elseif (isset($_POST["mobile_device"])) {$mobile_device=$_POST["mobile_device"];}
if (isset($_GET["parkSTATS"])) {$parkSTATS=$_GET["parkSTATS"];}
elseif (isset($_POST["parkSTATS"])) {$parkSTATS=$_POST["parkSTATS"];}
if (isset($_GET["SLAinSTATS"])) {$SLAinSTATS=$_GET["SLAinSTATS"];}
elseif (isset($_POST["SLAinSTATS"])) {$SLAinSTATS=$_POST["SLAinSTATS"];}
if (isset($_GET["GOSTATUS"])) {$GOSTATUS=$_GET["GOSTATUS"];}
elseif (isset($_POST["GOSTATUS"])) {$GOSTATUS=$_POST["GOSTATUS"];}
$DB=preg_replace("/[^0-9a-zA-Z]/","",$DB);
# defaults
$RS_BargeSwap=0;
if (file_exists('options.php'))
{
require('options.php');
}
header ("Content-type: text/html; charset=utf-8");
$report_name = 'Real-Time Main Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,allow_chats,cache_carrier_stats_realtime,report_default_format,ofcom_uk_drop_calc,enable_pause_code_limits,timeclock_end_of_day,allow_web_debug FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
#if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$SSenable_languages = $row[4];
$SSlanguage_method = $row[5];
$agent_whisper_enabled = $row[6];
$allow_chats = $row[7];
$cache_carrier_stats_realtime = $row[8];
$SSreport_default_format = $row[9];
$SSofcom_uk_drop_calc = $row[10];
$SSenable_pause_code_limits = $row[11];
$SStimeclock_end_of_day = $row[12];
$SSallow_web_debug = $row[13];
}
if ($SSallow_web_debug < 1) {$DB=0;}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysqli_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect_mysqli.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$RS_ListenBarge = 'MONITOR|BARGE|WHISPER';
$RS_agentWAIT = 3;
$RS_INcolumnsHIDE = 0;
$RS_DIDdesc = 0;
if (strlen($RS_report_default_format) > 3) {$SSreport_default_format = $RS_report_default_format;}
if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;}
if (!isset($DB)) {$DB=0;}
if (!isset($RR)) {$RR=40;}
if (!isset($group)) {$group='ALL-ACTIVE';}
if (!isset($groups)) {$groups=array();}
if (!isset($user_group_filter)) {$user_group_filter=array();}
if (!isset($ingroup_filter)) {$ingroup_filter=array();}
if (!isset($usergroup)) {$usergroup='';}
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
if (!isset($UidORname)) {$UidORname=1;} # 0=id, 1=name
if (!isset($orderby)) {$orderby='timeup';}
if (!isset($SERVdisplay)) {$SERVdisplay=0;} # 0=no, 1=yes
if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes
if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes
if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes
if (!isset($CUSTINFOdisplay)) {$CUSTINFOdisplay=0;} # 0=no, 1=yes
if ($CUSTINFOdisplay==1) {$CUSTPHONEdisplay=0;} # only one of these should be on at one time
if ($CUSTPHONEdisplay==1) {$CUSTINFOdisplay=0;} # only one of these should be on at one time
if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes
if (!isset($with_inbound))
{
if ($outbound_autodial_active > 0)
{$with_inbound='Y';} # N=no, Y=yes, O=only
else
{$with_inbound='O';} # N=no, Y=yes, O=only
}
$ingroup_detail='';
if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group; $RR=40;}
else {$group = $groups[0];}
function get_server_load($windows = false)
{
$os = strtolower(PHP_OS);
if(strpos($os, "win") === false)
{
if(file_exists("/proc/loadavg"))
{
$load = file_get_contents("/proc/loadavg");
$load = explode(' ', $load);
return $load[0] . ' ' . $load[1] . ' ' . $load[2];
}
elseif(function_exists("shell_exec"))
{
$load = explode(' ', `uptime`);
return $load[count($load)-3] . ' ' . $load[count($load)-2] . ' ' . $load[count($load)-1];
}
else
{
return false;
}
}
elseif($windows)
{
if(class_exists("COM"))
{
$wmi = new COM("WinMgmts:\\\\.");
$cpus = $wmi->InstancesOf("Win32_Processor");
$cpuload = 0;
$i = 0;
while ($cpu = $cpus->Next())
{
$cpuload += $cpu->LoadPercentage;
$i++;
}
$cpuload = round(MathZDC($cpuload, $i), 2);
return "$cpuload%";
}
else
{
return false;
}
}
}
$load_ave = get_server_load(true);
$NOW_TIME = date("Y-m-d H:i:s");
$NOW_DAY = date("Y-m-d");
$NOW_HOUR = date("H:i:s");
$STARTtime = date("U");
$epochONEminuteAGO = ($STARTtime - 60);
$timeONEminuteAGO = date("Y-m-d H:i:s",$epochONEminuteAGO);
$epochFIVEminutesAGO = ($STARTtime - 300);
$timeFIVEminutesAGO = date("Y-m-d H:i:s",$epochFIVEminutesAGO);
$epochFIFTEENminutesAGO = ($STARTtime - 900);
$timeFIFTEENminutesAGO = date("Y-m-d H:i:s",$epochFIFTEENminutesAGO);
$epochONEhourAGO = ($STARTtime - 3600);
$timeONEhourAGO = date("Y-m-d H:i:s",$epochONEhourAGO);
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$epochTWENTYFOURhoursAGO = ($STARTtime - 86400);
$timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
if ($non_latin < 1)
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW);
}
else
{
$PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER);
$PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW);
}
$RR = preg_replace('/[^0-9]/', '', $RR);
$inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $inbound);
$group = preg_replace('/[^-_0-9a-zA-Z]/', '', $group);
$groups[0] = preg_replace('/[^-_0-9a-zA-Z]/', '', $groups[0]);
$usergroup = preg_replace('/[^-_0-9a-zA-Z]/', '', $usergroup);
$DB = preg_replace('/[^0-9]/', '', $DB);
$adastats = preg_replace('/[^-_0-9a-zA-Z]/', '', $adastats);
$SIPmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $SIPmonitorLINK);
$IAXmonitorLINK = preg_replace('/[^-_0-9a-zA-Z]/', '', $IAXmonitorLINK);
$UGdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $UGdisplay);
$UidORname = preg_replace('/[^-_0-9a-zA-Z]/', '', $UidORname);
$orderby = preg_replace('/[^-_0-9a-zA-Z]/', '', $orderby);
$SERVdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $SERVdisplay);
$CALLSdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CALLSdisplay);
$PHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHONEdisplay);
$CUSTPHONEdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTPHONEdisplay);
$CUSTINFOdisplay = preg_replace('/[^-_0-9a-zA-Z]/', '', $CUSTINFOdisplay);
if ($CUSTINFOdisplay==1) {$CUSTPHONEdisplay=0;} # only one of these should be on at one time
if ($CUSTPHONEdisplay==1) {$CUSTINFOdisplay=0;} # only one of these should be on at one time
$NOLEADSalert = preg_replace('/[^-_0-9a-zA-Z]/', '', $NOLEADSalert);
$DROPINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $DROPINGROUPstats);
$ALLINGROUPstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $ALLINGROUPstats);
$with_inbound = preg_replace('/[^-_0-9a-zA-Z]/', '', $with_inbound);
$monitor_active = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_active);
$monitor_phone = preg_replace('/[^-_0-9a-zA-Z]/', '', $monitor_phone);
$CARRIERstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $CARRIERstats);
$PRESETstats = preg_replace('/[^-_0-9a-zA-Z]/', '', $PRESETstats);
$AGENTtimeSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $AGENTtimeSTATS);
$parkSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $parkSTATS);
$SLAinSTATS = preg_replace('/[^-_0-9a-zA-Z]/', '', $SLAinSTATS);
$INGROUPcolorOVERRIDE = preg_replace('/[^-_0-9a-zA-Z]/', '', $INGROUPcolorOVERRIDE);
$droppedOFtotal = preg_replace('/[^-_0-9a-zA-Z]/', '', $droppedOFtotal);
$report_display_type = preg_replace('/[^-_0-9a-zA-Z]/', '', $report_display_type);
$mobile_device = preg_replace('/[^-_0-9a-zA-Z]/', '', $mobile_device);
$RTajax = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTajax);
$RTpass = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTpass);
$RTuser = preg_replace('/[^-_0-9a-zA-Z]/', '', $RTuser);
$server_ip = preg_replace('/[^-\._0-9a-zA-Z]/', '', $server_ip);
$SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT);
$submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit);
$GOSTATUS = preg_replace('/[^-_0-9a-zA-Z]/', '', $GOSTATUS);
# Variables filtered further down in the code
# $user_group_filter
# $ingroup_filter
$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$sl_ct = mysqli_num_rows($rslt);
if ($sl_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VUselected_language = $row[0];
}
$auth=0;
$reports_auth=0;
$admin_auth=0;
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',0,0);
if ( ($auth_message == 'GOOD') or ($auth_message == '2FA') )
{
$auth=1;
if ($auth_message == '2FA')
{
header ("Content-type: text/html; charset=utf-8");
echo _QXZ("Your session is expired").". <a href=\"admin.php\">"._QXZ("Click here to log in")."</a>.\n";
exit;
}
}
if ($auth > 0)
{
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$admin_auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$reports_auth=$row[0];
if ($reports_auth < 1)
{
$VDdisplayMESSAGE = _QXZ("You are not allowed to view reports");
Header ("Content-type: text/html; charset=utf-8");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
exit;
}
if ( ($reports_auth > 0) and ($admin_auth < 1) )
{
$ADD=999999;
$reports_only_user=1;
}
}
else
{
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
if ($auth_message == 'LOCK')
{
$VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
Header ("Content-type: text/html; charset=utf-8");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
exit;
}
if ($auth_message == 'IPBLOCK')
{
$VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip";
Header ("Content-type: text/html; charset=utf-8");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
exit;
}
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
Header("HTTP/1.0 401 Unauthorized");
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
exit;
}
$stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level from vicidial_users where user='$PHP_AUTH_USER';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGfull_name =$row[3];
$LOGuser_level =$row[4];
$LOGuser_group =$row[5];
$LOGdelete_users =$row[8];
$LOGdelete_user_groups =$row[9];
$LOGdelete_lists =$row[10];
$LOGdelete_campaigns =$row[11];
$LOGdelete_ingroups =$row[12];
$LOGdelete_remote_agents =$row[13];
$LOGload_leads =$row[14];
$LOGcampaign_detail =$row[15];
$LOGast_admin_access =$row[16];
$LOGast_delete_phones =$row[17];
$LOGdelete_scripts =$row[18];
$LOGdelete_filters =$row[29];
$LOGalter_agent_interface =$row[30];
$LOGdelete_call_times =$row[32];
$LOGmodify_call_times =$row[33];
$LOGmodify_users =$row[34];
$LOGmodify_campaigns =$row[35];
$LOGmodify_lists =$row[36];
$LOGmodify_scripts =$row[37];
$LOGmodify_filters =$row[38];
$LOGmodify_ingroups =$row[39];
$LOGmodify_usergroups =$row[40];
$LOGmodify_remoteagents =$row[41];
$LOGmodify_servers =$row[42];
$LOGview_reports =$row[43];
$LOGmodify_dids =$row[56];
$LOGdelete_dids =$row[57];
$LOGmanager_shift_enforcement_override=$row[61];
$LOGexport_reports =$row[64];
$LOGdelete_from_dnc =$row[65];
$LOGcallcard_admin =$row[70];
$LOGforce_change_password =$row[71];
$LOGmodify_shifts =$row[72];
$LOGmodify_phones =$row[73];
$LOGmodify_carriers =$row[74];
$LOGmodify_labels =$row[75];
$LOGmodify_statuses =$row[76];
$LOGmodify_voicemail =$row[77];
$LOGmodify_audiostore =$row[78];
$LOGmodify_moh =$row[79];
$LOGmodify_tts =$row[80];
$LOGmodify_contacts =$row[81];
$LOGmodify_same_user_level =$row[82];
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
$LOGadmin_viewable_groups = $row[2];
$LOGadmin_viewable_call_times = $row[3];
$LOGadmin_viewable_groupsSQL='';
$valLOGadmin_viewable_groupsSQL='';
$vmLOGadmin_viewable_groupsSQL='';
if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) )
{
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
}
else
{$admin_viewable_groupsALL=1;}
# and (preg_match("/MONITOR|BARGE|HIJACK|WHISPER/",$monitor_active) ) )
if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) )
{
$stmt="SELECT phone_login from vicidial_users where user='$PHP_AUTH_USER';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysqli_fetch_row($rslt);
$monitor_phone = $row[0];
}
$stmt="SELECT realtime_block_user_info,user_group,admin_hide_lead_data,admin_hide_phone_data from vicidial_users where user='$PHP_AUTH_USER';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$realtime_block_user_info = $row[0];
$LOGuser_group = $row[1];
$LOGadmin_hide_lead_data = $row[2];
$LOGadmin_hide_phone_data = $row[3];
$stmt="SELECT allowed_campaigns,allowed_reports,allowed_custom_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = "$row[1]|$row[2]";
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
Header("HTTP/1.0 401 Unauthorized");
echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|"._QXZ("$report_name")."|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!preg_match("/ALL-/",$LOGallowed_campaigns)) )
{
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
$regexLOGallowed_campaigns = " $LOGallowed_campaigns ";
$allactivecampaigns='';
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysqli_num_rows($rslt);
$i=0;
$LISTgroups=array();
$LISTnames=array();
$LISTgroups[$i]='ALL-ACTIVE';
$i++;
$groups_to_print++;
while ($i < $groups_to_print)
{
$row=mysqli_fetch_row($rslt);
$LISTgroups[$i] =$row[0];
$LISTnames[$i] =$row[1];
$allactivecampaigns .= "'$LISTgroups[$i]',";
$i++;
}
$allactivecampaigns .= "''";
$i=0;
$group_string='|';
$group_ct = count($groups);
while($i < $group_ct)
{
$groups[$i] = preg_replace("/'|\"|\\\\|;/","",$groups[$i]);
if ( (preg_match("/ $groups[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) )
{
$group_string .= "$groups[$i]|";
$group_SQL .= "'$groups[$i]',";
$groupQS .= "&groups[]=$groups[$i]";
}
$i++;
}
$group_SQL = preg_replace('/,$/i', '',$group_SQL);
$i=0;
$user_group_string='|';
$user_group_ct = count($user_group_filter);
while($i < $user_group_ct)
{
$user_group_filter[$i] = preg_replace("/'|\"|\\\\|;/","",$user_group_filter[$i]);
# if ( (preg_match("/ $user_group_filter[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) )
# {
$user_group_string .= "$user_group_filter[$i]|";
$user_group_SQL .= "'$user_group_filter[$i]',";
$usergroupQS .= "&user_group_filter[]=$user_group_filter[$i]";
# }
$i++;
}
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
$i=0;
$ingroup_string='|';
$ingroup_ct = count($ingroup_filter);
while($i < $ingroup_ct)
{
$ingroup_filter[$i] = preg_replace('/[^-_0-9a-zA-Z]/', '', $ingroup_filter[$i]);
$ingroup_string .= "$ingroup_filter[$i]|";
$ingroup_SQL .= "'$ingroup_filter[$i]',";
$ingroupQS .= "&ingroup_filter[]=$ingroup_filter[$i]";
$i++;
}
$ingroup_SQL = preg_replace('/,$/i', '',$ingroup_SQL);
#if ($DB > 0) {echo "INBOUND INPUT DEBUG: |$ingroup_ct|$ingroup_string|\n";}
### if no campaigns selected, display all
if ( ($group_ct < 1) or (strlen($group_string) < 2) )
{
$groups[0] = 'ALL-ACTIVE';
$group_string = '|ALL-ACTIVE|';
$group = 'ALL-ACTIVE';
$groupQS .= "&groups[]=ALL-ACTIVE";
}
### if no user groups selected, display all
if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) )
{
$user_group_filter[0] = 'ALL-GROUPS';
$user_group_string = '|ALL-GROUPS|';
$usergroupQS .= "&user_group_filter[]=ALL-GROUPS";
}
### if no ingroups selected, display all
$ingroup_none=0;
if ( ($ingroup_ct < 1) or (strlen($ingroup_string) < 2) )
{
$ingroup_filter[0] = 'ALL-INGROUPS';
$ingroup_string = '|ALL-INGROUPS|';
$ingroupQS .= "&ingroup_filter[]=ALL-INGROUPS";
$ingroup_none=1;
}
if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) )
{
$all_active = 0;
$group_SQL = "''";
$group_SQLand = "and FALSE";
$group_SQLwhere = "where FALSE";
}
elseif ( preg_match('/ALL\-ACTIVE/i',$group_string) )
{
$all_active = 1;
$group_SQL = $allactivecampaigns;
$group_SQLand = "and campaign_id IN($allactivecampaigns)";
$group_SQLwhere = "where campaign_id IN($allactivecampaigns)";
}
else
{
$all_active = 0;
$group_SQLand = "and campaign_id IN($group_SQL)";
$group_SQLwhere = "where campaign_id IN($group_SQL)";
}
### USER GROUP STUFF
if ( (preg_match('/\s\-\-NONE\-\-\s/',$user_group_string) ) or ($user_group_ct < 1) )
{
$all_active_groups = 0;
$user_group_SQL = "''";
# $user_group_SQLand = "and FALSE";
# $user_group_SQLwhere = "where FALSE";
}
elseif ( preg_match('/ALL\-GROUPS/i',$user_group_string) )
{
$all_active_groups = 1;
# $user_group_SQL = '';
$user_group_SQL = "'$rawLOGadmin_viewable_groupsSQL'";
# $group_SQLand = "and campaign_id IN($allactivecampaigns)";
# $group_SQLwhere = "where campaign_id IN($allactivecampaigns)";
}
else
{
$all_active_groups = 0;
# $user_group_SQLand = "and user_group IN($user_group_SQL)";
# $user_group_SQLwhere = "where user_group IN($user_group_SQL)";
}
if ( (preg_match('/\s\-\-NONE\-\-\s/',$ingroup_string) ) or ($ingroup_ct < 1) )
{
$all_active_ingroups = 0;
$ingroup_SQL = "''";
}
elseif ( preg_match('/ALL\-INGROUPS/i',$ingroup_string) )
{
$all_active_ingroups = 1;
$ingroup_SQL = "'$rawLOGadmin_viewable_groupsSQL'";
$ingroup_SQLand = "and campaign_id IN($rawLOGadmin_viewable_groupsSQL)";
$ingroup_SQLwhere = "where campaign_id IN($rawLOGadmin_viewable_groupsSQL)";
}
else
{
$all_active_ingroups = 0;
}
$stmt="SELECT user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
$rslt=mysql_to_mysqli($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
$usergroups_to_print = mysqli_num_rows($rslt);
$i=0;
$usergroups=array();
$usergroupnames=array();
$usergroups[$i]='ALL-GROUPS';
$usergroupnames[$i] = 'All user groups';
$i++;
$usergroups_to_print++;
while ($i < $usergroups_to_print)
{
$row=mysqli_fetch_row($rslt);
$usergroups[$i] =$row[0];
$i++;
}
$stmt="select group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$MAIN.="$stmt\n";}
$ingroups_to_print = mysqli_num_rows($rslt);
$i=0;
$LISTingroups=array();
$LISTingroup_names=array();
$LISTingroups[$i]='ALL-INGROUPS';
$i++;
$ingroups_to_print++;
$ingroups_string='|';
while ($i < $ingroups_to_print)
{
$row=mysqli_fetch_row($rslt);
$LISTingroups[$i] = $row[0];
$LISTingroup_names[$i] = $row[1];
$ingroups_string .= "$LISTingroups[$i]|";
$i++;
}
if (!isset($RR)) {$RR=4;}
if (isset($RS_CUSTINFOminUL))
{
$CUSTINFOminUL = $RS_CUSTINFOminUL;
}
else {$CUSTINFOminUL = 9;}
if ($LOGuser_level < $CUSTINFOminUL) {$CUSTINFOdisplay=0;}
require("screen_colors.php");
$NFB = '<b><font size=6 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
$select_list = "<TABLE class=\"realtime_settings_table\" CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD VALIGN=TOP>"._QXZ("Select Campaigns").": <BR>";
$select_list .= "<SELECT SIZE=15 NAME=groups[] multiple>";
$o=0;
while ($groups_to_print > $o)
{
if (preg_match("/\|$LISTgroups[$o]\|/",$group_string))
{$select_list .= "<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
else
{$select_list .= "<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTnames[$o]</option>";}
$o++;
}
$select_list .= "</SELECT>";
$select_list .= "<BR><font class=\"top_settings_val\">"._QXZ("(To select more than 1 campaign, hold down the Ctrl key and click)")."<font>";
$select_list .= "<BR><BR>"._QXZ("Select User Groups").": <BR>";
$select_list .= "<SELECT SIZE=8 NAME=user_group_filter[] ID=user_group_filter[] multiple>";
$o=0;
while ($o < $usergroups_to_print)
{
if (preg_match("/\|$usergroups[$o]\|/",$user_group_filter_string))
{$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o] - $usergroupnames[$o]</option>";}
else
{$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o] - $usergroupnames[$o]</option>";}
$o++;
}
$select_list .= "</SELECT>";
$select_list .= "<BR><BR>"._QXZ("Select In-Groups").": <BR>";
$select_list .= "<SELECT SIZE=8 NAME=ingroup_filter[] ID=ingroup_filter[] multiple>";
$o=0;
while ($o < $ingroups_to_print)
{
if (preg_match("/\|$LISTingroups[$o]\|/",$ingroup_string))
{$select_list .= "<option selected value='$LISTingroups[$o]'>$LISTingroups[$o] - $LISTingroup_names[$o]</option>";}
else
{
if ( ($in_group_none > 0) and ($LISTingroups[$o] == 'ALL-INGROUPS') )
{$select_list .= "<option selected value='$LISTingroups[$o]'>$LISTingroups[$o] - $LISTingroup_names[$o]</option>";}
else
{$select_list .= "<option value='$LISTingroups[$o]'>$LISTingroups[$o] - $LISTingroup_names[$o]</option>";}
}
$o++;
}
$select_list .= "</SELECT>";
$select_list .= "</TD><TD VALIGN=TOP ALIGN=CENTER>";
$select_list .= "<a href=\"#\" onclick=\"closeDiv(\'campaign_select_list\');\">"._QXZ("Close Panel")."</a><BR><BR>";
$select_list .= "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0>";
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Inbound").": </TD><TD align=left><SELECT SIZE=1 NAME=with_inbound>";
$select_list .= "<option value=\"N\"";
if ($with_inbound=='N') {$select_list .= " selected";}
$select_list .= ">"._QXZ("No")."</option>";
$select_list .= "<option value=\"Y\"";
if ($with_inbound=='Y') {$select_list .= " selected";}
$select_list .= ">"._QXZ("Yes")."</option>";
$select_list .= "<option value=\"O\"";
if ($with_inbound=='O') {$select_list .= " selected";}
$select_list .= ">"._QXZ("Only")."</option>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Monitor").": </TD><TD align=left><SELECT SIZE=1 NAME=monitor_active>";
$select_list .= "<option value=\"\"";
if (strlen($monitor_active) < 2) {$select_list .= " selected";}
$select_list .= ">"._QXZ("NONE")."</option>";
if (preg_match("/MONITOR/",$RS_ListenBarge) )
{
$select_list .= "<option value=\"MONITOR\"";
if ($monitor_active=='MONITOR') {$select_list .= " selected";}
$select_list .= ">"._QXZ("MONITOR")."</option>";
}
if (preg_match("/BARGE/",$RS_ListenBarge) )
{
$select_list .= "<option value=\"BARGE\"";
if ($monitor_active=='BARGE') {$select_list .= " selected";}
$select_list .= ">"._QXZ("BARGE")."</option>";
}
if ( ($agent_whisper_enabled == '1') and (preg_match("/WHISPER/",$RS_ListenBarge) ) )
{
$select_list .= "<option value='WHISPER'";
if ($monitor_active=='WHISPER') {$select_list .= " selected";}
$select_list .= ">"._QXZ("WHISPER")."</option>";
}
#$select_list .= "<option value=\"HIJACK\"";
# if ($monitor_active=='HIJACK') {$select_list .= " selected";}
#$select_list .= ">HIJACK</option>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Phone").": </TD><TD align=left>";
$select_list .= "<INPUT type=text size=10 maxlength=20 NAME=monitor_phone VALUE=\"$monitor_phone\">";
$select_list .= "</TD></TR>";
$select_list .= "<TR><TD align=center COLSPAN=2> </TD></TR>";
if ($UGdisplay > 0)
{
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Select User Group").": </TD><TD align=left>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">"._QXZ("ALL USER GROUPS")."</option>";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT></TD></TR>";
}
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Dialable Leads Alert").": </TD><TD align=left><SELECT SIZE=1 NAME=NOLEADSalert>";
$select_list .= "<option value=\"\"";
if (strlen($NOLEADSalert) < 2) {$select_list .= " selected";}
$select_list .= ">"._QXZ("NO")."</option>";
$select_list .= "<option value=\"YES\"";
if ($NOLEADSalert=='YES') {$select_list .= " selected";}
$select_list .= ">"._QXZ("YES")."</option>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "<TR><TD align=right>";
$select_list .= _QXZ("Show Drop In-Group Row").": </TD><TD align=left><SELECT SIZE=1 NAME=DROPINGROUPstats>";
$select_list .= "<option value=\"0\"";
if ($DROPINGROUPstats < 1) {$select_list .= " selected";}
$select_list .= ">"._QXZ("NO")."</option>";
$select_list .= "<option value=\"1\"";
if ($DROPINGROUPstats=='1') {$select_list .= " selected";}
$select_list .= ">"._QXZ("YES")."</option>";