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 193e4e5cf..24e0107ed 100644 --- a/access.php +++ b/access.php @@ -156,11 +156,8 @@ } } } -print_header( '', - ' - ', + +print_header ( ['css/access.css', 'js/access.js'], '', ( ! empty( $op['time'] ) && $op['time'] == 'Y' ? 'onload="enableAll( 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/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_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 12186f290..62be94c89 100644 --- a/export.php +++ b/export.php @@ -23,7 +23,7 @@ $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 f775fb81f..f03a9db78 100644 --- a/help_index.php +++ b/help_index.php @@ -1,7 +1,7 @@ ' . translate ( 'Help Index' ) . '
    '; 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/includes/functions.php b/includes/functions.php index 7d98f4e79..30e63678f 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -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 { 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/minical.php b/minical.php index 5dd93281c..d20cb4279 100644 --- a/minical.php +++ b/minical.php @@ -105,7 +105,7 @@ $enddate = mktime ( 23, 59, 59, $thismonth + 1, 0, $thisyear ); // Don't display custom header. -print_header ( '', generate_refresh_meta(), '', true ); +print_header ( [], generate_refresh_meta(), '', true ); /* Pre-Load the repeated events for quicker access. */ $repeated_events = read_repeated_events ( $user, $startdate, $enddate, $cat_id ); diff --git a/pref.php b/pref.php index 8a1062d63..6a02ce727 100644 --- a/pref.php +++ b/pref.php @@ -174,7 +174,7 @@ function save_pref( $prefs, $src) { $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($INC, '', ''); +print_header(); ?>

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

-'; } -print_header( +print_header ( ['js/popups.js/true', 'js/dblclick_add.js/true'], - generate_refresh_meta(), '', false, false, false, false ); + generate_refresh_meta() ); echo <<
 
"> diff --git a/remotecal_mgmt.php b/remotecal_mgmt.php index c312d7e71..781694cad 100644 --- a/remotecal_mgmt.php +++ b/remotecal_mgmt.php @@ -32,11 +32,7 @@ $duplicatesStr = translate('Duplicates'); -print_header( - '', - '', - 'onload="load_users();"' -); +print_header ( [], '', 'onload="load_users();"' ); ?> @@ -503,7 +499,7 @@ function save_handler() { var add = $('#editUserAdd').val(); if (add == "1") { if (login.length == 0) { - $('#errorMessage').html(''); + $('#errorMessage').html(''); $('#edit-user-dialog-alert').show(); return; } @@ -534,7 +530,7 @@ function save_handler() { var url = $('#editURL').val(); if (url.length == 0) { - //$('#errorMessage').html(''); + //$('#errorMessage').html(''); $('#invalid-url-error').show(); //$('#edit-user-dialog-alert').show(); foundError = true; diff --git a/resourcecal_mgmt.php b/resourcecal_mgmt.php index 542b971f3..b53f46be8 100644 --- a/resourcecal_mgmt.php +++ b/resourcecal_mgmt.php @@ -26,11 +26,7 @@ $noNameError = translate('Name is required'); $invalidIDError = translate('The ID is limited to letters, numbers and underscore only.'); -print_header( - '', - '', - 'onload="load_users();"' -); +print_header ( [], '', 'onload="load_users();"' ); ?> @@ -355,7 +351,7 @@ function save_handler() { var add = $('#editUserAdd').val(); if (add == "1") { if (login.length == 0) { - $('#errorMessage').html(''); + $('#errorMessage').html(''); $('#edit-user-dialog-alert').show(); return; } diff --git a/search.php b/search.php index 78580b121..ccdf48392 100644 --- a/search.php +++ b/search.php @@ -48,7 +48,7 @@ $INC[] = 'js/search.js/true'; -print_header($INC, '', 'onload="toggleDateRange();"' ); +print_header ( $INC, '', 'onload="toggleDateRange();"' ); ?>

diff --git a/security_audit.php b/security_audit.php index c003a825a..3bd69d9ed 100644 --- a/security_audit.php +++ b/security_audit.php @@ -21,7 +21,7 @@ $phpinfo = getGetValue('phpinfo'); if ($phpinfo == '1') { - print_header('', '', '', true); + print_header ( [], '', '', true ); phpinfo(); print_trailer(false, true, true); exit; diff --git a/user_mgmt.php b/user_mgmt.php index 9d01467d3..b0dfa3edc 100644 --- a/user_mgmt.php +++ b/user_mgmt.php @@ -35,11 +35,7 @@ $invalidFirstName = translate('Invalid first name.'); $invalidLastName = translate('Invalid last name.'); -print_header( - '', - '', - 'onload="load_users();"' -); +print_header ( [], '', 'onload="load_users();"' ); ?> @@ -418,12 +414,12 @@ function save_handler() { if (add == "1") { isAdd = 1; if (login.length == 0) { - $('#errorMessage').html(''); + $('#errorMessage').html(''); $('#edit-user-dialog-alert').show(); return; } if (password1.length == 0) { - $('#errorMessage').html(''); + $('#errorMessage').html(''); $('#edit-user-dialog-alert').show(); return; } @@ -519,7 +515,7 @@ function change_password_handler() { var password1 = $('#setPassword1').val(); var password2 = $('#setPassword2').val(); if (password1.length == 0) { - $('#changePasswordErrorMessage').html(''); + $('#changePasswordErrorMessage').html(''); $('#edit-password-dialog-alert').show(); return; } diff --git a/usersel.php b/usersel.php index f04afe160..c719bcd0f 100644 --- a/usersel.php +++ b/usersel.php @@ -28,7 +28,7 @@ $groups = get_groups( $user ); -print_header( '', '', '', true, false, true ); +print_header ( [], '', '', true, false, true ); echo ' ' ); +print_header ( ['js/popups.js/true', 'js/weekHover.js'] ); $trailerStr = print_trailer(); $next = mktime ( 3, 0, 0, $thismonth + 1, 1, $thisyear ); diff --git a/views_edit.php b/views_edit.php index b8bb07eb4..dbf45d28c 100644 --- a/views_edit.php +++ b/views_edit.php @@ -20,7 +20,7 @@ $BodyX = 'onload="usermode_handler();"'; $INC = ['js/views_edit.php']; -print_header( $INC, '', $BodyX ); +print_header ( $INC, '', $BodyX ); ?> diff --git a/week.php b/week.php index d74fa4414..8563acc9c 100644 --- a/week.php +++ b/week.php @@ -242,9 +242,9 @@