# This function (which loads the navbar and page content from the database) is
# called automatically by wfpl_main()
+
+function enc_css_str($str) {
+ $str = str_replace("\\", "\\00005c", $str);
+ return str_replace("\"", "\\000022", $str);
+}
+
function cms_display($basename, &$tem) {
if(preg_match('/([.]l(ocal)?$)|^192[.]168[.]|^127.0.0.1$|^10[.]/', $_SERVER['HTTP_HOST'])) {
$GLOBALS['wfpl_main_template']->set('$running_locally');
$tem->set('$navbar_items', $nav_items);
}
+ $header_image = persistent_get('wfplcms_header_image');
+ if ($header_image) {
+ $hi_css = "\n<style>\n";
+ if ($header_image['width'] != WFPL_SITE_WIDTH) {
+ $hi_css .= "#site_header {\n";
+ $hi_css .= 'width: ' . $header_image['width'] . "px;\n";
+ $hi_css .= "}\n";
+ }
+ $hi_css .= "#site_header:before {\n";
+ $hi_css .= "content: \"\";\n";
+ $hi_css .= 'background-image: url(' . $header_image['url'] . ");\n";
+ $hi_css .= 'padding-top: ' . ($header_image['height'] / $header_image['width'] * 100) . "%;\n";
+ $hi_css .= "}\n";
+ if ($header_image['caption']) {
+ $hi_css .= "#site_header:after {\n";
+ $hi_css .= "content: \"" . enc_css_str($header_image['caption']) . "\";\n";
+ $hi_css .= "}\n";
+ }
+ $hi_css .= "</style>\n";
+
+ $tem->set('$cms_css', $hi_css);
+ }
+
$cms_page_id = cms_display_content($tem, 'where filename=%"', $basename);
+ $footer = db_get_value('cms_pages', 'content', 'where filename="_footer"');
+ if ($footer) {
+ $tem->set('$cms_footer', $footer);
+ }
+
if(session_auth_can('admin_links')) {
$admin_links = array();
if($cms_page_id) {