Example #1
0
 private function formEdit()
 {
     $mod_cat = GWF_Module::loadModuleDB('Category', true, true);
     $page = $this->page;
     $user = $this->user;
     $data = array();
     $data['url'] = array(GWF_Form::STRING, $page->getVar('page_url'), $this->module->lang('th_url'));
     // 		if ($this->is_author)
     // 		{
     $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module, $page->getMode()), $this->module->lang('th_type'));
     // 		}
     if ($this->is_oowner) {
         $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', $this->getSelectedGroups($page), true, true), $this->module->lang('th_groups'));
     }
     $data['noguests'] = array(GWF_Form::CHECKBOX, $page->isLoginRequired(), $this->module->lang('th_noguests'));
     if ($this->is_author) {
         $data['index'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::INDEXED), $this->module->lang('th_index'));
         $data['follow'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::FOLLOW), $this->module->lang('th_follow'));
         $data['sitemap'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::IN_SITEMAP), $this->module->lang('th_in_sitemap'));
     }
     $data['enabled'] = array(GWF_Form::CHECKBOX, $page->isEnabled(), $this->module->lang('th_enabled'));
     $data['title'] = array(GWF_Form::STRING, $page->getVar('page_title'), $this->module->lang('th_title'));
     if ($mod_cat !== false) {
         $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat'));
     }
     $data['descr'] = array(GWF_Form::STRING, $page->getVar('page_meta_desc'), $this->module->lang('th_descr'));
     $data['tags'] = array(GWF_Form::STRING, trim($page->getVar('page_meta_tags'), ','), $this->module->lang('th_tags'));
     $data['show_author'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_AUTHOR), $this->module->lang('th_show_author'));
     $data['show_similar'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_SIMILAR), $this->module->lang('th_show_similar'));
     $data['show_modified'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_MODIFIED), $this->module->lang('th_show_modified'));
     $data['show_trans'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_TRANS), $this->module->lang('th_show_trans'));
     $data['show_comments'] = array(GWF_Form::CHECKBOX, $page->wantComments(), $this->module->lang('th_show_comments'));
     if ($this->is_author) {
         $data['home_page'] = array(GWF_Form::CHECKBOX, $this->module->cfgHomePage() === $page->getOtherID(), $this->module->lang('th_home_page'));
     }
     $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file'));
     $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload'));
     if ($this->is_author) {
         $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_inline_css'), $this->module->lang('th_inline_css'));
     }
     if ($page->getMode() === GWF_Page::BBCODE) {
         $data['content'] = array(GWF_Form::MESSAGE, $page->getVar('page_content'), $this->module->lang('th_content'));
     } else {
         $data['content'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_content'), $this->module->lang('th_content'));
     }
     $buttons = array('edit' => $this->module->lang('btn_edit'), 'translate' => $this->module->lang('btn_translate'));
     if ($this->is_author && $page->isLocked()) {
         $buttons['unlock'] = $this->module->lang('btn_unlock');
     }
     $buttons['delete'] = $this->module->lang('btn_delete');
     $data['buttons'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }
Example #2
0
 private function getForm(GWF_VoteMulti $poll, GWF_User $user)
 {
     $data = array();
     $data['title'] = array(GWF_Form::STRING, $poll->getVar('vm_title'), $this->module->lang('th_title'));
     $data['guest'] = array(GWF_Form::CHECKBOX, $poll->isGuestVoteAllowed(), $this->module->lang('th_guests'));
     $data['multi'] = array(GWF_Form::CHECKBOX, $poll->isMultipleChoice(), $this->module->lang('th_multi'));
     $data['enabled'] = array(GWF_Form::CHECKBOX, $poll->isEnabled(), $this->module->lang('th_enabled'));
     if (Module_Votes::mayAddGlobalPoll(GWF_Session::getUser())) {
         $data['public'] = array(GWF_Form::CHECKBOX, $poll->isGlobal(), $this->module->lang('th_vm_public'));
     }
     $data['view'] = array(GWF_Form::SELECT, GWF_VoteMulti::getViewSelect($this->module, 'view', $poll->getViewFlag()), $this->module->lang('th_mvview'));
     $data['gid'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('gid', $poll->getGroupID(), true, true), $this->module->lang('th_vm_gid'));
     $data['level'] = array(GWF_Form::INT, $poll->getLevel(), $this->module->lang('th_vm_level'));
     $data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit'));
     return new GWF_Form($this, $data);
 }
Example #3
0
 private function getForm()
 {
     $tags = Common::getPostString('link_tags', Common::getGet('tag'));
     $data = array('link_lang' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_LangSelect::TYPE_SUPPORTED, 'link_lang'), $this->module->lang('th_link_lang')), 'link_score' => array(GWF_Form::STRING, '0', $this->module->lang('th_link_score'), $this->module->lang('tt_link_score')), 'link_gid' => array(GWF_Form::SELECT, GWF_GroupSelect::single('link_gid'), $this->module->lang('th_link_gid'), $this->module->lang('tt_link_gid')), 'tag_info' => array(GWF_Form::HEADLINE, '', $this->module->lang('info_tag')), 'known_tags' => array(GWF_Form::HEADLINE, '', $this->collectTags()), 'link_tags' => array(GWF_Form::STRING, $tags, $this->module->lang('th_link_tags')), 'div1' => array(GWF_Form::DIVIDER), 'link_href' => array(GWF_Form::STRING, '', $this->module->lang('th_link_href'), $this->module->lang('tt_link_href')), 'link_descr' => array(GWF_Form::STRING, '', $this->module->lang('th_link_descr')));
     if ($this->module->cfgLongDescription()) {
         $data['link_descr2'] = array(GWF_Form::MESSAGE, '', $this->module->lang('th_link_descr2'));
     }
     $data['link_options&' . GWF_Links::MEMBER_LINK] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::MEMBER_LINK]), $this->module->lang('th_link_options&' . GWF_Links::MEMBER_LINK));
     if (GWF_User::isLoggedIn()) {
         $data['link_options&' . GWF_Links::UNAFILIATE] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::UNAFILIATE]), $this->module->lang('th_link_options&' . GWF_Links::UNAFILIATE));
         $data['link_options&' . GWF_Links::ONLY_PRIVATE] = array(GWF_Form::CHECKBOX, isset($_POST['link_options&' . GWF_Links::ONLY_PRIVATE]), $this->module->lang('th_link_options&' . GWF_Links::ONLY_PRIVATE));
     }
     if (!GWF_Session::isLoggedIn() && $this->module->cfgGuestCaptcha()) {
         $data['captcha'] = array(GWF_Form::CAPTCHA);
     }
     $data['buttons'] = array(GWF_Form::SUBMITS, array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add')));
     return new GWF_Form($this, $data);
 }
Example #4
0
 private function getForm()
 {
     $l = $this->link;
     $data = array('link_score' => array(GWF_Form::STRING, $l->getVar('link_score'), $this->module->lang('th_link_score'), $this->module->lang('tt_link_score')), 'link_gid' => array(GWF_Form::SELECT, GWF_GroupSelect::single('link_gid', $l->getGroupID(), true, true), $this->module->lang('th_link_gid'), $this->module->lang('tt_link_gid')), 'tag_info' => array(GWF_Form::HEADLINE, '', $this->module->lang('info_tag')), 'known_tags' => array(GWF_Form::HEADLINE, '', $this->collectTags()), 'link_tags' => array(GWF_Form::STRING, $l->getVar('link_tags'), $this->module->lang('th_link_tags')), 'div1' => array(GWF_Form::DIVIDER), 'link_href' => array(GWF_Form::STRING, $l->getVar('link_href'), $this->module->lang('th_link_href'), $this->module->lang('tt_link_href')), 'link_descr' => array(GWF_Form::STRING, $l->getVar('link_descr'), $this->module->lang('th_link_descr')));
     if ($this->module->cfgLongDescription()) {
         $data['link_descr2'] = array(GWF_Form::MESSAGE, $l->display('link_descr2'), $this->module->lang('th_link_descr2'));
     }
     $data['link_options&' . GWF_Links::UNAFILIATE] = array(GWF_Form::CHECKBOX, $l->isUnafiliated(), $this->module->lang('th_link_options&' . GWF_Links::UNAFILIATE));
     $data['link_options&' . GWF_Links::MEMBER_LINK] = array(GWF_Form::CHECKBOX, $l->isMemberLink(), $this->module->lang('th_link_options&' . GWF_Links::MEMBER_LINK));
     $data['link_options&' . GWF_Links::ONLY_PRIVATE] = array(GWF_Form::CHECKBOX, $l->isPrivate(), $this->module->lang('th_link_options&' . GWF_Links::ONLY_PRIVATE));
     if (GWF_User::isStaffS()) {
         $data['link_options&' . GWF_Links::STICKY] = array(GWF_Form::CHECKBOX, $l->isSticky(), $this->module->lang('th_link_options&' . GWF_Links::STICKY));
         $data['link_options&' . GWF_Links::IN_MODERATION] = array(GWF_Form::CHECKBOX, $l->isInModeration(), $this->module->lang('th_link_options&' . GWF_Links::IN_MODERATION));
     }
     $data['edit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_edit'), '');
     $data['delete'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_delete'), '');
     return new GWF_Form($this, $data);
 }
Example #5
0
 private function getForm(GWF_Download $dl)
 {
     $data = array();
     $data['filename'] = array(GWF_Form::STRING, $dl->getVar('dl_filename'), $this->module->lang('th_dl_filename'));
     $data['group'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('group', $dl->getVar('dl_gid')), $this->module->lang('th_dl_gid'));
     $data['level'] = array(GWF_Form::INT, $dl->getVar('dl_level'), $this->module->lang('th_dl_level'));
     if (GWF_User::isAdminS()) {
         $data['price'] = array(GWF_Form::FLOAT, $dl->getVar('dl_price'), $this->module->lang('th_dl_price'));
     }
     $data['expire'] = array(GWF_Form::STRING, GWF_Time::humanDuration($dl->getVar('dl_expire')), $this->module->lang('th_dl_expire'), $this->module->lang('tt_dl_expire'));
     $data['guest_view'] = array(GWF_Form::CHECKBOX, $dl->isOptionEnabled(GWF_Download::GUEST_VISIBLE), $this->module->lang('th_dl_guest_view'), $this->module->lang('tt_dl_guest_view'));
     $data['guest_down'] = array(GWF_Form::CHECKBOX, $dl->isOptionEnabled(GWF_Download::GUEST_DOWNLOAD), $this->module->lang('th_dl_guest_down'), $this->module->lang('tt_dl_guest_down'));
     $data['adult'] = array(GWF_Form::CHECKBOX, $dl->isOptionEnabled(GWF_Download::ADULT), $this->module->lang('th_adult'));
     $data['huname'] = array(GWF_Form::CHECKBOX, $dl->isOptionEnabled(GWF_Download::HIDE_UNAME), $this->module->lang('th_huname'));
     $data['enabled'] = array(GWF_Form::CHECKBOX, $dl->isEnabled(), $this->module->lang('th_enabled'));
     $data['descr'] = array(GWF_Form::MESSAGE, $dl->getVar('dl_descr'), $this->module->lang('th_dl_descr'));
     $data['buttons'] = array(GWF_Form::SUBMITS, array('edit' => $this->module->lang('btn_edit'), 'delete' => $this->module->lang('btn_delete')));
     return new GWF_Form($this, $data);
 }
Example #6
0
 private function getForm()
 {
     $data = array();
     if (false === ($file = $this->getFile())) {
         $name = '';
         $size = '';
     } else {
         $_POST['filename'] = $name = $file['name'];
         $size = $file['size'];
     }
     $data['filename'] = array(GWF_Form::STRING, $name, $this->module->lang('th_dl_filename'));
     if ($file === false) {
         $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file'));
         if (GWF_User::isLoggedIn()) {
             $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload'));
         }
     } else {
         $data['size'] = array(GWF_Form::SSTRING, $size, $this->module->lang('th_dl_size'));
         $data['remove'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_remove'));
     }
     $data['group'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('group', Common::getPost('group')), $this->module->lang('th_dl_gid'));
     $data['level'] = array(GWF_Form::INT, '0', $this->module->lang('th_dl_level'));
     if (GWF_User::isAdminS()) {
         $data['price'] = array(GWF_Form::FLOAT, '0.00', $this->module->lang('th_dl_price'));
     }
     $data['expire'] = array(GWF_Form::STRING, '0 seconds', $this->module->lang('th_dl_expire'), $this->module->lang('tt_dl_expire'));
     $data['guest_view'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_dl_guest_view'), $this->module->lang('tt_dl_guest_view'));
     $data['guest_down'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_dl_guest_down'), $this->module->lang('tt_dl_guest_down'));
     $data['adult'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_adult'));
     if (GWF_User::isLoggedIn()) {
         $data['huname'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_huname'));
     }
     $data['descr'] = array(GWF_Form::MESSAGE, '', $this->module->lang('th_dl_descr'));
     if (!GWF_User::isLoggedIn() && $this->module->cfgGuestCaptcha()) {
         $data['captcha'] = array(GWF_Form::CAPTCHA);
     }
     $data['add'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_add'));
     return new GWF_Form($this, $data);
 }
Example #7
0
 public function getForm()
 {
     $data = array('opt' => array(GWF_Form::VALIDATOR));
     $buttons = array('add_opt' => $this->module->lang('btn_add_opt'), 'rem_opts' => $this->module->lang('btn_rem_opts'), 'create' => $this->module->lang('btn_create'));
     $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title'));
     $data['reverse'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_reverse'));
     $data['multi'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_multi'));
     $data['guests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_guests'));
     if (Module_Votes::mayAddGlobalPoll(GWF_Session::getUser())) {
         $data['public'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_vm_public'));
     }
     $data['view'] = array(GWF_Form::SELECT, GWF_VoteMulti::getViewSelect($this->module, 'view', intval(Common::getPost('view', GWF_VoteMulti::SHOW_RESULT_VOTED))), $this->module->lang('th_mvview'));
     $data['gid'] = array(GWF_Form::SELECT, GWF_GroupSelect::single('gid', Common::getPostString('gid', '0')), $this->module->lang('th_vm_gid'));
     $data['level'] = array(GWF_Form::INT, '0', $this->module->lang('th_vm_level'));
     $i = 1;
     foreach (GWF_Session::getOrDefault(self::SESS_OPTIONS, array()) as $item) {
         $data['opt[' . $i . ']'] = array(GWF_Form::STRING, $item, $this->module->lang('th_option', array($i)));
         $i++;
     }
     $data['cmds'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }
Example #8
0
 private function formAdd()
 {
     $mod_cat = GWF_Module::loadModuleDB('Category', true, true);
     $data = array();
     $data['url'] = array(GWF_Form::STRING, '', $this->module->lang('th_url'));
     $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module), $this->module->lang('th_type'));
     $data['lang'] = array(GWF_Form::SELECT, GWF_LangSelect::single(1, 'lang'), $this->module->lang('th_lang'));
     $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', true, true, true), $this->module->lang('th_groups'));
     $data['noguests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_noguests'));
     if ($this->is_author) {
         $data['index'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_index'));
         $data['follow'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_follow'));
         $data['sitemap'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_in_sitemap'));
     }
     $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title'));
     if ($mod_cat !== false) {
         $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat'));
     }
     $data['descr'] = array(GWF_Form::STRING, '', $this->module->lang('th_descr'));
     $data['tags'] = array(GWF_Form::STRING, '', $this->module->lang('th_tags'));
     $data['show_author'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_author'));
     $data['show_similar'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_similar'));
     $data['show_modified'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_modified'));
     $data['show_trans'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_trans'));
     $data['show_comments'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_comments'));
     if ($this->is_author) {
         $data['home_page'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_home_page'));
     }
     $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file'));
     $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload'));
     if ($this->is_author) {
         $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_inline_css'));
     }
     $data['content'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_content'));
     $buttons = array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add'));
     $data['buttons'] = array(GWF_Form::SUBMITS, $buttons);
     return new GWF_Form($this, $data);
 }
Example #9
0
 public function getGroupSelect($selected = '0', $name = 'groupid')
 {
     return GWF_GroupSelect::single($name, $selected, true, false);
 }
Example #10
0
 public function validate_join(Module_Admin $m, $arg)
 {
     return GWF_GroupSelect::isValidJoinFlag((int) $arg) ? false : $m->lang('err_group_join');
 }