public function execute() { if (false !== ($mod_forum = GWF_Module::getModule('Forum', true))) { $mod_forum->onInclude(); GWF_ForumBoard::init(false); } if (false !== Common::getPost('quicktranslate')) { return $this->onQuickTranslate(); } $newsid = (int) Common::getGet('newsid', '0'); $langid = (int) Common::getGet('langid', '0'); if (false === ($news = GWF_News::getNewsItem($newsid))) { return $this->module->error('err_news'); } // if (false === ($news->loadTranslations())) { // return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); // } if (false === ($lang = GWF_Language::getByID($langid))) { return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); } if (!GWF_Language::isSupported($langid)) { return GWF_HTML::err('ERR_UNKNOWN_LANGUAGE'); } $this->news = $news; $this->lang = $lang; if (false !== Common::getPost('edit')) { return $this->onEdit() . $this->templateEdit(); } if (false !== Common::getPost('translate')) { return $this->onTranslate(); } if (false !== Common::getPost('preview')) { return $this->onPreview(); } return $this->templateEdit(); }
public function validate_langid(Module_News $module, $langid) { return GWF_Language::isSupported($langid) ? false : $module->lang('err_langtrans'); }