From 1c27d1fd4d91b4dd01b7149245bbf42b269f761b Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Fri, 26 Apr 2013 11:45:03 -0400 Subject: [PATCH] DOCSYSTEM Generar la variable SYSTEM_NAME Generar la variable SYSTEM_NAME --- workflow/engine/classes/class.Installer.php | 3 ++ workflow/engine/controllers/installer.php | 34 +++++++++++++++++++-- workflow/engine/controllers/main.php | 7 +++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.Installer.php b/workflow/engine/classes/class.Installer.php index 7ef35ae18..e3a27c160 100755 --- a/workflow/engine/classes/class.Installer.php +++ b/workflow/engine/classes/class.Installer.php @@ -198,6 +198,9 @@ class Installer $db_text = "options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $wf : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $rb : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $rp : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "?>"; if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { $dbText .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; + if (!defined('SYSTEM_NAME')) { + $dbText .= " define ('SYSTEM_NAME', " . SYSTEM_NAME . ");\n"; + } } $fp = @fopen($db_file, "w"); $this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false); diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index bbaa158b6..cfbd82952 100644 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -688,7 +688,12 @@ class Installer extends Controller $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $rpPass ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { - $dbText .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; + $dbText .= "\n"; + $dbText .= " define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; + $systemName = $this->getNameSystem($pathShared); + if ($systemName != '') { + $dbText .= " define ('SYSTEM_NAME', " . $systemName . ");\n"; + } } $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); @@ -974,7 +979,12 @@ class Installer extends Controller $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $rpPass ); if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) { - $dbText .= "define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; + $dbText .= "\n"; + $dbText .= " define ('PARTNER_FLAG', " . ((defined('PARTNER_FLAG')) ? PARTNER_FLAG : ((isset($_REQUEST['PARTNER_FLAG'])) ? $_REQUEST['PARTNER_FLAG']:'false')) . ");\n"; + $systemName = $this->getNameSystem($pathShared); + if ($systemName != '') { + $dbText .= " define ('SYSTEM_NAME', " . $systemName . ");\n"; + } } $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); @@ -1067,6 +1077,26 @@ class Installer extends Controller return $info; } + public function getNameSystem ($pathShared = '') + { + $systemName = ''; + if ($pathShared == '') { + $pathShared = trim( $_REQUEST['pathShared'] ); + } + + if (substr( $pathShared, - 1 ) != '/') { + $pathShared .= '/'; + } + + if (file_exists($pathShared . 'partner.info')) { + $dataInfo = parse_ini_file($pathShared . 'partner.info'); + if (isset($dataInfo['vendor'])) { + $systemName = trim($dataInfo['vendor']); + } + } + return $systemName; + } + public function getEngines () { $this->setResponseType( 'json' ); diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index 085c66140..dd6d33731 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -733,8 +733,11 @@ class Main extends Controller $properties = array (); $ee = class_exists( 'pmLicenseManager' ) ? " - Enterprise Edition" : ''; - $properties[] = array ('ProcessMaker Ver.',System::getVersion() . $ee,$pmSection - ); + $systemName = 'ProcessMaker'; + if (!defined('SYSTEM_NAME')) { + $systemName = SYSTEM_NAME; + } + $properties[] = array ($systemName. ' Ver.', System::getVersion() . $ee, $pmSection); if (file_exists(PATH_DATA. 'log/upgrades.log')) { $properties[] = array (G::LoadTranslation('ID_UPGRADES_PATCHES'), '' . G::LoadTranslation( 'ID_UPGRADE_VIEW_LOG') . '' ,$pmSection);