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

obtain_update_ftp_data.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 3.90 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\install\module\obtain_data\task;
015   
016  use phpbb\install\exception\user_interaction_required_exception;
017  use phpbb\install\helper\config;
018  use phpbb\install\helper\iohandler\iohandler_interface;
019  use phpbb\install\helper\update_helper;
020  use phpbb\install\task_base;
021   
022  class obtain_update_ftp_data extends task_base
023  {
024      /**
025       * @var config
026       */
027      protected $installer_config;
028   
029      /**
030       * @var iohandler_interface
031       */
032      protected $iohandler;
033   
034      /**
035       * @var update_helper
036       */
037      protected $update_helper;
038   
039      /**
040       * @var string
041       */
042      protected $php_ext;
043   
044      /**
045       * Constructor
046       *
047       * @param config                $installer_config
048       * @param iohandler_interface    $iohandler
049       * @param update_helper            $update_helper
050       * @param string                $php_ext
051       */
052      public function __construct(config $installer_config, iohandler_interface $iohandler, update_helper $update_helper, $php_ext)
053      {
054          $this->installer_config    = $installer_config;
055          $this->iohandler        = $iohandler;
056          $this->update_helper    = $update_helper;
057          $this->php_ext            = $php_ext;
058   
059          parent::__construct(false);
060      }
061   
062      /**
063       * {@inheritdoc}
064       */
065      public function check_requirements()
066      {
067          return ($this->installer_config->get('do_update_files', false) &&
068              ($this->installer_config->get('file_update_method', '') === 'ftp')
069          );
070      }
071   
072      /**
073       * {@inheritdoc}
074       */
075      public function run()
076      {
077          if ($this->iohandler->get_input('submit_ftp', false))
078          {
079              $this->update_helper->include_file('includes/functions_transfer.' . $this->php_ext);
080   
081              $method = 'ftp';
082              $methods = \transfer::methods();
083              if (!in_array($method, $methods, true))
084              {
085                  $method = $methods[0];
086              }
087   
088              $ftp_host = $this->iohandler->get_input('ftp_host', '', true);
089              $ftp_user = $this->iohandler->get_input('ftp_user', '', true);
090              $ftp_pass = html_entity_decode($this->iohandler->get_input('ftp_pass', '', true), ENT_COMPAT);
091              $ftp_path = $this->iohandler->get_input('ftp_path', '', true);
092              $ftp_port = $this->iohandler->get_input('ftp_port', 21);
093              $ftp_time = $this->iohandler->get_input('ftp_timeout', 10);
094   
095              $this->installer_config->set('ftp_host', $ftp_host);
096              $this->installer_config->set('ftp_user', $ftp_user);
097              $this->installer_config->set('ftp_pass', $ftp_pass);
098              $this->installer_config->set('ftp_path', $ftp_path);
099              $this->installer_config->set('ftp_port', (int) $ftp_port);
100              $this->installer_config->set('ftp_timeout', (int) $ftp_time);
101              $this->installer_config->set('ftp_method', $method);
102          }
103          else
104          {
105              $this->iohandler->add_user_form_group('FTP_SETTINGS', array(
106                  'ftp_host'    => array(
107                      'label'            => 'FTP_HOST',
108                      'description'    => 'FTP_HOST_EXPLAIN',
109                      'type'            => 'text',
110                  ),
111                  'ftp_user'    => array(
112                      'label'            => 'FTP_USERNAME',
113                      'description'    => 'FTP_USERNAME_EXPLAIN',
114                      'type'            => 'text',
115                  ),
116                  'ftp_pass'    => array(
117                      'label'            => 'FTP_PASSWORD',
118                      'description'    => 'FTP_PASSWORD_EXPLAIN',
119                      'type'            => 'password',
120                  ),
121                  'ftp_path'    => array(
122                      'label'            => 'FTP_ROOT_PATH',
123                      'description'    => 'FTP_ROOT_PATH_EXPLAIN',
124                      'type'            => 'text',
125                  ),
126                  'ftp_port'    => array(
127                      'label'            => 'FTP_PORT',
128                      'description'    => 'FTP_PORT_EXPLAIN',
129                      'type'            => 'text',
130                      'default'        => 21,
131                  ),
132                  'ftp_timeout'    => array(
133                      'label'            => 'FTP_TIMEOUT',
134                      'description'    => 'FTP_TIMEOUT_EXPLAIN',
135                      'type'            => 'text',
136                      'default'        => 10,
137                  ),
138                  'submit_ftp'    => array(
139                      'label'    => 'SUBMIT',
140                      'type'    => 'submit',
141                  ),
142              ));
143   
144              throw new user_interaction_required_exception();
145          }
146      }
147   
148      /**
149       * {@inheritdoc}
150       */
151      static public function get_step_count()
152      {
153          return 0;
154      }
155   
156      /**
157       * {@inheritdoc}
158       */
159      public function get_task_lang_name()
160      {
161          return '';
162      }
163  }
164