move paths_installed to shared folder CORE #55
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
variables:
|
||||||
|
GIT_STRATEGY: fetch
|
||||||
|
GIT_FETCH_EXTRA_FLAGS: --prune --tags --depth 1000
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
|
||||||
|
|||||||
1119
composer.lock
generated
1119
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
# Use our base image
|
# Use our base image
|
||||||
FROM gitlab.luranasoft.com:5050/luos/docker/base-image:1.0.12-php8.3
|
FROM gitlab.luranasoft.com:5050/luos/docker/base-image:1.0.30-php8.3
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|||||||
@@ -451,6 +451,7 @@ class WebApplication
|
|||||||
define("PATH_TRUNK", $this->rootDir . PATH_SEP);
|
define("PATH_TRUNK", $this->rootDir . PATH_SEP);
|
||||||
define("PATH_OUTTRUNK", realpath($this->rootDir . "/../") . PATH_SEP);
|
define("PATH_OUTTRUNK", realpath($this->rootDir . "/../") . PATH_SEP);
|
||||||
define("PATH_HOME", $this->rootDir . PATH_SEP . "workflow" . PATH_SEP);
|
define("PATH_HOME", $this->rootDir . PATH_SEP . "workflow" . PATH_SEP);
|
||||||
|
define('PATH_DATA', isset($_SERVER['PATH_DATA']) ? $_SERVER['PATH_DATA'] : PATH_TRUNK . 'shared' . PATH_SEP );
|
||||||
|
|
||||||
define("PATH_HTML", PATH_HOME . "public_html" . PATH_SEP);
|
define("PATH_HTML", PATH_HOME . "public_html" . PATH_SEP);
|
||||||
define("PATH_RBAC_HOME", PATH_TRUNK . "rbac" . PATH_SEP);
|
define("PATH_RBAC_HOME", PATH_TRUNK . "rbac" . PATH_SEP);
|
||||||
@@ -479,7 +480,7 @@ class WebApplication
|
|||||||
define("PATH_UPLOAD", PATH_HTML . "files" . PATH_SEP);
|
define("PATH_UPLOAD", PATH_HTML . "files" . PATH_SEP);
|
||||||
define("PATH_WORKFLOW_MYSQL_DATA", PATH_CORE . "data" . PATH_SEP . "mysql" . PATH_SEP);
|
define("PATH_WORKFLOW_MYSQL_DATA", PATH_CORE . "data" . PATH_SEP . "mysql" . PATH_SEP);
|
||||||
define("PATH_RBAC_MYSQL_DATA", PATH_RBAC_CORE . "data" . PATH_SEP . "mysql" . PATH_SEP);
|
define("PATH_RBAC_MYSQL_DATA", PATH_RBAC_CORE . "data" . PATH_SEP . "mysql" . PATH_SEP);
|
||||||
define("FILE_PATHS_INSTALLED", PATH_CORE . "config" . PATH_SEP . "paths_installed.php");
|
define("FILE_PATHS_INSTALLED", PATH_DATA . "config" . PATH_SEP . "paths_installed.php");
|
||||||
define("PATH_WORKFLOW_MSSQL_DATA", PATH_CORE . "data" . PATH_SEP . "mssql" . PATH_SEP);
|
define("PATH_WORKFLOW_MSSQL_DATA", PATH_CORE . "data" . PATH_SEP . "mssql" . PATH_SEP);
|
||||||
define("PATH_RBAC_MSSQL_DATA", PATH_RBAC_CORE . "data" . PATH_SEP . "mssql" . PATH_SEP);
|
define("PATH_RBAC_MSSQL_DATA", PATH_RBAC_CORE . "data" . PATH_SEP . "mssql" . PATH_SEP);
|
||||||
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
|
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
|
||||||
@@ -493,7 +494,7 @@ class WebApplication
|
|||||||
}
|
}
|
||||||
|
|
||||||
// include the server installed configuration
|
// include the server installed configuration
|
||||||
require_once PATH_CORE . "config" . PATH_SEP . "paths_installed.php";
|
require_once FILE_PATHS_INSTALLED;
|
||||||
|
|
||||||
// defining system constant when a valid server environment exists
|
// defining system constant when a valid server environment exists
|
||||||
define("PATH_LANGUAGECONT", PATH_DATA . "META-INF" . PATH_SEP);
|
define("PATH_LANGUAGECONT", PATH_DATA . "META-INF" . PATH_SEP);
|
||||||
|
|||||||
@@ -16,9 +16,62 @@ class Bootstrap
|
|||||||
public static $includeClassPaths = array();
|
public static $includeClassPaths = array();
|
||||||
public static $includePaths = array();
|
public static $includePaths = array();
|
||||||
protected $relativeIncludePaths = array();
|
protected $relativeIncludePaths = array();
|
||||||
|
public static $startingTime = 0;
|
||||||
//below here only approved methods
|
//below here only approved methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to initialize session settings
|
||||||
|
*/
|
||||||
|
public static function initializeSession($config) {
|
||||||
|
// Start the timer
|
||||||
|
self::$startingTime = microtime(true);
|
||||||
|
|
||||||
|
// Determine session lifetime
|
||||||
|
$sessionLifetime = isset($config['session.gc_maxlifetime'])
|
||||||
|
? $config['session.gc_maxlifetime']
|
||||||
|
: ini_get('session.gc_maxlifetime');
|
||||||
|
|
||||||
|
// Default to 1440 seconds (24 minutes) if lifetime is not set
|
||||||
|
if (is_null($sessionLifetime)) {
|
||||||
|
$sessionLifetime = 1440;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the session garbage collection maximum lifetime
|
||||||
|
ini_set('session.gc_maxlifetime', $sessionLifetime);
|
||||||
|
|
||||||
|
// Configure cookie lifetime based on user agent and configuration
|
||||||
|
Bootstrap::configureCookieLifetime($sessionLifetime, $config);
|
||||||
|
|
||||||
|
// Set cookie security options if REMOTE_USER is not set
|
||||||
|
if (!array_key_exists('REMOTE_USER', $_SERVER) || empty($_SERVER['REMOTE_USER'])) {
|
||||||
|
ini_set('session.cookie_httponly', 1);
|
||||||
|
if (G::is_https()) {
|
||||||
|
ini_set('session.cookie_secure', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the session
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function to configure cookie lifetime based on user agent
|
||||||
|
*/
|
||||||
|
public static function configureCookieLifetime($sessionLifetime, $config) {
|
||||||
|
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
||||||
|
$isIE = preg_match("/msie/i", $userAgent);
|
||||||
|
$isSafari = preg_match("/safari/i", $userAgent) && !preg_match("/chrome/i", $userAgent);
|
||||||
|
|
||||||
|
// Set cookie lifetime based on browser and configuration
|
||||||
|
if (($isIE && $config['ie_cookie_lifetime'] != 1) ||
|
||||||
|
($isSafari && $config['safari_cookie_lifetime'] != 1)) {
|
||||||
|
return; // Do not set cookie lifetime if conditions are not met
|
||||||
|
}
|
||||||
|
|
||||||
|
ini_set('session.cookie_lifetime', $sessionLifetime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
|
* @deprecated 3.2.2, We keep this function only for backwards compatibility because is used in the plugin manager
|
||||||
*/
|
*/
|
||||||
@@ -247,6 +300,10 @@ class Bootstrap
|
|||||||
$file = $filter->xssFilterHard($file);
|
$file = $filter->xssFilterHard($file);
|
||||||
$downloadFileName = $filter->xssFilterHard($downloadFileName);
|
$downloadFileName = $filter->xssFilterHard($downloadFileName);
|
||||||
|
|
||||||
|
//if (DEBUG_TIME_LOG) { // to do: remove comment
|
||||||
|
self::logTimeByPage();
|
||||||
|
//}
|
||||||
|
|
||||||
$browserCacheFilesUid = G::browserCacheFilesGetUid();
|
$browserCacheFilesUid = G::browserCacheFilesGetUid();
|
||||||
|
|
||||||
if ($browserCacheFilesUid != null) {
|
if ($browserCacheFilesUid != null) {
|
||||||
@@ -720,16 +777,16 @@ class Bootstrap
|
|||||||
*/
|
*/
|
||||||
public static function logTimeByPage()
|
public static function logTimeByPage()
|
||||||
{
|
{
|
||||||
if (!defined(PATH_DATA)) {
|
if (!defined('PATH_DATA')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$serverAddr = $_SERVER ['SERVER_ADDR'];
|
$serverAddr = $_SERVER ['SERVER_ADDR'];
|
||||||
global $startingTime;
|
|
||||||
$endTime = microtime(true);
|
$endTime = microtime(true);
|
||||||
$time = $endTime - $startingTime;
|
$time = $endTime - self::$startingTime;
|
||||||
$fpt = fopen(PATH_DATA . 'log/time.log', 'a');
|
Bootstrap::verifyPath(PATH_DATA . 'logs', true);
|
||||||
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']));
|
$fpt = fopen(PATH_DATA . 'logs/time.log', 'a');
|
||||||
|
fwrite($fpt, sprintf("%s %7.6f %-15s %s\n", date('Y-m-d H:i:s'), $time, getenv('REMOTE_ADDR'), $_SERVER ['REQUEST_URI']));
|
||||||
fclose($fpt);
|
fclose($fpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -822,16 +822,18 @@ class InstallerModule extends Controller
|
|||||||
'USR_LASTNAME' => $adminUsername,
|
'USR_LASTNAME' => $adminUsername,
|
||||||
'USR_PASSWORD' => G::encryptHash($adminPassword)
|
'USR_PASSWORD' => G::encryptHash($adminPassword)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Write the paths_installed.php file (contains all the information configured so far)
|
// Write the paths_installed.php file (contains all the information configured so far)
|
||||||
if (!file_exists(FILE_PATHS_INSTALLED)) {
|
if (!file_exists(FILE_PATHS_INSTALLED)) {
|
||||||
$sh = G::encryptOld(filemtime(PATH_GULLIVER . '/class.g.php'));
|
$sh = G::encryptOld(filemtime(PATH_GULLIVER . '/class.g.php'));
|
||||||
$h = G::encrypt($db_host . $sh . $db_username . $sh . $db_password, $sh);
|
$h = G::encrypt($db_host . $sh . $db_username . $sh . $db_password, $sh);
|
||||||
$dbText = "<?php\n";
|
$dbText = "<?php\n";
|
||||||
$dbText .= sprintf(" define('PATH_DATA', '%s');\n", $pathShared);
|
$dbText .= sprintf(" define('PATH_C', '%s');\n", PATH_DATA . 'compiled/');
|
||||||
$dbText .= sprintf(" define('PATH_C', '%s');\n", $pathShared . 'compiled/');
|
|
||||||
$dbText .= sprintf(" define('HASH_INSTALLATION', '%s');\n", $h);
|
$dbText .= sprintf(" define('HASH_INSTALLATION', '%s');\n", $h);
|
||||||
$dbText .= sprintf(" define('SYSTEM_HASH', '%s');\n", $sh);
|
$dbText .= sprintf(" define('SYSTEM_HASH', '%s');\n", $sh);
|
||||||
$this->installLog(G::LoadTranslation('ID_CREATING', SYS_LANG, [FILE_PATHS_INSTALLED]));
|
$this->installLog(G::LoadTranslation('ID_CREATING', SYS_LANG, [FILE_PATHS_INSTALLED]));
|
||||||
|
|
||||||
|
Bootstrap::verifyPath(PATH_DATA . 'config', true);
|
||||||
file_put_contents(FILE_PATHS_INSTALLED, $dbText);
|
file_put_contents(FILE_PATHS_INSTALLED, $dbText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ Ext.onReady(function () {
|
|||||||
fieldLabel: '<span id="pathSharedSpan"></span> ' + _('ID_WORFLOW_DATA_DIRECTORY'),
|
fieldLabel: '<span id="pathSharedSpan"></span> ' + _('ID_WORFLOW_DATA_DIRECTORY'),
|
||||||
id: 'pathShared',
|
id: 'pathShared',
|
||||||
width: 430,
|
width: 430,
|
||||||
|
disabled: true,
|
||||||
value: path_shared,
|
value: path_shared,
|
||||||
enableKeyEvents: true,
|
enableKeyEvents: true,
|
||||||
allowBlank: false,
|
allowBlank: false,
|
||||||
|
|||||||
@@ -10,116 +10,29 @@ use ProcessMaker\Validation\ValidationUploadedFiles;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* bootstrap - ProcessMaker Bootstrap
|
* bootstrap - ProcessMaker Bootstrap
|
||||||
* this file is used initialize main variables, redirect and dispatch all requests
|
* This file initializes main variables, redirects, and dispatches all requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Validating if exists 'HTTP_USER_AGENT' key in $_SERVER array
|
// Ensure 'HTTP_USER_AGENT' is set
|
||||||
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
|
$_SERVER['HTTP_USER_AGENT'] = htmlspecialchars(filter_input(INPUT_SERVER, 'HTTP_USER_AGENT') ?? '', ENT_QUOTES, 'UTF-8');
|
||||||
$_SERVER['HTTP_USER_AGENT'] = '';
|
// Define path separator constant
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
// Define the Home Directory
|
||||||
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
|
$documentRoot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
|
||||||
$docuroot = explode(PATH_SEP, $realdocuroot);
|
$pathParts = explode(PATH_SEP, $documentRoot);
|
||||||
|
array_pop($pathParts); // Remove the last part (usually the project folder)
|
||||||
|
$pathHome = implode(PATH_SEP, $pathParts) . PATH_SEP;
|
||||||
|
|
||||||
array_pop($docuroot);
|
// Define trunk paths
|
||||||
$pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
$pathTrunk = implode(PATH_SEP, array_slice($pathParts, 0, -1)) . PATH_SEP; // Remove last part again
|
||||||
|
$pathOutTrunk = implode(PATH_SEP, array_slice($pathParts, 0, -2)) . PATH_SEP; // Remove last two parts
|
||||||
|
|
||||||
// try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
|
define('PATH_HOME', $pathHome);
|
||||||
// in a normal installation you don't need to change it.
|
|
||||||
array_pop($docuroot);
|
|
||||||
$pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
|
||||||
|
|
||||||
array_pop($docuroot);
|
|
||||||
$pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
|
||||||
|
|
||||||
define('PATH_HOME', $pathhome);
|
|
||||||
define('PATH_TRUNK', $pathTrunk);
|
define('PATH_TRUNK', $pathTrunk);
|
||||||
define('PATH_OUTTRUNK', $pathOutTrunk);
|
define('PATH_OUTTRUNK', $pathOutTrunk);
|
||||||
|
|
||||||
//we are focusing in have this behaivour
|
|
||||||
//1. if the uri is an 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);
|
define('PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP);
|
||||||
|
define('PATH_DATA', isset($_SERVER['PATH_DATA']) ? $_SERVER['PATH_DATA'] : PATH_TRUNK . 'shared' . PATH_SEP );
|
||||||
//this is the first path, if the file exists...
|
|
||||||
$request = substr($_SERVER['REQUEST_URI'], 1, strlen($_SERVER['REQUEST_URI'])); //removes the first '/'
|
|
||||||
$fileWithoutParam = explode("?", $request); // split the URI by '?'
|
|
||||||
$request = $fileWithoutParam[0]; // get the first element of the split URI
|
|
||||||
$requestFile = PATH_HTML . $request; // temporary assemble a path for the file embedded in the URI
|
|
||||||
if (file_exists($requestFile)) {
|
|
||||||
if (!is_file($requestFile)) {
|
|
||||||
header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
if ($request === "app.php" || $request === "sysGeneric.php") {
|
|
||||||
//HTTP/1.0 403 Forbidden
|
|
||||||
http_response_code(403);
|
|
||||||
}
|
|
||||||
$pos = strripos($request, ".") + 1;
|
|
||||||
$size = strlen($request);
|
|
||||||
if ($pos < $size) {
|
|
||||||
//if this file got an extension then assign the content
|
|
||||||
$ext_file = substr($request, $pos, $size);
|
|
||||||
if ($ext_file == "gif" || $ext_file == "png") {
|
|
||||||
$ext_file = 'image/' . $ext_file;
|
|
||||||
} elseif ($ext_file == "jpg" || $ext_file == "jpeg") {
|
|
||||||
$ext_file = 'image/jpeg';
|
|
||||||
} elseif ($ext_file == "swf") {
|
|
||||||
$ext_file = "application/x-shockwave-flash";
|
|
||||||
} elseif ($ext_file == "json" || $ext_file == "htc") {
|
|
||||||
$ext_file = "text/plain";
|
|
||||||
} elseif ($ext_file == "htm" || $ext_file == "html" || $ext_file == "txt") {
|
|
||||||
$ext_file = "text/html";
|
|
||||||
} elseif ($ext_file == "doc" || $ext_file == "pdf" || $ext_file == "pm" || $ext_file == "po") {
|
|
||||||
$ext_file = "application/octet-stream";
|
|
||||||
} elseif ($ext_file == "tar") {
|
|
||||||
$ext_file = "application/x-tar";
|
|
||||||
} elseif ($ext_file == "woff") {
|
|
||||||
$ext_file = "application/font-woff";
|
|
||||||
} elseif ($ext_file == "js") {
|
|
||||||
$ext_file = "text/javascript";
|
|
||||||
} elseif ($ext_file == "css") {
|
|
||||||
//may this line be innecesary, all the .css are been generated at run time
|
|
||||||
$ext_file = 'text/css';
|
|
||||||
} else {
|
|
||||||
$ext_file = "application/octet-stream";
|
|
||||||
}
|
|
||||||
header('Content-Type: ' . $ext_file);
|
|
||||||
}
|
|
||||||
header('Pragma: cache');
|
|
||||||
$mtime = filemtime($requestFile);
|
|
||||||
$gmt_mtime = gmdate("D, d M Y H:i:s", $mtime) . " GMT";
|
|
||||||
header('ETag: "' . Bootstrap::encryptOld($mtime . $requestFile) . '"');
|
|
||||||
header("Last-Modified: " . $gmt_mtime);
|
|
||||||
header('Cache-Control: public');
|
|
||||||
$userAgent = strtolower($_SERVER ['HTTP_USER_AGENT']);
|
|
||||||
if (preg_match("/msie/i", $userAgent)) {
|
|
||||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 10) . " GMT");
|
|
||||||
} else {
|
|
||||||
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 90 * 60 * 60 * 24) . " GMT");
|
|
||||||
if (isset($_SERVER ['HTTP_IF_MODIFIED_SINCE'])) {
|
|
||||||
if ($_SERVER ['HTTP_IF_MODIFIED_SINCE'] == $gmt_mtime) {
|
|
||||||
header('HTTP/1.1 304 Not Modified');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($_SERVER ['HTTP_IF_NONE_MATCH'])) {
|
|
||||||
if (str_replace('"', '',
|
|
||||||
stripslashes($_SERVER ['HTTP_IF_NONE_MATCH'])) == Bootstrap::encryptOld($mtime . $requestFile)) {
|
|
||||||
header("HTTP/1.1 304 Not Modified");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
readfile($requestFile);
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Defining RBAC Paths constants
|
// Defining RBAC Paths constants
|
||||||
define('PATH_RBAC_HOME', PATH_TRUNK . 'rbac' . PATH_SEP);
|
define('PATH_RBAC_HOME', PATH_TRUNK . 'rbac' . PATH_SEP);
|
||||||
@@ -154,29 +67,34 @@ define('PATH_UPLOAD', PATH_HTML . 'files' . PATH_SEP);
|
|||||||
|
|
||||||
define('PATH_WORKFLOW_MYSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
|
define('PATH_WORKFLOW_MYSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
|
||||||
define('PATH_RBAC_MYSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
|
define('PATH_RBAC_MYSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mysql' . PATH_SEP);
|
||||||
define('FILE_PATHS_INSTALLED', PATH_CORE . 'config' . PATH_SEP . 'paths_installed.php');
|
define('FILE_PATHS_INSTALLED', PATH_DATA . 'config' . PATH_SEP . 'paths_installed.php');
|
||||||
define('PATH_WORKFLOW_MSSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
|
define('PATH_WORKFLOW_MSSQL_DATA', PATH_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
|
||||||
define('PATH_RBAC_MSSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
|
define('PATH_RBAC_MSSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP . 'mssql' . PATH_SEP);
|
||||||
define('PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP);
|
define('PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP);
|
||||||
|
|
||||||
// include Gulliver Class
|
// Return error for local files that should be returned by nginx or apache2
|
||||||
|
$requestUri = ltrim($_SERVER['REQUEST_URI'], '/'); // Remove leading '/'
|
||||||
|
$requestFile = PATH_HTML . strtok($requestUri, '?'); // Get the file path without query parameters
|
||||||
|
|
||||||
|
if (file_exists($requestFile)) {
|
||||||
|
error_log("Requested file should not be accessed directly: /" . $requestUri);
|
||||||
|
print ("This should not happen. Review the rules in nginx or apache server: /" . $requestUri);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// include Gulliver Class and define necessary paths
|
||||||
if (file_exists(FILE_PATHS_INSTALLED)) {
|
if (file_exists(FILE_PATHS_INSTALLED)) {
|
||||||
|
|
||||||
// include the server installed configuration
|
// include the server installed configuration
|
||||||
require_once FILE_PATHS_INSTALLED;
|
require_once FILE_PATHS_INSTALLED;
|
||||||
|
|
||||||
// defining system constant when a valid server environment exists
|
// defining system constants
|
||||||
define('PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP);
|
define('PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP);
|
||||||
define('PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP);
|
define('PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP);
|
||||||
define('PATH_TEMPORAL', PATH_C . 'dynEditor/');
|
define('PATH_TEMPORAL', PATH_C . 'dynEditor/');
|
||||||
define('PATH_DB', PATH_DATA . 'sites' . PATH_SEP);
|
define('PATH_DB', PATH_DATA . 'sites' . PATH_SEP);
|
||||||
|
|
||||||
// smarty constants
|
|
||||||
define('PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c');
|
define('PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c');
|
||||||
define('PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache');
|
define('PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache');
|
||||||
|
|
||||||
/* TO DO: put these line in other part of code*/
|
|
||||||
Bootstrap::verifyPath(PATH_SMARTY_C, true);
|
Bootstrap::verifyPath(PATH_SMARTY_C, true);
|
||||||
Bootstrap::verifyPath(PATH_SMARTY_CACHE, true);
|
Bootstrap::verifyPath(PATH_SMARTY_CACHE, true);
|
||||||
}
|
}
|
||||||
@@ -191,24 +109,18 @@ set_include_path(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global definitions, before it was the defines.php file
|
* Global definitions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// URL Key
|
// URL Key
|
||||||
define("URL_KEY", 'c0l0s40pt1mu59r1m3');
|
define("URL_KEY", 'c0l0s40pt1mu59r1m3');
|
||||||
|
|
||||||
// Other definitions
|
// Application settings
|
||||||
define('TIMEOUT_RESPONSE', 100); //web service timeout
|
define('TIMEOUT_RESPONSE', 100); //web service timeout in seconds
|
||||||
define('APPLICATION_CODE', 'ProcessMaker'); //to login like workflow system
|
define('APPLICATION_CODE', 'ProcessMaker'); //Application code for login
|
||||||
define('MAIN_POFILE', 'processmaker');
|
define('MAIN_POFILE', 'processmaker');
|
||||||
define('PO_SYSTEM_VERSION', 'PM 4.0.1');
|
define('PO_SYSTEM_VERSION', 'PM 4.0.1');
|
||||||
|
|
||||||
$G_CONTENT = null;
|
|
||||||
$G_MESSAGE = "";
|
|
||||||
$G_MESSAGE_TYPE = "info";
|
|
||||||
$G_MENU_SELECTED = -1;
|
|
||||||
$G_MAIN_MENU = "default";
|
|
||||||
|
|
||||||
// Environment definitions
|
// Environment definitions
|
||||||
define('G_PRO_ENV', 'PRODUCTION');
|
define('G_PRO_ENV', 'PRODUCTION');
|
||||||
define('G_DEV_ENV', 'DEVELOPMENT');
|
define('G_DEV_ENV', 'DEVELOPMENT');
|
||||||
@@ -217,35 +129,18 @@ define('G_TEST_ENV', 'TEST');
|
|||||||
// Number of files per folder at PATH_UPLOAD (cases documents)
|
// Number of files per folder at PATH_UPLOAD (cases documents)
|
||||||
define('APPLICATION_DOCUMENTS_PER_FOLDER', 1000);
|
define('APPLICATION_DOCUMENTS_PER_FOLDER', 1000);
|
||||||
|
|
||||||
|
// Global variables for application state (menus)
|
||||||
|
$G_CONTENT = null;
|
||||||
|
$G_MESSAGE = "";
|
||||||
|
$G_MESSAGE_TYPE = "info";
|
||||||
|
$G_MENU_SELECTED = -1;
|
||||||
|
$G_MAIN_MENU = "default";
|
||||||
|
|
||||||
G::defineConstants();
|
G::defineConstants();
|
||||||
|
|
||||||
$config = Bootstrap::getSystemConfiguration();
|
// Call the function to initialize the session
|
||||||
|
$config = Bootstrap::getSystemConfiguration(); //to do: review
|
||||||
// starting session
|
Bootstrap::initializeSession($config);
|
||||||
if (isset($config['session.gc_maxlifetime'])) {
|
|
||||||
$timelife = $config['session.gc_maxlifetime'];
|
|
||||||
} else {
|
|
||||||
$timelife = ini_get('session.gc_maxlifetime');
|
|
||||||
}
|
|
||||||
if (is_null($timelife)) {
|
|
||||||
$timelife = 1440;
|
|
||||||
}
|
|
||||||
ini_set('session.gc_maxlifetime', $timelife);
|
|
||||||
if ((preg_match("/msie/i", $_SERVER ['HTTP_USER_AGENT']) != 1 ||
|
|
||||||
$config['ie_cookie_lifetime'] == 1) &&
|
|
||||||
(!(preg_match("/safari/i", $_SERVER ['HTTP_USER_AGENT']) == 1 && preg_match("/chrome/i",
|
|
||||||
$_SERVER ['HTTP_USER_AGENT']) == 0) ||
|
|
||||||
$config['safari_cookie_lifetime'] == 1)) {
|
|
||||||
ini_set('session.cookie_lifetime', $timelife);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(array_key_exists('REMOTE_USER', $_SERVER) && (string) ($_SERVER['REMOTE_USER']) != '')) {
|
|
||||||
ini_set('session.cookie_httponly', 1);
|
|
||||||
if (G::is_https()) {
|
|
||||||
ini_set('session.cookie_secure', 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
//Set Time Zone
|
//Set Time Zone
|
||||||
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
|
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
|
||||||
@@ -287,7 +182,7 @@ $_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR
|
|||||||
//to do: make different environments. sys
|
//to do: make different environments. sys
|
||||||
|
|
||||||
//check if it is a installation instance
|
//check if it is a installation instance
|
||||||
if (!defined('PATH_C')) {
|
if (!defined('PATH_C')) { // to do: review
|
||||||
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
|
// is a intallation instance, so we need to define PATH_C and PATH_LANGUAGECONT constants temporarily
|
||||||
define('PATH_C', (rtrim(Bootstrap::sys_get_temp_dir(), PATH_SEP) . PATH_SEP));
|
define('PATH_C', (rtrim(Bootstrap::sys_get_temp_dir(), PATH_SEP) . PATH_SEP));
|
||||||
define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/');
|
define('PATH_LANGUAGECONT', PATH_HOME . 'engine/content/languages/');
|
||||||
@@ -304,10 +199,8 @@ $virtualURITable['/(sys\w{0,})/(\w{0,}.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')) {
|
|
||||||
$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';
|
||||||
@@ -353,7 +246,7 @@ if (Bootstrap::virtualURI($_SERVER['REQUEST_URI'], $virtualURITable, $realPath))
|
|||||||
if (file_exists($pluginFilename)) {
|
if (file_exists($pluginFilename)) {
|
||||||
Bootstrap::streamFile($pluginFilename, false, '', true);
|
Bootstrap::streamFile($pluginFilename, false, '', true);
|
||||||
}
|
}
|
||||||
die();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$requestUriArray = explode("/", $_SERVER['REQUEST_URI']);
|
$requestUriArray = explode("/", $_SERVER['REQUEST_URI']);
|
||||||
@@ -378,7 +271,7 @@ if (Bootstrap::virtualURI($_SERVER['REQUEST_URI'], $virtualURITable, $realPath))
|
|||||||
if (file_exists($fileToBeStreamed)) {
|
if (file_exists($fileToBeStreamed)) {
|
||||||
Bootstrap::streamFile($fileToBeStreamed);
|
Bootstrap::streamFile($fileToBeStreamed);
|
||||||
}
|
}
|
||||||
die();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($realPath) {
|
switch ($realPath) {
|
||||||
@@ -386,7 +279,7 @@ if (Bootstrap::virtualURI($_SERVER['REQUEST_URI'], $virtualURITable, $realPath))
|
|||||||
Bootstrap::parseURI(getenv("REQUEST_URI"));
|
Bootstrap::parseURI(getenv("REQUEST_URI"));
|
||||||
$filename = PATH_METHODS . SYS_COLLECTION . '/' . SYS_TARGET . '.js';
|
$filename = PATH_METHODS . SYS_COLLECTION . '/' . SYS_TARGET . '.js';
|
||||||
Bootstrap::streamFile($filename);
|
Bootstrap::streamFile($filename);
|
||||||
die();
|
exit();
|
||||||
break;
|
break;
|
||||||
case 'errorFile':
|
case 'errorFile':
|
||||||
ob_start();
|
ob_start();
|
||||||
@@ -394,14 +287,14 @@ if (Bootstrap::virtualURI($_SERVER['REQUEST_URI'], $virtualURITable, $realPath))
|
|||||||
if (DEBUG_TIME_LOG) {
|
if (DEBUG_TIME_LOG) {
|
||||||
Bootstrap::logTimeByPage();
|
Bootstrap::logTimeByPage();
|
||||||
} //log this page
|
} //log this page
|
||||||
die();
|
exit();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//Process files loaded with tag head in HTML
|
//Process files loaded with tag head in HTML
|
||||||
$realPath = explode('?', $realPath);
|
$realPath = explode('?', $realPath);
|
||||||
$realPath[0] .= strpos(basename($realPath[0]), '.') === false ? '.php' : '';
|
$realPath[0] .= strpos(basename($realPath[0]), '.') === false ? '.php' : '';
|
||||||
Bootstrap::streamFile($realPath[0]);
|
Bootstrap::streamFile($realPath[0]);
|
||||||
die();
|
exit();
|
||||||
}
|
}
|
||||||
} //virtual URI parser
|
} //virtual URI parser
|
||||||
|
|
||||||
@@ -427,6 +320,7 @@ if (isset($arrayUpdating['action']) && $arrayUpdating['action']) {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Bootstrap::logTimeByPage();
|
||||||
|
|
||||||
// verify if index.html exists
|
// verify if index.html exists
|
||||||
if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template
|
if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template
|
||||||
@@ -436,22 +330,22 @@ if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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_DB') && file_exists(PATH_DB)) {
|
||||||
//Instance Server Configuration Singleton
|
//Instance Server Configuration Singleton
|
||||||
$oServerConf = ServerConf::getSingleton();
|
$oServerConf = ServerConf::getSingleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create headPublisher singleton
|
// Create headPublisher singleton
|
||||||
|
|
||||||
$oHeadPublisher = headPublisher::getSingleton();
|
$oHeadPublisher = headPublisher::getSingleton();
|
||||||
|
|
||||||
|
|
||||||
// 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_DB') || !file_exists(PATH_DB)) {
|
||||||
// new installer, extjs based
|
// new installer, extjs based
|
||||||
define( 'PATH_DATA', PATH_C );
|
|
||||||
|
|
||||||
//important to start laravel classes
|
//important to start laravel classes
|
||||||
app()->useStoragePath(realpath(PATH_DATA));
|
app()->useStoragePath(realpath(PATH_DATA));
|
||||||
@@ -481,7 +375,7 @@ if (!defined('PATH_DATA') || !file_exists(PATH_DATA)) {
|
|||||||
$_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI'];
|
$_SESSION['phpFileNotFound'] = $_SERVER['REQUEST_URI'];
|
||||||
header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
|
header("location: /errors/error404.php?url=" . urlencode($_SERVER['REQUEST_URI']));
|
||||||
}
|
}
|
||||||
die();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
app()->useStoragePath(realpath(PATH_DATA));
|
app()->useStoragePath(realpath(PATH_DATA));
|
||||||
@@ -850,7 +744,13 @@ if (!defined('EXECUTE_BY_CRON')) {
|
|||||||
(!(preg_match("/safari/i", $_SERVER ['HTTP_USER_AGENT']) == 1 && preg_match("/chrome/i",
|
(!(preg_match("/safari/i", $_SERVER ['HTTP_USER_AGENT']) == 1 && preg_match("/chrome/i",
|
||||||
$_SERVER ['HTTP_USER_AGENT']) == 0) ||
|
$_SERVER ['HTTP_USER_AGENT']) == 0) ||
|
||||||
$config['safari_cookie_lifetime'] == 1)) {
|
$config['safari_cookie_lifetime'] == 1)) {
|
||||||
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + $timelife, 'httponly' => true]);
|
// Determine session lifetime
|
||||||
|
$sessionLifetime = isset($config['session.gc_maxlifetime']) ? $config['session.gc_maxlifetime'] : ini_get('session.gc_maxlifetime');
|
||||||
|
// Default to 1440 seconds (24 minutes) if lifetime is not set
|
||||||
|
if (is_null($sessionLifetime)) {
|
||||||
|
$sessionLifetime = 1440;
|
||||||
|
}
|
||||||
|
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + $sessionLifetime, 'httponly' => true]);
|
||||||
setcookie(session_name(), session_id(), $cookieOptions);
|
setcookie(session_name(), session_id(), $cookieOptions);
|
||||||
}
|
}
|
||||||
$RBAC->initRBAC();
|
$RBAC->initRBAC();
|
||||||
|
|||||||
Reference in New Issue
Block a user