Example #1
0
function template_header()
{
    global $txt, $modSettings, $context, $settings, $user_info, $boarddir, $cachedir;
    setupThemeContext();
    // Print stuff to prevent caching of pages (except on attachment errors, etc.)
    if (empty($context['no_last_modified'])) {
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        // Are we debugging the template/html content?
        if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !$context['browser']['is_ie'] && !WIRELESS) {
            header('Content-Type: application/xhtml+xml');
        } elseif (!isset($_REQUEST['xml']) && !WIRELESS) {
            header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
        }
    }
    header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
    $checked_securityFiles = false;
    $showed_banned = false;
    foreach ($context['template_layers'] as $layer) {
        loadSubTemplate($layer . '_above', true);
        // May seem contrived, but this is done in case the body and main layer aren't there...
        if (in_array($layer, array('body', 'main')) && allowedTo('admin_forum') && !$user_info['is_guest'] && !$checked_securityFiles) {
            $checked_securityFiles = true;
            $securityFiles = array('install.php', 'webinstall.php', 'upgrade.php', 'convert.php', 'repair_paths.php', 'repair_settings.php', 'Settings.php~', 'Settings_bak.php~');
            foreach ($securityFiles as $i => $securityFile) {
                if (!file_exists($boarddir . '/' . $securityFile)) {
                    unset($securityFiles[$i]);
                }
            }
            if (!empty($securityFiles) || !empty($modSettings['cache_enable']) && !is_writable($cachedir)) {
                echo '
		<div class="errorbox">
			<p class="alert">!!</p>
			<h3>', empty($securityFiles) ? $txt['cache_writable_head'] : $txt['security_risk'], '</h3>
			<p>';
                foreach ($securityFiles as $securityFile) {
                    echo '
				', $txt['not_removed'], '<strong>', $securityFile, '</strong>!<br />';
                    if ($securityFile == 'Settings.php~' || $securityFile == 'Settings_bak.php~') {
                        echo '
				', sprintf($txt['not_removed_extra'], $securityFile, substr($securityFile, 0, -1)), '<br />';
                    }
                }
                if (!empty($modSettings['cache_enable']) && !is_writable($cachedir)) {
                    echo '
				<strong>', $txt['cache_writable'], '</strong><br />';
                }
                echo '
			</p>
		</div>';
            }
        } elseif (in_array($layer, array('main', 'body')) && isset($_SESSION['ban']['cannot_post']) && !$showed_banned) {
            $showed_banned = true;
            echo '
				<div class="windowbg alert" style="margin: 2ex; padding: 2ex; border: 2px dashed red;">
					', sprintf($txt['you_are_post_banned'], $user_info['is_guest'] ? $txt['guest_title'] : $user_info['name']);
            if (!empty($_SESSION['ban']['cannot_post']['reason'])) {
                echo '
					<div style="padding-left: 4ex; padding-top: 1ex;">', $_SESSION['ban']['cannot_post']['reason'], '</div>';
            }
            if (!empty($_SESSION['ban']['expire_time'])) {
                echo '
					<div>', sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)), '</div>';
            } else {
                echo '
					<div>', $txt['your_ban_expires_never'], '</div>';
            }
            echo '
				</div>';
        }
    }
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $settings['theme_url'] = $settings['default_theme_url'];
        $settings['images_url'] = $settings['default_images_url'];
        $settings['theme_dir'] = $settings['default_theme_dir'];
    }
}
Example #2
0
if (empty($ssi_guest_access) && empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && basename($_SERVER['PHP_SELF']) != 'SSI.php') {
    require_once CONTROLLERDIR . '/Auth.controller.php';
    $controller = new Auth_Controller();
    $controller->action_kickguest();
    obExit(null, true);
}
// Load the stuff like the menu bar, etc.
if (isset($ssi_layers)) {
    $template_layers = Template_Layers::getInstance();
    $template_layers->removeAll();
    foreach ($ssi_layers as $layer) {
        $template_layers->addBegin($layer);
    }
    template_header();
} else {
    setupThemeContext();
}
// We need to set up user agent, and make more checks on the request
$req = request();
// Make sure they didn't muss around with the settings... but only if it's not cli.
if (isset($_SERVER['REMOTE_ADDR']) && session_id() == '') {
    trigger_error($txt['ssi_session_broken'], E_USER_NOTICE);
}
// Without visiting the forum this session variable might not be set on submit.
if (!isset($_SESSION['USER_AGENT']) && (!isset($_GET['ssi_function']) || $_GET['ssi_function'] !== 'pollVote')) {
    $_SESSION['USER_AGENT'] = $req->user_agent();
}
// Have the ability to easily add functions to SSI.
call_integration_hook('integrate_SSI');
// Call a function passed by GET.
if (isset($_GET['ssi_function']) && function_exists('ssi_' . $_GET['ssi_function']) && (!empty($modSettings['allow_guestAccess']) || !$user_info['is_guest'])) {
Example #3
0
    public static function template_header()
    {
        global $txt, $modSettings, $context, $settings, $user_info, $boarddir, $cachedir;
        setupThemeContext();
        // Print stuff to prevent caching of pages (except on attachment errors, etc.)
        if (empty($context['no_last_modified'])) {
            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
            if (!isset($_REQUEST['xml']) && !WIRELESS) {
                header('Content-Type: text/html; charset=UTF-8');
            }
        }
        header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=UTF-8');
        $checked_securityFiles = false;
        $showed_banned = false;
        if (self::$_is_BoardIndex && allowedTo('admin_forum') && !$user_info['is_guest'] && !$checked_securityFiles) {
            $checked_securityFiles = true;
            $securityFiles = array('install.php', 'upgrade.php', 'repair_settings.php', 'Settings.php~', 'Settings_bak.php~');
            foreach ($securityFiles as $i => $securityFile) {
                if (!file_exists($boarddir . '/' . $securityFile)) {
                    unset($securityFiles[$i]);
                }
            }
            if (!empty($securityFiles)) {
                $context['additional_admin_errors'] .= '
		<div class="errorbox">
			<p class="alert">!!</p>
			<h3>' . $txt['security_risk'] . '</h3>
			<p>';
                foreach ($securityFiles as $securityFile) {
                    $context['additional_admin_errors'] .= '
				' . $txt['not_removed'] . '<strong>' . $securityFile . '</strong>!<br />';
                    if ($securityFile == 'Settings.php~' || $securityFile == 'Settings_bak.php~') {
                        $context['additional_admin_errors'] .= '
				' . sprintf($txt['not_removed_extra'] . $securityFile . substr($securityFile, 0, -1)) . '<br />';
                    }
                }
                $context['additional_admin_errors'] .= '
			</p>
		</div>';
            }
        } elseif (self::$_is_BoardIndex && isset($_SESSION['ban']['cannot_post']) && !$showed_banned) {
            $showed_banned = true;
            echo '
				<div class="windowbg alert" style="margin: 2ex; padding: 2ex; border: 2px dashed red;">
					', sprintf($txt['you_are_post_banned'], $user_info['is_guest'] ? $txt['guest_title'] : $user_info['name']);
            if (!empty($_SESSION['ban']['cannot_post']['reason'])) {
                echo '
					<div style="padding-left: 4ex; padding-top: 1ex;">', $_SESSION['ban']['cannot_post']['reason'], '</div>';
            }
            if (!empty($_SESSION['ban']['expire_time'])) {
                echo '
					<div>', sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)), '</div>';
            } else {
                echo '
					<div>', $txt['your_ban_expires_never'], '</div>';
            }
            echo '
				</div>';
        }
    }
Example #4
0
File: Subs.php Project: bbon/mjncms
function template_header()
{
    global $txt, $modSettings, $context, $settings, $user_info, $boarddir;
    setupThemeContext();
    // Print stuff to prevent caching of pages (except on attachment errors, etc.)
    if (empty($context['no_last_modified'])) {
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        // Are we debugging the template/html content?
        if (!isset($_REQUEST['xml']) && isset($_GET['debug']) && !$context['browser']['is_ie'] && !WIRELESS) {
            header('Content-Type: application/xhtml+xml');
        } elseif (!isset($_REQUEST['xml']) && !WIRELESS) {
            header('Content-Type: text/html; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
        }
    }
    header('Content-Type: text/' . (isset($_REQUEST['xml']) ? 'xml' : 'html') . '; charset=' . (empty($context['character_set']) ? 'ISO-8859-1' : $context['character_set']));
    foreach ($context['template_layers'] as $layer) {
        loadSubTemplate($layer . '_above', true);
        // May seem contrived, but this is done in case the main layer isn't there...
        if ($layer == 'main' && allowedTo('admin_forum') && !$user_info['is_guest']) {
            $securityFiles = array('install.php', 'webinstall.php', 'upgrade.php', 'convert.php', 'repair_paths.php', 'repair_settings.php');
            foreach ($securityFiles as $i => $securityFile) {
                if (!file_exists($boarddir . '/' . $securityFile)) {
                    unset($securityFiles[$i]);
                }
            }
            if (!empty($securityFiles)) {
                echo '
		<div style="margin: 2ex; padding: 2ex; border: 2px dashed #cc3344; color: black; background-color: #ffe4e9;">
			<div style="float: left; width: 2ex; font-size: 2em; color: red;">!!</div>
			<b style="text-decoration: underline;">', $txt['smf299'], '</b><br />
			<div style="padding-left: 6ex;">';
                foreach ($securityFiles as $securityFile) {
                    echo '
			', $txt['smf300'], '<b>', $securityFile, '</b>!<br />';
                }
                echo '
			</div>
		</div>';
            }
        } elseif ($layer == 'main' && isset($_SESSION['ban']['cannot_post'])) {
            echo '
				<div class="windowbg" style="margin: 2ex; padding: 2ex; border: 2px dashed red; color: red;">
					', sprintf($txt['you_are_post_banned'], $user_info['is_guest'] ? $txt[28] : $user_info['name']);
            if (!empty($_SESSION['ban']['cannot_post']['reason'])) {
                echo '
					<div style="padding-left: 4ex; padding-top: 1ex;">', $_SESSION['ban']['cannot_post']['reason'], '</div>';
            }
            echo '
				</div>';
        }
    }
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $settings['theme_url'] = $settings['default_theme_url'];
        $settings['images_url'] = $settings['default_images_url'];
        $settings['theme_dir'] = $settings['default_theme_dir'];
    }
}
Example #5
0
/**
 * The header template
 */
function template_header()
{
    global $context, $settings;
    doSecurityChecks();
    setupThemeContext();
    // Print stuff to prevent caching of pages (except on attachment errors, etc.)
    if (empty($context['no_last_modified'])) {
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        // Are we debugging the template/html content?
        if ((!isset($_REQUEST['xml']) || !isset($_REQUEST['api'])) && isset($_GET['debug']) && !isBrowser('ie')) {
            header('Content-Type: application/xhtml+xml');
        } elseif (!isset($_REQUEST['xml']) || !isset($_REQUEST['api'])) {
            header('Content-Type: text/html; charset=UTF-8');
        }
    }
    // Probably temporary ($_REQUEST['xml'] should be replaced by $_REQUEST['api'])
    if (isset($_REQUEST['api']) && $_REQUEST['api'] == 'json') {
        header('Content-Type: application/json; charset=UTF-8');
    } elseif (isset($_REQUEST['xml']) || isset($_REQUEST['api'])) {
        header('Content-Type: text/xml; charset=UTF-8');
    } else {
        header('Content-Type: text/html; charset=UTF-8');
    }
    foreach (Template_Layers::getInstance()->prepareContext() as $layer) {
        loadSubTemplate($layer . '_above', 'ignore');
    }
    if (isset($settings['use_default_images']) && $settings['use_default_images'] == 'defaults' && isset($settings['default_template'])) {
        $settings['theme_url'] = $settings['default_theme_url'];
        $settings['images_url'] = $settings['default_images_url'];
        $settings['theme_dir'] = $settings['default_theme_dir'];
    }
}