예제 #1
0
파일: Edit.php 프로젝트: sinfocol/gwf3
 private function onEdit()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         #, array('langid', 'title', 'message')))) {
         return $error;
     }
     $langid = $this->lang->getID();
     if (false === $this->news->saveTranslation($langid, $form->getVar('title'), $form->getVar('message'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $options = 0;
     $back = '';
     $oldhidden = $this->news->isHidden();
     $newhidden = isset($_POST['hidden']);
     $options |= $newhidden ? GWF_News::HIDDEN : 0;
     if ($newhidden !== $oldhidden) {
         $back .= $this->module->message('msg_hidden_' . ($newhidden ? 1 : 0));
     }
     $oldmail = $this->news->isToBeMailed();
     $newmail = isset($_POST['mailme']);
     $options |= $newmail ? GWF_News::MAIL_ME : 0;
     if ($newmail !== $oldmail) {
         $back .= $this->module->message('msg_mailme_' . ($newmail ? 1 : 0));
     }
     if (false === $this->news->saveVar('news_options', $options)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     //		if ($this->module->cfgNewsInForum())
     //		{
     //			$back .= $this->newsToForum($this->news, !$newhidden);
     //		}
     return $back . $this->module->message('msg_edited', array($this->news->displayTitle(), $this->lang->displayName()));
 }