Ejemplo n.º 1
0
 /**
  * Get the already stored license data.
  * @param string $uid
  * @return \stdClass
  */
 public function getLicenseData($uid)
 {
     $result = new stdClass();
     $result->success = false;
     $key = blowfishGetKey('ProcessMaker');
     //TODO DELETE THIS LINE
     //$result->success = true;
     //return $result;
     //Verify if activationCode exist in DB
     $rs = $this->amBean->retrieve_by_string_fields(array("acm_uid" => $uid));
     if (empty($rs)) {
         $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_IDFIELDMISSING', $this->moduleName);
         return $result;
     }
     try {
         $license = json_decode($this->crypt->openLicense($key, $rs->acm_data));
     } catch (Exception $e) {
         $result->message = $e->getMessage();
         return $result;
     }
     if (empty($license)) {
         $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_NOTVALID', $this->moduleName);
         return $result;
     } else {
         if (!isset($license->lic_max_admins)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_ADMINISTRATORMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_max_admins = $license->lic_max_admins;
         }
         if (!isset($license->lic_max_users)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_USERSMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_max_users = $license->lic_max_users;
         }
         if (!isset($license->lic_max_cases)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_CASESMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_max_cases = $license->lic_max_cases;
         }
         if (!isset($license->lic_product_expiration_date)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_PRODUCTDATEMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_product_expiration_date = $license->lic_product_expiration_date;
         }
         if (!isset($license->lic_support_expiration_date)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_SUPPORTDATEMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_support_expiration_date = $license->lic_support_expiration_date;
         }
         if (!isset($license->lic_enabled_br)) {
             $result->message = translate('LBL_PMSE_ADAM_LICENSEMANAGER_MESSAGE_BUSSINESRULESMISSING', $this->moduleName);
             return $result;
         } else {
             $result->lic_enabled_br = (bool) $license->lic_enabled_br;
         }
         $result->success = true;
     }
     return $result;
 }