SPEEDY first version of boostrap.php, with many changes

This commit is contained in:
Fernando Ontiveros
2012-11-12 14:44:44 -04:00
parent bdceea960f
commit b5c11b4198
12 changed files with 444 additions and 793 deletions

View File

@@ -1,14 +1,101 @@
<?php
/**
* class.util.php
* class.bootstrap.php
*
* @package gulliver.system
*
*
*/
class G
class Bootstrap
{
//below here only approved methods
/*
* this function still under revision
*/
public function getSystemConfiguration ($globalIniFile = '', $wsIniFile = '', $wsName = '')
{
$readGlobalIniFile = false;
$readWsIniFile = false;
if (empty( $globalIniFile )) {
$globalIniFile = PATH_CORE . 'config' . PATH_SEP . 'env.ini';
}
if (empty( $wsIniFile )) {
if (defined( 'PATH_DB' )) {
// if we're on a valid workspace env.
if (empty( $wsName )) {
$uriParts = explode( '/', getenv( "REQUEST_URI" ) );
if (isset( $uriParts[1] )) {
if (substr( $uriParts[1], 0, 3 ) == 'sys') {
$wsName = substr( $uriParts[1], 3 );
}
}
}
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
}
}
$readGlobalIniFile = file_exists( $globalIniFile ) ? true : false;
$readWsIniFile = file_exists( $wsIniFile ) ? true : false;
if (isset( $_SESSION['PROCESSMAKER_ENV'] )) {
$md5 = array ();
if ($readGlobalIniFile) {
$md5[] = md5_file( $globalIniFile );
}
if ($readWsIniFile) {
$md5[] = md5_file( $wsIniFile );
}
$hash = implode( '-', $md5 );
if ($_SESSION['PROCESSMAKER_ENV_HASH'] === $hash) {
$_SESSION['PROCESSMAKER_ENV']['from_cache'] = 1;
return $_SESSION['PROCESSMAKER_ENV'];
}
}
// default configuration
$config = array ('debug' => 0,'debug_sql' => 0,'debug_time' => 0,'debug_calendar' => 0,'wsdl_cache' => 1,'memory_limit' => '128M','time_zone' => 'America/New_York','memcached' => 0,'memcached_server' => '','default_skin' => 'classic','default_lang' => 'en','proxy_host' => '','proxy_port' => '','proxy_user' => '','proxy_pass' => ''
);
// read the global env.ini configuration file
if ($readGlobalIniFile && ($globalConf = @parse_ini_file( $globalIniFile )) !== false) {
$config = array_merge( $config, $globalConf );
}
// Workspace environment configuration
if ($readWsIniFile && ($wsConf = @parse_ini_file( $wsIniFile )) !== false) {
$config = array_merge( $config, $wsConf );
}
// validation debug config, only binary value is valid; debug = 1, to enable
$config['debug'] = $config['debug'] == 1 ? 1 : 0;
if ($config['proxy_pass'] != '') {
$config['proxy_pass'] = G::decrypt( $config['proxy_pass'], 'proxy_pass' );
}
$md5 = array ();
if ($readGlobalIniFile) {
$md5[] = md5_file( $globalIniFile );
}
if ($readWsIniFile) {
$md5[] = md5_file( $wsIniFile );
}
$hash = implode( '-', $md5 );
$_SESSION['PROCESSMAKER_ENV'] = $config;
$_SESSION['PROCESSMAKER_ENV_HASH'] = $hash;
return $config;
}
//below this line, still not approved methods
/**
* mk_dir , copied from class.G.php
*
@@ -217,24 +304,25 @@ class G
* @param string $downloadFileName
* @return string
*/
public function streamFile($file, $download = false, $downloadFileName = '') {
require_once (PATH_THIRDPARTY . 'jsmin/jsmin.php');
public function streamFile ($file, $download = false, $downloadFileName = '')
{
$folderarray = explode( '/', $file );
$typearray = explode( '.', basename( $file ) );
$typefile = $typearray[count( $typearray ) - 1];
$filename = $file;
// trick to generate the translation.language.js file , merging two
// files and then minified the content.
//trick to generate the translation.language.js file , merging two files
if (strtolower( $typefile ) == 'js' && $typearray[0] == 'translation') {
$output = g::streamJSTranslationFile ( $filename, $typearray [1] );
Bootstrap::sendHeaders( $filename, 'text/javascript', $download, $downloadFileName );
$output = Bootstrap::streamJSTranslationFile( $filename, $typearray[1] );
print $output;
return;
}
//trick to generate the big css file for ext style .
if (strtolower( $typefile ) == 'css' && $folderarray[count( $folderarray ) - 2] == 'css') {
$output = g::streamCSSBigFile ( $typearray [0] );
Bootstrap::sendHeaders( $filename, 'text/css', $download, $downloadFileName );
$output = Bootstrap::streamCSSBigFile( $typearray[0] );
print $output;
return;
}
@@ -242,63 +330,59 @@ class G
if (file_exists( $filename )) {
switch (strtolower( $typefile )) {
case 'swf':
g::sendHeaders ( $filename, 'application/x-shockwave-flash', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'application/x-shockwave-flash', $download, $downloadFileName );
break;
case 'js':
g::sendHeaders ( $filename, 'text/javascript', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/javascript', $download, $downloadFileName );
break;
case 'htm':
case 'html':
g::sendHeaders ( $filename, 'text/html', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/html', $download, $downloadFileName );
break;
case 'htc':
g::sendHeaders ( $filename, 'text/plain', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/plain', $download, $downloadFileName );
break;
case 'json':
g::sendHeaders ( $filename, 'text/plain', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/plain', $download, $downloadFileName );
break;
case 'gif':
g::sendHeaders ( $filename, 'image/gif', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'image/gif', $download, $downloadFileName );
break;
case 'png':
g::sendHeaders ( $filename, 'image/png', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'image/png', $download, $downloadFileName );
break;
case 'jpg':
g::sendHeaders ( $filename, 'image/jpg', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'image/jpg', $download, $downloadFileName );
break;
case 'css':
g::sendHeaders ( $filename, 'text/css', $download, $downloadFileName );
break;
case 'css' :
g::sendHeaders ( $filename, 'text/css', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/css', $download, $downloadFileName );
break;
case 'xml':
g::sendHeaders ( $filename, 'text/xml', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/xml', $download, $downloadFileName );
break;
case 'txt':
g::sendHeaders ( $filename, 'text/html', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'text/html', $download, $downloadFileName );
break;
case 'doc':
case 'pdf':
case 'pm':
case 'po':
g::sendHeaders ( $filename, 'application/octet-stream', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName );
break;
case 'php':
if ($download) {
g::sendHeaders ( $filename, 'text/plain', $download, $downloadFileName );
G::sendHeaders( $filename, 'text/plain', $download, $downloadFileName );
} else {
require_once ($filename);
return;
}
break;
case 'tar':
g::sendHeaders ( $filename, 'application/x-tar', $download, $downloadFileName );
Bootstrap::sendHeaders( $filename, 'application/x-tar', $download, $downloadFileName );
break;
default:
//throw new Exception ( "Unknown type of file '$file'. " );
g::sendHeaders ( $filename, 'application/octet-stream', $download, $downloadFileName );
break;
Bootstrap::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName );
break;
}
} else {
@@ -307,100 +391,13 @@ class G
}
$_SESSION['phpFileNotFound'] = $file;
g::header ( "location: /errors/error404.php?l=" . $_SERVER ['REQUEST_URI'] );
Bootstrap::header( "location: /errors/error404.php?l=" . $_SERVER['REQUEST_URI'] );
}
switch (strtolower ( $typefile )) {
case "js" :
$paths = explode ( '/', $filename );
$jsName = $paths [count ( $paths ) - 1];
$output = '';
$pathJs = PATH_GULLIVER_HOME . PATH_SEP . 'js' . PATH_SEP;
switch ($jsName) {
//
case 'draw2d.js' :
$cachePath = PATH_C . 'ExtJs' . PATH_SEP;
$checksum = g::getCheckSum ( array (
$pathJs . 'ext/wz_jsgraphics.js',
$pathJs . 'ext/mootools.js',
$pathJs . 'ext/moocanvas.js'
) );
$cf = $cachePath . "ext-draw2d-cache.$checksum.js";
$cfStored = g::getCacheFileNameByPattern ( $cachePath, 'ext-draw2d-cache.*.js' );
// error_log("draw2d.js ".$checksum ."==".
// $cfStored['checksum']);
if (is_file ( $cfStored ['filename'] ) && $checksum == $cfStored ['checksum']) {
$output = file_get_contents ( $cf );
} else {
if (is_file ( $cfStored ['filename'] )) {
@unlink ( $cfStored ['filename'] );
if ( substr($filename,-10) == "ext-all.js" ) {
$filename = PATH_GULLIVER_HOME . 'js/ext/min/ext-all.js';
}
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/wz_jsgraphics.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/mootools.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/moocanvas.js' ) );
$output .= file_get_contents ( $pathJs . 'ext/draw2d.js' ); // already
// minified
file_put_contents ( $cf, $output );
}
break;
case 'ext-all.js' :
$cachePath = PATH_C . 'ExtJs' . PATH_SEP;
$checksum = g::getCheckSum ( array (
$pathJs . 'ext/pmos-common.js',
$pathJs . 'ext/ux/miframe.js',
$pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js',
$pathJs . 'ext/ux.statusbar/ext-statusbar.js',
$pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js'
) );
$cfStored = g::getCacheFileNameByPattern ( $cachePath, 'ext-all-cache.*.js' );
$cf = PATH_C . 'ExtJs' . PATH_SEP . "ext-all-cache.$checksum.js";
if (is_file ( $cfStored ['filename'] ) && $checksum == $cfStored ['checksum']) {
$output = file_get_contents ( $cf );
} else {
if (is_file ( $cfStored ['filename'] )) {
@unlink ( $cfStored ['filename'] );
}
$output .= file_get_contents ( $pathJs . 'ext/ext-all.js' ); // already
// minified
$output .= file_get_contents ( $pathJs . 'ext/ux/ux-all.js' ); // already
// minified
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/pmos-common.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/ux/miframe.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/ux.statusbar/ext-statusbar.js' ) );
$output .= JSMin::minify ( file_get_contents ( $pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js' ) );
file_put_contents ( $cf, $output );
}
break;
case 'maborak.js' :
$oHeadPublisher = & headPublisher::getSingleton ();
foreach ( $oHeadPublisher->maborakFiles as $fileJS ) {
$output .= JSMin::minify ( file_get_contents ( $fileJS ) );
}
break;
case 'maborak.loader.js' :
$oHeadPublisher = & headPublisher::getSingleton ();
foreach ( $oHeadPublisher->maborakLoaderFiles as $fileJS ) {
$output .= JSMin::minify ( file_get_contents ( $fileJS ) );
}
break;
default :
$output = JSMin::minify ( file_get_contents ( $filename ) );
break;
}
print $output;
break;
case 'css' :
print g::trimSourceCodeFile ( $filename );
break;
default :
@readfile( $filename );
break;
}
}
/**
@@ -496,7 +493,7 @@ class G
* @return void
*/
public function LoadClass($strClass) {
$classfile = g::ExpandPath ( "classes" ) . 'class.' . $strClass . '.php';
$classfile = Bootstrap::ExpandPath ( "classes" ) . 'class.' . $strClass . '.php';
if (! file_exists ( $classfile )) {
if (file_exists ( PATH_GULLIVER . 'class.' . $strClass . '.php' )) {
return require_once (PATH_GULLIVER . 'class.' . $strClass . '.php');
@@ -531,8 +528,7 @@ class G
*
* @author Hugo Loza. <hugo@colosa.com>
* @access public
* @param
* eter string lang
* @param string lang
* @return void
*/
public function LoadTranslationObject($lang = SYS_LANG) {
@@ -584,7 +580,7 @@ class G
$G_SKIN = $strSkin;
try {
$file = g::ExpandPath ( 'skinEngine' ) . 'skinEngine.php';
$file = Bootstrap::ExpandPath ( 'skinEngine' ) . 'skinEngine.php';
include $file;
$skinEngine = new SkinEngine ( $G_TEMPLATE, $G_SKIN, $G_CONTENT );
$skinEngine->setLayout ( $layout );
@@ -641,7 +637,7 @@ class G
case 'label' :
case 'labels' :
$_SESSION ['G_MESSAGE_TYPE'] = $strType;
$_SESSION ['G_MESSAGE'] = nl2br ( g::LoadTranslation ( $msgID ) );
$_SESSION ['G_MESSAGE'] = nl2br ( Bootstrap::LoadTranslation ( $msgID ) );
break;
case 'string' :
$_SESSION ['G_MESSAGE_TYPE'] = $strType;
@@ -667,7 +663,7 @@ class G
*/
public function header($parameter) {
if (defined ( 'ENABLE_ENCRYPT' ) && (ENABLE_ENCRYPT == 'yes') && (substr ( $parameter, 0, 9 ) == 'location:')) {
$url = g::encrypt ( substr ( $parameter, 10 ), URL_KEY );
$url = Bootstrap::encrypt ( substr ( $parameter, 10 ), URL_KEY );
header ( 'location:' . $url );
} else {
header ( $parameter );
@@ -742,7 +738,7 @@ class G
$rest->setSupportedFormats( 'JsonFormat', 'XmlFormat' );
// getting all services class
$restClasses = array ();
$restClassesList = g::rglob( '*', 0, PATH_CORE . 'services/' );
$restClassesList = Bootstrap::rglob( '*', 0, PATH_CORE . 'services/' );
foreach ($restClassesList as $classFile) {
if (substr( $classFile, - 4 ) === '.php') {
$restClasses[str_replace( '.php', '', basename( $classFile ) )] = $classFile;
@@ -750,7 +746,7 @@ class G
}
if (! empty( $apiClassesPath )) {
$pluginRestClasses = array ();
$restClassesList = g::rglob( '*', 0, $apiClassesPath . 'services/' );
$restClassesList = Bootstrap::rglob( '*', 0, $apiClassesPath . 'services/' );
foreach ($restClassesList as $classFile) {
if (substr( $classFile, - 4 ) === '.php') {
$pluginRestClasses[str_replace( '.php', '', basename( $classFile ) )] = $classFile;
@@ -864,7 +860,7 @@ class G
public function streamJSTranslationFile($filename, $locale = 'en') {
header ( 'Content-Type: text/javascript' );
if (! g::LoadTranslationObject ( $locale )) {
if (! Bootstrap::LoadTranslationObject ( $locale )) {
header ( 'Cache-Control: no-cache' );
header ( 'Pragma: no-cache' );
return;
@@ -902,7 +898,7 @@ class G
}
}
return JSMin::minify ( 'var TRANSLATIONS = ' . g::json_encode ( $translation ) . ';' );
return 'var TRANSLATIONS = ' . Bootstrap::json_encode ( $translation ) . ";\n";
}
/**
@@ -934,25 +930,15 @@ class G
$skinName = "classic";
}
if ($skinName == "classic") {
$configurationFile = g::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP . 'config.xml';
$configurationFile = Bootstrap::ExpandPath( "skinEngine" ) . 'base' . PATH_SEP . 'config.xml';
} else {
$configurationFile = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
if (! is_file( $configurationFile )) {
$configurationFile = g::ExpandPath( "skinEngine" ) . $skinName . PATH_SEP . 'config.xml';
$configurationFile = Bootstrap::ExpandPath( "skinEngine" ) . $skinName . PATH_SEP . 'config.xml';
}
}
//Read Configuration File
$xmlConfiguration = file_get_contents( $configurationFile );
$xmlConfigurationObj = g::xmlParser( $xmlConfiguration );
$baseSkinDirectory = dirname( $configurationFile );
$directorySize = g::getDirectorySize( $baseSkinDirectory );
$mtime = $directorySize['maxmtime'];
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
//$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
$gmt_mtime = gmdate( "D, d M Y H:i:s", $mtime ) . " GMT";
header( 'Pragma: cache' );
header( 'ETag: "' . md5( $mtime . $filename ) . '"' );
@@ -974,6 +960,16 @@ class G
}
}
//Read Configuration File
$xmlConfiguration = file_get_contents( $configurationFile );
$xmlConfigurationObj = Bootstrap::xmlParser( $xmlConfiguration );
$baseSkinDirectory = dirname( $configurationFile );
$directorySize = Bootstrap::getDirectorySize( $baseSkinDirectory );
$mtime = $directorySize['maxmtime'];
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
//$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
$outputHeader = "/* Autogenerated CSS file by gulliver framework \n";
$outputHeader .= " Skin: $filename\n";
$outputHeader .= " Configuration: $configurationFile\n";
@@ -981,46 +977,11 @@ class G
$gmt_mtimeNow = gmdate( "D, d M Y H:i:s", $mtimeNow ) . " GMT";
$outputHeader .= " Date: $gmt_mtimeNow*/\n";
$output = "";
//Base files
switch (strtolower( $skinVariant )) {
case "extjs":
//Basepublic function getDirectorySize ($path, $maxmtime = 0)
{
$totalsize = 0;
$totalcount = 0;
$dircount = 0;
if ($handle = opendir( $path )) {
while (false !== ($file = readdir( $handle ))) {
$nextpath = $path . '/' . $file;
if ($file != '.' && $file != '..' && ! is_link( $nextpath ) && $file != '.svn') {
if (is_dir( $nextpath )) {
$dircount ++;
$result = g::getDirectorySize( $nextpath, $maxmtime );
$totalsize += $result['size'];
$totalcount += $result['count'];
$dircount += $result['dircount'];
$maxmtime = $result['maxmtime'] > $maxmtime ? $result['maxmtime'] : $maxmtime;
} elseif (is_file( $nextpath )) {
$totalsize += filesize( $nextpath );
$totalcount ++;
$mtime = filemtime( $nextpath );
if ($mtime > $maxmtime) {
$maxmtime = $mtime;
}
}
}
}
}
closedir( $handle );
$total['size'] = $totalsize;
$total['count'] = $totalcount;
$total['dircount'] = $dircount;
$total['maxmtime'] = $maxmtime;
return $total;
}
//Base
$baseCSSPath = PATH_SKIN_ENGINE . "base" . PATH_SEP . "baseCss" . PATH_SEP;
$output .= file_get_contents( $baseCSSPath . 'ext-all-notheme.css' );
//$output .= file_get_contents ( $publicExtPath . 'ext-all.css' );
@@ -1030,13 +991,11 @@ class G
break;
default:
break;
}
//Get Browser Info
$infoBrowser = g::get_current_browser();
$infoBrowser = Bootstrap::get_current_browser();
$browserName = $infoBrowser['browser_working'];
if (isset( $infoBrowser[$browserName . '_data'] )) {
if ($infoBrowser[$browserName . '_data'][0] != "") {
@@ -1046,7 +1005,7 @@ class G
//Read Configuration File
$xmlConfiguration = file_get_contents ( $configurationFile );
$xmlConfigurationObj = g::xmlParser($xmlConfiguration);
$xmlConfigurationObj = Bootstrap::xmlParser($xmlConfiguration);
$skinFilesArray=$xmlConfigurationObj->result['skinConfiguration']['__CONTENT__']['cssFiles']['__CONTENT__'][$skinVariant]['__CONTENT__']['cssFile'] ;
foreach ($skinFilesArray as $keyFile => $cssFileInfo) {
@@ -1055,7 +1014,7 @@ class G
if (((in_array($browserName, $enabledBrowsers))||(in_array('ALL', $enabledBrowsers)))&&(!(in_array($browserName, $disabledBrowsers)))) {
if ($cssFileInfo['__ATTRIBUTES__']['file'] == 'rtl.css') {
g::LoadClass('serverConfiguration');
Bootstrap::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton();
if (!(defined('SYS_LANG'))) {
if (isset($_SERVER['HTTP_REFERER'])) {
@@ -1162,7 +1121,7 @@ class G
*/
public function getCheckSum ($files)
{
g::LoadClass( 'system' );
Bootstrap::LoadClass( 'system' );
$key = System::getVersion();
if (! is_array( $files )) {
@@ -1252,7 +1211,7 @@ class G
if (is_array( $vVar )) {
foreach ($vVar as $sKey => $vValue) {
if (is_array( $vValue )) {
g::strip_slashes( $vVar[$sKey] );
Bootstrap::strip_slashes( $vVar[$sKey] );
} else {
$vVar[$sKey] = stripslashes( $vVar[$sKey] );
}
@@ -1321,7 +1280,7 @@ class G
$paths = glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
$files = glob($path.$pattern, $flags);
foreach ($paths as $path) {
$files = array_merge($files, g::rglob($pattern, $flags, $path));
$files = array_merge($files, Bootstrap::rglob($pattern, $flags, $path));
}
return $files;
}
@@ -1336,7 +1295,7 @@ class G
if ( function_exists('json_encode') ) {
return json_encode($Json);
} else {
g::LoadThirdParty('pear/json', 'class.json');
Bootstrap::LoadThirdParty('pear/json', 'class.json');
$oJSON = new Services_JSON();
return $oJSON->encode($Json);
}
@@ -1352,7 +1311,7 @@ class G
if (function_exists('json_decode')) {
return json_decode($Json);
} else {
g::LoadThirdParty('pear/json', 'class.json');
Bootstrap::LoadThirdParty('pear/json', 'class.json');
$oJSON = new Services_JSON();
return $oJSON->decode($Json);
}
@@ -1453,7 +1412,7 @@ class G
if ($file != '.' && $file != '..' && ! is_link( $nextpath ) && $file != '.svn') {
if (is_dir( $nextpath )) {
$dircount ++;
$result = g::getDirectorySize( $nextpath, $maxmtime );
$result = Bootstrap::getDirectorySize( $nextpath, $maxmtime );
$totalsize += $result['size'];
$totalcount += $result['count'];
$dircount += $result['dircount'];
@@ -1653,9 +1612,9 @@ class G
}
}
$mobile_test = g::check_is_mobile( $browser_user_agent );
$mobile_test = Bootstrap::check_is_mobile( $browser_user_agent );
if ( $mobile_test ) {
$a_mobile_data = g::get_mobile_data( $browser_user_agent );
$a_mobile_data = Bootstrap::get_mobile_data( $browser_user_agent );
$ua_type = 'mobile';
}
@@ -1719,7 +1678,7 @@ class G
}
}
$start_pos += g::get_set_count( 'get' );
$start_pos += Bootstrap::get_set_count( 'get' );
$string_working_number = substr( $pv_browser_user_agent, $start_pos, $substring_length );
$string_working_number = substr( $string_working_number, 0, strcspn($string_working_number, ' );/') );
if (!is_numeric( substr( $string_working_number, 0, 1 ))) {
@@ -1841,7 +1800,7 @@ class G
case 'mac':
if (strstr($pv_browser_string, 'os x')) {
if (strstr($pv_browser_string, 'os x ')) {
$os_working_number = str_replace( '_', '.', g::get_item_version( $pv_browser_string, 'os x' ) );
$os_working_number = str_replace( '_', '.', Bootstrap::get_item_version( $pv_browser_string, 'os x' ) );
} else {
$os_working_number = 10;
}
@@ -1940,7 +1899,7 @@ class G
for ($k = 0; $k < $k_count; $k++) {
if (strstr( $pv_browser_user_agent, $a_mobile_browser[$k] )) {
$mobile_browser = $a_mobile_browser[$k];
$mobile_browser_number = g::get_item_version( $pv_browser_user_agent, $mobile_browser );
$mobile_browser_number = Bootstrap::get_item_version( $pv_browser_user_agent, $mobile_browser );
break;
}
}
@@ -1949,9 +1908,9 @@ class G
if (strstr( $pv_browser_user_agent, $a_mobile_device[$k] )) {
$mobile_device = trim ( $a_mobile_device[$k], '-_' ); // but not space trims yet
if ($mobile_device == 'blackberry') {
g::get_set_count( 'set', 0 );
Bootstrap::get_set_count( 'set', 0 );
}
$mobile_device_number = g::get_item_version( $pv_browser_user_agent, $mobile_device );
$mobile_device_number = Bootstrap::get_item_version( $pv_browser_user_agent, $mobile_device );
$mobile_device = trim( $mobile_device ); // some of the id search strings have white space
break;
}
@@ -1960,7 +1919,7 @@ class G
for ($k = 0; $k < $k_count; $k++) {
if (strstr( $pv_browser_user_agent, $a_mobile_os[$k] )) {
$mobile_os = $a_mobile_os[$k];
$mobile_os_number = str_replace( '_', '.', g::get_item_version( $pv_browser_user_agent, $mobile_os ) );
$mobile_os_number = str_replace( '_', '.', Bootstrap::get_item_version( $pv_browser_user_agent, $mobile_os ) );
break;
}
}
@@ -1968,14 +1927,14 @@ class G
for ($k = 0; $k < $k_count; $k++) {
if (strstr( $pv_browser_user_agent, $a_mobile_server[$k] )) {
$mobile_server = $a_mobile_server[$k];
$mobile_server_number = g::get_item_version( $pv_browser_user_agent, $mobile_server );
$mobile_server_number = Bootstrap::get_item_version( $pv_browser_user_agent, $mobile_server );
break;
}
}
// just for cases where we know it's a mobile device already
if (!$mobile_os && ( $mobile_browser || $mobile_device || $mobile_server ) && strstr( $pv_browser_user_agent, 'linux' ) ) {
$mobile_os = 'linux';
$mobile_os_number = g::get_item_version( $pv_browser_user_agent, 'linux' );
$mobile_os_number = Bootstrap::get_item_version( $pv_browser_user_agent, 'linux' );
}
$a_mobile_data = array( $mobile_device, $mobile_browser, $mobile_browser_number, $mobile_os, $mobile_os_number, $mobile_server, $mobile_server_number, $mobile_device_number );
@@ -2020,7 +1979,7 @@ class G
$plain = '/sys' . SYS_TEMP;
for ($i = 2; $i < count( $aRequestUri ); $i ++) {
$decoded = g::decrypt( urldecode( $aRequestUri[$i] ), URL_KEY );
$decoded = Bootstrap::decrypt( urldecode( $aRequestUri[$i] ), URL_KEY );
if ($decoded == 'sWì') {
$decoded = $VARS[$i]; //this is for the string "../"
}
@@ -2169,7 +2128,7 @@ class G
public function createUID ($scope, $id)
{
$e = $scope . $id;
$e = g::encrypt( $e, URL_KEY );
$e = Bootstrap::encrypt( $e, URL_KEY );
$e = str_replace( array ('+','/','='
), array ('__','_','___'
), base64_encode( $e ) );
@@ -2192,7 +2151,7 @@ class G
), array ('___','__','_'
), $uid );
$e = base64_decode( $e );
$e = g::decrypt( $e, URL_KEY );
$e = Bootstrap::decrypt( $e, URL_KEY );
$e = substr( $e, strlen( $scope ) );
return $e;
}
@@ -2210,7 +2169,7 @@ class G
$arrays = & func_get_args();
foreach ($arrays as $array_i) {
if (is_array( $array_i )) {
g::array_merge_2( $array, $array_i );
Bootstrap::array_merge_2( $array, $array_i );
}
}
return $array;
@@ -2232,7 +2191,7 @@ class G
if (! isset( $array[$k] )) {
$array[$k] = array ();
}
g::array_merge_2( $array[$k], $v );
Bootstrap::array_merge_2( $array[$k], $v );
} else {
if (isset( $array[$k] ) && is_array( $array[$k] )) {
$array[$k][0] = $v;
@@ -2265,7 +2224,7 @@ class G
if (! is_array( $result )) {
$result = array ();
}
$result = $result + g::getSystemConstants();
$result = $result + Bootstrap::getSystemConstants();
$__textoEval = "";
$u = 0;
//$count=preg_match_all('/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))/',$sqlString,$match,PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
@@ -2280,7 +2239,7 @@ class G
$u = $match[0][$r][1] + strlen( $match[0][$r][0] );
//Mysql quotes scape
if (($match[1][$r][0] == '@') && (isset( $result[$match[2][$r][0]] ))) {
$__textoEval .= "\"" . g::sqlEscape( $result[$match[2][$r][0]], $DBEngine ) . "\"";
$__textoEval .= "\"" . Bootstrap::sqlEscape( $result[$match[2][$r][0]], $DBEngine ) . "\"";
continue;
}
//URL encode
@@ -2300,14 +2259,14 @@ class G
}
//Substring (Sub replaceDataField)
if (($match[1][$r][0]=='!')&&(isset($result[$match[2][$r][0]]))) {
$__textoEval.=g::replaceDataField($result[$match[2][$r][0]],$result);
$__textoEval.=Bootstrap::replaceDataField($result[$match[2][$r][0]],$result);
continue;
}
//Call function
if (($match[1][$r][0]==='')&&($match[2][$r][0]==='')&&($match[3][$r][0]!=='')) {
eval('$strAux = ' . $match[3][$r][0] . '(\'' . addcslashes(g::replaceDataField(stripslashes($match[4][$r][0]),$result),'\\\'') . '\');');
eval('$strAux = ' . $match[3][$r][0] . '(\'' . addcslashes(Bootstrap::replaceDataField(stripslashes($match[4][$r][0]),$result),'\\\'') . '\');');
if ($match[3][$r][0] == "g::LoadTranslation") {
if ($match[3][$r][0] == "Bootstrap::LoadTranslation") {
$arraySearch = array("'");
$arrayReplace = array("\\'");
$strAux = str_replace($arraySearch, $arrayReplace, $strAux);
@@ -2318,12 +2277,12 @@ class G
}
//Non-quoted
if (($match[1][$r][0]=='#')&&(isset($result[$match[2][$r][0]]))) {
$__textoEval.=g::replaceDataField($result[$match[2][$r][0]],$result);
$__textoEval.=Bootstrap::replaceDataField($result[$match[2][$r][0]],$result);
continue;
}
//Non-quoted =
if (($match[1][$r][0]=='=')&&(isset($result[$match[2][$r][0]]))) {
$__textoEval.=g::replaceDataField($result[$match[2][$r][0]],$result);
$__textoEval.=Bootstrap::replaceDataField($result[$match[2][$r][0]],$result);
continue;
}
}
@@ -2351,7 +2310,7 @@ class G
*/
public function getSystemConstants($params = null)
{
$t1 = g::microtime_float();
$t1 = Bootstrap::microtime_float();
$sysCon = array();
if (defined("SYS_LANG")) {
@@ -2382,7 +2341,7 @@ class G
switch ($params->option) {
case "STORED SESSION":
if (isset($params->SID)) {
g::LoadClass("sessions");
Bootstrap::LoadClass("sessions");
$oSessions = new Sessions($params->SID);
$sysCon = array_merge($sysCon, $oSessions->getGlobals());
@@ -2446,7 +2405,7 @@ class G
}
$temp = $strTemplateName . ".php";
$file = g::ExpandPath( 'templates' ) . $temp;
$file = Bootstrap::ExpandPath( 'templates' ) . $temp;
// Check if its a user template
if (file_exists( $file )) {
//require_once( $file );
@@ -2479,7 +2438,7 @@ class G
} else {
if ($createPath) {
//TODO:: Define Environment constants: Devel (0777), Production (0770), ...
G::mk_dir( $strPath, 0777 );
Bootstrap::mk_dir( $strPath, 0777 );
} else {
return false;
}
@@ -2555,18 +2514,18 @@ class G
$MONTHS = Array ();
for ($i = 1; $i <= 12; $i ++) {
$MONTHS[$i] = g::LoadTranslation( "ID_MONTH_$i", $lang );
$MONTHS[$i] = Bootstrap::LoadTranslation( "ID_MONTH_$i", $lang );
}
$d = (int) $day;
$dd = g::complete_field( $day, 2, 1 );
$dd = Bootstrap::complete_field( $day, 2, 1 );
//missing D
$M = $MONTHS[$month];
$m = (int) $month;
$mm = g::complete_field( $month, 2, 1 );
$mm = Bootstrap::complete_field( $month, 2, 1 );
$yy = substr( $year, strlen( $year ) - 2, 2 );
$yyyy = $year;
@@ -2695,7 +2654,7 @@ class G
public function encryptlink ($url)
{
if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') {
return urlencode( G::encrypt( $url, URL_KEY ) );
return urlencode( Bootstrap::encrypt( $url, URL_KEY ) );
} else {
return $url;
}

View File

@@ -214,231 +214,6 @@ class G
{
return array_sum( explode( ' ', microtime() ) );
}
/* custom error functions */
/**
* &setFatalErrorHandler
*
* @param string $newFatalErrorHandler default value null
*
* @return boolean true
*/
public function &setFatalErrorHandler ($newFatalErrorHandler = null)
{
if (isset( $newFatalErrorHandler )) {
set_error_handler( $newFatalErrorHandler );
} else {
ob_start( array ('G','fatalErrorHandler'
) );
}
return true;
}
/**
* setErrorHandler
*
* @param string setErrorHandler
* @param object $newCustomErrorHandler
*
* @return boolean true
*/
/*public static*/
public function setErrorHandler ($newCustomErrorHandler = null)
{
if (isset( $newCustomErrorHandler )) {
set_error_handler( $newCustomErrorHandler );
} else {
set_error_handler( array ("G","customErrorHandler") );
}
return true;
}
/**
* fatalErrorHandler
*
* @param string $buffer
*
* @return string $errorBox or $buffer
*/
/*public static*/
public function fatalErrorHandler ($buffer)
{
// The ereg function has been DEPRECATED as of PHP 5.3.0.
// if (ereg("(error</b>:)(.+)(<br)", $buffer, $regs) ) {
if (preg_match( "/(error</b>:)(.+)(<br)/", $buffer, $regs )) {
$err = preg_replace( "/<.*?>/", "", $regs[2] );
G::customErrorLog( 'FATAL', $err, '', 0, '' );
$ip_addr = G::getIpAddress();
$errorBox = "<table cellpadding=1 cellspacing=0 border=0 bgcolor=#808080 width=250><tr><td >" . "<table cellpadding=2 cellspacing=0 border=0 bgcolor=white width=100%>" . "<tr bgcolor=#d04040><td colspan=2 nowrap><font color=#ffffaa><code> ERROR CAUGHT check log file</code></font></td></tr>" . "<tr ><td colspan=2 nowrap><font color=black><code>IP address: $ip_addr</code></font></td></tr> " . "</table></td></tr></table>";
return $errorBox;
}
return $buffer;
}
/**
* customErrorHandler
*
* @param string $errno
* @param string $msg
* @param string $file
* @param string $line
* @param string $context
*
* @return void
*/
/*public static*/
public function customErrorHandler ($errno, $msg, $file, $line, $context)
{
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
$type = "FATAL";
G::customErrorLog( $type, $msg, $file, $line );
G::verboseError( $type, $errno, $msg, $file, $line, $context );
if (defined( "ERROR_SHOW_SOURCE_CODE" ) && ERROR_SHOW_SOURCE_CODE) {
G::showErrorSource( $type, $msg, $file, $line, "#c00000" );
}
die();
break;
case E_WARNING:
case E_USER_WARNING:
$type = "WARNING";
G::customErrorLog( $type, $msg, $file, $line );
break;
case E_NOTICE:
case E_USER_NOTICE:
$type = "NOTICE";
if (defined( "ERROR_LOG_NOTICE_ERROR" ) && ERROR_LOG_NOTICE_ERROR) {
G::customErrorLog( $type, $msg, $file, $line );
}
break;
case E_STRICT:
$type = "STRICT"; //dont show STRICT Errors
break;
default:
$type = "ERROR ($errno)";
G::customErrorLog( $type, $msg, $file, $line );
break;
}
if (defined( "ERROR_SHOW_SOURCE_CODE" ) && ERROR_SHOW_SOURCE_CODE && $errno != E_STRICT) {
G::showErrorSource( $type, $msg, $file, $line );
}
}
/**
* public function showErrorSource
*
* @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public
* @param eter string type
* @param eter string msg
* @param eter string file
* @param eter string line
* @return string
*/
public function showErrorSource ($type, $msg, $file, $line)
{
global $__src_array;
$line_offset = 3;
if (! isset( $__src_array[$file] )) {
$__src_array[$file] = @file( $file );
}
if (! $__src_array[$file]) {
return;
}
if ($line - $line_offset < 1) {
$start = 1;
} else {
$start = $line - $line_offset;
}
if ($line + $line_offset > count( $__src_array[$file] )) {
$end = count( $__src_array[$file] );
} else {
$end = $line + $line_offset;
}
print "<table cellpadding=1 cellspacing=0 border=0 bgcolor=#808080 width=80%><tr><td >";
print "<table cellpadding=2 cellspacing=0 border=0 bgcolor=white width=100%>";
print "<tr bgcolor=#d04040>
<td colspan=2 nowrap><font color=#ffffaa><code> $type: $msg</code></font></td></tr>
<tr >
<td colspan=2 nowrap><font color=gray>File: $file</font></td></tr>";
for ($i = $start; $i <= $end; $i ++) {
$str = @highlight_string( "<?php" . $__src_array[$file][$i - 1] . "?>", true );
$pos1 = strpos( $str, "&lt;?" );
$pos2 = strrpos( $str, "?&gt;" );
$str = substr( $str, 0, $pos1 ) . substr( $str, $pos1 + 5, $pos2 - ($pos1 + 5) ) . substr( $str, $pos2 + 5 );
($i == $line) ? $bgcolor = "bgcolor=#ffccaa" : $bgcolor = "bgcolor=#ffffff";
print "<tr><td bgcolor=#d0d0d0 width=15 align=right><code>$i</code></td>
<td $bgcolor>$str</td></tr>";
}
print "</table></td></tr></table><p>";
}
/**
* customErrorLog
*
* @param string $type
* @param string $msg
* @param string $file
* @param string $line
*
* @return void
*/
public function customErrorLog ($type, $msg, $file, $line)
{
global $HTTP_X_FORWARDED_FOR, $REMOTE_ADDR, $HTTP_USER_AGENT, $REQUEST_URI;
$ip_addr = G::getIpAddress();
if (defined( 'APPLICATION_CODE' )) {
$name = APPLICATION_CODE;
} else {
$name = "php";
}
if ($file != '') {
$msg .= " in $file:$line ";
}
$date = date( 'Y-m-d H:i:s' );
$REQUEST_URI = getenv( 'REQUEST_URI' );
$HTTP_USER_AGENT = getenv( 'HTTP_USER_AGENT' );
error_log( "[$date] [$ip_addr] [$name] $type: $msg [$HTTP_USER_AGENT] URI: $REQUEST_URI", 0 );
}
/**
* verboseError
*
* @param string $type
* @param string $errno
* @param string $msg
* @param string $file
* @param string $line
* @param string $context
*
* @return void
*/
/*public static*/
public function verboseError ($type, $errno, $msg, $file, $line, $context)
{
global $SERVER_ADMIN;
print "<h1>Error!</h1>";
print "An error occurred while executing this script. Please
contact the <a href=mailto:$SERVER_ADMIN>$SERVER_ADMIN</a> to
report this error.";
print "<p>";
print "Here is the information provided by the script:";
print "<hr><pre>";
print "Error type: $type (code: $errno)<br>";
print "Error message: $msg<br>";
print "Script name and line number of error: $file:$line<br>";
print "Variable context when error occurred: <br>";
print_r( $context );
print "</pre><hr>";
}
/**
* * Encrypt and decrypt functions ***
@@ -1330,129 +1105,10 @@ class G
G::header( "location: /errors/error404.php?l=" . $_SERVER['REQUEST_URI'] );
}
switch (strtolower( $typefile )) {
case "js":
$paths = explode( '/', $filename );
$jsName = $paths[count( $paths ) - 1];
$output = '';
$pathJs = PATH_GULLIVER_HOME . PATH_SEP . 'js' . PATH_SEP;
switch ($jsName) {
case 'draw2d.js':
$filename = PATH_GULLIVER_HOME . 'js/ext/min/draw2d.js';
@readfile( $filename );
/* this code is commented, because in run time we dont generate the file ext-all.js
the file was generate once and the committed to git. If there are changes in the included
files we need to regenerate the file manually.
$cachePath = PATH_C . 'ExtJs' . PATH_SEP;
$checksum = G::getCheckSum( array ($pathJs . 'ext/wz_jsgraphics.js',$pathJs . 'ext/mootools.js',$pathJs . 'ext/moocanvas.js'
) );
$cf = $cachePath . "ext-draw2d-cache.$checksum.js";
$cfStored = G::getCacheFileNameByPattern( $cachePath, 'ext-draw2d-cache.*.js' );
//error_log("draw2d.js ".$checksum ."==". $cfStored['checksum']);
if (is_file( $cfStored['filename'] ) && $checksum == $cfStored['checksum']) {
$output = file_get_contents( $cf );
} else {
if (is_file( $cfStored['filename'] )) {
@unlink( $cfStored['filename'] );
}
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/wz_jsgraphics.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/mootools.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/moocanvas.js' ) );
$output .= file_get_contents( $pathJs . 'ext/draw2d.js' ); //already minified
file_put_contents( $cf, $output );
}
*/
break;
case 'ext-all.js':
if ( substr($filename,-10) == "ext-all.js" ) {
$filename = PATH_GULLIVER_HOME . 'js/ext/min/ext-all.js';
}
@readfile( $filename );
/* this code is commented, because in run time we dont generate the file ext-all.js
the file was generate once and the committed to git. If there are changes in the included
files we need to regenerate the file manually.
$cachePath = PATH_C . 'ExtJs' . PATH_SEP;
$checksum = G::getCheckSum( array ($pathJs . 'ext/pmos-common.js',$pathJs . 'ext/ux/miframe.js',$pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js',$pathJs . 'ext/ux.statusbar/ext-statusbar.js',$pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js'
) );
$cfStored = G::getCacheFileNameByPattern( $cachePath, 'ext-all-cache.*.js' );
$cf = PATH_C . 'ExtJs' . PATH_SEP . "ext-all-cache.$checksum.js";
if (is_file( $cfStored['filename'] ) && $checksum == $cfStored['checksum']) {
$output = file_get_contents( $cf );
} else {
if (is_file( $cfStored['filename'] )) {
@unlink( $cfStored['filename'] );
}
$output .= file_get_contents( $pathJs . 'ext/ext-all.js' ); //already minified
$output .= file_get_contents( $pathJs . 'ext/ux/ux-all.js' ); //already minified
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/pmos-common.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/ux/miframe.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/ux.locationbar/Ext.ux.LocationBar.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/ux.statusbar/ext-statusbar.js' ) );
$output .= JSMin::minify( file_get_contents( $pathJs . 'ext/ux.treefilterx/Ext.ux.tree.TreeFilterX.js' ) );
file_put_contents( $cf, $output );
}
*/
break;
default:
@readfile( $filename );
break;
}
print $output;
break;
case 'css':
print G::trimSourceCodeFile( $filename );
break;
default:
@readfile( $filename );
break;
}
}
/**
* trimSourceCodeFile
*
* @param string $filename
*
* @return string $output
*/
public function trimSourceCodeFile ($filename)
{
$handle = fopen( $filename, "r" );
$lastChar = '';
$firstChar = '';
$content = '';
$line = '';
if ($handle) {
while (! feof( $handle )) {
//$line = trim( fgets($handle, 16096) ) . "\n" ;
$line = fgets( $handle, 16096 );
$content .= $line;
}
fclose( $handle );
}
return $content;
$index = 0;
$output = '';
while ($index < strlen( $content )) {
$car = $content[$index];
$index ++;
if ($car == '/' && isset( $content[$index] ) && $content[$index] == '*') {
$endComment = false;
$index ++;
while ($endComment == false && $index < strlen( $content )) {
if ($content[$index] == '*' && isset( $content[$index + 1] ) && $content[$index + 1] == '/') {
$endComment = true;
$index ++;
}
$index ++;
}
$car = '';
}
$output .= $car;
}
return $output;
}
/**
@@ -3371,7 +3027,7 @@ class G
/**
* Validate and emai address in complete forms,
*
* @author Erik A.O. <erik@gmail.com, aortiz.erik@gmail.com>
* @author Erik A.O. <erik@colosa.com>
* i.e. if the param. is 'erik a.o. <erik@colosa.com>'
* -> returns a object within $o->email => erik@colosa.com and $o->name => erik A.O. in other case returns false
*
@@ -3404,7 +3060,7 @@ class G
/**
* JSON encode
*
* @author Erik A.O. <erik@gmail.com, aortiz.erik@gmail.com>
* @author Erik A.O. <erik@colosa.com>
*/
public function json_encode($Json)
{
@@ -3420,7 +3076,7 @@ class G
/**
* JSON decode
*
* @author Erik A.O. <erik@gmail.com, aortiz.erik@gmail.com>
* @author Erik A.O. <erik@colosa.com>
*/
public function json_decode($Json)
{
@@ -3689,11 +3345,11 @@ class G
return $infoUser;
}
public function getModel($model)
{
require_once "classes/model/$model.php";
return new $model();
}
//public function getModel($model)
//{
// require_once "classes/model/$model.php";
// return new $model();
//}
/**
* Recursive Is writeable function

View File

@@ -4922,8 +4922,9 @@ class XmlForm
}
}
$oJSON = new Services_JSON();
$this->objectRequiredFields = str_replace( '"', "%27", str_replace( "'", "%39", $oJSON->encode( $this->requiredFields ) ) );
//$oJSON = new Services_JSON();
$jsonRequired = G::json_encode( $this->requiredFields );
$this->objectRequiredFields = str_replace( '"', "%27", str_replace( "'", "%39", $jsonRequired ) );
//Load the default values
//$this->setDefaultValues();

View File

@@ -50,8 +50,8 @@ class dashletRssReader implements DashletInterface
curl_setopt( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $pCurl, CURLOPT_TIMEOUT, 20 );
curl_setopt( $pCurl, CURLOPT_NOPROGRESS, false );
curl_setopt( $pCurl, CURLOPT_VERBOSE, true );
curl_setopt( $pCurl, CURLOPT_NOPROGRESS, true );
curl_setopt( $pCurl, CURLOPT_VERBOSE, false );
//Apply proxy settings
$sysConf = System::getSystemConfiguration();

View File

@@ -66,7 +66,7 @@ class PMmemcached
$this->version = $this->mem->getVersion();
}
} else {
G::Loadclass( 'fileCache' );
require_once ('classes/class.fileCache.php');
// create cache folder
$cacheFolder = PATH_DATA . "sites/" . $workspace . "/cachefiles/";
if (! file_exists( $cacheFolder )) {

View File

@@ -1102,7 +1102,7 @@ class PMPluginRegistry
{
try {
$iPlugins = 0;
G::LoadClass( 'serverConfiguration' );
require_once ( 'class.serverConfiguration.php' );
$oServerConf = & serverConf::getSingleton();
$oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails );
foreach ($this->_aPluginDetails as $namespace => $detail) {

View File

@@ -120,7 +120,9 @@ if (strlen($msgType) > 0) {
$_SESSION['FAILED_LOGINS'] = $sFailedLogins;
//translation
$Translations = G::getModel("Translation");
//$Translations = G::getModel("Translation");
require_once "classes/model/Translation.php";
$Translations = new Translation();
$translationsTable = $Translations->getTranslationEnvironments();
$availableLangArray = array ();

View File

@@ -83,10 +83,13 @@ function getWorkspacesAvailable()
sort ($filesArray, SORT_STRING);
return $filesArray;
}
$availableWorkspace = getWorkspacesAvailable ();
//Translations
$Translations = G::getModel("Translation");
//$Translations = G::getModel("Translation"); <-- ugly way to get a class
require_once "classes/model/Translation.php";
$Translations = new Translation();
$translationsTable = $Translations->getTranslationEnvironments();
$availableLangArray = array ();
@@ -103,7 +106,6 @@ foreach ($translationsTable as $locale) {
$availableLangArray [] = $aFields;
}
$availableWorkspaceArray = array ();
$availableWorkspaceArray [] = array ('ENV_ID' => 'char', 'ENV_NAME' => 'char');
foreach ($availableWorkspace as $envKey => $envName) {
@@ -120,8 +122,9 @@ $_SESSION ['_DBArray'] = $_DBArray;
$aField ['LOGIN_VERIFY_MSG'] = G::loadTranslation ('LOGIN_VERIFY_MSG');
$aField['USER_LANG'] = SYS_LANG;
//Get Server Configuration
G::LoadClass ('serverConfiguration');
//G::LoadClass ('serverConfiguration'); //already called
$oServerConf = & serverConf::getSingleton ();
$G_PUBLISH = new Publisher ();
@@ -131,8 +134,8 @@ if ($oServerConf->getProperty ('LOGIN_NO_WS')) {
$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'login/sysLogin', '', $aField, 'sysLogin');
}
G::RenderPage ("publish");
?>
<script type="text/javascript">
var oInfoPanel;

View File

@@ -36,9 +36,11 @@ try {
die;
break;
}*/
$oJSON = new Services_JSON();
//$oJSON = new Services_JSON();
if (isset( $_REQUEST['data'] )) {
$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) );
$oData = G::json_decode( stripslashes( $_REQUEST['data'] ) );
//$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) );
$sOutput = '';
}

View File

@@ -15,8 +15,9 @@ try {
break;
}
$oJSON = new Services_JSON();
$aData = get_object_vars( $oJSON->decode( $_POST['oData'] ) );
//$oJSON = new Services_JSON();
$aData = get_object_vars( G::json_decode( $_POST['oData'] ));
//$aData = get_object_vars( $oJSON->decode( $_POST['oData'] ) );
if (isset( $_POST['function'] )) {
$sAction = $_POST['function'];

View File

@@ -23,7 +23,7 @@
*/
/**
* sysGeneric - ProcessMaker Bootstrap
* bootstrap - ProcessMaker Bootstrap
* this file is used initialize main variables, redirect and dispatch all requests
*/
@@ -49,6 +49,24 @@ define( 'PATH_HOME', $pathhome );
define( 'PATH_TRUNK', $pathTrunk );
define( 'PATH_OUTTRUNK', $pathOutTrunk );
//we are focusing in have this behaivour
//1. if the uri is a existing file return the file inmediately
//2. if the uri point to png, jpg, js, or css mapped in other place, return it inmediately
//3. process the uri,
//here we are putting approved CONSTANTS, I mean constants be sure we need,
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );
//this is the first path, if the file exists...
if (file_exists(PATH_HTML . $_SERVER['REQUEST_URI'])) {
//we are missing the header part
//to do: add header mime part
readfile(PATH_HTML . $_SERVER['REQUEST_URI']);
die;
}
// Defining RBAC Paths constants
define( 'PATH_RBAC_HOME', PATH_TRUNK . 'rbac' . PATH_SEP );
@@ -60,7 +78,6 @@ define( 'PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP );
define( 'PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP );
define( 'PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP ); //to enable rbac version 2
define( 'PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP );
define( 'PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP );
// Defining PMCore Path constants
define( 'PATH_CORE', PATH_HOME . 'engine' . PATH_SEP );
@@ -92,27 +109,20 @@ define( 'PATH_SERVICES_REST', PATH_CORE . 'services' . PATH_SEP . 'rest' . PATH_
require_once (PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php');
if (file_exists( FILE_PATHS_INSTALLED )) {
// backward compatibility; parsing old definitions in the compiled path constant
$tmp = file_get_contents( FILE_PATHS_INSTALLED );
if (strpos( $tmp, 'PATH_OUTTRUNK' ) !== false) {
@file_put_contents( FILE_PATHS_INSTALLED, str_replace( 'PATH_OUTTRUNK', 'PATH_DATA', $tmp ) );
}
// end backward compatibility
// include the workspace installed configuration
// include the server installed configuration
require_once FILE_PATHS_INSTALLED;
// defining system constant when a valid workspace environment exists
// defining system constant when a valid server environment exists
define( 'PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP );
define( 'PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP );
define( 'PATH_TEMPORAL', PATH_C . 'dynEditor/' );
define( 'PATH_DB', PATH_DATA . 'sites' . PATH_SEP );
// smarty constants
define( 'PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c' );
define( 'PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache' );
/* To do:
if (! is_dir( PATH_SMARTY_C )) {
G::mk_dir( PATH_SMARTY_C );
}
@@ -120,10 +130,16 @@ if (file_exists( FILE_PATHS_INSTALLED )) {
if (! is_dir( PATH_SMARTY_CACHE )) {
G::mk_dir( PATH_SMARTY_CACHE );
}
*/
}
// set include path
set_include_path( PATH_CORE . PATH_SEPARATOR . PATH_THIRDPARTY . PATH_SEPARATOR . PATH_THIRDPARTY . 'pear' . PATH_SEPARATOR . PATH_RBAC_CORE . PATH_SEPARATOR . get_include_path() );
set_include_path( PATH_CORE . PATH_SEPARATOR .
PATH_THIRDPARTY . PATH_SEPARATOR .
PATH_THIRDPARTY . 'pear' . PATH_SEPARATOR .
PATH_RBAC_CORE . PATH_SEPARATOR .
get_include_path()
);
/**
* Global definitions, before it was the defines.php file
@@ -158,13 +174,10 @@ 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' );
// Including these files we get the PM paths and definitions (that should be just one file.
require_once PATH_CORE . 'classes' . PATH_SEP . 'class.system.php';
// starting session
session_start();
$config = System::getSystemConfiguration();
$config = Bootstrap::getSystemConfiguration();
$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
@@ -191,15 +204,10 @@ $_SERVER['SERVER_ADDR'] = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_AD
//to do: make different environments. sys
define( 'ERROR_SHOW_SOURCE_CODE', true ); // enable ERROR_SHOW_SOURCE_CODE to display the source code for any WARNING OR NOTICE
//define ( 'ERROR_LOG_NOTICE_ERROR', true ); //enable ERROR_LOG_NOTICE_ERROR to log Notices messages in default apache log
//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( G::sys_get_temp_dir(), PATH_SEP ) . PATH_SEP) );
define( 'PATH_C', (rtrim( Bootstrap::sys_get_temp_dir(), PATH_SEP ) . PATH_SEP) );
define( 'PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' );
}
@@ -216,7 +224,7 @@ if (defined( 'PATH_C' )) {
}
$virtualURITable['/htmlarea/(*)'] = PATH_THIRDPARTY . 'htmlarea/';
$virtualURITable['/sys[a-zA-Z][a-zA-Z0-9]{0,}()/'] = 'sysNamed';
//$virtualURITable['/sys[a-zA-Z][a-zA-Z0-9]{0,}()/'] = 'sysNamed';
$virtualURITable['/(sys*)'] = FALSE;
$virtualURITable['/errors/(*)'] = PATH_GULLIVER_HOME . 'methods/errors/';
$virtualURITable['/gulliver/(*)'] = PATH_GULLIVER_HOME . 'methods/';
@@ -225,15 +233,15 @@ $virtualURITable['/html2ps_pdf/(*)'] = PATH_THIRDPARTY . 'html2ps_pdf/';
$virtualURITable['/images/'] = 'errorFile';
$virtualURITable['/skins/'] = 'errorFile';
$virtualURITable['/files/'] = 'errorFile';
$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}()'] = 'sysUnnamed';
//$virtualURITable['/[a-zA-Z][a-zA-Z0-9]{0,}()'] = 'sysUnnamed';
$virtualURITable['/rest/(*)'] = 'rest-service';
$virtualURITable['/update/(*)'] = PATH_GULLIVER_HOME . 'methods/update/';
$virtualURITable['/(*)'] = PATH_HTML;
//$virtualURITable['/(*)'] = PATH_HTML;
$virtualURITable['/css/(*)'] = PATH_HTML . 'css/'; //ugly
$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 (G::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
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
@@ -257,7 +265,7 @@ if (G::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html' . PATH_SEP . $filePath;
if (file_exists( $pluginFilename )) {
G::streamFile( $pluginFilename );
Bootstrap::streamFile( $pluginFilename );
}
die();
}
@@ -279,7 +287,7 @@ if (G::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
$fileToBeStreamed = str_replace( "/skin/", PATH_CUSTOM_SKINS, $_SERVER['REQUEST_URI'] );
if (file_exists( $fileToBeStreamed )) {
G::streamFile( $fileToBeStreamed );
Bootstrap::streamFile( $fileToBeStreamed );
}
die();
}
@@ -293,15 +301,15 @@ if (G::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
die();
break;
case 'jsMethod':
G::parseURI( getenv( "REQUEST_URI" ) );
Bootstrap::parseURI( getenv( "REQUEST_URI" ) );
$filename = PATH_METHODS . SYS_COLLECTION . '/' . SYS_TARGET . '.js';
G::streamFile( $filename );
Bootstrap::streamFile( $filename );
die();
break;
case 'errorFile':
header( "location: /errors/error404.php?url=" . urlencode( $_SERVER['REQUEST_URI'] ) );
if (DEBUG_TIME_LOG)
G::logTimeByPage(); //log this page
Bootstrap::logTimeByPage(); //log this page
die();
break;
default:
@@ -310,26 +318,25 @@ if (G::virtualURI( $_SERVER['REQUEST_URI'], $virtualURITable, $realPath )) {
} else {
$realPath = explode( '?', $realPath );
$realPath[0] .= strpos( basename( $realPath[0] ), '.' ) === false ? '.php' : '';
G::streamFile( $realPath[0] );
Bootstrap::streamFile( $realPath[0] );
die();
}
}
} //virtual URI parser
// the request correspond to valid php page, now parse the URI
G::parseURI( getenv( "REQUEST_URI" ), $isRestRequest );
Bootstrap::parseURI( getenv( "REQUEST_URI" ), $isRestRequest );
if (G::isPMUnderUpdating()) {
if (Bootstrap::isPMUnderUpdating()) {
header( "location: /update/updating.php" );
if (DEBUG_TIME_LOG)
G::logTimeByPage();
Bootstrap::logTimeByPage();
die();
}
// 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', G::parseTemplate( PATH_TPL . 'index.html', array ('lang' => SYS_LANG,'skin' => SYS_SKIN
file_put_contents( PATH_HTML . 'index.html', Bootstrap::parseTemplate( PATH_TPL . 'index.html', array ('lang' => SYS_LANG,'skin' => SYS_SKIN
) ) );
}
@@ -338,34 +345,33 @@ define( 'SYS_URI', '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' );
// defining the serverConf singleton
if (defined( 'PATH_DATA' ) && file_exists( PATH_DATA )) {
//Instance Server Configuration Singleton
G::LoadClass( 'serverConfiguration' );
Bootstrap::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
}
// Call Gulliver Classes
G::LoadThirdParty( 'pear/json', 'class.json' );
G::LoadThirdParty( 'smarty/libs', 'Smarty.class' );
G::LoadSystem( 'error' );
G::LoadSystem( 'dbconnection' );
G::LoadSystem( 'dbsession' );
G::LoadSystem( 'dbrecordset' );
G::LoadSystem( 'dbtable' );
G::LoadSystem( 'rbac' );
G::LoadSystem( 'publisher' );
G::LoadSystem( 'templatePower' );
G::LoadSystem( 'xmlDocument' );
G::LoadSystem( 'xmlform' );
G::LoadSystem( 'xmlformExtension' );
G::LoadSystem( 'form' );
G::LoadSystem( 'menu' );
G::LoadSystem( "xmlMenu" );
G::LoadSystem( 'dvEditor' );
G::LoadSystem( 'controller' );
G::LoadSystem( 'httpProxyController' );
G::LoadSystem( 'pmException' );
Bootstrap::LoadThirdParty( 'smarty/libs', 'Smarty.class' );
//Bootstrap::LoadSystem( 'error' );
//Bootstrap::LoadSystem( 'dbconnection' );
//Bootstrap::LoadSystem( 'dbsession' );
//Bootstrap::LoadSystem( 'dbrecordset' );
//Bootstrap::LoadSystem( 'dbtable' );
//* Bootstrap::LoadSystem( 'publisher' );
//Bootstrap::LoadSystem( 'templatePower' );
//* Bootstrap::LoadSystem( 'xmlDocument' );
//* Bootstrap::LoadSystem( 'xmlform' );
//Bootstrap::LoadSystem( 'xmlformExtension' );
//* Bootstrap::LoadSystem( 'form' );
//* Bootstrap::LoadSystem( 'menu' );
//Bootstrap::LoadSystem( "xmlMenu" );
//Bootstrap::LoadSystem( 'dvEditor' );
//Bootstrap::LoadSystem( 'controller' );
//Bootstrap::LoadSystem( 'httpProxyController' );
//Bootstrap::LoadSystem( 'pmException' );
//
// Create headPublisher singleton
G::LoadSystem( 'headPublisher' );
Bootstrap::LoadSystem( 'headPublisher' );
$oHeadPublisher = & headPublisher::getSingleton();
// Installer, redirect to install if we don't have a valid shared data folder
@@ -399,14 +405,14 @@ if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
}
// Load Language Translation
G::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );
Bootstrap::LoadTranslationObject( defined( 'SYS_LANG' ) ? SYS_LANG : "en" );
// look for a disabled workspace
if ($oServerConf->isWSDisabled( SYS_TEMP )) {
$aMessage['MESSAGE'] = G::LoadTranslation( 'ID_DISB_WORKSPACE' );
$aMessage['MESSAGE'] = Bootstrap::LoadTranslation( 'ID_DISB_WORKSPACE' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish' );
Bootstrap::RenderPage( 'publish' );
die();
}
@@ -423,8 +429,8 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
// including workspace shared classes -> particularlly for pmTables
set_include_path( get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE );
} else {
G::SendTemporalMessage( 'ID_NOT_WORKSPACE', "error" );
G::header( 'location: /sys/' . SYS_LANG . '/' . SYS_SKIN . '/main/sysLogin?errno=2' );
Bootstrap::SendTemporalMessage( 'ID_NOT_WORKSPACE', "error" );
Bootstrap::header( 'location: /sys/' . SYS_LANG . '/' . SYS_SKIN . '/main/sysLogin?errno=2' );
die();
}
} else { //when we are in global pages, outside any valid workspace
@@ -449,12 +455,17 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
$controller->call( $controllerAction );
}
} else { // classic sysLogin interface
Bootstrap::LoadSystem( 'g');
Bootstrap::LoadSystem( 'publisher' );
Bootstrap::LoadSystem( 'xmlform' );
Bootstrap::LoadSystem( 'form' );
Bootstrap::LoadSystem( 'menu' );
require_once (PATH_METHODS . "login/sysLogin.php");
die();
}
}
if (DEBUG_TIME_LOG)
G::logTimeByPage(); //log this page
Bootstrap::logTimeByPage(); //log this page
die();
}
}
@@ -472,7 +483,7 @@ define( 'SERVER_NAME', $_SERVER['SERVER_NAME'] );
define( 'SERVER_PORT', $_SERVER['SERVER_PORT'] );
// create memcached singleton
G::LoadClass( 'memcached' );
Bootstrap::LoadClass( 'memcached' );
$memcache = & PMmemcached::getSingleton( SYS_SYS );
// verify configuration for rest service
@@ -499,7 +510,7 @@ if ($isRestRequest) {
}
// load Plugins base class
G::LoadClass( 'plugin' );
Bootstrap::LoadClass( 'plugin' );
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
@@ -576,7 +587,7 @@ $oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$avoidChangedWorkspaceValidation = false;
// Load custom Classes and Model from Plugins.
G::LoadAllPluginModelClasses();
Bootstrap::LoadAllPluginModelClasses();
// jump to php file in methods directory
$collectionPlugin = '';
@@ -586,7 +597,7 @@ if ($oPluginRegistry->isRegisteredFolder( SYS_COLLECTION )) {
$collectionPlugin = $targetPlugin[0];
$avoidChangedWorkspaceValidation = true;
} else {
$phpFile = G::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
$phpFile = Bootstrap::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . SYS_TARGET . '.php';
}
// services is a special folder,
@@ -595,7 +606,7 @@ if (SYS_COLLECTION == 'services') {
$targetPlugin = explode( '/', SYS_TARGET );
if ($targetPlugin[0] == 'webdav') {
$phpFile = G::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . 'webdav.php';
$phpFile = Bootstrap::ExpandPath( 'methods' ) . SYS_COLLECTION . PATH_SEP . 'webdav.php';
}
}
@@ -603,12 +614,6 @@ if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') {
$avoidChangedWorkspaceValidation = true;
}
//the index.php file, this new feature will allow automatically redirects to valid php file inside any methods folder
/* DEPRECATED
if ( SYS_TARGET == '' ) {
$phpFile = str_replace ( '.php', 'index.php', $phpFile );
$phpFile = include ( $phpFile );
}*/
$bWE = false;
$isControllerCall = false;
if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
@@ -627,7 +632,7 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
$phpFile = $aAux[0];
if ($extension != 'php') {
G::streamFile( $phpFile );
Bootstrap::streamFile( $phpFile );
die();
}
@@ -638,6 +643,7 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
//erik: verify if it is a Controller Class or httpProxyController Class
if (is_file( PATH_CONTROLLERS . SYS_COLLECTION . '.php' )) {
Bootstrap::LoadSystem( 'controller' );
require_once PATH_CONTROLLERS . SYS_COLLECTION . '.php';
$controllerClass = SYS_COLLECTION;
//if the method name is empty set default to index method
@@ -659,7 +665,7 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') {
//redirect to login, if user changed the workspace in the URL
if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != SYS_SYS) {
$_SESSION['WORKSPACE'] = SYS_SYS;
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', "error" );
Bootstrap::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', "error" );
// verify if the current skin is a 'ux' variant
$urlPart = substr( SYS_SKIN, 0, 2 ) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login';
@@ -668,9 +674,31 @@ if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_S
}
// enable rbac
Bootstrap::LoadSystem( 'rbac' );
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER';
Bootstrap::LoadSystem( 'g');
Bootstrap::LoadSystem( 'publisher' );
Bootstrap::LoadSystem( 'xmlDocument' );
Bootstrap::LoadSystem( 'xmlform' );
Bootstrap::LoadSystem( 'form' );
Bootstrap::LoadSystem( 'menu' );
Bootstrap::LoadSystem( 'templatePower' );
//Bootstrap::LoadSystem( 'xmlformExtension' );
//Bootstrap::LoadSystem( "xmlMenu" );
//Bootstrap::LoadSystem( 'dvEditor' );
//Bootstrap::LoadSystem( 'httpProxyController' );
//Bootstrap::LoadSystem( 'pmException' );
//Bootstrap::LoadSystem( 'dbconnection' );
//Bootstrap::LoadSystem( 'dbsession' );
//Bootstrap::LoadSystem( 'dbrecordset' );
Bootstrap::LoadSystem( 'dbtable' );
Bootstrap::LoadClass( 'system' );
// 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" );
@@ -718,7 +746,7 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
$bRedirect = true;
if (isset( $_GET['sid'] )) {
G::LoadClass( 'sessions' );
Bootstrap::LoadClass( 'sessions' );
$oSessions = new Sessions();
if ($aSession = $oSessions->verifySession( $_GET['sid'] )) {
require_once 'classes/model/Users.php';
@@ -762,14 +790,14 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
/**
* New feature for Gulliver framework to support Controllers & HttpProxyController classes handling
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @author <erik@colosa.com
*/
if ($isControllerCall) { //Instance the Controller object and call the request method
$controller = new $controllerClass();
$controller->setHttpRequestData( $_REQUEST );
$controller->call( $controllerAction );
} elseif ($isRestRequest) {
G::dispatchRestService( SYS_TARGET, $restConfig, $restApiClassPath );
Bootstrap::dispatchRestService( SYS_TARGET, $restConfig, $restApiClassPath );
} else {
require_once $phpFile;
}
@@ -782,6 +810,6 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
ob_end_flush();
if (DEBUG_TIME_LOG) {
G::logTimeByPage(); //log this page
bootstrap::logTimeByPage(); //log this page
}
}

View File

@@ -234,7 +234,6 @@
}
// Call Gulliver Classes
G::LoadThirdParty('pear/json','class.json');
G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem('error');
G::LoadSystem('dbconnection');