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) {
if (! file_exists($template)) {
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,100 +269,102 @@ 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' );
$config = Bootstrap::getSystemConfiguration();
// starting session
if (isset($config['session.gc_maxlifetime'])) {
try {
Bootstrap::initVendors();
$config = Bootstrap::getSystemConfiguration();
// starting session
if (isset($config['session.gc_maxlifetime'])) {
$timelife = $config['session.gc_maxlifetime'];
} else {
} else {
$timelife = ini_get('session.gc_maxlifetime');
}
if (is_null($timelife)) {
}
if (is_null($timelife)) {
$timelife = 1440;
}
ini_set('session.gc_maxlifetime', $timelife);
ini_set('session.cookie_lifetime', $timelife);
session_start();
}
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;
// Do not change any of these settings directly, use env.ini instead
ini_set( 'display_errors', $config['debug'] );
ini_set( 'error_reporting', $e_all );
ini_set( 'short_open_tag', 'On' );
ini_set( 'default_charset', "UTF-8" );
ini_set( 'memory_limit', $config['memory_limit'] );
ini_set( 'soap.wsdl_cache_enabled', $config['wsdl_cache'] );
ini_set( 'date.timezone', $config['time_zone'] );
$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;
define( 'DEBUG_SQL_LOG', $config['debug_sql'] );
define( 'DEBUG_TIME_LOG', $config['debug_time'] );
define( 'DEBUG_CALENDAR_LOG', $config['debug_calendar'] );
define( 'MEMCACHED_ENABLED', $config['memcached'] );
define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define( 'TIME_ZONE', $config['time_zone'] );
// Do not change any of these settings directly, use env.ini instead
ini_set( 'display_errors', $config['debug'] );
ini_set( 'error_reporting', $e_all );
ini_set( 'short_open_tag', 'On' );
ini_set( 'default_charset', "UTF-8" );
ini_set( 'memory_limit', $config['memory_limit'] );
ini_set( 'soap.wsdl_cache_enabled', $config['wsdl_cache'] );
ini_set( 'date.timezone', $config['time_zone'] );
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];
define( 'DEBUG_SQL_LOG', $config['debug_sql'] );
define( 'DEBUG_TIME_LOG', $config['debug_time'] );
define( 'DEBUG_CALENDAR_LOG', $config['debug_calendar'] );
define( 'MEMCACHED_ENABLED', $config['memcached'] );
define( 'MEMCACHED_SERVER', $config['memcached_server'] );
define( 'TIME_ZONE', $config['time_zone'] );
//to do: make different environments. sys
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];
//to do: make different environments. sys
//check if it is a installation instance
if (! defined( 'PATH_C' )) {
//check if it is a installation instance
if (! defined( 'PATH_C' )) {
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
define( 'PATH_C', (rtrim( Bootstrap::sys_get_temp_dir(), PATH_SEP ) . PATH_SEP) );
define( 'PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' );
}
}
//Call Gulliver Classes
Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
//Call Gulliver Classes
Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class");
//Loading the autoloader libraries feature
spl_autoload_register(array("Bootstrap", "autoloadClass"));
//Loading the autoloader libraries feature
spl_autoload_register(array("Bootstrap", "autoloadClass"));
Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php");
Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php");
$skinPathErrors = G::skinGetPathToSrcByVirtualUri("errors", $config);
$skinPathUpdate = G::skinGetPathToSrcByVirtualUri("update", $config);
$skinPathErrors = G::skinGetPathToSrcByVirtualUri("errors", $config);
$skinPathUpdate = G::skinGetPathToSrcByVirtualUri("update", $config);
// defining Virtual URLs
$virtualURITable = array ();
$virtualURITable['/plugin/(*)'] = 'plugin';
$virtualURITable['/(sys*)/(*.js)'] = 'jsMethod';
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/';
// defining Virtual URLs
$virtualURITable = array ();
$virtualURITable['/plugin/(*)'] = 'plugin';
$virtualURITable['/(sys*)/(*.js)'] = 'jsMethod';
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/';
if (defined( 'PATH_C' )) {
if (defined( 'PATH_C' )) {
$virtualURITable['/jsform/(*.js)'] = PATH_C . 'xmlform/';
$virtualURITable['/extjs/(*)'] = PATH_C . 'ExtJs/';
}
}
$virtualURITable['/htmlarea/(*)'] = PATH_THIRDPARTY . 'htmlarea/';
//$virtualURITable['/sys[a-zA-Z][a-zA-Z0-9]{0,}()/'] = 'sysNamed';
$virtualURITable['/(sys*)'] = FALSE;
$virtualURITable["/errors/(*)"] = ($skinPathErrors != "")? $skinPathErrors : PATH_GULLIVER_HOME . "methods" . PATH_SEP . "errors" . PATH_SEP;
$virtualURITable['/gulliver/(*)'] = PATH_GULLIVER_HOME . 'methods/';
$virtualURITable['/controls/(*)'] = PATH_GULLIVER_HOME . 'methods/controls/';
$virtualURITable['/html2ps_pdf/(*)'] = PATH_THIRDPARTY . 'html2ps_pdf/';
//$virtualURITable['/images/'] = 'errorFile';
//$virtualURITable['/skins/'] = 'errorFile';
//$virtualURITable['/files/'] = 'errorFile';
$virtualURITable['/(*)api/(*)'] = 'api-service';
$virtualURITable["/update/(*)"] = ($skinPathUpdate != "")? $skinPathUpdate : PATH_GULLIVER_HOME . "methods" . PATH_SEP . "update" . PATH_SEP;
//$virtualURITable['/(*)'] = PATH_HTML;
$virtualURITable['/css/(*)'] = PATH_HTML . 'css/'; //ugly
$virtualURITable['/skin/(*)'] = PATH_HTML;
$virtualURITable['/skins/(*)'] = PATH_HTML . 'skins/'; //ugly
$virtualURITable['/images/(*)'] = PATH_HTML . 'images/'; //ugly
$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}/'] = 'errorFile';
$virtualURITable['/htmlarea/(*)'] = PATH_THIRDPARTY . 'htmlarea/';
//$virtualURITable['/sys[a-zA-Z][a-zA-Z0-9]{0,}()/'] = 'sysNamed';
$virtualURITable['/(sys*)'] = FALSE;
$virtualURITable["/errors/(*)"] = ($skinPathErrors != "")? $skinPathErrors : PATH_GULLIVER_HOME . "methods" . PATH_SEP . "errors" . PATH_SEP;
$virtualURITable['/gulliver/(*)'] = PATH_GULLIVER_HOME . 'methods/';
$virtualURITable['/controls/(*)'] = PATH_GULLIVER_HOME . 'methods/controls/';
$virtualURITable['/html2ps_pdf/(*)'] = PATH_THIRDPARTY . 'html2ps_pdf/';
//$virtualURITable['/images/'] = 'errorFile';
//$virtualURITable['/skins/'] = 'errorFile';
//$virtualURITable['/files/'] = 'errorFile';
$virtualURITable['/(*)api/(*)'] = 'api-service';
$virtualURITable["/update/(*)"] = ($skinPathUpdate != "")? $skinPathUpdate : PATH_GULLIVER_HOME . "methods" . PATH_SEP . "update" . PATH_SEP;
//$virtualURITable['/(*)'] = PATH_HTML;
$virtualURITable['/css/(*)'] = PATH_HTML . 'css/'; //ugly
$virtualURITable['/skin/(*)'] = PATH_HTML;
$virtualURITable['/skins/(*)'] = PATH_HTML . 'skins/'; //ugly
$virtualURITable['/images/(*)'] = PATH_HTML . 'images/'; //ugly
$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}/'] = 'errorFile';
$isRestRequest = false;
// Verify if we need to redirect or stream the file, if G:VirtualURI returns true means we are going to redirect the page
if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
$isRestRequest = false;
// Verify if we need to redirect or stream the file, if G:VirtualURI returns true means we are going to redirect the page
if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
// review if the file requested belongs to public_html plugin
if (substr( $realPath, 0, 6 ) == 'plugin') {
// Another way to get the path of Plugin public_html and stream the correspondent file, By JHL Jul 14, 08
@@ -452,73 +452,73 @@ if (Bootstrap::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath
die();
}
}
} //virtual URI parser
} //virtual URI parser
// the request correspond to valid php page, now parse the URI
Bootstrap::parseURI( getenv( "REQUEST_URI" ), $isRestRequest );
// the request correspond to valid php page, now parse the URI
Bootstrap::parseURI( getenv( "REQUEST_URI" ), $isRestRequest );
// Bootstrap::mylog("sys_temp: ".SYS_TEMP);
if (Bootstrap::isPMUnderUpdating()) {
// Bootstrap::mylog("sys_temp: ".SYS_TEMP);
if (Bootstrap::isPMUnderUpdating()) {
header( "location: /update/updating.php" );
if (DEBUG_TIME_LOG)
Bootstrap::logTimeByPage();
die();
}
}
// verify if index.html exists
if (! file_exists( PATH_HTML . 'index.html' )) { // if not, create it from template
// verify if index.html exists
if (! file_exists( PATH_HTML . 'index.html' )) { // if not, create it from template
file_put_contents( PATH_HTML . 'index.html', Bootstrap::parseTemplate( PATH_TPL . 'index.html', array ('lang' => SYS_LANG,'skin' => SYS_SKIN
) ) );
}
}
define( 'SYS_URI', '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' );
define( 'SYS_URI', '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' );
// defining the serverConf singleton
if (defined( 'PATH_DATA' ) && file_exists( PATH_DATA )) {
// defining the serverConf singleton
if (defined( 'PATH_DATA' ) && file_exists( PATH_DATA )) {
//Instance Server Configuration Singleton
Bootstrap::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
}
}
// Call more Classes
Bootstrap::registerClass('headPublisher', PATH_GULLIVER . "class.headPublisher.php");
Bootstrap::registerClass('publisher', PATH_GULLIVER . "class.publisher.php");
Bootstrap::registerClass('xmlform', PATH_GULLIVER . "class.xmlform.php");
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
Bootstrap::registerClass('xmlformExtension', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('form', PATH_GULLIVER . "class.form.php");
Bootstrap::registerClass('menu', PATH_GULLIVER . "class.menu.php");
Bootstrap::registerClass('Xml_Document', PATH_GULLIVER . "class.xmlDocument.php");
Bootstrap::registerClass('DBSession', PATH_GULLIVER . "class.dbsession.php");
Bootstrap::registerClass('DBConnection', PATH_GULLIVER . "class.dbconnection.php");
Bootstrap::registerClass('DBRecordset', PATH_GULLIVER . "class.dbrecordset.php");
Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('Groups', PATH_HOME . "engine/classes/class.groups.php");
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
// Call more Classes
Bootstrap::registerClass('headPublisher', PATH_GULLIVER . "class.headPublisher.php");
Bootstrap::registerClass('publisher', PATH_GULLIVER . "class.publisher.php");
Bootstrap::registerClass('xmlform', PATH_GULLIVER . "class.xmlform.php");
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
Bootstrap::registerClass('xmlformExtension', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('form', PATH_GULLIVER . "class.form.php");
Bootstrap::registerClass('menu', PATH_GULLIVER . "class.menu.php");
Bootstrap::registerClass('Xml_Document', PATH_GULLIVER . "class.xmlDocument.php");
Bootstrap::registerClass('DBSession', PATH_GULLIVER . "class.dbsession.php");
Bootstrap::registerClass('DBConnection', PATH_GULLIVER . "class.dbconnection.php");
Bootstrap::registerClass('DBRecordset', PATH_GULLIVER . "class.dbrecordset.php");
Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
Bootstrap::registerClass('XmlForm_Field_FastSearch', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
Bootstrap::registerClass('XmlForm_Field_WYSIWYG_EDITOR', PATH_GULLIVER . "class.wysiwygEditor.php");
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
Bootstrap::registerClass('Groups', PATH_HOME . "engine/classes/class.groups.php");
Bootstrap::registerClass('Tasks', PATH_HOME . "engine/classes/class.tasks.php");
Bootstrap::registerClass('Calendar', PATH_HOME . "engine/classes/class.calendar.php");
Bootstrap::registerClass('processMap', PATH_HOME . "engine/classes/class.processMap.php");
Bootstrap::registerSystemClasses();
Bootstrap::registerSystemClasses();
require_once PATH_THIRDPARTY . '/pear/PEAR.php';
require_once PATH_THIRDPARTY . '/pear/PEAR.php';
//Bootstrap::LoadSystem( 'pmException' );
//Bootstrap::LoadSystem( 'pmException' );
// Create headPublisher singleton
//Bootstrap::LoadSystem( 'headPublisher' );
$oHeadPublisher = & headPublisher::getSingleton();
// Create headPublisher singleton
//Bootstrap::LoadSystem( 'headPublisher' );
$oHeadPublisher = & headPublisher::getSingleton();
// Installer, redirect to install if we don't have a valid shared data folder
if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
// Installer, redirect to install if we don't have a valid shared data folder
if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
// new installer, extjs based
define( 'PATH_DATA', PATH_C );
//NewRelic Snippet - By JHL
@@ -549,23 +549,23 @@ if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
header( "location: /errors/error404.php?url=" . urlencode( $_SERVER['REQUEST_URI'] ) );
}
die();
}
}
// Load Language Translation
Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );
// Load Language Translation
Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );
// look for a disabled workspace
if ($oServerConf->isWSDisabled( SYS_TEMP )) {
// look for a disabled workspace
if ($oServerConf->isWSDisabled( SYS_TEMP )) {
$aMessage['MESSAGE'] = Bootstrap::LoadTranslation( 'ID_DISB_WORKSPACE' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
Bootstrap::RenderPage( 'publish' );
die();
}
}
// database and workspace definition
// if SYS_TEMP exists, the URL has a workspace, now we need to verify if exists their db.php file
if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
// database and workspace definition
// if SYS_TEMP exists, the URL has a workspace, now we need to verify if exists their db.php file
if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
//this is the default, the workspace db.php file is in /shared/workflow/sites/SYS_SYS
if (file_exists( PATH_DB . SYS_TEMP . '/db.php' )) {
require_once (PATH_DB . SYS_TEMP . '/db.php');
@@ -584,7 +584,7 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
}
die();
}
} else { //when we are in global pages, outside any valid workspace
} else { //when we are in global pages, outside any valid workspace
if (SYS_TARGET === 'newSite') {
$phpFile = G::ExpandPath( 'methods' ) . SYS_COLLECTION . "/" . SYS_TARGET . '.php';
//NewRelic Snippet - By JHL
@@ -616,28 +616,28 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
Bootstrap::logTimeByPage(); //log this page
die();
}
}
}
// PM Paths DATA
define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/' );
define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' );
define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' );
define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' );
define( 'PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/' );
define( 'PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/' );
define( 'PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP );
define( 'PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP );
define( 'SERVER_NAME', $_SERVER['SERVER_NAME'] );
define( 'SERVER_PORT', $_SERVER['SERVER_PORT'] );
// PM Paths DATA
define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/' );
define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' );
define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' );
define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' );
define( 'PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/' );
define( 'PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/' );
define( 'PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP );
define( 'PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP );
define( 'SERVER_NAME', $_SERVER['SERVER_NAME'] );
define( 'SERVER_PORT', $_SERVER['SERVER_PORT'] );
// create memcached singleton
Bootstrap::LoadClass( 'memcached' );
$memcache = & PMmemcached::getSingleton( SYS_SYS );
// create memcached singleton
Bootstrap::LoadClass( 'memcached' );
$memcache = & PMmemcached::getSingleton( SYS_SYS );
// verify configuration for rest service
/*if ($isRestRequest) {
// verify configuration for rest service
/*if ($isRestRequest) {
// disable until confirm that rest is enabled & configured on rest-config.ini file
$isRestRequest = false;
$confFile = '';
@@ -657,28 +657,28 @@ $memcache = & PMmemcached::getSingleton( SYS_SYS );
}
}
}
}*/
}*/
// load Plugins base class
Bootstrap::LoadClass( 'plugin' );
// load Plugins base class
Bootstrap::LoadClass( 'plugin' );
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
$oPluginRegistry = & PMPluginRegistry::getSingleton();
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if (file_exists( $sSerializedFile )) {
if (file_exists( $sSerializedFile )) {
$oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) );
$attributes = $oPluginRegistry->getAttributes();
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
}
}
// setup propel definitions and logging
//changed to autoloader
//require_once ("propel/Propel.php");
//require_once ("creole/Creole.php");
// setup propel definitions and logging
//changed to autoloader
//require_once ("propel/Propel.php");
//require_once ("creole/Creole.php");
if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
define( 'PM_PID', mt_rand( 1, 999999 ) );
require_once 'Log.php';
@@ -709,71 +709,71 @@ if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
if ($con instanceof DebugConnection) {
$con->setLogger( $logger );
}
} else {
} else {
Propel::init( PATH_CORE . "config/databases.php" );
}
}
Creole::registerDriver( 'dbarray', 'creole.contrib.DBArrayConnection' );
Creole::registerDriver( 'dbarray', 'creole.contrib.DBArrayConnection' );
// Session Initializations
ini_set( 'session.auto_start', '1' );
// Session Initializations
ini_set( 'session.auto_start', '1' );
// The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off.
// ini_set( 'register_globals', 'Off' );
//session_start();
ob_start();
// The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off.
// ini_set( 'register_globals', 'Off' );
//session_start();
ob_start();
// Rebuild the base Workflow translations if not exists
if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) {
// Rebuild the base Workflow translations if not exists
if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) {
require_once ("classes/model/Translation.php");
$fields = Translation::generateFileTranslation( 'en' );
}
}
// TODO: Verify if the language set into url is defined in translations env.
if (SYS_LANG != 'en' && ! is_file( PATH_LANGUAGECONT . 'translation.' . SYS_LANG )) {
// TODO: Verify if the language set into url is defined in translations env.
if (SYS_LANG != 'en' && ! is_file( PATH_LANGUAGECONT . 'translation.' . SYS_LANG )) {
require_once ("classes/model/Translation.php");
$fields = Translation::generateFileTranslation( SYS_LANG );
}
}
// Setup plugins
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$avoidChangedWorkspaceValidation = false;
// Setup plugins
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$avoidChangedWorkspaceValidation = false;
// Load custom Classes and Model from Plugins.
Bootstrap::LoadAllPluginModelClasses();
// Load custom Classes and Model from Plugins.
Bootstrap::LoadAllPluginModelClasses();
// jump to php file in methods directory
$collectionPlugin = '';
if ($oPluginRegistry->isRegisteredFolder( SYS_COLLECTION )) {
// jump to php file in methods directory
$collectionPlugin = '';
if ($oPluginRegistry->isRegisteredFolder( SYS_COLLECTION )) {
$phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
$targetPlugin = explode( '/', SYS_TARGET );
$collectionPlugin = $targetPlugin[0];
$avoidChangedWorkspaceValidation = true;
} else {
} else {
$phpFile = Bootstrap::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
}
}
// services is a special folder,
if (SYS_COLLECTION == 'services') {
// services is a special folder,
if (SYS_COLLECTION == 'services') {
$avoidChangedWorkspaceValidation = true;
$targetPlugin = explode( '/', SYS_TARGET );
if ($targetPlugin[0] == 'webdav') {
$phpFile = Bootstrap::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . 'webdav.php';
}
}
}
if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') {
if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') {
$avoidChangedWorkspaceValidation = true;
}
}
$bWE = false;
$isControllerCall = false;
$isPluginController = false;
$bWE = false;
$isControllerCall = false;
$isPluginController = false;
if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
$phpFile = PATH_GULLIVER_HOME . 'methods/' . substr( SYS_COLLECTION, 8 ) . SYS_TARGET . '.php';
} else {
} else {
//when the file is part of the public directory of any PROCESS, this a ProcessMaker feature
if (preg_match( '/^[0-9][[:alnum:]]+$/', SYS_COLLECTION ) == 1) { //the pattern is /sysSYS/LANG/SKIN/PRO_UID/file
$auxPart = explode( '/', $_SERVER['REQUEST_URI'] );
@@ -853,10 +853,10 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
header( "location: /errors/error404.php?url=" . urlencode( $_SERVER['REQUEST_URI'] ) );
die();
}
}
}
//redirect to login, if user changed the workspace in the URL
if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != SYS_SYS) {
//redirect to login, if user changed the workspace in the URL
if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != SYS_SYS) {
$_SESSION['WORKSPACE'] = SYS_SYS;
Bootstrap::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', "error" );
// verify if the current skin is a 'ux' variant
@@ -864,15 +864,15 @@ if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_S
header( 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart );
die();
}
}
// enable rbac
Bootstrap::LoadSystem( 'rbac' );
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER';
// enable rbac
Bootstrap::LoadSystem( 'rbac' );
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER';
// define and send Headers for all pages
if (! defined( 'EXECUTE_BY_CRON' )) {
// define and send Headers for all pages
if (! defined( 'EXECUTE_BY_CRON' )) {
header( "Expires: " . gmdate( "D, d M Y H:i:s", mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' ) ) ) . " GMT" );
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" );
@@ -1024,5 +1024,7 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
if (DEBUG_TIME_LOG) {
bootstrap::logTimeByPage(); //log this page
}
}
} catch (Exception $e) {
Bootstrap::renderTemplate('error.tpl', 'SYSTEM EXCEPTION', $e->getMessage(), array());
}