-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit-brand.php
1297 lines (1148 loc) · 66 KB
/
edit-brand.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/app/main.php');?>
<?php
check_simplexml();
if(get_app_info('is_sub_user'))
{
if(get_app_info('reports_only'))
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/reports?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
else
{
echo '<script type="text/javascript">window.location="'.addslashes(get_app_info('path')).'/app?i='.get_app_info('restricted_to_app').'"</script>';
exit;
}
}
?>
<!-- Validation -->
<script type="text/javascript" src="<?php echo get_app_info('path');?>/js/validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#settings-form").validate({
rules: {
app_name: {
required: true
},
from_name: {
required: true
},
from_email: {
required: true,
email: true
},
reply_to: {
required: true,
email: true
},
campaign_report_rows: {
required: true,
digits: true,
min: 1
}
},
messages: {
app_name: "<?php echo addslashes(_('Please specify your brand\'s name'));?>",
from_name: "<?php echo addslashes(_('\'From name\' is required'));?>",
from_email: "<?php echo addslashes(_('A valid \'From email\' is required'));?>",
reply_to: "<?php echo addslashes(_('A valid \'Reply to\' email is required'));?>"
}
});
//Check if login email clashes with the main login email address
$("#settings-form").submit(function(e){
login_email = $('#login_email').val();
if(login_email == "<?php echo get_app_info('email');?>")
{
e.preventDefault();
$("#duplicate-login-email").show();
}
});
//accordion1
$("#collapse3").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top-60}, 'slow', 'easeOutExpo'); $("#smtp_host").focus();});
$("#collapse0").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top-10}, 'slow', 'easeOutExpo'); $("#custom_domain").focus();});
$("#collapse2").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top+45}, 'slow', 'easeOutExpo'); $("#recaptcha_sitekey").focus();});
$("#collapse1").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top+97}, 'slow', 'easeOutExpo');});
$("#collapse5").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top+152}, 'slow', 'easeOutExpo'); });
$("#collapse4").on('shown', function(){$('html, body').animate({scrollTop:$(this).parent().parent().position().top+205}, 'slow', 'easeOutExpo'); $("#query_string").focus();});
//accordion2
$("#collapse2_1").on('shown', function(){$("#login_email").focus();});
$("#collapse2_4").on('shown', function(){$("#delivery_fee").focus();});
$("#collapse2_5").on('shown', function(){$("#monthly-limit").focus();});
});
</script>
<form action="<?php echo get_app_info('path')?>/includes/app/edit.php" method="POST" accept-charset="utf-8" class="form-vertical" enctype="multipart/form-data" id="settings-form">
<div class="row-fluid">
<div class="span2">
<div class="sidebar-nav sidebar-box" style="padding: 19px;">
<?php include('includes/helpers/ses-quota.php');?>
</div>
</div>
<div class="span5">
<h2><?php echo _('Edit brand');?></h2><br/>
<label class="control-label" for="app_name"><?php echo _('Brand name');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="app_name" name="app_name" placeholder="<?php echo _('Name of the brand');?>" value="<?php echo get_saved_data('app_name');?>">
</div>
</div>
<label class="control-label" for="from_name"><?php echo _('From name');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="from_name" name="from_name" placeholder="<?php echo _('From name');?>" value="<?php echo get_saved_data('from_name');?>">
</div>
</div>
<label class="control-label" for="from_email"><?php echo _('From email');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="from_email" name="from_email" placeholder="<?php echo _('name@domain.com');?>" value="<?php echo get_saved_data('from_email');?>">
</div>
<p id="verification-check-loader" style="display:none;"><img src="<?php echo get_app_info('path')?>/img/<?php echo get_app_info('dark_mode') ? 'loader-dark.gif' : 'loader-light.gif';?>" style="width:16px;"/> <?php echo _('Checking if your \'From email\' is verified in your SES console..');?><br/><br/></p>
<div class="alert alert-danger" id="unverified-email" style="display:none;"><strong><i class="icon icon-warning-sign"></i> <?php echo _('Unverified \'From email\'');?></strong>: <?php echo _('Your \'From email\' or its domain is not verified in your Amazon SES console. Do either of the following:');?>
<br/><br/>
<ul>
<li id="click-to-verify-copy"><a href="javascript:void(0);" id="click-to-verify-btn"><?php echo _('Click here to verify this \'From email\', Amazon will send a verification email to this \'From email\'');?> →</a></li>
<li><a href="https://console.aws.amazon.com/ses/home?#verified-senders-domain:" target="_blank"><?php echo _('Alternatively, verify this \'From email\'s \'domain\' in your Amazon SES console');?> →</a></li>
</ul>
<p><?php echo _('When you verify a domain, you can use any \'From email\' address belonging to that domain without having to verify them individually.');?></p>
<p><?php echo _('Lastly, the \'From email\' is case sensitive. Please ensure you are using the same case as the email address verified in your Amazon SES console.');?></p>
</div>
<div class="alert alert-danger" id="unverified-email-pending" style="display:none;"><strong><i class="icon icon-warning-sign"></i> <?php echo _('\'From email\' pending verification');?></strong>: <?php echo _('Your \'From email\' or its domain is pending verification in your Amazon SES console. Please complete the verification.');?></div>
<div class="alert alert-danger" id="api-error" style="display:none;"><strong><i class="icon icon-warning-sign"></i> <?php echo _('Unable to communicate with Amazon SES API');?></strong>: <?php echo _('Please check the error message on the left for instructions.');?></div>
<div class="alert alert-success" id="verified-email" style="display:none;"><strong><i class="icon icon-ok"></i> <?php echo _('Congrats! This \'From email\' is verified.');?></strong></div>
<?php
$q = 'SELECT smtp_host, smtp_port, smtp_username, smtp_password FROM apps WHERE id = '.get_app_info('app');
$r = mysqli_query($mysqli, $q);
if ($r && mysqli_num_rows($r) > 0)
{
while($row = mysqli_fetch_array($r))
{
$smtp_host = $row['smtp_host'];
$smtp_port = $row['smtp_port'];
$smtp_username = $row['smtp_username'];
$smtp_password = $row['smtp_password'];
}
}
?>
<?php if($smtp_host=='' || $smtp_port=='' || $smtp_username=='' || $smtp_password==''):?>
<?php if(get_app_info('s3_key')!='' && get_app_info('s3_key')!=''):?>
<script type="text/javascript">
$(document).ready(function() {
$("#from_email").focusout(function(){
$("#verification-check-loader").show();
$("#unverified-email").hide();
$("#unverified-email-pending").hide();
$("#api-error").hide();
$("#verified-email").hide();
$.post("<?php echo get_app_info('path')?>/includes/app/check-email-verification.php", { from_email: $("#from_email").val(), auto_verify: 'no' },
function(data) {
if(data=='unverified')
{
$("#verification-check-loader").hide();
$("#unverified-email").show();
$("#unverified-email-pending").hide();
$("#api-error").hide();
$("#verified-email").hide();
}
else if(data=='pending verification')
{
$("#verification-check-loader").hide();
$("#unverified-email").hide();
$("#unverified-email-pending").show();
$("#api-error").hide();
$("#verified-email").hide();
}
else if(data=='verified')
{
$("#verification-check-loader").hide();
$("#unverified-email").hide();
$("#unverified-email-pending").hide();
$("#api-error").hide();
$("#verified-email").show();
}
else if(data=="api error")
{
$("#verification-check-loader").hide();
$("#unverified-email").hide();
$("#unverified-email-pending").hide();
$("#api-error").show();
$("#verified-email").hide();
}
else
{
$("#verification-check-loader").hide();
}
}
);
});
<?php
//Check if from email is verified in SES console
if(!get_app_info('is_sub_user') && get_app_info('s3_key')!='' && get_app_info('s3_secret')!='')
{
$from_email = get_saved_data('from_email');
if(verify_identity($from_email)=='api_error')
{
echo '$("#api-error").show();';
}
else if(verify_identity($from_email)=='unverified')
{
//From email address or domain is not verified in SES console
echo '$("#unverified-email").show();';
}
else if(verify_identity($from_email)=='pending')
{
//From email address or domain 'pending verification' in SES console
echo '$("#unverified-email-pending").show();';
}
}
?>
$("#click-to-verify-btn").click(function(e){
e.preventDefault();
$("#click-to-verify-copy").html("<?php echo _('Please wait..');?>");
$.post("<?php echo get_app_info('path')?>/includes/app/verify-email.php", { from_email: $("#from_email").val() },
function(data) {
if(data)
{
if(data=="success")
$("#unverified-email").html("<?php echo _('A verification email has been sent to your \'From email\' address with a confirmation link to complete the verification. Please click the link to complete the verification, then refresh this page.');?>");
else if(data=="success2")
$("#unverified-email").html("<?php echo _('Two verification emails has been sent to both your login email address and the above \'From email\' address. Please click the verification link in both emails to complete the verification, then refresh this page.');?>");
else if(data=="failed")
$("#unverified-email").html("<?php echo _('Unable to send your \'From email\' address to Amazon SES for verification! Please try again later.');?>");
}
else
{
alert("<?php echo _('Sorry, unable to verify email address. Please try again later!');?>");
}
}
);
});
});
</script>
<?php endif;?>
<?php endif;?>
</div>
<label class="control-label" for="reply_to"><?php echo _('Reply to email');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="reply_to" name="reply_to" placeholder="<?php echo _('name@domain.com');?>" value="<?php echo get_saved_data('reply_to');?>">
</div>
</div>
<br/>
<label class="control-label" for="logo"><?php echo _('Brand logo');?> <em class="thirtytwo"><?php echo _('(32 x 32 pixel, jpeg, jpg, gif or png format)');?></em></label>
<div class="control-group">
<div class="controls">
<input type="file" id="logo" name="logo" />
</div>
<?php if(get_saved_data('brand_logo_filename')!=''):?>
<div id="brand-logo-management">
<img src="<?php echo get_app_info('path').'/uploads/logos/'.get_saved_data('brand_logo_filename');?>" id="brand-logo"/>
<a href="javascript:void(0);" title="" class="icon icon-trash" id="delete-brand-logo"> <?php echo _('Delete');?></a>
<script type="text/javascript">
$(document).ready(function() {
$("#delete-brand-logo").click(function(e){
e.preventDefault();
c = confirm("<?php echo _('Confirm delete this logo?');?>");
if(c)
{
$.post("<?php echo get_app_info('path').'/includes/app/delete-logo.php'?>", { id: "<?php echo get_app_info('app');?>", filename: "<?php echo get_saved_data('brand_logo_filename');?>" },
function(data) {
if(data)
{
$("#brand-logo-management").fadeOut();
}
else
{
alert("<?php echo _('Sorry, unable to delete. Please try again later!');?>");
}
}
);
}
});
});
</script>
<br/>
</div>
<?php endif;?>
</div>
<br/>
<?php $err = isset($_GET['e']) ? $_GET['e'] : '';?>
<?php if($err=='1'):?>
<div class="alert alert-error">
<button class="close" onclick="$('.alert-error').hide();">×</button>
<strong><?php echo _('Could not create \'/logos/\' directory. Please make sure permissions in /uploads/ folder is set to 777. Your logo has not been uploaded.');?></strong>
</div>
<?php elseif($err=='2'):?>
<div class="alert alert-error">
<button class="close" onclick="$('.alert-error').hide();">×</button>
<strong><?php echo _('Please upload only these file formats: jpeg, jpg, gif or png.');?></strong>
</div>
<?php elseif($err=='3'):?>
<div class="alert alert-error">
<button class="close" onclick="$('.alert-error').hide();">×</button>
<strong><?php echo _('Could not upload image to \'/logos/\' folder. <br/>Please make sure permissions in /uploads/ folder is set to 777. <br/>Then remove the /logos/ folder in the /uploads/ folder and try again.');?></strong>
</div>
<?php endif;?>
<hr/>
<div class="accordion" id="accordion">
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse3" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-envelope-alt"></span> <?php echo _('SMTP settings');?></h3></a>
</div>
<div id="collapse3" class="accordion-body collapse">
<?php
$smtp_provider = array(
'choose'=>'<span class="icon icon-envelope-alt"></span> '._('Choose an SMTP provider')
,'elasticemail'=>'<img src="'.get_app_info('path').'/img/elasticemail.png" class="smtp-provider-img"/> Elastic Email'
,'sendgrid'=>'<img src="'.get_app_info('path').'/img/sendgrid.png" class="smtp-provider-img"/> Sendgrid'
,'mailjet'=>'<img src="'.get_app_info('path').'/img/mailjet.png" class="smtp-provider-img"/> Mailjet'
,'other'=>'<span class="icon icon-envelope-alt"></span> Other'
);
$smtp_instructions = array(
'elasticemail'=>'<img src="'.get_app_info('path').'/img/elasticemail.png" class="smtp-provider-img"/> '._('See how to setup ElasticEmail with Sendy').' → <a href="https://sendy.co/elasticemail?'.get_app_info('path').'" target="_blank">https://sendy.co/elasticemail?'.get_app_info('path').'</a>'
,'sendgrid'=>'<img src="'.get_app_info('path').'/img/sendgrid.png" class="smtp-provider-img"/> '._('See how to setup Sendgrid with Sendy').' → <a href="https://sendy.co/sendgrid?'.get_app_info('path').'" target="_blank">https://sendy.co/sendgrid?'.get_app_info('path').'</a>'
,'mailjet'=>'<img src="'.get_app_info('path').'/img/mailjet.png" class="smtp-provider-img"/> '._('See how to setup Mailjet with Sendy').' → <a href="https://sendy.co/mailjet?'.get_app_info('path').'" target="_blank">https://sendy.co/mailjet?'.get_app_info('path').'</a>'
);
?>
<div class="alert" id="smtp_alert" <?php if((get_app_info('s3_key')=='' && get_app_info('s3_secret')=='') && get_saved_data('smtp_host')=='') echo 'style="display:none;"'?>>
<?php if(get_app_info('s3_key')!='' && get_app_info('s3_secret')!=''):?>
<p>
<span class="icon icon-info-sign"></span> <?php echo _('Emails are sent via Amazon SES by default. However, if you want to send emails via another SMTP provider for this brand, you can set the SMTP credentials here.');?>
</p>
<?php endif;?>
<p id="smtp-setup-instructions">
<?php
if(get_app_info('s3_key')!='' && get_app_info('s3_secret')!='')
echo '<br/>';
if(get_saved_data('smtp_host')=='smtp.elasticemail.com')
echo $smtp_instructions['elasticemail'];
else if(get_saved_data('smtp_host')=='smtp.sendgrid.net')
echo $smtp_instructions['sendgrid'];
else if(get_saved_data('smtp_host')=='in-v3.mailjet.com')
echo $smtp_instructions['mailjet'];
?>
</p>
</div>
<div class="btn-group" id="smtp-selector">
<button class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<?php
if(get_saved_data('smtp_host')=='') echo $smtp_provider['choose'];
else if(get_saved_data('smtp_host')=='smtp.elasticemail.com') echo $smtp_provider['elasticemail'];
else if(get_saved_data('smtp_host')=='smtp.sendgrid.net') echo $smtp_provider['sendgrid'];
else if(get_saved_data('smtp_host')=='in-v3.mailjet.com') echo $smtp_provider['mailjet'];
else echo $smtp_provider['other'];
?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);" id="elasticemail-btn"><?php echo $smtp_provider['elasticemail'];?></a>
<a href="javascript:void(0);" id="sendgrid-btn"><?php echo $smtp_provider['sendgrid'];?></a>
<a href="javascript:void(0);" id="mailjet-btn"><?php echo $smtp_provider['mailjet'];?></a>
<a href="javascript:void(0);" id="other-btn"><?php echo $smtp_provider['other'];?></a>
</li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function() {
prev_smtp_username = "<?php echo get_saved_data('smtp_username');?>";
caret = ' <span class="caret"></span>';
<?php if(get_saved_data('smtp_host')==''):?>
$("#smtp-setup-instructions").hide();
<?php else:?>
$("#smtp-setup-instructions").show();
<?php endif;?>
$("#elasticemail-btn").click(function(){
//Set SMTP fields
$("#smtp-selector button").html('<?php echo $smtp_provider['elasticemail'];?>'+caret);
$("#smtp_host").val("smtp.elasticemail.com");
$("#smtp_port").val("465");
$("#ssl").attr("selected", "selected");
$("#tls").removeAttr("selected");
$("#smtp_username").val(prev_smtp_username);
//Set instructions
$("#smtp_alert").show();
$("#smtp-setup-instructions").show();
$("#smtp-setup-instructions").empty();
$("#smtp-setup-instructions").html('<?php echo $smtp_instructions['elasticemail']?>');
});
$("#sendgrid-btn").click(function(){
//Set SMTP fields
$("#smtp-selector button").html('<?php echo $smtp_provider['sendgrid'];?>'+caret);
$("#smtp_host").val("smtp.sendgrid.net");
$("#smtp_port").val("465");
$("#ssl").attr("selected", "selected");
$("#tls").removeAttr("selected");
$("#smtp_username").val("apikey");
//Set instructions
$("#smtp_alert").show();
$("#smtp-setup-instructions").show();
$("#smtp-setup-instructions").empty();
$("#smtp-setup-instructions").html('<?php echo $smtp_instructions['sendgrid']?>');
});
$("#mailjet-btn").click(function(){
//Set SMTP fields
$("#smtp-selector button").html('<?php echo $smtp_provider['mailjet'];?>'+caret);
$("#smtp_host").val("in-v3.mailjet.com");
$("#smtp_port").val("587");
$("#ssl").removeAttr("selected");
$("#tls").attr("selected", "selected");
$("#smtp_username").val(prev_smtp_username);
//Set instructions
$("#smtp_alert").show();
$("#smtp-setup-instructions").show();
$("#smtp-setup-instructions").empty();
$("#smtp-setup-instructions").html('<?php echo $smtp_instructions['mailjet']?>');
});
$("#other-btn").click(function(){
//Set SMTP fields
$("#smtp-selector button").html('<?php echo $smtp_provider['other'];?>'+caret);
$("#smtp_host").val("");
$("#smtp_port").val("");
$("#ssl").removeAttr("selected");
$("#tls").removeAttr("selected");
$("#smtp_username").val(prev_smtp_username);
//Set instructions
<?php if(get_app_info('s3_key')=='' && get_app_info('s3_secret')==''):?>
$("#smtp_alert").hide();
<?php endif;?>
$("#smtp-setup-instructions").hide();
});
});
</script>
<label class="control-label" for="smtp_host"><?php echo _('Host');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="smtp_host" name="smtp_host" placeholder="eg. smtp.gmail.com" value="<?php echo get_saved_data('smtp_host');?>" autocomplete="off">
</div>
</div>
<label class="control-label" for="smtp_port"><?php echo _('Port');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="smtp_port" name="smtp_port" placeholder="eg. 465" value="<?php echo get_saved_data('smtp_port');?>" autocomplete="off">
</div>
</div>
<label class="control-label" for="smtp_ssl">SSL / TLS</label>
<div class="control-group">
<div class="controls">
<select name="smtp_ssl">
<option value="ssl" id="ssl">SSL</option>
<option value="tls" id="tls">TLS</option>
</select>
<script type="text/javascript">
$("#<?php echo get_saved_data('smtp_ssl');?>").attr("selected", "selected");
</script>
</div>
</div>
<label class="control-label" for="smtp_username"><?php echo _('Username');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="smtp_username" name="smtp_username" placeholder="<?php echo _('Username (usually your email)');?>" value="<?php echo get_saved_data('smtp_username');?>" autocomplete="off">
</div>
</div>
<label class="control-label" for="smtp_password"><?php echo _('Password');?></label>
<div class="control-group">
<div class="controls">
<input type="password" class="input-xlarge" id="smtp_password" name="smtp_password" placeholder="<?php echo _('Leave blank to not change it');?>" value="" autocomplete="new-password">
</div>
</div>
<br/>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse0" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-globe"></span> <?php echo _('Custom domain');?></h3></a>
</div>
<div id="collapse0" class="accordion-body collapse">
<?php
$licensed_custom_domain_maxed = licensed_custom_domain_maxed();
$licensed_custom_domain_used = licensed_custom_domain_used();
$licensed_custom_domain_count = licensed_custom_domain_count();
?>
<span>
<?php if($licensed_custom_domain_count==0):?>
<span class="label">You have 0 custom domain licenses</span>
<?php else:?>
<span class="label label-<?php echo $licensed_custom_domain_maxed ? 'important' : 'success';?>"><?php echo $licensed_custom_domain_used;?> of <?php echo $licensed_custom_domain_count?> custom domain licenses used</span>
<?php endif;?>
</span>
<?php if($licensed_custom_domain_maxed && get_saved_data('custom_domain')==''):?>
<p class="alert" style="margin-top: 20px;">
<span class="icon icon-info-sign"></span> <?php echo _('Just like Sendy domain licenses, custom domains requires licensing.');?> <?php echo _('You can purchase custom domain licenses here →');?> <a href="https://sendy.co/custom-domain-licenses?l=<?php echo get_app_info('license');?>" target="_blank" style="text-decoration: underline;">https://sendy.co/custom-domain-licenses</a>. <?php echo _('Refresh this page once done and you will be able to set your custom domain.');?>
<?php if($licensed_custom_domain_count==0):?>
<br/><br/>
<?php echo _('When you set a custom domain, unsubscribe, web version and all trackable links in emails you send will use this custom domain instead of the domain you installed Sendy on. Brand users can also login to their accounts via the custom domain.');?>
<?php endif;?>
</p>
<?php else:?>
<p class="alert" style="margin-top: 20px;"><span class="icon icon-info-sign"></span> <?php echo _('Unsubscribe, web version and all trackable links in emails you send will use this custom domain instead of the domain you installed Sendy on. Brand users can also login to their accounts via the custom domain.');?> <?php echo _('You can purchase more custom domain licenses here →');?> <a href="https://sendy.co/custom-domain-licenses?l=<?php echo get_app_info('license');?>" target="_blank" style="text-decoration: underline;">https://sendy.co/custom-domain-licenses</a>.</p>
<?php endif;?>
<label class="control-label" for="custom_domain"><?php echo _('Custom domain');?></label>
<div class="control-group">
<div class="controls">
<!-- Protocol -->
<select name="protocol" id="protocol" style="width:80px;" <?php echo $licensed_custom_domain_maxed && get_saved_data('custom_domain')=='' ? 'disabled' : ''; ?>>
<option value="http" id="http" selected>http://</option>
<option value="https" id="https">https://</option>
</select>
<script type="text/javascript">
$("#<?php echo get_saved_data('custom_domain_protocol');?>").attr("selected", "selected");
</script>
<!-- Custom domain -->
<input type="text" class="input-xlarge" id="custom_domain" name="custom_domain" placeholder="<?php echo 'Eg. domain.com or sub.domain.com'?>" value="<?php echo get_saved_data('custom_domain');?>" <?php echo $licensed_custom_domain_maxed && get_saved_data('custom_domain')=='' ? 'disabled' : ''; ?> autocomplete="off">
<div class="alert" id="cd_instructions" style="<?php echo get_saved_data('custom_domain')=='' ? 'display:none' : '';?>">
<span class="icon icon-info-sign"></span> <?php echo _('Create a CNAME record in your custom domain\'s DNS and point it to your Sendy installation\'s domain:');?>
<table class="table table-bordered" style="width: 300px;" id="cd_instructions">
<tbody>
<tr>
<th>Hostname</th>
<th>Type</th>
<th>Record</th>
</tr>
<tr>
<td><span class="customdomain" id="cd_example"><?php echo get_saved_data('custom_domain')=='' ? 'customdomain.com' : get_saved_data('custom_domain');?></span></td>
<td>CNAME</td>
<td>
<span id="sd">
<?php
//Get hostname
$parse = parse_url(get_app_info('path'));
$domain = $parse['host'];
if($domain=='')
{
$domain_exp = explode('/', get_app_info('path'));
$domain = $domain_exp[2];
}
echo $domain;
//Get installation URI
$uri_array = explode($domain, get_app_info('path'));
$uri = $uri_array[1];
?>
</span>
</td>
</tr>
</tbody>
</table>
<p>
<?php echo _('Before enabling your custom domain, test your custom domain setup by visiting the following URL and it should load your Sendy login page');?> →
<code><span id="protocol-test"><?php echo get_saved_data('custom_domain_protocol')=='' ? 'http' : get_saved_data('custom_domain_protocol');?></span>://<span id="hostname-test"><?php echo get_saved_data('custom_domain');?></span><?php echo $uri;?></code>
</p>
<p><?php echo _('Otherwise, <a href="https://sendy.co/troubleshooting#custom-domain-not-working" target="_blank" style="text-decoration: underline;">please see this troubleshooting tip</a>');?></p>
</div>
</div>
<br/>
<!-- Enabled/Disabled -->
<label class="control-label" for="custom_domain"><?php echo _('Enable custom domain?');?></label>
<div class="btn-group" data-toggle="buttons-radio">
<a href="javascript:void(0)" title="" class="btn" id="cd-enabled" style="text-decoration: none;" <?php echo $licensed_custom_domain_maxed && get_saved_data('custom_domain')=='' ? 'disabled' : ''; ?>><i class="icon icon-ok"></i> <?php echo _('Yes');?></a>
<a href="javascript:void(0)" title="" class="btn active" id="cd-disabled" style="text-decoration: none;" <?php echo $licensed_custom_domain_maxed && get_saved_data('custom_domain')=='' ? 'disabled' : ''; ?>><i class="icon icon-remove-sign"></i> <?php echo _('No');?></a>
</div>
<input type="hidden" name="custom_domain_status" id="custom_domain_status" value="0">
<script type="text/javascript">
$(document).ready(function() {
<?php
$custom_domain_enabled = get_saved_data('custom_domain_enabled');
if($custom_domain_enabled==1):
?>
$("#cd-enabled").button('toggle');
$("#custom_domain_status").val("1");
<?php else:?>
$("#cd-disabled").button('toggle');
$("#custom_domain_status").val("0");
<?php endif;?>
$("#cd-enabled").click(function(){
$("#custom_domain_status").val("1");
});
$("#cd-disabled").click(function(){
$("#custom_domain_status").val("0");
});
});
</script>
</div>
<br/><br/>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse2" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-ok"></span> <?php echo _('Google reCAPTCHA v2');?></h3></a>
</div>
<div id="collapse2" class="accordion-body collapse">
<div class="alert">
<span class="icon icon-info-sign"></span> <?php echo _('You can use Google\'s reCAPTCHA v2 to protect your subscription forms from spam bots. To enable, register your site on <a href="https://www.google.com/recaptcha/admin/create" target="_blank" style="text-decoration: underline;">Google\'s reCAPTCHA website</a> and select \'reCAPTCHA v2 > "I\'m not a robot" tickbox\' to get your \'Site key\' and \'Secret key\', then paste them below. reCAPTCHA will be disabled if the following fields are empty.');?>
</div>
<label class="control-label" for="recaptcha_sitekey"><?php echo _('Site key');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="recaptcha_sitekey" name="recaptcha_sitekey" placeholder="Site key" value="<?php echo get_saved_data('recaptcha_sitekey');?>" autocomplete="off">
</div>
</div>
<label class="control-label" for="recaptcha_secretkey"><?php echo _('Secret key');?></label>
<div class="control-group">
<div class="controls">
<input type="password" class="input-xlarge" id="recaptcha_secretkey" name="recaptcha_secretkey" placeholder="Secret key" value="<?php echo get_saved_data('recaptcha_secretkey');?>" autocomplete="new-password">
</div>
</div>
<br/>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse1" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-certificate"></span> <?php echo _('GDPR features');?></h3></a>
</div>
<div id="collapse1" class="accordion-body collapse">
<p class="alert"><span class="icon icon-info-sign"></span> <?php echo _('The <a href="https://www.eugdpr.org/the-regulation.html" target="_blank" style="text-decoration: underline;">General Data Protection Regulation (GDPR)</a> is a regulation in EU law on data protection and privacy for all individuals within the European Union. The GDPR regulation affects anyone in the world who collect and process the personal data of EU users. If you collect and process data of EU users, Sendy\'s GDPR features will be useful to you.')?></p>
<label class="control-label"><?php echo _('GDPR options');?></label>
<div class="control-group">
<div class="dashed-box">
<div class="checkbox">
<label><input type="checkbox" name="gdpr_options" <?php echo get_app_data('gdpr_options')==1 ? 'checked' : '';?>><?php echo _('Show me GDPR options where applicable');?> <br/><br/><i class="thirtytwo"><?php echo _('By enabling this option, GDPR features will show up in the app where appropriate. For example, subscribe form dialogues will present you with an option to enable \'GDPR fields\' amongst many others.');?></i></label>
</div>
</div>
</div>
<br/>
<label class="control-label"><?php echo _('GDPR safe switch');?></label>
<div class="control-group">
<div class="dashed-box">
<div class="checkbox">
<label><input type="checkbox" name="gdpr_only" <?php echo get_app_data('gdpr_only')==1 ? 'checked' : '';?>><?php echo _('Only send Campaigns to subscribers with <span class="label label-warning">GDPR</span> tag');?> <br/><br/><i class="thirtytwo"><?php echo _('Subscribers who signup through Sendy\'s \'Ready-to-use subscribe form\', the embeddable \'Subscribe form HTML code\' or the \'subscribe\' API with \'gdpr\' parameter set to \'true\' will be tagged with \'GDPR\'. By enabling this option, your future Campaigns will only send to subscribers tagged with \'GDPR\'.');?></i></label>
</div>
</div>
<br/>
<div class="dashed-box">
<div class="checkbox">
<label><input type="checkbox" name="gdpr_only_ar" <?php echo get_app_data('gdpr_only_ar')==1 ? 'checked' : '';?>><?php echo _('Only send Autoresponders to subscribers with <span class="label label-warning">GDPR</span> tag');?> <br/><br/><i class="thirtytwo"><?php echo _('Subscribers who signup through Sendy\'s \'Ready-to-use subscribe form\', the embeddable \'Subscribe form HTML code\' or the \'subscribe\' API with \'gdpr\' parameter set to \'true\' will be tagged with \'GDPR\'. By enabling this option, your future Autoresponders will only send to subscribers tagged with \'GDPR\'.');?></i></label>
</div>
</div>
</div>
<br/><br/>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse5" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-eye-open"></span> <?php echo _('Privacy');?></h3></a>
</div>
<div id="collapse5" class="accordion-body collapse">
<p class="alert"><span class="icon icon-info-sign"></span> <?php echo _('Set your default email tracking preference when creating new campaigns or autoresponders. This can still be changed on the fly when you create new campaigns or autoresponders.')?></p>
<p>
<?php echo _('Track opens');?>:
<div class="btn-group tracking" data-toggle="buttons-radio">
<a href="javascript:void(0)" title="<?php echo _('Enable opens tracking');?>" class="btn" id="opens_tracking_on" data-placement="right"><i class="icon icon-ok"></i> <?php echo _('Yes');?></a>
<a href="javascript:void(0)" title="<?php echo _('Disable opens tracking');?>" class="btn" id="opens_tracking_off"><i class="icon icon-remove-sign"></i> <?php echo _('No');?></a>
<a href="javascript:void(0)" title="<?php echo _('Track opens without identifying users to respect their privacy');?>" class="btn" id="opens_tracking_anon"><i class="icon icon-ok"></i> <?php echo _('Anonymously');?></a>
</div>
<script type="text/javascript">
$(document).ready(function() {
<?php
$opens_tracking = get_saved_data('opens_tracking');
if($opens_tracking==1):
?>
$("#opens_tracking_on").button('toggle');
$("#opens").val("1");
<?php elseif($opens_tracking==0):?>
$("#opens_tracking_off").button('toggle');
$("#opens").val("0");
<?php elseif($opens_tracking==2):?>
$("#opens_tracking_anon").button('toggle');
$("#opens").val("2");
<?php endif;?>
$("#opens_tracking_on").click(function(){
$("#opens").val("1");
});
$("#opens_tracking_off").click(function(){
$("#opens").val("0");
});
$("#opens_tracking_anon").click(function(){
$("#opens").val("2");
});
});
</script>
</p>
<br/>
<p>
<?php echo _('Track clicks');?>:
<div class="btn-group tracking" data-toggle="buttons-radio">
<a href="javascript:void(0)" title="<?php echo _('Enable clicks tracking');?>" class="btn" id="clicks_tracking_on" data-placement="right"><i class="icon icon-ok"></i> <?php echo _('Yes');?></a>
<a href="javascript:void(0)" title="<?php echo _('Disable clicks tracking');?>" class="btn" id="clicks_tracking_off"><i class="icon icon-remove-sign"></i> <?php echo _('No');?></a>
<a href="javascript:void(0)" title="<?php echo _('Track clicks without identifying users to respect their privacy');?>" class="btn" id="clicks_tracking_anon"><i class="icon icon-ok"></i> <?php echo _('Anonymously');?></a>
</div>
<script type="text/javascript">
$(document).ready(function() {
<?php
$links_tracking = get_saved_data('links_tracking');
if($links_tracking==1):
?>
$("#clicks_tracking_on").button('toggle');
$("#clicks").val("1");
<?php elseif($links_tracking==0):?>
$("#clicks_tracking_off").button('toggle');
$("#clicks").val("0");
<?php elseif($links_tracking==2):?>
$("#clicks_tracking_anon").button('toggle');
$("#clicks").val("2");
<?php endif;?>
$("#clicks_tracking_on").click(function(){
$("#clicks").val("1");
});
$("#clicks_tracking_off").click(function(){
$("#clicks").val("0");
});
$("#clicks_tracking_anon").click(function(){
$("#clicks").val("2");
});
});
</script>
</p>
<input type="hidden" name="opens" id="opens" value="">
<input type="hidden" name="clicks" id="clicks" value="">
<br/><br/>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse4" class="accordion-toggle" data-parent="#accordion" data-toggle="collapse"><h3><span class="icon icon-reorder"></span> <?php echo _('Miscellaneous');?></h3></a>
</div>
<div id="collapse4" class="accordion-body collapse">
<br/>
<label class="control-label" for="query_string" style="width:70%;"><?php echo _('Default URL query string');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="query_string" name="query_string" placeholder="utm_source=newsletter&utm_medium=sendy&utm_campaign=email_marketing" value="<?php echo get_saved_data('query_string');?>" style="width: 70%;" autocomplete="off">
<br/>
<span><i class="thirtytwo"><?php echo _('(Default query string to append to all links in your campaigns and autoresponders. A good use case is Google Analytics tracking. Don\'t include \'?\' in your query string.)')?></i></span>
</div>
</div>
<br/>
<label class="control-label" for="test_email_prefix"><?php echo _('Prefix for subject line of test emails');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="test_email_prefix" name="test_email_prefix" placeholder="[Test]" value="<?php echo get_saved_data('test_email_prefix');?>" autocomplete="off">
<br/>
<span><i class="thirtytwo"><?php echo _('(Optionally add a prefix to the subject line of test emails)')?></i></span>
</div>
</div>
<br/>
<label class="control-label" for="allowed_attachments"><?php echo _('Allowed attachments file types');?></label>
<div class="control-group">
<div class="controls">
<input type="text" class="input-xlarge" id="allowed_attachments" name="allowed_attachments" placeholder="jpeg,jpg,gif,png,pdf,zip" value="<?php echo get_saved_data('allowed_attachments');?>" autocomplete="off">
<br/>
<span><i class="thirtytwo"><?php echo _('(Empty field to disable attachments in campaigns)')?></i></span>
</div>
</div>
<br/>
<label class="control-label" for="sort-by"><?php echo _('Sort lists and templates by');?></label>
<div class="control-group">
<div class="controls">
<!-- Choice -->
<select name="sort-by" id="sort-by">
<option value="date" id="sort-by-date" <?php if(get_saved_data('templates_lists_sorting')=='date'):?>selected="selected"<?php endif;?>><?php echo _('Date added');?></option>
<option value="name" id="sort-by-name" <?php if(get_saved_data('templates_lists_sorting')=='name'):?>selected="selected"<?php endif;?>><?php echo _('Name');?></option>
</select>
</div>
</div>
<br/>
<label class="control-label" for="campaign_report_rows"><?php echo _('No. of rows to show in campaigns, reports, lists and rules');?></label>
<div class="control-group">
<div class="input-prepend input-append">
<input type="text" class="input-xlarge" id="campaign_report_rows" name="campaign_report_rows" placeholder="10" value="<?php echo get_saved_data('campaign_report_rows');?>" style="width: 80px;" autocomplete="off"><span class="add-on"><?php echo _('rows per page');?></span>
</div>
</div>
<br/>
<label class="control-label"><?php echo _('Default opt-in method');?>:</label>
<div class="btn-group" data-toggle="buttons-radio" style="margin-top: 5px;">
<a href="javascript:void(0)" title="" class="btn" id="single"><i class="icon icon-angle-right"></i> <?php echo _('Single Opt-In');?></a>
<a href="javascript:void(0)" title="" class="btn" id="double"><i class="icon icon-double-angle-right"></i> <?php echo _('Double Opt-In');?></a>
</div>
<br/>
<label class="control-label" style="margin-top: 17px;"><?php echo _('Hide hidden lists');?>:</label>
<div class="btn-group tracking" data-toggle="buttons-radio">
<a href="javascript:void(0)" title="" class="btn" id="hide_hidden_lists_on"><i class="icon icon-ok"></i> <?php echo _('Yes');?></a>
<a href="javascript:void(0)" title="" class="btn" id="hide_hidden_lists_off"><i class="icon icon-remove-sign"></i> <?php echo _('No');?></a>
</div>
<script type="text/javascript">
$(document).ready(function() {
//Show / hide hidden lists
<?php
$hide_hidden_lists = get_saved_data('hide_lists');
if($hide_hidden_lists==1):
?>
$("#hide_hidden_lists_on").button('toggle');
$("#hide_lists").val("1");
<?php elseif($hide_hidden_lists==0):?>
$("#hide_hidden_lists_off").button('toggle');
$("#hide_lists").val("0");
<?php endif;?>
$("#hide_hidden_lists_on").click(function(){
$("#hide_lists").val("1");
});
$("#hide_hidden_lists_off").click(function(){
$("#hide_lists").val("0");
});
//Default opt-in method
<?php
$opt_in = get_saved_data('opt_in');
if($opt_in==0):
?>
$("#single").button('toggle');
$("#opt_in").val("0");
<?php else:?>
$("#double").button('toggle');
$("#opt_in").val("1");
<?php endif;?>
$("#single").click(function(){
$("#opt_in").val("0");
});
$("#double").click(function(){
$("#opt_in").val("1");
});
});
</script>
<input type="hidden" name="opt_in" id="opt_in" value="<?php echo $opt_in;?>">
<input type="hidden" name="hide_lists" id="hide_lists" value="">
<input type="hidden" name="id" value="<?php echo get_app_info('app');?>">
<br/>
</div>
</div>
<br/>
<button type="submit" class="btn btn-inverse"><i class="icon-ok icon-white"></i> <?php echo _('Save');?></button>
</div>
</div>
<div class="span5">
<h2><?php echo _('Brand settings');?></h2><br/>
<div class="alert alert-info"><i class="icon icon-info-sign"></i> <?php echo _('If you\'re creating this brand for your client, you can allow them to send newsletters on their own at a fee you preset below.');?> <?php echo _('Send the');?> <strong><?php echo _('Client login details');?></strong> <?php echo _('to your client so that they can login to manage lists, subscribers and send newsletters.');?><br/><br/><?php echo _('Also, don\'t forget to set your PayPal account email address in');?> <a href="<?php echo get_app_info('path');?>/settings" style="text-decoration: underline;"><?php echo _('Settings');?></a>.</div>
<div class="well">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapse2_1" class="accordion-toggle" data-parent="#accordion2" data-toggle="collapse"><h3><span class="icon icon-lock"></span> <?php echo _('Client login details');?></h3></a>
</div>
<div id="collapse2_1" class="accordion-body collapse in">
<p><strong><?php echo _('Login URL');?></strong>:
<span id="loginurl">
<?php
$parse = parse_url(get_app_info('path'));
$protocol = $parse['scheme'];
$domain = $parse['host'];
$path = $parse['path'];
if(get_saved_data('custom_domain')=='' || get_saved_data('custom_domain_enabled')==0)
echo '<span id="sendy_protocol">'.$protocol.'</span>'.'://'.'<span class="customdomain" id="sendy_domain">'.$domain.'</span>'.$path;
else
echo '<span id="sendy_protocol">'.get_saved_data('custom_domain_protocol').'</span>'.'://'.'<span class="customdomain" id="sendy_domain">'.get_saved_data('custom_domain').'</span>'.$path;
?>
</span>
</p>
<p><strong><?php echo _('Login email');?></strong>: <input type="text" name="login_email" id="login_email" placeholder="<?php echo _('name@domain.com');?>" value="<?php echo get_login_data('username');?>" style="margin-top: 5px;" autocomplete="off"/></p>
<div class="alert alert-danger" id="duplicate-login-email" style="display:none;"><i class="icon icon-warning-sign"></i> <?php echo _('This login email is already in use by your main login email address set in your main Settings. Please use another email address or remove the email address from the field.');?> </div>
<p><strong><?php echo _('Password');?></strong>: <span id="generate-password-wrapper"><a href="javascript:void(0)" style="text-decoration:underline;" id="generate-password"><?php echo _('Generate new password');?></a></span></p>
<?php if(get_login_data('auth_enabled')):?>
<p id="2fa-text"><?php echo _('Two-factor authentication is currently <strong class="label label-success">enabled</strong>');?></p>
<p id="disable-2fa-btn">
<button id="disable-two-factor-btn" class="btn">
<span class="icon icon-key"></span> <?php echo _('Disable two-factor authentication');?>
</button>
</p>
<script type="text/javascript">
$("#disable-two-factor-btn").click(function(e){
e.preventDefault();
if(confirm("Are you sure you want to disable two-factor authentication?"))
{
$.post("<?php echo get_app_info("path");?>/includes/settings/two-factor.php", { enable: 0, otp: 0, uid: <?php echo get_login_data('id');?> },
function(data) {
if(data)
{
$("#disable-2fa-btn").slideUp();
$("#2fa-text").html("<?php echo _('Two-factor authentication is currently <strong class=\"label\">disabled</strong>').'<br/><i>'._('(two-factor authentication can only be enabled by the brand user while logged in to their account)').'</i>';?>");
$("#2fa-text i").addClass("thirtytwo");
} else alert("<?php echo _('Unable to save. Please try again.');?>");
}
);
}
});
</script>
<?php else:?>
<p><?php echo _('Two-factor authentication is currently <strong class="label">disabled</strong>');?><br/><i class="thirtytwo"><?php echo _('(two-factor authentication can only be enabled by the brand user while logged in to their account)');?></i></p>
<?php endif;?>
<script type="text/javascript">
$("#generate-password").click(function(){
$("#form").submit();
$.post('<?php echo get_app_info('path');?>/includes/app/generate-password.php', {app: <?php echo get_app_info('app');?>, brand_name: $("#app_name").val(), from_name: $("#from_name").val(), from_email: $("#from_email").val()},
function(data) {
if(data)
{
$("#generate-password-wrapper").html(data);
}
}
);
});
</script>
<p><strong><strong><?php echo _('Language');?></strong>: </strong>
<select id="language" name="language" style="margin-top:5px;">
<option value="<?php echo get_login_data('language');?>"><?php echo get_login_data('language');?></option>
<?php
if($handle = opendir('locale'))