/**
  * Retrieve multiple objects by pkey.
  *
  * @param array $pks List of primary keys
  * @param Connection $con the connection to use
  * @throws PropelException Any exceptions caught during processing will be
  * rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(LicenseManagerPeer::LICENSE_UID, $pks, Criteria::IN);
         $objs = LicenseManagerPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Example #2
0
    public function verifyLicenseEnterprise ($workspace)

    {

        $this->initPropel( true );



        require_once ("classes/model/LicenseManager.php");

        $oCriteria = new Criteria('workflow');

        $oCriteria->add(LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE');

        $oDataset = LicenseManagerPeer::doSelectRS($oCriteria);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $row = array();

        if ($oDataset->next()) {

            $row = $oDataset->getRow();



            $tr = LicenseManagerPeer::retrieveByPK ( $row['LICENSE_UID'] );

            $pos = strpos( $row['LICENSE_PATH'], 'license_' );

            $license = substr( $row['LICENSE_PATH'], $pos, strlen($row['LICENSE_PATH']));

            $tr->setLicensePath   ( PATH_DATA . "sites/" . $workspace . "/licenses/" . $license);

            $tr->setLicenseWorkspace ( $workspace );



            $res = $tr->save ();

        }

    }
function buildData()
{
    require_once "classes/model/Users.php";
    G::LoadClass("serverConfiguration");
    G::LoadClass("system");
    $oServerConf =& serverConf::getSingleton();
    $os = '';
    if (file_exists('/etc/redhat-release')) {
        $fnewsize = filesize('/etc/redhat-release');
        $fp = fopen('/etc/redhat-release', 'r');
        $os = trim(fread($fp, $fnewsize));
        fclose($fp);
    }
    $os .= " (" . PHP_OS . ")";
    $params = array();
    $params['ip'] = getenv('SERVER_ADDR');
    $oServerConf->setHeartbeatProperty('HB_BEAT_INDEX', intval($oServerConf->getHeartbeatProperty('HB_BEAT_INDEX', 'HEART_BEAT_CONF')) + 1, 'HEART_BEAT_CONF');
    $params['index'] = $oServerConf->getHeartbeatProperty('HB_BEAT_INDEX', 'HEART_BEAT_CONF');
    //$this->index;
    $params['beatType'] = is_null($oServerConf->getHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF')) ? "starting" : $oServerConf->getHeartbeatProperty('HB_BEAT_TYPE', 'HEART_BEAT_CONF');
    //1;//$this->beatType;
    $params['date'] = date('Y-m-d H:i:s');
    $params['host'] = getenv('SERVER_NAME');
    $params['os'] = $os;
    $params['webserver'] = getenv('SERVER_SOFTWARE');
    $params['php'] = phpversion();
    $params['pmVersion'] = System::getVersion();
    if (class_exists('pmLicenseManager')) {
        $params['pmProduct'] = 'PMEE';
    } else {
        $params['pmProduct'] = 'PMCE';
    }
    $params['logins'] = $oServerConf->logins;
    $params['workspaces'] = serialize($oServerConf->getWSList());
    $params['plugins'] = serialize($oServerConf->getPluginsList());
    $params['dbVersion'] = $oServerConf->getDBVersion();
    //$params ['errors'] = serialize( $oServerConf->errors );
    if ($licInfo = $oServerConf->getProperty('LICENSE_INFO')) {
        $params['license'] = serialize($licInfo);
    }
    ///////
    $criteria = new Criteria("workflow");
    $criteria->addSelectColumn("COUNT(USERS.USR_UID) AS USERS_NUMBER");
    $criteria->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL);
    $rs = UsersPeer::doSelectRS($criteria);
    $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $rs->next();
    $row = $rs->getRow();
    $params["users"] = $row["USERS_NUMBER"];
    ///////
    $ee = null;
    if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION")) {
        $ee = trim(file_get_contents(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION"));
    } else {
        $pluginRegistry =& PMPluginRegistry::getSingleton();
        $details = $pluginRegistry->getPluginDetails("enterprise.php");
        $ee = !($details == null) ? $details->iVersion : null;
    }
    $params["ee"] = $ee;
    ///////
    $addonNumber = 0;
    $addonEnabledNumber = 0;
    $pluginRegistry =& PMPluginRegistry::getSingleton();
    $arrayAddon = array();
    if (file_exists(PATH_DATA_SITE . "ee")) {
        $arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
        $arrayAddon["enterprise"] = array("sFilename" => "enterprise-1.tar");
    }
    foreach ($arrayAddon as $addon) {
        $sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
        if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
            $addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
            $enabled = 0;
            if ($addonDetails) {
                $enabled = $addonDetails->enabled ? 1 : 0;
            }
            if ($enabled == 1) {
                $addonEnabledNumber = $addonEnabledNumber + 1;
            }
            $addonNumber = $addonNumber + 1;
        }
    }
    $params["addonNumber"] = $addonNumber;
    $params["addonEnabledNumber"] = $addonEnabledNumber;
    ///////
    $licenseID = null;
    $licenseType = null;
    $licenseDomainWorkspace = null;
    $licenseNumber = 0;
    if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php")) {
        $licenseManager =& pmLicenseManager::getSingleton();
        preg_match("/^license_(.*).dat\$/", $licenseManager->file, $matches);
        $licenseID = $matches[1];
        $licenseType = $licenseManager->type;
        $licenseDomainWorkspace = $licenseManager->info["DOMAIN_WORKSPACE"];
        ///////
        $criteria = new Criteria("workflow");
        $criteria->addSelectColumn("COUNT(LICENSE_MANAGER.LICENSE_UID) AS LICENSE_NUMBER");
        $criteria->add(LicenseManagerPeer::LICENSE_UID, null, Criteria::ISNOTNULL);
        $rs = LicenseManagerPeer::doSelectRS($criteria);
        $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $rs->next();
        $row = $rs->getRow();
        ///////
        $licenseNumber = $row["LICENSE_NUMBER"] > 0 ? $row["LICENSE_NUMBER"] : count(glob(PATH_DATA_SITE . "licenses" . PATH_SEP . "*.dat"));
    }
    $params["licenseID"] = $licenseID;
    $params["licenseType"] = $licenseType;
    $params["licenseDomainWorkspace"] = $licenseDomainWorkspace;
    $params["licenseNumber"] = $licenseNumber;
    ///////
    return $params;
}
 public function getResultQry($sNameTable, $sfield, $sCondition)
 {
     try {
         require_once "classes/model/LicenseManager.php";
         $oCriteria = new Criteria('workflow');
         $oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_USER);
         $oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_START);
         $oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_PATH);
         $oCriteria->addSelectColumn(LicenseManagerPeer::LICENSE_DATA);
         $oCriteria->add(LicenseManagerPeer::LICENSE_STATUS, 'ACTIVE');
         $oDataset = LicenseManagerPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aRow = $oDataset->getRow();
     } catch (Exception $e) {
         G::pr($e);
         $aRow = array();
     }
     return $aRow;
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST). This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param array $arr An array to populate the object from.
  * @param string $keyType The type of keys the array uses.
  * @return void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = LicenseManagerPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setLicenseUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setLicenseUser($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setLicenseStart($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setLicenseEnd($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setLicenseSpan($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setLicenseStatus($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setLicenseData($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setLicensePath($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setLicenseWorkspace($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setLicenseType($arr[$keys[9]]);
     }
 }