-
Notifications
You must be signed in to change notification settings - Fork 42
/
bookingredirect.php
executable file
·48 lines (41 loc) · 1.64 KB
/
bookingredirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Booking redirect
*
* This is a very simple script which allows us to pass a base64 encoded URL
* as param and redirect to the decoded URL.
* This was needed because it wasn't possible to stop the Moodle calendar exporter
* from escaping "&" to "&" HTML entitities which made it impossible
* to open links within outlook events.
*
* @package mod_booking
* @copyright 2022 Wunderbyte GmbH <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../config.php');
global $DB, $CFG, $COURSE, $USER, $OUTPUT, $PAGE;
// No guest autologin.
require_login(0, false);
$encodedurl = required_param('encodedurl', PARAM_TEXT); // The base64 encoded URL.
$link = base64_decode($encodedurl);
// Check if it's actually a link.
if (filter_var($link, FILTER_VALIDATE_URL)) {
// Now open the link.
header("Location: $link");
exit();
}
echo "The URL does not seem to be valid. Please contact a developer.";