Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 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      $settings->add(new admin_setting_configtext('messageinbound_hostuser',
  71              new lang_string('messageinboundhostuser', 'tool_messageinbound'),
  72              new lang_string('messageinboundhostuser_desc', 'tool_messageinbound'), '', PARAM_NOTAGS));
  73      $settings->add(new admin_setting_configpasswordunmask('messageinbound_hostpass',
  74              new lang_string('messageinboundhostpass', 'tool_messageinbound'),
  75              new lang_string('messageinboundhostpass_desc', 'tool_messageinbound'), ''));
  76  
  77      // Add the category to the admin tree.
  78      $ADMIN->add('email', $settings);
  79      // Link to the external page for Inbound Message handler configuration.
  80      $ADMIN->add('email', new admin_externalpage('messageinbound_handlers',
  81              new lang_string('message_handlers', 'tool_messageinbound'),
  82              "$CFG->wwwroot/$CFG->admin/tool/messageinbound/index.php"));
  83  }