diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-03 15:59:06 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-29 02:14:38 +0200 |
commit | d3f65cd66e4c3cbf2a8af45a7db99b40d0153214 (patch) | |
tree | 1bd3499e6ce936d887dde32543b046031f470b08 /phpBB/includes/acp/acp_contact.php | |
parent | deee3be9ef34e3760428291d165aee33b05a68c3 (diff) | |
download | forums-d3f65cd66e4c3cbf2a8af45a7db99b40d0153214.tar forums-d3f65cd66e4c3cbf2a8af45a7db99b40d0153214.tar.gz forums-d3f65cd66e4c3cbf2a8af45a7db99b40d0153214.tar.bz2 forums-d3f65cd66e4c3cbf2a8af45a7db99b40d0153214.tar.xz forums-d3f65cd66e4c3cbf2a8af45a7db99b40d0153214.zip |
[ticket/10073] Add ACP module to add bbcode text for contact admin info
PHPBB3-10073
Diffstat (limited to 'phpBB/includes/acp/acp_contact.php')
-rw-r--r-- | phpBB/includes/acp/acp_contact.php | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/phpBB/includes/acp/acp_contact.php b/phpBB/includes/acp/acp_contact.php new file mode 100644 index 0000000000..21807082fc --- /dev/null +++ b/phpBB/includes/acp/acp_contact.php @@ -0,0 +1,118 @@ +<?php +/** +* +* @package acp +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* @package acp +*/ +class acp_contact +{ + public $u_action; + + public function main($id, $mode) + { + global $db, $user, $request, $template; + global $config, $phpbb_root_path, $phpEx; + + $user->add_lang(array('acp/board', 'posting')); + + $this->tpl_name = 'acp_contact'; + $this->page_title = 'ACP_CONTACT_SETTINGS'; + $form_name = 'acp_contact'; + add_form_key($form_name); + $error = ''; + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + $config_text = new \phpbb\config\db_text($db, CONFIG_TEXT_TABLE); + + $contact_admin_info = $request->variable('contact_admin_info', $config_text->get('contact_admin_info'), true); + $contact_admin_info_uid = $config['contact_admin_info_uid']; + $contact_admin_info_bitfield= $config['contact_admin_info_bitfield']; + $contact_admin_info_flags = $config['contact_admin_info_flags']; + + if ($request->is_set_post('submit') || $request->is_set_post('preview')) + { + if (!check_form_key($form_name)) + { + $error = $user->lang('FORM_INVALID'); + } + + generate_text_for_storage( + $contact_admin_info, + $contact_admin_info_uid, + $contact_admin_info_bitfield, + $contact_admin_info_flags, + !$request->variable('disable_bbcode', false), + !$request->variable('disable_magic_url', false), + !$request->variable('disable_smilies', false) + ); + + if (empty($error) && $request->is_set_post('submit')) + { + $config->set('contact_admin_form_enable', $request->variable('contact_admin_form_enable', false)); + + $config_text->set('contact_admin_info', $contact_admin_info); + $config->set('contact_admin_info_uid', $contact_admin_info_uid); + $config->set('contact_admin_info_bitfield', $contact_admin_info_bitfield); + $config->set('contact_admin_info_flags', $contact_admin_info_flags); + + trigger_error($user->lang['CONTACT_US_INFO_UPDATED'] . adm_back_link($this->u_action)); + } + } + + $contact_admin_info_preview = ''; + if ($request->is_set_post('preview')) + { + $contact_admin_info_preview = generate_text_for_display($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags); + } + + $contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags); + + $template->assign_vars(array( + 'ERRORS' => $error, + 'CONTACT_ENABLED' => $config['contact_admin_form_enable'], + + 'CONTACT_US_INFO' => $contact_admin_edit['text'], + 'CONTACT_US_INFO_PREVIEW' => $contact_admin_info_preview, + + 'S_BBCODE_CHECKED' => (!$contact_admin_edit['allow_bbcode']) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$contact_admin_edit['allow_smilies']) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$contact_admin_edit['allow_urls']) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), + 'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'], + 'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'], + 'FLASH_STATUS' => $user->lang['FLASH_IS_ON'], + 'URL_STATUS' => $user->lang['URL_IS_ON'], + + 'S_BBCODE_ALLOWED' => true, + 'S_SMILIES_ALLOWED' => true, + 'S_BBCODE_IMG' => true, + 'S_BBCODE_FLASH' => true, + 'S_LINKS_ALLOWED' => true, + )); + + // Assigning custom bbcodes + display_custom_bbcodes(); + } +} |