From 8c33f72ed5942df1751221194d88e90cb535c62b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 25 Mar 2016 16:30:35 -0600 Subject: [PATCH] Set the default theme as the default. --- core/install/install.php | 19 ++++++++++--------- resources/footer.php | 17 +++++++---------- resources/header.php | 18 +++++++----------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/core/install/install.php b/core/install/install.php index b282df5a76..e0d4bb86ae 100644 --- a/core/install/install.php +++ b/core/install/install.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2015 + Portions created by the Initial Developer are Copyright (C) 2008-2016 the Initial Developer. All Rights Reserved. Contributor(s): @@ -126,14 +126,14 @@ if(!$install_step) { $install_step = 'select_language'; } $text = $language->get(); //set a default template - $default_template = 'enhanced'; + $default_template = 'default'; if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) { $default_template = $_SESSION['domain']['template']['name']; } //set a default enviroment if first_time if($install_enabled){ - //initialize some varibles to cut down on warnings + //initialize some varibles to cut down on warnings $_SESSION['message'] = ''; $v_link_label_play = ''; $v_link_label_pause = ''; @@ -175,7 +175,7 @@ if(!$install_step) { $install_step = 'select_language'; } //action code if($return_install_step == 'config_detail'){ - //check for all required data + //check for all required data $existing_errors = count($messages); if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; } if (strlen($admin_password) == 0) { $messages[] = "Please provide the Admin Password"; } @@ -286,7 +286,7 @@ if(!$install_step) { $install_step = 'select_language'; } case E_USER_ERROR: throw new Exception ($errstr . " in $errfile line: $errline"); case E_STRICT: throw new Exception ($errstr . " in $errfile line: $errline"); case E_RECOVERABLE_ERROR: throw new Exception ($errstr . " in $errfile line: $errline"); - default: return false; + default: return false; } } #set_error_handler("error_handler"); @@ -338,15 +338,16 @@ if(!$install_step) { $install_step = 'select_language'; } echo "\n"; } } - }else{ + } + else { echo "

Unkown install_step '$install_step'

\n"; } if($install_enabled){ - //grab the default theme + //get the default theme $set_session_theme = 1; $domains_processed = 1; - include "themes/enhanced/app_defaults.php"; + include "themes/".$default_template."/app_defaults.php"; unset($set_session_theme, $domains_processed); //initialize some defaults so we can be 'logged in' $_SESSION['username'] = 'install_enabled'; @@ -354,7 +355,7 @@ if($install_enabled){ $_SESSION['menu'] = ''; } -// add the content to the template and then send output +//add the content to the template and then send output $body = ob_get_contents(); //get the output from the buffer ob_end_clean(); //clean the buffer diff --git a/resources/footer.php b/resources/footer.php index f577aa0a94..f2ef68d44d 100644 --- a/resources/footer.php +++ b/resources/footer.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2016 the Initial Developer. All Rights Reserved. Contributor(s): @@ -30,34 +30,31 @@ require_once "resources/require.php"; $body = $content_from_db.ob_get_contents(); ob_end_clean(); //clean the buffer -//set a default template - if (strlen($_SESSION['domain']['template']['name']) == 0) { $_SESSION['domain']['template']['name'] = 'default'; } - //clear the template if ($_SESSION['theme']['cache']['boolean'] == "false") { - $_SESSION["template_content"] = ''; + $_SESSION["template_content"] = ''; } //set a default template if (strlen($_SESSION["template_content"]) == 0) { //build template if session template has no length - $v_template_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; + $template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; if (strlen($template_rss_sub_category) > 0) { //this template was assigned by the content manager //get the contents of the template and save it to the template variable - $template_full_path = $v_template_path.'/'.$template_rss_sub_category.'/template.php'; + $template_full_path = $template_base_path.'/'.$template_rss_sub_category.'/template.php'; if (!file_exists($template_full_path)) { $_SESSION['domain']['template']['name'] = 'default'; - $template_full_path = $v_template_path.'/default/template.php'; + $template_full_path = $template_base_path.'/default/template.php'; } $template = file_get_contents($template_full_path); $_SESSION["template_content"] = $template; } else { //get the contents of the template and save it to the template variable - $template_full_path = $v_template_path.'/'.$_SESSION['domain']['template']['name'].'/template.php'; + $template_full_path = $template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php'; if (!file_exists($template_full_path)) { $_SESSION['domain']['template']['name'] = 'default'; - $template_full_path = $v_template_path.'/default/template.php'; + $template_full_path = $template_base_path.'/default/template.php'; } $template = file_get_contents($template_full_path); $_SESSION["template_content"] = $template; diff --git a/resources/header.php b/resources/header.php index e8dc220901..b6a1f1e766 100644 --- a/resources/header.php +++ b/resources/header.php @@ -46,21 +46,16 @@ require_once "resources/require.php"; } } -//set a default template - if (!isset($_SESSION['domain']['template']['name'])) { $_SESSION['domain']['template']['name'] = 'default'; } +//set the template base directory path + $template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; -//set a default template - $v_template_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; - if (!isset($_SESSION['domain']['template']['name'])) { - //get the contents of the template and save it to the template variable - $template_full_path = $v_template_path.'/'.$_SESSION['domain']['template']['name'].'/template.php'; - if (!file_exists($template_full_path)) { - $_SESSION['domain']['template']['name'] = 'default'; - } +//check if the template exists if it is missing then use the default + if (!file_exists($template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php')) { + $_SESSION['domain']['template']['name'] = 'default'; } //start the output buffer - include $v_template_path.'/'.$_SESSION['domain']['template']['name'].'/config.php'; + include $template_base_path.'/'.$_SESSION['domain']['template']['name'].'/config.php'; //start the output buffer ob_start(); @@ -134,4 +129,5 @@ require_once "resources/require.php"; if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) { require_once("app/translate/translate_header.php"); } + ?> \ No newline at end of file