-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.php
1441 lines (1319 loc) · 51.5 KB
/
report.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 include('includes/header.php');?>
<?php include('includes/login/auth.php');?>
<?php include('includes/reports/main.php');?>
<?php include('includes/helpers/short.php');?>
<?php
//IDs
$cid = isset($_GET['c']) && is_numeric($_GET['c']) ? mysqli_real_escape_string($mysqli, $_GET['c']) : exit;
if(get_app_info('is_sub_user'))
{
if(get_app_info('app')!=get_app_info('restricted_to_app'))
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/reports?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
else if(get_app_info('campaigns_only')==1 && get_app_info('templates_only')==1 && get_app_info('lists_only')==1 && get_app_info('reports_only')==1)
{
go_to_next_allowed_section();
}
else if(get_app_info('reports_only')==1)
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/app?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
$q = 'SELECT app FROM campaigns WHERE id = '.$cid;
$r = mysqli_query($mysqli, $q);
if ($r)
{
while($row = mysqli_fetch_array($r))
{
$a = $row['app'];
}
if($a!=get_app_info('restricted_to_app'))
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/reports?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
}
}
?>
<?php
$q = 'SELECT * FROM campaigns WHERE userID = '.get_app_info('main_userID').' AND app='.get_app_info('app').' AND id = '.$cid;
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$id = stripslashes($row['id']);
$from_name = stripslashes($row['from_name']);
$from_email = stripslashes($row['from_email']);
$title = stripslashes($row['title']);
$recipients = stripslashes($row['recipients']);
$sent = stripslashes($row['sent']);
$bounce_setup = $row['bounce_setup'];
$complaint_setup = $row['complaint_setup'];
$opens = $row['opens']=='' ? '' : stripslashes($row['opens']);
$opens_tracking = stripslashes($row['opens_tracking']);
$links_tracking = stripslashes($row['links_tracking']);
$opens_all = '';
$opens_array = array();
$no_opens_yet = $opens_tracking ? _('No opens yet!') : _('Tracking disabled for opens');
$no_links_for_this_campaign = $links_tracking ? _('There are no links for this campaign.') : _('Tracking disabled for clicks');
if($opens=='')
{
$percentage_opened = 0;
$opens_unique = 0;
}
else
{
$opens_array = explode(',', $opens);
$opens_array2 = array();
foreach($opens_array as $oa)
{
$oa = $oa.',';
$oa = delete_between(':', ',', $oa);
array_push($opens_array2, $oa);
}
$opens_all = count($opens_array2);
$opens_unique = count(array_unique($opens_array2));
$percentage_opened = round($opens_unique/($recipients-get_bounced()) * 100, 2);
}
if($recipients==0 || $opens_unique==0)
{
$click_per = 0;
$unsubscribe_per = 0;
}
else
{
$click_per = round(get_click_percentage($cid)/($recipients-get_bounced()) *100, 4);
$unsubscribe_per = round(get_unsubscribes()/($recipients-get_bounced()) *100, 4);
}
if($opens_all=='')
$opens_all = '0';
if($recipients==0)
{
$bounce_percentage = 0;
$complaint_percentage = 0;
}
else
{
$bounce_percentage = round((get_bounced()/$recipients) * 100, 2);
$complaint_percentage = round((get_complaints()/$recipients) * 100, 2);
}
}
}
?>
<link rel="stylesheet" type="text/css" href="<?php echo get_app_info('path');?>/css/print.css" media="print" />
<script type="text/javascript" src="<?php echo get_app_info('path');?>/js/validate.js"></script>
<link href="<?php echo get_app_info('path');?>/css<?php echo get_app_info('dark_mode') ? '/dark' : '';?>/tablesorter.css?30" rel="stylesheet">
<script type="text/javascript" src="<?php echo get_app_info('path');?>/js/tablesorter/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="<?php echo get_app_info('path');?>/js/tablesorter/jquery.tablesorter.widgets.min.js"></script>
<script type="text/javascript" src="<?php echo get_app_info('path')?>/js/fancybox/jquery.fancybox.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo get_app_info('path')?>/js/fancybox/jquery.fancybox.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
//iframe preview
$(".iframe-preview").click(function(e) {
e.preventDefault();
$.fancybox.open({
src : $(this).attr("href"),
type : 'iframe',
padding : 0,
iframe : {
preload : false
}
});
});
$('#clicks').tablesorter({
widgets : ['saveSort'],
usNumberFormat : false,
sortReset : true,
sortRestart : true,
headers: { 3: { sorter: false} }
});
$('#countries').tablesorter({
widgets : ['saveSort'],
usNumberFormat : false,
sortReset : true,
sortRestart : true,
headers: { 2: { sorter: false} }
});
});
</script>
<script src="js/highcharts/highcharts.js?2"></script>
<?php if(get_app_info('dark_mode')):?><script src="js/highcharts/themes/high-contrast-dark.src.js"></script><?php endif;?>
<script type="text/javascript">
$(document).ready(function() {
var chart;
$(document).ready(function() {
<?php $bounced_complaint_color = get_app_info('dark_mode') ? '#ececec' : '#333333';?>
Highcharts.setOptions({
colors: ['#999999', '#70bd6c', '#eeca46', '#579fc8', '#ce5c56', '<?php echo $bounced_complaint_color;?>', '<?php echo $bounced_complaint_color;?>']
});
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'bar',
height: 300
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: ['<?php echo _('Activity');?>'],
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: false
}
},
legend: {
itemStyle: {
color: '#646464',
fontWeight: 'normal',
fontFamily: 'Roboto'
}
},
tooltip: {
formatter: function() {
return ''+
this.series.name +': '+ this.y;
}
},
plotOptions: {
bar: {
borderWidth: 0,
shadow: false,
groupPadding: 0,
dataLabels: {
enabled: true
}
}
},
credits: {
enabled: false
},
series: [
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Recipients');?>',
data: [<?php echo $recipients;?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Opened');?>',
data: [<?php echo $opens_unique;?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Unopened');?>',
data: [<?php echo $recipients - $opens_unique; ?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Clicked');?>',
data: [<?php echo get_click_percentage($cid);?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Unsubscribed');?>',
data: [<?php echo get_unsubscribes();?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Bounced');?>',
data: [<?php echo get_bounced();?>]
},
{
dataLabels: {
style:{
fontWeight: 'normal',
textOutline: '0px',
color: "#797979"
}
},
name: '<?php echo _('Marked as spam');?>',
data: [<?php echo get_complaints();?>]
}
],
exporting: { enabled: false }
});
});
});
</script>
<div class="row-fluid">
<div class="span2">
<?php include('includes/sidebar.php');?>
</div>
<div class="span10">
<div>
<p class="lead">
<?php if(get_app_info('is_sub_user')):?>
<?php echo get_app_data('app_name');?>
<?php else:?>
<a href="<?php echo get_app_info('path'); ?>/edit-brand?i=<?php echo get_app_info('app');?>" data-placement="right" title="<?php echo _('Edit brand settings');?>"><?php echo get_app_data('app_name');?> <span class="icon icon-pencil top-brand-pencil"></span></a>
<?php endif;?>
</p>
</div>
<h2><?php echo _('Campaign report');?></h2><br/>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('campaigns_only')==0)):?>
<span>
<?php echo _('Campaign title');?>:
<a href="javascript:void(0);" id="edit-campaign-title" title="<?php echo _('Click to edit this campaign\'s title for your own reference');?>"><?php echo get_saved_data('label')=='' ? _('Not set') : get_saved_data('label');?> <span class="icon icon-pencil"></span></a>
<input type="text" name="campaign-title-field" id="campaign-title-field" value="<?php echo get_saved_data('label')=='' ? _('Not set') : get_saved_data('label');?>" style="width: 200px; margin-top: 7px; display:none;" />
<script type="text/javascript">
$(document).ready(function() {
$("#edit-campaign-title").click(function(){
$(this).hide();
$("#campaign-title-field").show();
if($("#edit-campaign-title").text()=="<?php echo _('Not set');?>") $("#campaign-title-field").val("");
$("#campaign-title-field").focus();
});
$("#campaign-title-field").blur(function(){
$(this).hide();
$("#edit-campaign-title").show();
update_campaign_title();
});
$("#campaign-title-field").keypress(function(e){
if(e.which == 13)
{
update_campaign_title();
}
});
function update_campaign_title()
{
$.post("<?php echo get_app_info('path');?>/includes/reports/update-campaign-title.php", { campaign_id: "<?php echo $cid;?>", campaign_title: $("#campaign-title-field").val() },
function(data) {
if(data)
{
if($("#campaign-title-field").val()=='') $("#edit-campaign-title").text("<?php echo _('Not set');?>");
else $("#edit-campaign-title").text($("#campaign-title-field").val());
$("#campaign-title-field").hide();
$("#edit-campaign-title").show();
}
else
{
alert("Sorry, unable to save. Please try again later!");
}
}
);
}
});
</script>
</span>
<?php endif;?>
<h3><?php echo _('Subject');?>: <?php echo get_saved_data('title');?> <a href="<?php echo get_app_info('path');?>/w/<?php echo encrypt_val($id);?>" title="<?php echo _('View the campaign');?>" class="iframe-preview"><span class="icon-eye-open"></span></a></h3><br/>
<blockquote>
<p><strong><?php echo _('Sent on');?></strong> <span class="label"><?php echo parse_date(get_saved_data('sent'), 'long', false)?></span> <strong><?php echo _('to');?></strong> <span class="label"><?php echo number_format(get_saved_data('recipients'));?> <?php echo _('subscribers');?></span></p>
<p><strong><?php echo _('From');?></strong> <span class="label"><?php echo $from_name.' <'.$from_email.'>';?></span></p>
<p><strong><?php echo _('To');?></strong> <?php echo get_lists();?></p>
<?php if(get_excluded_lists() != 'No data'):?>
<p><strong><?php echo _('Excluded');?></strong> <?php echo get_excluded_lists();?></p>
<?php endif;?>
<?php
if (count(glob("uploads/attachments/$cid/*")) > 0)
{
echo '<p><strong>'._('Attachments').'</strong>';
if($handle = opendir('uploads/attachments/'.$cid))
{
$i = -1;
while (false !== ($file = readdir($handle)))
{
if($file!='.' && $file!='..'):
?>
<ul id="attachments" style="margin-top: 10px;">
<li id="attachment<?php echo $i;?>" style="<?php echo get_app_info('dark_mode') ? 'color:black;' : '';?> padding: 0px 0px;">
<?php
$filen = $file;
if(strlen($filen)>30) $filen = substr($file, 0, 30).'...';
echo '<a href="'.APP_PATH.'/uploads/attachments/'.$cid.'/'.$file.'" title="">'.$filen.'</a>';
?>
(<?php echo round((filesize('uploads/attachments/'.$cid.'/'.$file)/1000000), 2);?>MB)
<a href="<?php echo get_app_info('path');?>/includes/create/delete-attachment.php" data-filename="<?php echo $file;?>" title="<?php echo _('Delete');?>" id="delete<?php echo $i;?>" <?php echo get_app_info('dark_mode') ? 'style="color:black;"' : '';?>><i class="icon icon-trash"></i></a>
<script type="text/javascript">
$("#delete<?php echo $i?>").click(function(e){
e.preventDefault();
filename = $(this).data("filename");
campaign_id = "<?php echo $cid?>";
url = $(this).attr("href");
c = confirm('<?php echo _('Confirm delete');?> \"'+filename+'\"?');
if(c)
{
$.post(url, { filename: filename, campaign_id: campaign_id },
function(data) {
if(data)
{
$("#attachment<?php echo $i?>").fadeOut();
}
else
{
alert("<?php echo _('Sorry, unable to delete. Please try again later!');?>");
}
}
);
}
});
</script>
</li>
</ul>
<?php
endif;
$i++;
}
closedir($handle);
echo '</p>';
}
}
?>
</blockquote>
<div class="row-fluid">
<div class="span4">
<div id="countries-container" style="min-height:300px;margin:20px 0 0 0;"></div>
</div>
<div class="span8">
<div id="container" style="margin-top: 50px;"></div>
</div>
</div>
<br/>
<div class="row-fluid">
<div class="span6">
<div class="well">
<h3><?php if($opens_tracking): ?><span class="badge badge-success" style="font-size:16px;"><?php echo $percentage_opened;?>%</span> <?php echo _('opened');?> <span class="label"><?php echo $opens_unique;?> <?php echo _('unique');?> / <?php echo _('opened');?> <?php echo $opens_all;?> <?php echo _('times');?></span><?php else: ?><span class="badge" style="font-size:16px;"><?php echo _('Tracking disabled for opens');?></span><?php endif;?></h3><br/>
<h3 style="float:left;"><?php if($opens_tracking): ?><span class="badge badge-warning" style="font-size:16px;"><?php echo $recipients - $opens_unique;?></span> <?php echo _('not opened');?> <?php else: ?><span class="badge" style="font-size:16px;"><?php echo _('Tracking disabled for opens');?></span><?php endif;?></h3>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<?php if($opens_tracking!=2):?>
<?php if($opens_tracking && is_last_campaign(get_app_info('app'), $cid)): ?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=unopens" title="<?php echo _('Export a CSV of ALL subscribers who did not open this email (includes subscribers newly added to the lists after this campaign was sent)');?>" class="notopened-export-btns"><i class="icon icon-download-alt"></i></a>
<a href="#import-into-list-modal" title="<?php echo _('Import ALL subscribers who did not open this email into a list (includes subscribers newly added to the lists after this campaign was sent)');?>" id="unopened-export-btn" data-toggle="modal" class="notopened-export-btns"><i class="icon icon-plus-sign"></i></a>
<?php endif;?>
<?php endif;?>
<?php endif;?>
<br/>
<h3 style="clear:both;margin-top: 27px;"><?php if($links_tracking): ?><span class="badge badge-info" style="font-size:16px;"><?php echo $click_per;?>%</span> <?php echo _('clicked a link');?> <span class="label"><?php echo get_click_percentage($cid);?> <?php echo _('unique clicks');?></span><?php else: ?><span class="badge" style="font-size: 16px;"><?php echo _('Tracking disabled for clicks');?></span><?php endif;?></h3>
</div>
</div>
<div class="span6">
<div class="well">
<h3><span class="badge badge-important" style="font-size:16px;"><?php echo $unsubscribe_per;?>%</span> <?php echo _('unsubscribed');?> <span class="label"><?php echo get_unsubscribes();?> <?php echo _('unsubscribed');?></span></h3><br/>
<h3><span class="badge badge-inverse" style="font-size:16px;"><?php echo $bounce_percentage;?>%</span> <?php echo _('bounced');?> <span class="label"><?php echo get_bounced();?> <?php echo _('bounced');?></span></h3><br/>
<h3><span class="badge badge-inverse" style="font-size:16px;"><?php echo $complaint_percentage;?>%</span> <?php echo _('marked as spam');?> <span class="label"><?php echo get_complaints();?> <?php echo _('marked as spam');?></span></h3>
</div>
</div>
</div>
<!-- Link activity -->
<br/>
<div class="row-fluid">
<div class="span12">
<h2 class="report-titles"><?php echo _('Link activity');?></h2>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<?php if($links_tracking!=2):?>
<?php if($links_tracking): ?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=clicks" title="<?php echo _('Export a CSV of ALL subscribers who clicked');?>" class="report-export"><i class="icon icon-download-alt"></i></a>
<a href="#import-into-list-modal" title="<?php echo _('Import ALL subscribers who clicked at least one link into a list');?>" id="link-activity-export-btn" data-toggle="modal" class="report-export"><i class="icon icon-plus-sign"></i></a>
<?php endif;?>
<?php endif;?>
<?php endif;?>
</div>
</div>
<br/>
<div class="row-fluid">
<table class="table table-striped table-condensed responsive" id="clicks">
<thead>
<tr>
<th><?php echo _('Link (URL)');?></th>
<th><?php echo _('Unique');?></th>
<th><?php echo _('Total');?></th>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<?php if($links_tracking!=2):?>
<th><?php echo _('Export');?></th>
<th><?php echo _('Import');?></th>
<?php endif;?>
<?php endif;?>
</tr>
</thead>
<tbody>
<?php
$q = 'SELECT id, link, clicks FROM links WHERE campaign_id = '.$cid;
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$link_id = stripslashes($row['id']);
$link = stripslashes($row['link']);
$link_trunc = strlen($link) > 100 ? substr($link, 0, 100).'...' : $link;
$clicks = $row['clicks']=='' ? '' : stripslashes($row['clicks']);
if($clicks==NULL)
{
$unique_clicks = '0';
$total_clicks = '0';
}
else
{
$total_clicks_array = explode(',', $clicks);
$total_clicks = count($total_clicks_array);
$unique_clicks = count(array_unique($total_clicks_array));
}
echo '
<tr>
<td><a href="'.$link.'" target="_blank">'.$link_trunc.'</a></td>
<td>'.$unique_clicks.'</td>
<td>'.$total_clicks.'</td>
';
if($links_tracking!=2)
{
if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0))
{
echo'
<td><a href="'.get_app_info('path').'/includes/reports/export-csv.php?c='.$id.'&l='.$link_id.'&a=recipient_clicks" title="'._('Export a CSV of ALL subscribers who clicked this link').'" class="recipient-click-export"><i class="icon icon-download-alt"></i></a></td>';
echo '<td><a href="#import-into-list-modal" title="'._('Import ALL subscribers who clicked this link into a list').'" class="link-activity-individual-export-btn" data-toggle="modal" data-link_id="'.$link_id.'"><i class="icon icon-plus-sign"></i></a></td>';
echo '</tr>';
}
}
}
}
else
{
echo '
<tr>
<td>'.$no_links_for_this_campaign.'</td>
<td></td>
';
if($links_tracking!=2)
{
echo '<td></td>
<td></td>
</tr>';
}
}
?>
</tbody>
</table>
</div>
<!-- Last 10 opened -->
<?php if($opens_tracking!=2):?>
<br/>
<div class="row-fluid">
<div class="span12">
<h2 class="report-titles"><?php echo _('Last 10 opened');?></h2>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<?php if($opens_tracking): ?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=opens" title="<?php echo _('Export a CSV of ALL subscribers who opened');?>" class="report-export"><i class="icon icon-download-alt"></i></a>
<a href="#import-into-list-modal" title="<?php echo _('Import ALL subscribers who opened this campaign into a list');?>" id="opened-export-btn" data-toggle="modal" class="report-export"><i class="icon icon-plus-sign"></i></a>
<?php endif;?>
<?php endif;?>
</div>
</div>
<br/>
<div class="row-fluid">
<table class="table table-striped table-condensed responsive">
<thead>
<tr>
<th><?php echo _('Name');?></th>
<th><?php echo _('Email');?></th>
<th><?php echo _('List');?></th>
<th><?php echo _('Status');?></th>
</tr>
</thead>
<tbody>
<?php
$q = 'SELECT opens from campaigns WHERE id = '.$cid;
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$last_opens = $row['opens'];
$last_opens_array = $row['opens']=='' ? array() : explode(',', $last_opens);
$loop_no = count(array_unique($last_opens_array));
if($loop_no>10) $loop_no = 10;
if($last_opens=='')
{
echo '
<tr>
<td>'.$no_opens_yet.'</td>
<td></td>
<td></td>
<td></td>
</tr>
';
}
for($z=0;$z<$loop_no;$z++)
{
$last_opens_array2 = array_reverse(array_unique($last_opens_array));
$last_subscriber_id = explode(':', $last_opens_array2[$z]);
$q2 = 'SELECT * FROM subscribers WHERE id = '.$last_subscriber_id[0];
$r2 = mysqli_query($mysqli, $q2);
if ($r2 && mysqli_num_rows($r2) > 0)
{
while($row = mysqli_fetch_array($r2))
{
$subscriber_id = stripslashes($row['id']);
$name = stripslashes($row['name']);
$email = stripslashes($row['email']);
$listID = stripslashes($row['list']);
$timestamp = parse_date($row['timestamp'], 'short', true);
$unsubscribed = stripslashes($row['unsubscribed']);
$bounced = stripslashes($row['bounced']);
$complaint = stripslashes($row['complaint']);
if($unsubscribed==0)
$unsubscribed = '<span class="label label-success">'._('Subscribed').'</span>';
else if($unsubscribed==1)
$unsubscribed = '<span class="label label-important">'._('Unsubscribed').'</span>';
if($bounced==1)
$unsubscribed = '<span class="label label-inverse">'._('Bounced').'</span>';
if($complaint==1)
$unsubscribed = '<span class="label label-inverse">'._('Marked as spam').'</span>';
if($name=='')
$name = '['._('No name').']';
$q2 = 'SELECT name FROM lists WHERE id = '.$listID;
$r2 = mysqli_query($mysqli, $q2);
if ($r2 && mysqli_num_rows($r2) > 0)
{
while($row = mysqli_fetch_array($r2))
{
$list_name = stripslashes($row['name']);
}
}
if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0))
echo '
<tr>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$name.'</a></td>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$email.'</a></td>
<td><a href="'.get_app_info('path').'/subscribers?i='.get_app_info('app').'&l='.$listID.'" title="">'.$list_name.'</a></td>
<td>'.$unsubscribed.'</td>
</tr>
';
else
echo '
<tr>
<td>'.$name.'</td>
<td>'.$email.'</td>
<td>'.$list_name.'</td>
<td>'.$unsubscribed.'</td>
</tr>
';
}
}
}
}
}
else
{
echo '
<tr>
<td>'._('No one opened yet.').'</td>
<td></td>
<td></td>
<td></td>
</tr>
';
}
?>
</tbody>
</table>
</div>
<?php endif;?>
<!-- Unsubscribed -->
<br/>
<div class="row-fluid">
<div class="span12">
<h2 class="report-titles"><?php echo _('Last 10 unsubscribed');?></h2>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=unsubscribes" title="<?php echo _('Export a CSV of ALL subscribers who unsubscribed');?>" class="report-export"><i class="icon icon-download-alt"></i></a>
<?php endif;?>
</div>
</div>
<br/>
<div class="row-fluid">
<table class="table table-striped table-condensed responsive">
<thead>
<tr>
<th><?php echo _('Name');?></th>
<th><?php echo _('Email');?></th>
<th><?php echo _('List');?></th>
<th><?php echo _('Status');?></th>
<th><?php echo _('Date');?></th>
</tr>
</thead>
<tbody>
<?php
$q = 'SELECT * FROM subscribers WHERE unsubscribed = 1 AND last_campaign = '.$cid.' ORDER BY timestamp DESC LIMIT 10';
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$subscriber_id = stripslashes($row['id']);
$name = stripslashes($row['name']);
$email = stripslashes($row['email']);
$listID = stripslashes($row['list']);
$timestamp = parse_date($row['timestamp'], 'short', true);
if($name=='')
$name = '['._('No name').']';
$q2 = 'SELECT name FROM lists WHERE id = '.$listID;
$r2 = mysqli_query($mysqli, $q2);
if ($r2 && mysqli_num_rows($r2) > 0)
{
while($row = mysqli_fetch_array($r2))
{
$list_name = stripslashes($row['name']);
}
}
if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0))
echo '
<tr>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$name.'</a></td>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$email.'</a></td>
<td><a href="'.get_app_info('path').'/subscribers?i='.get_app_info('app').'&l='.$listID.'" title="">'.$list_name.'</a></td>
<td><span class="label label-important">'._('Unsubscribed').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
else
echo '
<tr>
<td>'.$name.'</td>
<td>'.$email.'</td>
<td>'.$list_name.'</td>
<td><span class="label label-important">'._('Unsubscribed').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
}
}
else
{
echo '
<tr>
<td>'._('No one unsubscribed from this campaign!').'</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
';
}
?>
</tbody>
</table>
</div>
<!-- Bounced -->
<br/>
<div class="row-fluid">
<div class="span12">
<h2 class="report-titles"><?php echo _('Last 10 bounced emails');?></h2>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=bounces" title="<?php echo _('Export a CSV of ALL subscribers who bounced');?>" class="report-export"><i class="icon icon-download-alt"></i></a>
<?php endif;?>
</div>
</div>
<br/>
<div class="row-fluid">
<table class="table table-striped table-condensed responsive">
<thead>
<tr>
<th><?php echo _('Name');?></th>
<th><?php echo _('Email');?></th>
<th><?php echo _('List');?></th>
<th><?php echo _('Status');?></th>
<th><?php echo _('Date');?></th>
</tr>
</thead>
<tbody>
<?php
$q = 'SELECT * FROM subscribers WHERE bounced = 1 AND last_campaign = '.$cid.' ORDER BY timestamp DESC LIMIT 10';
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$subscriber_id = stripslashes($row['id']);
$name = stripslashes($row['name']);
$email = stripslashes($row['email']);
$listID = stripslashes($row['list']);
$timestamp = parse_date($row['timestamp'], 'short', true);
if($name=='')
$name = '['._('No name').']';
$q2 = 'SELECT name FROM lists WHERE id = '.$listID;
$r2 = mysqli_query($mysqli, $q2);
if ($r2 && mysqli_num_rows($r2) > 0)
{
while($row = mysqli_fetch_array($r2))
{
$list_name = stripslashes($row['name']);
}
}
if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0))
echo '
<tr>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$name.'</a></td>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$email.'</a></td>
<td><a href="'.get_app_info('path').'/subscribers?i='.get_app_info('app').'&l='.$listID.'" title="">'.$list_name.'</a></td>
<td><span class="label label-inverse">'._('Bounced').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
else
echo '
<tr>
<td>'.$name.'</td>
<td>'.$email.'</td>
<td>'.$list_name.'</td>
<td><span class="label label-inverse">'._('Bounced').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
}
}
else
{
echo '
<tr>';
echo '<td>'._('No emails bounced from this campaign!').'</td>';
echo'
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
';
}
?>
</tbody>
</table>
</div>
<!-- Marked as spam -->
<br/>
<div class="row-fluid">
<div class="span12">
<h2 class="report-titles"><?php echo _('Last 10 marked as spam');?></h2>
<?php if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0)):?>
<a href="<?php echo get_app_info('path');?>/includes/reports/export-csv.php?c=<?php echo $id?>&a=complaints" title="<?php echo _('Export a CSV of ALL subscribers who marked your email as spam');?>" class="report-export"><i class="icon icon-download-alt"></i></a>
<?php endif;?>
</div>
</div>
<br/>
<div class="row-fluid">
<table class="table table-striped table-condensed responsive">
<thead>
<tr>
<th><?php echo _('Name');?></th>
<th><?php echo _('Email');?></th>
<th><?php echo _('List');?></th>
<th><?php echo _('Status');?></th>
<th><?php echo _('Date');?></th>
</tr>
</thead>
<tbody>
<?php
$q = 'SELECT * FROM subscribers WHERE complaint = 1 AND last_campaign = '.$cid.' ORDER BY timestamp DESC LIMIT 10';
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$subscriber_id = stripslashes($row['id']);
$name = stripslashes($row['name']);
$email = stripslashes($row['email']);
$listID = stripslashes($row['list']);
$timestamp = parse_date($row['timestamp'], 'short', true);
if($name=='')
$name = '['._('No name').']';
$q2 = 'SELECT name FROM lists WHERE id = '.$listID;
$r2 = mysqli_query($mysqli, $q2);
if ($r2 && mysqli_num_rows($r2) > 0)
{
while($row = mysqli_fetch_array($r2))
{
$list_name = stripslashes($row['name']);
}
}
if(!get_app_info('is_sub_user') || (get_app_info('is_sub_user') && get_app_info('lists_only')==0))
echo '
<tr>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$name.'</a></td>
<td><a href="#subscriber-info" data-id="'.$subscriber_id.'" data-toggle="modal" class="subscriber-info">'.$email.'</a></td>
<td><a href="'.get_app_info('path').'/subscribers?i='.get_app_info('app').'&l='.$listID.'" title="">'.$list_name.'</a></td>
<td><span class="label label-inverse">'._('Marked as spam').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
else
echo '
<tr>
<td>'.$name.'</td>
<td>'.$email.'</td>
<td>'.$list_name.'</td>
<td><span class="label label-inverse">'._('Marked as spam').'</span></td>
<td>'.$timestamp.'</td>
</tr>
';
}
}
else
{
echo '
<tr>';
echo '<td>'._('No one marked your email as spam!').'</td>';
echo'
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
';
}
?>
</tbody>
</table>
</div>
<!-- Countries -->
<br/>
<div class="row-fluid">
<div class="span12">
<h2><?php echo _('All countries');?></h2><br/>
<table class="table table-striped table-condensed responsive" id="countries">
<thead>