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

notify_user.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 3.95 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\install_finish\task;
015   
016  use phpbb\config\db;
017   
018  /**
019   * Logs installation and sends an email to the admin
020   */
021  class notify_user extends \phpbb\install\task_base
022  {
023      /**
024       * @var \phpbb\install\helper\config
025       */
026      protected $install_config;
027   
028      /**
029       * @var \phpbb\install\helper\iohandler\iohandler_interface
030       */
031      protected $iohandler;
032   
033      /**
034       * @var \phpbb\auth\auth
035       */
036      protected $auth;
037   
038      /**
039       * @var db
040       */
041      protected $config;
042   
043      /**
044       * @var \phpbb\language\language
045       */
046      protected $language;
047   
048      /**
049       * @var \phpbb\log\log_interface
050       */
051      protected $log;
052   
053      /**
054       * @var \phpbb\user
055       */
056      protected $user;
057   
058      /**
059       * @var string
060       */
061      protected $phpbb_root_path;
062   
063      /**
064       * @var string
065       */
066      protected $php_ext;
067   
068      /**
069       * Constructor
070       *
071       * @param \phpbb\install\helper\container_factory                $container
072       * @param \phpbb\install\helper\config                            $install_config
073       * @param \phpbb\install\helper\iohandler\iohandler_interface    $iohandler
074       * @param string                                                $phpbb_root_path
075       * @param string                                                $php_ext
076       */
077      public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path, $php_ext)
078      {
079          $this->install_config    = $install_config;
080          $this->iohandler        = $iohandler;
081   
082          $this->auth                = $container->get('auth');
083          $this->language            = $container->get('language');
084          $this->log                = $container->get('log');
085          $this->user                = $container->get('user');
086          $this->phpbb_root_path    = $phpbb_root_path;
087          $this->php_ext            = $php_ext;
088   
089          // We need to reload config for cases when it doesn't have all values
090          /** @var \phpbb\cache\driver\driver_interface $cache */
091          $cache = $container->get('cache.driver');
092          $cache->destroy('config');
093   
094          $this->config = new db(
095              $container->get('dbal.conn'),
096              $cache,
097              $container->get_parameter('tables.config')
098          );
099   
100          global $config;
101          $config = $this->config;
102   
103          parent::__construct(true);
104      }
105   
106      /**
107       * {@inheritdoc}
108       */
109      public function run()
110      {
111          $this->user->session_begin();
112          $this->user->setup('common');
113   
114          if ($this->config['email_enable'])
115          {
116              include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
117   
118              $messenger = new \messenger(false);
119              $messenger->template('installed', $this->install_config->get('user_language', 'en'));
120              $messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
121              $messenger->anti_abuse_headers($this->config, $this->user);
122              $messenger->assign_vars(array(
123                      'USERNAME'        => html_entity_decode($this->install_config->get('admin_name'), ENT_COMPAT),
124                      'PASSWORD'        => html_entity_decode($this->install_config->get('admin_passwd'), ENT_COMPAT))
125              );
126              $messenger->send(NOTIFY_EMAIL);
127          }
128   
129          // Login admin
130          // Ugly but works
131          $this->auth->login(
132              $this->install_config->get('admin_name'),
133              $this->install_config->get('admin_passwd'),
134              false,
135              true,
136              true
137          );
138   
139          $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
140          $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
141          $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
142   
143          // Create log
144          $this->log->add(
145              'admin',
146              $this->user->data['user_id'],
147              $this->user->ip,
148              'LOG_INSTALL_INSTALLED',
149              false,
150              array($this->config['version'])
151          );
152   
153          // Remove install_lock
154          @unlink($this->phpbb_root_path . 'cache/install_lock');
155      }
156   
157      /**
158       * {@inheritdoc}
159       */
160      static public function get_step_count()
161      {
162          return 1;
163      }
164   
165      /**
166       * {@inheritdoc}
167       */
168      public function get_task_lang_name()
169      {
170          return 'TASK_NOTIFY_USER';
171      }
172  }
173