diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index eee10fac8..1466842fa 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -225,8 +225,8 @@ class Bootstrap self::registerClass("cronFile", PATH_CLASSES . "class.plugin.php"); self::registerClass("pluginDetail", PATH_CLASSES . "class.pluginRegistry.php"); self::registerClass("PMPluginRegistry", PATH_CLASSES . "class.pluginRegistry.php"); - self::registerClass("fixtureDetail", PATH_CLASSES . "class.fixtureRegistry.php"); - self::registerClass("PMFixtureRegistry", PATH_CLASSES . "class.fixtureRegistry.php"); + self::registerClass("featuresDetail", PATH_CLASSES . "class.licensedFeatures.php"); + self::registerClass("PMLicensedFeatures", PATH_CLASSES . "class.licensedFeatures.php"); self::registerClass("PMDashlet", PATH_CLASSES . "class.pmDashlet.php"); self::registerClass("pmGauge", PATH_CLASSES . "class.pmGauge.php"); self::registerClass("pmPhing", PATH_CLASSES . "class.pmPhing.php"); diff --git a/workflow/engine/classes/class.licensedFeatures.php b/workflow/engine/classes/class.licensedFeatures.php new file mode 100644 index 000000000..50ccb71e6 --- /dev/null +++ b/workflow/engine/classes/class.licensedFeatures.php @@ -0,0 +1,89 @@ +featureName = $featureName; + $this->description = $description; + } +} + + +class PMLicensedFeatures +{ + private $featuresDetails = array (); + private $features = array (); + + private static $instancefeature = null; + + /** + * This function is the constructor of the PMLicensedFeatures class + * param + * + * @return void + */ + public function __construct () + { + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_ID); + $criteria->add(AddonsManagerPeer::ADDON_TYPE, 'feature', Criteria::EQUAL); + $addons = AddonsManagerPeer::doSelect($criteria); + foreach ($addons as $addon) { + $this->features[] = $addon->getAddonId(); + $detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription()); + $this->featuresDetails[$addon->getAddonId()] = $detail; + } + } + + /** + * This function is instancing to this class + * param + * + * @return object + */ + public static function getSingleton () + { + if (self::$instancefeature == null) { + self::$instancefeature = new PMLicensedFeatures(); + } + return self::$instancefeature; + } + + public function verifyfeature ($featureName) + { + $licenseManager = &pmLicenseManager::getSingleton(); + $_SESSION['__sw__'] = true; + $padl = new padl(); + + $enable = in_array($padl->_decrypt($featureName), $licenseManager->features); + + $this->featuresDetails[$padl->_decrypt($featureName)]->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.pmLicenseManager.php b/workflow/engine/classes/class.pmLicenseManager.php index 6698693c0..ace704336 100644 --- a/workflow/engine/classes/class.pmLicenseManager.php +++ b/workflow/engine/classes/class.pmLicenseManager.php @@ -54,7 +54,8 @@ class pmLicenseManager $this->result = $results['RESULT']; $this->features = array(); - $this->fixtures = array(); + $this->licensedfeatures = array(); + $this->licensedfeaturesList = array(); if (in_array($this->result, $validStatus)) { $this->serial="3ptta7Xko2prrptrZnSd356aqmPXvMrayNPFj6CLdaR1pWtrW6qPw9jV0OHjxrDGu8LVxtmSm9nP5kR23HRpdZWccpeui+bKkK°DoqCt2Kqgpq6Vg37s"; $info['FIRST_NAME'] = $results['DATA']['FIRST_NAME']; @@ -67,8 +68,8 @@ class pmLicenseManager $this->id = $results ['ID']; $this->expireIn = $this->getExpireIn (); $this->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : array(); - $this->fixtures = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_FIXTURE'])? $results ['DATA']['CUSTOMER_FIXTURE'] : $this->getActiveFixtures() : array(); - $this->fixturesList = isset($results ['DATA']['FIXTURE_LIST'])? $results ['DATA']['FIXTURE_LIST'] : null; + $this->licensedfeatures = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : array() : array(); + $this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST'])? $results ['DATA']['LICENSED_FEATURES_LIST'] : null; $this->status = $this->getCurrentLicenseStatus (); if (isset ( $results ['LIC'] )) { @@ -507,13 +508,5 @@ class pmLicenseManager } return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default'))); } - - public function getActiveFixtures() - { - if (!file_exists ( PATH_PLUGINS . 'enterprise/data/default' )) { - return array(); - } - return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default'))); - } } diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php index 7ea500796..132b26a9b 100644 --- a/workflow/engine/classes/model/AddonsStore.php +++ b/workflow/engine/classes/model/AddonsStore.php @@ -125,7 +125,7 @@ class AddonsStore extends BaseAddonsStore } else { $status = "available"; $enabled = false; - if (!$addonInLicense && in_array($addon->getAddonName(), $licenseManager->fixtures) == 1) { + if (!$addonInLicense && in_array($addon->getAddonName(), $licenseManager->licensedfeatures) == 1) { $status = "installed"; $enabled = true; } @@ -172,7 +172,7 @@ class AddonsStore extends BaseAddonsStore return $result; } - public static function addonFixtureList() + public static function addonFeatureList() { $result = array(); @@ -425,17 +425,17 @@ class AddonsStore extends BaseAddonsStore } } } else { - $list = unserialize($pmLicenseManagerO->fixturesList); - foreach ($list['addons'] as $key => $fixture) { + $list = unserialize($pmLicenseManagerO->licensedfeaturesList); + foreach ($list['addons'] as $key => $feature) { $addon = new AddonsManager(); - $addon->setAddonId($fixture['name']); - $addon->setStoreId($fixture['guid']); - $addon->setAddonName($fixture['name']); - $addon->setAddonDescription($fixture['description']); - $addon->setAddonNick($fixture['nick']); + $addon->setAddonId($feature['name']); + $addon->setStoreId($feature['guid']); + $addon->setAddonName($feature['name']); + $addon->setAddonDescription($feature['description']); + $addon->setAddonNick($feature['nick']); $addon->setAddonVersion(""); - $addon->setAddonStatus($fixture['status']); - $addon->setAddonType("fixture"); + $addon->setAddonStatus($feature['status']); + $addon->setAddonType("features"); $addon->setAddonPublisher("Colosa"); $addon->setAddonDownloadUrl(""); $addon->setAddonDownloadMd5(""); diff --git a/workflow/engine/templates/enterprise/addonsStore.js b/workflow/engine/templates/enterprise/addonsStore.js index 3cda2c5d9..f1c2906ff 100644 --- a/workflow/engine/templates/enterprise/addonsStore.js +++ b/workflow/engine/templates/enterprise/addonsStore.js @@ -499,7 +499,7 @@ Ext.onReady(function() { "force": true } }); - addonsFixtureStore.load({ + addonsFeaturesStore.load({ params: { "force": true } @@ -615,18 +615,18 @@ Ext.onReady(function() { }); - var addonsFixtureStore = new Ext.data.JsonStore({ + var addonsFeaturesStore = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: "addonsStoreAction", method: "POST" }), baseParams: { "action": "addonsList", - "type" : "fixture" + "type" : "features" }, autoDestroy: true, messageProperty: 'error', - storeId: 'addonsFixtureStore', + storeId: 'addonsFeaturesStore', root: 'addons', idProperty: 'id', sortInfo: { @@ -638,14 +638,14 @@ Ext.onReady(function() { 'log', 'progress'], listeners: { 'beforeload': function(store, options) { - Ext.ComponentMgr.get('loading-fixture-indicator').setValue(''); + Ext.ComponentMgr.get('loading-features-indicator').setValue(''); return true; }, "exception": function(e, type, action, options, response, arg) { - Ext.ComponentMgr.get('loading-fixture-indicator').setValue(' '); + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); }, "load": function(store, records, options) { - Ext.ComponentMgr.get('loading-fixture-indicator').setValue(""); + Ext.ComponentMgr.get('loading-features-indicator').setValue(""); progressWindow.hide(); store.filterBy(function (record, id) { if (record.get('type') == 'core') { @@ -659,8 +659,8 @@ Ext.onReady(function() { return true; }); - if (addonsFixtureGrid.disabled) { - addonsFixtureGrid.enable(); + if (addonsFeatureGrid.disabled) { + addonsFeatureGrid.enable(); } errors = store.reader.jsonData.errors; @@ -677,11 +677,11 @@ Ext.onReady(function() { } if (store_errors.length > 0) { - Ext.ComponentMgr.get('loading-fixture-indicator').setValue(' '); + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); //storeError(error_msg); reloadTask.cancel(); } else { - Ext.ComponentMgr.get('loading-fixture-indicator').setValue(' '); + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); } } } @@ -1512,15 +1512,15 @@ Ext.onReady(function() { } }); - // create the Grid Fixtures - var addonsFixtureGrid = new Ext.grid.GridPanel({ - store: addonsFixtureStore, + // create the Grid Features + var addonsFeatureGrid = new Ext.grid.GridPanel({ + store: addonsFeaturesStore, colspan: 2, flex: 1, padding: 5, columns: [ { - id : 'icon-column-fixture', + id : 'icon-column-feature', header : '', width : 30, hideable : false, @@ -1530,7 +1530,7 @@ Ext.onReady(function() { } }, { - id :'nick-column-fixture', + id :'nick-column-feature', header : _('ID_NAME'), width : 300, sortable : true, @@ -1546,13 +1546,13 @@ Ext.onReady(function() { } }, { - id :'description-column-fixture', + id :'description-column-feature', header : _('ID_DESCRIPTION'), width : 400, dataIndex: 'description' }, { - id : 'enabled-column-fixture', + id : 'enabled-column-feature', header : _('ID_ENABLED'), width : 60, dataIndex: 'enabled', @@ -1566,7 +1566,7 @@ Ext.onReady(function() { } }, { - id : "status-fixture", + id : "status-feature", header : _('ID_STATUS'), width : 120, sortable : false, @@ -1627,7 +1627,7 @@ Ext.onReady(function() { disabled: (INTERNET_CONNECTION == 1)? false : true, handler: function (b, e) { reloadTask.cancel(); - addonsFixtureStore.load({ + addonsFeaturesStore.load({ params: { "force": true } @@ -1637,7 +1637,7 @@ Ext.onReady(function() { '->', { xtype:"displayfield", - id:'loading-fixture-indicator' + id:'loading-features-indicator' } ], listeners: { @@ -1709,7 +1709,7 @@ Ext.onReady(function() { items : addonsGrid },{ title: _('ID_ENTERPRISE_FIXTURES'), - items : addonsFixtureGrid + items : addonsFeatureGrid } ] }); @@ -1745,7 +1745,7 @@ Ext.onReady(function() { addonsGrid.addListener("rowcontextmenu", onMessageMnuContext, this); - addonsFixtureGrid.on("rowcontextmenu", + addonsFeatureGrid.on("rowcontextmenu", function (grid, rowIndex, evt) { var sm = grid.getSelectionModel(); sm.selectRow(rowIndex, sm.isSelected(rowIndex)); @@ -1753,7 +1753,7 @@ Ext.onReady(function() { this ); - addonsFixtureGrid.addListener("rowcontextmenu", onMessageMnuContext, this); + addonsFeatureGrid.addListener("rowcontextmenu", onMessageMnuContext, this); /////// var viewport = new Ext.Viewport({ @@ -1767,7 +1767,7 @@ Ext.onReady(function() { if (licensed) { addonsStore.load(); - addonsFixtureStore.load(); + addonsFeaturesStore.load(); } });