コード例 #1
0
 /**
  * Populate form when an error occurred
  *
  * @param	int		$cat_id		The category ID
  * @param	string	$mode		add|edit
  * @param	string	$title		Page title (depends of $mode)
  * @return	null
  */
 private function _populate_form($cat_id, $mode, $title)
 {
     global $phpbb_extension_manager;
     if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm'] && $mode == 'new') {
         $this->s_hidden_fields = array_merge($this->s_hidden_fields, $this->captcha->get_hidden_fields());
         $this->user->add_lang('ucp');
         $this->template->assign_vars(array('CAPTCHA_TEMPLATE' => $this->captcha->get_template()));
     }
     $this->user->add_lang('posting');
     if (!function_exists('display_custom_bbcodes')) {
         include $this->root_path . 'includes/functions_display.' . $this->php_ext;
     }
     display_custom_bbcodes();
     add_form_key('dir_form');
     $ext_path = $phpbb_extension_manager->get_extension_path('ernadoo/phpbbdirectory', false);
     $flag_path = $ext_path . 'images/flags/';
     $s_guest = !$this->user->data['is_registered'] || !empty($this->guest_email);
     $s_rss = $this->config['dir_activ_rss'];
     $s_banner = $this->config['dir_activ_banner'];
     $s_back = $this->categorie->data['cat_link_back'];
     $s_flag = $this->config['dir_activ_flag'];
     $this->template->assign_vars(array('BBCODE_STATUS' => $this->config['allow_bbcode'] ? $this->user->lang('BBCODE_IS_ON', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : $this->user->lang('BBCODE_IS_OFF', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->config['allow_bbcode'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'SMILIES_STATUS' => $this->config['allow_smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->config['allow_post_links'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'FLASH_STATUS' => $this->config['allow_bbcode'] && $this->config['allow_post_flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'L_TITLE' => $title, 'L_DIR_DESCRIPTION_EXP' => $this->user->lang('DIR_DESCRIPTION_EXP', $this->config['dir_length_describe']), 'L_DIR_SUBMIT_TYPE' => $this->categorie->dir_submit_type($this->categorie->need_approval()), 'L_DIR_SITE_BANN_EXP' => $this->user->lang('DIR_SITE_BANN_EXP', $this->config['dir_banner_width'], $this->config['dir_banner_height']), 'S_GUEST' => $s_guest ? true : false, 'S_RSS' => $s_rss ? true : false, 'S_BANNER' => $s_banner ? true : false, 'S_BACK' => $s_back ? true : false, 'S_FLAG' => $s_flag ? true : false, 'S_BBCODE_ALLOWED' => (bool) $this->config['allow_bbcode'], 'S_BBCODE_IMG' => (bool) $this->config['allow_bbcode'], 'S_BBCODE_FLASH' => $this->config['allow_bbcode'] && $this->config['allow_post_flash'] ? true : false, 'S_BBCODE_QUOTE' => true, 'S_LINKS_ALLOWED' => (bool) $this->config['allow_post_links'], 'DIR_FLAG_PATH' => $flag_path, 'DIR_FLAG_IMAGE' => $this->flag ? $this->dir_helper->get_img_path('flags', $this->flag) : '', 'EDIT_MODE' => $mode == 'edit' ? true : false, 'SITE_NAME' => isset($this->site_name) ? $this->site_name : '', 'SITE_URL' => isset($this->url) ? $this->url : '', 'DESCRIPTION' => isset($this->description) ? $this->description : '', 'GUEST_EMAIL' => isset($this->guest_email) ? $this->guest_email : '', 'RSS' => isset($this->rss) ? $this->rss : '', 'BANNER' => isset($this->banner) ? $this->banner : '', 'BACK' => isset($this->back) ? $this->back : '', 'S_POST_ACTION' => '', 'S_CATLIST' => $this->categorie->make_cat_select($cat_id), 'S_LIST_FLAG' => $this->link->get_dir_flag_list($flag_path, $this->flag), 'S_DESC_STAR' => @$this->categorie->data['cat_must_describe'] ? '*' : '', 'S_ROOT' => $cat_id, 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields)));
 }