From aa556e7b20533c378d2d213f5adbac917b74064f Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 13 Mar 2014 13:22:37 -0400 Subject: [PATCH 1/2] FIX, removing duplicated function an adding its reference for backward compatibility --- gulliver/system/class.bootstrap.php | 83 ++---------------------- workflow/engine/classes/class.system.php | 13 +++- 2 files changed, 15 insertions(+), 81 deletions(-) diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 259993b53..f41a655e3 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -68,87 +68,12 @@ class Bootstrap public static function getSystemConfiguration($globalIniFile = '', $wsIniFile = '', $wsName = '') { - $readGlobalIniFile = false; - $readWsIniFile = false; - - if (empty($globalIniFile)) { - $globalIniFile = PATH_CORE . 'config' . PATH_SEP . 'env.ini'; + // (!) Backward compatibility, the original function is in System class + if (! class_exists("System")) { + require_once PATH_CORE . "classes" . PATH_SEP . "class.system.php"; } - if (empty($wsIniFile)) { - if (defined('PATH_DB')) { - // if we're on a valid workspace env. - if (empty($wsName)) { - $uriParts = explode('/', getenv("REQUEST_URI")); - if (isset($uriParts[1])) { - if (substr($uriParts[1], 0, 3) == 'sys') { - $wsName = substr($uriParts[1], 3); - } - } - } - $wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini'; - } - } - - $readGlobalIniFile = file_exists($globalIniFile) ? true : false; - $readWsIniFile = file_exists($wsIniFile) ? true : false; - - if (isset($_SESSION['PROCESSMAKER_ENV'])) { - $md5 = array(); - - if ($readGlobalIniFile) { - $md5[] = md5_file($globalIniFile); - } - if ($readWsIniFile) { - $md5[] = md5_file($wsIniFile); - } - $hash = implode('-', $md5); - - if ($_SESSION['PROCESSMAKER_ENV_HASH'] === $hash) { - $_SESSION['PROCESSMAKER_ENV']['from_cache'] = 1; - return $_SESSION['PROCESSMAKER_ENV']; - } - } - - // default configuration - $error_reporting_default = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; - $error_reporting_default = defined('E_STRICT') ? $error_reporting_default & ~E_STRICT : $error_reporting_default; - - $config = array('debug' => 0, 'debug_sql' => 0, 'debug_time' => 0, 'debug_calendar' => 0, 'wsdl_cache' => 1, 'memory_limit' => "256M", - 'time_zone' => 'America/New_York', 'memcached' => 0, 'memcached_server' => '', 'default_skin' => 'neoclassic', 'default_lang' => 'en', - 'proxy_host' => '', 'proxy_port' => '', 'proxy_user' => '', 'proxy_pass' => '' , 'size_log_file' => 5000000 , 'number_log_file' => 5, - 'ie_cookie_lifetime' => 1, 'error_reporting' => $error_reporting_default, 'display_errors' => 'On'); - - // read the global env.ini configuration file - if ($readGlobalIniFile && ($globalConf = @parse_ini_file($globalIniFile)) !== false) { - $config = array_merge($config, $globalConf); - } - - // Workspace environment configuration - if ($readWsIniFile && ($wsConf = @parse_ini_file($wsIniFile)) !== false) { - $config = array_merge($config, $wsConf); - } - - // validation debug config, only binary value is valid; debug = 1, to enable - $config['debug'] = $config['debug'] == 1 ? 1 : 0; - - if ($config['proxy_pass'] != '') { - $config['proxy_pass'] = G::decrypt($config['proxy_pass'], 'proxy_pass'); - } - - $md5 = array(); - if ($readGlobalIniFile) { - $md5[] = md5_file($globalIniFile); - } - if ($readWsIniFile) { - $md5[] = md5_file($wsIniFile); - } - $hash = implode('-', $md5); - - $_SESSION['PROCESSMAKER_ENV'] = $config; - $_SESSION['PROCESSMAKER_ENV_HASH'] = $hash; - - return $config; + return System::getSystemConfiguration($globalIniFile, $wsIniFile, $wsName); } public static function registerSystemClasses() diff --git a/workflow/engine/classes/class.system.php b/workflow/engine/classes/class.system.php index 6b1452f49..a9038127c 100755 --- a/workflow/engine/classes/class.system.php +++ b/workflow/engine/classes/class.system.php @@ -66,7 +66,10 @@ class System 'proxy_user' => '', 'proxy_pass' => '', 'size_log_file' => 5000000, - 'number_log_file' => 5 + 'number_log_file' => 5, + 'ie_cookie_lifetime' => 1, + 'error_reporting' => "", + 'display_errors' => 'On' ); /** @@ -1088,7 +1091,13 @@ class System } } - // default configuration + // default configuration for "error_reporting" conf + if (empty(self::$defaultConfig["error_reporting"])) { + $errorReportingDefault = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; + $errorReportingDefault = defined('E_STRICT') ? $errorReportingDefault & ~E_STRICT : $errorReportingDefault; + self::$defaultConfig["error_reporting"] = $errorReportingDefault; + } + $config = self::$defaultConfig; // read the global env.ini configuration file From def52653ed88710e58c3a29cff4790ca75ddcb78 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 13 Mar 2014 16:08:21 -0400 Subject: [PATCH 2/2] removing old files --- src/framework/Maveriks/Util/ClassLoader.php | 111 ------ src/framework/Maveriks/Util/Logger.php | 73 ---- src/framework/Maveriks/WebApplication.php | 359 -------------------- 3 files changed, 543 deletions(-) delete mode 100644 src/framework/Maveriks/Util/ClassLoader.php delete mode 100644 src/framework/Maveriks/Util/Logger.php delete mode 100644 src/framework/Maveriks/WebApplication.php diff --git a/src/framework/Maveriks/Util/ClassLoader.php b/src/framework/Maveriks/Util/ClassLoader.php deleted file mode 100644 index bda55000d..000000000 --- a/src/framework/Maveriks/Util/ClassLoader.php +++ /dev/null @@ -1,111 +0,0 @@ -SplClassLoader that loads classes of the - * specified namespace. - * - * @param string $ns The namespace to use. - */ - public function __construct() - { - defined("DS") || define("DS", DIRECTORY_SEPARATOR); - defined("NS") || define("NS", "\\"); - - spl_autoload_register(array($this, 'loadClass')); - } - - /** - * @return \ProcessMaker\Core\ClassLoader - */ - public static function getInstance() - { - if (is_null(self::$instance)) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Gets the base include path for all class files in the namespace of this class loader. - * - * @return string $includePath - */ - public function getIncludePaths() - { - return self::$includePath; - } - - /** - * Uninstalls this class loader from the SPL autoloader stack. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - public function add($namespace, $sourceDir) - { - if (empty($namespace)) { - self::$includePath[] = $sourceDir . (substr($sourceDir, -1) == DS ? "" : DS); - } else { - self::$includePath[$namespace] = $sourceDir . (substr($sourceDir, -1) == DS ? "" : DS); - } - } - - function loadClass($className) - { - var_dump(self::$includePath); die; - $className = ltrim($className, NS); - - foreach (self::$includePath as $path) { - if ($lastPos = strrpos($className, NS)) { - $namespace = substr($className, 0, $lastPos); - var_dump($namespace); - $className = substr($className, $lastPos + 1); - $subpath = str_replace(NS, DS, $namespace) . DS; - } - - - $filename = $path . $subpath . $className . ".php"; - var_dump($filename); - - if (file_exists($filename)) { - require $filename . ".php"; - return true; - } - } - - return false; - } - - /** - * Loads the given class or interface. - * - * @param string $className The name of the class to load. - * @return void - */ - public function loadClass2($className) - { - if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) { - $fileName = ''; - $namespace = ''; - - if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) { - $namespace = substr($className, 0, $lastNsPos); - $className = substr($className, $lastNsPos + 1); - $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; - } - - $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; - - require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; - } - } -} \ No newline at end of file diff --git a/src/framework/Maveriks/Util/Logger.php b/src/framework/Maveriks/Util/Logger.php deleted file mode 100644 index 7dc8716d4..000000000 --- a/src/framework/Maveriks/Util/Logger.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ -class Logger -{ - private static $instance; - private $logFile; - private $fp; - - protected function __construct() - { - $this->logFile = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'processmaker.log'; - if (! file_exists($this->logFile)) { - if (! touch($this->logFile)) { - error_log("ProcessMaker Log file can't be created!"); - } - chmod($this->logFile, 0777); - } - - $this->fp = fopen($this->logFile, "a+"); - } - - public static function getInstance() - { - if (is_null(self::$instance)) { - self::$instance = new Logger(); - } - - return self::$instance; - } - - public function setLogLine() - { - $args = func_get_args(); - - $this->setLog(date('Y-m-d H:i:s') . " "); - - foreach ($args as $str) { - $this->setLog((is_string($str) ? $str : var_export($str, true)) . PHP_EOL); - } - } - - public function setLogInline() - { - $args = func_get_args(); - $this->setLog(date('Y-m-d H:i:s') . " "); - - foreach ($args as $str) { - $this->setLog((is_string($str) ? $str : var_export($str, true)) . " "); - } - } - - public function setLog($str) - { - fwrite($this->fp, $str); - } - - public static function log() - { - $me = Logger::getInstance(); - $args = func_get_args(); - - call_user_func_array(array($me, 'setLogLine'), $args); - } -} - diff --git a/src/framework/Maveriks/WebApplication.php b/src/framework/Maveriks/WebApplication.php deleted file mode 100644 index 873f4f108..000000000 --- a/src/framework/Maveriks/WebApplication.php +++ /dev/null @@ -1,359 +0,0 @@ -rootDir = $rootDir; - $this->workflowDir = $rootDir . DS . "workflow" . DS; - } - - /** - * @return string - */ - public function getRootDir() - { - return $this->rootDir; - } - - /** - * @param string $requestUri - */ - public function setRequestUri($requestUri) - { - $this->requestUri = $requestUri; - } - - /** - * @return string - */ - public function getRequestUri() - { - return $this->requestUri; - } - - public function route() - { - if (substr($this->requestUri, 1, 3) == "api") { - return self::RUNNING_API; - } else { - return self::RUNNING_WORKFLOW; - } - } - - public function run($type = "") - { - switch ($type) { - case self::SERVICE_API: - $request = $this->parseApiRequestUri(); - $this->loadEnvironment($request["workspace"]); - - Util\Logger::log("API::Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]); - $this->dispatchApiRequest($request["uri"], $request["version"]); - Util\Logger::log("API::End Dispatching ".$_SERVER["REQUEST_METHOD"]." ".$request["uri"]); - break; - } - } - - /** - * This method dispatch rest/api service - * - * @author Erik Amaru Ortiz - */ - public function dispatchApiRequest($uri, $version = "1.0") - { - // to handle a request with "OPTIONS" method - if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { - header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEADERS'); - header('Access-Control-Allow-Headers: authorization, content-type'); - header("Access-Control-Allow-Credentials", "false"); - header('Access-Control-Max-Age: 60'); - die(); - } - - /* - * Enable this header to allow "Cross Domain AJAX" requests; - * This works because processmaker is handling correctly requests with method 'OPTIONS' - * that automatically is sent by a client using XmlHttpRequest or similar. - */ - header('Access-Control-Allow-Origin: *'); - - // $servicesDir contains directory where Services Classes are allocated - $servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'Services' . DS; - // $apiDir - contains directory to scan classes and add them to Restler - $apiDir = $servicesDir . 'Api' . DS; - // $apiIniFile - contains file name of api ini configuration - $apiIniFile = $servicesDir . DS . 'api.ini'; - // $authenticationClass - contains the class name that validate the authentication for Restler - $authenticationClass = 'Services\\Api\\OAuth2\\Server'; - // $pmOauthClientId - contains PM Local OAuth Id (Web Designer) - $pmOauthClientId = 'x-pm-local-client'; - - /* - * Load Api ini file for Rest Service - */ - $apiIniConf = array(); - if (file_exists($apiIniFile)) { - $apiIniConf = Util\Common::parseIniFile($apiIniFile); - } - - // Setting current workspace to Api class - \ProcessMaker\Services\Api::setWorkspace(SYS_SYS); - // TODO remove this setting on the future, it is not needed, but if it is not present is throwing a warning - \Luracast\Restler\Format\HtmlFormat::$viewPath = $servicesDir . 'oauth2/views'; - - // create a new Restler instance - $rest = new \Luracast\Restler\Restler(); - // setting api version to Restler - $rest->setAPIVersion($version); - // adding $authenticationClass to Restler - $rest->addAuthenticationClass($authenticationClass, ''); - - // Setting database connection source - list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, ''); - $port = empty($port) ? '' : ";port=$port"; - \Services\Api\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port); - - // Setting default OAuth Client id, for local PM Web Designer - \Services\Api\OAuth2\Server::setPmClientId($pmOauthClientId); - - require_once $this->workflowDir . "engine/src/Extension/Restler/UploadFormat.php"; - //require_once PATH_CORE - - //$rest->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat'); - //$rest->setOverridingFormats('UploadFormat', 'JsonFormat', 'XmlFormat', 'HtmlFormat'); - $rest->setOverridingFormats('JsonFormat', 'UploadFormat'); - - // Override $_SERVER['REQUEST_URI'] to Restler handles the current url correctly - - $isPluginRequest = strpos($uri, '/plugin-') !== false ? true : false; - - if ($isPluginRequest) { - $tmp = explode('/', $uri); - array_shift($tmp); - $tmp = array_shift($tmp); - $tmp = explode('-', $tmp); - $pluginName = $tmp[1]; - $uri = str_replace('/plugin-'.$pluginName, '', $uri); - } - - $_SERVER['REQUEST_URI'] = $uri; - - if (! $isPluginRequest) { // if it is not a request for a plugin endpoint - // scan all api directory to find api classes - $classesList = \Bootstrap::rglob('*', 0, $apiDir); - - foreach ($classesList as $classFile) { - if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') { - $namespace = '\\Services\\' . str_replace( - DIRECTORY_SEPARATOR, - '\\', - str_replace('.php', '', str_replace($servicesDir, '', $classFile)) - ); - //var_dump($namespace); - $rest->addAPIClass($namespace); - } - } - - // adding aliases for Restler - if (array_key_exists('alias', $apiIniConf)) { - foreach ($apiIniConf['alias'] as $alias => $aliasData) { - if (is_array($aliasData)) { - foreach ($aliasData as $label => $namespace) { - $namespace = '\\' . ltrim($namespace, '\\'); - $rest->addAPIClass($namespace, $alias); - } - } - } - } - } else { - // hook to get rest api classes from plugins -// if (class_exists('PMPluginRegistry')) { -// $pluginRegistry = & PMPluginRegistry::getSingleton(); -// $plugins = $pluginRegistry->getRegisteredRestServices(); -// -// if (is_array($plugins) && array_key_exists($pluginName, $plugins)) { -// foreach ($plugins[$pluginName] as $class) { -// $rest->addAPIClass($class['namespace']); -// } -// } -// } - } - - $rest->handle(); - } - - public function parseApiRequestUri() - { - $url = explode("/", $this->requestUri); - array_shift($url); - array_shift($url); - $version = array_shift($url); - $workspace = array_shift($url); - $restUri = ""; - - foreach ($url as $urlPart) { - $restUri .= "/" . $urlPart; - } - - return array( - "uri" => $restUri, - "version" => $version, - "workspace" => $workspace - ); - } - - public function loadEnvironment($workspace) - { - $lang = "en"; - - define('SYS_LANG', $lang); - define('PATH_SEP', DIRECTORY_SEPARATOR); - - define('PATH_TRUNK', $this->rootDir . PATH_SEP); - define('PATH_OUTTRUNK', realpath($this->rootDir . '/../') . PATH_SEP); - define('PATH_HOME', $this->rootDir . PATH_SEP . 'workflow' . PATH_SEP); - - define('PATH_HTML', PATH_HOME . 'public_html' . PATH_SEP); - define('PATH_RBAC_HOME', PATH_TRUNK . 'rbac' . PATH_SEP); - define('PATH_GULLIVER_HOME', PATH_TRUNK . 'gulliver' . PATH_SEP); - define('PATH_GULLIVER', PATH_GULLIVER_HOME . 'system' . PATH_SEP); //gulliver system classes - define('PATH_GULLIVER_BIN', PATH_GULLIVER_HOME . 'bin' . PATH_SEP); //gulliver bin classes - define('PATH_TEMPLATE', PATH_GULLIVER_HOME . 'templates' . PATH_SEP); - define('PATH_THIRDPARTY', PATH_GULLIVER_HOME . 'thirdparty' . PATH_SEP); - define('PATH_RBAC', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP); //to enable rbac version 2 - define('PATH_RBAC_CORE', PATH_RBAC_HOME . 'engine' . PATH_SEP); - define('PATH_CORE', PATH_HOME . 'engine' . PATH_SEP); - define('PATH_SKINS', PATH_CORE . 'skins' . PATH_SEP); - define('PATH_SKIN_ENGINE', PATH_CORE . 'skinEngine' . PATH_SEP); - define('PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP); - define('PATH_XMLFORM', PATH_CORE . 'xmlform' . PATH_SEP); - define('PATH_CONFIG', PATH_CORE . 'config' . PATH_SEP); - define('PATH_PLUGINS', PATH_CORE . 'plugins' . PATH_SEP); - define('PATH_HTMLMAIL', PATH_CORE . 'html_templates' . PATH_SEP); - define('PATH_TPL', PATH_CORE . 'templates' . PATH_SEP); - define('PATH_TEST', PATH_CORE . 'test' . PATH_SEP); - define('PATH_FIXTURES', PATH_TEST . 'fixtures' . PATH_SEP); - define('PATH_RTFDOCS', PATH_CORE . 'rtf_templates' . PATH_SEP); - define('PATH_DYNACONT', PATH_CORE . 'content' . PATH_SEP . 'dynaform' . PATH_SEP); - define('SYS_UPLOAD_PATH', PATH_HOME . "public_html/files/" ); - define('PATH_UPLOAD', PATH_HTML . 'files' . 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('FILE_PATHS_INSTALLED', PATH_CORE . 'config' . PATH_SEP . 'paths_installed.php' ); - 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_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP); - define('PATH_SERVICES_REST', PATH_CORE . 'services' . PATH_SEP . 'rest' . PATH_SEP); - - require_once PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php'; - - spl_autoload_register(array("Bootstrap", "autoloadClass")); - - \Bootstrap::registerClass("G", PATH_GULLIVER . "class.g.php"); - \Bootstrap::registerClass("System", PATH_HOME . "engine/classes/class.system.php"); - - // define autoloading for others - \Bootstrap::registerClass("wsBase", PATH_HOME . "engine/classes/class.wsBase.php"); - \Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . "class.xmlDocument.php"); - \Bootstrap::registerClass('XmlForm_Field_TextPM', PATH_HOME . "engine/classes/class.XmlForm_Field_TextPM.php"); - \Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php"); - \Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php"); - - //\Bootstrap::registerDir('model', PATH_CORE . 'classes' . PATH_SEP . 'model'); - //\Bootstrap::registerDir('rbac/model', PATH_RBAC_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model'); - - //\Bootstrap::LoadThirdParty("smarty/libs", "Smarty.class"); - - \Bootstrap::registerSystemClasses(); - - - $config = \System::getSystemConfiguration(); - - define('DEBUG_SQL_LOG', $config['debug_sql']); - define('DEBUG_TIME_LOG', $config['debug_time']); - define('DEBUG_CALENDAR_LOG', $config['debug_calendar']); - define('MEMCACHED_ENABLED', $config['memcached']); - define('MEMCACHED_SERVER', $config['memcached_server']); - define('TIME_ZONE', $config['time_zone']); - - - // set include path - set_include_path( - PATH_CORE . PATH_SEPARATOR . - PATH_THIRDPARTY . PATH_SEPARATOR . - PATH_THIRDPARTY . 'pear' . PATH_SEPARATOR . - PATH_RBAC_CORE . PATH_SEPARATOR . - get_include_path() - ); - - - /* - * Setting Up Workspace - */ - - // include the server installed configuration - require_once FILE_PATHS_INSTALLED; - - define('SYS_SYS', $workspace); - - // defining system constant when a valid server environment exists - define( 'PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP ); - define( 'PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP ); - define( 'PATH_TEMPORAL', PATH_C . 'dynEditor/' ); - define( 'PATH_DB', PATH_DATA . 'sites' . PATH_SEP ); - - $workspaceDir = PATH_DB . $workspace; - - // smarty constants - define( 'PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c' ); - define( 'PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache' ); - - - //***************** PM Paths DATA ************************** - define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); - define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); - define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); - define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); - define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/'); - define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/'); - define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP); - define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP); - - if (is_file(PATH_DATA_SITE.PATH_SEP . '.server_info')) { - $SERVER_INFO = file_get_contents(PATH_DATA_SITE.PATH_SEP.'.server_info'); - $SERVER_INFO = unserialize($SERVER_INFO); - - define('SERVER_NAME', $SERVER_INFO ['SERVER_NAME']); - define('SERVER_PORT', $SERVER_INFO ['SERVER_PORT']); - } else { - echo "WARNING! No server info found!"; - } - - // create memcached singleton - \Bootstrap::LoadClass('memcached'); - //$memcache = PMmemcached::getSingleton( SYS_SYS ); - - \Propel::init(PATH_CONFIG . "databases.php"); - } -} \ No newline at end of file