Skip to content

Commit

Permalink
Updated from agora_moodle2 repository (20240523)
Browse files Browse the repository at this point in the history
  • Loading branch information
toniginard committed May 23, 2024
1 parent ed1ab95 commit ce4b119
Show file tree
Hide file tree
Showing 600 changed files with 5,212 additions and 8,911 deletions.
9 changes: 9 additions & 0 deletions html/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ More information on each of the fixes can be found in the project
development home at https://github.com/projectestac/agora_moodle2


Changes 24.04.30
---------------------------------------------------------------------------------------
- Upgraded Moodle to version 4.1.10
- Updated langpacks
- Course format simple: Show content of labels in non-editing view
- coursequotas: Fixed lang string
- Wiris: Upgraded all components


Changes 24.03.19
---------------------------------------------------------------------------------------
- Upgraded Moodle to version 4.1.9+
Expand Down
8 changes: 8 additions & 0 deletions html/admin/environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3923,6 +3923,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.2" requires="3.11.8">
Expand Down Expand Up @@ -4113,6 +4115,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.3" requires="3.11.8">
Expand Down Expand Up @@ -4305,6 +4309,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.4" requires="4.1.2">
Expand Down Expand Up @@ -4496,6 +4502,8 @@
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function show(): void {
* Delete the DB preset
*/
public function execute(): void {
confirm_sesskey();
require_sesskey();

$this->manager->delete_preset($this->id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public function show(): void {
* Stores a preset into the DB.
*/
public function execute(): void {
confirm_sesskey();

$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'export', 'mode' => 'execute']);
$this->moodleform = new export_form($url);

Expand Down Expand Up @@ -87,7 +85,7 @@ public function execute(): void {
* @throws xml_writer_exception
*/
public function download_xml(): void {
confirm_sesskey();
require_sesskey();

list($xmlstr, $filename) = $this->manager->download_preset($this->id);

Expand Down
2 changes: 0 additions & 2 deletions html/admin/tool/admin_presets/classes/local/action/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public function show(): void {
* Imports the xmlfile into DB
*/
public function execute(): void {
confirm_sesskey();

$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'import', 'mode' => 'execute']);
$this->moodleform = new import_form($url);

Expand Down
2 changes: 0 additions & 2 deletions html/admin/tool/admin_presets/classes/local/action/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class load extends base {
public function execute(): void {
global $OUTPUT;

confirm_sesskey();

$url = new \moodle_url('/admin/tool/admin_presets/index.php', ['action' => 'load', 'mode' => 'execute']);
$this->moodleform = new load_form($url);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function show(): void {
public function execute(): void {
global $OUTPUT;

confirm_sesskey();
require_sesskey();

list($presetapp, $rollback, $failures) = $this->manager->revert_preset($this->id);

Expand Down
14 changes: 7 additions & 7 deletions html/admin/tool/analytics/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,28 @@
switch ($action) {

case 'enable':
confirm_sesskey();
require_sesskey();

$model->enable();
redirect($returnurl);
break;

case 'disable':
confirm_sesskey();
require_sesskey();

$model->update(0, false, false);
redirect($returnurl);
break;

case 'delete':
confirm_sesskey();
require_sesskey();

$model->delete();
redirect($returnurl);
break;

case 'edit':
confirm_sesskey();
require_sesskey();

$invalidcurrenttimesplitting = $model->invalid_timesplitting_selected();
$potentialtimesplittings = $model->get_potential_timesplittings();
Expand Down Expand Up @@ -183,7 +183,7 @@
break;

case 'evaluate':
confirm_sesskey();
require_sesskey();

if ($model->is_static()) {
throw new moodle_exception('errornostaticevaluate', 'tool_analytics');
Expand Down Expand Up @@ -226,7 +226,7 @@
break;

case 'scheduledanalysis':
confirm_sesskey();
require_sesskey();

if ($onlycli) {
throw new moodle_exception('erroronlycli', 'tool_analytics');
Expand Down Expand Up @@ -292,7 +292,7 @@
break;

case 'clear':
confirm_sesskey();
require_sesskey();

$model->clear();
redirect($returnurl);
Expand Down
45 changes: 45 additions & 0 deletions html/admin/tool/mobile/classes/event_handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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/>.

namespace tool_mobile;

use core\session\utility\cookie_helper;
use core\event\user_loggedin;

/**
* Event handler for tool_mobile.
*
* @package tool_mobile
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class event_handler {

/**
* Allows the plugin to augment Set-Cookie headers when the user_loggedin event is fired as part of complete_user_login() calls.
*
* @param user_loggedin $event the event
* @return void
*/
public static function handle_user_loggedin(user_loggedin $event): void {
global $CFG;

// Set Partitioned and Secure attributes to the MoodleSession cookie if the user is using the Moodle app.
if (\core_useragent::is_moodle_app()) {
cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']);
}
}
}
33 changes: 33 additions & 0 deletions html/admin/tool/mobile/db/events.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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/>.

/**
* tool_mobile plugin event handler definition.
*
* @package tool_mobile
* @category event
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$observers = [
[
'eventname' => '\core\event\user_loggedin',
'callback' => '\tool_mobile\event_handler::handle_user_loggedin',
],
];
13 changes: 13 additions & 0 deletions html/admin/tool/mobile/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,16 @@ function tool_mobile_pre_processor_message_send($procname, $data) {
$data->fullmessagehtml .= html_writer::tag('p', get_string('readingthisemailgettheapp', 'tool_mobile', $url->out()));
}
}

/**
* Callback to add headers before the HTTP headers are sent.
*
*/
function tool_mobile_before_http_headers() {
global $CFG;

// Set Partitioned and Secure attributes to the MoodleSession cookie if the user is using the Moodle app.
if (\core_useragent::is_moodle_app()) {
\core\session\utility\cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']);
}
}
2 changes: 1 addition & 1 deletion html/admin/tool/mobile/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

defined('MOODLE_INTERNAL') || die();
$plugin->version = 2022112800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2022112801; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022111800; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
Expand Down
2 changes: 1 addition & 1 deletion html/auth/lti/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function complete_login(array $launchdata, moodle_url $returnurl, int $pr
if (isloggedin()) {
// If a different user is currently logged in, authenticate the linked user instead.
global $USER;
if ((int) $USER->id !== $user->id) {
if ($USER->id !== $user->id) {
complete_user_login($user);
}
// If the linked user is already logged in, skip the call to complete_user_login() because this affects deep linking
Expand Down
48 changes: 48 additions & 0 deletions html/auth/lti/classes/local/ltiadvantage/event/event_handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,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/>.

namespace auth_lti\local\ltiadvantage\event;

use auth_lti\local\ltiadvantage\utility\cookie_helper;
use core\event\user_loggedin;

/**
* Event handler for auth_lti.
*
* @package auth_lti
* @copyright 2024 Jake Dallimore <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class event_handler {

/**
* Allows the plugin to augment Set-Cookie headers when the user_loggedin event is fired as part of complete_user_login() calls.
*
* @param user_loggedin $event the event
* @return void
*/
public static function handle_user_loggedin(user_loggedin $event): void {
// The event data isn't important here. The intent of this listener is to ensure that the MoodleSession cookie is set up
// properly during LTI launches + login. This means two things:
// i) it's set with SameSite=None; Secure; where possible (since OIDC needs HTTPS this will almost always be possible).
// ii) it set with the 'Partitioned' attribute, when required.
// The former ensures cross-site cookies are sent for embedded launches. The latter is an opt-in flag needed to use Chrome's
// partitioning mechanism, CHIPS.
if (cookie_helper::cookies_supported()) {
cookie_helper::setup_session_cookie();
}
}
}
Loading

0 comments on commit ce4b119

Please sign in to comment.