Exemplo n.º 1
0
 /**
  * Get string representation
  *
  * @return string
  **/
 public function __toString()
 {
     if ($this->getMajor() > 0 || $this->getMinor() > 0 || $this->getPatch() > 0) {
         return parent::__toString();
     }
     return $this->getGreek() . '.' . $this->getReleaseNumber();
 }
Exemplo n.º 2
0
 /**
  * Copies Properties, Permissions, Tags and content from another Cblock into a new version of this Cblock
  *
  * @param object $sourceObject Source Cblock object
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 public function copyFrom(&$sourceObject)
 {
     $sourceID = $sourceObject->getID();
     $sourceVersion = $sourceObject->getVersion();
     $sourceInfo = $sourceObject->get();
     $targetID = (int) $this->_id;
     $targetVersion = $this->getVersion();
     parent::copyFrom($sourceObject);
     if ($sourceInfo["FOLDER"] == 0) {
         $sql = "DELETE FROM yg_contentblocks_lnk_entrymasks WHERE CBID = ? AND CBVERSION = ?;";
         sYDB()->Execute($sql, $targetID, $targetVersion);
         $sql = "SELECT * FROM yg_contentblocks_lnk_entrymasks WHERE CBID = ? AND CBVERSION = ?;";
         $dbr = sYDB()->Execute($sql, $sourceID, $sourceVersion);
         $links = $dbr->GetArray();
         for ($l = 0; $l < count($links); $l++) {
             $sql = "INSERT INTO yg_contentblocks_lnk_entrymasks (ENTRYMASK, CBID, CBVERSION, ORDERPROD) VALUES (?, ?, ?, ?)";
             sYDB()->Execute($sql, $links[$l]["ENTRYMASK"], $targetID, $targetVersion, $links[$l]["ORDERPROD"]);
             $linkId = (int) sYDB()->Insert_ID();
             $sql = "INSERT INTO `yg_contentblocks_lnk_entrymasks_c`\n\t\t\t\t\t\t\t(FORMFIELD, ENTRYMASKFORMFIELD, LNK, VALUE01, VALUE02, VALUE03, VALUE04, VALUE05, VALUE06, VALUE07, VALUE08)\n\t\t\t\t\t\tSELECT FORMFIELD, ENTRYMASKFORMFIELD, {$linkId}, VALUE01, VALUE02, VALUE03, VALUE04, VALUE05, VALUE06, VALUE07, VALUE08\n\t\t\t\t\t\tFROM yg_contentblocks_lnk_entrymasks_c WHERE (LNK = ?);";
             sYDB()->Execute($sql, $links[$l]["ID"]);
         }
     }
     $this->copyExtensionsFrom($sourceObject);
     $this->markAsChanged();
 }
Exemplo n.º 3
0
 /**
  * Approves the specified version of this Mailing and all embedded Cblocks and creates a new working version
  *
  * @param int $version (optional) Mailing version
  * @return int|false New version or FALSE in case of an error
  */
 public function approveVersion($version = 0)
 {
     $result = parent::approveVersion($version);
     // Check if there are blind entrymasks in this mailing (and add a version)
     $colist = $this->getCblockList();
     foreach ($colist as $colist_item) {
         if ($colist_item['EMBEDDED'] == 1) {
             $tmpCb = sCblockMgr()->getCblock($colist_item['OBJECTID'], $colist_item['VERSION']);
             $tmpCb->approveVersion();
         }
     }
     if ((int) $version == 0) {
         $version = (int) $this->getVersion();
     }
     $this->history->add(HISTORYTYPE_MAILING, NULL, $version, 'TXT_MAILING_H_APPROVE');
     if ($this->getPublishedVersion() == ALWAYS_LATEST_APPROVED_VERSION) {
         $this->history->add(HISTORYTYPE_MAILING, NULL, $version, 'TXT_MAILING_H_AUTOPUBLISH');
         sMailingMgr()->callExtensionHook("onPublish", $this->_id, $version);
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/MAILING_PUBLISH") == "true") {
             Singleton::FC()->emptyBucket();
         }
     }
     sMailingMgr()->callExtensionHook('onApprove', (int) $this->_id, (int) $this->_version);
     return result;
 }
Exemplo n.º 4
0
 /**
  * Copies Properties, Extensions, Permissions, Views, Tags from another File into this File
  *
  * @param object $sourceObject Source File object
  * @return bool TRUE on success or FALSE in case of an error
  * @throws Exception
  */
 public function copyFrom(&$sourceObject)
 {
     $sourceID = $sourceObject->getID();
     $sourceVersion = $sourceObject->getVersion();
     $sourceInfo = $sourceObject->get();
     $targetID = (int) $this->_id;
     $targetVersion = $this->getVersion();
     $targetInfo = $this->get();
     $targetThumbVersion = (int) $targetInfo['VIEWVERSION'] + 1;
     $filedir = sConfig()->getVar('CONFIG/DIRECTORIES/FILESDIR') . "/";
     parent::copyFrom($sourceObject);
     $this->setFileType($sourceInfo['FILETYPE']);
     $this->setFilename($sourceInfo['FILENAME']);
     $this->setFilesize($sourceInfo['FILESIZE']);
     if ($sourceInfo["FOLDER"] == 0) {
         $fprefix = $sourceObject->getID() . "-" . $sourceInfo["VIEWVERSION"];
         $filename = $sourceInfo["FILENAME"];
         $tmpfile = $filedir . $fprefix . $filename;
         copy($tmpfile, $filedir . $targetID . "-" . $targetThumbVersion . $sourceInfo["FILENAME"]);
         $tmpfile = tempnam();
         copy($filedir . $fprefix . $filename, $tmpfile);
         $this->updateFile($filename, $sourceInfo["FILETYPE"], $tmpfile, false);
         unlink($tmpfile);
     }
     $this->setViewVersion($targetThumbVersion);
     $this->views->copyTo($sourceID, $sourceVersion, $targetID, $this->getLatestApprovedVersion());
     $this->views->copyGeneratedViewInfo($sourceVersion, $targetVersion, $sourceID);
     $this->views->scheduleUpdate();
     $this->copyExtensionsFrom($sourceObject);
 }