[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/install/controller/ -> install.php (source)

   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  namespace phpbb\install\controller;
  15  
  16  use phpbb\exception\http_exception;
  17  use phpbb\install\helper\install_helper;
  18  use phpbb\install\helper\navigation\navigation_provider;
  19  use Symfony\Component\HttpFoundation\StreamedResponse;
  20  use Symfony\Component\HttpFoundation\Response;
  21  use phpbb\install\helper\iohandler\factory;
  22  use phpbb\template\template;
  23  use phpbb\request\request_interface;
  24  use phpbb\install\installer;
  25  use phpbb\language\language;
  26  
  27  /**
  28   * Controller for installing phpBB
  29   */
  30  class install
  31  {
  32      /**
  33       * @var helper
  34       */
  35      protected $controller_helper;
  36  
  37      /**
  38       * @var factory
  39       */
  40      protected $iohandler_factory;
  41  
  42      /**
  43       * @var navigation_provider
  44       */
  45      protected $menu_provider;
  46  
  47      /**
  48       * @var language
  49       */
  50      protected $language;
  51  
  52      /**
  53       * @var template
  54       */
  55      protected $template;
  56  
  57      /**
  58       * @var request_interface
  59       */
  60      protected $request;
  61  
  62      /**
  63       * @var installer
  64       */
  65      protected $installer;
  66  
  67      /**
  68       * @var install_helper
  69       */
  70      protected $install_helper;
  71  
  72      /**
  73       * Constructor
  74       *
  75       * @param helper                 $helper
  76       * @param factory                 $factory
  77       * @param navigation_provider    $nav_provider
  78       * @param language                $language
  79       * @param template                $template
  80       * @param request_interface        $request
  81       * @param installer                $installer
  82       * @param install_helper        $install_helper
  83       */
  84  	public function __construct(helper $helper, factory $factory, navigation_provider $nav_provider, language $language, template $template, request_interface $request, installer $installer, install_helper $install_helper)
  85      {
  86          $this->controller_helper    = $helper;
  87          $this->iohandler_factory    = $factory;
  88          $this->menu_provider        = $nav_provider;
  89          $this->language                = $language;
  90          $this->template                = $template;
  91          $this->request                = $request;
  92          $this->installer            = $installer;
  93          $this->install_helper        = $install_helper;
  94      }
  95  
  96      /**
  97       * Controller logic
  98       *
  99       * @return Response|StreamedResponse
 100       *
 101       * @throws http_exception When phpBB is already installed
 102       */
 103  	public function handle()
 104      {
 105          if ($this->install_helper->is_phpbb_installed())
 106          {
 107              throw new http_exception(403, 'INSTALL_PHPBB_INSTALLED');
 108          }
 109  
 110          $this->template->assign_vars(array(
 111              'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'),
 112          ));
 113  
 114          // Set up input-output handler
 115          if ($this->request->is_ajax())
 116          {
 117              $this->iohandler_factory->set_environment('ajax');
 118          }
 119          else
 120          {
 121              $this->iohandler_factory->set_environment('nojs');
 122          }
 123  
 124          // Set the appropriate input-output handler
 125          $this->installer->set_iohandler($this->iohandler_factory->get());
 126          $this->controller_helper->handle_language_select();
 127  
 128          if ($this->request->is_ajax())
 129          {
 130              $installer = $this->installer;
 131              $response = new StreamedResponse();
 132              $response->setCallback(function() use ($installer) {
 133                  $installer->run();
 134              });
 135  
 136              // Try to bypass any server output buffers
 137              $response->headers->set('X-Accel-Buffering', 'no');
 138  
 139              return $response;
 140          }
 141          else
 142          {
 143              // Determine whether the installation was started or not
 144              if (true)
 145              {
 146                  // Set active stage
 147                  $this->menu_provider->set_nav_property(
 148                      array('install', 0, 'introduction'),
 149                      array(
 150                          'selected'    => true,
 151                          'completed'    => false,
 152                      )
 153                  );
 154  
 155                  // If not, let's render the welcome page
 156                  $this->template->assign_vars(array(
 157                      'SHOW_INSTALL_START_FORM'    => true,
 158                      'TITLE'                        => $this->language->lang('INSTALL_INTRO'),
 159                      'CONTENT'                    => $this->language->lang('INSTALL_INTRO_BODY'),
 160                  ));
 161  
 162                  /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */
 163                  $iohandler = $this->iohandler_factory->get();
 164                  $this->controller_helper->handle_navigation($iohandler);
 165  
 166                  return $this->controller_helper->render('installer_install.html', 'INSTALL', true);
 167              }
 168  
 169              // @todo: implement no js controller logic
 170          }
 171      }
 172  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1