/** * @see \wcf\system\moderation\queue\activation\IModerationQueueActivationHandler::enableContent() */ public function enableContent(ModerationQueue $queue) { if ($this->isValid($queue->objectID) && $this->getEntry($queue->objectID)->isDisabled) { $entryAction = new EntryAction(array($this->getEntry($queue->objectID)), 'enable'); $entryAction->executeAction(); } }
/** * @see \wcf\system\cronjob\ICronjob::execute() */ public function execute(Cronjob $cronjob) { parent::execute($cronjob); if (CMS_NEWS_EMPTY_RECYCLE_BIN_CYCLE) { $entryIDs = array(); $sql = "SELECT\tentryID\n\t\t\t\tFROM\tcms" . WCF_N . "_news_entry\n\t\t\t\tWHERE\tisDeleted = ?\n\t\t\t\t\tAND deleteTime < ?"; $statement = WCF::getDB()->prepareStatement($sql, 1000); $statement->execute(array(1, TIME_NOW - CMS_NEWS_EMPTY_RECYCLE_BIN_CYCLE * 86400)); while ($row = $statement->fetchArray()) { $entryIDs[] = $row['entryID']; } if (!empty($entryIDs)) { $action = new EntryAction($entryIDs, 'delete'); $action->executeAction(); } } }
/** * @see wcf\system\cronjob\ICronjob::execute() */ public function execute(Cronjob $cronjob) { parent::execute($cronjob); // get delayed news $entryList = new EntryList(); $entryList->getConditionBuilder()->add('news_entry.isPublished = 0'); $entryList->getConditionBuilder()->add('news_entry.publicationDate <= ?', array(TIME_NOW)); $entryList->readObjects(); if (count($entryList->getObjects())) { // publish news $action = new EntryAction($entryList->getObjects(), 'publish'); $action->executeAction(); } // get outdated news $entryList = new EntryList(); $entryList->getConditionBuilder()->add('news_entry.isArchived = 0'); $entryList->getConditionBuilder()->add('news_entry.time <= ?', array(TIME_NOW - CMS_NEWS_DAYS_TO_ARCHIVE * 86400)); $entryList->readObjects(); if (count($entryList->getObjects())) { // archivate news $action = new EntryAction($entryList->getObjects(), 'archive'); $action->executeAction(); } // get outdated news in archive if (CMS_NEWS_DAYS_TO_DELETE_ARCHIVE) { $entryList = new NewsList(); $entryList->getConditionBuilder()->add('news_entry.isArchived = 1'); $entryList->getConditionBuilder()->add('news_entry.time <= ?', array(TIME_NOW - CMS_NEWS_DAYS_TO_ARCHIVE * 86400 - CMS_NEWS_DAYS_TO_DELETE_ARCHIVE * 86400)); $entryList->readObjects(); if (count($entryList->getObjects())) { // delete news $action = new EntryAction($entryList->getObjects(), 'delete'); $action->executeAction(); } } }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // add breadcrumbs WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news'), LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms')))); if ($this->entry->isArchived) { WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news.archive'), LinkHandler::getInstance()->getLink('NewsArchive', array('application' => 'cms')))); } $categories = array(); $leafCategories = $this->entry->getLeafCategories(); $category = reset($leafCategories); while ($category !== null) { $categories[] = $category; $category = $category->getParentCategory(); } foreach (array_reverse($categories) as $parentCategory) { WCF::getBreadcrumbs()->add($parentCategory->getBreadcrumb()); } // update news view count $this->entry->updateVisits(); // update news visit if ($this->entry->isNew()) { $entryAction = new EntryAction(array($this->entry->getDecoratedObject()), 'markAsRead', array('viewableEntry' => $this->entry)); $entryAction->executeAction(); } // fetch news likes if (MODULE_LIKE) { $objectType = LikeHandler::getInstance()->getObjectType('de.incendium.cms.like.likeableNews'); LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->entryID)); $this->entryLikeData = LikeHandler::getInstance()->getLikeObjects($objectType); } // get news tags if (MODULE_TAGGING) { $this->tags = TagEngine::getInstance()->getObjectTags('de.incendium.cms.news.entry', $this->entry->entryID, array($this->entry->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : "")); } // get news comments if ($this->commentManager === null) { $this->objectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.incendium.cms.news.comment'); $objectType = CommentHandler::getInstance()->getObjectType($this->objectTypeID); $this->commentManager = $objectType->getProcessor(); } $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $this->entryID); // more news from this category $this->moreEntryList = new AccessibleEntryList(); $this->moreEntryList->getConditionBuilder()->add("news_entry.entryID IN (SELECT entryID FROM cms" . WCF_N . "_news_entry_to_category WHERE entryID != ? AND categoryID IN (?))", array($this->entryID, $this->entry->getCategoryIDs())); $this->moreEntryList->sqlLimit = CMS_DASHBOARD_SIDEBAR_NEWSENTRIES; $this->moreEntryList->readObjects(); // meta tags MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->entry->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true); MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)), true); MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true); MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->entry->getExcerpt())), true); // add tags as keywords if (!empty($this->tags)) { $keywords = ''; foreach ($this->tags as $tag) { if (!empty($keywords)) { $keywords .= ', '; } $keywords .= $tag->name; } MetaTagHandler::getInstance()->addTag('keywords', 'keywords', $keywords); } // quotes MessageQuoteManager::getInstance()->initObjects('de.incendium.cms.news.entry', array($this->entry->entryID)); }
/** * @see \wcf\system\edit\IHistorySavingObject::revertVersion() */ public function revertVersion(EditHistoryEntry $edit) { $postAction = new EntryAction(array($this->getDecoratedObject()), 'update', array('isEdit' => true, 'data' => array('message' => $edit->message), 'editReason' => WCF::getLanguage()->getDynamicVariable('wcf.edit.reverted', array('edit' => $edit)))); $postAction->executeAction(); }
/** * @see \wcf\system\moderation\queue\IModerationQueueHandler::removeContent() */ public function removeContent(ModerationQueue $queue, $message) { if ($this->isValid($queue->objectID)) { // remove news from moderation center $action = new EntryAction(array($this->getEntry($queue->objectID)), 'delete'); $action->executeAction(); } }
/** * Publishes news entries. */ public function publish() { if (empty($this->objects)) { $this->readObjects(); } $entryIDs = array(); foreach ($this->objects as $entry) { $entryIDs[] = $entry->entryID; $entry->update(array('isPublished' => 1, 'time' => $entry->publicationDate, 'publicationDate' => 0)); } // trigger publication if (!empty($entryIDs)) { $action = new EntryAction($entryIDs, 'triggerPublication'); $action->executeAction(); } }