forked from craigk5n/webcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pref.php
926 lines (847 loc) · 38.8 KB
/
pref.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
<?php
require_once 'includes/init.php';
// Force the CSS cache to clear by incrementing webcalendar_csscache cookie.
$webcalendar_csscache = 1;
if ( isset ( $_COOKIE['webcalendar_csscache'] ) ) {
$webcalendar_csscache += $_COOKIE['webcalendar_csscache'];
}
sendCookie ( 'webcalendar_csscache', $webcalendar_csscache );
function save_pref( $prefs, $src) {
global $prefuser;
foreach ($prefs as $key => $value) {
if ( $src == 'post' ) {
$setting = substr ( $key, 5 );
$prefix = substr ( $key, 0, 5 );
if ( $prefix != 'pref_')
continue;
// Validate key name. Should start with "pref_" and not include
// any unusual characters that might be an SQL injection attack.
if ( ! preg_match ( '/pref_[A-Za-z0-9_]+$/', $key ) )
die_miserable_death ( str_replace ( 'XXX', $key,
translate ( 'Invalid setting name XXX.' ) ) );
} else {
$setting = $key;
$prefix = 'pref_';
}
//echo "Setting = $setting, key = $key, prefix = $prefix<br>\n";
if ( strlen ( $setting ) > 0 && $prefix == 'pref_' ) {
$sql = 'DELETE FROM webcal_user_pref WHERE cal_login = ? ' .
'AND cal_setting = ?';
dbi_execute ( $sql, [$prefuser, $setting] );
if ( strlen ( $value ) > 0 ) {
$setting = strtoupper ( $setting );
$sql = 'INSERT INTO webcal_user_pref ' .
'( cal_login, cal_setting, cal_value ) VALUES ' .
'( ?, ?, ? )';
if ( ! dbi_execute ( $sql, [$prefuser, $setting, $value] ) ) {
$error = 'Unable to update preference: ' . dbi_error() .
'<br><br><span class="bold colon">SQL</span>' . $sql;
break;
}
}
}
}
}
$message = '';
// Handle "Reset Preferences" button
$action = getValue('action');
if ($action == "reset" && empty($error)) {
$user = getValue('user');
if ($user != $login && ! $is_admin) {
// Make sure this person is either an admin or the owner/admin of the nonuser cal.
if (!user_is_nonuser_admin($login, $user)) {
// This user not authorized.
$error = translate('Not authorized');
}
}
if(empty($error)) {
dbi_execute('DELETE FROM webcal_user_pref WHERE cal_login = ?', [$user]);
$message = translate('Preferences reset to system defaults.');
}
}
$public = getGetValue ('public');
$user = getGetValue ('user');
$updating_public = false;
load_global_settings();
if ( $is_admin && ! empty ( $public ) && $PUBLIC_ACCESS == 'Y' ) {
$updating_public = true;
load_user_preferences ( '__public__' );
$prefuser = '__public__';
} elseif ( ! empty ( $user ) && $user != $login && ($is_admin || $is_nonuser_admin)) {
$prefuser = $user;
load_user_preferences ( $user );
} else {
$prefuser = $login;
// Reload preferences so any css changes will take effect
load_user_preferences();
}
if ( ! empty ( $_POST ) && empty ( $error )) {
save_pref ( $_POST, 'post' );
// Reload preferences
load_user_preferences();
}
if ($user != $login)
$user = (($is_admin || $is_nonuser_admin) && $user) ? $user : $login;
// Load categories only if editing our own calendar
//if (!$user || $user == $login) load_user_categories();
load_user_categories();
// Reload preferences into $prefarray[].
// Get system settings first.
$prefarray = [];
$res = dbi_execute ( 'SELECT cal_setting, cal_value FROM webcal_config ' );
if ( $res ) {
while ( $row = dbi_fetch_row ( $res ) ) {
$prefarray[$row[0]] = $row[1];
}
dbi_free_result ( $res );
}
//get user settings
$res = dbi_execute ( 'SELECT cal_setting, cal_value FROM webcal_user_pref
WHERE cal_login = ?', [$prefuser] );
if ( $res ) {
while ( $row = dbi_fetch_row ( $res ) ) {
$prefarray[$row[0]] = $row[1];
}
dbi_free_result ( $res );
}
//this will force $LANGUAGE to to the current value and eliminate having
//to double click the 'SAVE' button
$translation_loaded = false;
//move this include here to allow proper translation
require_once 'includes/date_formats.php';
// Make sure global values passed to styles.php are for this user.
// Makes the demo calendar accurate.
$GLOBALS['BGCOLOR'] = $prefarray['BGCOLOR'];
$GLOBALS['H2COLOR'] = $prefarray['H2COLOR'];
$GLOBALS['TODAYCELLBG'] = $prefarray['TODAYCELLBG'];
$GLOBALS['TABLEBG'] = $prefarray['TABLEBG'];
$GLOBALS['TABLEBG'] = $prefarray['TABLEBG'];
$GLOBALS['THBG'] = $prefarray['THBG'];
$GLOBALS['CELLBG'] = $prefarray['CELLBG'];
$GLOBALS['WEEKENDBG'] = $prefarray['WEEKENDBG'];
$GLOBALS['OTHERMONTHBG'] = $prefarray['OTHERMONTHBG'];
$GLOBALS['FONTS'] = $prefarray['FONTS'];
$GLOBALS['MYEVENTS'] = $prefarray['MYEVENTS'];
$colors = [
'BGCOLOR' => translate('Document background'),
'H2COLOR' => translate('Document title'),
'TEXTCOLOR' => translate('Document text'),
'MYEVENTS' => translate('My event text'),
'TABLEBG' => translate('Table grid color'),
'THBG' => translate('Table header background'),
'THFG' => translate('Table header text'),
'CELLBG' => translate('Table cell background'),
'TODAYCELLBG' => translate('Table cell background for current day'),
'HASEVENTSBG' => translate('Table cell background for days with events'),
'WEEKENDBG' => translate('Table cell background for weekends'),
'OTHERMONTHBG' => translate('Table cell background for other month'),
'WEEKNUMBER' => translate('Week number color'),
'POPUP_BG' => translate('Event popup background'),
'POPUP_FG' => translate('Event popup text')
];
$color_sets = '';
foreach ($colors as $k => $v) {
$handler = 'color_change_handler_' . $k;
$color_sets .= print_color_input_html ( $k, $v, '', '', 'p', '', $handler );
}
//determine if we can set timezones, if not don't display any options
$can_set_timezone = set_env ( 'TZ', $prefarray['TIMEZONE'] );
$dateYmd = date ( 'Ymd' );
$selected = ' selected ';
$minutesStr = translate ( 'minutes' );
//allow css_cache to display public or NUC values
$_SESSION['webcal_tmp_login'] = $prefuser;
//Prh ... add user to edit_template to get/set correct template
$openStr ="\"window.open( 'edit_template.php?type=%s&user=%s','cal_template','dependent,menubar,scrollbars,height=500,width=500,outerHeight=520,outerWidth=520' );\"";
$INC = [];
print_header();
?>
<h2><?php
if ( $updating_public )
echo translate ($PUBLIC_ACCESS_FULLNAME) . ' ';
etranslate ( 'Preferences' );
if ( $is_nonuser_admin || ( $is_admin && substr ( $prefuser, 0, 5 ) == '_NUC_' ) ) {
nonuser_load_variables ( $user, 'nonuser' );
echo ': ' . $nonuserfullname . "\n";
}
$qryStr = ( ! empty ( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' );
$formaction = substr ($self, strrpos($self, '/') + 1) . $qryStr;
$formaction = preg_replace('/action=reset/', 'action=save', $formaction);
?> <img src="images/bootstrap-icons/question-circle-fill.svg" alt="<?php etranslate ( 'Help' )?>" class="help" onclick="window.open( 'help_pref.php', 'cal_help', 'dependent,menubar,scrollbars,height=400,width=400,innerHeight=420,outerWidth=420' );"></h2>
<!-- Message -->
<div id="main-dialog-message" class="alert alert-info" style="<?php echo (empty($message) ? "display: none" : "display: block");?>"">
<span id="infoMessage"><?php echo $message;?></span>
<button type="button" class="close" onclick="$('.alert').hide()">×</button>
</div>
<form action="<?php echo htmlspecialchars($formaction) ?>" method="post" name="prefform">
<?php
print_form_key();
if ($user)
echo "<input type=\"hidden\" name=\"user\" value=\"$user\">\n";
echo display_admin_link();
$resetConfirm = translate('Are you sure you want to reset preferences for XXX?');
$resetConfirm = str_replace("XXX", $user, $resetConfirm);
?>
<div class="form-row">
<button class="btn btn-primary mr-2" name="" type="submit"><?php
etranslate ( 'Save Preferences' )?></button>
<input type="hidden" name="action" value="save">
<a class="btn btn-secondary mr-2" href="pref.php?action=reset&user=<?php echo $user;?>&csrf_form_key=<?php echo getFormKey();?>"
onclick="return confirm('<?php echo $resetConfirm;?>')"><?php etranslate("Reset Preferences");?></a>
<?php if ( $updating_public ) { ?>
<input type="hidden" name="public" value="1">
<?php } /*if ( $updating_public )*/
// If user is admin of a non-user cal, and non-user cal is "public"
// (meaning it is a public calendar that requires no login), then allow
// the current user to modify prefs for that nonuser cal
if ( $is_admin && ! $updating_public ) {
if ( empty ( $public ) && ! empty ( $PUBLIC_ACCESS ) &&
$PUBLIC_ACCESS == 'Y' ) {
$public_option = '<a class="dropdown-item" href="pref.php?public=1">'
. translate( 'Public Access calendar' ) . "</a>\n";
}
}
if ( $NONUSER_ENABLED == 'Y' || $PUBLIC_ACCESS == 'Y' ) {
if ( ( empty ( $user ) || $user == $login ) && ! $updating_public ) {
$nulist = get_my_nonusers ( $login );
if (!empty($nulist)) {
?>
<div class="dropdown">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">
<?php etranslate('Manage Preferences for Resource, Remote and Public Calendars');?>
</button>
<div class="dropdown-menu">
<?php
if (!empty($public_option)) {
echo $public_option . "\n";
}
for ($i = 0, $cnt = count($nulist); $i < $cnt; $i++) {
echo '<a class="dropdown-item" href="pref.php?user=' . $nulist[$i]['cal_login'] . '">' .
$nulist[$i]['cal_fullname'] . "</a>\n";
}
?>
</div>
</div>
<?php
}
} else {
$linktext = translate ( 'Return to My Preferences' );
echo "<br><a title=\"$linktext\" class=\"btn btn-secondary\" href=\"pref.php\">« $linktext </a>";
}
}
?>
</div>
<br><br>
<!-- TABS -->
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#settings"><?php etranslate('Settings');?></a></li>
<?php if ( $SEND_EMAIL == 'Y' ) { ?>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#email"><?php etranslate('Email');?></a></li>
<?php } ?>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#boss"><?php etranslate('When I am the boss');?></a></li>
<?php if ( $PUBLISH_ENABLED == 'Y' || $RSS_ENABLED == 'Y' ) { ?>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#subscribe"><?php etranslate('Subscribe/Publish');?></a></li>
<?php } ?>
<?php if ( $ALLOW_USER_HEADER == 'Y' && ( $CUSTOM_SCRIPT == 'Y' || $CUSTOM_HEADER == 'Y' ||
$CUSTOM_TRAILER == 'Y' ) ) { ?>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#header"><?php etranslate('Custom Scripts');?></a></li>
<?php } ?>
<?php if ( $ALLOW_COLOR_CUSTOMIZATION == 'Y' ) { ?>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#colors"><?php etranslate('Colors');?></a></li>
<?php } ?>
</ul>
<!-- TABS BODY -->
<div class="tab-content mb-12">
<!-- DETAILS -->
<div class="tab-pane container active" id="settings"><div class="form-group">
<fieldset class="border p-2">
<legend><?php etranslate ('Language')?></legend>
<table cellspacing="1" cellpadding="2">
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("language-help");?>" valign="top">
<label for="pref_lang"><?php etranslate ('Language')?>:</label></td><td>
<select class="form-control" name="pref_LANGUAGE" id="pref_lang">
<?php
define_languages(); //load the language list
reset ( $languages );
foreach ($languages as $key => $val) {
// Don't allow users to select browser-defined. We want them to pick
// a language so that when we send reminders (done without the benefit
// of a browser-preferred language), we'll know which language to use.
// DO let them select browser-defined for the public user or NUC.
if ( $key != 'Browser-defined' || $updating_public || $is_admin ||
$is_nonuser_admin ) {
echo '<option value="' . $val . '"';
if ( $val == $prefarray['LANGUAGE'] ) echo $selected;
echo '>' . $key . "</option>\n";
}
}
?>
</select>
<br>
<?php echo str_replace( 'XXX', translate( get_browser_language( true ) ),
translate( 'Your browser default language is XXX.' ) ); ?>
</td></tr>
</table>
</fieldset>
<fieldset class="border p-2">
<legend><?php etranslate ('Date and Time')?></legend>
<table cellspacing="1" cellpadding="2">
<?php if ( $can_set_timezone == true ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("tz-help");?>" valign="top">
<label for="pref_TIMEZONE" class="colon"><?php etranslate ('Timezone Selection')?>:</label></td><td>
<?php
if ( empty ( $prefarray['TIMEZONE'] ) ) $prefarray['TIMEZONE'] = $SERVER_TIMEZONE;
echo print_timezone_select_html ( 'pref_', $prefarray['TIMEZONE']);
?>
</td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
<?php } //end $can_set_timezone ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("date-format-help");?>" valign="top">
<label for="pref_DATE_FORMAT"><?php etranslate ('Date format')?>:</label></td><td>
<select class="form-control" name="pref_DATE_FORMAT">
<?php
for ( $i = 0, $cnt = count ( $datestyles ); $i < $cnt; $i += 2 ) {
echo '<option value="' . $datestyles[$i] . '"';
if ( $prefarray['DATE_FORMAT'] == $datestyles[$i] )
echo $selected;
echo '>' . $datestyles[$i + 1] . "</option>\n";
}
?>
</select> <?php echo date_to_str ( $dateYmd,
$DATE_FORMAT, false, false );?>
<br>
<select class="form-control" name="pref_DATE_FORMAT_MY">
<?php
for ( $i = 0, $cnt = count ( $datestyles_my ); $i < $cnt; $i += 2 ) {
echo '<option value="' . $datestyles_my[$i] . '"';
if ( $prefarray['DATE_FORMAT_MY'] == $datestyles_my[$i] )
echo $selected;
echo '>' . $datestyles_my[$i + 1] . "</option>\n";
}
?>
</select> <?php echo date_to_str ( $dateYmd,
$DATE_FORMAT_MY, false, false );?>
<br>
<select class="form-control" name="pref_DATE_FORMAT_MD">
<?php
for ( $i = 0, $cnt = count ( $datestyles_md ); $i < $cnt; $i += 2 ) {
echo '<option value="' . $datestyles_md[$i] . '"';
if ( $prefarray['DATE_FORMAT_MD'] == $datestyles_md[$i] )
echo $selected;
echo '>' . $datestyles_md[$i + 1] . "</option>\n";
}
?>
</select> <?php echo date_to_str ( $dateYmd,
$DATE_FORMAT_MD, false, false );?>
<br>
<select class="form-control" name="pref_DATE_FORMAT_TASK">
<?php
for ( $i = 0, $cnt = count ( $datestyles_task ); $i < $cnt; $i += 2 ) {
echo '<option value="' . $datestyles_task[$i] . '"';
if ( $prefarray['DATE_FORMAT_TASK'] == $datestyles_task[$i] )
echo $selected;
echo '>' . $datestyles_task[$i + 1] . "</option>\n";
}
?>
</select> <?php echo translate ( 'Small Task Date' ) . ' ' .
date_to_str( $dateYmd, $DATE_FORMAT_TASK, false, false );?>
</td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("preferred-event-visibility");?>"><label for="pref_DEFAULT_VISIBILITY"><?php
etranslate ('Default Visibility')?>:</label></td><td>
<select class="form-control" name="pref_DEFAULT_VISIBILITY" id="pref_DEFAULT_VISIBILITY">
<option value="P"
<?php if (isset($prefarray['DEFAULT_VISIBILITY']) &&
$prefarray['DEFAULT_VISIBILITY'] == 'P') {
echo " selected ";
}
echo ">" . translate('Public');
?> </option>
<option value="R"
<?php if (empty($prefarray['DEFAULT_VISIBILITY'] ) ||
$prefarray['DEFAULT_VISIBILITY'] == 'R') {
echo " selected ";
}
echo ">" . translate('Private');
?> </option>
<option value="C"
<?php if (isset($prefarray['DEFAULT_VISIBILITY']) &&
$prefarray['DEFAULT_VISIBILITY'] == 'C') {
echo " selected ";
}
echo ">" . translate('Confidential');
?> </option>
</select>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("time-format-help");?>">
<label for="pref_TIME_FORMAT"><?php etranslate ('Time format')?>:</label></td><td class="form-inline mt-1 mb-2">
<?php echo print_radio ( 'TIME_FORMAT',
['12'=>translate ( '12 hour' ), '24'=>translate ( '24 hour' )] ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-week-starts-on");?>">
<label for="pref_WEEK_START"><?php etranslate ('Week starts on')?>:</label></td><td>
<select class="form-control" name="pref_WEEK_START" id="pref_WEEK_START">
<?php
for ( $i = 0; $i < 7; $i++ ) {
echo "<option value=\"$i\"" .
( $i == $prefarray['WEEK_START'] ? $selected : '' ) .
'>' . weekday_name ( $i ) . "</option>\n";
}
?>
</select>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-weekend-starts-on");?>">
<label for="pref_WEEKEND_START"><?php etranslate ('Weekend starts on')?>:</label></td><td>
<select class="form-control" name="pref_WEEKEND_START" id="pref_WEEKEND_START">
<?php
for ( $i = -1; $i < 6; $i++ ) {
$j = ( $i == -1 ? 6 : $i ); //make sure start with Saturday
echo "<option value=\"$j\"" .
( $j == $prefarray['WEEKEND_START'] ? $selected : '' ) .
'>' . weekday_name ( $j ) . "</option>\n";
}
?>
</select>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("work-hours-help");?>">
<label for="pref_starthr"><?php etranslate ('Work hours')?>:</label></td><td class="form-inline mt-1 mb-2">
<?php etranslate ('From')?>
<select class="form-control" name="pref_WORK_DAY_START_HOUR" id="pref_starthr">
<?php
for ( $i = 0; $i < 24; $i++ ) {
echo "<option value=\"$i\"" .
( $i == $prefarray['WORK_DAY_START_HOUR'] ? $selected :'' ) .
">" . display_time ( $i * 10000, 1 ) . "</option>\n";
}
?>
</select>
<?php etranslate ('to')?>
<select class="form-control" name="pref_WORK_DAY_END_HOUR" id="pref_endhr">
<?php
for ( $i = 0; $i < 24; $i++ ) {
echo "<option value=\"$i\"" .
( $i == $prefarray['WORK_DAY_END_HOUR'] ? $selected : '' ) .
">" . display_time ( $i * 10000, 1 ) . "</option>\n";
}
?>
</select>
</td></tr>
</table>
</fieldset>
<fieldset class="border p-2">
<legend><?php etranslate ('Appearance')?></legend>
<table cellspacing="1" cellpadding="2">
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("preferred-view-help");?>"><label for="pref_STARTVIEW"><?php
etranslate ('Preferred view')?>:</label></td><td>
<select class="form-control" name="pref_STARTVIEW" id="pref_STARTVIEW">
<?php
// For backwards compatibility. We used to store without the .php extension
if ( $prefarray['STARTVIEW'] == 'month' || $prefarray['STARTVIEW'] == 'day' ||
$prefarray['STARTVIEW'] == 'week' || $prefarray['STARTVIEW'] == 'year' )
$prefarray['STARTVIEW'] .= '.php';
$choices = $choices_text = [];
if ( access_can_access_function ( ACCESS_DAY, $user ) ) {
$choices[] = 'day.php';
$choices_text[] = translate ( 'Day' );
}
if ( access_can_access_function ( ACCESS_WEEK, $user ) ) {
$choices[] = 'week.php';
$choices_text[] = translate ( 'Week' );
}
if ( access_can_access_function ( ACCESS_MONTH, $user ) ) {
$choices[] = 'month.php';
$choices_text[] = translate ( 'Month' );
}
if ( access_can_access_function ( ACCESS_YEAR, $user ) ) {
$choices[] = 'year.php';
$choices_text[] = translate ( 'Year' );
}
for ( $i = 0, $cnt = count ( $choices ); $i < $cnt; $i++ ) {
echo '<option value="' . $choices[$i] . '" ';
if ( $prefarray['STARTVIEW'] == $choices[$i] )
echo $selected;
echo ' >' . htmlspecialchars ( $choices_text[$i] ) . "</option>\n";
}
// Allow user to select a view also
for ( $i = 0, $cnt = count ( $views ); $i < $cnt; $i++ ) {
if ( $views[$i]['cal_owner'] != $user && $views[$i]['cal_is_global'] != 'Y' )
continue;
$xurl = $views[$i]['url'];
echo '<option value="';
echo $xurl . '" ';
$xurl_strip = str_replace ( '&', '&', $xurl );
if ( $prefarray['STARTVIEW'] == $xurl_strip )
echo $selected;
echo '>' . htmlspecialchars ( $views[$i]['cal_name'] ) . "</option>\n";
}
?>
</select>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("fonts-help");?>">
<label for="pref_font"><?php etranslate ( 'Fonts')?></label></td><td>
<input class="form-control" type="text" size="40" name="pref_FONTS" id="pref_font" value="<?php echo htmlspecialchars ( $prefarray['FONTS'] );?>">
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-sm_month-help");?>">
<label for="pref_DISPLAY_SM_MONTH"><?php etranslate ( 'Display small months' )?>:</label></td><td class="form-inline mt-1 mb-2">
<?php echo print_radio ( 'DISPLAY_SM_MONTH' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-weekends-help");?>">
<label for="pref_DISPLAY_WEEKENDS"><?php etranslate ( 'Display weekends' )?>:</label></td><td class="form-inline mt-1 mb-2">
<?php echo print_radio ( 'DISPLAY_WEEKENDS' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-long-daynames-help");?>">
<label for="pref_DISPLAY_LONG_DAYS"><?php etranslate ( 'Display long day names' )?>:</label></td><td class="form-inline mt-1 mb-2">
<?php echo print_radio ( 'DISPLAY_LONG_DAYS' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-minutes-help");?>">
<label for="pref_DISPLAY_MINUTES"><?php etranslate ( 'Display 00 minutes always' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_MINUTES' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-end-times-help");?>">
<label for="pref_DISPLAY_END_TIMES"><?php etranslate ( 'Display end times on calendars' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_END_TIMES' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-alldays-help");?>">
<label for="pref_DISPLAY_ALL_DAYS_IN_MONTH"><?php etranslate ( 'Display all days in month view' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_ALL_DAYS_IN_MONTH' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-week-number-help");?>">
<label for="pref_DISPLAY_WEEKNUMBER"><?php etranslate ( 'Display week number' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_WEEKNUMBER' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-tasks-help");?>">
<label for="pref_DISPLAY_TASKS"><?php etranslate ( 'Display small task list' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_TASKS' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-tasks-in-grid-help");?>">
<label for="pref_DISPLAY_TASKS_IN_GRID"><?php etranslate ( 'Display tasks in Calendars' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_TASKS_IN_GRID' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("lunar-help");?>">
<label for="pref_DISPLAY_MOON_PHASES"><?php etranslate ( 'Display Lunar Phases in month view' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_MOON_PHASES' ) ?>
</td></tr>
</table>
</fieldset>
<fieldset class="border p-2">
<legend><?php etranslate ('Events')?></legend>
<table cellspacing="1" cellpadding="2">
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-unapproved-help");?>">
<label for="pref_DISPLAY_UNAPPROVED"><?php etranslate ( 'Display unapproved' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_UNAPPROVED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("timed-evt-len-help");?>">
<label for="pref_TIMED_EVT_LEN"><?php etranslate ( 'Specify timed event length by' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'TIMED_EVT_LEN',
['D'=>translate ( 'Duration' ), 'E'=>translate ( 'End Time' )] ) ?>
</td></tr>
<?php if ( ! empty ( $categories ) ) { ?>
<tr><td>
<label for="pref_cat"><?php etranslate ( 'Default Category' )?>:</label></td><td>
<select class="form-control" name="pref_CATEGORY_VIEW" id="pref_cat">
<?php
if ( ! empty ( $categories ) ) {
foreach ( $categories as $K => $V ) {
echo "<option value=\"$K\"";
if ( ! empty ( $prefarray['CATEGORY_VIEW'] ) &&
$prefarray['CATEGORY_VIEW'] == $K ) echo $selected;
echo ">" . htmlentities ( $V['cat_name'] ) . "</option>\n";
}
}
?>
</select>
</td></tr>
<?php } //end if (! empty ($categories ) ) ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("crossday-help");?>">
<label><?php etranslate ( 'Disable Cross-Day Events' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISABLE_CROSSDAY_EVENTS' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display-desc-print-day-help");?>">
<label for="pref_DISPLAY_DESC_PRINT_DAY"><?php etranslate ( 'Display description in printer day view' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_DESC_PRINT_DAY' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("entry-interval-help");?>">
<label for="pref_ENTRY_SLOTS"><?php etranslate ( 'Entry interval' )?>:</label></td><td>
<select class="form-control" name="pref_ENTRY_SLOTS">
<option value="24" <?php if ( $prefarray['ENTRY_SLOTS'] == "24" )
echo $selected?>>1 <?php etranslate ( 'hour' )?></option>
<option value="48" <?php if ( $prefarray['ENTRY_SLOTS'] == "48" )
echo $selected?>>30 <?php echo $minutesStr ?></option>
<option value="72" <?php if ( $prefarray['ENTRY_SLOTS'] == "72" )
echo $selected?>>20 <?php echo $minutesStr ?></option>
<option value="96" <?php if ( $prefarray['ENTRY_SLOTS'] == "96" )
echo $selected?>>15 <?php echo $minutesStr ?></option>
<option value="144" <?php if ( $prefarray['ENTRY_SLOTS'] == "144" )
echo $selected?>>10 <?php echo $minutesStr ?></option>
<option value="288" <?php if ( $prefarray['ENTRY_SLOTS'] == "288" )
echo $selected?>>5 <?php echo $minutesStr ?></option>
<option value="1440" <?php if ( $prefarray['ENTRY_SLOTS'] == "1440" )
echo $selected?>>1 <?php etranslate ( 'minute' )?></option>
</select>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("time-interval-help");?>">
<label for="pref_TIME_SLOTS"><?php etranslate ( 'Time interval' )?>:</label></td><td>
<select class="form-control" name="pref_TIME_SLOTS">
<option value="24" <?php if ( $prefarray['TIME_SLOTS'] == "24" )
echo $selected?>>1 <?php etranslate ( 'hour' )?></option>
<option value="48" <?php if ( $prefarray['TIME_SLOTS'] == "48" )
echo $selected?>>30 <?php echo $minutesStr ?></option>
<option value="72" <?php if ( $prefarray['TIME_SLOTS'] == "72" )
echo $selected?>>20 <?php echo $minutesStr ?></option>
<option value="96" <?php if ( $prefarray['TIME_SLOTS'] == "96" )
echo $selected?>>15 <?php echo $minutesStr ?></option>
<option value="144" <?php if ( $prefarray['TIME_SLOTS'] == "144" )
echo $selected?>>10 <?php echo $minutesStr ?></option>
</select>
</td></tr>
</table>
</fieldset>
<fieldset class="border p-2">
<legend><?php etranslate ('Miscellaneous')?></legend>
<table cellspacing="1" cellpadding="2">
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("auto-refresh-help");?>">
<label for="pref_AUTO_REFRESH"><?php etranslate ( 'Auto-refresh calendars' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'AUTO_REFRESH' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("auto-refresh-time-help");?>">
<label for="pref_AUTO_REFRESH_TIME"><?php etranslate ( 'Auto-refresh time' )?>:</label></td><td class="form-inline mt-1">
<nobr><input class="form-control" type="text" name="pref_AUTO_REFRESH_TIME" size="3" value="<?php echo ( empty ( $prefarray['AUTO_REFRESH_TIME'] ) ? 0 : $prefarray['AUTO_REFRESH_TIME'] ); ?>"> <?php etranslate ( 'minutes' )?></nobr>
</td></tr>
</table>
</fieldset>
</div>
</div>
<!-- END SETTINGS -->
<?php
if ( ! $updating_public ) {
if ( $SEND_EMAIL == 'Y' ) { ?>
<div class="tab-pane container fade" id="email"><div class="form-group">
<table cellspacing="1" cellpadding="2">
<tr><td class="tooltip">
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-format");?>">
<label for="pref_EMAIL_HTML"><?php etranslate ( 'Email format preference' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_HTML',
['Y'=> translate ( 'HTML' ), 'N'=>translate ( 'Plain Text' )] ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-include-ics");?>">
<label for="pref_EMAIL_ATTACH_ICS"><?php etranslate ( 'Include iCalendar attachments' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_ATTACH_ICS', '', '', 0 ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-reminders-help");?>">
<label for="pref_EMAIL_REMINDER"><?php etranslate ( 'Event reminders' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_REMINDER' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-added");?>">
<label for="pref_EMAIL_EVENT_ADDED"><?php etranslate ( 'Events added to my calendar' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_EVENT_ADDED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-updated");?>">
<label for="pref_EMAIL_EVENT_UPDATED"><?php etranslate ( 'Events updated on my calendar' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_EVENT_UPDATED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-deleted");?>">
<label for="pref_EMAIL_EVENT_DELETED"><?php etranslate ( 'Events removed from my calendar' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_EVENT_DELETED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-rejected");?>">
<label for="pref_EMAIL_EVENT_REJECTED"><?php etranslate ( 'Event rejected by participant' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_EVENT_REJECTED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("email-event-create");?>">
<label for="pref_EMAIL_EVENT_CREATE"><?php etranslate ( 'Event that I create' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_EVENT_CREATE' ) ?>
</td></tr>
</table>
</div></div>
<!-- END EMAIL -->
<?php } ?>
<div class="tab-pane container fade" id="boss"><div class="form-group">
<table cellspacing="1" cellpadding="2">
<?php if ( $SEND_EMAIL == 'Y' ) { ?>
<tr><td><label for="pref_EMAIL_ASSISTANT_EVENTS"><?php etranslate ( 'Email me event notification' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'EMAIL_ASSISTANT_EVENTS' ) ?>
</td></tr>
<?php } //end email ?>
<tr><td><label for="pref_APPROVE_ASSISTANT_EVENT"><?php etranslate ( 'I want to approve events' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'APPROVE_ASSISTANT_EVENT' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("display_byproxy-help");?>">
<label for="pref_DISPLAY_CREATED_BYPROXY"><?php etranslate ( 'Display if created by Assistant' )?>:</label></td>
<td class="form-inline mt-1">
<?php echo print_radio ( 'DISPLAY_CREATED_BYPROXY' ) ?>
</td></tr>
</table>
</div></div>
<!-- END BOSS -->
<?php } /* if ( ! $updating_public ) */ ?>
<div class="tab-pane container fade" id="subscribe"><div class="form-group">
<table cellspacing="1" cellpadding="2">
<?php if ( $PUBLISH_ENABLED == 'Y' || $RSS_ENABLED == 'Y') { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("allow-view-subscriptions-help");?>">
<label for="pref_USER_REMOTE_ACCESS"><?php etranslate ( 'Allow remote viewing of' );
$publish_access = ( empty( $prefarray['USER_REMOTE_ACCESS'] )
? 0 : $prefarray['USER_REMOTE_ACCESS'] );
?>:</label></td><td>
<select class="form-control" name="pref_USER_REMOTE_ACCESS" id="pref_USER_REMOTE_ACCESS">
<option value="0" <?php echo ( $publish_access == '0' ?
$selected : '' ) . ' >' . translate ( 'Public' ) . ' ' .
translate ( 'entries' )?></option>
<option value="1" <?php echo ( $publish_access == '1' ?
$selected : '' ) . ' >' . translate ( 'Public' ) . ' & ' .
translate ( 'Confidential' ) . ' ' . translate ( 'entries' )?></option>
<option value="2" <?php echo ( $publish_access == '2' ?
$selected : '' ) . ' >' . translate ( 'All' ) . ' ' .
translate ( 'entries' )?></option>
</select>
</td></tr>
<?php }
if ( $PUBLISH_ENABLED == 'Y' ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("allow-remote-subscriptions-help");?>">
<label for="USER_PUBLISH_ENABLED"><?php etranslate ( 'Allow remote subscriptions' )?>:</label></td><td class="form-inline mt-1">
<?php echo print_radio ( 'USER_PUBLISH_ENABLED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("remote-subscriptions-url-help");?>">
<label><?php etranslate ( 'URL' )?>:</label></td>
<td>
<?php
echo htmlspecialchars ( getServerUrl() ) .
'publish.php/' . ( $updating_public ? '__public__' : $user ) . '.ics';
echo "<br>\n";
echo htmlspecialchars ( getServerUrl() ) .
'publish.php?user=' . ( $updating_public ? '__public__' : $user );
?></td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("allow-remote-publishing-help");?>">
<label for="pref_USER_PUBLISH_RW_ENABLED"><?php etranslate ( 'Allow remote publishing' )?>:</label></td>
<td class="form-inline mt-1">
<?php echo print_radio ( 'USER_PUBLISH_RW_ENABLED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("remote-publishing-url-help");?>">
<label><?php etranslate ( 'URL' )?>:</label></td>
<td>
<?php
echo htmlspecialchars ( getServerUrl() ) .
'icalclient.php';
?></td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
<?php
} /* $PUBLISH_ENABLED */
if ( $RSS_ENABLED == 'Y' ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("rss-enabled-help");?>">
<label for="pref_USER_RSS_ENABLED"><?php etranslate ( 'Enable RSS feed' )?>:</label></td>
<td class="form-inline mt-1">
<?php echo print_radio ( 'USER_RSS_ENABLED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("rss-feed-url-help");?>">
<label><?php etranslate ( 'URL' )?>:</label></td>
<td>
<?php
echo htmlspecialchars ( getServerUrl() ) .
'rss.php?user=' . ( $updating_public ? '__public__' : $user );
?></td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
<?php
} /* $RSS_ENABLED */ ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("freebusy-enabled-help");?>">
<label for="pref_FREEBUSY_ENABLED"><?php etranslate ( 'Enable FreeBusy publishing' )?>:</label></td>
<td class="form-inline mt-1">
<?php echo print_radio ( 'FREEBUSY_ENABLED' ) ?>
</td></tr>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("freebusy-url-help");?>">
<label><?php etranslate ( 'URL' )?>:</label></td>
<td>
<?php
echo htmlspecialchars ( getServerUrl() ) .
'freebusy.php/' . ( $updating_public ? '__public__' : $user ) . '.ifb';
echo "<br>\n";
echo htmlspecialchars ( getServerUrl() ) .
'freebusy.php?user=' . ( $updating_public ? '__public__' : $user );
?></td></tr>
<tr><td height="0.5 em"><!-- small vertical spacing--><span style="font-size: 25%"> </span> </td></tr>
</table>
</div></div>
<!-- END SUBSCRIBE -->
<?php if ( $ALLOW_USER_HEADER == 'Y' ) { ?>
<div class="tab-pane container fade" id="header"><div class="form-group">
<table cellspacing="1" cellpadding="2">
<?php if ( $CUSTOM_SCRIPT == 'Y' ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("custom-script-help");?>">
<label><?php etranslate ( 'Custom script/stylesheet' )?>:</label></td><td>
<button class="form-control btn bth-secondary" name="" type="button"
onclick=<?php printf ( $openStr, 'S', $prefuser ) ?>><?php
etranslate ( 'Edit' );?>...</button>
</td></tr>
<?php }
if ( $CUSTOM_HEADER == 'Y' ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("custom-header-help");?>">
<label><?php etranslate ( 'Custom header' )?>:</label></td><td>
<button class="form-control btn btn-secondary" name="" type="button"
onclick="<?php printf ( $openStr, 'H', $prefuser ) ?>"><?php
etranslate ( 'Edit' );?>...</button>
</td></tr>
<?php }
if ( $CUSTOM_TRAILER == 'Y' ) { ?>
<tr><td data-toggle="tooltip" data-placement="top" title="<?php etooltip ("custom-trailer-help");?>">
<label><?php etranslate ( 'Custom trailer' )?>:</label></td><td>
<button class="form-control btn btn-secondary" name="" type="button"
onclick=<?php printf ( $openStr, 'T', $prefuser ) ?>><?php
etranslate ( 'Edit' );?>...</button>
</td></tr>
<?php } ?>
</table>
</div></div>
<!-- END HEADER -->
<?php } // if $ALLOW_USER_HEADER ?>
<!-- BEGIN COLORS -->
<?php if ( $ALLOW_COLOR_CUSTOMIZATION == 'Y' ) { ?>
<div class="tab-pane container fade" id="colors"><div class="form-group">
<table>
<tr class="ignore"><td class="aligntop" width="50%">
<?php echo $color_sets;?>
<div><a href="#" class="btn btn-secondary" onclick="reset_colors(); return false;"><?php etranslate('Reset Colors');?></a></div>
</td><td class="aligncenter aligntop" width="50%">
<br>
<!-- BEGIN EXAMPLE MONTH -->
<p class="bold" style="text-align:center; color: var(--h2color)">
<?php
echo date_to_str(date('Ymd'), $DATE_FORMAT_MY, false);
echo "</p>\n";
echo display_month(date('m'), date('Y'), true);
?>
<!-- END EXAMPLE MONTH -->
</td></tr></table>
</div>
<!-- END COLORS -->
<?php } // if $ALLOW_COLOR_CUSTOMIZATION ?>
</div>
<!-- END TABS -->
<br><br>
<div>
<button class="btn btn-primary" name="" type="submit"><?php
etranslate ( 'Save Preferences' )?></button>
<br><br>
</div>
</form>
<script>
<?php
// Change the color in the current page
foreach ( $colors as $k => $v ) {
echo "function color_change_handler_$k() {\n";
echo " var color = $('#pref_" . $k . "').val();\n";
echo " $('body').get(0).style.setProperty('--" . strtolower($k) . "', color);\n";
echo "}\n";
}
?>
function reset_colors() {
<?php
foreach ( $colors as $k => $v ) {
echo " $('body').get(0).style.setProperty('--" . strtolower($k) . "', '$GLOBALS[$k]');\n";
echo " $('#pref_" . $k . "').val('$GLOBALS[$k]');\n";
}
?>
}
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<?php echo print_trailer(); ?>