BUG 0000 Some Fixes like unversioning index.html, cleaning up of sysGeneric

This commit is contained in:
Erik Amaru Ortiz
2012-04-09 18:48:44 -04:00
parent abc8f00daa
commit 32eace4cee
10 changed files with 453 additions and 293 deletions

View File

@@ -2066,7 +2066,7 @@ function run_workspace_backup($task, $args) {
//new db restore rotines, by Erik <erik@colosa.com> on May 17th, 2010 //new db restore rotines, by Erik <erik@colosa.com> on May 17th, 2010
//set the temporal directory for all tables into wf, rb, and rp databases //set the temporal directory for all tables into wf, rb, and rp databases
$tmpDir = G::getSysTemDir() . PATH_SEP . 'pmDbBackup' . PATH_SEP; $tmpDir = G::sys_get_temp_dir() . PATH_SEP . 'pmDbBackup' . PATH_SEP;
//create the db maintenance temporal dir //create the db maintenance temporal dir
G::mk_dir($tmpDir); G::mk_dir($tmpDir);

View File

@@ -914,6 +914,12 @@ class G
*/ */
function parseURI($uri, $config = array()) function parseURI($uri, $config = array())
{ {
//*** process the $_POST with magic_quotes enabled
// The magic_quotes_gpc feature has been DEPRECATED as of PHP 5.3.0.
if (get_magic_quotes_gpc() === 1) {
$_POST = G::strip_slashes($_POST);
}
$aRequestUri = explode('/', $uri ); $aRequestUri = explode('/', $uri );
if ( substr ( $aRequestUri[1], 0, 3 ) == 'sys' ) { if ( substr ( $aRequestUri[1], 0, 3 ) == 'sys' ) {
@@ -992,6 +998,42 @@ class G
} }
} }
function strip_slashes($vVar) {
if (is_array($vVar)) {
foreach($vVar as $sKey => $vValue) {
if (is_array($vValue)) {
G::strip_slashes($vVar[$sKey]);
}
else {
$vVar[$sKey] = stripslashes($vVar[$sKey]);
}
}
}
else {
$vVar = stripslashes($vVar);
}
return $vVar;
}
/**
* function to calculate the time used to render a page
*/
function logTimeByPage()
{
if (!defined(PATH_DATA)) {
return false;
}
$serverAddr = $_SERVER['SERVER_ADDR'];
global $startingTime;
$endTime = microtime(true);
$time = $endTime - $startingTime;
$fpt= fopen ( PATH_DATA . 'log/time.log', 'a' );
fwrite( $fpt, sprintf ( "%s.%03d %15s %s %5.3f %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), substr($serverAddr,-4), $time, $_SERVER['REQUEST_URI'] ));
fclose( $fpt);
}
/** /**
* streaming a big JS file with small js files * streaming a big JS file with small js files
* *
@@ -3138,7 +3180,7 @@ $output = $outputHeader.$output;
* Get the temporal directory path on differents O.S. i.e. /temp -> linux, C:/Temp -> win * Get the temporal directory path on differents O.S. i.e. /temp -> linux, C:/Temp -> win
* @author <erik@colosa.com> * @author <erik@colosa.com>
*/ */
function getSysTemDir() { function sys_get_temp_dir() {
if ( !function_exists('sys_get_temp_dir') ){ if ( !function_exists('sys_get_temp_dir') ){
// Based on http://www.phpit.net/ // Based on http://www.phpit.net/
// article/creating-zip-tar-archives-dynamically-php/2/ // article/creating-zip-tar-archives-dynamically-php/2/
@@ -4922,6 +4964,56 @@ function getDirectorySize($path,$maxmtime=0)
file_put_contents($file, $content); file_put_contents($file, $content);
} }
function verifyWriteAccess($resources)
{
$noWritable = array();
foreach ($resources as $i => $resource) {
if (!is_writable($resource)) {
$noWritable[] = $resource;
}
}
if (count($noWritable) > 0) {
$e = new Exception("Write access not allowed for ProcessMaker resources");
$e->files = $noWritable;
throw $e;
}
}
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';
$smarty = new Smarty();
$smarty->compile_dir = G::sys_get_temp_dir();
$smarty->cache_dir = G::sys_get_temp_dir();
$smarty->config_dir = PATH_THIRDPARTY . 'smarty/configs';
$smarty->template_dir = PATH_TEMPLATE;
$smarty->force_compile = true;
foreach ($data as $key => $value) {
$smarty->assign($key, $value);
}
$smarty->display("$template.tpl");
}
function parseTemplate($template, $data=array())
{
$content = '';
ob_start();
G::renderTemplate($template, $data);
$content = ob_get_contents();
ob_get_clean();
return $content;
}
}; };
/** /**

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex,nofollow" />
<title>Whoops, looks like something went wrong.</title>
<style>
{literal}
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
html { background: #eee; padding: 10px }
body { font: 11px Verdana, Arial, sans-serif; color: #333 }
img { border: 0; }
.clear { clear:both; height:0; font-size:0; line-height:0; }
.clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
.clear_fix { display:inline-block; }
* html .clear_fix { height:1%; }
.clear_fix { display:block; }
#content { width:970px; margin:0 auto; }
.exceptionreset, .exceptionreset .block { margin: auto }
.exceptionreset abbr { border-bottom: 1px dotted #000; cursor: help; }
.exceptionreset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
.exceptionreset strong { font-weight:bold; }
.exceptionreset a { color:#6c6159; }
.exceptionreset a img { border:none; }
.exceptionreset a:hover { text-decoration:underline; }
.exceptionreset em { font-style:italic; }
.exceptionreset h1, .exceptionreset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
.exceptionreset h2 span { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; }
.exceptionreset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
.exceptionreset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
-webkit-border-bottom-right-radius: 16px;
-webkit-border-bottom-left-radius: 16px;
-moz-border-radius-bottomright: 16px;
-moz-border-radius-bottomleft: 16px;
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
}
.exceptionreset .block_exception { background-color:#ddd; color: #333; padding:20px;
-webkit-border-top-left-radius: 16px;
-webkit-border-top-right-radius: 16px;
-moz-border-radius-topleft: 16px;
-moz-border-radius-topright: 16px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
}
.exceptionreset li a { background:none; color:#868686; text-decoration:none; }
.exceptionreset li a:hover { background:none; color:#313131; text-decoration:underline; }
.exceptionreset ol { padding: 10px 0; }
.exceptionreset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #ccc;
}
{/literal}
</style>
</head>
<body>
<div id="content" class="exceptionreset">
<h1>ProcessMaker Start, looks like something went wrong.</h1>
<div class="block_exception clear_fix"><h2>
<abbr title="RuntimeException">RuntimeException</abbr>:
Unable to write on ProcessMaker directories, change permissions to run properly.</h2>
</div>
<div class="block">
<ol class="traces list_exception">
{foreach from=$files item=file}
<li>at <abbr title="{$file}">{$file}</abbr> .... <font color="red">not writable.</font></li>
{/foreach}
</ol>
</div>
</div>
</body>
</html>

View File

@@ -142,7 +142,7 @@ class Sessions {
*/ */
public function registerGlobal($name, $value) public function registerGlobal($name, $value)
{ {
$this->tmpfile = G::getSysTemDir() . PATH_SEP . "pm-rg-{$this->sessionId}"; $this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if($this->sessionId == NULL){ if($this->sessionId == NULL){
throw new Exception('session id was not set.'); throw new Exception('session id was not set.');
@@ -180,7 +180,7 @@ class Sessions {
*/ */
public function getGlobal($name) public function getGlobal($name)
{ {
$this->tmpfile = G::getSysTemDir() . PATH_SEP . "pm-rg-{$this->sessionId}"; $this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if($this->sessionId == NULL){ if($this->sessionId == NULL){
throw new Exception('session id was not set.'); throw new Exception('session id was not set.');
@@ -217,7 +217,7 @@ class Sessions {
*/ */
public function getGlobals() public function getGlobals()
{ {
$this->tmpfile = G::getSysTemDir() . PATH_SEP . "pm-rg-{$this->sessionId}"; $this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
if($this->sessionId == NULL){ if($this->sessionId == NULL){
throw new Exception('session id was not set.'); throw new Exception('session id was not set.');
@@ -250,7 +250,7 @@ class Sessions {
if($this->sessionId == NULL){ if($this->sessionId == NULL){
throw new Exception('session id was not set.'); throw new Exception('session id was not set.');
} }
$this->tmpfile = G::getSysTemDir() . PATH_SEP . "pm-rg-{$this->sessionId}"; $this->tmpfile = G::sys_get_temp_dir() . PATH_SEP . "pm-rg-{$this->sessionId}";
@unlink($this->tmpfile); @unlink($this->tmpfile);
} }

View File

@@ -1240,8 +1240,8 @@ case "removeUserFromGroup" :
if ( isset($_FILES['form']) ) { if ( isset($_FILES['form']) ) {
foreach ($_FILES['form']['name'] as $sFieldName => $vValue) { foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
if ( $_FILES['form']['error'][$sFieldName] == 0 ){ if ( $_FILES['form']['error'][$sFieldName] == 0 ){
file_put_contents(G::getSysTemDir().PATH_SEP.$_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName])); file_put_contents(G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName]));
$filename = G::getSysTemDir().PATH_SEP.$_FILES['form']['name'][$sFieldName]; $filename = G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName];
} }
} }
} }

View File

@@ -3,6 +3,6 @@
<title>Redirector</title> <title>Redirector</title>
<meta http-equiv="PRAGMA" content="NO-CACHE" /> <meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" /> <meta http-equiv="CACHE-CONTROL" content="NO-STORE" />
<meta http-equiv="REFRESH" content="0;URL=/sys/{lang}/{skin}/login/login" /> <meta http-equiv="REFRESH" content="0;URL=/sys/{$lang}/{$skin}/login/login" />
</head> </head>
</html> </html>

View File

@@ -36,8 +36,8 @@
if ( isset($_FILES['form']) ) { if ( isset($_FILES['form']) ) {
foreach ($_FILES['form']['name'] as $sFieldName => $vValue) { foreach ($_FILES['form']['name'] as $sFieldName => $vValue) {
if ( $_FILES['form']['error'][$sFieldName] == 0 ){ if ( $_FILES['form']['error'][$sFieldName] == 0 ){
file_put_contents(G::getSysTemDir().PATH_SEP.$_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName])); file_put_contents(G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName], file_get_contents($_FILES['form']['tmp_name'][$sFieldName]));
$fpath = G::getSysTemDir().PATH_SEP.$_FILES['form']['name'][$sFieldName]; $fpath = G::sys_get_temp_dir().PATH_SEP.$_FILES['form']['name'][$sFieldName];
if( isset($_POST['INPUTS'][$sFieldName]) && $_POST['INPUTS'][$sFieldName] != '' ){ #input file type if( isset($_POST['INPUTS'][$sFieldName]) && $_POST['INPUTS'][$sFieldName] != '' ){ #input file type
ws_sendFile($fpath, $USR_UID, $caseId, 1, $_POST['INPUTS'][$sFieldName]); ws_sendFile($fpath, $USR_UID, $caseId, 1, $_POST['INPUTS'][$sFieldName]);

View File

@@ -268,7 +268,7 @@
$t->is( $methods[89] , 'pr' ,$i++. ' pr'); $t->is( $methods[89] , 'pr' ,$i++. ' pr');
$t->is( $methods[90] , 'dump' ,$i++. ' dump'); $t->is( $methods[90] , 'dump' ,$i++. ' dump');
$t->is( $methods[91] , 'stripCDATA' ,$i++. ' stripCDATA'); $t->is( $methods[91] , 'stripCDATA' ,$i++. ' stripCDATA');
$t->is( $methods[92] , 'getSysTemDir' ,$i++. ' getSysTemDir'); $t->is( $methods[92] , 'sys_get_temp_dir' ,$i++. ' sys_get_temp_dir');
$t->is( $methods[93] , 'PMWSCompositeResponse' ,$i++. ' PMWSCompositeResponse'); $t->is( $methods[93] , 'PMWSCompositeResponse' ,$i++. ' PMWSCompositeResponse');
$t->is( $methods[94] , 'emailAddress' ,$i++. ' emailAddress'); $t->is( $methods[94] , 'emailAddress' ,$i++. ' emailAddress');
$t->is( count( $methods ) , --$i , count( $methods ).' = '.$i.' ok'); $t->is( count( $methods ) , --$i , count( $methods ).' = '.$i.' ok');

View File

@@ -1,8 +0,0 @@
<html>
<head>
<title>Redirector</title>
<meta http-equiv="PRAGMA" content="NO-CACHE" />
<meta http-equiv="CACHE-CONTROL" content="NO-STORE" />
<meta http-equiv="REFRESH" content="0;URL=sys/en/classic/login/login" />
</head>
</html>

View File

@@ -1,50 +1,45 @@
<?php <?php
//sysGeneric, this file is used initialize main variables and redirect to each and all pages /**
* sysGeneric.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* sysGeneric - ProcessMaker Bootstrap
* this file is used initialize main variables and redirect to each and all pages
*/
$startingTime = microtime(true); $startingTime = microtime(true);
//*** process the $_POST with magic_quotes enabled // Defining the PATH_SEP constant, he we are defining if the the path separator symbol will be '\\' or '/'
function strip_slashes(&$vVar) {
if (is_array($vVar)) {
foreach($vVar as $sKey => $vValue) {
if (is_array($vValue)) {
strip_slashes($vVar[$sKey]);
}
else {
$vVar[$sKey] = stripslashes($vVar[$sKey]);
}
}
}
else {
$vVar = stripslashes($vVar);
}
}
// The magic_quotes_gpc feature has been DEPRECATED as of PHP 5.3.0.
// if (ini_get('magic_quotes_gpc') == '1') {
if (get_magic_quotes_gpc() === 1) {
strip_slashes($_POST);
}
//******** function to calculate the time used to render this page *****
function logTimeByPage() {
$serverAddr = $_SERVER['SERVER_ADDR'];
global $startingTime;
$endTime = microtime(true);
$time = $endTime - $startingTime;
$fpt= fopen ( PATH_DATA . 'log/time.log', 'a' );
fwrite( $fpt, sprintf ( "%s.%03d %15s %s %5.3f %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), substr($serverAddr,-4), $time, $_SERVER['REQUEST_URI'] ));
fclose( $fpt);
}
//******** defining the PATH_SEP constant, he we are defining if the the path separator symbol will be '\\' or '/' **************************
define('PATH_SEP', '/'); define('PATH_SEP', '/');
//***************** Defining the Home Directory ********************************* // Defining the Home Directory
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']); $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode(PATH_SEP , $realdocuroot); $docuroot = explode(PATH_SEP , $realdocuroot);
array_pop($docuroot); array_pop($docuroot);
$pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP; $pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP;
// try to find automatically the trunk directory where are placed the RBAC and Gulliver directories // try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
// in a normal installation you don't need to change it. // in a normal installation you don't need to change it.
array_pop($docuroot); array_pop($docuroot);
@@ -52,49 +47,20 @@
array_pop($docuroot); array_pop($docuroot);
$pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP ; $pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP ;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define('PATH_HOME', $pathhome); define('PATH_HOME', $pathhome);
define('PATH_TRUNK', $pathTrunk); define('PATH_TRUNK', $pathTrunk);
define('PATH_OUTTRUNK', $pathOutTrunk); define('PATH_OUTTRUNK', $pathOutTrunk);
//////////////////////////// start, from paths.php
/* Default configuration values (do not change these, use env.ini) */
// $default_config = array(
// 'debug' => 0,
// 'debug_sql' => 0,
// 'debug_time' => 0,
// 'debug_calendar' => 0,
// 'wsdl_cache' => 1,
// 'memory_limit' => '100M',
// 'time_zone' => 'America/La_Paz',
// 'memcached' => 0,
// 'memcached_server' => ''
// );
// /* Read the env.ini */
// $env_file = realpath($pathhome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'env.ini');
// $config = $default_config;
// if ($env_file !== false && file_exists($env_file)) {
// $ini_contents = parse_ini_file($env_file, false);
// if ($ini_contents !== false)
// $config = array_merge($default_config, $ini_contents);
// }
//var_dump($pathhome . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'); die;
require_once $pathhome . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; require_once $pathhome . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
$config = System::getSystemConfiguration($pathhome . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'env.ini'); $config = System::getSystemConfiguration($pathhome . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'env.ini');
$e_all = defined('E_DEPRECATED') ? E_ALL ^ E_DEPRECATED : E_ALL;
//*** Do not change any of these settings directly, use env.ini instead // Do not change any of these settings directly, use env.ini instead
ini_set('display_errors','On'); ini_set('display_errors','On');
ini_set('short_open_tag', 'on'); ini_set('short_open_tag', 'on');
ini_set('asp_tags', 'on'); ini_set('asp_tags', 'on');
// The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off.
// ini_set('register_globals', 'off');
ini_set('default_charset', "UTF-8"); ini_set('default_charset', "UTF-8");
$e_all = defined('E_DEPRECATED') ? E_ALL ^ E_DEPRECATED : E_ALL;
ini_set('error_reporting', ($config['debug'] ? $e_all : $e_all ^ E_NOTICE)); ini_set('error_reporting', ($config['debug'] ? $e_all : $e_all ^ E_NOTICE));
ini_set('memory_limit', $config['memory_limit']); ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
@@ -104,25 +70,40 @@
define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']); define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define ('MEMCACHED_ENABLED', $config['memcached']); define ('MEMCACHED_ENABLED', $config['memcached']);
define ('MEMCACHED_SERVER', $config['memcached_server']); define ('MEMCACHED_SERVER', $config['memcached_server']);
define ('TIME_ZONE', $config['time_zone']); define ('TIME_ZONE', $config['time_zone']);
//////////////////////////// end, from paths.php
// Including these files we get the PM paths and definitions (that should be just one file.
require_once $pathhome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php';
// Verifiying permissions processmaker writable directories
$writableDirs = array(PATH_CONFIG, PATH_XMLFORM, PATH_HTML, PATH_PLUGINS);
if (defined('PATH_DATA')) {
$writableDirs[] = PATH_DATA;
}
if (defined('PATH_LANGUAGECONT')) {
$writableDirs[] = PATH_LANGUAGECONT;
}
try {
G::verifyWriteAccess($writableDirs);
}
catch (Exception $e) {
G::renderTemplate('write_access_denied.exception', array('files' => $e->files));
die();
}
// end permissions verification
//************* Including these files we get the PM paths and definitions (that should be just one file ***********
require_once ( $pathhome . PATH_SEP . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php' );
//******************* Error handler and log error *******************
//to do: make different environments. sys //to do: make different environments. sys
//G::setErrorHandler ( );
//G::setFatalErrorHandler ( );
define ('ERROR_SHOW_SOURCE_CODE', true); // enable ERROR_SHOW_SOURCE_CODE to display the source code for any WARNING OR NOTICE 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 //define ( 'ERROR_LOG_NOTICE_ERROR', true ); //enable ERROR_LOG_NOTICE_ERROR to log Notices messages in default apache log
// ***** create headPublisher singleton ***************** // Create headPublisher singleton
G::LoadSystem('headPublisher'); G::LoadSystem('headPublisher');
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton();
// ***** defining the maborak js file, this file is the concat of many js files and here we are including all of them **** // Defining the maborak js file, this file is the concat of many js files and here we are including all of them.
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/maborak.js' ); $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'maborak/core/maborak.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/common.js' ); $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/common.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/effects.js' ); $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/effects.js' );
@@ -154,23 +135,25 @@
$oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'appFolder/core/appFolderList.js', true ); $oHeadPublisher->addMaborakFile(PATH_CORE . 'js' . PATH_SEP . 'appFolder/core/appFolderList.js', true );
$oHeadPublisher->addMaborakFile(PATH_THIRDPARTY . 'htmlarea/editor.js', true ); $oHeadPublisher->addMaborakFile(PATH_THIRDPARTY . 'htmlarea/editor.js', true );
//erik: if it is a installation instance //check if it is a installation instance
if(!defined('PATH_C')) { if(!defined('PATH_C')) {
$tmpDir = G::getSysTemDir(); // is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
define('PATH_C', $tmpDir . ((substr($tmpDir, -1) == PATH_SEP)? '': PATH_SEP)); define('PATH_C', (rtrim(G::sys_get_temp_dir(), PATH_SEP) . PATH_SEP));
define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' ); define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/' );
} }
//************ defining Virtual URLs ****************/ // defining Virtual URLs
$virtualURITable = array(); $virtualURITable = array();
$virtualURITable['/plugin/(*)'] = 'plugin'; $virtualURITable['/plugin/(*)'] = 'plugin';
$virtualURITable['/(sys*)/(*.js)'] = 'jsMethod'; $virtualURITable['/(sys*)/(*.js)'] = 'jsMethod';
$virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/'; $virtualURITable['/js/(*)'] = PATH_GULLIVER_HOME . 'js/';
$virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/'; $virtualURITable['/jscore/(*)'] = PATH_CORE . 'js/';
if ( defined('PATH_C') ) { if ( defined('PATH_C') ) {
$virtualURITable['/jsform/(*.js)'] = PATH_C . 'xmlform/'; $virtualURITable['/jsform/(*.js)'] = PATH_C . 'xmlform/';
$virtualURITable['/extjs/(*)'] = PATH_C . 'ExtJs/'; $virtualURITable['/extjs/(*)'] = PATH_C . 'ExtJs/';
} }
$virtualURITable['/htmlarea/(*)'] = PATH_THIRDPARTY . 'htmlarea/'; $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['/(sys*)'] = FALSE;
@@ -183,26 +166,18 @@
$virtualURITable['/images/'] = 'errorFile'; $virtualURITable['/images/'] = 'errorFile';
$virtualURITable['/skins/'] = 'errorFile'; $virtualURITable['/skins/'] = 'errorFile';
$virtualURITable['/files/'] = '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['/(*)'] = PATH_HTML; $virtualURITable['/(*)'] = PATH_HTML;
// Verify if we need to redirect or stream the file, if G:VirtualURI returns true means we are going to redirect the page
//****** 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 ( G::virtualURI($_SERVER['REQUEST_URI'], $virtualURITable , $realPath )) {
// review if the file requested belongs to public_html plugin // review if the file requested belongs to public_html plugin
if ( substr ( $realPath, 0,6) == '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
* By JHL Jul 14, 08 // TODO: $pathsQuery will be used?
* Another way to get the path of Plugin public_html and stream the correspondent file
* TODO: $pathsQuery will be used?
*/
$pathsQuery=""; $pathsQuery="";
// Get the query side // Get the query side
/* // Did we use this variable $pathsQuery for something??
* Did we use this variable $pathsQuery for something??
*/
$forQuery = explode("?",$realPath); $forQuery = explode("?",$realPath);
if (isset($forQuery[1])) { if (isset($forQuery[1])) {
$pathsQuery = $forQuery[1]; $pathsQuery = $forQuery[1];
@@ -217,27 +192,20 @@
//The other parts are the realpath into public_html (no matter how many elements) //The other parts are the realpath into public_html (no matter how many elements)
$filePath=implode(PATH_SEP,$paths); $filePath=implode(PATH_SEP,$paths);
$pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html'. PATH_SEP . $filePath; $pluginFilename = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'public_html'. PATH_SEP . $filePath;
if ( file_exists ( $pluginFilename ) ) { if ( file_exists ( $pluginFilename ) ) {
G::streamFile ( $pluginFilename ); G::streamFile ( $pluginFilename );
} }
die; die;
} }
$requestUriArray = explode("/",$_SERVER['REQUEST_URI']); $requestUriArray = explode("/",$_SERVER['REQUEST_URI']);
if((isset($requestUriArray[1]))&&($requestUriArray[1] == 'skin')) { if((isset($requestUriArray[1]))&&($requestUriArray[1] == 'skin')) {
/* // This will allow to public images of Custom Skins, By JHL Feb 28, 11
* By JHL Feb 28, 11
* This will allow to public images of Custom Skins
*/
$pathsQuery=""; $pathsQuery="";
// Get the query side // Get the query side
/* // This way we remove garbage
* This way we remove garbage
*/
$forQuery = explode("?",$realPath); $forQuery = explode("?",$realPath);
if (isset($forQuery[1])) { if (isset($forQuery[1])) {
$pathsQuery = $forQuery[1]; $pathsQuery = $forQuery[1];
@@ -245,7 +213,6 @@
//Get that path in array //Get that path in array
$paths = explode ( PATH_SEP, $forQuery[0] ); $paths = explode ( PATH_SEP, $forQuery[0] );
$fileToBeStreamed=str_replace("/skin/",PATH_CUSTOM_SKINS,$_SERVER['REQUEST_URI']); $fileToBeStreamed=str_replace("/skin/",PATH_CUSTOM_SKINS,$_SERVER['REQUEST_URI']);
if ( file_exists ( $fileToBeStreamed ) ) { if ( file_exists ( $fileToBeStreamed ) ) {
@@ -254,11 +221,10 @@
die; die;
} }
switch ($realPath) { switch ($realPath) {
case 'sysUnnamed' : case 'sysUnnamed' :
require_once('sysUnnamed.php'); die; require_once('sysUnnamed.php');
die;
break; break;
case 'sysNamed' : case 'sysNamed' :
header('location : ' . $_SERVER['REQUEST_URI'] . 'en/green/login/login' ); header('location : ' . $_SERVER['REQUEST_URI'] . 'en/green/login/login' );
@@ -272,7 +238,7 @@
break; break;
case 'errorFile': case 'errorFile':
header ("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI'])); header ("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
if ( DEBUG_TIME_LOG ) logTimeByPage(); //log this page if ( DEBUG_TIME_LOG ) G::logTimeByPage(); //log this page
die; die;
break; break;
default : default :
@@ -283,21 +249,28 @@
} }
} }
//************** the request correspond to valid php page, now parse the URI ************** // the request correspond to valid php page, now parse the URI
G::parseURI(getenv("REQUEST_URI"), $config); G::parseURI(getenv("REQUEST_URI"), $config);
// 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))
);
}
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . "widgets/jscalendar/lang/calendar-" . SYS_LANG . ".js"); $oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . "widgets/jscalendar/lang/calendar-" . SYS_LANG . ".js");
define('SYS_URI' , '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/'); define('SYS_URI' , '/sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/');
//************** defining the serverConf singleton ************** // defining the serverConf singleton
if (defined('PATH_DATA') && file_exists(PATH_DATA)) { if (defined('PATH_DATA') && file_exists(PATH_DATA)) {
//Instance Server Configuration Singleton //Instance Server Configuration Singleton
G::LoadClass('serverConfiguration'); G::LoadClass('serverConfiguration');
$oServerConf =& serverConf::getSingleton(); $oServerConf =& serverConf::getSingleton();
} }
//***************** Call Gulliver Classes **************************
// Call Gulliver Classes
G::LoadThirdParty('pear/json','class.json'); G::LoadThirdParty('pear/json','class.json');
G::LoadThirdParty('smarty/libs','Smarty.class'); G::LoadThirdParty('smarty/libs','Smarty.class');
G::LoadSystem('error'); G::LoadSystem('error');
@@ -321,20 +294,21 @@
G::LoadSystem('pmException'); G::LoadSystem('pmException');
//G::LoadSystem('pagedTable'); //G::LoadSystem('pagedTable');
//************** Installer, redirect to install if we don't have a valid shared data folder ***************/ // Installer, redirect to install if we don't have a valid shared data folder
if ( !defined('PATH_DATA') || !file_exists(PATH_DATA)) { if ( !defined('PATH_DATA') || !file_exists(PATH_DATA)) {
/*new installer, extjs based*/ // new installer, extjs based
define('PATH_DATA', PATH_C); define('PATH_DATA', PATH_C);
require_once ( PATH_CONTROLLERS . 'installer.php' ); require_once ( PATH_CONTROLLERS . 'installer.php' );
$controller = 'Installer'; $controller = 'Installer';
// if the method name is empty set default to index method // if the method name is empty set default to index method
if (strpos(SYS_TARGET, '/') !== false) if (strpos(SYS_TARGET, '/') !== false) {
list($controller, $controllerAction) = explode('/', SYS_TARGET); list($controller, $controllerAction) = explode('/', SYS_TARGET);
else }
else {
$controllerAction = SYS_TARGET; $controllerAction = SYS_TARGET;
}
$controllerAction = ($controllerAction != '' && $controllerAction != 'login')? $controllerAction: 'index'; $controllerAction = ($controllerAction != '' && $controllerAction != 'login')? $controllerAction: 'index';
@@ -351,10 +325,10 @@
die; die;
} }
// ************* Load Language Translation ***************** // Load Language Translation
G::LoadTranslationObject(defined('SYS_LANG')?SYS_LANG:"en"); G::LoadTranslationObject(defined('SYS_LANG')?SYS_LANG:"en");
//******** look for a disabled workspace **** // look for a disabled workspace
if($oServerConf->isWSDisabled(SYS_TEMP)){ if($oServerConf->isWSDisabled(SYS_TEMP)){
$aMessage['MESSAGE'] = G::LoadTranslation('ID_DISB_WORKSPACE'); $aMessage['MESSAGE'] = G::LoadTranslation('ID_DISB_WORKSPACE');
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher;
@@ -363,7 +337,7 @@
die; die;
} }
//********** database and workspace definition ************************ // 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 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 != '') { if ( defined('SYS_TEMP') && SYS_TEMP != '') {
//this is the default, the workspace db.php file is in /shared/workflow/sites/SYS_SYS //this is the default, the workspace db.php file is in /shared/workflow/sites/SYS_SYS
@@ -410,16 +384,16 @@
die(); die();
} }
} }
if ( DEBUG_TIME_LOG ) logTimeByPage(); //log this page if ( DEBUG_TIME_LOG ) G::logTimeByPage(); //log this page
die(); die();
} }
} }
// ***** create memcached singleton ***************** // create memcached singleton
G::LoadClass ( 'memcached' ); G::LoadClass ( 'memcached' );
$memcache = & PMmemcached::getSingleton(SYS_SYS); $memcache = & PMmemcached::getSingleton(SYS_SYS);
//***************** PM Paths DATA ************************** // PM Paths DATA
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
@@ -431,24 +405,25 @@
define('SERVER_NAME', $_SERVER ['SERVER_NAME']); define('SERVER_NAME', $_SERVER ['SERVER_NAME']);
define('SERVER_PORT', $_SERVER ['SERVER_PORT']); define('SERVER_PORT', $_SERVER ['SERVER_PORT']);
//***************** Plugins ************************** // load Plugins base class
G::LoadClass('plugin'); G::LoadClass('plugin');
//here we are loading all plugins registered //here we are loading all plugins registered
//the singleton has a list of enabled plugins //the singleton has a list of enabled plugins
$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton'; $sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
$oPluginRegistry =& PMPluginRegistry::getSingleton(); $oPluginRegistry =& PMPluginRegistry::getSingleton();
if ( file_exists ($sSerializedFile) )
if (file_exists ($sSerializedFile)) {
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile)); $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
// setup propel definitions and logging
//******* setup propel definitions and logging ****
require_once ( "propel/Propel.php" ); require_once ( "propel/Propel.php" );
require_once ( "creole/Creole.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)); define('PM_PID', mt_rand(1,999999));
require_once ( "Log.php" ); require_once 'Log.php';
// register debug connection decorator driver // register debug connection decorator driver
Creole::registerDriver('*', 'creole.contrib.DebugConnection'); Creole::registerDriver('*', 'creole.contrib.DebugConnection');
@@ -462,23 +437,31 @@
Propel::setLogger($logger); Propel::setLogger($logger);
// log file for workflow database // log file for workflow database
$con = Propel::getConnection('workflow'); $con = Propel::getConnection('workflow');
if ($con instanceof DebugConnection) $con->setLogger($logger); if ($con instanceof DebugConnection) {
$con->setLogger($logger);
}
// log file for rbac database // log file for rbac database
$con = Propel::getConnection('rbac'); $con = Propel::getConnection('rbac');
if ($con instanceof DebugConnection) $con->setLogger($logger);
if ($con instanceof DebugConnection) {
$con->setLogger($logger);
}
// log file for report database // log file for report database
$con = Propel::getConnection('rp'); $con = Propel::getConnection('rp');
if ($con instanceof DebugConnection) $con->setLogger($logger); if ($con instanceof DebugConnection) {
$con->setLogger($logger);
} }
else }
else {
Propel::init( PATH_CORE . "config/databases.php" ); Propel::init( PATH_CORE . "config/databases.php" );
}
Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
//***************** Session Initializations **************************/ // Session Initializations
ini_set('session.auto_start', '1'); ini_set('session.auto_start', '1');
// The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off. // The register_globals feature has been DEPRECATED as of PHP 5.3.0. default value Off.
// ini_set( 'register_globals', 'Off' ); // ini_set( 'register_globals', 'Off' );
session_start(); session_start();
@@ -489,20 +472,21 @@
require_once ( "classes/model/Translation.php" ); require_once ( "classes/model/Translation.php" );
$fields = Translation::generateFileTranslation('en'); $fields = Translation::generateFileTranslation('en');
} }
// TODO: Verify if the language set into url is defined in translations env. // TODO: Verify if the language set into url is defined in translations env.
if( SYS_LANG != 'en' && ! is_file(PATH_LANGUAGECONT . 'translation.' . SYS_LANG) ){ if( SYS_LANG != 'en' && ! is_file(PATH_LANGUAGECONT . 'translation.' . SYS_LANG) ){
require_once ( "classes/model/Translation.php" ); require_once ( "classes/model/Translation.php" );
$fields = Translation::generateFileTranslation(SYS_LANG); $fields = Translation::generateFileTranslation(SYS_LANG);
} }
//********* Setup plugins ************* // Setup plugins
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins $oPluginRegistry->setupPlugins(); //get and setup enabled plugins
$avoidChangedWorkspaceValidation = false; $avoidChangedWorkspaceValidation = false;
// Load custom Classes and Model from Plugins. // Load custom Classes and Model from Plugins.
G::LoadAllPluginModelClasses(); G::LoadAllPluginModelClasses();
//*********jump to php file in methods directory ************* // jump to php file in methods directory
$collectionPlugin = ''; $collectionPlugin = '';
if ($oPluginRegistry->isRegisteredFolder(SYS_COLLECTION)) { if ($oPluginRegistry->isRegisteredFolder(SYS_COLLECTION)) {
$phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET.'.php'; $phpFile = PATH_PLUGINS . SYS_COLLECTION . PATH_SEP . SYS_TARGET.'.php';
@@ -510,17 +494,20 @@
$collectionPlugin = $targetPlugin[0]; $collectionPlugin = $targetPlugin[0];
$avoidChangedWorkspaceValidation = true; $avoidChangedWorkspaceValidation = true;
} }
else else {
$phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . SYS_TARGET.'.php'; $phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . SYS_TARGET.'.php';
}
// services is a special folder, // services is a special folder,
if ( SYS_COLLECTION == 'services' ) { if ( SYS_COLLECTION == 'services' ) {
$avoidChangedWorkspaceValidation = true; $avoidChangedWorkspaceValidation = true;
$targetPlugin = explode( '/', SYS_TARGET ); $targetPlugin = explode( '/', SYS_TARGET );
if ( $targetPlugin[0] == 'webdav' ) { if ( $targetPlugin[0] == 'webdav' ) {
$phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . 'webdav.php'; $phpFile = G::ExpandPath('methods') . SYS_COLLECTION . PATH_SEP . 'webdav.php';
} }
} }
if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') { if (SYS_COLLECTION == 'login' && SYS_TARGET == 'login') {
$avoidChangedWorkspaceValidation = true; $avoidChangedWorkspaceValidation = true;
} }
@@ -538,8 +525,7 @@
} }
else { else {
//when the file is part of the public directory of any PROCESS, this a ProcessMaker feature //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) if (preg_match('/^[0-9][[:alnum:]]+$/', SYS_COLLECTION) == 1) { //the pattern is /sysSYS/LANG/SKIN/PRO_UID/file
{ //the pattern is /sysSYS/LANG/SKIN/PRO_UID/file
$auxPart = explode ( '/' , $_SERVER['REQUEST_URI']); $auxPart = explode ( '/' , $_SERVER['REQUEST_URI']);
$aAux = explode('?', $auxPart[ count($auxPart)-1]); $aAux = explode('?', $auxPart[ count($auxPart)-1]);
//$extPart = explode ( '.' , $auxPart[ count($auxPart)-1] ); //$extPart = explode ( '.' , $auxPart[ count($auxPart)-1] );
@@ -549,10 +535,12 @@
$phpFile = PATH_DATA_SITE . 'public' . PATH_SEP . SYS_COLLECTION . PATH_SEP . urldecode ($auxPart[ count($auxPart)-1]); $phpFile = PATH_DATA_SITE . 'public' . PATH_SEP . SYS_COLLECTION . PATH_SEP . urldecode ($auxPart[ count($auxPart)-1]);
$aAux = explode('?', $phpFile); $aAux = explode('?', $phpFile);
$phpFile = $aAux[0]; $phpFile = $aAux[0];
if ($extension != 'php') { if ($extension != 'php') {
G::streamFile($phpFile); G::streamFile($phpFile);
die; die;
} }
$avoidChangedWorkspaceValidation=true; $avoidChangedWorkspaceValidation=true;
$bWE = true; $bWE = true;
//$phpFile = PATH_DATA_SITE . 'public' . PATH_SEP . SYS_COLLECTION . PATH_SEP . $auxPart[ count($auxPart)-1]; //$phpFile = PATH_DATA_SITE . 'public' . PATH_SEP . SYS_COLLECTION . PATH_SEP . $auxPart[ count($auxPart)-1];
@@ -572,7 +560,6 @@
if (!$isControllerCall && ! file_exists($phpFile)) { if (!$isControllerCall && ! file_exists($phpFile)) {
$_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI']; $_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI'];
print $phpFile;
header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI'])); header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
die; die;
} }
@@ -587,11 +574,11 @@
die; die;
} }
//***************** enable rbac ************************** // enable rbac
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() ); $RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER'; $RBAC->sSystem = 'PROCESSMAKER';
//****** define and send Headers for all pages ******************* // define and send Headers for all pages
if (! defined('EXECUTE_BY_CRON')) { 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("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("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -654,13 +641,16 @@
$memcache->set($memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS ); $memcache->set($memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS );
} }
} }
if ($bRedirect) { if ($bRedirect) {
//g::pr($_SERVER); die; if (substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs') { // verify if the current skin is a 'ux' variant
if (strpos($_SERVER['REQUEST_URI'], '/home') !== false) { $loginUrl = 'main/login';
}
else if (strpos($_SERVER['REQUEST_URI'], '/home') !== false){ //verify is it is using the uxs skin for simplified interface
$loginUrl = 'home/login'; $loginUrl = 'home/login';
} }
else { else {
$loginUrl = 'main/login'; $loginUrl = 'login/login'; // just set up the classic login
} }
if (empty($_POST)) { if (empty($_POST)) {
@@ -680,23 +670,27 @@
} }
$_SESSION['phpLastFileFound'] = $_SERVER['REQUEST_URI']; $_SESSION['phpLastFileFound'] = $_SERVER['REQUEST_URI'];
/*** /**
* New feature for Gulliver framework to support Controllers & HttpProxyController classes handling * New feature for Gulliver framework to support Controllers & HttpProxyController classes handling
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com> * @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
*/ */
if ($isControllerCall) { //Instance the Controller object and call the request method if ($isControllerCall) { //Instance the Controller object and call the request method
$controller = new $controllerClass(); $controller = new $controllerClass();
$controller->setHttpRequestData($_REQUEST); $controller->setHttpRequestData($_REQUEST);
$controller->call($controllerAction); $controller->call($controllerAction);
} else }
require_once( $phpFile ); else {
require_once $phpFile;
}
if (defined('SKIP_HEADERS')){ if (defined('SKIP_HEADERS')){
header("Expires: " . gmdate("D, d M Y H:i:s", mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1)) . " GMT");
header('Cache-Control: public'); header('Cache-Control: public');
header('Pragma: '); header('Pragma: ');
} }
ob_end_flush(); ob_end_flush();
if ( DEBUG_TIME_LOG ) logTimeByPage(); //log this page if (DEBUG_TIME_LOG) {
G::logTimeByPage(); //log this page
}
} }