Merged in marcoAntonioNina/processmaker/PM-520 (pull request #871)
PM-520 Cambios en el Enterprise Plugins Manager
This commit is contained in:
@@ -225,6 +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("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");
|
||||
|
||||
89
workflow/engine/classes/class.licensedFeatures.php
Normal file
89
workflow/engine/classes/class.licensedFeatures.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
class featuresDetail
|
||||
{
|
||||
public $featureName;
|
||||
public $description = null;
|
||||
public $enabled = false;
|
||||
public $workspaces = null;
|
||||
|
||||
/**
|
||||
* This function is the constructor of the featuresDetail class
|
||||
*
|
||||
* @param string $featureName
|
||||
* @param string $name
|
||||
* @param string $description
|
||||
* @return void
|
||||
*/
|
||||
public function __construct ($featureName, $description = '')
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ class pmLicenseManager
|
||||
);
|
||||
|
||||
$this->result = $results['RESULT'];
|
||||
$this->features = array();
|
||||
$this->licensedfeatures = array();
|
||||
$this->licensedfeaturesList = array();
|
||||
if (in_array($this->result, $validStatus)) {
|
||||
$this->serial="3ptta7Xko2prrptrZnSd356aqmPXvMrayNPFj6CLdaR1pWtrW6qPw9jV0OHjxrDGu8LVxtmSm9nP5kR23HRpdZWccpeui+bKkK<6B>DoqCt2Kqgpq6Vg37s";
|
||||
$info['FIRST_NAME'] = $results['DATA']['FIRST_NAME'];
|
||||
@@ -64,7 +67,9 @@ class pmLicenseManager
|
||||
$this->plan = isset($results ['DATA']['PLAN'])?$results ['DATA']['PLAN']:"";
|
||||
$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->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : array();
|
||||
$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'] )) {
|
||||
@@ -352,7 +357,9 @@ class pmLicenseManager
|
||||
public function installLicense($path, $redirect = true)
|
||||
{
|
||||
$application = new license_application ( $path, false, true, false, true, true );
|
||||
|
||||
$results = $application->validate ( false, false, "", "", "80", true );
|
||||
|
||||
//if the result is ok then it is saved into DB
|
||||
$res = $results ['RESULT'];
|
||||
if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) {
|
||||
@@ -496,6 +503,9 @@ class pmLicenseManager
|
||||
|
||||
public function getActiveFeatures()
|
||||
{
|
||||
if (file_exists ( PATH_PLUGINS . 'enterprise/data/default' )) {
|
||||
return array();
|
||||
}
|
||||
return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1506,6 +1506,13 @@ class workspaceTools
|
||||
$versionOld = ( isset($version[0])) ? $version[0] : '';
|
||||
CLI::logging(CLI::info("$versionOld < $versionPresent") . "\n");
|
||||
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Verify enterprise old...\n");
|
||||
$this->verifyEnterprise($workSpace);
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Verify took $final seconds.\n");
|
||||
|
||||
if ( $versionOld < $versionPresent || strpos($versionPresent, "Branch")) {
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Updating database...\n");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,11 +44,12 @@ class Main extends Controller
|
||||
|
||||
// license notification
|
||||
$expireInLabel = '';
|
||||
if (class_exists( 'pmLicenseManager' )) {
|
||||
$pmLicenseManager = &pmLicenseManager::getSingleton();
|
||||
$expireIn = $pmLicenseManager->getExpireIn();
|
||||
$expireInLabel = $pmLicenseManager->getExpireInLabel();
|
||||
}
|
||||
|
||||
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
||||
$pmLicenseManager = &pmLicenseManager::getSingleton();
|
||||
$expireIn = $pmLicenseManager->getExpireIn();
|
||||
$expireInLabel = $pmLicenseManager->getExpireInLabel();
|
||||
|
||||
$this->setVar( 'licenseNotification', $expireInLabel );
|
||||
|
||||
// setting variables on javascript env.
|
||||
|
||||
@@ -347,7 +347,9 @@ try {
|
||||
exit(0);
|
||||
break;
|
||||
case "addonslist":
|
||||
$result = AddonsStore::addonList();
|
||||
$type = (isset($_REQUEST['type'])) ? $_REQUEST['type']: 'plugin';
|
||||
$result = AddonsStore::addonList($type);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw (new Exception("Action \"$action\" is not valid"));
|
||||
|
||||
@@ -21,8 +21,8 @@ class enterprisePlugin extends PMPlugin
|
||||
$VERSION = System::getVersion();
|
||||
|
||||
$res = parent::PMPlugin($sNamespace, $sFilename);
|
||||
$this->sFriendlyName = "ProcessMaker Enterprise Edition";
|
||||
$this->sDescription = "ProcessMaker Enterprise Edition $VERSION";
|
||||
$this->sFriendlyName = "ProcessMaker Enterprise Core Edition";
|
||||
$this->sDescription = "ProcessMaker Enterprise Core Edition $VERSION";
|
||||
$this->sPluginFolder = "enterprise";
|
||||
$this->sSetupPage = "../enterprise/addonsStore.php";
|
||||
$this->iVersion = $VERSION;
|
||||
|
||||
@@ -755,16 +755,16 @@ class SkinEngine
|
||||
$name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME']: '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'] , ENT_QUOTES, 'UTF-8'): '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '');
|
||||
$smarty->assign('user',$name);
|
||||
}
|
||||
if(class_exists('pmLicenseManager')){
|
||||
$pmLicenseManagerO = &pmLicenseManager::getSingleton();
|
||||
$expireIn = $pmLicenseManagerO->getExpireIn();
|
||||
$expireInLabel = $pmLicenseManagerO->getExpireInLabel();
|
||||
//if($expireIn<=30){
|
||||
if($expireInLabel != ""){
|
||||
$smarty->assign('msgVer', '<label class="textBlack">'.$expireInLabel.'</label> ');
|
||||
|
||||
if (defined('SYS_SYS')) {
|
||||
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
||||
$pmLicenseManagerO = &pmLicenseManager::getSingleton();
|
||||
$expireIn = $pmLicenseManagerO->getExpireIn();
|
||||
$expireInLabel = $pmLicenseManagerO->getExpireInLabel();
|
||||
if($expireInLabel != ""){
|
||||
$smarty->assign('msgVer', '<label class="textBlack">'.$expireInLabel.'</label> ');
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
if (defined('SYS_SYS')) {
|
||||
$logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user