/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'action' => 'edit', 'pageID' => $this->pageID )); }
/** * @see Form::save() */ public function save() { MessageForm::save(); //$this->entry->update() $this->saved(); HeaderUtil::redirect('index.php?page=CheatDatabaseEntry&entryID=' . $this->entry->entryID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Form::save() */ public function save() { MessageForm::save(); // save solution $this->entry->update($this->text, $this->state, $this->getOptions(), $this->attachmentListEditor); $this->saved(); // forward HeaderUtil::redirect('index.php?page=ContestSolutionEntry' . '&contestID=' . $this->entry->contestID . '&solutionID=' . $this->entry->solutionID . SID_ARG_2ND_NOT_ENCODED . '#solution' . $this->entry->solutionID); exit; }
/** * @see Page::readParameters() */ public function readParameters() { MessageForm::readParameters(); if (isset($_REQUEST['priceID'])) { $this->priceID = intval($_REQUEST['priceID']); } $this->entry = new ContestPriceEditor($this->priceID); if (!$this->entry->priceID || !$this->entry->isEditable()) { throw new IllegalLinkException(); } }
public function executeSendMessage(sfWebRequest $request) { $this->forward404Unless($request->isMethod('POST')); $form = new MessageForm($this->getUser()->getAttribute('id')); $form->bind($request->getParameter('message')); if ($form->isValid()) { $thread = new Thread(); $thread->subject = $request->getPostParameter('message[subject]'); $thread->recipients = json_encode(array($this->getUser()->getAttribute('id'), $request->getPostParameter('message[recipients]'))); $thread->save(); $message = new Message(); $message->message_id = md5(date(DateTime::ISO8601)); $message->thread_id = $thread->thread_id; $message->author_id = $this->getUser()->getAttribute('id'); $message->body = $request->getPostParameter('message[message]'); $message->save(); $this->redirectWithInfo('Your message was successfully sent.', 'messages/index'); } $this->redirectWithInfo('An error occured sending your message. Please try again later.'); }
/** * Displays and send messages in the specified queue. * @param string $queue_name * @param string $subscriber_id */ public function actionMessages($queue_name, $subscriber_id = null) { if (($subscriber_id = trim($subscriber_id)) === '') { $subscriber_id = null; } list($queue, $authItems) = $this->loadQueue($queue_name, array('nfy.message.read', 'nfy.message.create')); $this->verifySubscriber($queue, $subscriber_id); $formModel = new MessageForm('create'); if ($authItems['nfy.message.create'] && isset($_POST['MessageForm'])) { $formModel->attributes = $_POST['MessageForm']; if ($formModel->validate()) { $queue->send($formModel->content, $formModel->category); $this->redirect(array('messages', 'queue_name' => $queue_name, 'subscriber_id' => $subscriber_id)); } } $dataProvider = null; if ($authItems['nfy.message.read']) { $dataProvider = new CArrayDataProvider($queue->peek($subscriber_id, 200, array(NfyMessage::AVAILABLE, NfyMessage::RESERVED, NfyMessage::DELETED)), array('sort' => array('attributes' => array('id'), 'defaultOrder' => array('id' => CSort::SORT_DESC)))); // reverse display order to simulate a chat window, where latest message is right above the message form $dataProvider->setData(array_reverse($dataProvider->getData())); } $this->render('messages', array('queue' => $queue, 'queue_name' => $queue_name, 'dataProvider' => $dataProvider, 'model' => $formModel, 'authItems' => $authItems)); }
/** * @see Form::save() */ public function save() { MessageForm::save(); //create date $date = (string) $this->dateValues['year'] . '-' . (string) $this->dateValues['month'] . '-' . (string) $this->dateValues['day'] . (MESSAGE_NEWSLETTERSYSTEM_GENERAL_HOURLYCRONJOB ? ' ' . (string) $this->dateValues['hour'] . ':00:00' : ''); //convert date to timestamp $unixTime = strtotime($date); $newsletter = new NewsletterEditor($this->newsletterID); $newsletter->update(WCF::getUser()->userID, WCF::getUser()->username, $unixTime, $this->subject, $this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes); $this->saved(); if ($this->sendTestmail) { $this->sendTestmail($newsletter); } $this->success = true; //resetting cache $cacheName = 'newsletter-' . PACKAGE_ID; WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.' . $cacheName . '.php'); }
/** * @see Page::assignVariables() */ public function assignVariables() { MessageForm::assignVariables(); WCF::getTPL()->assign(array('itemID' => $this->itemID, 'item' => $this->item, 'action' => 'edit')); }
/** * @see Page::show() */ public function show() { // set active header menu item PageMenu::setActiveMenuItem('wcf.header.menu.user.contest'); if (WCF::getUser()->userID == 0) { // forward to login page WCF::getTPL()->assign(array('url' => 'index.php?form=UserLogin' . SID_ARG_2ND, 'message' => WCF::getLanguage()->get('wcf.contest.register.message'))); WCF::getTPL()->display('redirect'); return; } // check permission WCF::getUser()->checkPermission('user.contest.canUseContest'); WCF::getUser()->checkPermission('user.contest.canAddContest'); if (!MODULE_CONTEST) { throw new IllegalLinkException(); } // check upload permission if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.contest.canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor if ($this->attachmentListEditor == null) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php'; $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'contestEntry', WCF::getPackageID('de.easy-coding.wcf.contest'), WCF::getUser()->getPermission('user.contest.maxAttachmentSize'), WCF::getUser()->getPermission('user.contest.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.contest.maxAttachmentCount')); } parent::show(); }
public function MessageForm() { // http://doc.silverstripe.org/framework/en/3.1/topics/forms return MessageForm::create($this, "MessageForm"); }
public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array('entry' => $this->entry)); }
function showNoticeForm() { $message_form = new MessageForm($this, $this->other, $this->content); $message_form->show(); }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array('username' => $this->username)); }
function showNoticeForm() { $message_form = new MessageForm($this); $message_form->show(); }
/** * @see Page::show() */ public function show() { UserProfileMenu::getInstance()->setActiveMenuItem('wcf.user.profile.menu.link.guestbook'); // TODO: check permissions and shit parent::show(); }
public function actionMessage() { $model = new MessageForm(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { // form inputs are valid, do something here $model = save(); //return; } } return $this->render('message', ['model' => $model]); }
/** * @see Form::save() */ public function save() { // set the language temporarily to the thread language if ($this->thread->languageID && $this->thread->languageID != WCF::getLanguage()->getLanguageID()) { $this->setLanguage($this->thread->languageID); } MessageForm::save(); if ($this->thread->isDisabled) { $this->disablePost = 1; } // search for double posts if ($postID = PostEditor::test($this->subject, $this->text, WCF::getUser()->userID, $this->username, $this->threadID)) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $postID); exit; } // save poll if ($this->showPoll) { $this->pollEditor->save(); } // save post in database $this->newPost = PostEditor::create($this->thread->threadID, $this->subject, $this->text, WCF::getUser()->userID, $this->username, $this->getOptions(), $this->attachmentListEditor, $this->pollEditor, null, intval($this->disablePost || !$this->board->getPermission('canReplyThreadWithoutModeration'))); // reset language if ($this->userInterfaceLanguageID !== null) { $this->setLanguage($this->userInterfaceLanguageID, true); } // remove quotes $sessionVars = WCF::getSession()->getVars(); if (isset($sessionVars['quotes'][$this->threadID])) { unset($sessionVars['quotes'][$this->threadID]); WCF::getSession()->register('quotes', $sessionVars['quotes']); } if (!$this->disablePost && $this->board->getPermission('canReplyThreadWithoutModeration')) { // refresh thread $this->thread->addPost($this->newPost, $this->closeThread); // update subscription $this->thread->setSubscription($this->subscription); // update user posts if (WCF::getUser()->userID && $this->board->countUserPosts) { WBBUser::updateUserPosts(WCF::getUser()->userID, 1); if (ACTIVITY_POINTS_PER_POST) { require_once WCF_DIR . 'lib/data/user/rank/UserRank.class.php'; UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST); } } // refresh counter and last post $this->board->addPosts(); $this->board->setLastPost($this->thread); // close / open thread if (!$this->thread->isClosed && $this->closeThread) { $this->thread->close(); } else { if ($this->thread->isClosed && !$this->closeThread) { $this->thread->open(); } } // mark as done if ($this->markAsDone == 1) { $this->thread->markAsDone(); } else { if (MODULE_THREAD_MARKING_AS_DONE && $this->board->enableMarkingAsDone && $this->thread->isDone && WCF::getUser()->userID && WCF::getUser()->userID == $this->thread->userID) { $this->thread->markAsUndone(); } } // reset stat cache WCF::getCache()->clearResource('stat'); WCF::getCache()->clearResource('boardData'); // send notifications $this->newPost->sendNotification($this->thread, $this->board, $this->attachmentListEditor); $this->saved(); // forward to post $url = 'index.php?page=Thread&postID=' . $this->newPost->postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $this->newPost->postID; HeaderUtil::redirect($url); } else { $this->saved(); if ($this->disablePost) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $this->newPost->postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $this->newPost->postID); } else { WCF::getTPL()->assign(array('url' => 'index.php?page=Thread&threadID=' . $this->threadID . SID_ARG_2ND_NOT_ENCODED, 'message' => WCF::getLanguage()->get('wbb.postAdd.moderation.redirect'), 'wait' => 5)); WCF::getTPL()->display('redirect'); } } exit; }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array('serverID' => $this->serverID, 'serverName' => $this->serverName, 'username' => $this->username, 'serverList' => $this->serverList)); }
/** * @see Page::show() */ public function show() { // check permission if (!WCF::getUser()->userID) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } // set active tab require_once WCF_DIR . 'lib/page/util/menu/UserProfileMenu.class.php'; UserProfileMenu::getInstance()->userID = $this->userID; UserCPMenu::getInstance()->setActiveMenuItem('wcf.user.usercp.menu.link.profile.guestbook'); if (WCF::getUser()->getPermission('user.guestbook.canViewMembersListTab') && WCF::getUser()->getPermission('user.membersList.canView')) { HeaderMenu::setActiveMenuItem('wcf.header.menu.memberslist'); } else { if (WCF::getUser()->getPermission('user.guestbook.canViewListMenuButton')) { HeaderMenu::setActiveMenuItem('wcf.header.menu.userGuestbook'); } } require_once WCF_DIR . 'lib/data/message/attachment/AttachmentsEditor.class.php'; $this->attachmentsEditor = new AttachmentsEditor(); // show form parent::show(); }
/** * @see Page::assginVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array('action' => 'add', 'instanceID' => $this->instanceID)); }
public function actionEmail($subject = '', $body = '') { $ids = Yii::app()->getUser()->getState('ids', array()); $students = Student::model()->findAllByPK($ids); $model = new MessageForm(); $model->subject = $subject; $model->body = $body; if (isset($_POST['MessageForm'])) { $model->attributes = $_POST['MessageForm']; if ($model->validate()) { $result = $model->prepareMessages($students); $flashes = array('success' => array(), 'error' => array()); if ($result['prepared']) { $flashes['success'][] = Yii::t('swu', 'One message has been correctly prepared.|{n} messages have been correctly prepared.', $result['prepared']); } if ($result['failed']) { $flashes['error'][] = Yii::t('swu', 'One message could not be prepared.|{n} messages could not be prepared.', $result['failed']); } $this->setAllFlashes($flashes); $this->refresh(); } } $this->render('message', array('model' => $model, 'students' => $students)); }
/** * @see Page::show() */ public function show() { // set active header menu item PageMenu::setActiveMenuItem('wcf.header.menu.user.contest'); // set active menu item ContestMenu::getInstance()->setContest($this->contest); ContestMenu::getInstance()->setActiveMenuItem('wcf.contest.menu.link.solution'); // check permission WCF::getUser()->checkPermission('user.contest.canViewContest'); if (!MODULE_CONTEST) { throw new IllegalLinkException(); } // check upload permission if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.contest.canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor if ($this->attachmentListEditor === null) { require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php'; $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'contestSolutionEntry', WCF::getPackageID('de.easy-coding.wcf.contest'), WCF::getUser()->getPermission('user.contest.maxAttachmentSize'), WCF::getUser()->getPermission('user.contest.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.contest.maxAttachmentCount')); } parent::show(); }
/** * @see Page::show() */ public function show() { // check upload permission if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.contest.canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor if ($this->attachmentListEditor === null) { $max = min(WCF::getUser()->getPermission('user.contest.maxAttachmentCount'), 1); $extensions = WCF::getUser()->getPermission('user.contest.allowedAttachmentExtensions'); $extensions = explode("\n", $extensions); $extensions = array_filter($extensions, create_function('$a', 'return in_array($a, array("jpeg", "jpg", "gif", "png"));')); $extensions = implode("\n", $extensions); require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php'; $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'contestPriceEntry', WCF::getPackageID('de.easy-coding.wcf.contest'), WCF::getUser()->getPermission('user.contest.maxAttachmentSize'), $extensions, $max); } parent::show(); }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); $this->frame->assignVariables(); WCF::getTPL()->assign(array( 'action' => 'add', 'pageName' => $this->pageName, 'menuItem' => $this->menuItem )); }
/** * @see MessageForm::validateText() */ protected function validateText() { try { parent::validateText(); } catch (UserInputException $e) { if ($e->getType() !== 'empty') { throw $e; } } }
/** * @see Page::show() */ public function show() { $this->loadAvailableLanguages(); // get max text length $this->maxTextLength = WCF::getUser()->getPermission('user.board.maxPostLength'); if (MODULE_POLL != 1 || !$this->board->getPermission('canStartPoll')) { $this->showPoll = false; } if (MODULE_ATTACHMENT != 1 || !$this->board->getPermission('canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor if ($this->attachmentListEditor == null) { $this->attachmentListEditor = new MessageAttachmentListEditor(array(), 'post', PACKAGE_ID, WCF::getUser()->getPermission('user.board.maxAttachmentSize'), WCF::getUser()->getPermission('user.board.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.board.maxAttachmentCount')); } // get poll editor if ($this->pollEditor == null) { $this->pollEditor = new PollEditor(0, 0, 'post', WCF::getUser()->getPermission('user.board.canStartPublicPoll')); } // show form parent::show(); }
/** * @see Page::show() */ public function show() { if (!MODULE_PM) { throw new IllegalLinkException(); } // check permission WCF::getUser()->checkPermission('user.pm.canUsePm'); if (!WCF::getUser()->userID) { throw new PermissionDeniedException(); } // check max pm permission if (WCF::getUser()->pmTotalCount >= WCF::getUser()->getPermission('user.pm.maxPm')) { throw new NamedUserException(WCF::getLanguage()->get('wcf.pm.error.mailboxIsFull')); } // get max text length $this->maxTextLength = WCF::getUser()->getPermission('user.pm.maxLength'); // check upload permissin if (MODULE_ATTACHMENT != 1 || !WCF::getUser()->getPermission('user.pm.canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentListEditor.class.php'; $this->attachmentListEditor = new MessageAttachmentListEditor($this->pmID && !$this->forwarding && !$this->reply ? array($this->pmID) : array(), 'pm', WCF::getPackageID('com.woltlab.wcf.data.message.pm'), WCF::getUser()->getPermission('user.pm.maxAttachmentSize'), WCF::getUser()->getPermission('user.pm.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.pm.maxAttachmentCount')); // show form parent::show(); }
/** * @see Page::show() */ public function show() { // check permission if (!WCF::getUser()->getPermission('mod.wantedPoster.canModifyEntries') && ($this->userID != WCF::getUser()->userID || !WCF::getUser()->getPermission('user.wantedPoster.canViewWantedPoster') || !WCF::getUser()->getPermission('user.wantedPoster.canUseWantedPoster'))) { require_once WCF_DIR . 'lib/system/exception/PermissionDeniedException.class.php'; throw new PermissionDeniedException(); } // get max text length $this->maxTextLength = WCF::getUser()->getPermission('user.wantedPoster.maxLength'); if (WCF::getUser()->getPermission('user.wantedPoster.canViewMembersListTab') && WCF::getUser()->getPermission('user.membersList.canView')) { HeaderMenu::setActiveMenuItem('wcf.header.menu.memberslist'); } else { if (WCF::getUser()->getPermission('user.wantedPoster.canViewHeaderMenu')) { HeaderMenu::setActiveMenuItem('wcf.header.menu.userWantedPoster'); } } // set active tab UserCPMenu::getInstance()->setActiveMenuItem('wcf.user.usercp.menu.link.profile.wantedPoster'); // Lade Content $uwp = new UserWantedPosterData($this->userID); $this->uwpData = $uwp->readEntry(); if (isset($this->uwpData['text'])) { $this->text = $this->uwpData['text']; } // check upload permission if (!WCF::getUser()->getPermission('user.wantedPoster.canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor require_once WCF_DIR . 'lib/data/message/attachment/AttachmentsEditor.class.php'; $this->attachmentsEditor = new AttachmentsEditor($this->userID, 'wantedPoster', WCF::getUser()->getPermission('user.wantedPoster.maxAttachmentSize'), WCF::getUser()->getPermission('user.wantedPoster.allowedAttachmentExtensions'), WCF::getUser()->getPermission('user.wantedPoster.maxAttachmentCount')); // show form parent::show(); }
<?php require_once 'messageform.php'; // format 061xxxxxx ili 061xxxxxx $broj = ''; $poruka = 'Test: ' . time(); $x = new MessageForm($broj, $poruka); $x->dispatch();
/** * @see Page::show() */ public function show() { // show form parent::show(); }