more updates

This commit is contained in:
@sinedrik
2013-08-23 10:03:45 -04:00
parent 6516c1149c
commit 59373c8ccf
3 changed files with 752 additions and 721 deletions

View File

@@ -421,43 +421,20 @@ class Bootstrap
* @param $data associative
* array containig the template data
*/
public function renderTemplate($template, $data = array())
public static function renderTemplate($template, $data = array())
{
if (!defined('PATH_THIRDPARTY')) {
throw new Exception('System constant (PATH_THIRDPARTY) is not defined!');
}
require_once PATH_THIRDPARTY . 'smarty/libs/Smarty.class.php';
$fInfo = pathinfo($template);
$tplExists = true;
// file has absolute path
if (substr($template, 0, 1) != PATH_SEP) {
$template = PATH_TEMPLATE . $template;
}
// fix for template that have dot in its name but is not a valid
// extension
if (isset($fInfo ['extension']) && ($fInfo ['extension'] != 'tpl' || $fInfo ['extension'] != 'html')) {
unset($fInfo ['extension']);
}
if (!isset($fInfo ['extension'])) {
if (file_exists($template . '.tpl')) {
$template .= '.tpl';
} elseif (file_exists($template . '.html')) {
$template .= '.html';
} else {
$tplExists = false;
}
} else {
if (! file_exists($template)) {
$tplExists = false;
}
}
if (!$tplExists) {
throw new Exception("Template: $template, doesn't exist!");
}
@@ -495,7 +472,7 @@ class Bootstrap
*
* @author <erik@colosa.com>
*/
public function sys_get_temp_dir()
public static function sys_get_temp_dir()
{
if (!function_exists('sys_get_temp_dir')) {
// Based on http://www.phpit.net/

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Server Error :: </title>
</head>
<style>
.box {
-moz-border-radius:6px; /* Rounded edges in Firefox */
color :#000;
border-style:solid;
border-width:1px;
border-color:#000;
font :normal 8pt Tahoma,sans-serif,MiscFixed;
text-decoration:none;
padding:0 20px;
vertical-align:middle;
font-weight: bold;
background-color:#DBDBDB;
}
</style>
<body>
<div class='box'>
<br />
<br />
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" class="mainCopy">
<tr>
<td width="15%" align="left" scope="col">
<span class="mxbOnlineTextBlue">{$title}</span><br />
<hr/>
{$message}<br /><br />
<br />
<br />
<table>
<tr><td><small><pre>{$trace}</pre></small></td></tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@@ -236,8 +236,6 @@ set_include_path( PATH_CORE . PATH_SEPARATOR .
get_include_path()
);
Bootstrap::initVendors();
/**
* Global definitions, before it was the defines.php file
*/
@@ -271,7 +269,11 @@ define( 'PML_WSDL_URL', PML_SERVER . '/syspmLibrary/en/green/services/wsdl' );
define( 'PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess' );
define( 'PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/download' );
try {
Bootstrap::initVendors();
$config = Bootstrap::getSystemConfiguration();
// starting session
if (isset($config['session.gc_maxlifetime'])) {
$timelife = $config['session.gc_maxlifetime'];
@@ -285,8 +287,6 @@ ini_set('session.gc_maxlifetime', $timelife);
ini_set('session.cookie_lifetime', $timelife);
session_start();
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
$e_all = $config['debug'] ? $e_all : $e_all & ~ E_NOTICE;
@@ -1025,4 +1025,6 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
bootstrap::logTimeByPage(); //log this page
}
}
} catch (Exception $e) {
Bootstrap::renderTemplate('error.tpl', 'SYSTEM EXCEPTION', $e->getMessage(), array());
}