コード例 #1
0
ファイル: Translate.php プロジェクト: sinfocol/gwf3
 private function onTranslate(GWF_Page $page)
 {
     $form = $this->formTranslate($page);
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     $options = 0;
     $options |= GWF_Page::ENABLED;
     $options |= GWF_Page::TRANSLATION;
     $options |= $page->isLoginRequired() ? GWF_Page::LOGIN_REQUIRED : 0;
     $options |= $this->locked_mode ? GWF_Page::LOCKED : 0;
     $options |= $page->getMode();
     $options |= $page->getShowFlags();
     $gstring = $page->getVar('page_groups');
     $tags = ',' . trim(trim($form->getVar('tags')), ',') . ',';
     $author = GWF_User::getStaticOrGuest();
     $time = time();
     $date = GWF_Time::getDate(GWF_Time::LEN_SECOND, $time);
     $newpage = new GWF_Page(array('page_id' => '0', 'page_otherid' => $page->getID(), 'page_lang' => $form->getVar('lang'), 'page_author' => $author->getID(), 'page_author_name' => $author->getVar('user_name'), 'page_groups' => $gstring, 'page_create_date' => $date, 'page_date' => $date, 'page_time' => $time, 'page_url' => $form->getVar('url'), 'page_title' => $form->getVar('title'), 'page_cat' => '0', 'page_meta_tags' => $tags, 'page_meta_desc' => $form->getVar('descr'), 'page_content' => $form->getVar('content'), 'page_views' => '0', 'page_options' => $options, 'page_inline_css' => $page->getVar('page_inline_css')));
     if (false === $newpage->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     // 		if (false === GWF_PageGID::updateGIDs($newpage, $gstring))
     // 		{
     // 			return GWF_HTML::err('ERR_DATABASE', array(__FILE__,__LINE__));
     // 		}
     if (false === GWF_PageTags::updateTags($newpage, $tags, $form->getVar('lang'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $this->module->writeHTA()) {
         return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
     }
     if ($this->locked_mode) {
         $this->module->sendModMails();
         return $this->module->message('msg_added_locked');
     }
     if (false === GWF_PageHistory::push($newpage)) {
         GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_trans');
 }