fixed issue with premium key not properly handling unicode spaces in key wrappers
This commit is contained in:
parent
50110a3e0f
commit
39d184c2e9
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -9,7 +9,6 @@
|
|||
"spellright.documentTypes": [
|
||||
"markdown",
|
||||
"latex",
|
||||
"plaintext",
|
||||
"php"
|
||||
"plaintext"
|
||||
]
|
||||
}
|
2
amd/build/vue/vue.min.js
vendored
2
amd/build/vue/vue.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
11907
amd/src/vue/vue.js
11907
amd/src/vue/vue.js
File diff suppressed because one or more lines are too long
|
@ -115,13 +115,16 @@ Klc5I28bGbvxIV5pnL6ZSjHEDp2WreM8HB0XFJwU+Q==
|
|||
$start = -1;
|
||||
$end = -1;
|
||||
for($i = 0; $i < count($parts); $i++) {
|
||||
if ( $parts[$i] == $START_HEADER ) {
|
||||
$p = trim(preg_replace('/\s+/u', ' ', $parts[$i])); // Make sure all unicode spaces are converted to normal spaces before comparing...
|
||||
|
||||
if ( $p == $START_HEADER ) {
|
||||
$start = $i+1;
|
||||
}
|
||||
if ($start > 0 && $parts[$i] == $END_HEADER) {
|
||||
if ($start > 0 && $p == $END_HEADER) {
|
||||
$end = $i;
|
||||
}
|
||||
}
|
||||
|
||||
if ($start < 0 || $end < 0 || $end - $start <= 0) {
|
||||
throw new \ValueError("Invalid activation key wrappers");
|
||||
} else {
|
||||
|
@ -277,8 +280,9 @@ Klc5I28bGbvxIV5pnL6ZSjHEDp2WreM8HB0XFJwU+Q==
|
|||
private static function website_match($key) {
|
||||
global $CFG;
|
||||
$site = $CFG->wwwroot;
|
||||
|
||||
// Add double slashes to key and site if no scheme is set.
|
||||
// Basically: if no double slashes present before any dots,shashes or @s.
|
||||
// Basically: if no double slashes present before any dots,slashes or @s.
|
||||
if(!\preg_match_all('#^[^./@]*?//#',$key )) {
|
||||
$key = "//".$key;
|
||||
}
|
||||
|
|
|
@ -565,10 +565,12 @@ class studentstudyplanservice extends \external_api {
|
|||
|
||||
$list = [];
|
||||
foreach ($records as $r) {
|
||||
try {
|
||||
$studyplan = studyplan::find_by_id($r->studyplan_id);
|
||||
if (has_capability(self::CAP_COACH,$studyplan->context(),$USER)) {
|
||||
$list[] = $studyplan->simple_model_coach();
|
||||
}
|
||||
} catch(\Exception $x) {}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
|
|
@ -499,9 +499,17 @@ class studyplan {
|
|||
if ($DB->count_records('local_treestudyplan_page', ['studyplan_id' => $this->id]) > 0) {
|
||||
return success::fail('cannot delete studyplan that still has pages');
|
||||
} else {
|
||||
// Delete any coach links for this studyplan before deleting the studyplan itself.
|
||||
$DB->delete_records("local_treestudyplan_coach", ["studyplan_id" => $this->id]);
|
||||
// TODO: Check if students and cohorts need to be removed at this time too..
|
||||
$DB->delete_records("local_treestudyplan_cohort", ["studyplan_id" => $this->id]);
|
||||
//
|
||||
$DB->delete_records("local_treestudyplan_user", ["studyplan_id" => $this->id]);
|
||||
//
|
||||
$DB->delete_records('local_treestudyplan', ['id' => $this->id]);
|
||||
return success::success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plug-in for Moodle
|
||||
// This file is part of the study plan plug-in for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
// This file is part of the study plan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,8 +25,8 @@ $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-260
|
|||
$plugin->version = 2024051800; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||
|
||||
$plugin->release = "1.2.0";
|
||||
$plugin->maturity = MATURITY_BETA; /*MATURITY_STABLE;*/
|
||||
$plugin->release = "1.3.0";
|
||||
$plugin->maturity = MATURITY_STABLE; /*MATURITY_STABLE;*/
|
||||
|
||||
// Supported from Moodle 3.11 to 4.3.
|
||||
$plugin->supported = [ 311, 403];
|
||||
|
|
Loading…
Reference in New Issue
Block a user