From ea42cf711b6d23fea1346478a0bf1d0e9a7cf0f7 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Fri, 10 Oct 2014 16:17:07 -0400 Subject: [PATCH] Improvement enable features enterprise --- gulliver/system/class.g.php | 3 ++- gulliver/thirdparty/propel/Propel.php | 5 +++++ workflow/engine/bin/tasks/cliAddons.php | 13 +++++++++++- .../engine/classes/class.licensedFeatures.php | 20 +++++++------------ workflow/engine/classes/class.wsBase.php | 3 ++- workflow/engine/classes/class.wsTools.php | 8 +++++++- workflow/engine/menus/setup.php | 7 +++++-- .../templates/enterprise/addonsStore.js | 2 +- 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index c423a3caf..d3ef213a7 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5279,7 +5279,8 @@ class G $sflagAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); $ipClient = G::getIpAddress(); - if ($sflagAudit) { + $licensedFeatures = & PMLicensedFeatures::getSingleton(); + if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; diff --git a/gulliver/thirdparty/propel/Propel.php b/gulliver/thirdparty/propel/Propel.php index dc7c81036..b6a7377c6 100755 --- a/gulliver/thirdparty/propel/Propel.php +++ b/gulliver/thirdparty/propel/Propel.php @@ -614,6 +614,11 @@ class Propel { */ public static function getDbConnection($name) { + $licensedFeatures = & PMLicensedFeatures::getSingleton(); + if (! $licensedFeatures->verifyfeature('02YeEFKNnVoOWFKMzN4ZmpXT0V3MU9SVklnOXNCcE9zcXJKa0tpemNmQkJ5OTUvOWlLdFhibGp0MHVHUlV0VmNpNw==')) { + return null; + } + if (! empty(self::$configuration['datasources'][$name]['connection'])) { return self::getConnection($name); } diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php index eae7ce857..beac69878 100644 --- a/workflow/engine/bin/tasks/cliAddons.php +++ b/workflow/engine/bin/tasks/cliAddons.php @@ -118,7 +118,18 @@ function change_hash($command, $opts) $response = new stdclass(); $response->workspace = $workspace; $response->hash = $hash; - $workspace->changeHashPassword($workspace->name, $response); + if (!defined("SYS_SYS")) { + define("SYS_SYS", $workspace->name); + } + if (!defined("PATH_DATA_SITE")) { + define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); + } + $_SESSION['__sw__'] = ''; + if (!$workspace->changeHashPassword($workspace->name, $response)) { + CLI::logging(pakeColor::colorize("This command cannot be used because your license does not include it.", "ERROR") . "\n"); + $workspace->close(); + die; + } $workspace->close(); CLI::logging(pakeColor::colorize("Changed...", "ERROR") . "\n"); } catch (Exception $e) { diff --git a/workflow/engine/classes/class.licensedFeatures.php b/workflow/engine/classes/class.licensedFeatures.php index 50ccb71e6..9a60e7895 100644 --- a/workflow/engine/classes/class.licensedFeatures.php +++ b/workflow/engine/classes/class.licensedFeatures.php @@ -65,25 +65,19 @@ class PMLicensedFeatures public function verifyfeature ($featureName) { + if (!class_exists("pmLicenseManager")) { + require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php"); + } $licenseManager = &pmLicenseManager::getSingleton(); + $_SESSION['__sw__'] = true; $padl = new padl(); + $value = $padl->_decrypt($featureName); - $enable = in_array($padl->_decrypt($featureName), $licenseManager->features); + $enable = in_array($value[0], $licenseManager->licensedfeatures); - $this->featuresDetails[$padl->_decrypt($featureName)]->enabled = $enable; + $this->featuresDetails[$value[0]]->enabled = $enable; return $enable; } - - public static function loadSingleton($file) - { - self::$instancefeature = unserialize(file_get_contents($file)); - - if (! is_object(self::$instancefeature) || get_class(self::$instancefeature) != "PMLicensedFeatures") { - throw new Exception("Can't load main PMLicensedFeatures object."); - } - - return self::$instancefeature; - } } diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 3e4c65a9a..43965394e 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -920,7 +920,8 @@ class wsBase if (!class_exists('System')) { G::LoadClass('system'); } - $aSetup = !empty($config) ? $config : System::getEmailConfiguration(); + $licensedFeatures = & PMLicensedFeatures::getSingleton(); + $aSetup = (!empty($config) && $licensedFeatures->verifyfeature('nKaNTNuT1MzK0RsMEtXTnYzR09ucHF2WGNuS0hRdDBBak42WXJhNVVOOG1INEVoaU1EaTllbjBBeEJNeG9wRVJ6NmxQelhyVTBvdThzPQ==') ) ? $config : System::getEmailConfiguration(); $oSpool = new spoolRun(); diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 458bd6134..4063f0634 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1668,7 +1668,13 @@ class workspaceTools { $this->initPropel( true ); G::LoadClass("enterprise"); - enterpriseClass::setHashPassword($response); + $licensedFeatures = & PMLicensedFeatures::getSingleton(); + if ($licensedFeatures->verifyfeature('95OY24wcXpEMzIyRmlNSnF0STNFSHJzMG9wYTJKekpLNmY2ZmRCeGtuZk5oUDloaUNhUGVjTDJBPT0=')) { + enterpriseClass::setHashPassword($response); + } else { + return false; + } + return true; } public function verifyEnterprise ($workspace) diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index afde8664f..1b8c48b4e 100755 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -28,6 +28,7 @@ $partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; $oServerConf = & serverConf::getSingleton(); $sAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); +$licensedFeatures = & PMLicensedFeatures::getSingleton(); if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { //settings options @@ -98,7 +99,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) { $G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs'); $G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, "logs"); $G_TMP_MENU->AddIdRawOption('EMAILS', '../mails/emailList', ucfirst (strtolower ( G::LoadTranslation('ID_EMAILS'))), '', '', 'logs'); - if (isset($sAudit) && $sAudit != false) { + if (isset($sAudit) && $sAudit != false && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { $G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (G::LoadTranslation('ID_AUDITLOG_DISPLAY')), '', '', 'logs'); } } @@ -107,7 +108,9 @@ if ($RBAC->userCanAccess("PM_SETUP") == 1) { $G_TMP_MENU->AddIdRawOption("PM_REQUIREMENTS", "../setup/systemInfo", G::LoadTranslation("ID_PROCESSMAKER_REQUIREMENTS_CHECK"), "", "", "settings"); $G_TMP_MENU->AddIdRawOption("PHP_INFO", "../setup/systemInfo?option=php", G::LoadTranslation("ID_PHP_INFO"), "", "", "settings"); //$G_TMP_MENU->AddIdRawOption("PHP_MAINTENANCE", "../admin/maintenance", 'Maintenance', "", "", "settings"); - $G_TMP_MENU->AddIdRawOption("AUDIT_LOG", "auditLogConfig", G::LoadTranslation("ID_AUDITLOG_DISPLAY"), "", "", "settings"); + if ($licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { + $G_TMP_MENU->AddIdRawOption("AUDIT_LOG", "auditLogConfig", G::LoadTranslation("ID_AUDITLOG_DISPLAY"), "", "", "settings"); + } } require_once 'classes/class.pmLicenseManager.php'; diff --git a/workflow/engine/templates/enterprise/addonsStore.js b/workflow/engine/templates/enterprise/addonsStore.js index 2aa05dfc3..7fabaaa8a 100644 --- a/workflow/engine/templates/enterprise/addonsStore.js +++ b/workflow/engine/templates/enterprise/addonsStore.js @@ -1709,7 +1709,7 @@ Ext.onReady(function() { title: _('ID_ENTERPRISE_PLUGINS'), items : addonsGrid },{ - title: _('ID_ENTERPRISE_FIXTURES'), + title: _('ID_ENTERPRISE_FEATURES'), items : addonsFeatureGrid } ]