/** * BBCode add/edit form * * @param string Type (add|edit) * @param array BBcode info * @param array Sections to edit in * @return string HTML */ public function bbcodeForm($type, $bbcode, $sections) { //----------------------------------------- // Set some of the form variables //----------------------------------------- $form_code = $type == 'edit' ? 'bbcode_doedit' : 'bbcode_doadd'; $button = $type == 'edit' ? $this->lang->words['edit_bbcode'] : $this->lang->words['addnew_bbcode']; $secure_key = ipsRegistry::getClass('adminFunctions')->getSecurityKey(); $all_groups = array(0 => array('all', $this->lang->words['all_groups'])); foreach ($this->cache->getCache('group_cache') as $group_data) { $all_groups[] = array($group_data['g_id'], $group_data['g_title']); } $ss_dropdown = array(0 => array('all', $this->lang->words['available_sections'])); if (is_array($sections) and count($sections)) { foreach ($sections as $sect_key => $sect_value) { $ss_dropdown[] = array($sect_key, $sect_value); } } $form = array(); $form['bbcode_title'] = $this->registry->output->formInput('bbcode_title', $this->request['bbcode_title'] ? $this->request['bbcode_title'] : $bbcode['bbcode_title']); $form['bbcode_desc'] = $this->registry->output->formTextarea('bbcode_desc', $this->request['bbcode_desc'] ? $this->request['bbcode_desc'] : $bbcode['bbcode_desc']); $form['bbcode_example'] = $this->registry->output->formTextarea('bbcode_example', $this->request['bbcode_example'] ? $this->request['bbcode_example'] : $bbcode['bbcode_example']); $form['bbcode_tag'] = '[ ' . $this->registry->output->formSimpleInput('bbcode_tag', $this->request['bbcode_tag'] ? $this->request['bbcode_tag'] : $bbcode['bbcode_tag'], 10) . ' ]'; $form['bbcode_useoption'] = $this->registry->output->formYesNo('bbcode_useoption', $this->request['bbcode_useoption'] ? $this->request['bbcode_useoption'] : $bbcode['bbcode_useoption']); $form['bbcode_switch_option'] = $this->registry->output->formYesNo('bbcode_switch_option', $this->request['bbcode_switch_option'] ? $this->request['bbcode_switch_option'] : $bbcode['bbcode_switch_option']); $form['bbcode_replace'] = $this->registry->output->formTextarea('bbcode_replace', htmlspecialchars($_POST['bbcode_replace'] ? $_POST['bbcode_replace'] : $bbcode['bbcode_replace'])); $form['bbcode_menu_option_text'] = $this->registry->output->formSimpleInput('bbcode_menu_option_text', $this->request['bbcode_menu_option_text'] ? $this->request['bbcode_menu_option_text'] : $bbcode['bbcode_menu_option_text'], 50); $form['bbcode_menu_content_text'] = $this->registry->output->formSimpleInput('bbcode_menu_content_text', $this->request['bbcode_menu_content_text'] ? $this->request['bbcode_menu_content_text'] : $bbcode['bbcode_menu_content_text'], 50); $form['bbcode_single_tag'] = $this->registry->output->formYesNo('bbcode_single_tag', $this->request['bbcode_single_tag'] ? $this->request['bbcode_single_tag'] : $bbcode['bbcode_single_tag']); $form['bbcode_groups'] = $this->registry->output->formMultiDropdown("bbcode_groups[]", $all_groups, $this->request['bbcode_groups'] ? $this->request['bbcode_groups'] : explode(",", $bbcode['bbcode_groups'])); $form['bbcode_sections'] = $this->registry->output->formMultiDropdown("bbcode_sections[]", $ss_dropdown, $this->request['bbcode_sections'] ? $this->request['bbcode_sections'] : explode(",", $bbcode['bbcode_sections'])); $form['bbcode_php_plugin'] = $this->registry->output->formInput('bbcode_php_plugin', $this->request['bbcode_php_plugin'] ? $this->request['bbcode_php_plugin'] : $bbcode['bbcode_php_plugin']); $form['bbcode_no_parsing'] = $this->registry->output->formYesNo('bbcode_no_parsing', $this->request['bbcode_no_parsing'] ? $this->request['bbcode_no_parsing'] : $bbcode['bbcode_no_parsing']); $form['bbcode_protected'] = $this->registry->output->formYesNo('bbcode_protected', $this->request['bbcode_protected'] ? $this->request['bbcode_protected'] : $bbcode['bbcode_protected']); $form['bbcode_custom_regex'] = $this->registry->output->formTextarea('bbcode_custom_regex', htmlspecialchars($_POST['bbcode_custom_regex'] ? $_POST['bbcode_custom_regex'] : $bbcode['bbcode_custom_regex'])); $apps = array(); /* Application drop down options */ foreach (ipsRegistry::$applications as $app_dir => $app_data) { $apps[] = array($app_dir, $app_data['app_title']); } $form['bbcode_app'] = $this->registry->output->formDropdown('bbcode_app', $apps, $this->request['bbcode_app'] ? $this->request['bbcode_app'] : $bbcode['bbcode_app']); $form['bbcode_optional_option'] = $this->registry->output->formYesNo('bbcode_optional_option', $this->request['bbcode_optional_option'] ? $this->request['bbcode_optional_option'] : $bbcode['bbcode_optional_option']); $form['bbcode_aliases'] = $this->registry->output->formTextarea('bbcode_aliases', $this->request['bbcode_aliases'] ? $this->request['bbcode_aliases'] : $bbcode['bbcode_aliases']); $form['bbcode_image'] = $this->registry->output->formInput('bbcode_image', $this->request['bbcode_image'] ? $this->request['bbcode_image'] : $bbcode['bbcode_image']); /* Content cache is enabled? */ if ($type == 'edit' and IPSContentCache::isEnabled()) { $_cacheCount = IPSContentCache::count(); $form['drop_cache'] = $this->registry->output->formYesNo('drop_cache', $this->request['drop_cache']); $this->lang->words['bbcache_action'] = sprintf($this->lang->words['bbcache_action'], $_cacheCount); } $IPBHTML = ""; //--starthtml--// $IPBHTML .= <<<EOF <div class='section_title'> \t<h2>{$this->lang->words['custom_bbcode_head']}</h2> </div> <form action='{$this->settings['base_url']}&{$this->form_code}&do={$form_code}&secure_key={$secure_key}' method='post'> <input type='hidden' name='id' value='{$bbcode['bbcode_id']}' /> EOF; if ($form['drop_cache']) { $IPBHTML .= <<<EOF \t\t<div class='warning'> \t\t <h4>{$this->lang->words['bbcache_title']}</h4> \t\t {$this->lang->words['bbcache_desc']} \t\t<p><strong>{$this->lang->words['bbcache_action']}</strong> {$form['drop_cache']}</p> \t\t</div> \t\t<br /> EOF; } $IPBHTML .= <<<EOF <div class="acp-box"> \t<h3>{$button}</h3> \t<table class='ipsTable double_pad'> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_title']}</span></td> \t\t\t<td class='field_field'>{$form['bbcode_title']}</td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_description']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_desc']} <br /><span class='desctext'>{$this->lang->words['bbcode_usedinguide']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_example']}</strong> \t\t\t<td class='field_field'>{$form['bbcode_example']}<span class='desctext'>{$this->lang->words['bbcode_usedinguide']}<br />{$this->lang->words['bbcode_example_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_tag']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_tag']} <br /><span class='desctext'>{$this->lang->words['bbcode_tag_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_aliases']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_aliases']} <br /><span class='desctext'>{$this->lang->words['bbcode_aliases_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_singletag']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_single_tag']} <br /><span class='desctext'>{$this->lang->words['bbcode_singletag_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_useoption']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_useoption']} <br /><span class='desctext'>{$this->lang->words['bbcode_useoption_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_customregex']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_custom_regex']} <br /><span class='desctext'>{$this->lang->words['bbcode_customregex_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_optional']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_optional_option']} <br /><span class='desctext'>{$this->lang->words['bbcode_optional_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_switch']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_switch_option']} <br /><span class='desctext'>{$this->lang->words['bbcode_switch_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_noparse']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_no_parsing']} <br /><span class='desctext'>{$this->lang->words['bbcode_noparse_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_replace']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_replace']} <br /><span class='desctext'>{$this->lang->words['bbcode_replace_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_php']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_php_plugin']}<br /><span class='desctext'>{$this->lang->words['bbcode_php_info_loc']} <br />{$this->lang->words['bbcode_php_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_groups']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_groups']} <br /><span class='desctext'>{$this->lang->words['bbcode_groups_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_whereused']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_sections']} <br /><span class='desctext'>{$this->lang->words['bbcode_whereused_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_assoc_app']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_app']}</td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_image']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_image']}<br /> <span class='desctext'>{$this->lang->words['bbcode_image_info_loc']} <br />{$this->lang->words['bbcode_image_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_optdial']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_menu_option_text']} <br /><span class='desctext'>{$this->lang->words['bbcode_optdial_info']}</span></td> \t\t</tr> \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_contdial']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_menu_content_text']} <br /><span class='desctext'>{$this->lang->words['bbcode_contdial_info']}</span></td> \t\t</tr> EOF; if (IN_DEV) { $IPBHTML .= <<<EOF \t\t<tr> \t\t\t<td class='field_title'><strong class='title'>{$this->lang->words['bbcode_protected']}</strong></td> \t\t\t<td class='field_field'>{$form['bbcode_protected']} <br /><span class='desctext'>{$this->lang->words['bbcode_protected_info']}</span></td> \t\t</tr> EOF; } $IPBHTML .= <<<EOF \t</table> \t<div class="acp-actionbar"> \t\t<input type='submit' value='{$button}' class="button primary" /> \t</div> </div>\t </form> EOF; //--endhtml--// return $IPBHTML; }