Пример #1
0
/**
 * Add a "toggle mobile" link if we're using a mobile device
 */
if ($a->is_mobile || $a->is_tablet) {
    if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
        $link = $a->get_baseurl() . '/toggle_mobile?address=' . curPageURL();
    } else {
        $link = $a->get_baseurl() . '/toggle_mobile?off=1&address=' . curPageURL();
    }
    $a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
}
/**
 * Build the page - now that we have all the components
 */
if (!$a->theme['stylesheet']) {
    $stylesheet = current_theme_url();
} else {
    $stylesheet = $a->theme['stylesheet'];
}
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
$page = $a->page;
$profile = $a->profile;
header("Content-type: text/html; charset=utf-8");
$template = 'view/theme/' . current_theme() . '/' . (x($a->page, 'template') ? $a->page['template'] : 'default') . '.php';
if (file_exists($template)) {
    require_once $template;
} else {
    require_once str_replace('theme/' . current_theme() . '/', '', $template);
}
session_write_close();
exit;
Пример #2
0
}*/
call_hooks('page_end', $a->page['content']);
/**
 *
 * Add a place for the pause/resume Ajax indicator
 *
 */
$a->page['content'] .= '<div id="pause"></div>';
/**
 *
 * Add the navigation (menu) template
 *
 */
if ($a->module != 'install') {
    nav($a);
}
/**
 * Build the page - now that we have all the components
 */
$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => current_theme_url()));
$page = $a->page;
$profile = $a->profile;
header("Content-type: text/html; charset=utf-8");
$template = 'view/' . $lang . '/' . (x($a->page, 'template') ? $a->page['template'] : 'default') . '.php';
if (file_exists($template)) {
    require_once $template;
} else {
    require_once str_replace($lang . '/', '', $template);
}
session_write_close();
exit;
Пример #3
0
/**
 * @brief build the page.
 *
 * Build the page - now that we have all the components
 *
 * @param App &$a global application object
 */
function construct_page(&$a)
{
    exec_pdl($a);
    $comanche = count($a->layout) ? true : false;
    require_once theme_include('theme_init.php');
    $installing = false;
    if ($a->module == 'setup') {
        $installing = true;
    } else {
        nav($a);
    }
    if ($comanche) {
        if ($a->layout['nav']) {
            $a->page['nav'] = get_custom_nav($a, $a->layout['nav']);
        }
    }
    if (($p = theme_include(current_theme() . '.js')) != '') {
        head_add_js($p);
    }
    if (($p = theme_include('mod_' . $a->module . '.php')) != '') {
        require_once $p;
    }
    require_once 'include/js_strings.php';
    if (x($a->page, 'template_style')) {
        head_add_css($a->page['template_style'] . '.css');
    } else {
        head_add_css((x($a->page, 'template') ? $a->page['template'] : 'default') . '.css');
    }
    head_add_css('mod_' . $a->module . '.css');
    head_add_css(current_theme_url($installing));
    head_add_js('mod_' . $a->module . '.js');
    $a->build_pagehead();
    $arr = $a->get_widgets();
    ksort($arr, SORT_NUMERIC);
    if (count($arr)) {
        foreach ($arr as $x) {
            if (!array_key_exists($x['location'], $a->page)) {
                $a->page[$x['location']] = '';
            }
            $a->page[$x['location']] .= $x['html'];
        }
    }
    // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
    // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
    // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
    // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page
    // has a '<content>' element instead of a '<section>'.
    // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
    // layout completely with a new layout definition, or replace/remove existing content.
    if ($comanche) {
        $arr = array('module' => $a->module, 'layout' => $a->layout);
        call_hooks('construct_page', $arr);
        $a->layout = $arr['layout'];
        foreach ($a->layout as $k => $v) {
            if (strpos($k, 'region_') === 0 && strlen($v)) {
                if (strpos($v, '$region_') !== false) {
                    $v = preg_replace_callback('/\\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v);
                }
                // And a couple of convenience macros
                if (strpos($v, '$htmlhead') !== false) {
                    $v = str_replace('$htmlhead', $a->page['htmlhead'], $v);
                }
                if (strpos($v, '$nav') !== false) {
                    $v = str_replace('$nav', $a->page['nav'], $v);
                }
                if (strpos($v, '$content') !== false) {
                    $v = str_replace('$content', $a->page['content'], $v);
                }
                $a->page[substr($k, 7)] = $v;
            }
        }
    }
    if ($a->is_mobile || $a->is_tablet) {
        if (isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL();
        } else {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
        }
        if (isset($_SESSION) && $_SESSION['mobile_theme'] != '' && $_SESSION['mobile_theme'] != '---' || isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme'])) {
            $a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
        }
    }
    $page = $a->page;
    $profile = $a->profile;
    header("Content-type: text/html; charset=utf-8");
    require_once theme_include((x($a->page, 'template') ? $a->page['template'] : 'default') . '.php');
}
Пример #4
0
/**
 * @brief build the page.
 *
 * Build the page - now that we have all the components
 *
 * @param App &$a global application object
 */
function construct_page(&$a)
{
    exec_pdl($a);
    $comanche = count($a->layout) ? true : false;
    require_once theme_include('theme_init.php');
    $installing = false;
    if ($a->module == 'setup') {
        $installing = true;
    } else {
        nav($a);
    }
    if ($comanche) {
        if ($a->layout['nav']) {
            $a->page['nav'] = get_custom_nav($a, $a->layout['nav']);
        }
    }
    if (($p = theme_include(current_theme() . '.js')) != '') {
        head_add_js($p);
    }
    if (($p = theme_include('mod_' . $a->module . '.php')) != '') {
        require_once $p;
    }
    require_once 'include/js_strings.php';
    if (x($a->page, 'template_style')) {
        head_add_css($a->page['template_style'] . '.css');
    } else {
        head_add_css((x($a->page, 'template') ? $a->page['template'] : 'default') . '.css');
    }
    head_add_css('mod_' . $a->module . '.css');
    head_add_css(current_theme_url($installing));
    head_add_js('mod_' . $a->module . '.js');
    $a->build_pagehead();
    if ($a->page['pdl_content']) {
        $a->page['content'] = comanche_region($a, $a->page['content']);
    }
    // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
    // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
    // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
    // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page
    // has a '<content>' element instead of a '<section>'.
    // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
    // layout completely with a new layout definition, or replace/remove existing content.
    if ($comanche) {
        $arr = array('module' => $a->module, 'layout' => $a->layout);
        call_hooks('construct_page', $arr);
        $a->layout = $arr['layout'];
        foreach ($a->layout as $k => $v) {
            if (strpos($k, 'region_') === 0 && strlen($v)) {
                if (strpos($v, '$region_') !== false) {
                    $v = preg_replace_callback('/\\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v);
                }
                // And a couple of convenience macros
                if (strpos($v, '$htmlhead') !== false) {
                    $v = str_replace('$htmlhead', $a->page['htmlhead'], $v);
                }
                if (strpos($v, '$nav') !== false) {
                    $v = str_replace('$nav', $a->page['nav'], $v);
                }
                if (strpos($v, '$content') !== false) {
                    $v = str_replace('$content', $a->page['content'], $v);
                }
                $a->page[substr($k, 7)] = $v;
            }
        }
    }
    if ($a->is_mobile || $a->is_tablet) {
        if (isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL();
        } else {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
        }
        if (isset($_SESSION) && $_SESSION['mobile_theme'] != '' && $_SESSION['mobile_theme'] != '---' || isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme'])) {
            $a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
        }
    }
    $page = $a->page;
    $profile = $a->profile;
    header("Content-type: text/html; charset=utf-8");
    // security headers - see https://securityheaders.io
    if ($a->get_scheme() === 'https') {
        header("Strict-Transport-Security: max-age=31536000");
    }
    header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'");
    if ($a->config['system']['x_security_headers']) {
        header("X-Frame-Options: SAMEORIGIN");
        header("X-Xss-Protection: 1; mode=block;");
        header("X-Content-Type-Options: nosniff");
    }
    if ($a->config['system']['public_key_pins']) {
        header("Public-Key-Pins: " . $a->config['system']['public_key_pins']);
    }
    require_once theme_include((x($a->page, 'template') ? $a->page['template'] : 'default') . '.php');
}