BUG 0000 Adjustment for the standardization of code.
- Only modified standardization of code.
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.bootstrap.php
|
||||
*
|
||||
* @package gulliver.system
|
||||
*
|
||||
*/
|
||||
|
||||
class Bootstrap
|
||||
{
|
||||
static $includeClassPaths = array();
|
||||
|
||||
public static $includeClassPaths = array();
|
||||
protected $relativeIncludePaths = array();
|
||||
|
||||
//below here only approved methods
|
||||
|
||||
/* the autoloader functions */
|
||||
|
||||
static function autoloadClass($class)
|
||||
public static function autoloadClass($class)
|
||||
{
|
||||
//error_log( "$class ");
|
||||
$className = strtolower($class);
|
||||
@@ -39,6 +39,7 @@ class Bootstrap
|
||||
/*
|
||||
* these functions still under revision
|
||||
*/
|
||||
|
||||
public function getSystemConfiguration($globalIniFile = '', $wsIniFile = '', $wsName = '')
|
||||
{
|
||||
$readGlobalIniFile = false;
|
||||
@@ -84,8 +85,7 @@ class Bootstrap
|
||||
}
|
||||
|
||||
// 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' => ''
|
||||
);
|
||||
$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) {
|
||||
@@ -366,7 +366,8 @@ class Bootstrap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function mk_dir($strPath, $rights = 0777) {
|
||||
public function mk_dir($strPath, $rights = 0777)
|
||||
{
|
||||
$folder_path = array($strPath);
|
||||
$oldumask = umask(0);
|
||||
while (!@is_dir(dirname(end($folder_path))) && dirname(end($folder_path)) != '/' && dirname(end($folder_path)) != '.' && dirname(end($folder_path)) != '') {
|
||||
@@ -394,7 +395,8 @@ class Bootstrap
|
||||
* @param $resources array
|
||||
* a list of files to verify write access
|
||||
*/
|
||||
public function verifyWriteAccess($resources) {
|
||||
public function verifyWriteAccess($resources)
|
||||
{
|
||||
$noWritable = array();
|
||||
foreach ($resources as $i => $resource) {
|
||||
if (!is_writable($resource)) {
|
||||
@@ -419,7 +421,8 @@ class Bootstrap
|
||||
* @param $data associative
|
||||
* array containig the template data
|
||||
*/
|
||||
public function renderTemplate($template, $data = array()) {
|
||||
public function renderTemplate($template, $data = array())
|
||||
{
|
||||
if (!defined('PATH_THIRDPARTY')) {
|
||||
throw new Exception('System constant (PATH_THIRDPARTY) is not defined!');
|
||||
}
|
||||
@@ -481,7 +484,8 @@ class Bootstrap
|
||||
* @param string $strClass
|
||||
* @return void
|
||||
*/
|
||||
public function LoadSystem($strClass) {
|
||||
public function LoadSystem($strClass)
|
||||
{
|
||||
require_once (PATH_GULLIVER . 'class.' . $strClass . '.php');
|
||||
}
|
||||
|
||||
@@ -491,7 +495,8 @@ class Bootstrap
|
||||
*
|
||||
* @author <erik@colosa.com>
|
||||
*/
|
||||
public function sys_get_temp_dir() {
|
||||
public function sys_get_temp_dir()
|
||||
{
|
||||
if (!function_exists('sys_get_temp_dir')) {
|
||||
// Based on http://www.phpit.net/
|
||||
// article/creating-zip-tar-archives-dynamically-php/2/
|
||||
@@ -536,9 +541,7 @@ class Bootstrap
|
||||
foreach ($convertionTable as $urlPattern => $localPath) {
|
||||
// $urlPattern = addcslashes( $urlPattern , '/');
|
||||
$urlPattern = addcslashes($urlPattern, './');
|
||||
$urlPattern = '/^' . str_replace( array ('*','?'
|
||||
), array ('.*','.?'
|
||||
), $urlPattern ) . '$/';
|
||||
$urlPattern = '/^' . str_replace(array('*', '?'), array('.*', '.?'), $urlPattern) . '$/';
|
||||
if (preg_match($urlPattern, $url, $match)) {
|
||||
if ($localPath === false) {
|
||||
$realPath = $url;
|
||||
@@ -670,7 +673,8 @@ class Bootstrap
|
||||
* @param string $urlLink
|
||||
* @return string
|
||||
*/
|
||||
static public function parseURI($uri, $isRestRequest = false) {
|
||||
static public function parseURI($uri, $isRestRequest = false)
|
||||
{
|
||||
// *** 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) {
|
||||
@@ -704,7 +708,8 @@ class Bootstrap
|
||||
* 2 or bigger to check if the temporary file exists.
|
||||
* return true if the file exists, otherwise false.
|
||||
*/
|
||||
public function isPMUnderUpdating($setFlag = 2) {
|
||||
public function isPMUnderUpdating($setFlag = 2)
|
||||
{
|
||||
if (!defined('PATH_DATA')) {
|
||||
return false;
|
||||
}
|
||||
@@ -738,7 +743,8 @@ class Bootstrap
|
||||
* array containig the template data
|
||||
* @return $content string containing the parsed template content
|
||||
*/
|
||||
public function parseTemplate($template, $data = array()) {
|
||||
public function parseTemplate($template, $data = array())
|
||||
{
|
||||
$content = '';
|
||||
|
||||
ob_start();
|
||||
@@ -758,7 +764,8 @@ class Bootstrap
|
||||
* @param string $strClass
|
||||
* @return void
|
||||
*/
|
||||
public function LoadClass($strClass) {
|
||||
public function LoadClass($strClass)
|
||||
{
|
||||
$classfile = Bootstrap::ExpandPath("classes") . 'class.' . $strClass . '.php';
|
||||
if (!file_exists($classfile)) {
|
||||
if (file_exists(PATH_GULLIVER . 'class.' . $strClass . '.php')) {
|
||||
@@ -781,7 +788,8 @@ class Bootstrap
|
||||
* @param string $strClass
|
||||
* @return void
|
||||
*/
|
||||
public function LoadThirdParty($sPath, $sFile) {
|
||||
public function LoadThirdParty($sPath, $sFile)
|
||||
{
|
||||
$classfile = PATH_THIRDPARTY . $sPath . '/' . $sFile . ((substr($sFile, 0, - 4) !== '.php') ? '.php' : '');
|
||||
return require_once ($classfile);
|
||||
}
|
||||
@@ -797,7 +805,8 @@ class Bootstrap
|
||||
* @param string lang
|
||||
* @return void
|
||||
*/
|
||||
public function LoadTranslationObject($lang = SYS_LANG) {
|
||||
public function LoadTranslationObject($lang = SYS_LANG)
|
||||
{
|
||||
$defaultTranslations = Array();
|
||||
$foreignTranslations = Array();
|
||||
|
||||
@@ -835,7 +844,8 @@ class Bootstrap
|
||||
* @param string $strSkin
|
||||
* @return void
|
||||
*/
|
||||
public function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '') {
|
||||
public function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '')
|
||||
{
|
||||
global $G_CONTENT;
|
||||
global $G_TEMPLATE;
|
||||
global $G_SKIN;
|
||||
@@ -892,7 +902,8 @@ class Bootstrap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null) {
|
||||
public function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null)
|
||||
{
|
||||
if (isset($width)) {
|
||||
$_SESSION ['G_MESSAGE_WIDTH'] = $width;
|
||||
}
|
||||
@@ -927,7 +938,8 @@ class Bootstrap
|
||||
* @param string $parameter
|
||||
* @return string
|
||||
*/
|
||||
public function header($parameter) {
|
||||
public function header($parameter)
|
||||
{
|
||||
if (defined('ENABLE_ENCRYPT') && (ENABLE_ENCRYPT == 'yes') && (substr($parameter, 0, 9) == 'location:')) {
|
||||
$url = Bootstrap::encrypt(substr($parameter, 10), URL_KEY);
|
||||
header('location:' . $url);
|
||||
@@ -946,7 +958,8 @@ class Bootstrap
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function LoadAllPluginModelClasses() {
|
||||
public function LoadAllPluginModelClasses()
|
||||
{
|
||||
// Get the current Include path, where the plugins directories should be
|
||||
if (!defined('PATH_SEPARATOR')) {
|
||||
define('PATH_SEPARATOR', (substr(PHP_OS, 0, 3) == 'WIN') ? ';' : ':' );
|
||||
@@ -982,7 +995,8 @@ class Bootstrap
|
||||
* @param string $strPath
|
||||
* @return string
|
||||
*/
|
||||
public function expandPath($strPath = '') {
|
||||
public function expandPath($strPath = '')
|
||||
{
|
||||
$res = "";
|
||||
$res = PATH_CORE;
|
||||
if ($strPath != "") {
|
||||
@@ -1099,7 +1113,8 @@ class Bootstrap
|
||||
/**
|
||||
* function to calculate the time used to render a page
|
||||
*/
|
||||
public function logTimeByPage() {
|
||||
public function logTimeByPage()
|
||||
{
|
||||
if (!defined(PATH_DATA)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1123,7 +1138,8 @@ class Bootstrap
|
||||
* @param string $downloadFileName
|
||||
* @return string
|
||||
*/
|
||||
public function streamJSTranslationFile($filename, $locale = 'en') {
|
||||
public function streamJSTranslationFile($filename, $locale = 'en')
|
||||
{
|
||||
$defaultTranslations = Array();
|
||||
$foreignTranslations = Array();
|
||||
|
||||
@@ -1242,7 +1258,6 @@ class Bootstrap
|
||||
$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' );
|
||||
|
||||
//Classic Skin
|
||||
$extJsSkin = 'xtheme-gray';
|
||||
|
||||
@@ -1314,7 +1329,8 @@ class Bootstrap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sendHeaders($filename, $contentType = '', $download = false, $downloadFileName = '') {
|
||||
public function sendHeaders($filename, $contentType = '', $download = false, $downloadFileName = '')
|
||||
{
|
||||
if ($download) {
|
||||
if ($downloadFileName == '') {
|
||||
$aAux = explode('/', $filename);
|
||||
@@ -1462,7 +1478,6 @@ class Bootstrap
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* strip_slashes
|
||||
* @param vVar
|
||||
@@ -1484,7 +1499,6 @@ class Bootstrap
|
||||
return $vVar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function LoadTranslation
|
||||
*
|
||||
@@ -1523,7 +1537,6 @@ class Bootstrap
|
||||
}
|
||||
return $untranslatedMark . $msgID . $untranslatedMark;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1578,7 +1591,6 @@ class Bootstrap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ************************************* init **********************************************
|
||||
* Xml parse collection functions
|
||||
@@ -1622,7 +1634,6 @@ class Bootstrap
|
||||
$cv['__CONTENT__'] = array();
|
||||
$cv['__CONTENT__']['_p'] = &$ary;
|
||||
$ary = &$cv['__CONTENT__'];
|
||||
|
||||
} elseif ($r['type'] == 'complete') {
|
||||
if (isset($ary[$t])) {
|
||||
if (isset($ary[$t][0])) {
|
||||
@@ -1640,7 +1651,6 @@ class Bootstrap
|
||||
}
|
||||
}
|
||||
$cv['__VALUE__'] = (isset($r['value']) ? $r['value'] : '');
|
||||
|
||||
} elseif ($r['type'] == 'close') {
|
||||
$ary = &$ary['_p'];
|
||||
}
|
||||
@@ -1699,7 +1709,6 @@ class Bootstrap
|
||||
return $total;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _del_p
|
||||
*
|
||||
@@ -2034,26 +2043,16 @@ class Bootstrap
|
||||
} elseif (strstr($pv_browser_string, '2003')) {
|
||||
$os_working_number = 5.2;
|
||||
$os_working_type = 'nt';
|
||||
}
|
||||
elseif ( strstr( $pv_browser_string, 'windows ce' ) )// windows CE
|
||||
{
|
||||
} elseif (strstr($pv_browser_string, 'windows ce')) {// windows CE
|
||||
$os_working_number = 'ce';
|
||||
$os_working_type = 'nt';
|
||||
}
|
||||
elseif ( strstr( $pv_browser_string, '95' ) )
|
||||
{
|
||||
} elseif (strstr($pv_browser_string, '95')) {
|
||||
$os_working_number = '95';
|
||||
}
|
||||
elseif ( ( strstr( $pv_browser_string, '9x 4.9' ) ) || ( strstr( $pv_browser_string, ' me' ) ) )
|
||||
{
|
||||
} elseif (( strstr($pv_browser_string, '9x 4.9') ) || ( strstr($pv_browser_string, ' me') )) {
|
||||
$os_working_number = 'me';
|
||||
}
|
||||
elseif ( strstr( $pv_browser_string, '98' ) )
|
||||
{
|
||||
} elseif (strstr($pv_browser_string, '98')) {
|
||||
$os_working_number = '98';
|
||||
}
|
||||
elseif ( strstr( $pv_browser_string, '2000' ) )// windows 2000, for opera ID
|
||||
{
|
||||
} elseif (strstr($pv_browser_string, '2000')) {// windows 2000, for opera ID
|
||||
$os_working_number = 5.0;
|
||||
$os_working_type = 'nt';
|
||||
}
|
||||
@@ -2305,6 +2304,7 @@ class Bootstrap
|
||||
/**
|
||||
* * Encrypt and decrypt functions ***
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encrypt string
|
||||
*
|
||||
@@ -2390,9 +2390,7 @@ class Bootstrap
|
||||
{
|
||||
$e = $scope . $id;
|
||||
$e = Bootstrap::encrypt($e, URL_KEY);
|
||||
$e = str_replace( array ('+','/','='
|
||||
), array ('__','_','___'
|
||||
), base64_encode( $e ) );
|
||||
$e = str_replace(array('+', '/', '='), array('__', '_', '___'), base64_encode($e));
|
||||
return $e;
|
||||
}
|
||||
|
||||
@@ -2408,9 +2406,7 @@ class Bootstrap
|
||||
*/
|
||||
public function getUIDName($uid, $scope = '')
|
||||
{
|
||||
$e = str_replace( array ('=','+','/'
|
||||
), array ('___','__','_'
|
||||
), $uid );
|
||||
$e = str_replace(array('=', '+', '/'), array('___', '__', '_'), $uid);
|
||||
$e = base64_decode($e);
|
||||
$e = Bootstrap::decrypt($e, URL_KEY);
|
||||
$e = substr($e, strlen($scope));
|
||||
@@ -2480,6 +2476,7 @@ class Bootstrap
|
||||
* @fn() Evaluate string with the function "fn"
|
||||
* @author David Callizaya <calidavidx21@hotmail.com>
|
||||
*/
|
||||
|
||||
public function replaceDataField($sqlString, $result, $DBEngine = 'mysql')
|
||||
{
|
||||
if (!is_array($result)) {
|
||||
@@ -2732,7 +2729,6 @@ class Bootstrap
|
||||
* if the day is 5 and the format is DD or D then -> five
|
||||
* *******************************************************************************************************
|
||||
*/
|
||||
|
||||
//scape the literal
|
||||
switch ($lang) {
|
||||
case 'es':
|
||||
@@ -2791,10 +2787,8 @@ class Bootstrap
|
||||
$yy = substr($year, strlen($year) - 2, 2);
|
||||
$yyyy = $year;
|
||||
|
||||
$names = array ('{day}','{DAY}','{month}','{YONTH}','{XONTH}','{year}','{YEAR}','{h}','{i}','{s}'
|
||||
);
|
||||
$values = array ($d,$dd,$m,$mm,$M,$yy,$yyyy,$h,$i,$s
|
||||
);
|
||||
$names = array('{day}', '{DAY}', '{month}', '{YONTH}', '{XONTH}', '{year}', '{YEAR}', '{h}', '{i}', '{s}' );
|
||||
$values = array($d, $dd, $m, $mm, $M, $yy, $yyyy, $h, $i, $s );
|
||||
|
||||
$ret = str_replace($names, $values, $format);
|
||||
|
||||
@@ -2875,7 +2869,6 @@ class Bootstrap
|
||||
return $campo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* evalJScript
|
||||
*
|
||||
@@ -2920,30 +2913,33 @@ class Bootstrap
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* isWinOs
|
||||
*
|
||||
* @return true if the 3 first letters of PHP_OS got 'WIN', otherwise false.
|
||||
*/
|
||||
function isWinOs()
|
||||
public function isWinOs()
|
||||
{
|
||||
return strtoupper(substr(PHP_OS, 0, 3)) == "WIN";
|
||||
}
|
||||
|
||||
/**
|
||||
* isNTOs
|
||||
*
|
||||
* @return true if PHP_OS is 'WINNT', otherwise false.
|
||||
*/
|
||||
function isNTOs()
|
||||
public function isNTOs()
|
||||
{
|
||||
return PHP_OS == "WINNT";
|
||||
}
|
||||
|
||||
/**
|
||||
* isLinuxOs
|
||||
*
|
||||
* @return true if PHP_OS (upper text) got 'LINUX', otherwise false.
|
||||
*/
|
||||
function isLinuxOs()
|
||||
public function isLinuxOs()
|
||||
{
|
||||
return strtoupper(PHP_OS) == "LINUX";
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user