public function execute()
 {
     parent::execute();
     $entryEditor = new EntryEditor($this->entry);
     $entryEditor->updateCounters(array('visits' => $this->entry->visits + 1));
     $this->executed();
     HeaderUtil::redirect($this->entry->website);
 }
 /**
  * @see	\wcf\system\worker\IWorker::execute()
  */
 public function execute()
 {
     parent::execute();
     if (!$this->loopCount) {
         // reset activity points
         UserActivityPointHandler::getInstance()->reset('de.incendium.linklist.activityPointEvent.entry');
         // reset search index
         SearchIndexManager::getInstance()->reset('de.incendium.linklist.entry');
     }
     if (!count($this->objectList)) {
         return;
     }
     // fetch cumulative likes
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("objectTypeID = ?", array(ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.like.likeableObject', 'de.incendium.linklist.likeableEntry')));
     $conditions->add("objectID IN (?)", array($this->objectList->getObjectIDs()));
     $sql = "SELECT\tobjectID, cumulativeLikes\n\t\t\tFROM\twcf" . WCF_N . "_like_object\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $cumulativeLikes = array();
     while ($row = $statement->fetchArray()) {
         $cumulativeLikes[$row['objectID']] = $row['cumulativeLikes'];
     }
     // prepare statements
     $attachmentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.attachment.objectType', 'de.incendium.linklist.entry');
     $sql = "SELECT\t\tCOUNT(*) AS attachments\n\t\t\tFROM\t\twcf" . WCF_N . "_attachment\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\t\tAND objectID = ?";
     $attachmentStatement = WCF::getDB()->prepareStatement($sql);
     $itemsToUser = array();
     foreach ($this->objectList as $entry) {
         $editor = new EntryEditor($entry);
         $data = array();
         // count attachments
         $attachmentStatement->execute(array($attachmentObjectType->objectTypeID, $entry->entryID));
         $row = $attachmentStatement->fetchArray();
         $data['attachments'] = $row['attachments'];
         // update cumulative likes
         $data['cumulativeLikes'] = isset($cumulativeLikes[$entry->entryID]) ? $cumulativeLikes[$entry->entryID] : 0;
         $editor->update($data);
         if ($entry->userID) {
             if (!isset($itemsToUser[$entry->userID])) {
                 $itemsToUser[$entry->userID] = 0;
             }
             $itemsToUser[$entry->userID]++;
         }
         // update search index
         SearchIndexManager::getInstance()->add('de.incendium.linklist.entry', $entry->entryID, $entry->message, $entry->subject, $entry->time, $entry->userID, $entry->username, $entry->languageID);
     }
     // update activity points
     UserActivityPointHandler::getInstance()->fireEvents('de.incendium.linklist.activityPointEvent.entry', $itemsToUser, false);
 }
 /**
  * @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();
 }
 /**
  * @see	\wcf\data\like\object\ILikeObject::updateLikeCounter()
  */
 public function updateLikeCounter($cumulativeLikes)
 {
     // update cumulative likes
     $editor = new EntryEditor($this->getDecoratedObject());
     $editor->update(array('cumulativeLikes' => $cumulativeLikes));
 }
 /**
  * @see	\wcf\system\comment\manager\ICommentManager::updateCounter()
  */
 public function updateCounter($objectID, $value)
 {
     $entry = new Entry($objectID);
     $editor = new EntryEditor($entry);
     $editor->updateCounters(array('comments' => $value));
 }