mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
Merge pull request #3434 from nickvergessen/ticket/13647
[ticket/13647] Move FAQ page to a controller
This commit is contained in:
commit
7c26cd25c7
13 changed files with 217 additions and 96 deletions
|
@ -8,6 +8,7 @@ imports:
|
||||||
- { resource: services_db.yml }
|
- { resource: services_db.yml }
|
||||||
- { resource: services_event.yml }
|
- { resource: services_event.yml }
|
||||||
- { resource: services_feed.yml }
|
- { resource: services_feed.yml }
|
||||||
|
- { resource: services_help.yml }
|
||||||
- { resource: services_mimetype_guesser.yml }
|
- { resource: services_mimetype_guesser.yml }
|
||||||
- { resource: services_notification.yml }
|
- { resource: services_notification.yml }
|
||||||
- { resource: services_password.yml }
|
- { resource: services_password.yml }
|
||||||
|
|
10
phpBB/config/default/container/services_help.yml
Normal file
10
phpBB/config/default/container/services_help.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
services:
|
||||||
|
phpbb.help.controller:
|
||||||
|
class: phpbb\help\controller\help
|
||||||
|
arguments:
|
||||||
|
- @controller.helper
|
||||||
|
- @dispatcher
|
||||||
|
- @template
|
||||||
|
- @user
|
||||||
|
- %core.root_path%
|
||||||
|
- %core.php_ext%
|
3
phpBB/config/default/routing/help.yml
Normal file
3
phpBB/config/default/routing/help.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
phpbb_help_controller:
|
||||||
|
path: /{mode}
|
||||||
|
defaults: { _controller: phpbb.help.controller:handle }
|
|
@ -7,3 +7,7 @@
|
||||||
# The above will be accessed via app.php?controller=foo and it will
|
# The above will be accessed via app.php?controller=foo and it will
|
||||||
# instantiate the "foo_service" service and call the "method" method.
|
# instantiate the "foo_service" service and call the "method" method.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
phpbb_help_routing:
|
||||||
|
resource: "help.yml"
|
||||||
|
prefix: /help
|
||||||
|
|
|
@ -24,90 +24,12 @@ $user->session_begin();
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
$user->setup();
|
$user->setup();
|
||||||
|
|
||||||
$mode = $request->variable('mode', '');
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
// Load the appropriate faq file
|
$response = new \Symfony\Component\HttpFoundation\RedirectResponse(
|
||||||
switch ($mode)
|
$controller_helper->route('phpbb_help_controller', array(
|
||||||
{
|
'mode' => $request->variable('mode', 'faq'),
|
||||||
case 'bbcode':
|
), 301)
|
||||||
$l_title = $user->lang['BBCODE_GUIDE'];
|
|
||||||
$user->add_lang('bbcode', false, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$page_title = $user->lang['FAQ_EXPLAIN'];
|
|
||||||
$ext_name = $lang_file = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* You can use this event display a custom help page
|
|
||||||
*
|
|
||||||
* @event core.faq_mode_validation
|
|
||||||
* @var string page_title Title of the page
|
|
||||||
* @var string mode FAQ that is going to be displayed
|
|
||||||
* @var string lang_file Language file containing the help data
|
|
||||||
* @var string ext_name Vendor and extension name where the help
|
|
||||||
* language file can be loaded from
|
|
||||||
* @since 3.1.4-RC1
|
|
||||||
*/
|
|
||||||
$vars = array(
|
|
||||||
'page_title',
|
|
||||||
'mode',
|
|
||||||
'lang_file',
|
|
||||||
'ext_name',
|
|
||||||
);
|
|
||||||
extract($phpbb_dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
|
|
||||||
|
|
||||||
$l_title = $page_title;
|
|
||||||
$user->add_lang(($lang_file) ? $lang_file : 'faq', false, true, $ext_name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pull the array data from the lang pack
|
|
||||||
$switch_column = $found_switch = false;
|
|
||||||
$help_blocks = array();
|
|
||||||
foreach ($user->help as $help_ary)
|
|
||||||
{
|
|
||||||
if ($help_ary[0] == '--')
|
|
||||||
{
|
|
||||||
if ($help_ary[1] == '--')
|
|
||||||
{
|
|
||||||
$switch_column = true;
|
|
||||||
$found_switch = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('faq_block', array(
|
|
||||||
'BLOCK_TITLE' => $help_ary[1],
|
|
||||||
'SWITCH_COLUMN' => $switch_column,
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($switch_column)
|
|
||||||
{
|
|
||||||
$switch_column = false;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$template->assign_block_vars('faq_block.faq_row', array(
|
|
||||||
'FAQ_QUESTION' => $help_ary[0],
|
|
||||||
'FAQ_ANSWER' => $help_ary[1])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lets build a page ...
|
|
||||||
$template->assign_vars(array(
|
|
||||||
'L_FAQ_TITLE' => $l_title,
|
|
||||||
'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'],
|
|
||||||
|
|
||||||
'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false,
|
|
||||||
'S_IN_FAQ' => true,
|
|
||||||
));
|
|
||||||
|
|
||||||
page_header($l_title);
|
|
||||||
|
|
||||||
$template->set_filenames(array(
|
|
||||||
'body' => 'faq_body.html')
|
|
||||||
);
|
);
|
||||||
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
|
$response->send();
|
||||||
|
|
||||||
page_footer();
|
|
||||||
|
|
|
@ -105,6 +105,9 @@ class acp_contact
|
||||||
|
|
||||||
$contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags);
|
$contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags);
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'ERRORS' => $error,
|
'ERRORS' => $error,
|
||||||
'CONTACT_ENABLED' => $config['contact_admin_form_enable'],
|
'CONTACT_ENABLED' => $config['contact_admin_form_enable'],
|
||||||
|
@ -116,7 +119,7 @@ class acp_contact
|
||||||
'S_SMILIES_DISABLE_CHECKED' => !$contact_admin_edit['allow_smilies'],
|
'S_SMILIES_DISABLE_CHECKED' => !$contact_admin_edit['allow_smilies'],
|
||||||
'S_MAGIC_URL_DISABLE_CHECKED' => !$contact_admin_edit['allow_urls'],
|
'S_MAGIC_URL_DISABLE_CHECKED' => !$contact_admin_edit['allow_urls'],
|
||||||
|
|
||||||
'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . $controller_helper->route('phpbb_help_controller', array('mode' => 'bbcode')) . '">', '</a>'),
|
||||||
'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'],
|
'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'],
|
||||||
'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'],
|
'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'],
|
||||||
'FLASH_STATUS' => $user->lang['FLASH_IS_ON'],
|
'FLASH_STATUS' => $user->lang['FLASH_IS_ON'],
|
||||||
|
|
|
@ -2019,6 +2019,9 @@ class acp_users
|
||||||
|
|
||||||
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);
|
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_SIGNATURE' => true,
|
'S_SIGNATURE' => true,
|
||||||
|
|
||||||
|
@ -2029,7 +2032,7 @@ class acp_users
|
||||||
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
|
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
|
||||||
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
|
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
|
||||||
|
|
||||||
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_controller', array('mode' => 'bbcode')) . '">', '</a>'),
|
||||||
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||||
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||||
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
||||||
|
|
|
@ -4862,6 +4862,8 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
$notification_mark_hash = generate_link_hash('mark_all_notifications_read');
|
$notification_mark_hash = generate_link_hash('mark_all_notifications_read');
|
||||||
|
|
||||||
// The following assigns all _common_ variables that may be used at any point in a template.
|
// The following assigns all _common_ variables that may be used at any point in a template.
|
||||||
|
@ -4915,7 +4917,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
|
||||||
'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"),
|
'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"),
|
||||||
'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
|
'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']),
|
||||||
'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id),
|
'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id),
|
||||||
'U_FAQ' => append_sid("{$phpbb_root_path}faq.$phpEx"),
|
'U_FAQ' => $controller_helper->route('phpbb_help_controller', array('mode' => 'faq')),
|
||||||
'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'),
|
'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'),
|
||||||
'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'),
|
'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'),
|
||||||
'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
|
'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'),
|
||||||
|
|
|
@ -1120,6 +1120,9 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
|
|
||||||
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';
|
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
// Start assigning vars for main posting page ...
|
// Start assigning vars for main posting page ...
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_POST_A' => $page_title,
|
'L_POST_A' => $page_title,
|
||||||
|
@ -1128,7 +1131,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
|
||||||
|
|
||||||
'SUBJECT' => (isset($message_subject)) ? $message_subject : '',
|
'SUBJECT' => (isset($message_subject)) ? $message_subject : '',
|
||||||
'MESSAGE' => $message_text,
|
'MESSAGE' => $message_text,
|
||||||
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_controller', array('mode' => 'bbcode')) . '">', '</a>'),
|
||||||
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||||
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
||||||
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||||
|
|
|
@ -548,6 +548,9 @@ class ucp_profile
|
||||||
|
|
||||||
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);
|
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
||||||
'SIGNATURE' => $decoded_message['text'],
|
'SIGNATURE' => $decoded_message['text'],
|
||||||
|
@ -557,7 +560,7 @@ class ucp_profile
|
||||||
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
|
'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '',
|
||||||
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
|
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '',
|
||||||
|
|
||||||
'BBCODE_STATUS' => ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_controller', array('mode' => 'bbcode')) . '">', '</a>'),
|
||||||
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||||
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||||
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
||||||
|
|
160
phpBB/phpbb/help/controller/help.php
Normal file
160
phpBB/phpbb/help/controller/help.php
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\help\controller;
|
||||||
|
|
||||||
|
use phpbb\exception\http_exception;
|
||||||
|
|
||||||
|
class help
|
||||||
|
{
|
||||||
|
/** @var \phpbb\controller\helper */
|
||||||
|
protected $helper;
|
||||||
|
|
||||||
|
/** @var \phpbb\event\dispatcher_interface */
|
||||||
|
protected $dispatcher;
|
||||||
|
|
||||||
|
/** @var \phpbb\template\template */
|
||||||
|
protected $template;
|
||||||
|
|
||||||
|
/** @var \phpbb\user */
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $root_path;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param \phpbb\controller\helper $helper
|
||||||
|
* @param \phpbb\event\dispatcher_interface $dispatcher
|
||||||
|
* @param \phpbb\template\template $template
|
||||||
|
* @param \phpbb\user $user
|
||||||
|
* @param string $root_path
|
||||||
|
* @param string $php_ext
|
||||||
|
*/
|
||||||
|
public function __construct(\phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\template\template $template, \phpbb\user $user, $root_path, $php_ext)
|
||||||
|
{
|
||||||
|
$this->helper = $helper;
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
|
$this->template = $template;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->root_path = $root_path;
|
||||||
|
$this->php_ext = $php_ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for /help/{mode} routes
|
||||||
|
*
|
||||||
|
* @param string $mode
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
|
||||||
|
* @throws http_exception when the $mode is not known by any extension
|
||||||
|
*/
|
||||||
|
public function handle($mode)
|
||||||
|
{
|
||||||
|
switch ($mode)
|
||||||
|
{
|
||||||
|
case 'faq':
|
||||||
|
case 'bbcode':
|
||||||
|
$page_title = ($mode === 'faq') ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
|
||||||
|
$this->user->add_lang($mode, false, true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$page_title = $this->user->lang['FAQ_EXPLAIN'];
|
||||||
|
$ext_name = $lang_file = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You can use this event display a custom help page
|
||||||
|
*
|
||||||
|
* @event core.faq_mode_validation
|
||||||
|
* @var string page_title Title of the page
|
||||||
|
* @var string mode FAQ that is going to be displayed
|
||||||
|
* @var string lang_file Language file containing the help data
|
||||||
|
* @var string ext_name Vendor and extension name where the help
|
||||||
|
* language file can be loaded from
|
||||||
|
* @since 3.1.4-RC1
|
||||||
|
*/
|
||||||
|
$vars = array(
|
||||||
|
'page_title',
|
||||||
|
'mode',
|
||||||
|
'lang_file',
|
||||||
|
'ext_name',
|
||||||
|
);
|
||||||
|
extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
|
||||||
|
|
||||||
|
if ($ext_name === '' || $lang_file === '')
|
||||||
|
{
|
||||||
|
throw new http_exception(404, 'Not Found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->user->add_lang($lang_file, false, true, $ext_name);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->assign_vars(array(
|
||||||
|
'L_FAQ_TITLE' => $page_title,
|
||||||
|
'S_IN_FAQ' => true,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assign_to_template($this->user->help);
|
||||||
|
|
||||||
|
make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
|
||||||
|
return $this->helper->render('faq_body.html', $page_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns the help data to the template blocks
|
||||||
|
*
|
||||||
|
* @param array $help_data
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
protected function assign_to_template(array $help_data)
|
||||||
|
{
|
||||||
|
// Pull the array data from the lang pack
|
||||||
|
$switch_column = $found_switch = false;
|
||||||
|
foreach ($help_data as $help_ary)
|
||||||
|
{
|
||||||
|
if ($help_ary[0] == '--')
|
||||||
|
{
|
||||||
|
if ($help_ary[1] == '--')
|
||||||
|
{
|
||||||
|
$switch_column = true;
|
||||||
|
$found_switch = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->assign_block_vars('faq_block', array(
|
||||||
|
'BLOCK_TITLE' => $help_ary[1],
|
||||||
|
'SWITCH_COLUMN' => $switch_column,
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($switch_column)
|
||||||
|
{
|
||||||
|
$switch_column = false;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->assign_block_vars('faq_block.faq_row', array(
|
||||||
|
'FAQ_QUESTION' => $help_ary[0],
|
||||||
|
'FAQ_ANSWER' => $help_ary[1],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->assign_var('SWITCH_COLUMN_MANUALLY', !$found_switch);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1720,6 +1720,8 @@ if (isset($captcha) && $captcha->is_solved() !== false)
|
||||||
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
|
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
|
||||||
add_form_key('posting');
|
add_form_key('posting');
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
// Build array of variables for main posting page
|
// Build array of variables for main posting page
|
||||||
$page_data = array(
|
$page_data = array(
|
||||||
|
@ -1734,7 +1736,7 @@ $page_data = array(
|
||||||
'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
|
'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
|
||||||
'SUBJECT' => $post_data['post_subject'],
|
'SUBJECT' => $post_data['post_subject'],
|
||||||
'MESSAGE' => $post_data['post_text'],
|
'MESSAGE' => $post_data['post_text'],
|
||||||
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
|
'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_controller', array('mode' => 'bbcode')) . '">', '</a>'),
|
||||||
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
|
||||||
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
|
||||||
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
|
||||||
|
|
|
@ -163,6 +163,9 @@ $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
|
||||||
$prev_id = $prev_ip = $user_list = array();
|
$prev_id = $prev_ip = $user_list = array();
|
||||||
$logged_visible_online = $logged_hidden_online = $counter = 0;
|
$logged_visible_online = $logged_hidden_online = $counter = 0;
|
||||||
|
|
||||||
|
/** @var \phpbb\controller\helper $controller_helper */
|
||||||
|
$controller_helper = $phpbb_container->get('controller.helper');
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']]))
|
if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']]))
|
||||||
|
@ -287,11 +290,6 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
$location_url = append_sid("{$phpbb_root_path}search.$phpEx");
|
$location_url = append_sid("{$phpbb_root_path}search.$phpEx");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'faq':
|
|
||||||
$location = $user->lang['VIEWING_FAQ'];
|
|
||||||
$location_url = append_sid("{$phpbb_root_path}faq.$phpEx");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'viewonline':
|
case 'viewonline':
|
||||||
$location = $user->lang['VIEWING_ONLINE'];
|
$location = $user->lang['VIEWING_ONLINE'];
|
||||||
$location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx");
|
$location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx");
|
||||||
|
@ -357,6 +355,13 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
default:
|
default:
|
||||||
$location = $user->lang['INDEX'];
|
$location = $user->lang['INDEX'];
|
||||||
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
$location_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
||||||
|
|
||||||
|
if ($row['session_page'] === 'app.' . $phpEx . '/help/faq' ||
|
||||||
|
$row['session_page'] === 'app.' . $phpEx . '/help/bbcode')
|
||||||
|
{
|
||||||
|
$location = $user->lang['VIEWING_FAQ'];
|
||||||
|
$location_url = $controller_helper->route('phpbb_help_controller', array('mode' => 'faq'));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue