Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   3  ///////////////////////////////////////////////////////////////////////////
   4  //                                                                       //
   5  // This file is part of Moodle - http://moodle.org/                      //
   6  // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
   7  //                                                                       //
   8  // Moodle is free software: you can redistribute it and/or modify        //
   9  // it under the terms of the GNU General Public License as published by  //
  10  // the Free Software Foundation, either version 3 of the License, or     //
  11  // (at your option) any later version.                                   //
  12  //                                                                       //
  13  // Moodle is distributed in the hope that it will be useful,             //
  14  // but WITHOUT ANY WARRANTY; without even the implied warranty of        //
  15  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
  16  // GNU General Public License for more details.                          //
  17  //                                                                       //
  18  // You should have received a copy of the GNU General Public License     //
  19  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.       //
  20  //                                                                       //
  21  ///////////////////////////////////////////////////////////////////////////
  22  
  23  /**
  24   * @package    moodle
  25   * @subpackage registration
  26   * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
  27   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
  28   * @copyright  (C) 1999 onwards Martin Dougiamas  http://dougiamas.com
  29   *
  30   * The administrator is redirect to this page from the hub to renew a registration
  31   * process because
  32   */
  33  
  34  require('../../config.php');
  35  require_once($CFG->libdir . '/adminlib.php');
  36  
  37  $url = optional_param('url', '', PARAM_URL);
  38  $token = optional_param('token', '', PARAM_TEXT);
  39  
  40  admin_externalpage_setup('registrationmoodleorg');
  41  
  42  if (parse_url($url, PHP_URL_HOST) !== parse_url(HUB_MOODLEORGHUBURL, PHP_URL_HOST)) {
  43      // Allow other plugins to renew registration on custom hubs. Plugins implementing this
  44      // callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
  45      $callbacks = get_plugins_with_function('hub_registration');
  46      foreach ($callbacks as $plugintype => $plugins) {
  47          foreach ($plugins as $plugin => $callback) {
  48              $callback('renew');
  49          }
  50      }
  51      throw new moodle_exception('errorotherhubsnotsupported', 'hub');
  52  }
  53  
  54  // Check that we are waiting a confirmation from this hub, and check that the token is correct.
  55  \core\hub\registration::reset_site_identifier($token);
  56  
  57  echo $OUTPUT->header();
  58  echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
  59  $hublink = html_writer::tag('a', HUB_MOODLEORGHUBURL, array('href' => HUB_MOODLEORGHUBURL));
  60  
  61  $deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
  62  
  63  $button = new single_button(new moodle_url('/admin/registration/index.php'),
  64                  get_string('restartregistration', 'hub'));
  65  $button->class = 'restartregbutton';
  66  
  67  echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
  68          array('class' => 'mdl-align'));
  69  
  70  echo $OUTPUT->footer();
  71  
  72