Ejemplo n.º 1
0
 public function save()
 {
     MessageForm::save();
     if ($this->time != '') {
         $dateTime = \DateTime::createFromFormat("Y-m-d H:i", $this->time, WCF::getUser()->getTimeZone());
     }
     $data = array('subject' => $this->subject, 'message' => $this->text, 'teaser' => $this->teaser, 'time' => $this->time != '' ? $dateTime->getTimestamp() : TIME_NOW, 'enableBBCodes' => $this->enableBBCodes, 'showSignature' => $this->showSignature, 'enableHtml' => $this->enableHtml, 'imageID' => $this->imageID ?: null, 'enableSmilies' => $this->enableSmilies, 'lastChangeTime' => TIME_NOW, 'isDisabled' => $this->time != '' && $dateTime->getTimestamp() > TIME_NOW ? 1 : 0, 'lastEditor' => WCF::getUser()->username, 'lastEditorID' => WCF::getUser()->userID);
     $newsData = array('data' => $data, 'categoryIDs' => $this->categoryIDs, 'tags' => $this->tags, 'attachmentHandler' => $this->attachmentHandler);
     $action = new NewsAction(array($this->newsID), 'update', $newsData);
     $resultValues = $action->executeAction();
     $this->saved();
     // re-define after saving
     $this->news = new News($this->newsID);
     if (WCF::getSession()->getPermission('user.cms.news.canStartPoll') && MODULE_POLL) {
         $pollID = PollManager::getInstance()->save($this->news->newsID);
         if ($pollID && $pollID != $this->news->pollID) {
             $editor = new NewsEditor($this->news);
             $editor->update(array('pollID' => $pollID));
         } else {
             if (!$pollID && $this->news->pollID) {
                 $editor = new NewsEditor($this->news);
                 $editor->update(array('pollID' => null));
             }
         }
     }
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'cms', 'object' => $this->news)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save the news update
     $this->objectAction = new NewsUpdateAction(array($this->update), 'update', array('data' => array('subject' => $this->subject, 'text' => $this->text)));
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save file
     $data = array_merge($this->additionalFields, array('description' => $this->text, 'subject' => $this->subject));
     $this->objectAction = new EntryFileAction(array($this->entryFile), 'update', array('data' => $data));
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'filebase', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save entry
     $data = array_merge($this->additionalFields, array('languageID' => $this->languageID, 'teaser' => $this->teaser, 'subject' => $this->subject, 'message' => $this->text, 'website' => $this->website));
     $entryData = array('data' => $data, 'categoryIDs' => $this->categoryIDs, 'attachmentHandler' => $this->attachmentHandler);
     if (MODULE_TAGGING) {
         $entryData['tags'] = $this->tags;
     }
     $this->objectAction = new EntryAction(array($this->entry), 'update', $entryData);
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'filebase', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save the news update
     $this->objectAction = new EntryUpdateAction(array($this->update), 'update', array('data' => array('subject' => $this->subject, 'message' => $this->text)));
     $this->objectAction->executeAction();
     // set news as new
     if ($this->setEntryAsNew) {
         $sql = "UPDATE    cms" . WCF_N . "_news_entry\n                    SET    time = ?\n                    WHERE    entryID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(TIME_NOW, $this->entryID));
         $sql = "DELETE FROM    wcf" . WCF_N . "_tracked_visit\n                    WHERE        objectTypeID = ?\n                    AND        objectID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(VisitTracker::getInstance()->getObjectTypeID('de.incendium.cms.news.entry'), $this->entryID));
         // reset the user storage data
         UserStorageHandler::getInstance()->resetAll('cmsUnreadNewsEntries');
     }
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // quotes
     MessageQuoteManager::getInstance()->assignVariables();
     // poll
     if ($this->canCreatePoll()) {
         PollManager::getInstance()->assignVariables();
     }
     WCF::getTPL()->assign(array('action' => $this->action, 'subject' => $this->subject, 'text' => $this->text, 'teaser' => $this->teaser, 'categoryList' => $this->categoryList, 'categoryIDs' => $this->categoryIDs, 'enableAutomaticArchiving' => $this->enableAutomaticArchiving, 'archivingDate' => $this->archivingDate, 'enableDelayedPublication' => $this->enableDelayedPublication, 'publicationDate' => $this->publicationDate, 'pictureID' => $this->pictureID, 'picture' => $this->picture, 'isHot' => $this->isHot, 'sources' => $this->sources, 'tags' => $this->tags, 'showSignatureSetting' => false, 'messageQuoteCount' => MessageQuoteManager::getInstance()->countQuotes()));
 }
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     MessageForm::readData();
     if (empty($_POST)) {
         $this->text = $this->message->message;
         if ($this->isFirstMessage) {
             $this->participantCanInvite = $this->conversation->participantCanInvite;
             $this->subject = $this->conversation->subject;
             if ($this->conversation->isDraft && $this->conversation->draftData) {
                 $draftData = @unserialize($this->conversation->draftData);
                 if (!empty($draftData['participants'])) {
                     foreach (UserProfile::getUserProfiles($draftData['participants']) as $user) {
                         if (!empty($this->participants)) {
                             $this->participants .= ', ';
                         }
                         $this->participants .= $user->username;
                     }
                 }
                 if (!empty($draftData['invisibleParticipants'])) {
                     foreach (UserProfile::getUserProfiles($draftData['invisibleParticipants']) as $user) {
                         if (!empty($this->invisibleParticipants)) {
                             $this->invisibleParticipants .= ', ';
                         }
                         $this->invisibleParticipants .= $user->username;
                     }
                 }
             }
         }
     }
     // add breadcrumbs
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
     WCF::getBreadcrumbs()->add($this->conversation->getBreadcrumb());
     // get message list
     $this->messageList = new ViewableConversationMessageList();
     $this->messageList->setConversation($this->conversation);
     $this->messageList->sqlLimit = CONVERSATION_REPLY_SHOW_MESSAGES_MAX;
     $this->messageList->sqlOrderBy = 'conversation_message.time DESC';
     $this->messageList->getConditionBuilder()->add('conversation_message.conversationID = ?', array($this->message->conversationID));
     $this->messageList->getConditionBuilder()->add("conversation_message.messageID <> ?", array($this->message->messageID));
     $this->messageList->readObjects();
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     if (WCF::getSession()->getPermission('mod.news.canEditNewsWithoutNote') && $this->editNoteSuppress == 1) {
         $this->news->editCount = 0;
         $this->editReason = '';
         $this->news->editTime = 0;
     }
     // save the news entry
     $data = array('subject' => $this->subject, 'text' => $this->text, 'teaser' => $this->teaser, 'languageID' => $this->languageID, 'enableBBCodes' => $this->enableBBCodes, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'editCount' => $this->news->editCount + 1, 'editReason' => $this->editReason, 'editTime' => TIME_NOW, 'editUser' => WCF::getUser()->username, 'editReason' => $this->editReason, 'editNoteSuppress' => $this->editNoteSuppress, 'isHot' => $this->isHot);
     // delayed publication
     if ($this->enableDelayedPublication) {
         $data['isPublished'] = 0;
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->publicationDate, WCF::getUser()->getTimeZone());
         $data['publicationDate'] = $dateTime->getTimestamp();
     } else {
         $data['isPublished'] = 1;
         $data['publicationDate'] = 0;
     }
     // automatic archivation
     if ($this->enableAutomaticArchiving) {
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->archivingDate, WCF::getUser()->getTimeZone());
         $data['archivingDate'] = $dateTime->getTimestamp();
     } else {
         $data['archivingDate'] = 0;
     }
     // news picture
     if (NEWS_ENABLE_NEWSPICTURE && $this->pictureID) {
         $data['pictureID'] = $this->pictureID;
     }
     $newsData = array('attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs, 'data' => $data);
     if (NEWS_ENTRY_ENABLE_SOURCES) {
         $newsData['sources'] = $this->sources;
     }
     if (MODULE_TAGGING) {
         $newsData['tags'] = $this->tags;
     }
     // save poll
     if ($this->canCreatePoll()) {
         $pollID = PollManager::getInstance()->save($this->news->newsID);
         if ($pollID) {
             $newsEditor = new NewsEditor($this->news);
             $newsEditor->update(array('pollID' => $pollID));
         }
     }
     $this->objectAction = new NewsAction(array($this->news), 'update', $newsData);
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save the news entry
     $data = array('subject' => $this->subject, 'message' => $this->text, 'languageID' => $this->languageID, 'enableBBCodes' => $this->enableBBCodes, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'isFeatured' => $this->isFeatured);
     // delayed publication
     if ($this->enableDelayedPublication) {
         $data['isPublished'] = 0;
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->publicationDate, WCF::getUser()->getTimeZone());
         $data['publicationDate'] = $dateTime->getTimestamp();
     } else {
         $data['isPublished'] = 1;
         $data['publicationDate'] = 0;
     }
     if (WCF::getSession()->getPermission('user.news.canEditEntryDate')) {
         $data['time'] = $this->entryDateObj->getTimestamp();
     }
     $entryData = array('attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs, 'isEdit' => true, 'editReason' => $this->editReason, 'data' => $data);
     if (MODULE_TAGGING) {
         $entryData['tags'] = $this->tags;
     }
     // save poll
     if ($this->canCreatePoll()) {
         $pollID = PollManager::getInstance()->save($this->entry->entryID);
         if ($pollID) {
             $entryEditor = new EntryEditor($this->entry);
             $entryEditor->update(array('pollID' => $pollID));
         }
     }
     $this->objectAction = new EntryAction(array($this->entry), 'update', $entryData);
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     MessageQuoteManager::getInstance()->assignVariables();
     WCF::getTPL()->assign(array('conversation' => $this->conversation, 'conversationID' => $this->conversationID, 'items' => $this->messageList->countObjects(), 'messages' => $this->messageList->getObjects(), 'attachmentList' => $this->messageList->getAttachmentList()));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('newsID' => $this->newsID, 'news' => $this->news));
 }
 /**
  * @see    \wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $data = array('subject' => $this->subject, 'time' => TIME_NOW, 'message' => $this->text, 'teaser' => $this->teaser, 'website' => $this->website, 'userID' => WCF::getUser()->userID ?: null, 'username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->username, 'languageID' => $this->languageID, 'isDisabled' => WCF::getSession()->getPermission('user.linklist.canAddEntryWithoutModeration') ? 0 : 1);
     $linkData = array('attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs, 'data' => $data);
     if (MODULE_TAGGING) {
         $linkData['tags'] = $this->tags;
     }
     $this->objectAction = new EntryAction(array(), 'create', $linkData);
     $resultValues = $this->objectAction->executeAction();
     $this->saved();
     if ($resultValues['returnValues']->isDisabled) {
         HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('LinklistOverview', array('application' => 'linklist')), WCF::getLanguage()->get('linklist.entry.moderation.redirect'), 30);
     } else {
         HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'linklist', 'object' => $resultValues['returnValues'])));
     }
     exit;
 }
Ejemplo n.º 13
0
 public function assignVariables()
 {
     parent::assignVariables();
     if (WCF::getSession()->getPermission('user.cms.news.canStartPoll') && MODULE_POLL) {
         PollManager::getInstance()->assignVariables();
     }
     if ($this->imageID && $this->imageID != 0) {
         $this->image = FileCache::getInstance()->getFile($this->imageID);
     }
     WCF::getTPL()->assign(array('categoryList' => $this->categoryList, 'categoryIDs' => $this->categoryIDs, 'imageID' => $this->imageID, 'image' => $this->image, 'teaser' => $this->teaser, 'time' => $this->time, 'action' => $this->action, 'tags' => $this->tags, 'allowedFileExtensions' => explode("\n", StringUtil::unifyNewlines(WCF::getSession()->getPermission('user.cms.news.allowedAttachmentExtensions')))));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('categoryList' => $this->categoryList, 'categoryIDs' => $this->categoryIDs, 'fileSubject' => $this->fileSubject, 'tags' => $this->tags, 'action' => 'add', 'teaser' => $this->teaser, 'uploadID' => $this->uploadID, 'fileUpload' => $this->fileUpload, 'website' => $this->website, 'allowedFileExtensions' => explode("\n", StringUtil::unifyNewlines(WCF::getSession()->getPermission('user.filebase.allowedFileExtensions')))));
 }
Ejemplo n.º 15
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $this->objectAction = new UserAction(array(WCF::getUser()), 'update', array('data' => array_merge($this->additionalFields, array('signature' => $this->text, 'signatureEnableBBCodes' => $this->enableBBCodes, 'signatureEnableHtml' => $this->enableHtml, 'signatureEnableSmilies' => $this->enableSmilies))));
     $this->objectAction->executeAction();
     SignatureCache::getInstance()->getSignature(new User(WCF::getUser()->userID));
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', true);
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     MessageQuoteManager::getInstance()->assignVariables();
     WCF::getTPL()->assign(array('participantCanInvite' => $this->participantCanInvite, 'participants' => $this->participants, 'invisibleParticipants' => $this->invisibleParticipants));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // quotes
     MessageQuoteManager::getInstance()->assignVariables();
     // poll
     if ($this->canCreatePoll()) {
         PollManager::getInstance()->assignVariables();
     }
     WCF::getTPL()->assign(array('action' => 'add', 'subject' => $this->subject, 'text' => $this->text, 'categoryList' => $this->categoryList, 'categoryIDs' => $this->categoryIDs, 'enableDelayedPublication' => $this->enableDelayedPublication, 'publicationDate' => $this->publicationDate, 'isFeatured' => $this->isFeatured, 'tags' => $this->tags, 'showSignatureSetting' => false, 'messageQuoteCount' => MessageQuoteManager::getInstance()->countQuotes()));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('action' => 'add', 'uploadID' => $this->uploadID, 'fileUpload' => $this->fileUpload, 'entryID' => $this->entryID, 'entry' => $this->entry, 'allowedFileExtensions' => explode("\n", StringUtil::unifyNewlines(WCF::getSession()->getPermission('user.filebase.allowedFileExtensions')))));
 }
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function assignVariables()
 {
     parent::assignVariables();
     // quotes
     MessageQuoteManager::getInstance()->assignVariables();
     WCF::getTPL()->assign(array('entryID' => $this->entryID, 'entry' => $this->entry));
 }