[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
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\module\install_finish\task; 15 16 use phpbb\config\db; 17 18 /** 19 * Logs installation and sends an email to the admin 20 */ 21 class notify_user extends \phpbb\install\task_base 22 { 23 /** 24 * @var \phpbb\install\helper\config 25 */ 26 protected $install_config; 27 28 /** 29 * @var \phpbb\install\helper\iohandler\iohandler_interface 30 */ 31 protected $iohandler; 32 33 /** 34 * @var \phpbb\auth\auth 35 */ 36 protected $auth; 37 38 /** 39 * @var db 40 */ 41 protected $config; 42 43 /** 44 * @var \phpbb\language\language 45 */ 46 protected $language; 47 48 /** 49 * @var \phpbb\log\log_interface 50 */ 51 protected $log; 52 53 /** 54 * @var \phpbb\user 55 */ 56 protected $user; 57 58 /** 59 * @var string 60 */ 61 protected $phpbb_root_path; 62 63 /** 64 * @var string 65 */ 66 protected $php_ext; 67 68 /** 69 * Constructor 70 * 71 * @param \phpbb\install\helper\container_factory $container 72 * @param \phpbb\install\helper\config $install_config 73 * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler 74 * @param string $phpbb_root_path 75 * @param string $php_ext 76 */ 77 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) 78 { 79 $this->install_config = $install_config; 80 $this->iohandler = $iohandler; 81 82 $this->auth = $container->get('auth'); 83 $this->language = $container->get('language'); 84 $this->log = $container->get('log'); 85 $this->user = $container->get('user'); 86 $this->phpbb_root_path = $phpbb_root_path; 87 $this->php_ext = $php_ext; 88 89 // We need to reload config for cases when it doesn't have all values 90 /** @var \phpbb\cache\driver\driver_interface $cache */ 91 $cache = $container->get('cache.driver'); 92 $cache->destroy('config'); 93 94 $this->config = new db( 95 $container->get('dbal.conn'), 96 $cache, 97 $container->get_parameter('tables.config') 98 ); 99 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |