PageRenderTime 70ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/phpBB/faq.php

https://github.com/VSEphpbb/phpbb
PHP | 117 lines | 70 code | 16 blank | 31 comment | 6 complexity | 6e22986bcf5da10d21f979e126a7caf8 MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * This file is part of the phpBB Forum Software package.
  5. *
  6. * @copyright (c) phpBB Limited <https://www.phpbb.com>
  7. * @license GNU General Public License, version 2 (GPL-2.0)
  8. *
  9. * For full copyright and license information, please see
  10. * the docs/CREDITS.txt file.
  11. *
  12. */
  13. /**
  14. * @ignore
  15. */
  16. define('IN_PHPBB', true);
  17. $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
  18. $phpEx = substr(strrchr(__FILE__, '.'), 1);
  19. include($phpbb_root_path . 'common.' . $phpEx);
  20. // Start session management
  21. $user->session_begin();
  22. $auth->acl($user->data);
  23. $user->setup();
  24. $mode = request_var('mode', '');
  25. $template_file = 'faq_body.html';
  26. // Load the appropriate faq file
  27. switch ($mode)
  28. {
  29. case 'bbcode':
  30. $l_title = $user->lang['BBCODE_GUIDE'];
  31. $user->add_lang('bbcode', false, true);
  32. break;
  33. default:
  34. $page_title = $user->lang['FAQ_EXPLAIN'];
  35. $ext_name = $lang_file = '';
  36. /**
  37. * You can use this event display a custom help page
  38. *
  39. * @event core.faq_mode_validation
  40. * @var string page_title Title of the page
  41. * @var string mode FAQ that is going to be displayed
  42. * @var string lang_file Language file containing the help data
  43. * @var string ext_name Vendor and extension name where the help
  44. * language file can be loaded from
  45. * @var string template_file Template file name
  46. * @since 3.1.4-RC1
  47. * @changed 3.1.11-RC1 Added template_file var
  48. */
  49. $vars = array(
  50. 'page_title',
  51. 'mode',
  52. 'lang_file',
  53. 'ext_name',
  54. 'template_file',
  55. );
  56. extract($phpbb_dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
  57. $l_title = $page_title;
  58. $user->add_lang(($lang_file) ? $lang_file : 'faq', false, true, $ext_name);
  59. break;
  60. }
  61. // Pull the array data from the lang pack
  62. $switch_column = $found_switch = false;
  63. $help_blocks = array();
  64. foreach ($user->help as $help_ary)
  65. {
  66. if ($help_ary[0] == '--')
  67. {
  68. if ($help_ary[1] == '--')
  69. {
  70. $switch_column = true;
  71. $found_switch = true;
  72. continue;
  73. }
  74. $template->assign_block_vars('faq_block', array(
  75. 'BLOCK_TITLE' => $help_ary[1],
  76. 'SWITCH_COLUMN' => $switch_column,
  77. ));
  78. if ($switch_column)
  79. {
  80. $switch_column = false;
  81. }
  82. continue;
  83. }
  84. $template->assign_block_vars('faq_block.faq_row', array(
  85. 'FAQ_QUESTION' => $help_ary[0],
  86. 'FAQ_ANSWER' => $help_ary[1])
  87. );
  88. }
  89. // Lets build a page ...
  90. $template->assign_vars(array(
  91. 'L_FAQ_TITLE' => $l_title,
  92. 'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'],
  93. 'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false,
  94. 'S_IN_FAQ' => true,
  95. ));
  96. page_header($l_title);
  97. $template->set_filenames(array(
  98. 'body' => $template_file)
  99. );
  100. make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
  101. page_footer();