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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
notify_user.php
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 \phpbb\config\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 parent::__construct(true);
101 }
102
103 /**
104 * {@inheritdoc}
105 */
106 public function run()
107 {
108 $this->user->session_begin();
109 $this->user->setup('common');
110
111 if ($this->config['email_enable'])
112 {
113 include ($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
114
115 // functions_messenger.php uses config to determine language paths
116 // Remove when able
117 global $config;
118 $config = $this->config;
119
120 $messenger = new \messenger(false);
121 $messenger->template('installed', $this->install_config->get('user_language', 'en'));
122 $messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
123 $messenger->anti_abuse_headers($this->config, $this->user);
124 $messenger->assign_vars(array(
125 'USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')),
126 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd')))
127 );
128 $messenger->send(NOTIFY_EMAIL);
129 }
130
131 // Login admin
132 // Ugly but works
133 $this->auth->login(
134 $this->install_config->get('admin_name'),
135 $this->install_config->get('admin_passwd'),
136 false,
137 true,
138 true
139 );
140
141 $this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
142 $this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
143 $this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
144
145 // Create log
146 $this->log->add(
147 'admin',
148 $this->user->data['user_id'],
149 $this->user->ip,
150 'LOG_INSTALL_INSTALLED',
151 false,
152 array($this->config['version'])
153 );
154
155 // Remove install_lock
156 @unlink($this->phpbb_root_path . 'cache/install_lock');
157 }
158
159 /**
160 * {@inheritdoc}
161 */
162 static public function get_step_count()
163 {
164 return 1;
165 }
166
167 /**
168 * {@inheritdoc}
169 */
170 public function get_task_lang_name()
171 {
172 return 'TASK_NOTIFY_USER';
173 }
174 }
175