/** * Include compiled header code, this was a hack to work around * Grunt/build/deploy issues. TODO clean this up and remove this workaround */ function include_head_compiled() { echo "<!-- compiled head -->"; $head_compiled = __DIR__ . "/head-compiled.html"; if (file_exists($head_compiled)) { require $head_compiled; } else { // fix relative paths $input = file_get_contents(__DIR__ . "/../layout/head.html"); $input = str_replace("src=\"", "src=\"" . htmlspecialchars(calculate_relative_path()), $input); echo $input; } echo "<!-- /compiled head -->"; }
function page_header_old($page_title, $page_id = false, $options = array()) { define('PAGE_RENDER_START', microtime(true)); header('Content-type: text/html; charset=utf-8'); $html_classes = array(); if (has_required_admin()) { $html_classes[] = "body_admin"; } $html_classes[] = get_site_config('site_id'); if (is_admin()) { $html_classes[] = "is_admin"; } ?> <!DOCTYPE HTML> <html<?php echo " class=\"" . implode(" ", $html_classes) . "\""; ?> > <head> <title><?php echo htmlspecialchars($page_title); if (has_required_admin()) { echo " [admin]"; } ?> </title> <link rel="stylesheet" type="text/css" href="<?php echo htmlspecialchars(url_for('styles/generated.css' . '?' . get_site_config('openclerk_version'))); ?> " /> <link rel="stylesheet" type="text/css" href="<?php echo htmlspecialchars(url_for(get_site_config('default_css') . '?' . get_site_config('openclerk_version'))); ?> " /> <?php if (get_site_config('custom_css')) { ?> <link rel="stylesheet" type="text/css" href="<?php echo htmlspecialchars(url_for(get_site_config('custom_css') . '?' . get_site_config('openclerk_version'))); ?> " /> <?php } ?> <?php if (has_required_admin()) { ?> <link rel="stylesheet" type="text/css" href="<?php echo htmlspecialchars(url_for('admin.css' . '?' . get_site_config('openclerk_version'))); ?> " /> <?php } ?> <?php if (isset($options["refresh"])) { ?> <meta http-equiv="refresh" content="<?php echo htmlspecialchars($options['refresh']); ?> "> <?php } ?> <script type="text/javascript" src="<?php echo htmlspecialchars(url_for('js/jquery-1.9.1.min.js')); ?> "></script> <script type="text/javascript" src="<?php echo htmlspecialchars(url_for('js/common.js' . '?' . get_site_config('openclerk_version'))); ?> "></script> <script type="text/javascript" src="<?php echo htmlspecialchars(url_for('js/locale/' . I18n::getCurrentLocale() . '.js?' . get_site_config('openclerk_version'))); ?> "></script> <?php if (isset($options['jsapi']) && $options['jsapi']) { ?> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> <?php $user = user_logged_in() ? get_user(user_id()) : false; if ($user) { if ($user['disable_graph_refresh'] || isset($graph_type['no_refresh']) && $graph_type['no_refresh']) { $timeout = 0; // disable refresh } else { $timeout = get_premium_value(get_user(user_id()), 'graph_refresh'); } } else { $timeout = get_site_config('graph_refresh_public'); } // TODO move this into a more helpful location rather than in the template head ?> window.UserGraphRefresh = <?php echo $timeout * 1000 * 60; ?> ; // ms </script> <?php } ?> <?php if (isset($options["js"]) && $options["js"]) { if (!is_array($options['js'])) { $options['js'] = array($options['js']); } foreach ($options['js'] as $js) { $js_hash = ""; if (strpos($js, "?") !== false) { $js_hash = "&" . substr($js, strpos($js, "?") + 1); $js = substr($js, 0, strpos($js, "?")); } ?> <script type="text/javascript" src="<?php echo htmlspecialchars(url_for('js/' . $js . '.js' . '?' . get_site_config('openclerk_version') . $js_hash)); ?> "></script> <?php } } ?> <?php require_template("templates_head"); ?> <?php $head_compiled = __DIR__ . "/../site/head-compiled.html"; if (file_exists($head_compiled)) { require $head_compiled; } else { // fix relative paths $input = file_get_contents(__DIR__ . "/head.html"); $input = str_replace("src=\"", "src=\"" . htmlspecialchars(calculate_relative_path()), $input); echo $input; } ?> </head> <body<?php if ($page_id) { echo ' id="' . $page_id . '"'; } if (isset($options['class'])) { echo " class=\"" . htmlspecialchars($options['class']) . "\""; } ?> > <div class="body_wrapper"> <?php require_template("templates_header"); ?> <div id="navigation"> <ul> <li class="home"><a href="<?php echo url_for('index'); ?> " title="<?php echo htmlspecialchars(get_site_config('site_name')); ?> "><span class="text"><?php echo htmlspecialchars(get_site_config('site_name')); ?> </span></a></li> <?php if (user_logged_in()) { ?> <li class="profile"><a href="<?php echo url_for('profile'); ?> " title="<?php echo ht("Your Reports"); ?> "><span class="text"><?php echo ht("Your Reports"); ?> </span><span class="responsive-text"><?php echo ht("Reports"); ?> </span></a></li> <li class="finance"><a href="<?php echo url_for('your_transactions'); ?> " title="<?php echo ht("Finance"); ?> "><span class="text"><?php echo ht("Finance"); ?> </span></a></li> <li class="accounts"><a href="<?php echo url_for('wizard_currencies'); ?> " title="<?php echo ht("Configure Accounts"); ?> "><span class="text"><?php echo ht("Configure Accounts"); ?> </span><span class="responsive-text"><?php echo ht("Configure"); ?> </span></a></li> <li class="user"><a href="<?php echo url_for('user'); ?> " title="<?php echo ht("User Profile"); ?> "><span class="text"><?php echo ht("User Profile"); ?> </span></a></li> <li class="logout"><a href="<?php echo url_for('login', array('logout' => 1)); ?> " title="<?php echo ht("Logout"); ?> "><span class="text"><?php echo ht("Logout"); ?> </span></a></li> <?php if (is_admin()) { ?> <li class="admin"><a href="<?php echo url_for('admin'); ?> " title="<?php echo ht("Admin"); ?> "><span class="text"><?php echo ht("Admin"); ?> </span></a></li> <?php } ?> <?php } else { ?> <li class="signup"><a href="<?php echo url_for('signup'); ?> " title="<?php echo ht("Signup"); ?> "><span class="text"><?php echo ht("Signup"); ?> </span></a></li> <li class="login"><a href="<?php echo url_for('login'); ?> " title="<?php echo ht("Login"); ?> "><span class="text"><?php echo ht("Login"); ?> </span></a></li> <?php } ?> <li class="premium"><a href="<?php echo url_for('premium'); ?> " title="<?php echo ht("Premium"); ?> "><span class="text"><?php echo ht("Premium"); ?> </span></a></li> <li class="help"><a href="<?php echo url_for('help'); ?> " title="<?php echo ht("Help"); ?> "><span class="text"><?php echo ht("Help"); ?> </span></a></li> </ul> </div> <?php if (did_autologin()) { ?> <div id="autologin"> <?php echo t("Automatically logged in. Hi, :user!", array(':user' => "<a href=\"" . url_for('user') . "\" class=\"disabled\">" . ($_SESSION["user_name"] ? htmlspecialchars($_SESSION["user_name"]) : "<i>" . t("anonymous") . "</i>") . "</a>")); ?> (<a href="<?php echo url_for('login', array('logout' => 1)); ?> "><?php echo ht("This isn't me."); ?> </a>) </div> <?php } ?> <div id="page_content"> <?php // always display messages on every page as necessary display_messages(); }