[ Index ] |
PHP Cross Reference of phpBB-3.2.11-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\obtain_data\task; 15 16 use phpbb\install\exception\user_interaction_required_exception; 17 18 class obtain_email_data extends \phpbb\install\task_base implements \phpbb\install\task_interface 19 { 20 /** 21 * @var \phpbb\install\helper\config 22 */ 23 protected $install_config; 24 25 /** 26 * @var \phpbb\install\helper\iohandler\iohandler_interface 27 */ 28 protected $io_handler; 29 30 /** 31 * Constructor 32 * 33 * @param \phpbb\install\helper\config $config Installer's config 34 * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler 35 */ 36 public function __construct(\phpbb\install\helper\config $config, 37 \phpbb\install\helper\iohandler\iohandler_interface $iohandler) 38 { 39 $this->install_config = $config; 40 $this->io_handler = $iohandler; 41 42 parent::__construct(true); 43 } 44 45 /** 46 * {@inheritdoc} 47 */ 48 public function run() 49 { 50 // E-mail data 51 $email_enable = $this->io_handler->get_input('email_enable', true); 52 $smtp_delivery = $this->io_handler->get_input('smtp_delivery', ''); 53 $smtp_host = $this->io_handler->get_input('smtp_host', '', true); 54 $smtp_port = $this->io_handler->get_input('smtp_port', ''); 55 $smtp_auth = $this->io_handler->get_input('smtp_auth', ''); 56 $smtp_user = $this->io_handler->get_input('smtp_user', '', true); 57 $smtp_passwd = $this->io_handler->get_input('smtp_pass', '', true); 58 59 $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); 60 61 // Check if data is sent 62 if ($this->io_handler->get_input('submit_email', false)) 63 { 64 $this->install_config->set('email_enable', $email_enable); 65 $this->install_config->set('smtp_delivery', $smtp_delivery); 66 $this->install_config->set('smtp_host', $smtp_host); 67 $this->install_config->set('smtp_port', $smtp_port); 68 $this->install_config->set('smtp_auth', $smtp_auth); 69 $this->install_config->set('smtp_user', $smtp_user); 70 $this->install_config->set('smtp_pass', $smtp_passwd); 71 } 72 else 73 { 74 $auth_options = array(); 75 foreach ($auth_methods as $method) 76 { 77 $auth_options[] = array( 78 'value' => $method, 79 'label' => 'SMTP_' . str_replace('-', '_', $method), 80 'selected' => false, 81 ); 82 } 83 84 $email_form = array( 85 'email_enable' => array( 86 'label' => 'ENABLE_EMAIL', 87 'description' => 'ENABLE_EMAIL_EXPLAIN', 88 'type' => 'radio', 89 'options' => array( 90 array( 91 'value' => 1, 92 'label' => 'ENABLE', 93 'selected' => true, 94 ), 95 array( 96 'value' => 0, 97 'label' => 'DISABLE', 98 'selected' => false, 99 ), 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |