예제 #1
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // get additional data
     $additionalData = array();
     foreach (SearchEngine::getInstance()->getAvailableObjectTypes() as $objectTypeName => $objectType) {
         if (($data = $objectType->getAdditionalData()) !== null) {
             $additionalData[$objectTypeName] = $data;
         }
     }
     // save result in database
     $this->searchData = array('packageID' => PACKAGE_ID, 'query' => $this->query, 'results' => $this->results, 'additionalData' => $additionalData, 'sortField' => $this->sortField, 'sortOrder' => $this->sortOrder, 'nameExactly' => $this->nameExactly, 'subjectOnly' => $this->subjectOnly, 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'username' => $this->username, 'userID' => $this->userID, 'selectedObjectTypes' => $this->selectedObjectTypes, 'alterable' => !$this->userID ? 1 : 0);
     if ($this->modifySearchID) {
         $this->objectAction = new SearchAction(array($this->modifySearchID), 'update', array('data' => array('searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash)));
         $this->objectAction->executeAction();
     } else {
         $this->objectAction = new SearchAction(array(), 'create', array('data' => array('userID' => WCF::getUser()->userID ?: null, 'searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash)));
         $resultValues = $this->objectAction->executeAction();
         $this->searchID = $resultValues['returnValues']->searchID;
     }
     // save keyword
     if (!empty($this->query)) {
         SearchKeywordManager::getInstance()->add($this->query);
     }
     $this->saved();
     // get application
     $application = 'wcf';
     if (count($this->selectedObjectTypes) == 1) {
         $objectType = SearchEngine::getInstance()->getObjectType(reset($this->selectedObjectTypes));
         if ($tmp = ApplicationHandler::getInstance()->getAbbreviation($objectType->packageID)) {
             $application = $tmp;
         }
     }
     // forward to result page
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array('id' => $this->searchID, 'application' => $application), 'highlight=' . urlencode($this->query)));
     exit;
 }
예제 #2
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // change user
     WCF::getSession()->changeUser($this->user);
     $this->saved();
     if (!empty($this->url)) {
         // append session
         if (mb_strpos($this->url, '?') !== false) {
             $this->url .= SID_ARG_2ND_NOT_ENCODED;
         } else {
             $this->url .= SID_ARG_1ST;
         }
         HeaderUtil::redirect($this->url);
     } else {
         if (RequestHandler::getInstance()->inRescueMode()) {
             $path = RouteHandler::getHost() . RouteHandler::getPath() . SID_ARG_1ST;
         } else {
             $application = ApplicationHandler::getInstance()->getActiveApplication();
             $path = $application->getPageURL() . 'acp/' . SID_ARG_1ST;
         }
         HeaderUtil::redirect($path);
     }
     exit;
 }
예제 #3
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // get recipient's language
     $userLanguage = $this->user->getLanguage();
     // build message data
     $subjectData = array('username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email, 'subject' => $this->subject);
     $messageData = array('message' => $this->message, 'recipient' => $this->user, 'username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->email);
     // build mail
     $mail = new Mail(array($this->user->username => $this->user->email), $userLanguage->getDynamicVariable('wcf.user.mail.mail.subject', $subjectData), $userLanguage->getDynamicVariable('wcf.user.mail.mail', $messageData));
     $mail->setLanguage($userLanguage);
     // 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();
     // forward to profile page
     HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('User', array('object' => $this->user)), WCF::getLanguage()->getDynamicVariable('wcf.user.mail.sent', array('user' => $this->user)));
     exit;
 }
예제 #4
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // generate a new lost password key
     $lostPasswordKey = StringUtil::getRandomID();
     // save key and request time in database
     $this->objectAction = new UserAction(array($this->user), 'update', array('data' => array_merge($this->additionalFields, array('lostPasswordKey' => $lostPasswordKey, 'lastLostPasswordRequestTime' => TIME_NOW))));
     $this->objectAction->executeAction();
     // send mail
     $mail = new Mail(array($this->user->username => $this->user->email), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail.subject'), WCF::getLanguage()->getDynamicVariable('wcf.user.lostPassword.mail', array('username' => $this->user->username, 'userID' => $this->user->userID, 'key' => $lostPasswordKey)));
     $mail->send();
     $this->saved();
     // forward to index page
     HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink(), WCF::getLanguage()->get('wcf.user.lostPassword.mail.sent'));
     exit;
 }
예제 #5
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // parse URLs
     if ($this->preParse == 1) {
         // BBCodes are enabled
         if ($this->enableBBCodes) {
             if ($this->allowedBBCodesPermission) {
                 $this->text = PreParser::getInstance()->parse($this->text, ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($this->allowedBBCodesPermission))));
             } else {
                 $this->text = PreParser::getInstance()->parse($this->text);
             }
         } else {
             $this->text = PreParser::getInstance()->parse($this->text, array());
         }
     }
 }