forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.php
893 lines (776 loc) · 39.1 KB
/
options.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
<?php
/**
* Options page and form.
*
* @package ProjectSend
* @subpackage Options
*/
$allowed_levels = array(9);
require_once('bootstrap.php');
$section = ( !empty( $_GET['section'] ) ) ? $_GET['section'] : $_POST['section'];
switch ( $section ) {
case 'general':
$section_title = __('General options','cftp_admin');
$checkboxes = array(
'footer_custom_enable',
'files_descriptions_use_ckeditor',
'use_browser_lang',
);
break;
case 'clients':
$section_title = __('Clients','cftp_admin');
$checkboxes = array(
'clients_can_register',
'clients_auto_approve',
'clients_can_upload',
'clients_can_delete_own_files',
'clients_can_set_expiration_date',
);
break;
case 'privacy':
$section_title = __('Privacy','cftp_admin');
$checkboxes = array(
'privacy_noindex_site',
'enable_landing_for_all_files',
'public_listing_page_enable',
'public_listing_logged_only',
'public_listing_show_all_files',
'public_listing_use_download_link',
'page_policy_enable',
);
break;
case 'email':
$section_title = __('E-mail notifications','cftp_admin');
$checkboxes = array(
'mail_copy_user_upload',
'mail_copy_client_upload',
'mail_copy_main_user',
);
break;
case 'security':
$section_title = __('Security','cftp_admin');
$checkboxes = array(
'pass_require_upper',
'pass_require_lower',
'pass_require_number',
'pass_require_special',
'recaptcha_enabled',
);
break;
case 'branding':
$section_title = __('Branding','cftp_admin');
$checkboxes = array(
);
break;
case 'social_login':
$section_title = __('Social Login','cftp_admin');
$checkboxes = array(
);
break;
default:
$location = BASE_URI . 'options.php?section=general';
header("Location: $location");
die();
break;
}
$page_title = $section_title;
$active_nav = 'options';
include_once ADMIN_TEMPLATES_DIR . DS . 'header.php';
/** Form sent */
if ($_POST && validateCsrfToken()) {
/**
* Escape all the posted values on a single function.
* Defined on functions.php
*/
/** Values that can be empty */
$allowed_empty_values = array(
'mail_copy_addresses',
'mail_smtp_host',
'mail_smtp_port',
'mail_smtp_user',
'mail_smtp_pass',
'page_policy_title',
'page_policy_content',
);
if ( empty( $_POST['google_signin_enabled'] ) ) {
$allowed_empty_values[] = 'google_client_id';
$allowed_empty_values[] = 'google_client_secret';
}
if ( empty( $_POST['recaptcha_enabled'] ) ) {
$allowed_empty_values[] = 'recaptcha_site_key';
$allowed_empty_values[] = 'recaptcha_secret_key';
}
foreach ($checkboxes as $checkbox) {
$_POST[$checkbox] = (empty($_POST[$checkbox]) || !isset($_POST[$checkbox])) ? 0 : 1;
}
$keys = array_keys($_POST);
$options_total = count($keys);
$options_filled = 0;
$query_state = '0';
/**
* Check if all the options are filled.
*/
for ($i = 0; $i < $options_total; $i++) {
if (!in_array($keys[$i], $allowed_empty_values)) {
if (empty($_POST[$keys[$i]]) && $_POST[$keys[$i]] != '0') {
$query_state = '3';
}
else {
$options_filled++;
}
}
}
/** If every option is completed, continue */
if ($query_state == '0') {
$updated = 0;
for ($j = 0; $j < $options_total; $j++) {
$save = $dbh->prepare( "UPDATE " . TABLE_OPTIONS . " SET value=:value WHERE name=:name" );
$save->bindParam(':value', $_POST[$keys[$j]]);
$save->bindParam(':name', $keys[$j]);
$save->execute();
if ($save) {
$updated++;
}
}
if ($updated > 0){
$query_state = '1';
}
else {
$query_state = '2';
}
}
/** If uploading a logo on the branding page */
$file_logo = $_FILES['select_logo'];
if ( !empty( $file_logo ) ) {
$logo = option_file_upload( $file_logo, 'image', 'logo_filename', 29 );
$file_status = $logo['status'];
}
/** Redirect so the options are reflected immediatly */
while (ob_get_level()) ob_end_clean();
$section_redirect = html_output($_POST['section']);
$location = BASE_URI . 'options.php?section=' . $section_redirect;
if ( !empty( $query_state ) ) {
$location .= '&status=' . $query_state;
}
if ( !empty( $file_status ) ) {
$location .= '&file_status=' . $file_status;
}
header("Location: $location");
die();
}
/**
* Replace | with , to use the tags system when showing
* the allowed filetypes on the form. This value comes from
* site.options.php
*/
$allowed_file_types = str_replace('|',',',ALLOWED_FILE_TYPES);
/** Explode, sort, and implode the values to list them alphabetically */
$allowed_file_types = explode(',',$allowed_file_types);
sort($allowed_file_types);
/** If .php files are allowed, set the flag for the warning message */
if ( in_array( 'php', $allowed_file_types ) ) {
$php_allowed_warning = true;
}
$allowed_file_types = implode(',',$allowed_file_types);
?>
<div class="col-xs-12 col-sm-12 col-lg-6">
<?php
if (isset($_GET['status'])) {
switch ($_GET['status']) {
case '1':
$msg = __('Options updated succesfuly.','cftp_admin');
echo system_message('success',$msg);
break;
case '2':
$msg = __('There was an error. Please try again.','cftp_admin');
echo system_message('danger',$msg);
break;
case '3':
$msg = __('Some fields were not completed. Options could not be saved.','cftp_admin');
echo system_message('danger',$msg);
$show_options_form = 1;
break;
}
}
/** Logo uploading status */
if (isset($_GET['file_status'])) {
switch ($_GET['file_status']) {
case '1':
break;
case '2':
$msg = __('The file could not be moved to the corresponding folder.','cftp_admin');
$msg .= __("This is most likely a permissions issue. If that's the case, it can be corrected via FTP by setting the chmod value of the",'cftp_admin');
$msg .= ' '.ADMIN_UPLOADS_DIR.' ';
$msg .= __('directory to 755, or 777 as a last resource.','cftp_admin');
$msg .= __("If this doesn't solve the issue, try giving the same values to the directories above that one until it works.",'cftp_admin');
echo system_message('danger',$msg);
break;
case '3':
$msg = __('The file you selected is not an allowed format.','cftp_admin');
echo system_message('danger',$msg);
break;
case '4':
$msg = __('There was an error uploading the file. Please try again.','cftp_admin');
echo system_message('danger',$msg);
break;
}
}
?>
<div class="white-box">
<div class="white-box-interior">
<script type="text/javascript">
$(document).ready(function() {
$('#allowed_file_types').tagsInput({
'width' : 'auto',
'height' : 'auto',
'defaultText' : '',
});
$("form").submit(function() {
clean_form(this);
is_complete_all_options(this,'<?php _e('Please complete all the fields.','cftp_admin'); ?>');
// show the errors or continue if everything is ok
if (show_form_errors() == false) { alert('<?php _e('Please complete all the fields.','cftp_admin'); ?>'); return false; }
});
});
</script>
<form action="options.php" name="optionsform" method="post" enctype="multipart/form-data" class="form-horizontal">
<input type="hidden" name="csrf_token" value="<?php echo getCsrfToken(); ?>" />
<input type="hidden" name="section" value="<?php echo $section; ?>">
<?php
switch ( $section ) {
case 'general':
?>
<h3><?php _e('General','cftp_admin'); ?></h3>
<p><?php _e('Basic information to be shown around the site. The time format and zones values affect how the clients see the dates on their files lists.','cftp_admin'); ?></p>
<div class="form-group">
<label for="this_install_title" class="col-sm-4 control-label"><?php _e('Site name','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="this_install_title" id="this_install_title" class="form-control" value="<?php echo html_output(THIS_INSTALL_TITLE); ?>" />
</div>
</div>
<div class="form-group">
<label for="timezone" class="col-sm-4 control-label"><?php _e('Timezone','cftp_admin'); ?></label>
<div class="col-sm-8">
<?php
/**
* Generates a select field.
* Code is stored on a separate file since it's pretty long.
*/
include_once INCLUDES_DIR . DS . 'timezones.php';
?>
</div>
</div>
<div class="form-group">
<label for="timeformat" class="col-sm-4 control-label"><?php _e('Time format','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="timeformat" id="timeformat" value="<?php echo TIMEFORMAT; ?>" />
<p class="field_note"><?php _e('For example, d/m/Y h:i:s will result in something like','cftp_admin'); ?> <strong><?php echo date('d/m/Y h:i:s'); ?></strong>.
<?php _e('For the full list of available values, visit','cftp_admin'); ?> <a href="http://php.net/manual/en/function.date.php" target="_blank"><?php _e('this page','cftp_admin'); ?></a>.</p>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="footer_custom_enable">
<input type="checkbox" value="1" name="footer_custom_enable" id="footer_custom_enable" class="checkbox_options" <?php echo (FOOTER_CUSTOM_ENABLE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Use custom footer text",'cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<label for="footer_custom_content" class="col-sm-4 control-label"><?php _e('Footer content','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="footer_custom_content" id="footer_custom_content" class="form-control" value="<?php echo html_output(FOOTER_CUSTOM_CONTENT); ?>" />
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Editor','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="files_descriptions_use_ckeditor">
<input type="checkbox" value="1" name="files_descriptions_use_ckeditor" id="files_descriptions_use_ckeditor" class="checkbox_options" <?php echo (FILES_DESCRIPTIONS_USE_CKEDITOR == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Use the visual editor on files descriptions",'cftp_admin'); ?>
</label>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Language','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="use_browser_lang">
<input type="checkbox" value="1" name="use_browser_lang" id="use_browser_lang" class="checkbox_options" <?php echo (USE_BROWSER_LANG == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Detect user browser language",'cftp_admin'); ?>
<p class="field_note"><?php _e("If available, will override the default one from the system configuration file. Affects all users and clients.",'cftp_admin'); ?></p>
</label>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('System location','cftp_admin'); ?></h3>
<p class="text-warning"><?php _e('These options are to be changed only if you are moving the system to another place. Changes here can cause ProjectSend to stop working.','cftp_admin'); ?></p>
<div class="form-group">
<label for="base_uri" class="col-sm-4 control-label"><?php _e('System URI','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="base_uri" id="base_uri" value="<?php echo BASE_URI; ?>" />
</div>
</div>
<?php
break;
case 'clients':
?>
<h3><?php _e('New registrations','cftp_admin'); ?></h3>
<p><?php _e('Used only on self-registrations. These options will not apply to clients registered by system administrators.','cftp_admin'); ?></p>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="clients_can_register">
<input type="checkbox" value="1" name="clients_can_register" id="clients_can_register" class="checkbox_options" <?php echo (CLIENTS_CAN_REGISTER == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Clients can register themselves','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="clients_auto_approve">
<input type="checkbox" value="1" name="clients_auto_approve" id="clients_auto_approve" class="checkbox_options" <?php echo (CLIENTS_AUTO_APPROVE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Auto approve new accounts','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<label for="clients_auto_group" class="col-sm-4 control-label"><?php _e('Add clients to this group:','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="clients_auto_group" id="clients_auto_group">
<option value="0"><?php _e('None (does not enable this feature)','cftp_admin'); ?></option>
<?php
/** Fill the groups array that will be used on the form */
$get_groups = new \ProjectSend\GroupActions;
$arguments = array();
$groups = $get_groups->get_groups($arguments);
foreach ( $groups as $group ) {
?>
<option value="<?php echo filter_var($group["id"],FILTER_VALIDATE_INT); ?>"
<?php
if (CLIENTS_AUTO_GROUP == $group["id"]) {
echo 'selected="selected"';
}
?>
><?php echo html_output($group["name"]); ?>
</option>
<?php
}
?>
</select>
<p class="field_note"><?php _e('New clients will automatically be assigned to the group you have selected.','cftp_admin'); ?></p>
</div>
</div>
<div class="form-group">
<label for="clients_can_select_group" class="col-sm-4 control-label"><?php _e('Groups for which clients can request membership to:','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="clients_can_select_group" id="clients_can_select_group">
<?php
$pub_groups_options = array(
'none' => __("None",'cftp_admin'),
'public' => __("Public groups",'cftp_admin'),
'all' => __("All groups",'cftp_admin'),
);
foreach ( $pub_groups_options as $value => $label ) {
?>
<option value="<?php echo $value; ?>" <?php if (CLIENTS_CAN_SELECT_GROUP == $value) { echo 'selected="selected"'; } ?>><?php echo $label; ?></option>
<?php
}
?>
</select>
<p class="field_note"><?php _e('When a client registers a new account, an option will be presented to request becoming a member of a particular group.','cftp_admin'); ?></p>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Files','cftp_admin'); ?></h3>
<?php
/*<p><?php _e('Options related to the files that clients upload themselves.','cftp_admin'); ?></p>
*/
?>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="clients_can_upload">
<input type="checkbox" value="1" name="clients_can_upload" id="clients_can_upload" class="checkbox_options" <?php echo (CLIENTS_CAN_UPLOAD == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Clients can upload files','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="clients_can_delete_own_files">
<input type="checkbox" value="1" name="clients_can_delete_own_files" id="clients_can_delete_own_files" class="checkbox_options" <?php echo (CLIENTS_CAN_DELETE_OWN_FILES == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Clients can delete their own uploaded files','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="clients_can_set_expiration_date">
<input type="checkbox" value="1" name="clients_can_set_expiration_date" id="clients_can_set_expiration_date" class="checkbox_options" <?php echo (CLIENTS_CAN_SET_EXPIRATION_DATE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Clients can set expiration Date','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<label for="expired_files_hide" class="col-sm-4 control-label"><?php _e('When a file expires:','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="expired_files_hide" id="expired_files_hide">
<option value="1" <?php echo (EXPIRED_FILES_HIDE == '1') ? 'selected="selected"' : ''; ?>><?php _e("Don't show it on the files list",'cftp_admin'); ?></option>
<option value="0" <?php echo (EXPIRED_FILES_HIDE == '0') ? 'selected="selected"' : ''; ?>><?php _e("Show it anyway, but prevent download.",'cftp_admin'); ?></option>
</select>
<p class="field_note"><?php _e('This only affects clients. On the admin side, you can still get the files.','cftp_admin'); ?></p>
</div>
</div>
<?php
break;
case 'privacy':
?>
<h3><?php _e('Privacy','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="privacy_noindex_site">
<input type="checkbox" value="1" name="privacy_noindex_site" id="privacy_noindex_site" class="checkbox_options" <?php echo (PRIVACY_NOINDEX_SITE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Prevent search engines from indexing this site",'cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="enable_landing_for_all_files">
<input type="checkbox" value="1" name="enable_landing_for_all_files" id="enable_landing_for_all_files" class="checkbox_options" <?php echo (ENABLE_LANDING_FOR_ALL_FILES == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Enable information page for private files",'cftp_admin'); ?>
<p class="field_note"><?php _e("If enabled, the file information landing page will be available even for files that are not marked as private. Downloading them will stay restricted.",'cftp_admin'); ?></p>
</label>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Privacy policy page','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="page_policy_enable">
<input type="checkbox" value="1" name="page_policy_enable" id="page_policy_enable" class="checkbox_options" <?php echo (PAGE_POLICY_ENABLE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e("Enable this page",'cftp_admin'); ?>
<p class="field_note"><?php _e("If enabled, a link to it will be shown on the footer, both on public and private pages.",'cftp_admin'); ?></p>
</label>
</div>
</div>
<div class="form-group">
<label for="page_policy_title" class="col-sm-4 control-label"><?php _e('Page title','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" class="form-control empty" name="page_policy_title" id="page_policy_title" value="<?php echo html_output(PAGE_POLICY_TITLE); ?>" />
</div>
</div>
<div class="form-group">
<label for="page_policy_content" class="col-sm-4 control-label"><?php _e('Page content','cftp_admin'); ?></label>
<div class="col-sm-8">
<textarea name="page_policy_content" id="page_policy_content" class="ckeditor empty form-control"><?php echo html_output(PAGE_POLICY_CONTENT); ?></textarea>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Public groups and files listings page','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="public_listing_page_enable">
<input type="checkbox" value="1" name="public_listing_page_enable" id="public_listing_page_enable" class="checkbox_options" <?php echo (PUBLIC_LISTING_PAGE_ENABLE == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Enable page','cftp_admin'); ?>
</label>
<p class="field_note"><?php _e('The url for the listings page is','cftp_admin'); ?><br>
<a href="<?php echo PUBLIC_LANDING_URI; ?>" target="_blank">
<?php echo PUBLIC_LANDING_URI; ?>
</a></p>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="public_listing_logged_only">
<input type="checkbox" value="1" name="public_listing_logged_only" id="public_listing_logged_only" class="checkbox_options" <?php echo (PUBLIC_LISTING_LOGGED_ONLY == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Only for logged in clients','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="public_listing_show_all_files">
<input type="checkbox" value="1" name="public_listing_show_all_files" id="public_listing_show_all_files" class="checkbox_options" <?php echo (PUBLIC_LISTING_SHOW_ALL_FILES == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Inside groups show all files, including those that are not marked as public.','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="public_listing_use_download_link">
<input type="checkbox" value="1" name="public_listing_use_download_link" id="public_listing_use_download_link" class="checkbox_options" <?php echo (PUBLIC_LISTING_USE_DOWNLOAD_LINK == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('On public files, show the download link.','cftp_admin'); ?>
</label>
</div>
</div>
<div class="options_divide"></div>
<?php
break;
case 'email':
?>
<h3><?php _e('"From" information','cftp_admin'); ?></h3>
<div class="form-group">
<label for="admin_email_address" class="col-sm-4 control-label"><?php _e('E-mail address','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="admin_email_address" id="admin_email_address" class="form-control" value="<?php echo html_output(ADMIN_EMAIL_ADDRESS); ?>" />
</div>
</div>
<div class="form-group">
<label for="mail_from_name" class="col-sm-4 control-label"><?php _e('Name','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="mail_from_name" id="mail_from_name" class="form-control" value="<?php echo html_output(MAIL_FROM_NAME); ?>" />
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Send copies','cftp_admin'); ?></h3>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="mail_copy_user_upload">
<input type="checkbox" value="1" name="mail_copy_user_upload" id="mail_copy_user_upload" <?php echo (MAIL_COPY_USER_UPLOAD == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('When a system user uploads files','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="mail_copy_client_upload">
<input type="checkbox" value="1" name="mail_copy_client_upload" id="mail_copy_client_upload" <?php echo (MAIL_COPY_CLIENT_UPLOAD == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('When a client uploads files','cftp_admin'); ?>
</label>
</div>
</div>
<div class="options_nested_note">
<p><?php _e('Define here who will receive copies of this emails. These are sent as BCC so neither recipient will see the other addresses.','cftp_admin'); ?></p>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="mail_copy_main_user">
<input type="checkbox" value="1" name="mail_copy_main_user" class="mail_copy_main_user" <?php echo (MAIL_COPY_MAIN_USER == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Address supplied above (on "From")','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<label for="mail_copy_addresses" class="col-sm-4 control-label"><?php _e('Also to this addresses','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="mail_copy_addresses" id="mail_copy_addresses" class="mail_data empty form-control" value="<?php echo html_output(MAIL_COPY_ADDRESSES); ?>" />
<p class="field_note"><?php _e('Separate e-mail addresses with a comma.','cftp_admin'); ?></p>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('Expiration','cftp_admin'); ?></h3>
<div class="form-group">
<label for="notifications_max_tries" class="col-sm-4 control-label"><?php _e('Maximum sending attemps','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="number" name="notifications_max_tries" id="notifications_max_tries" class="form-control number_small" value="<?php echo NOTIFICATIONS_MAX_TRIES; ?>" step="1" min="1" max="100" />
<p class="field_note"><?php _e('Define how many times will the system attemp to send each notification.','cftp_admin'); ?></p>
</div>
</div>
<div class="form-group">
<label for="notifications_max_days" class="col-sm-4 control-label"><?php _e('Days before expiring','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="number" name="notifications_max_days" id="notifications_max_days" class="form-control number_small" value="<?php echo NOTIFICATIONS_MAX_DAYS; ?>" step="10" min="1" max="365" />
<p class="field_note"><?php _e('Notifications older than this will not be sent.','cftp_admin'); ?><br /><strong><?php _e('Set to 0 to disable.','cftp_admin'); ?></strong></p>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('E-mail sending options','cftp_admin'); ?></h3>
<p><?php _e('Here you can select which mail system will be used when sending the notifications. If you have a valid e-mail account, SMTP is the recommended option.','cftp_admin'); ?></p>
<div class="form-group">
<label for="mail_system_use" class="col-sm-4 control-label"><?php _e('Mailer','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="mail_system_use" id="mail_system_use">
<option value="mail" <?php echo (MAIL_SYSTEM_USE == 'mail') ? 'selected="selected"' : ''; ?>>PHP Mail (basic)</option>
<option value="smtp" <?php echo (MAIL_SYSTEM_USE == 'smtp') ? 'selected="selected"' : ''; ?>>SMTP</option>
<option value="gmail" <?php echo (MAIL_SYSTEM_USE == 'gmail') ? 'selected="selected"' : ''; ?>>Gmail</option>
<option value="sendmail" <?php echo (MAIL_SYSTEM_USE == 'sendmail') ? 'selected="selected"' : ''; ?>>Sendmail</option>
</select>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('SMTP & Gmail shared options','cftp_admin'); ?></h3>
<p><?php _e('You need to include your username (usually your e-mail address) and password if you have selected either SMTP or Gmail as your mailer.','cftp_admin'); ?></p>
<div class="form-group">
<label for="mail_smtp_user" class="col-sm-4 control-label"><?php _e('Username','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="mail_smtp_user" id="mail_smtp_user" class="mail_data empty form-control" value="<?php echo html_output(MAIL_SMTP_USER); ?>" />
</div>
</div>
<div class="form-group">
<label for="mail_smtp_pass" class="col-sm-4 control-label"><?php _e('Password','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="password" name="mail_smtp_pass" id="mail_smtp_pass" class="mail_data empty form-control" value="<?php echo html_output(MAIL_SMTP_PASS); ?>" />
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('SMTP options','cftp_admin'); ?></h3>
<p><?php _e('If you selected SMTP as your mailer, please complete these options.','cftp_admin'); ?></p>
<div class="form-group">
<label for="mail_smtp_host" class="col-sm-4 control-label"><?php _e('Host','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="mail_smtp_host" id="mail_smtp_host" class="mail_data empty form-control" value="<?php echo html_output(MAIL_SMTP_HOST); ?>" />
</div>
</div>
<div class="form-group">
<label for="mail_smtp_port" class="col-sm-4 control-label"><?php _e('Port','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="mail_smtp_port" id="mail_smtp_port" class="mail_data empty form-control" value="<?php echo html_output(MAIL_SMTP_PORT); ?>" />
</div>
</div>
<div class="form-group">
<label for="mail_smtp_auth" class="col-sm-4 control-label"><?php _e('Authentication','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="mail_smtp_auth" id="mail_smtp_auth">
<option value="none" <?php echo (MAIL_SMTP_AUTH == 'none') ? 'selected="selected"' : ''; ?>><?php _e('None','cftp_admin'); ?></option>
<option value="ssl" <?php echo (MAIL_SMTP_AUTH == 'ssl') ? 'selected="selected"' : ''; ?>>SSL</option>
<option value="tls" <?php echo (MAIL_SMTP_AUTH == 'tls') ? 'selected="selected"' : ''; ?>>TLS</option>
</select>
</div>
</div>
<?php
break;
case 'security':
?>
<h3><?php _e('Allowed file extensions','cftp_admin'); ?></h3>
<p><?php _e('Be careful when changing this options. They could affect not only the system but the whole server it is installed on.','cftp_admin'); ?></p>
<div class="form-group">
<label for="file_types_limit_to" class="col-sm-4 control-label"><?php _e('Extensions','cftp_admin'); ?></label>
<div class="col-sm-8">
<input name="allowed_file_types" id="allowed_file_types" value="<?php echo $allowed_file_types; ?>" />
<p class="field_note">
<strong><?php _e('Important','cftp_admin'); ?></strong>: <?php _e('Separate allowed file types with a comma.','cftp_admin'); ?>
</p>
</div>
</div>
<div class="form-group">
<label for="file_types_limit_to" class="col-sm-4 control-label"><?php _e('Limit file types uploading to','cftp_admin'); ?></label>
<div class="col-sm-8">
<select class="form-control" name="file_types_limit_to" id="file_types_limit_to">
<option value="noone" <?php echo (FILE_TYPES_LIMIT_TO == 'noone') ? 'selected="selected"' : ''; ?>><?php _e('No one','cftp_admin'); ?></option>
<option value="all" <?php echo (FILE_TYPES_LIMIT_TO == 'all') ? 'selected="selected"' : ''; ?>><?php _e('Everyone','cftp_admin'); ?></option>
<option value="clients" <?php echo (FILE_TYPES_LIMIT_TO == 'clients') ? 'selected="selected"' : ''; ?>><?php _e('Clients only','cftp_admin'); ?></option>
</select>
</div>
</div>
<?php
if ( isset( $php_allowed_warning ) && $php_allowed_warning == true ) {
$msg = __('Warning: php extension is allowed. This is a serious security problem. If you are not sure that you need it, please remove it from the list.','cftp_admin');
echo system_message('danger',$msg);
}
?>
<div class="options_divide"></div>
<h3><?php _e('Passwords','cftp_admin'); ?></h3>
<p><?php _e('When setting up a password for an account, require at least:','cftp_admin'); ?></p>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="pass_require_upper">
<input type="checkbox" value="1" name="pass_require_upper" id="pass_require_upper" class="checkbox_options" <?php echo (PASS_REQUIRE_UPPER == 1) ? 'checked="checked"' : ''; ?> /> <?php echo $json_strings['validation']['req_upper']; ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="pass_require_lower">
<input type="checkbox" value="1" name="pass_require_lower" id="pass_require_lower" class="checkbox_options" <?php echo (PASS_REQUIRE_LOWER == 1) ? 'checked="checked"' : ''; ?> /> <?php echo $json_strings['validation']['req_lower']; ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="pass_require_number">
<input type="checkbox" value="1" name="pass_require_number" id="pass_require_number" class="checkbox_options" <?php echo (PASS_REQUIRE_NUMBER == 1) ? 'checked="checked"' : ''; ?> /> <?php echo $json_strings['validation']['req_number']; ?>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="pass_require_special">
<input type="checkbox" value="1" name="pass_require_special" id="pass_require_special" class="checkbox_options" <?php echo (PASS_REQUIRE_SPECIAL == 1) ? 'checked="checked"' : ''; ?> /> <?php echo $json_strings['validation']['req_special']; ?>
</label>
</div>
</div>
<div class="options_divide"></div>
<h3><?php _e('reCAPTCHA','cftp_admin'); ?></h3>
<p><?php _e('Helps prevent SPAM on your registration form.','cftp_admin'); ?></p>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<label for="recaptcha_enabled">
<input type="checkbox" value="1" name="recaptcha_enabled" id="recaptcha_enabled" class="checkbox_options" <?php echo (RECAPTCHA_ENABLED == 1) ? 'checked="checked"' : ''; ?> /> <?php _e('Use reCAPTCHA','cftp_admin'); ?>
</label>
</div>
</div>
<div class="form-group">
<label for="recaptcha_site_key" class="col-sm-4 control-label"><?php _e('Site key','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="recaptcha_site_key" id="recaptcha_site_key" class="form-control empty" value="<?php echo html_output(RECAPTCHA_SITE_KEY); ?>" />
</div>
</div>
<div class="form-group">
<label for="recaptcha_secret_key" class="col-sm-4 control-label"><?php _e('Secret key','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="recaptcha_secret_key" id="recaptcha_secret_key" class="form-control empty" value="<?php echo html_output(RECAPTCHA_SECRET_KEY); ?>" />
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<a href="<?php echo LINK_DOC_RECAPTCHA; ?>" class="external_link" target="_blank"><?php _e('How do I obtain this credentials?','cftp_admin'); ?></a>
</div>
</div>
<?php
break;
case 'branding':
?>
<h3><?php _e('Current logo','cftp_admin'); ?></h3>
<p><?php _e('Use this page to upload your company logo, or update the currently assigned one. This image will be shown to your clients when they access their file list.','cftp_admin'); ?></p>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000">
<div id="current_logo">
<div id="current_logo_img">
<?php echo get_branding_layout(true); // true: returns the thumbnail, not the full image ?>
</div>
</div>
<div id="form_upload_logo">
<div class="form-group">
<label class="col-sm-4 control-label"><?php _e('Select image to upload','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="file" name="select_logo" class="empty" accept=".jpg, .jpeg, .jpe, .gif, .png, .svg" />
</div>
</div>
</div>
<?php
break;
case 'social_login':
?>
<h3><?php _e('Google','cftp_admin'); ?></h3>
<div class="options_column">
<div class="form-group">
<label for="google_signin_enabled" class="col-sm-4 control-label"><?php _e('Enabled','cftp_admin'); ?></label>
<div class="col-sm-8">
<select name="google_signin_enabled" id="google_signin_enabled" class="form-control">
<option value="1" <?php echo (GOOGLE_SIGNIN_ENABLED == '1') ? 'selected="selected"' : ''; ?>><?php _e('Yes','cftp_admin'); ?></option>
<option value="0" <?php echo (GOOGLE_SIGNIN_ENABLED == '0') ? 'selected="selected"' : ''; ?>><?php _e('No','cftp_admin'); ?></option>
</select>
</div>
</div>
<div class="form-group">
<label for="google_client_id" class="col-sm-4 control-label"><?php _e('Client ID','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="google_client_id" id="google_client_id" class="form-control empty" value="<?php echo html_output(GOOGLE_CLIENT_ID); ?>" />
</div>
</div>
<div class="form-group">
<label for="google_client_secret" class="col-sm-4 control-label"><?php _e('Client Secret','cftp_admin'); ?></label>
<div class="col-sm-8">
<input type="text" name="google_client_secret" id="google_client_secret" class="form-control empty" value="<?php echo html_output(GOOGLE_CLIENT_SECRET); ?>" />
</div>
</div>
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<a href="<?php echo LINK_DOC_GOOGLE_SIGN_IN; ?>" class="external_link" target="_blank"><?php _e('How do I obtain this credentials?','cftp_admin'); ?></a>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<?php _e('Callback URI','cftp_admin'); ?>
</div>
<div class="col-sm-8">
<span class="format_url"><?php echo BASE_URI . 'sociallogin/google/callback.php'; ?></span>
</div>
</div>
</div>
<?php
break;
}
?>
<div class="options_divide"></div>
<div class="after_form_buttons">
<button type="submit" class="btn btn-wide btn-primary empty"><?php _e('Save options','cftp_admin'); ?></button>
</div>
</form>
</div>
</div>
</div>
<?php
include_once ADMIN_TEMPLATES_DIR . DS . 'footer.php';