diff --git a/Makefile b/Makefile index b6853e235..d1ef3e064 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,17 @@ -# Makefile for copying files downloaded using composer into the proper location -# for use with WebCalendar. +# Makefile for copying files downloaded using composer +# into the proper location for use with WebCalendar. # We only copy the min number of files required from the vendor directory. # Also, compute the SHA hash to use with the integrity tag. -# We don't want WebCalendar releases to bundle every single file in the vendor directory. +# We don't want WebCalendar releases to bundle +# every single file in the vendor directory. +# # Also, composer dependency management sucks at asset management. # -# NOTE: This Makefile does not work on macos, just linux. This is because there is -# no sha384sum command on macos. If you're on a Mac, you can use docker to setup -# a linux container where (after installing xdd), you can run make to generate the -# sha files. +# NOTE: This Makefile does not work on macos, just linux. +# This is because there is no sha384sum command on macos. +# If you're on a Mac, you can use docker to setup +# a linux container where (after installing xdd), +# you can run make to generate the sha files. PHPMAILER_DIR = includes/classes/phpmailer PHPMAILER_VENDOR_DIR = vendor/phpmailer/phpmailer/src @@ -130,7 +133,7 @@ includes/load_assets.php: \ pub/jquery.min.js \ pub/jquery.min.js.sha echo ' $@ - echo '// Auto-generated by make. Do not hand-edit.' >> $@ + echo '// Auto-generated by make. Do not hand-edit.' >> $@ echo '// See Makefile in source for details..' >> $@ echo '// Last updated: ' | tr -d '\012' >> $@ date >> $@ @@ -169,20 +172,24 @@ pub/jquery.min.js.sha: pub/jquery.min.js $(SHA384SUM) # To get the list of files we need for the "basic" install of ckeditor, # I downloaded the "basic package" from the website: # https://ckeditor.com/ckeditor-4/download -# Then I looked at what was included to make the list of files we need -# to copy over from the vendor/ckeditor directory (which includes -# enough for the "full package" of 72 plugins and adds about 15Mb instead -# of the 2Mb for basic. -# To create this list from the unzipped ckeditor download, cd into the unzipped -# 'ckeditor' dir and use this command: +# Then I looked at what was included to make the list of files +# we need to copy over from the 'vendor/ckeditor' directory +# (which includes enough for the "full package" of 72 plugins +# and adds about 15Mb instead of the 2Mb for basic). +# To create this list from the unzipped ckeditor download, +# cd into the unzipped 'ckeditor' dir and use this command: +# # find * -type f | grep -v samples | grep -v config.js | grep -v 'adapters/' | sed 's/^/\t/' | sed 's/$/ \\/' | sed 's/promise.js ./promise.js/' -# NOTE: We do not include the config.js provides by composer because it defaults to -# the full ckeditor distribution with all plugins (15+ Mb). Instead, I've downloaed -# the config.js from the 4.18 basic build and copied it manually into pub/ckeditor. -# It's possible we may need to update the pub/ckeditor/config.js file manually if -# a new 4.X release requires updates to this file. -# NOTE #2: This Makefile is assuming that the README.md file gets updated with -# each CKEditor update (seems like a safe assumption.) +# +# NOTE: We do not include the 'config.js' provided by composer +# because it defaults to the full ckeditor distribution +# with all plugins (15+ Mb). +# Instead, I've downloaded the 'config.js' from the 4.18 basic build +# and copied it manually into pub/ckeditor. +# It's possible we may need to update the 'pub/ckeditor/config.js' file +# manually if a new 4.X release requires updates to this file. +# NOTE #2: This Makefile is assuming that the 'README.md' file gets +# updated with each CKEditor update (seems like a safe assumption) CKEDITOR_FILES = \ pub/ckeditor/CHANGES.md \ pub/ckeditor/LICENSE.md \ @@ -305,4 +312,3 @@ pub/ckeditor/CHANGES.md: $(CKEDITOR_VENDOR_DIR)/ckeditor/CHANGES.md echo "Copying file: $${f}"; \ cp $${a} $${f}; \ done - diff --git a/about.php b/about.php index 5ef0be1fd..3dd83eeaa 100644 --- a/about.php +++ b/about.php @@ -27,9 +27,9 @@ $replacements[] = ''; $data = preg_replace ( $patterns, $replacements, $data ); } -print_header ( [], '', - '', true, false, true ); -echo '
' +print_header ( ['css/about.css'], '', '', true, false, true ); +echo ' +
' . ( empty ( $credits ) ? ' diff --git a/access.php b/access.php index c98c16f62..ccb0e8053 100644 --- a/access.php +++ b/access.php @@ -158,12 +158,10 @@ } } } -print_header( '', - ' - ', - ( $op['time'] === 'Y' ? 'onload="enableAll(true);"' : '' ) ); + +print_header ( ['css/access.css', 'js/access.js'], '', + ( ! empty( $op['time'] ) && $op['time'] == 'Y' + ? 'onload="enableAll( true );"' : '' ) ); echo print_success( $saved ); diff --git a/activity_log.php b/activity_log.php index d4d4d1dbd..aa0169b54 100644 --- a/activity_log.php +++ b/activity_log.php @@ -34,8 +34,7 @@ -
-
'; - -echo "\n -\n" . $cch . " + function reset_colors() {" . $rc . ' + } + '; } else { // if $error echo print_error ( $error, true ); diff --git a/adminhome.php b/adminhome.php index 7388457b3..17fef78d0 100644 --- a/adminhome.php +++ b/adminhome.php @@ -149,18 +149,7 @@ $_SESSION['webcal_tmp_login'] = 'SheIsA1Fine!'; -print_header( '', -/* - ' - If this is the proper way to call css_cacher.php from here? - */ - ' - ' ); +print_header(); echo '

' . translate( 'Administrative Tools' ) . '

diff --git a/assistant_edit.php b/assistant_edit.php index cabfd71c3..b1c216e5d 100644 --- a/assistant_edit.php +++ b/assistant_edit.php @@ -10,8 +10,7 @@ if ( $user != $login ) $user = ( ( $is_admin || $is_nonuser_admin ) && $user ) ? $user : $login; -print_header( '', ! $GROUPS_ENABLED == 'Y' ? '' : - '' ); +print_header ( $GROUPS_ENABLED !== 'Y' ? [] : ['js/assistant_edit.js'] ); echo '
' . csrf_form_key() . ( $user ? ' diff --git a/autocomplete_ajax.php b/autocomplete_ajax.php index 1b1714ca4..f05088188 100644 --- a/autocomplete_ajax.php +++ b/autocomplete_ajax.php @@ -115,12 +115,12 @@ } $data = $sug = []; - for ($i = 0; $i < count ($ret); $i++) { - $sug[$i] = $ret[$i]['name']; - } - for ($i = 0; $i < count ($ret); $i++) { - $data[$i] = $ret[$i]['text']; + + foreach ( $ret as $i ) { + $sug[] = $i['name']; + $data[] = $i['text']; } + ajax_send_object('matches', $sug, $sendPlainText); } else { ajax_send_error(translate("Error")); diff --git a/availability.php b/availability.php index 39012a73c..34d9fda4a 100644 --- a/availability.php +++ b/availability.php @@ -66,10 +66,10 @@ echo '
- -
diff --git a/category.php b/category.php index d8cccb1e4..e68f5dde1 100644 --- a/category.php +++ b/category.php @@ -86,7 +86,7 @@ . 'Cancel ' . (!empty($id) ? ' ' : '' ) . '
@@ -116,7 +116,7 @@ if (!empty($V['cat_icon_mime'])) { echo ''
-        . $catIconStr . ''; + . $catIconStr . '">'; } echo ''; } diff --git a/category_handler.php b/category_handler.php index e296f3703..bbe6ad555 100644 --- a/category_handler.php +++ b/category_handler.php @@ -68,10 +68,10 @@ function updateIconBlob($catId, $iconData, $iconMimeType) { $error = db_error(); } - if (!dbi_execute( - 'DELETE FROM webcal_entry_categories - WHERE cat_id = ? AND ( cat_owner = ?' - . ($is_admin ? ' OR cat_owner = \'\'' : ' )'), + if (!dbi_execute(" + DELETE FROM `webcal_entry_categories` + WHERE `cat_id` = ? AND ( `cat_owner` = ?" + . ($is_admin ? " OR `cat_owner` = '' )" : " )"), [$id, $login] )) { $error = db_error(); diff --git a/catsel.php b/catsel.php index 64c68c9df..6c6dabc0f 100644 --- a/catsel.php +++ b/catsel.php @@ -24,9 +24,8 @@ if ( strlen ( $entryCatStr ) < 30 ) $entryCatStr = $entryCatFiller . $entryCatStr . $entryCatFiller; -print_header ( ['js/catsel.php/false/' . $form], - '', - '', true, false, true ); +print_header ( ['js/catsel.php/false/' . $form, 'js/catsel.js'], + '', '', true, false, true ); echo ' diff --git a/day.php b/day.php index 83debb516..125c6f266 100644 --- a/day.php +++ b/day.php @@ -65,7 +65,7 @@ $eventinfo = ( empty ( $eventinfo ) ? '' : $eventinfo ); $trailerStr = print_trailer(); print_header ( ['js/popups.js/true', 'js/dblclick_add.js/true'], - generate_refresh_meta(), '', false, false, false, false ); + generate_refresh_meta() ); echo << '; - print_header ( '', '', '', true, false, true ); + print_header ( [], '', '', true, false, true ); if ( count ( $data ) && empty ( $errormsg ) ) { // Delete existing events. delete_events ( $nid ); diff --git a/edit_report.php b/edit_report.php index ec18cbbf4..49eefaba9 100644 --- a/edit_report.php +++ b/edit_report.php @@ -11,8 +11,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Reports + * + * @package WebCalendar\Reports */ /* Security: diff --git a/edit_report_handler.php b/edit_report_handler.php index b4d2575b7..52c72587b 100644 --- a/edit_report_handler.php +++ b/edit_report_handler.php @@ -150,24 +150,13 @@ $names[] = 'cal_report_id'; $values[] = $newid; - $sql = 'INSERT INTO webcal_report ( '; - $sql_v = ''; - - $namecnt = count ( $names ); - for ( $i = 0; $i < $namecnt; $i++ ) { - $sql .= ( $i > 0 ? ', ' : '' ) . $names[$i]; - $sql_v .= ( $i > 0 ? ', ' : '' ) . '?'; - } - $sql .= ' ) VALUES ( ' . $sql_v . ' )'; + $sql = 'INSERT INTO webcal_report ( ' . implode ( ',', $names ) + . ' ) VALUES ( ?' . str_repeat ( ',?', count ( $names ) - 1 ) . ' )'; $report_id = $newid; } else { - $sql = 'UPDATE webcal_report SET '; - $namecnt = count ( $names ); - for ( $i = 0; $i < $namecnt; $i++ ) { - $sql .= ( $i > 0 ? ', ' : '' ) . "$names[$i] = ?"; - } - $sql .= ' WHERE cal_report_id = ?'; - $values[] = $report_id; // Push the $report_id to $values. + $sql = 'UPDATE webcal_report SET ' . implode ( ' = ?,', $names ) + . ' = ? WHERE cal_report_id = ?'; + $values[] = $report_id; } } diff --git a/edit_template.php b/edit_template.php index eef7631ab..ae6f8c84e 100644 --- a/edit_template.php +++ b/edit_template.php @@ -101,7 +101,7 @@ } } -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); /* echo 'report_id: ' . $report_id . '
report_name: ' . $report_name . '
diff --git a/export.php b/export.php index a6a7f733a..62be94c89 100644 --- a/export.php +++ b/export.php @@ -19,11 +19,11 @@ $datem = date ( 'm' ); $dateY = date ( 'Y' ); -$yearAgo = time () - 365 * 24 * 3600; +$yearAgo = time () - 31536000; // 365 * 24 * 3600; $dateYearAgo = date('Ymd', $yearAgo); $selected = ' selected '; -print_header('', '', 'onload="updateDateFields();"' ); +print_header ( [], '', 'onload="updateDateFields();"' ); echo '

' . translate ( 'Export' ) . '

'; echo csrf_form_key(); diff --git a/groups.php b/groups.php index cb731149e..f02bdf6d0 100644 --- a/groups.php +++ b/groups.php @@ -29,11 +29,7 @@ $noNameError = translate('Group Name cannot be blank.'); $noUsersSelectedError = translate('You must selected one or more users.'); -print_header( - '', - '', - 'onload="load_groups();"' -); +print_header ( [], '', 'onload="load_groups();"' ); ?>

@@ -282,7 +278,7 @@ function save_handler() { var selectedUsers = $('#editUsers').val(); if (! selectedUsers || selectedUsers.length == 0) { - $('#errorMessage').html(''); + $('#errorMessage').html(''); $('#edit-group-dialog-alert').show(); return; } diff --git a/help_admin.php b/help_admin.php index 415ae9741..e2ce1d4e4 100644 --- a/help_admin.php +++ b/help_admin.php @@ -2,7 +2,7 @@ require_once 'includes/init.php'; require_once 'includes/help_list.php'; -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); echo $helpListStr . '

' . translate ( 'Help' ) . ': ' . translate ( 'System Settings' ) . '

diff --git a/help_bug.php b/help_bug.php index 79383c12d..f27e64d86 100644 --- a/help_bug.php +++ b/help_bug.php @@ -8,7 +8,7 @@ if ( empty ( $HTTP_USER_AGENT ) ) $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; - print_header ( '', '', '', true ); + print_header ( [], '', '', true ); echo $helpListStr . '

' . translate ( 'Report Bug' ) . '

' . diff --git a/help_docs.php b/help_docs.php index 7f16dd2a4..171ac4ff1 100644 --- a/help_docs.php +++ b/help_docs.php @@ -8,7 +8,7 @@ if ( empty ( $HTTP_USER_AGENT ) ) $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); echo $helpListStr . '

' . translate ( 'WebCalendar Documentation' ) . '

diff --git a/help_edit_entry.php b/help_edit_entry.php index 53cd6791f..2353953b6 100644 --- a/help_edit_entry.php +++ b/help_edit_entry.php @@ -2,7 +2,7 @@ require_once 'includes/init.php'; require_once 'includes/help_list.php'; -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); echo $helpListStr . '

' . translate ( 'Help' ) . ': ' . translate ( 'Adding/Editing Calendar Entries' ) . '

'; diff --git a/help_import.php b/help_import.php index 2b7ea942b..64aa90631 100644 --- a/help_import.php +++ b/help_import.php @@ -2,7 +2,7 @@ require_once 'includes/init.php'; require_once 'includes/help_list.php'; -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); echo $helpListStr . '

' . translate ( 'Help' ) . ': ' . translate ( 'Import' ) . '

' . translate ( 'Palm Desktop' ) . '

diff --git a/help_index.php b/help_index.php index 4bf1571ad..f03a9db78 100644 --- a/help_index.php +++ b/help_index.php @@ -1,7 +1,7 @@ ' . translate ( 'Help Index' ) . '
    '; @@ -9,13 +9,13 @@ //display About WebCalendar link only on index page $aboutStr = translate ( 'About WebCalendar' ); echo ' -
  • ' +
  • ' . $aboutStr . '
  • '; foreach ( $help_list as $key => $val ) { $page++; $transStr = translate ( $key ); echo ' -
  • ' . $transStr . '
  • '; } echo ' diff --git a/help_layers.php b/help_layers.php index 0b54f74b5..7a0a9dd25 100644 --- a/help_layers.php +++ b/help_layers.php @@ -1,7 +1,7 @@ ' . translate ( 'Help' ) . ': ' . translate ( 'Layers' ) . '

    ' . diff --git a/help_pref.php b/help_pref.php index 740141c23..85c60e317 100644 --- a/help_pref.php +++ b/help_pref.php @@ -2,7 +2,7 @@ require_once 'includes/init.php'; require_once 'includes/help_list.php'; -print_header ( '', '', '', true ); +print_header ( [], '', '', true ); echo $helpListStr . '

    ' . translate ( 'Help' ) . ': ' . translate ( 'Preferences' ) . '

    ' . translate ( 'Settings' ) . '

    diff --git a/help_uac.php b/help_uac.php index c068ea19b..634896141 100644 --- a/help_uac.php +++ b/help_uac.php @@ -5,7 +5,7 @@ $descStr = translate ( 'Allows for fine control of user access and permissions. Users can also grant default and per individual permission if authorized by the administrator.' ); -print_header ( '', '', '', true, false, true ); +print_header ( [], '', '', true, false, true ); echo $helpListStr . '

    ' . translate ( 'Help' ) . ': ' diff --git a/icons.php b/icons.php index 36c868761..401a571cc 100644 --- a/icons.php +++ b/icons.php @@ -44,8 +44,8 @@ for ($i = 0, $cnt = count($icons); $i < $cnt; $i++) { echo '

' + . '\');" >' . $title_str . '' . ($i > 0 && $i % 8 == 0 ? ' ' : ''); diff --git a/import_outlookcsv.php b/import_outlookcsv.php index b166c0dda..d4315fd70 100644 --- a/import_outlookcsv.php +++ b/import_outlookcsv.php @@ -78,7 +78,7 @@ function parse_outlookcsv ( $cal_file ) { } function dateDifference ( $start_timestamp, $end_timestamp, $unit = 0 ) { - $days_seconds_star = ( 23 * 56 * 60 ) + 4.091; // Star Day + $days_seconds_star = 77284.091; // Star Day ( 23 * 56 * 60 ) + 4.091 $days_seconds_sun = 86400; // Sun Day $difference_seconds = $end_timestamp - $start_timestamp; switch ( $unit ) { diff --git a/includes/classes/AttachmentList.php b/includes/classes/AttachmentList.php index f9a1a730e..c7d1703c7 100644 --- a/includes/classes/AttachmentList.php +++ b/includes/classes/AttachmentList.php @@ -5,8 +5,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/ * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Doc + * + * @package WebCalendar\Doc */ /** diff --git a/includes/classes/CommentList.php b/includes/classes/CommentList.php index e96c42ca3..3bcafba45 100644 --- a/includes/classes/CommentList.php +++ b/includes/classes/CommentList.php @@ -5,8 +5,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/ * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Doc + * + * @package WebCalendar\Doc */ /** * A list of Doc comment objects. diff --git a/includes/classes/Doc.php b/includes/classes/Doc.php index a37806e04..56095c2ae 100644 --- a/includes/classes/Doc.php +++ b/includes/classes/Doc.php @@ -7,8 +7,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/ * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Doc + * + * @package WebCalendar\Doc */ /** @@ -19,42 +19,42 @@ */ class Doc { /** - * The unique id + * The unique id * @var int * @access private */ var $_blob_id; /** - * Associated event's id (if any) + * Associated event's id (if any) * @var int * @access private */ var $_event_id; /** - * The user login of user who created this Doc + * The user login of user who created this Doc * @var string * @access private */ var $_login; /** - * Filename of the doc (not used for comments) + * Filename of the doc (not used for comments) * @var string * @access private */ var $_name; /** - * The description of the doc + * The description of the doc * @var string * @access private */ var $_description; /** - * The size of the doc (in bytes) + * The size of the doc (in bytes) * (not used for comments) * @var int * @access private @@ -62,28 +62,28 @@ class Doc { var $_size; /** - * The MIME type of the doc + * The MIME type of the doc * @var string * @access private */ var $_mime_type; /** - * Type of object (C=Comment, A=Attachment) + * Type of object (C=Comment, A=Attachment) * @var string * @access private */ var $_type; /** - * Date last modified (in YYYYMMDD format) + * Date last modified (in YYYYMMDD format) * @var int * @access private */ var $_mod_date; /** - * Time last modified (in HHMMSS format) + * Time last modified (in HHMMSS format) * @var int * @access private */ @@ -314,7 +314,7 @@ function getSummary ($target='') { if ( $this->_size < 1024 ) $ret .= $this->_size . ' ' . translate ( 'bytes' ); else - if ( $this->_size < 1024 * 1024 ) + if ( $this->_size < 1048576 ) // 1024 * 1024 $ret .= sprintf ( " %.1f", ( $this->_size / 1024 ) ) . translate ( 'kb' ); else $ret .= sprintf ( " %.1f", ( $this->_size / 1048576 ) ) . translate ( 'Mb' ); diff --git a/includes/classes/DocList.php b/includes/classes/DocList.php index 80da8e867..00ed52e40 100644 --- a/includes/classes/DocList.php +++ b/includes/classes/DocList.php @@ -5,8 +5,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/ * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Doc + * + * @package WebCalendar\Doc */ /** diff --git a/includes/classes/Event.php b/includes/classes/Event.php index e979471a3..2ea93ee90 100644 --- a/includes/classes/Event.php +++ b/includes/classes/Event.php @@ -5,8 +5,8 @@ * @author Adam Roben * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Events + * + * @package WebCalendar\Events */ /** diff --git a/includes/classes/RptEvent.php b/includes/classes/RptEvent.php index 989e55c8b..0f3719260 100644 --- a/includes/classes/RptEvent.php +++ b/includes/classes/RptEvent.php @@ -5,8 +5,8 @@ * @author Adam Roben * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Events + * + * @package WebCalendar\Events */ /** diff --git a/includes/classes/WebCalMailer.php b/includes/classes/WebCalMailer.php index 12bdfa122..58b66b60e 100644 --- a/includes/classes/WebCalMailer.php +++ b/includes/classes/WebCalMailer.php @@ -8,8 +8,8 @@ * @author Ray Jones * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Mailer + * + * @package WebCalendar\Mailer */ $inc_path = ( defined( '__WC_INCLUDEDIR' ) ? __WC_INCLUDEDIR : 'includes' ); diff --git a/includes/css/styles.css b/includes/css/styles.css index e8de28f79..8a71594c3 100644 --- a/includes/css/styles.css +++ b/includes/css/styles.css @@ -13,10 +13,12 @@ html { /* These are to prevent some 'spam site' complaints. */ background-color: #FFFFFE; color: #000001; + color-scheme: dark light; + hanging-punctuation: first last; } *, -*:before, -*:after { +*::before, +*::after { -webkit-box-sizing: inherit; box-sizing: inherit; } @@ -33,6 +35,11 @@ body{ color: var(--textcolor); font: var(--def-font-size)/1.5 var(--def-font-family); } + +del { + text-decoration: line-through 2px var(--textcolor); +} + div.container-fluid, div.container, nav.navbar, div.dropdown-menu, ul.dropdown-menu, .list-group, .list-group-item, .sectioncontent { @@ -70,6 +77,9 @@ abbr { div { border:0; } +h1,h2,h3,h4,h5,h6 { + text-wrap: balance; +} h2 { color: var(--h2color); font-size:1.875rem; @@ -83,6 +93,10 @@ fieldset { label { font-weight:bold; } +p { + max-inline-size: 65ch; + text-wrap: pretty; +} textarea { /*font-size:.75rem;*/ overflow:auto; @@ -170,7 +184,19 @@ td.weekcell { text-decoration:none; } img { - border:0; + max-inline-size: 100%; + block-size: auto; + + /* These 2 presume pre-load a low-res image in an inline style="" on each img. */ + /* We probably don't need them. Yet. */ + /* + background-repeat: no-repeat; + background-size: cover; + */ + + shape-margin: 1rem; + border: 0; + vertical-align: middle; } img.color { width:.9375rem; @@ -923,6 +949,12 @@ tr.highlight td { #viewl #nextmonth { float:right; } +table#nextmonth { + float: right; +} +table#prevmonth { + float: left; +} #month .minical caption, #viewl .minical caption { margin-left:4ex; @@ -1595,3 +1627,9 @@ table.ThemeMenubar { margin-left: .1rem; margin-right: .1rem; } +@media(prefers-reduced-motion: no-preference) { + :has(:target) { + scroll-behavior: smooth; + scroll-padding-top: 2rem; + } +} diff --git a/includes/functions.php b/includes/functions.php index 8dd9c6000..30e63678f 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -145,7 +145,7 @@ function add_duration ( $time, $duration ) { $minutes = intval ( $time / 10000 ) * 60 + ( ( $time / 100 ) % 100 ) + $duration; // If we ran past 240000, then roll back over to 000000. - $minutes %= ( 24 * 60 ); + $minutes %= 1440; return sprintf ( "%d%02d00", $minutes / 60, $minutes % 60 ); } @@ -719,7 +719,7 @@ function daily_matrix ( $date, $participants, $popup = '' ) { ' . $viewMsg . ''; + . '.gif" alt="' . $viewMsg . '">'; } $ret .= ' @@ -738,9 +738,9 @@ function daily_matrix ( $date, $participants, $popup = '' ) {
' . $title_str . '

- + alt="{$tentative}">{$tentative}
{$busy}{$busy}   {$tentative}{$tentative}
EOT; @@ -984,8 +984,8 @@ function display_admin_link($break = true) { $adminStr = translate ( 'Admin' ); return ( $break ? "
\n" : '' ) - . ( $MENU_ENABLED == 'N' ? '«  ' . $adminStr + . ( $MENU_ENABLED == 'N' ? '«  ' . $adminStr . '

' . "\n" : '' ); } @@ -1156,10 +1156,10 @@ function display_navigation ( $name, $show_arrows = true, $show_cats = true ) { . ( get_web_browser() == 'MSIE' ? ' style="zoom:1"' : '' ) . '>' . ( $show_arrows && ( $name != 'month' || $DISPLAY_SM_MONTH == 'N' || $DISPLAY_TASKS == 'Y' ) ? ' - - ' : '' ) . '
@@ -1247,10 +1247,10 @@ function display_small_month ( $thismonth, $thisyear, $showyear, - - ' . date_to_str ( sprintf ( "%04d%02d%02d", $thisyear, $thismonth, 1 ), @@ -1267,10 +1267,10 @@ function display_small_month ( $thismonth, $thisyear, $showyear, - - ' . date_to_str ( sprintf ( "%04d%02d%02d", $thisyear, $thismonth, 1 ), @@ -1758,7 +1758,7 @@ function error_check ( $nextURL, $redirect = true ) { $ret = ''; if ( ! empty ( $error ) ) { - print_header ( '', '', '', true ); + print_header ( [], '', '', true ); $ret .= '

' . print_error ( $error ) . '

'; } else { @@ -1905,8 +1905,8 @@ function generate_activity_log ( $id = '', $sys = false, $startid = '' ) { // Added TZ conversion ( ! empty ( $GENERAL_USE_GMT ) && $GENERAL_USE_GMT == 'Y' ? 3 : 2 ) ) . ' - ' . ( ! $sys && ! $id ? '' + ' . ( ! $sys && ! $id ? '' . htmlspecialchars ( $l_ename ) . ' ' : '' ) . display_activity_log ( $l_type, $l_text ) . ' '; @@ -2581,9 +2581,9 @@ function get_groups($user, $includeUserlist=false) $res = dbi_execute($sql, [$groups[$i]['cal_group_id']]); while ($row = dbi_fetch_row($res)) { if (isset($users_by_name[$row[0]])){ - // It is possible some users assigned to this group may not exist, - // so we skip those that don't. For example, if users are fetched - // from an external source via user-app-*.php, and one of those + // It is possible some users assigned to this group may not exist, + // so we skip those that don't. For example, if users are fetched + // from an external source via user-app-*.php, and one of those // users is deleted externally. $users[] = $users_by_name[$row[0]]; } @@ -3426,8 +3426,8 @@ function getReminders ( $id, $display = false ) { $d = $h = $minutes = 0; if ( $reminder['offset'] > 0 ) { $minutes = $reminder['offset']; - $d = intval ( $minutes / (24*60) ); - $minutes -= ( $d * (24*60) ); + $d = intval ( $minutes / 1440 ); // (24*&60) + $minutes -= ( $d * 1440 ); // (24*60) $h = intval ( $minutes / 60 ); $minutes -= ( $h * 60 ); } @@ -3647,7 +3647,7 @@ function html_for_event_day_at_a_glance ( $event, $date ) { if ( $getCat > 0 && file_exists ( $catIcon ) ) { $catAlt = translate ( 'Category' ) . ': ' . $categories[$getCat]['cat_name']; $hour_arr[$ind] .= '' . $catAlt
-     . ''; + . '">'; } if ( $getCalTypeName == 'task' ) { @@ -3804,7 +3804,7 @@ function html_for_event_week_at_a_glance ( $event, $date, if ( $getCat > 0 && file_exists ( $catIcon ) ) { $catAlt = translate ( 'Category' ) . ': ' . $categories[$getCat]['cat_name']; $hour_arr[$ind] .= '' . $catAlt
-     . ''; + . '">'; } // Build entry link if UAC permits viewing. @@ -4690,13 +4690,13 @@ function print_date_entries ( $date, $user, $ssi = false, $moon_title = ( empty ( $tmp ) ? '' : translate ( ucfirst ( $tmp ) . ( strpos ( 'fullnew', $tmp ) !== false ? '' : ' Quarter' ) . ' Moon' ) ); $ret = ( $can_add ? ' - ' . $newEntryStr
        . '' : '' ) . ' ' . substr ( $date, 6, 2 ) . '' . ( empty ( $tmp ) - ? '' : '' . $moon_title . '' ) . "
\n"; + ? '' : '' . $moon_title . '' ) . "
\n"; $cnt++; } // Get, combine and sort the events for this date. @@ -4958,7 +4958,7 @@ function print_entry ( $event, $date ) { ? '' : translate ( 'Category' ) . ': ' . $categories[$catNum]['cat_name'] ); - $ret .= $catIcon . '" alt="' . $catAlt . '" title="' . "$catAlt\">"; + $ret .= $catIcon . '" alt="' . $catAlt . '">'; } if ( $login != $loginStr && strlen ( $loginStr ) ) { diff --git a/includes/init.php b/includes/init.php index dc487c04b..ccb49cbee 100644 --- a/includes/init.php +++ b/includes/init.php @@ -155,7 +155,7 @@ function send_http_headers () { * @param bool $IGNORED Parameter not used (ignored) * @param bool $disableUTIL Do not include the util.js link */ -function print_header( $includes = '', $HeadX = '', $BodyX = '', +function print_header ( $includes = '', $HeadX = '', $BodyX = '', $disableCustom = false, $disableStyle = false, $disableRSS = false, $IGNORED = false, $disableUTIL = false ) { global $BGCOLOR, $browser, $charset, $CSP, $CUSTOM_HEADER, $CUSTOM_SCRIPT, @@ -165,6 +165,8 @@ function print_header( $includes = '', $HeadX = '', $BodyX = '', $self, $TABLECELLFG, $TEXTCOLOR, $THBG, $THFG, $TODAYCELLBG, $WEEKENDBG, $ASSETS; + $id = ''; + ob_start (); if ( is_dir ( 'includes' ) ) { @@ -218,9 +220,8 @@ function print_header( $includes = '', $HeadX = '', $BodyX = '', if( ! empty( $js_ar ) ) foreach( $js_ar as $j ) { - $i = 'includes/' . $j; $ret .= ' - '; + '; } // Any other includes? @@ -231,11 +232,10 @@ function print_header( $includes = '', $HeadX = '', $BodyX = '', // Ignore since we handled it above //$cs_ret .= '' . "\n"; } if( stristr( $inc, '.css' ) ) { - $i = 'includes/' . $inc; // Not added to $cs_ar because I think we want these, // even if $disableStyle. $cs_ret .= ' - '; + '; } elseif( substr( $inc, 0, 12 ) == 'js/popups.js' && ! empty( $DISABLE_POPUPS ) && $DISABLE_POPUPS == 'Y' ) { // Don't load popups.js if DISABLE_POPUPS. @@ -256,7 +256,7 @@ function print_header( $includes = '', $HeadX = '', $BodyX = '', } else { $ret .= 'js_cacher.php?inc=' . $inc; } - $ret .= '">'; + $ret .= '" defer>'; } } } @@ -325,21 +325,28 @@ function print_header( $includes = '', $HeadX = '', $BodyX = '', . '" rel="alternate" title="' . $appStr . ' [RSS 2.0]">' : '' ) // Do we need anything else inside the header tag? // $HeadX moved here because linked CSS may override standard styles. - . ( $HeadX ? ' - ' . $HeadX : '' ) . ' + . " + $HeadX" . ' - id. */ . ' id="' . preg_replace( '/(_|.php)/', '', - substr( $self, strrpos( $self, '/' ) + 1 ) ) . '"' - // Add any extra parts to the tag. - . ( empty( $BodyX ) ? '' : " $BodyX" ) . '>' . "\n" - // Add custom header if enabled. - . ( $CUSTOM_HEADER == 'Y' && ! $disableCustom - ? load_template( $login, 'H' ) : '' ); + tag. + . " $BodyX>\n" + // Add custom header if enabled. + . ( $CUSTOM_HEADER === 'Y' && ! $disableCustom + ? load_template ( $login, 'H' ) : '' ); + // HTML includes needed for the top menu. if( $MENU_ENABLED == 'Y' ) { require_once 'menu.php'; diff --git a/includes/moon_phases.php b/includes/moon_phases.php index d822f2b97..3c08b065b 100644 --- a/includes/moon_phases.php +++ b/includes/moon_phases.php @@ -23,15 +23,15 @@ function calculateMoonPhases ( $year, $month = 1 ) { $U = false; $K0 = intval ( ( $year - 1900 ) * 12.3685 ) + ( $month - 1 ); - $R1 = 3.14159265 / 180; - $T = ( $year - 1899.5 ) / 100; + $R1 = 0.0174532925; // [pi] 3.14159265 / 180 + $T = ( $year - 1899.5 ) / 100; $T2 = $T * $T; $T3 = $T2 * $T; - $J0 = 2415020 + 29 * $K0; + $J0 = 29 * $K0 + 2415020; $F0 = ( ( 0.0001178 * $T2 - 0.000000155 * $T3 ) + - ( 0.75933 + 0.53058868 * $K0 ) - + ( 0.53058868 * $K0 + 0.75933 ) - ( 0.000837 * $T + 0.000335 * $T2 ) ); $M0 = $K0 * 0.08084821133; @@ -53,14 +53,14 @@ function calculateMoonPhases ( $year, $month = 1 ) { ( 0.00000239 * $T3 ) ); for ( $K9 = 0; $K9 < 7; $K9 += 0.5 ) { - $J = $J0 + 14 * $K9; + $J = 14 * $K9 + $J0; $K = $K9 / 2; - $B6 = ( $B1 + $K * 390.67050646 ) * $R1; - $M5 = ( $M0 + $K * 29.10535608 ) * $R1; - $M6 = ( $M1 + $K * 385.81691806 ) * $R1; + $B6 = ( $K * 390.67050646 + $B1 ) * $R1; + $M5 = ( $K * 29.10535608 + $M0 ) * $R1; + $M6 = ( $K * 385.81691806 + $M1 ) * $R1; - $F = ( ( $F0 + 0.765294 * $K9 ) - + $F = ( ( 0.765294 * $K9 + $F0 ) - ( 0.4068 * sin ( $M6 ) ) + ( ( 0.1734 - 0.000393 * $T ) * sin ( $M5 ) ) + ( 0.0161 * sin ( 2 * $M6 ) ) + @@ -73,7 +73,7 @@ function calculateMoonPhases ( $year, $month = 1 ) { $J += intval ( $F ); $F -= intval ( $F ); - //. + // Convert from JD to Calendar Date. $julian = $J + round ( $F ); $s = ( function_exists ( 'jdtogregorian' ) diff --git a/includes/trailer.php b/includes/trailer.php index cba9a553b..780eeea85 100644 --- a/includes/trailer.php +++ b/includes/trailer.php @@ -46,7 +46,7 @@ if ( ! empty ( $GLOBALS['HOME_LINK'] ) ) { $home = $GLOBALS['HOME_LINK']; $homeStr = translate ( 'Home' ); - $goto_link[] = '$homeStr" . ''; } @@ -78,7 +78,7 @@ if ( ! empty ( $user ) && $user != $login ) $todayURL .= '?user=' . $user; - $goto_link[] = '$todayStr" . ''; } if ( $login != '__public__' ) { @@ -86,14 +86,12 @@ if( ( ! access_is_enabled() || access_can_access_function( ACCESS_ADMIN_HOME ) || access_can_access_function( ACCESS_PREFERENCES ) ) ) - $goto_link[] = '$adminStr" . ''; if ( $REQUIRE_APPROVALS == 'Y' || $PUBLIC_ACCESS == 'Y' ) - $goto_link[] = '$unapprovedStr" . ''; } @@ -109,33 +107,32 @@ $ulist = array_merge( get_my_users(), get_my_nonusers( $login, true ) ); if ( count ( $ulist ) > 1 ) { $calStr = translate ( 'Another Users Calendar' ); - $goto_link[] = '' + $goto_link[] = '' . $calStr . ''; } } } else { - $goto_link[] = '$myCalStr" . ''; - $goto_link[] = '$todayStr" . ''; if ( $readonly == 'N' ) - $goto_link[] = '' . $adminStr . ''; + $goto_link[] = '' . $adminStr . ''; } // Only display some links if we're viewing our own calendar. if ( empty ( $user ) || $user == $login ) { if ( access_can_access_function ( ACCESS_SEARCH ) ) - $goto_link[] = '' + $goto_link[] = '' . $searchStr . ''; if ( $login != '__public__' && ! $is_nonuser && $readonly != 'Y' ) { if ( access_can_access_function ( ACCESS_IMPORT ) ) - $goto_link[] = '' + $goto_link[] = '' . $importStr . ''; if ( access_can_access_function ( ACCESS_EXPORT ) ) - $goto_link[] = '' + $goto_link[] = '' . $exportStr . ''; } if ( $can_add ) { @@ -144,13 +141,12 @@ . ( ! empty ( $thismonth ) ? '&month=' . $thismonth : '' ) . ( ! empty ( $thisday ) ? '&day=' . $thisday : '' ); - $goto_link[] = '' . $addNewEntryStr . ''; if ( $DISPLAY_TASKS_IN_GRID == 'Y' || $DISPLAY_TASKS == 'Y' ) - $goto_link[] = '' . $addNewTaskStr . ''; } @@ -160,8 +156,7 @@ : ( $login != '__public__' && ! $is_nonuser ) ); if ( $showHelp ) - $goto_link[] = '' . $helpStr . ''; if ( count ( $goto_link ) > 0 ) { @@ -177,8 +172,7 @@ $viewcnt = count ( $views ); if ( ( access_can_access_function ( ACCESS_VIEW ) && $ALLOW_VIEW_OTHER != 'N' ) && $viewcnt > 0 ) { for ( $i = 0; $i < $viewcnt; $i++ ) { - $views_link[] = '' . htmlspecialchars ( $views[$i]['cal_name'] ) . "\n"; } @@ -204,8 +198,7 @@ if ( $rows ) { for ( $i = 0, $cnt = count ( $rows ); $i < $cnt; $i++ ) { $row = $rows[$i]; - $reports_link[] = '' . htmlspecialchars ( $row[0] ) . ''; } @@ -247,10 +240,10 @@ if ( $readonly != 'Y' ) $tret .= '
' . $currentUserStr . ': ' . ( strlen ( $login ) && $login != '__public__' - ? $fullname . ' (' . $logoutStr : // For public user (who did not actually login). - $publicStr . ' (' . $loginStr ) . ")\n"; } @@ -301,7 +294,7 @@ // Year does not show events, so you cannot manage someone's cal. } $groups .= ( $i > 0 && $groups != '' ? ", \n" : '' ) - . '$f".''; + . "$f".''; } if ( ! empty ( $groups ) ) $tret .= '
' @@ -310,7 +303,7 @@ // WebCalendar Info... $tret .= '

-' . $GLOBALS['PROGRAM_NAME'] . "\n" . '
' . "\n"; diff --git a/includes/user-imap.php b/includes/user-imap.php index 7da30f106..0d5329698 100644 --- a/includes/user-imap.php +++ b/includes/user-imap.php @@ -13,8 +13,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage IMAPAuthentication + * + * @package WebCalendar\IMAPAuthentication */ defined ( '_ISVALID' ) or die ( 'You cannot access this file directly!' ); diff --git a/includes/user.php b/includes/user.php index 2fc99cd6a..f635094ff 100644 --- a/includes/user.php +++ b/includes/user.php @@ -14,8 +14,8 @@ * @author Craig Knudsen * @copyright Craig Knudsen, , http://k5n.us/webcalendar * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL - * @package WebCalendar - * @subpackage Authentication + * + * @package WebCalendar\Authentication */ defined ( '_ISVALID' ) or die ( 'You cannot access this file directly!' ); @@ -188,7 +188,7 @@ function user_load_variables ( $login, $prefix ) { $GLOBALS[$prefix . 'lastname'] = $row[1]; $GLOBALS[$prefix . 'is_admin'] = $row[2]; $GLOBALS[$prefix . 'email'] = empty ( $row[3] ) ? '' : $row[3]; - if ( strlen ( $row[0] ) && strlen ( $row[1] ) ) + if ( strlen($row[0] ?? '') && strlen($row[1] ?? '') ) $GLOBALS[$prefix . 'fullname'] = "$row[0] $row[1]"; else $GLOBALS[$prefix . 'fullname'] = $login; @@ -490,7 +490,7 @@ function user_get_users ( $publicOnly=false ) { "ORDER BY $order1 cal_login" ); if ( $res ) { while ( $row = dbi_fetch_row ( $res ) ) { - if ( strlen ( $row[1] ) && strlen ( $row[2] ) ) + if ( strlen($row[1] ?? '') && strlen($row[2] ?? '') ) $fullname = "$row[2] $row[1]"; else $fullname = $row[0]; diff --git a/includes/views.php b/includes/views.php index 45fa28326..509f22128 100644 --- a/includes/views.php +++ b/includes/views.php @@ -7,6 +7,7 @@ * @license https://gnu.org/licenses/old-licenses/gpl-2.0.html GNU GPL * @package WebCalendar */ +require_once 'includes/init.php'; /** * Initialize view variables and check permissions. diff --git a/list_unapproved.php b/list_unapproved.php index 4f304416e..bd0980feb 100644 --- a/list_unapproved.php +++ b/list_unapproved.php @@ -149,9 +149,8 @@ function list_unapproved ( $user ) {   -    

" . translate('Private'); + echo ">" . translate('Private'); ?>