Set the default theme as the default.

This commit is contained in:
markjcrane 2016-03-25 16:30:35 -06:00
parent d5c60df4fc
commit 8c33f72ed5
3 changed files with 24 additions and 30 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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 "</form>\n";
}
}
}else{
}
else {
echo "<p>Unkown install_step '$install_step'</p>\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

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
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;

View File

@ -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");
}
?>