/**
  * @see	\wcf\system\like\IViewableLikeProvider::prepare()
  */
 public function prepare(array $likes)
 {
     $responseIDs = array();
     foreach ($likes as $like) {
         $responseIDs[] = $like->objectID;
     }
     // get objects type ids
     $responses = array();
     $conditionBuilder = new PreparedStatementConditionBuilder();
     $conditionBuilder->add('comment_response.responseID IN (?)', array($responseIDs));
     $sql = "SELECT\t\tcomment.objectTypeID, comment_response.responseID\n\t\t\tFROM\t\twcf" . WCF_N . "_comment_response comment_response\n\t\t\tLEFT JOIN\twcf" . WCF_N . "_comment comment\n\t\t\tON\t\t(comment.commentID = comment_response.commentID)\n\t\t\t" . $conditionBuilder;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditionBuilder->getParameters());
     while ($row = $statement->fetchArray()) {
         $responses[$row['responseID']] = $row['objectTypeID'];
     }
     // group likes by object type id
     $likeData = array();
     foreach ($likes as $like) {
         if (isset($responses[$like->objectID])) {
             if (!isset($likeData[$responses[$like->objectID]])) {
                 $likeData[$responses[$like->objectID]] = array();
             }
             $likeData[$responses[$like->objectID]][] = $like;
         }
     }
     foreach ($likeData as $objectTypeID => $likes) {
         $objectType = CommentHandler::getInstance()->getObjectType($objectTypeID);
         if (CommentHandler::getInstance()->getCommentManager($objectType->objectType) instanceof IViewableLikeProvider) {
             CommentHandler::getInstance()->getCommentManager($objectType->objectType)->prepare($likes);
         }
     }
 }
 /**
  * @see	\wcf\system\like\IViewableLikeProvider::prepare()
  */
 public function prepare(array $likes)
 {
     $commentIDs = array();
     foreach ($likes as $like) {
         $commentIDs[] = $like->objectID;
     }
     // fetch comments
     $commentList = new CommentList();
     $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs));
     $commentList->readObjects();
     $comments = $commentList->getObjects();
     // group likes by object type id
     $likeData = array();
     foreach ($likes as $like) {
         if (isset($comments[$like->objectID])) {
             if (!isset($likeData[$comments[$like->objectID]->objectTypeID])) {
                 $likeData[$comments[$like->objectID]->objectTypeID] = array();
             }
             $likeData[$comments[$like->objectID]->objectTypeID][] = $like;
         }
     }
     foreach ($likeData as $objectTypeID => $likes) {
         $objectType = CommentHandler::getInstance()->getObjectType($objectTypeID);
         if (CommentHandler::getInstance()->getCommentManager($objectType->objectType) instanceof IViewableLikeProvider) {
             CommentHandler::getInstance()->getCommentManager($objectType->objectType)->prepare($likes);
         }
     }
 }
Пример #3
0
 /**
  * @see	\wcf\data\like\object\ILikeObject::sendNotification()
  */
 public function sendNotification(Like $like)
 {
     $objectType = CommentHandler::getInstance()->getObjectType($this->object->objectTypeID);
     if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType . '.like.notification')) {
         $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType . '.like.notification');
         if ($this->userID != WCF::getUser()->userID) {
             $notificationObject = new LikeUserNotificationObject($like);
             UserNotificationHandler::getInstance()->fireEvent('like', $objectType->objectType . '.like.notification', $notificationObject, array($this->userID), array('objectID' => $this->object->objectID, 'objectOwnerID' => $this->userID));
         }
     }
 }
 /**
  * @see	\wcf\system\menu\user\profile\content\IUserProfileMenuContent::getContent()
  */
 public function getContent($userID)
 {
     if ($this->commentManager === null) {
         $this->objectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user.profileComment');
         $objectType = CommentHandler::getInstance()->getObjectType($this->objectTypeID);
         $this->commentManager = $objectType->getProcessor();
     }
     $commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $userID);
     // assign variables
     WCF::getTPL()->assign(array('commentCanAdd' => $this->commentManager->canAdd($userID), 'commentList' => $commentList, 'commentObjectTypeID' => $this->objectTypeID, 'userID' => $userID, 'lastCommentTime' => $commentList->getMinCommentTime(), 'likeData' => MODULE_LIKE ? $commentList->getLikeData() : array()));
     return WCF::getTPL()->fetch('userProfileCommentList');
 }
 /**
  * @see	\wcf\system\stat\IStatDailyHandler::getData()
  */
 public function getData($date)
 {
     $objectTypeID = CommentHandler::getInstance()->getObjectTypeID($this->objectType);
     if ($objectTypeID === null) {
         throw new SystemException("Unknown comment object type '" . $this->objectType . "'");
     }
     $sql = "SELECT (\n\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\tFROM\twcf" . WCF_N . "_comment\n\t\t\t\tWHERE\tobjectTypeID = ?\n\t\t\t\t\tAND time BETWEEN ? AND ?\n\t\t\t) + (\n\t\t\t\tSELECT\t\tCOUNT(*)\n\t\t\t\tFROM\t\twcf" . WCF_N . "_comment_response comment_response\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_comment comment\n\t\t\t\tON\t\t(comment.commentID = comment_response.commentID)\n\t\t\t\tWHERE\t\tcomment.objectTypeID = ?\n\t\t\t\t\t\tAND comment_response.time BETWEEN ? AND ?\n\t\t\t)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($objectTypeID, $date, $date + 86399, $objectTypeID, $date, $date + 86399));
     $counter = $statement->fetchColumn();
     $sql = "SELECT (\n\t\t\t\tSELECT\tCOUNT(*)\n\t\t\t\tFROM\twcf" . WCF_N . "_comment\n\t\t\t\tWHERE\tobjectTypeID = ?\n\t\t\t\t\tAND time < ?\n\t\t\t) + (\n\t\t\t\tSELECT\t\tCOUNT(*)\n\t\t\t\tFROM\t\twcf" . WCF_N . "_comment_response comment_response\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_comment comment\n\t\t\t\tON\t\t(comment.commentID = comment_response.commentID)\n\t\t\t\tWHERE\t\tcomment.objectTypeID = ?\n\t\t\t\t\t\tAND comment_response.time < ?\n\t\t\t)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array($objectTypeID, $date + 86400, $objectTypeID, $date + 86400));
     $total = $statement->fetchColumn();
     return array('counter' => $counter, 'total' => $total);
 }
Пример #6
0
 public function readData()
 {
     parent::readData();
     VisitCountHandler::getInstance()->count();
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.page.news'), LinkHandler::getInstance()->getLink('NewsCategoryList', array('application' => 'cms'))));
     $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.codequake.cms.news.comment');
     $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->newsID);
     $newsEditor = new NewsEditor($this->news->getDecoratedObject());
     $newsEditor->update(array('clicks' => $this->news->clicks + 1));
     // get Tags
     if (MODULE_TAGGING) {
         $this->tags = $this->news->getTags();
     }
     if ($this->news->teaser != '') {
         MetaTagHandler::getInstance()->addTag('description', 'description', $this->news->teaser);
     } else {
         MetaTagHandler::getInstance()->addTag('description', 'description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt())));
     }
     if (!empty($this->tags)) {
         MetaTagHandler::getInstance()->addTag('keywords', 'keywords', implode(',', $this->tags));
     }
     MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->news->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true);
     MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('News', array('application' => 'cms', 'object' => $this->news->getDecoratedObject())), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     if ($this->news->getImage() != null) {
         MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->news->getImage()->getLink(), true);
     }
     if ($this->news->getUserProfile()->facebook != '') {
         MetaTagHandler::getInstance()->addTag('article:author', 'article:author', 'https://facebook.com/' . $this->news->getUserProfile()->facebook, true);
     }
     if (FACEBOOK_PUBLIC_KEY != '') {
         MetaTagHandler::getInstance()->addTag('fb:app_id', 'fb:app_id', FACEBOOK_PUBLIC_KEY, true);
     }
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt())), true);
     if ($this->news->isNew()) {
         $newsAction = new NewsAction(array($this->news->getDecoratedObject()), 'markAsRead', array('viewableNews' => $this->news));
         $newsAction->executeAction();
     }
     // fetch likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.codequake.cms.likeableNews');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->newsID));
         $this->likeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
 }
Пример #7
0
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     // delete avatars
     $avatarIDs = array();
     foreach ($this->objects as $user) {
         if ($user->avatarID) {
             $avatarIDs[] = $user->avatarID;
         }
     }
     if (!empty($avatarIDs)) {
         $action = new UserAvatarAction($avatarIDs, 'delete');
         $action->executeAction();
     }
     // delete profile comments
     if (!empty($this->objectIDs)) {
         CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.user.profileComment', $this->objectIDs);
     }
     $returnValue = parent::delete();
     return $returnValue;
 }
 /**
  * @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));
 }
 /**
  * Deletes given entries.
  * 
  * @return	array<array>
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     $entryIDs = $entyData = $attachmentEntryIDs = $userCounters = array();
     foreach ($this->objects as $entry) {
         $entryData[$entry->entryID] = $entry->userID;
         $entryIDs[] = $entry->entryID;
         if ($entry->attachments) {
             $attachmentEntryIDs[] = $entry->entryID;
         }
         if (!$entry->isDisabled) {
             if (!isset($userToItems[$entry->userID])) {
                 $userToItems[$entry->userID] = 0;
             }
             $userToItems[$entry->userID]++;
         }
     }
     // remove user activity events
     $this->removeActivityEvents($entryData);
     // remove files
     $fileList = new EntryFileList();
     $fileList->getConditionBuilder()->add("file.entryID IN (?)", array(array_keys($entryData)));
     $fileList->readObjects();
     $fileAction = new EntryFileAction($fileList->getObjects(), 'delete', array('ignoreEntries' => true));
     $fileAction->executeAction();
     // remove entries
     foreach ($this->objects as $entry) {
         $entry->delete();
         $this->addEntryData($entry->getDecoratedObject(), 'deleted', LinkHandler::getInstance()->getLink('FilebaseOverview', array('application' => 'filebase')));
         EntryModificationLogHandler::getInstance()->delete($entry->getDecoratedObject());
     }
     if (!empty($entryIDs)) {
         // delete like data
         LikeHandler::getInstance()->removeLikes('de.incendium.filebase.likeableEntry', $entryIDs);
         // delete comments
         CommentHandler::getInstance()->deleteObjects('de.incendium.filebase.entryComment', $entryIDs);
         // delete tag to object entries
         TagEngine::getInstance()->deleteObjects('de.incendium.filebase.entry', $entryIDs);
         // delete entry from search index
         SearchIndexManager::getInstance()->delete('de.incendium.filebase.entry', $entryIDs);
     }
     // decrease user entry counter
     if (!empty($userCounters)) {
         EntryEditor::updateEntryCounter($userCounters);
     }
     // delete attachments
     if (!empty($attachmentEntryIDs)) {
         AttachmentHandler::removeAttachments('de.incendium.filebase.entry', $attachmentEntryIDs);
     }
     // delete subscriptions
     UserObjectWatchHandler::getInstance()->deleteObjects('de.incendium.filebase.entry', $entryIDs);
     $this->unmarkItems();
     return $this->getEntryData();
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     // collect data
     $entryIDs = $entyData = $attachmentEntryIDs = $perUserCount = $pollIDs = array();
     foreach ($this->objects as $entry) {
         $entryIDs[] = $entry->entryID;
         $entryData[$entry->entryID] = $entry->userID;
         if ($entry->pollID) {
             $pollIDs[] = $entry->pollID;
         }
         if ($entry->attachments) {
             $attachmentEntryIDs[] = $entry->entryID;
         }
         if (!$entry->isDisabled) {
             if (!isset($perUserCount[$entry->userID])) {
                 $perUserCount[$entry->userID] = 0;
             }
             $perUserCount[$entry->userID]++;
         }
     }
     // remove user activity events
     $this->removeActivityEvents($entryData);
     // remove entries
     foreach ($this->objects as $entry) {
         $entry->delete();
         $this->addEntryData($entry->getDecoratedObject(), 'deleted', LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms')));
         NewsEntryModificationLogHandler::getInstance()->delete($entry->getDecoratedObject());
     }
     if (!empty($entryIDs)) {
         // delete like data
         LikeHandler::getInstance()->removeLikes('de.incendium.cms.like.likeableNews', $entryIDs);
         // delete comments
         CommentHandler::getInstance()->deleteObjects('de.incendium.cms.news.comment', $entryIDs);
         // delete tag to object entries
         TagEngine::getInstance()->deleteObjects('de.incendium.cms.news.entry', $entryIDs);
         // delete entry activity events
         UserActivityEventHandler::getInstance()->removeEvents('de.incendium.cms.news.recentActivityEvent.entry', $entryIDs);
         UserActivityPointHandler::getInstance()->removeEvents('de.incendium.cms.news.activityPointEvent.entry', $perUserCount);
         // delete entry from search index
         SearchIndexManager::getInstance()->delete('de.incendium.cms.news.entry', $entryIDs);
         // remove object from moderation queue
         ModerationQueueActivationManager::getInstance()->removeModeratedContent('de.incendium.cms.news.entry', $entryIDs);
     }
     // delete a poll
     if (!empty($pollIDs)) {
         PollManager::getInstance()->removePolls($pollIDs);
     }
     // delete attachments
     if (!empty($attachmentEntryIDs)) {
         AttachmentHandler::removeAttachments('de.incendium.cms.news.entry', $attachmentEntryIDs);
     }
     // reset the user storage data
     UserStorageHandler::getInstance()->resetAll('cmsUnreadNewsEntries');
     $this->unmarkItems();
     return $this->getEntryData();
 }
 /**
  * @see    \wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     if (empty($this->objects)) {
         $this->readObjects();
     }
     $entryIDs = $entyData = $attachmentEntryIDs = $userCounters = array();
     foreach ($this->objects as $entry) {
         $entryData[$entry->entryID] = $entry->userID;
         $entryIDs[] = $entry->entryID;
         if ($entry->attachments) {
             $attachmentEntryIDs[] = $entry->entryID;
         }
         if (!$entry->isDisabled) {
             if (!isset($userToItems[$entry->userID])) {
                 $userToItems[$entry->userID] = 0;
             }
             $userToItems[$entry->userID]++;
         }
     }
     // remove user activity events
     $this->removeActivityEvents($entryData);
     // remove entries
     foreach ($this->objects as $entry) {
         $entry->delete();
         $this->addEntryData($entry->getDecoratedObject(), 'deleted', LinkHandler::getInstance()->getLink('LinklistOverview', array('application' => 'linklist')));
         EntryModificationLogHandler::getInstance()->delete($entry->getDecoratedObject());
     }
     if (!empty($entryIDs)) {
         // delete like data
         LikeHandler::getInstance()->removeLikes('de.incendium.linklist.likeableEntry', $entryIDs);
         // delete comments
         CommentHandler::getInstance()->deleteObjects('de.incendium.linklist.entryComment', $entryIDs);
         // delete tag to object entries
         TagEngine::getInstance()->deleteObjects('de.incendium.linklist.entry', $entryIDs);
         // delete entry from search index
         SearchIndexManager::getInstance()->delete('de.incendium.linklist.entry', $entryIDs);
     }
     // decrease user entry counter
     if (!empty($userCounters)) {
         EntryEditor::updateEntryCounter($userCounters);
     }
     // delete attachments
     if (!empty($attachmentEntryIDs)) {
         AttachmentHandler::removeAttachments('de.incendium.linklist.entry', $attachmentEntryIDs);
     }
     $this->unmarkItems();
     return $this->getEntryData();
 }
 public function readData()
 {
     parent::readData();
     // update entry visit
     if ($this->entry->isNew()) {
         $entryAction = new EntryAction(array($this->entry->getDecoratedObject()), 'markAsRead', array('viewableEntry' => $this->entry));
         $entryAction->executeAction();
     }
     // get author's user profile
     $this->userProfile = $this->entry->getUserProfile();
     // get comments
     $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.incendium.linklist.entryComment');
     $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->entryID);
     // get other entries by this author
     $this->userEntryList = new AccessibleEntryList();
     $this->userEntryList->enableCategoryLoading(false);
     $this->userEntryList->getConditionBuilder()->add('entry.userID = ?', array($this->entry->userID));
     $this->userEntryList->getConditionBuilder()->add('entry.entryID <> ?', array($this->entry->entryID));
     $this->userEntryList->sqlLimit = 5;
     $this->userEntryList->readObjects();
     // get tags
     if (MODULE_TAGGING) {
         $this->tags = TagEngine::getInstance()->getObjectTags('de.incendium.linklist.entry', $this->entry->entryID, array($this->entry->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : ""));
     }
     // fetch likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.incendium.linklist.likeableEntry');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->entryID));
         $this->entryLikeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
     // add breadcrumbs
     $leafCategories = $this->entry->getLeafCategories();
     $category = reset($leafCategories);
     LINKLISTCore::getInstance()->setLocation($category->getParentCategories(), $category);
     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('Entry', array('application' => 'linklist', 'object' => $this->entry)), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', $this->entry->teaser, 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);
     }
 }
Пример #13
0
 /**
  * @see	\wcf\data\ITitledObject::getTitle()
  */
 public function getTitle()
 {
     return CommentHandler::getInstance()->getObjectType($this->getComment()->objectTypeID)->getProcessor()->getTitle($this->getComment()->objectTypeID, $this->getComment()->objectID, true);
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     if (empty($_POST)) {
         $this->assignedUserID = $this->queue->assignedUserID;
     }
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.moderation.moderation'), LinkHandler::getInstance()->getLink('ModerationList')));
     $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.moderation.queue');
     $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->queueID);
     // update queue visit
     if ($this->queue->isNew()) {
         $action = new ModerationQueueAction(array($this->queue->getDecoratedObject()), 'markAsRead', array('visitTime' => TIME_NOW));
         $action->executeAction();
     }
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // categories
     $categoryTree = new NewsCategoryNodeTree($this->objectTypeName);
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // stats
     $this->stats = NewsStatsCacheBuilder::getInstance()->getData();
     $this->stats['categories'] = count(CategoryHandler::getInstance()->getCategories($this->objectTypeName));
     $this->stats['comments'] = count(CommentHandler::getInstance()->getObjectType('de.voolia.news.comment'));
     // users online list
     if (MODULE_USERS_ONLINE && NEWS_INDEX_ENABLE_USERS_ONLINE_LIST) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     // add breadcrumbs
     NEWSCore::getInstance()->setBreadcrumbs($this->category !== null ? $this->category->getParentCategories() : array());
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // categories
     $categoryTree = new NewsCategoryNodeTree($this->objectTypeName);
     $this->categoryList = $categoryTree->getIterator();
     $this->categoryList->setMaxDepth(0);
     // stats
     $this->stats = NewsStatsCacheBuilder::getInstance()->getData();
     $this->stats['categories'] = count(CategoryHandler::getInstance()->getCategories($this->objectTypeName));
     $this->stats['comments'] = count(CommentHandler::getInstance()->getObjectType('de.incendium.cms.news.comment'));
     // users online list
     if (MODULE_USERS_ONLINE && CMS_NEWS_ENABLE_USERS_ONLINE_LIST) {
         $this->usersOnlineList = new UsersOnlineList();
         $this->usersOnlineList->readStats();
         $this->usersOnlineList->getConditionBuilder()->add('session.userID IS NOT NULL');
         $this->usersOnlineList->readObjects();
     }
     // add breadcrumbs
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news'), LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms'))));
     if ($this->category !== null) {
         foreach ($this->category->getParentCategories() as $parentCategory) {
             WCF::getBreadcrumbs()->add($parentCategory->getBreadcrumb());
         }
     }
 }
Пример #17
0
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // set active menu item
     CMSCore::setActiveMenuItem($this->page);
     // set breadcrumbs
     CMSCore::setBreadcrumbs($this->page);
     // change style
     if ($this->page->styleID && StyleHandler::getInstance()->getStyle()->styleID != $this->page->styleID) {
         StyleHandler::getInstance()->changeStyle($this->page->styleID, true);
     }
     // get contents
     $contents = $this->page->getContents();
     $this->contentNodeTree = $contents['body'];
     $this->sidebarNodeTree = $contents['sidebar'];
     // comments
     if ($this->page->isCommentable) {
         $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.codequake.cms.page.comment');
         $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
         $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->page->pageID);
     }
     // meta tags
     if ($this->page->metaKeywords !== '') {
         MetaTagHandler::getInstance()->addTag('keywords', 'keywords', WCF::getLanguage()->get($this->page->metaKeywords));
     }
     if ($this->page->metaDescription !== '') {
         MetaTagHandler::getInstance()->addTag('description', 'description', WCF::getLanguage()->get($this->page->metaDescription));
     }
     if ($this->page->metaDescription !== '') {
         MetaTagHandler::getInstance()->addTag('og:description', 'og:description', WCF::getLanguage()->get($this->page->metaDescription), true);
     }
     MetaTagHandler::getInstance()->addTag('generator', 'generator', 'Fireball CMS');
     MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->page->getTitle() . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true);
     MetaTagHandler::getInstance()->addTag('og:url', 'og:url', $this->page->getLink(false), true);
     if (FACEBOOK_PUBLIC_KEY != '') {
         MetaTagHandler::getInstance()->addTag('fb:app_id', 'fb:app_id', FACEBOOK_PUBLIC_KEY, true);
     }
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true);
 }
 /**
  * @see	\wcf\data\IDeleteAction::delete()
  */
 public function delete()
 {
     // delete news entries
     parent::delete();
     // collect data
     $newsIDs = $perUserCount = $pollIDs = array();
     foreach ($this->objects as $news) {
         $newsIDs[] = $news->newsID;
         if ($news->pollID) {
             $pollIDs[] = $news->pollID;
         }
         if (!$news->isDisabled) {
             if (!isset($perUserCount[$news->userID])) {
                 $perUserCount[$news->userID] = 0;
             }
             $perUserCount[$news->userID]++;
         }
     }
     if (!empty($newsIDs)) {
         // delete like data
         LikeHandler::getInstance()->removeLikes('de.voolia.news.likeableNews', $newsIDs);
         // delete comments
         CommentHandler::getInstance()->deleteObjects('de.voolia.news.comment', $newsIDs);
         // delete tag to object entries
         TagEngine::getInstance()->deleteObjects('de.voolia.news.entry', $newsIDs);
         // delete entry activity events
         UserActivityEventHandler::getInstance()->removeEvents('de.voolia.news.recentActivityEvent.news', $newsIDs);
         UserActivityPointHandler::getInstance()->removeEvents('de.voolia.news.activityPointEvent.news', $perUserCount);
         // delete entry from search index
         SearchIndexManager::getInstance()->delete('de.voolia.news.entry', $newsIDs);
         // remove object from moderation queue
         ModerationQueueActivationManager::getInstance()->removeModeratedContent('de.voolia.news.entry', $newsIDs);
     }
     // delete a poll
     if (!empty($pollIDs)) {
         PollManager::getInstance()->removePolls($pollIDs);
     }
     // reset the user storage data
     UserStorageHandler::getInstance()->resetAll('newsUnreadEntries');
     UserStorageHandler::getInstance()->resetAll('newsUnreadWatchedEntries');
     // reset the news cache
     NewsEditor::resetNewsStatsCache();
 }
 /**
  * @see	\wcf\system\faker\AbstractFaker::__construct()
  */
 public function __construct(\Faker\Generator $generator, array $parameters)
 {
     parent::__construct($generator, $parameters);
     $this->objectTypeID = \wcf\system\comment\CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user.profileComment');
     $this->objectType = \wcf\data\object\type\ObjectTypeCache::getInstance()->getObjectType($this->objectTypeID);
 }
Пример #20
0
 /**
  * Validates message parameter.
  */
 protected function validateMessage()
 {
     $this->readString('message', false, 'data');
     $this->parameters['data']['message'] = MessageUtil::stripCrap($this->parameters['data']['message']);
     if (empty($this->parameters['data']['message'])) {
         throw new UserInputException('message');
     }
     CommentHandler::enforceCensorship($this->parameters['data']['message']);
 }