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

View File

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

View File

@ -46,21 +46,16 @@ require_once "resources/require.php";
} }
} }
//set a default template //set the template base directory path
if (!isset($_SESSION['domain']['template']['name'])) { $_SESSION['domain']['template']['name'] = 'default'; } $template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
//set a default template //check if the template exists if it is missing then use the default
$v_template_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes'; if (!file_exists($template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php')) {
if (!isset($_SESSION['domain']['template']['name'])) { $_SESSION['domain']['template']['name'] = 'default';
//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';
}
} }
//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");
} }
?> ?>