# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # include "includes/config.php"; include "includes/php-dbi.php"; include "includes/functions.php"; include "includes/{$user_inc}"; include "includes/validate.php"; include "includes/connect.php"; send_no_cache_header(); load_global_settings(); load_user_preferences(); load_user_layers(); load_user_categories(); if (empty($friendly) && empty($user)) { remember_this_view(); } $view = "week"; include "includes/translate.php"; if ($allow_view_other != "Y" && !$is_admin || empty($user)) { $user = ""; } if (!empty($friendly)) { $hide_icons = true; } else { $hide_icons = false; } $can_add = $readonly == "N" || $is_admin == "Y"; if ($public_access == "Y" && $login == "__public__") { if ($public_access_can_add != "Y") { $can_add = false;
function print_header($includes = '', $HeadX = '', $BodyX = '', $disableCustom = false, $disableStyle = false, $disableRSS = false, $disableAJAX = false, $disableUTIL = false) { global $BGCOLOR, $browser, $charset, $CUSTOM_HEADER, $CUSTOM_SCRIPT, $DISABLE_POPUPS, $DISPLAY_TASKS, $DISPLAY_WEEKENDS, $FONTS, $friendly, $LANGUAGE, $login, $MENU_ENABLED, $MENU_THEME, $OTHERMONTHBG, $POPUP_FG, $REQUEST_URI, $self, $TABLECELLFG, $TEXTCOLOR, $THBG, $THFG, $TODAYCELLBG, $WEEKENDBG, $SCRIPT, $PUBLIC_ACCESS_FULLNAME, $PUBLIC_ACCESS, $is_admin; $lang = $ret = ''; // Remember this view if the file is a view_x.php script. if (!strstr($REQUEST_URI, 'view_entry')) { remember_this_view(true); } // Check the CSS version for cache clearing if needed. if (!$disableStyle) { if (isset($_COOKIE['webcalendar_csscache'])) { $webcalendar_csscache = $_COOKIE['webcalendar_csscache']; } else { $webcalendar_csscache = 1; SetCookie('webcalendar_csscache', $webcalendar_csscache); } } // Menu control. if (!empty($friendly) || $disableCustom) { $MENU_ENABLED = 'N'; } $appStr = generate_application_name(true); $ret .= send_doctype($appStr); $ret .= !$disableAJAX ? ' <script type="text/javascript" src="includes/js/prototype.js"></script>' : ''; // Includes needed for the top menu. if ($MENU_ENABLED == 'Y') { $MENU_THEME = !empty($MENU_THEME) && $MENU_THEME != 'none' ? $MENU_THEME : 'default'; $menu_theme = $SCRIPT == 'admin.php' && !empty($GLOBALS['sys_MENU_THEME']) ? $GLOBALS['sys_MENU_THEME'] : $MENU_THEME; $ret .= ' <script type="text/javascript" src="includes/menu/JSCookMenu.js"></script> <script type="text/javascript" src="includes/menu/themes/' . $menu_theme . '/theme.js"></script>'; } $ret .= !$disableUTIL ? ' <script type="text/javascript" src="includes/js/util.js"></script>' : ''; // Any other includes? if (is_array($includes)) { foreach ($includes as $inc) { if (substr($inc, 0, 13) == 'js/popups.php' && !empty($DISABLE_POPUPS) && $DISABLE_POPUPS == 'Y') { // Don't load popups.php javascript if DISABLE_POPUPS. } else { $ret .= ' <script type="text/javascript" src="js_cacher.php?inc=' . $inc . '"></script>'; } } } // Do we need anything else inside the header tag? if ($HeadX) { $ret .= ' ' . $HeadX; } // Include the CSS needed for the top menu and themes. if ($MENU_ENABLED == 'Y') { include_once 'includes/menu/index.php'; $ret .= ' <link rel="stylesheet" type="text/css" href="includes/menu/themes/' . $menu_theme . '/theme.css" />'; } // Add RSS feed for unapproved events if approvals are required if ($GLOBALS['REQUIRE_APPROVALS'] == 'Y' && $login != '__public__' && $is_admin) { // Prh .. fix theme change for auth_http which does not set webcal*login // variables. // // Pass the logged in user id as login=<whatever> on the URL // Add css_cache=<cookie setting> to change the URL signature // to force a fetch from the server rather than from the // browser cache when the style changes. // Note: we could do all the queries to add the RSS feed for every user // the current user has permissions to approve for, but I'm thinking // that's too many db requests to repeat on every page. $ret .= '<link rel="alternate" type="application/rss+xml" title="' . $appStr . ' - Unapproved Events - ' . $login . '" href="rss_unapproved.php"/>'; if ($is_admin && $PUBLIC_ACCESS == 'Y') { $ret .= '<link rel="alternate" type="application/rss+xml" title="' . $appStr . ' - Unapproved Events - ' . translate($PUBLIC_ACCESS_FULLNAME) . '" href="rss_unapproved.php?user=public"/>'; } } if ($is_admin) { $ret .= '<link rel="alternate" type="application/rss+xml" title="' . $appStr . ' - ' . translate('Activity Log') . '" href="rss_activity_log.php"/>'; } // If loading admin.php, we will not use an exrternal file because we need to // override the global colors and this is impossible if loading external file. // We will still increment the webcalendar_csscache cookie though. echo $ret . ($disableStyle ? '' : ' <link rel="stylesheet" type="text/css" href="css_cacher.php?login='******'webcal_tmp_login']) ? $login : $_SESSION['webcal_tmp_login']) . '&css_cache=' . $webcalendar_csscache . '" />') . ($CUSTOM_SCRIPT == 'Y' && !$disableCustom ? load_template($login, 'S') : '') . (empty($friendly) ? '' : ' <link rel="stylesheet" type="text/css"' . (empty($friendly) ? ' media="print"' : '') . ' href="includes/print_styles.css" />') . (!empty($GLOBALS['RSS_ENABLED']) && $GLOBALS['RSS_ENABLED'] == 'Y' && $login == '__public__' || !empty($GLOBALS['USER_RSS_ENABLED']) && $GLOBALS['USER_RSS_ENABLED'] == 'Y' && !$disableRSS ? ' <link rel="alternate" type="application/rss+xml" title="' . $appStr . ' [RSS 2.0]" href="rss.php' . ($login != '__public__' ? '?user='******'') . '" />' : '') . ' <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />' . ($MENU_ENABLED == 'Y' ? $menuScript : '') . ' </head> <body' . (translate('direction') == 'rtl' ? ' dir="rtl"' : '') . ' id="' . preg_replace('/(_|.php)/', '', substr($self, strrpos($self, '/') + 1)) . '"' . (empty($BodyX) ? '' : " {$BodyX}") . '>' . "\n" . ($MENU_ENABLED == 'Y' && $menuConfig['Above Custom Header'] ? $menuHtml : '') . ($CUSTOM_HEADER == 'Y' && !$disableCustom ? load_template($login, 'H') : '') . ($MENU_ENABLED == 'Y' && !$menuConfig['Above Custom Header'] ? $menuHtml : ''); // TODO convert this to return value. }