Skip to content
Snippets Groups Projects
Commit 1e552005 authored by Peter Rotich's avatar Peter Rotich
Browse files

Change startup to osTicket::start() - start session + load config

parent 4dbd053c
Branches
Tags
No related merge requests found
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
$configfile=INCLUDE_DIR.'settings.php'; $configfile=INCLUDE_DIR.'settings.php';
elseif(file_exists(INCLUDE_DIR.'ost-config.php')) //NEW config file v 1.6 stable ++ elseif(file_exists(INCLUDE_DIR.'ost-config.php')) //NEW config file v 1.6 stable ++
$configfile=INCLUDE_DIR.'ost-config.php'; $configfile=INCLUDE_DIR.'ost-config.php';
elseif(file_exists(ROOT_DIR.'include/')) elseif(file_exists(ROOT_DIR.'setup/'))
header('Location: '.ROOT_PATH.'setup/'); header('Location: '.ROOT_PATH.'setup/');
if(!$configfile || !file_exists($configfile)) die('<b>Error loading settings. Contact admin.</b>'); if(!$configfile || !file_exists($configfile)) die('<b>Error loading settings. Contact admin.</b>');
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
#include required files #include required files
require(INCLUDE_DIR.'class.osticket.php');
require(INCLUDE_DIR.'class.ostsession.php'); require(INCLUDE_DIR.'class.ostsession.php');
require(INCLUDE_DIR.'class.usersession.php'); require(INCLUDE_DIR.'class.usersession.php');
require(INCLUDE_DIR.'class.pagenate.php'); //Pagenate helper! require(INCLUDE_DIR.'class.pagenate.php'); //Pagenate helper!
...@@ -158,26 +159,26 @@ ...@@ -158,26 +159,26 @@
$ferror=null; $ferror=null;
if (!db_connect(DBHOST,DBUSER,DBPASS) || !db_select_database(DBNAME)) { if (!db_connect(DBHOST,DBUSER,DBPASS) || !db_select_database(DBNAME)) {
$ferror='Unable to connect to the database'; $ferror='Unable to connect to the database';
}elseif(!($cfg=Sys::getConfig())){ } elseif(!($ost=osTicket::start(1))) {
$ferror='Unable to load config info from DB. Get tech support.'; $ferror='Unable to load config info from DB. Get tech support.';
} }
if($ferror){ //Fatal error
Sys::alertAdmin('osTicket Fatal Error',$ferror); //try alerting admin. if($ferror) { //Fatal error
die("<b>Fatal Error:</b> Contact system administrator."); //Generic error. //try alerting admin using email in config file
$msg=$ferror."\n\n".THISPAGE;
Email::sendmail(ADMIN_EMAIL, 'osTicket Fatal Error', $msg, sprintf('"osTicket Alerts"<%s>', ADMIN_EMAIL));
//Display generic error to the user
die("<b>Fatal Error:</b> Contact system administrator.");
exit; exit;
} }
//Init //Init
$cfg->init(); $cfg = $ost;
$session = $ost->getSession();
//System defaults we might want to make global// //System defaults we might want to make global//
#pagenation default - user can overwrite it! #pagenation default - user can overwrite it!
define('DEFAULT_PAGE_LIMIT',$cfg->getPageSize()?$cfg->getPageSize():25); define('DEFAULT_PAGE_LIMIT', $ost->getPageSize()?$ost->getPageSize():25);
//Start session handler!
$session=osTicketSession::start(SESSION_TTL); // start_session
//Set default timezone...staff will overwrite it.
$_SESSION['TZ_OFFSET']=$cfg->getTZoffset();
$_SESSION['daylight']=$cfg->observeDaylightSaving();
#Cleanup magic quotes crap. #Cleanup magic quotes crap.
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment