Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Inbound Message Settings. 19 * 20 * @package tool_messageinbound 21 * @copyright 2014 Andrew Nicols 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die; 26 27 if ($hassiteconfig) { 28 // Create a settings page for all of the mail server settings. 29 $settings = new admin_settingpage('messageinbound_mailsettings', 30 new lang_string('incomingmailconfiguration', 'tool_messageinbound')); 31 32 $settings->add(new admin_setting_heading('messageinbound_generalconfiguration', 33 new lang_string('messageinboundgeneralconfiguration', 'tool_messageinbound'), 34 new lang_string('messageinboundgeneralconfiguration_desc', 'tool_messageinbound'), '')); 35 $settings->add(new admin_setting_configcheckbox('messageinbound_enabled', 36 new lang_string('messageinboundenabled', 'tool_messageinbound'), 37 new lang_string('messageinboundenabled_desc', 'tool_messageinbound'), 0)); 38 39 // These settings are used when generating a Inbound Message address. 40 $settings->add(new admin_setting_heading('messageinbound_mailboxconfiguration', 41 new lang_string('mailboxconfiguration', 'tool_messageinbound'), 42 new lang_string('messageinboundmailboxconfiguration_desc', 'tool_messageinbound'), '')); 43 $settings->add(new admin_setting_configtext_with_maxlength('messageinbound_mailbox', 44 new lang_string('mailbox', 'tool_messageinbound'), 45 null, '', PARAM_RAW, null, 15)); 46 $settings->add(new admin_setting_configtext('messageinbound_domain', 47 new lang_string('domain', 'tool_messageinbound'), 48 null, '', PARAM_RAW)); 49 50 // These settings are used when checking the incoming mailbox for mail. 51 $settings->add(new admin_setting_heading('messageinbound_serversettings', 52 new lang_string('incomingmailserversettings', 'tool_messageinbound'), 53 new lang_string('incomingmailserversettings_desc', 'tool_messageinbound'), '')); 54 $settings->add(new admin_setting_configtext('messageinbound_host', 55 new lang_string('messageinboundhost', 'tool_messageinbound'), 56 new lang_string('configmessageinboundhost', 'tool_messageinbound'), '', PARAM_RAW)); 57 58 $options = array( 59 '' => get_string('noencryption', 'tool_messageinbound'), 60 'ssl' => get_string('ssl', 'tool_messageinbound'), 61 'sslv2' => get_string('sslv2', 'tool_messageinbound'), 62 'sslv3' => get_string('sslv3', 'tool_messageinbound'), 63 'tls' => get_string('tls', 'tool_messageinbound'), 64 'tlsv1' => get_string('tlsv1', 'tool_messageinbound'), 65 ); 66 $settings->add(new admin_setting_configselect('messageinbound_hostssl', 67 new lang_string('messageinboundhostssl', 'tool_messageinbound'), 68 new lang_string('messageinboundhostssl_desc', 'tool_messageinbound'), 'ssl', $options)); 69 70 // Get all the issuers. 71 $issuers = \core\oauth2\api::get_all_issuers(); 72 $oauth2services = [ 73 '' => new lang_string('none', 'admin'), 74 ]; 75 foreach ($issuers as $issuer) { 76 // Get the enabled issuer only. 77 if ($issuer->get('enabled')) { 78 $oauth2services[$issuer->get('id')] = s($issuer->get('name')); 79 } 80 } 81 82 if (count($oauth2services) > 1) { 83 $settings->add(new admin_setting_configselect('messageinbound_hostoauth', 84 new lang_string('issuer', 'auth_oauth2'), 85 get_string('messageinboundhostoauth_help', 'tool_messageinbound'), 86 '', 87 $oauth2services 88 )); 89 } 90 91 $settings->add(new admin_setting_configtext('messageinbound_hostuser', 92 new lang_string('messageinboundhostuser', 'tool_messageinbound'), 93 new lang_string('messageinboundhostuser_desc', 'tool_messageinbound'), '', PARAM_NOTAGS)); 94 $settings->add(new admin_setting_configpasswordunmask('messageinbound_hostpass', 95 new lang_string('messageinboundhostpass', 'tool_messageinbound'), 96 new lang_string('messageinboundhostpass_desc', 'tool_messageinbound'), '')); 97 98 // Add the category to the admin tree. 99 $ADMIN->add('email', $settings); 100 // Link to the external page for Inbound Message handler configuration. 101 $ADMIN->add('email', new admin_externalpage('messageinbound_handlers', 102 new lang_string('message_handlers', 'tool_messageinbound'), 103 "$CFG->wwwroot/$CFG->admin/tool/messageinbound/index.php")); 104 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body