Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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_email_data.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 4.29 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   
018  class obtain_email_data extends \phpbb\install\task_base implements \phpbb\install\task_interface
019  {
020      /**
021       * @var \phpbb\install\helper\config
022       */
023      protected $install_config;
024   
025      /**
026       * @var \phpbb\install\helper\iohandler\iohandler_interface
027       */
028      protected $io_handler;
029   
030      /**
031       * Constructor
032       *
033       * @param \phpbb\install\helper\config                            $config        Installer's config
034       * @param \phpbb\install\helper\iohandler\iohandler_interface    $iohandler    Installer's input-output handler
035       */
036      public function __construct(\phpbb\install\helper\config $config,
037                                  \phpbb\install\helper\iohandler\iohandler_interface $iohandler)
038      {
039          $this->install_config    = $config;
040          $this->io_handler        = $iohandler;
041   
042          parent::__construct(true);
043      }
044   
045      /**
046       * {@inheritdoc}
047       */
048      public function run()
049      {
050          // E-mail data
051          $email_enable    = $this->io_handler->get_input('email_enable', true);
052          $smtp_delivery    = $this->io_handler->get_input('smtp_delivery', '');
053          $smtp_host        = $this->io_handler->get_input('smtp_host', '');
054          $smtp_port        = $this->io_handler->get_input('smtp_port', '');
055          $smtp_auth        = $this->io_handler->get_input('smtp_auth', '');
056          $smtp_user        = $this->io_handler->get_input('smtp_user', '');
057          $smtp_passwd    = $this->io_handler->get_input('smtp_pass', '');
058   
059          $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
060   
061          // Check if data is sent
062          if ($this->io_handler->get_input('submit_email', false))
063          {
064              $this->install_config->set('email_enable', $email_enable);
065              $this->install_config->set('smtp_delivery', $smtp_delivery);
066              $this->install_config->set('smtp_host', $smtp_host);
067              $this->install_config->set('smtp_port', $smtp_port);
068              $this->install_config->set('smtp_auth', $smtp_auth);
069              $this->install_config->set('smtp_user', $smtp_user);
070              $this->install_config->set('smtp_pass', $smtp_passwd);
071          }
072          else
073          {
074              $auth_options = array();
075              foreach ($auth_methods as $method)
076              {
077                  $auth_options[] = array(
078                      'value'        => $method,
079                      'label'        => 'SMTP_' . str_replace('-', '_', $method),
080                      'selected'    => false,
081                  );
082              }
083   
084              $email_form = array(
085                  'email_enable' => array(
086                      'label'            => 'ENABLE_EMAIL',
087                      'description'    => 'COOKIE_SECURE_EXPLAIN',
088                      'type'            => 'radio',
089                      'options'        => array(
090                          array(
091                              'value'        => 1,
092                              'label'        => 'ENABLE',
093                              'selected'    => true,
094                          ),
095                          array(
096                              'value'        => 0,
097                              'label'        => 'DISABLE',
098                              'selected'    => false,
099                          ),
100                      ),
101                  ),
102                  'smtp_delivery' => array(
103                      'label'            => 'USE_SMTP',
104                      'description'    => 'USE_SMTP_EXPLAIN',
105                      'type'            => 'radio',
106                      'options'        => array(
107                          array(
108                              'value'        => 0,
109                              'label'        => 'NO',
110                              'selected'    => true,
111                          ),
112                          array(
113                              'value'        => 1,
114                              'label'        => 'YES',
115                              'selected'    => false,
116                          ),
117                      ),
118                  ),
119                  'smtp_host' => array(
120                      'label'            => 'SMTP_SERVER',
121                      'type'            => 'text',
122                      'default'        => $smtp_host,
123                  ),
124                  'smtp_port' => array(
125                      'label'            => 'SMTP_PORT',
126                      'type'            => 'text',
127                      'default'        => $smtp_port,
128                  ),
129                  'smtp_auth' => array(
130                      'label'            => 'SMTP_AUTH_METHOD',
131                      'description'    => 'SMTP_AUTH_METHOD_EXPLAIN',
132                      'type'            => 'select',
133                      'options'        => $auth_options,
134                  ),
135                  'smtp_user' => array(
136                      'label'            => 'SMTP_USERNAME',
137                      'description'    => 'SMTP_USERNAME_EXPLAIN',
138                      'type'            => 'text',
139                      'default'        => $smtp_user,
140                  ),
141                  'smtp_pass' => array(
142                      'label'            => 'SMTP_PASSWORD',
143                      'description'    => 'SMTP_PASSWORD_EXPLAIN',
144                      'type'            => 'password',
145                  ),
146                  'submit_email' => array(
147                      'label'    => 'SUBMIT',
148                      'type'    => 'submit',
149                  ),
150              );
151   
152              $this->io_handler->add_user_form_group('EMAIL_CONFIG', $email_form);
153   
154              throw new user_interaction_required_exception();
155          }
156      }
157   
158      /**
159       * {@inheritdoc}
160       */
161      static public function get_step_count()
162      {
163          return 0;
164      }
165   
166      /**
167       * {@inheritdoc}
168       */
169      public function get_task_lang_name()
170      {
171          return '';
172      }
173  }
174