2014-10-08 14:38:30 -04:00
|
|
|
<?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;
|
|
|
|
|
}
|
2014-11-24 11:06:28 -04:00
|
|
|
/*----------------------------------********---------------------------------*/
|
2014-10-08 14:38:30 -04:00
|
|
|
public function verifyfeature ($featureName)
|
|
|
|
|
{
|
2014-10-10 16:17:07 -04:00
|
|
|
if (!class_exists("pmLicenseManager")) {
|
|
|
|
|
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
|
|
|
|
|
}
|
2014-12-09 10:50:14 -04:00
|
|
|
|
|
|
|
|
$licenseManager = pmLicenseManager::getSingleton(false);
|
2014-10-10 16:17:07 -04:00
|
|
|
|
2014-10-08 14:38:30 -04:00
|
|
|
$_SESSION['__sw__'] = true;
|
|
|
|
|
$padl = new padl();
|
2014-10-10 16:17:07 -04:00
|
|
|
$value = $padl->_decrypt($featureName);
|
2014-10-08 14:38:30 -04:00
|
|
|
|
2015-03-25 18:18:57 -04:00
|
|
|
if (is_array($value)) {
|
2015-04-07 16:21:51 -04:00
|
|
|
$value = $value[0];
|
2015-03-25 18:18:57 -04:00
|
|
|
}
|
|
|
|
|
$trueValue = $value;
|
|
|
|
|
$enable = in_array($trueValue, $licenseManager->licensedfeatures);
|
2014-10-08 14:38:30 -04:00
|
|
|
|
2014-10-13 11:11:01 -04:00
|
|
|
if (!isset($this->featuresDetails[$value[0]]) || !is_object($this->featuresDetails[$value[0]])) {
|
|
|
|
|
$this->featuresDetails[$value[0]] = new stdclass();
|
|
|
|
|
}
|
2014-10-10 16:17:07 -04:00
|
|
|
$this->featuresDetails[$value[0]]->enabled = $enable;
|
2014-10-08 14:38:30 -04:00
|
|
|
return $enable;
|
|
|
|
|
}
|
2014-11-24 11:06:28 -04:00
|
|
|
/*----------------------------------********---------------------------------*/
|
2014-10-08 14:38:30 -04:00
|
|
|
}
|
|
|
|
|
|