Exemplo n.º 1
0
Arquivo: js.php Projeto: ruucla/mwf
 * @uses User_Agent
 */
/** Set the header type and a cache of zero because this is very dynamic. */
header('Content-Type: text/javascript');
header("Cache-Control: max-age=0");
/** User_Agent is required to determine visitor device type. */
@(require_once '../lib/user_agent.class.php');
@(include_once dirname(dirname(__FILE__)) . '/config.php');
/**
 * Script does nothing if class can't load, user isn't mobile, or the GET 'm'
 * parameter isn't set (meaning the script wouldn't know where to redirect).
 * This also does nothing if the User_Agent fetch fails. This is a safety
 * fallback to leave the behavior on other sites as though they're already
 * on the other site.
 */
if (!class_exists('User_Agent') || User_Agent::get() === false || !User_Agent::is_mobile(false) || !isset($_GET['m'])) {
    die;
}
/** The page to redirect to is GET 'm' */
$mobile_page = $_GET['m'];
/**
 * The domain specifies a suffix that is optionally appended to the cookie name
 * to create an override setting for only particular pages.
 */
$domain_key = isset($_GET['d']) ? '_' . substr(md5($_GET['d']), 0, 8) : '';
/** Check to see if an override cookie exists. */
$cookie_override = isset($_COOKIE[Config::get('global', 'cookie_prefix') . 'ovrrdr' . $domain_key]) && $_COOKIE[Config::get('global', 'cookie_prefix') . 'ovrrdr' . $domain_key] == 1 ? 1 : 0;
/** The referrer is the page including this script - it may include GET 'ovrrdr'. */
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$referer_uri = strpos($referer, '?') !== false ? substr($referer, strpos($referer, '?') + 1, strlen($referer) - strpos($referer, '?') - 1) : '';
/** Find GET 'ovrrdr' if it exists in the referrer's URI. */
Exemplo n.º 2
0
Arquivo: index.php Projeto: ruucla/mwf
    die('<h1>Fatal Error</h1><p>The configuration settings {global::site_url} and {global::site_asset_url} must be defined in ' . dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'global.php</p>');
}
/**
 * Set an override for the classification if $_GET['ovrcls'] is defined, unset
 * it if $_GET['unovrcls'] is defined (unary), or redirect if non-mobile and
 * {'global':'site_nonmobile_url'} is true.
 */
if (isset($_GET['ovrcls'])) {
    User_Agent::set_override($_GET['ovrcls']);
    header('Location: ' . Config::get('global', 'site_url'));
} else {
    if (isset($_GET['unovrcls'])) {
        User_Agent::unset_override();
        header('Location: ' . Config::get('global', 'site_url'));
    } else {
        if (!User_Agent::is_mobile() && ($nonmobile_url = Config::get('global', 'site_nonmobile_url'))) {
            header('Location: ' . $nonmobile_url);
        }
    }
}
/**
 * Get the menu from {'frontpage':'menu'} defined in config/frontpage.php.
 */
$menu = Config::get('frontpage', 'menu');
/**
 * Handle differences between a subsection and the top-level menu, using key
 * 'default' if on the front page or otherwise the $_GET['s'] parameter.
 */
if (isset($_GET['s']) && isset($menu[$_GET['s']])) {
    $menu_items = $menu[$_GET['s']];
    $main_menu = false;