Browse Source

Set the default theme as the default.

markjcrane 9 years ago
parent
commit
5f6d676f4d
3 changed files with 25 additions and 31 deletions
  1. 10 9
      core/install/install.php
  2. 7 10
      resources/footer.php
  3. 8 12
      resources/header.php

+ 10 - 9
core/install/install.php

@@ -17,7 +17,7 @@
 
 
 	The Initial Developer of the Original Code is
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
 	Mark J Crane <[email protected]>
-	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.
 	the Initial Developer. All Rights Reserved.
 
 
 	Contributor(s):
 	Contributor(s):
@@ -126,14 +126,14 @@ if(!$install_step) { $install_step = 'select_language'; }
 	$text = $language->get();
 	$text = $language->get();
 
 
 //set a default template
 //set a default template
-	$default_template = 'enhanced';
+	$default_template = 'default';
 	if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) {
 	if (isset($_SESSION['domain']['template']['name']) and strlen($_SESSION['domain']['template']['name']) != 0) {
 		$default_template = $_SESSION['domain']['template']['name'];
 		$default_template = $_SESSION['domain']['template']['name'];
 	}
 	}
 
 
 //set a default enviroment if first_time
 //set a default enviroment if first_time
 	if($install_enabled){
 	if($install_enabled){
-	//initialize some varibles to cut down on warnings
+		//initialize some varibles to cut down on warnings
 		$_SESSION['message'] = '';
 		$_SESSION['message'] = '';
 		$v_link_label_play = '';
 		$v_link_label_play = '';
 		$v_link_label_pause = '';
 		$v_link_label_pause = '';
@@ -175,7 +175,7 @@ if(!$install_step) { $install_step = 'select_language'; }
 
 
 	//action code
 	//action code
 	if($return_install_step == 'config_detail'){
 	if($return_install_step == 'config_detail'){
-	//check for all required data
+		//check for all required data
 		$existing_errors = count($messages);
 		$existing_errors = count($messages);
 		if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; }
 		if (strlen($admin_username) == 0) { $messages[] = "Please provide the Admin Username"; }
 		if (strlen($admin_password) == 0) {	$messages[] = "Please provide the Admin Password"; }
 		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_USER_ERROR:          throw new Exception ($errstr . " in $errfile line: $errline");
 					case E_STRICT:              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");
 					case E_RECOVERABLE_ERROR:   throw new Exception ($errstr . " in $errfile line: $errline");
-					default: 					return false;
+					default:                    return false;
 				}
 				}
 			}
 			}
 			#set_error_handler("error_handler");
 			#set_error_handler("error_handler");
@@ -338,15 +338,16 @@ if(!$install_step) { $install_step = 'select_language'; }
 				echo "</form>\n";
 				echo "</form>\n";
 			}
 			}
 		}
 		}
-	}else{
+	}
+	else {
 		echo "<p>Unkown install_step '$install_step'</p>\n";
 		echo "<p>Unkown install_step '$install_step'</p>\n";
 	}
 	}
 
 
 if($install_enabled){
 if($install_enabled){
-	//grab the default theme
+	//get the default theme
 		$set_session_theme = 1;
 		$set_session_theme = 1;
 		$domains_processed = 1;
 		$domains_processed = 1;
-		include "themes/enhanced/app_defaults.php";
+		include "themes/".$default_template."/app_defaults.php";
 		unset($set_session_theme, $domains_processed);
 		unset($set_session_theme, $domains_processed);
 	//initialize some defaults so we can be 'logged in'
 	//initialize some defaults so we can be 'logged in'
 		$_SESSION['username'] = 'install_enabled';
 		$_SESSION['username'] = 'install_enabled';
@@ -354,7 +355,7 @@ if($install_enabled){
 		$_SESSION['menu'] = '';
 		$_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
 	$body = ob_get_contents(); //get the output from the buffer
 	ob_end_clean(); //clean the buffer
 	ob_end_clean(); //clean the buffer
 
 

+ 7 - 10
resources/footer.php

@@ -17,7 +17,7 @@
 
 
 	The Initial Developer of the Original Code is
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
 	Mark J Crane <[email protected]>
-	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.
 	the Initial Developer. All Rights Reserved.
 
 
 	Contributor(s):
 	Contributor(s):
@@ -30,34 +30,31 @@ require_once "resources/require.php";
 	$body = $content_from_db.ob_get_contents();
 	$body = $content_from_db.ob_get_contents();
 	ob_end_clean(); //clean the buffer
 	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
 //clear the template
 	if ($_SESSION['theme']['cache']['boolean'] == "false") {
 	if ($_SESSION['theme']['cache']['boolean'] == "false") {
-			$_SESSION["template_content"] = '';
+		$_SESSION["template_content"] = '';
 	}
 	}
 
 
 //set a default template
 //set a default template
 	if (strlen($_SESSION["template_content"]) == 0) { //build template if session template has no length
 	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) {
 		if (strlen($template_rss_sub_category) > 0) {
 			//this template was assigned by the content manager
 			//this template was assigned by the content manager
 				//get the contents of the template and save it to the template variable
 				//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)) {
 				if (!file_exists($template_full_path)) {
 					$_SESSION['domain']['template']['name'] = 'default';
 					$_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);
 				$template = file_get_contents($template_full_path);
 				$_SESSION["template_content"] = $template;
 				$_SESSION["template_content"] = $template;
 		}
 		}
 		else {
 		else {
 			//get the contents of the template and save it to the template variable
 			//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)) {
 				if (!file_exists($template_full_path)) {
 					$_SESSION['domain']['template']['name'] = 'default';
 					$_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);
 				$template = file_get_contents($template_full_path);
 				$_SESSION["template_content"] = $template;
 				$_SESSION["template_content"] = $template;

+ 8 - 12
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 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';
-		}
+//set the template base directory path
+	$template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
+
+//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
 //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
 //start the output buffer
 	ob_start();
 	ob_start();
@@ -134,4 +129,5 @@ require_once "resources/require.php";
 	if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) {
 	if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) {
 		require_once("app/translate/translate_header.php");
 		require_once("app/translate/translate_header.php");
 	}
 	}
+
 ?>
 ?>