Exemplo n.º 1
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // enable recipient language
     $languages = array(0 => WCF::getLanguage(), WCF::getLanguage()->getLanguageID() => WCF::getLanguage());
     if (!isset($languages[$this->user->languageID])) {
         $languages[$this->user->languageID] = new Language($this->user->languageID);
     }
     $languages[$this->user->languageID]->setLocale();
     // build message data
     $subjectData = array('$username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email, '$subject' => $this->subject);
     $messageData = array('$message' => $this->message, 'PAGE_TITLE' => $languages[$this->user->languageID]->get(PAGE_TITLE), '$recipient' => $this->user->username, '$username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email, 'PAGE_URL' => PAGE_URL);
     // build mail
     require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
     $mail = new Mail(array($this->user->username => $this->user->email), $languages[$this->user->languageID]->get('wcf.user.mail.mail.subject', $subjectData), $languages[$this->user->languageID]->get('wcf.user.mail.mail', $messageData));
     // add reply-to tag
     if (WCF::getUser()->userID) {
         if ($this->showAddress) {
             $mail->setHeader('Reply-To: ' . Mail::buildAddress(WCF::getUser()->username, WCF::getUser()->email));
         }
     } else {
         $mail->setHeader('Reply-To: ' . $this->email);
     }
     // send mail
     $mail->send();
     $this->saved();
     // enable user language
     WCF::getLanguage()->setLocale();
     // forward to profile page
     WCF::getTPL()->assign(array('url' => 'index.php?page=User&userID=' . $this->userID . SID_ARG_2ND_NOT_ENCODED, 'message' => WCF::getLanguage()->get('wcf.user.mail.sent', array('$username' => StringUtil::encodeHTML($this->user->username)))));
     WCF::getTPL()->display('redirect');
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     CaptchaForm::save();
     // save solution
     $this->entry->update($this->solution);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=Contest&contestID=' . $this->entry->contestID . '&solutionID=' . $this->entry->solutionID . SID_ARG_2ND_NOT_ENCODED . '#solution' . $this->entry->solutionID);
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     CaptchaForm::save();
     // save solution
     $this->entry->update($this->comment);
     $this->saved();
     // get solution/contest
     require_once WCF_DIR . 'lib/data/contest/solution/ContestSolution.class.php';
     $solution = new ContestSolution($this->entry->solutionID);
     // forward
     HeaderUtil::redirect('index.php?page=ContestSolutionEntry' . '&contestID=' . $solution->contestID . '&solutionID=' . $solution->solutionID . SID_ARG_2ND_NOT_ENCODED . '#comment' . $this->entry->commentID);
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // generate a new lost password key
     $lostPasswordKey = StringUtil::getRandomID();
     // save key and request time in database
     $sql = "UPDATE \twcf" . WCF_N . "_user\n\t\t\tSET\tlostPasswordKey = '" . $lostPasswordKey . "',\n\t\t\t\tlastLostPasswordRequest = " . TIME_NOW . "\n\t\t\tWHERE \tuserID = " . $this->user->userID;
     WCF::getDB()->registerShutdownUpdate($sql);
     // send mail
     $subjectData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE));
     $messageData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), '$username' => $this->user->username, '$userID' => $this->user->userID, '$key' => $lostPasswordKey, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS);
     require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
     $mail = new Mail(array($this->user->username => $this->user->email), WCF::getLanguage()->get('wcf.user.lostPassword.mail.subject', $subjectData), WCF::getLanguage()->get('wcf.user.lostPassword.mail', $messageData));
     $mail->send();
     $this->saved();
     // forward to index page
     WCF::getTPL()->assign(array('url' => 'index.php' . SID_ARG_1ST, 'message' => WCF::getLanguage()->get('wcf.user.lostPassword.mail.sent')));
     WCF::getTPL()->display('redirect');
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save comment
     $comment = ContestCommentEditor::create($this->contest->contestID, $this->comment, WCF::getUser()->userID, $this->username);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=Contest&contestID=' . $this->contest->contestID . '&commentID=' . $comment->commentID . SID_ARG_2ND_NOT_ENCODED . '#comment' . $comment->commentID);
     exit;
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // parse URLs
     if ($this->parseURL == 1) {
         require_once WCF_DIR . 'lib/data/message/bbcode/URLParser.class.php';
         $this->text = URLParser::parse($this->text);
     }
     $this->saveOptions();
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // get additional data
     $additionalData = array();
     foreach (SearchEngine::$searchTypeObjects as $type => $typeObject) {
         if (($data = $typeObject->getAdditionalData()) !== null) {
             $additionalData[$type] = $data;
         }
     }
     // save result in database
     $this->searchData = array('packageID' => PACKAGE_ID, 'query' => $this->query, 'result' => $this->result, 'additionalData' => $additionalData, 'sortField' => $this->sortField, 'sortOrder' => $this->sortOrder, 'nameExactly' => $this->nameExactly, 'subjectOnly' => $this->subjectOnly, 'fromDay' => $this->fromDay, 'fromMonth' => $this->fromMonth, 'fromYear' => $this->fromYear, 'untilDay' => $this->untilDay, 'untilMonth' => $this->untilMonth, 'untilYear' => $this->untilYear, 'username' => $this->username, 'userID' => $this->userID, 'types' => $this->types, 'alterable' => !$this->userID ? 1 : 0);
     if ($this->searchID) {
         $sql = "UPDATE\twcf" . WCF_N . "_search\n\t\t\t\tSET\tsearchData = '" . escapeString(serialize($this->searchData)) . "',\n\t\t\t\t\tsearchDate = " . TIME_NOW . ",\n\t\t\t\t\tsearchType = 'messages',\n\t\t\t\t\tsearchHash = '" . $this->searchHash . "'\n\t\t\t\tWHERE\tsearchID = " . $this->searchID;
         WCF::getDB()->sendQuery($sql);
     } else {
         $sql = "INSERT INTO\twcf" . WCF_N . "_search\n\t\t\t\t\t\t(userID, searchData, searchDate, searchType, searchHash)\n\t\t\t\tVALUES\t\t(" . WCF::getUser()->userID . ",\n\t\t\t\t\t\t'" . escapeString(serialize($this->searchData)) . "',\n\t\t\t\t\t\t" . TIME_NOW . ",\n\t\t\t\t\t\t'messages',\n\t\t\t\t\t\t'" . $this->searchHash . "')";
         WCF::getDB()->sendQuery($sql);
         $this->searchID = WCF::getDB()->getInsertID();
     }
     $this->saved();
     // forward to result page
     HeaderUtil::redirect('index.php?form=Search&searchID=' . $this->searchID . '&highlight=' . urlencode($this->query) . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }