Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

help.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 4.00 KiB


001  <?php
002  /**
003   *
004   * This file is part of the phpBB Forum Software package.
005   *
006   * @copyright (c) phpBB Limited <https://www.phpbb.com>
007   * @license GNU General Public License, version 2 (GPL-2.0)
008   *
009   * For full copyright and license information, please see
010   * the docs/CREDITS.txt file.
011   *
012   */
013   
014  namespace phpbb\help\controller;
015   
016  use phpbb\exception\http_exception;
017   
018  class help
019  {
020      /** @var \phpbb\controller\helper */
021      protected $helper;
022   
023      /** @var \phpbb\event\dispatcher_interface  */
024      protected $dispatcher;
025   
026      /** @var \phpbb\template\template */
027      protected $template;
028   
029      /** @var \phpbb\user */
030      protected $user;
031   
032      /** @var string */
033      protected $root_path;
034   
035      /** @var string */
036      protected $php_ext;
037   
038      /**
039       * Constructor
040       *
041       * @param \phpbb\controller\helper    $helper
042       * @param \phpbb\event\dispatcher_interface    $dispatcher
043       * @param \phpbb\template\template    $template
044       * @param \phpbb\user                $user
045       * @param string                    $root_path
046       * @param string                    $php_ext
047       */
048      public function __construct(\phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\template\template $template, \phpbb\user $user, $root_path, $php_ext)
049      {
050          $this->helper = $helper;
051          $this->dispatcher = $dispatcher;
052          $this->template = $template;
053          $this->user = $user;
054          $this->root_path = $root_path;
055          $this->php_ext = $php_ext;
056      }
057   
058      /**
059       * Controller for /help/{mode} routes
060       *
061       * @param string        $mode
062       * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
063       * @throws http_exception when the $mode is not known by any extension
064       */
065      public function handle($mode)
066      {
067          $template_file = 'faq_body.html';
068          switch ($mode)
069          {
070              case 'faq':
071              case 'bbcode':
072                  $page_title = ($mode === 'faq') ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
073                  $this->user->add_lang($mode, false, true);
074              break;
075   
076              default:
077                  $page_title = $this->user->lang['FAQ_EXPLAIN'];
078                  $ext_name = $lang_file = '';
079   
080                  /**
081                   * You can use this event display a custom help page
082                   *
083                   * @event core.faq_mode_validation
084                   * @var    string    page_title        Title of the page
085                   * @var    string    mode            FAQ that is going to be displayed
086                   * @var    string    lang_file        Language file containing the help data
087                   * @var    string    ext_name        Vendor and extension name where the help
088                   *                                language file can be loaded from
089                   * @var    string    template_file    Template file name
090                   * @since 3.1.4-RC1
091                   * @changed 3.1.11-RC1 Added template_file var
092                   */
093                  $vars = array(
094                      'page_title',
095                      'mode',
096                      'lang_file',
097                      'ext_name',
098                      'template_file',
099                  );
100                  extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
101   
102                  if ($ext_name === '' || $lang_file === '')
103                  {
104                      throw new http_exception(404, 'Not Found');
105                  }
106   
107                  $this->user->add_lang($lang_file, false, true, $ext_name);
108              break;
109   
110          }
111   
112          $this->template->assign_vars(array(
113              'L_FAQ_TITLE'                => $page_title,
114              'S_IN_FAQ'                    => true,
115          ));
116   
117          $this->assign_to_template($this->user->help);
118   
119          make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
120          return $this->helper->render($template_file, $page_title);
121      }
122   
123      /**
124       * Assigns the help data to the template blocks
125       *
126       * @param array $help_data
127       * @return null
128       */
129      protected function assign_to_template(array $help_data)
130      {
131          // Pull the array data from the lang pack
132          $switch_column = $found_switch = false;
133          foreach ($help_data as $help_ary)
134          {
135              if ($help_ary[0] == '--')
136              {
137                  if ($help_ary[1] == '--')
138                  {
139                      $switch_column = true;
140                      $found_switch = true;
141                      continue;
142                  }
143   
144                  $this->template->assign_block_vars('faq_block', array(
145                      'BLOCK_TITLE'        => $help_ary[1],
146                      'SWITCH_COLUMN'        => $switch_column,
147                  ));
148   
149                  if ($switch_column)
150                  {
151                      $switch_column = false;
152                  }
153                  continue;
154              }
155   
156              $this->template->assign_block_vars('faq_block.faq_row', array(
157                  'FAQ_QUESTION'        => $help_ary[0],
158                  'FAQ_ANSWER'        => $help_ary[1],
159              ));
160          }
161   
162          $this->template->assign_var('SWITCH_COLUMN_MANUALLY', !$found_switch);
163      }
164  }
165