Skip to content

Commit d767819

Browse files
Release 3.77.1
1 parent 58aed01 commit d767819

File tree

6 files changed

+105
-85
lines changed

6 files changed

+105
-85
lines changed
Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
11
<?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-
172

183
class com_wiris_system_service_HttpRequest {
19-
public $extraParams;
20-
private $wrap;
21-
22-
public function __construct() {
23-
if(!php_Boot::$skip_constructor) {
24-
$this->extraParams = new Hash();
25-
$this->wrap = com_wiris_system_CallWrapper::getInstance();
26-
}}
27-
28-
public function setParameter($key, $value) {
29-
$this->extraParams->set($key, $value);
30-
}
31-
public function getParameterNames() {
32-
// At this point we need to access directly to $_GET and $_POST variables because
33-
// we don't know what params are sended via POST or GET.
34-
// For security reasons this method only returns the params names.
35-
// To get the param value optional_param method.
36-
$param = new _hx_array(array());
37-
$key = "";
38-
foreach ($_GET as $key => $value) {
39-
$param->insert(0, $key);
40-
}
41-
foreach ($_POST as $key => $value) {
42-
$param->insert(0, $key);
43-
}
44-
return $param;
45-
}
46-
47-
public function getContextURL() {
48-
return "";
49-
}
50-
51-
public function getParameter($key) {
52-
$this->wrap->stop();
53-
$parameter = null;
54-
if (optional_param($key, null, PARAM_RAW) != null) {
55-
$parameter = optional_param($key, null, PARAM_RAW);
56-
} else {
57-
if ($this->extraParams->exists($key)) {
58-
$parameter = $this->extraParams->get($key);
59-
}
60-
}
61-
$this->wrap->start();
62-
return $parameter;
63-
}
64-
4+
public function __construct() {
5+
if(!php_Boot::$skip_constructor) {
6+
$this->extraParams = new Hash();
7+
$this->headers = new Hash();
8+
$this->setHeaders();
9+
}}
10+
public function getHeader($key) {
11+
$httpKey = null;
12+
$httpKey = "HTTP_" . $this->headers->get($key);
13+
$header = null;
14+
$header = isset($_SERVER[$httpKey]) ? $_SERVER[$httpKey] : '';
15+
return $header;
16+
}
17+
public function setParameter($key, $value) {
18+
$this->extraParams->set($key, $value);
19+
}
20+
public function getParameterNames() {
21+
$param = new _hx_array(array());
22+
$key = "";
23+
foreach ($_GET as $key => $value) {
24+
$param->insert(0, $key);
25+
}
26+
foreach ($_POST as $key => $value) {
27+
$param->insert(0, $key);
28+
}
29+
return $param;
30+
}
31+
public function getContextURL() {
32+
return "";
33+
}
34+
public function getParameter($key) {
35+
$param = null;
36+
if(isset($_POST[$key])) {
37+
$param = $_POST[$key];
38+
} else {
39+
if(isset($_GET[$key])) {
40+
$param = $_GET[$key];
41+
} else {
42+
if($this->extraParams->exists($key)) {
43+
return $this->extraParams->get($key);
44+
}
45+
}
46+
}
47+
return $param;
48+
}
49+
public function setHeaders() {
50+
$this->headers->set("User-Agent", "USER_AGENT");
51+
}
52+
public $headers;
53+
public $extraParams;
54+
public function __call($m, $a) {
55+
if(isset($this->$m) && is_callable($this->$m))
56+
return call_user_func_array($this->$m, $a);
57+
else if(isset($this->»dynamics[$m]) && is_callable($this->»dynamics[$m]))
58+
return call_user_func_array($this->»dynamics[$m], $a);
59+
else if('toString' == $m)
60+
return $this->__toString();
61+
else
62+
throw new HException('Unable to call «'.$m.'»');
63+
}
64+
function __toString() { return 'com.wiris.system.service.HttpRequest'; }
6565
}

quizzes/lib/integration.ini

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ quizzes.hand.logtraces = "true"
135135
;
136136
;quizzes.graph.url = "http://www.wiris.net/demo/graph"
137137

138-
139-
;
140-
; Classpath and Class used in Moodle to overwrite service.php and cache folder path
141-
;
142-
143-
quizzes.configuration.classpath = "../classes"
144-
quizzes.configuration.class = "MoodleConfiguration"
145-
146-
;
147-
; Classpath and Class used in Moodle to manage the access to services
148-
;
149-
quizzes.accessprovider.classpath = ../classes
150-
quizzes.accessprovider.class = accessprovider
151-
138+
;
139+
; Classpath and Class used in Moodle to overwrite service.php and cache folder path
140+
;
141+
142+
quizzes.configuration.classpath = "../classes"
143+
quizzes.configuration.class = "MoodleConfiguration"
144+
145+
;
146+
; Classpath and Class used in Moodle to manage the access to services
147+
;
148+
quizzes.accessprovider.classpath = ../classes
149+
quizzes.accessprovider.class = accessprovider
150+
151+

quizzes/lib/quizzes.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,6 +2184,7 @@ com.wiris.quizzes.JsAlgorithmInput.prototype = $extend(com.wiris.quizzes.JsInput
21842184
return session;
21852185
}
21862186
,setValue: function(v) {
2187+
var sessionChanged = v != this.value;
21872188
com.wiris.quizzes.JsInput.prototype.setValue.call(this,v);
21882189
if(this.isEmpty()) this.value = this.getEmptyWirisCasSession();
21892190
this.input.value = this.value;
@@ -2207,7 +2208,7 @@ com.wiris.quizzes.JsAlgorithmInput.prototype = $extend(com.wiris.quizzes.JsInput
22072208
if(this.isEmpty()) this.calcLauncher.hideWarning(); else this.calcLauncher.showWarning();
22082209
}
22092210
}
2210-
if(this.onSessionChanged != null) this.onSessionChanged();
2211+
if(sessionChanged && this.onSessionChanged != null) this.onSessionChanged();
22112212
}
22122213
,getValue: function() {
22132214
this.value = this.input.value;
@@ -2504,7 +2505,7 @@ com.wiris.quizzes.JsCasJnlpLauncher.prototype = $extend(com.wiris.quizzes.JsInpu
25042505
} else {
25052506
this.setButtonEnabled(true);
25062507
this.setNote(this.t("error"));
2507-
haxe.Log.trace(session.get("error"),{ fileName : "JsComponent.hx", lineNumber : 1768, className : "com.wiris.quizzes.JsCasJnlpLauncher", methodName : "sessionReceived"});
2508+
haxe.Log.trace(session.get("error"),{ fileName : "JsComponent.hx", lineNumber : 1770, className : "com.wiris.quizzes.JsCasJnlpLauncher", methodName : "sessionReceived"});
25082509
}
25092510
}
25102511
,pollServiceImpl: function() {
@@ -2822,23 +2823,29 @@ com.wiris.quizzes.JsCalcWrapper.__super__ = com.wiris.quizzes.JsInput;
28222823
com.wiris.quizzes.JsCalcWrapper.prototype = $extend(com.wiris.quizzes.JsInput.prototype,{
28232824
setImaginaryUnits: function(options) {
28242825
var _g = this;
2825-
if(this.calc != null) this.calc.actionWithParams("setImaginaryUnitRestrictions",options); else this.setImaginaryUnitRestrictions = function() {
2826+
if(this.calc != null) try {
2827+
this.calc.actionWithParams("setImaginaryUnitRestrictions",options);
2828+
} catch( e ) {
2829+
} else this.setImaginaryUnitRestrictions = function() {
28262830
_g.setImaginaryUnits(options);
28272831
};
28282832
}
28292833
,setSeparators: function(options) {
28302834
var _g = this;
2831-
if(this.calc != null) {
2835+
if(this.calc != null) try {
28322836
this.calc.actionWithParams("setSeparatorRestrictions",options);
28332837
this.setValue(this.calc.getContent());
2838+
} catch( e ) {
28342839
} else this.setSeparatorRestrictions = function() {
28352840
_g.setSeparators(options);
28362841
};
28372842
}
28382843
,setDocumentProperty: function(name,value) {
28392844
if(this.calc != null) {
2840-
this.calc.calcModel.setDocumentProperty(name,value);
2841-
this.setValue(this.calc.getContent());
2845+
if(this.calc.calcModel.getDocumentProperty(name) != value) {
2846+
this.calc.calcModel.setDocumentProperty(name,value);
2847+
this.setValue(this.calc.getContent());
2848+
}
28422849
} else this.initParams[name] = value;
28432850
}
28442851
,initCalc: function() {

quizzes/test.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
if(version_compare(PHP_VERSION, '5.1.0', '<')) {
3+
exit('Your current PHP version is: ' . PHP_VERSION . '. Wiris Quizzes needs version 5.1.0 or later');
4+
}
5+
;
6+
$bootfile = dirname(__FILE__) . '/../bootstrap.php';
7+
if (@is_readable($bootfile)) require_once($bootfile);
8+
9+
require_once dirname(__FILE__) . '/lib/php/Boot.class.php';
10+
11+
com_wiris_quizzes_test_Tester::main();
12+
13+
?>

thirdpartylibs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<library>
44
<location>quizzes</location>
55
<name>Wiris Quizzes engine</name>
6-
<version>3.76.0.1053</version>
6+
<version>3.77.1</version>
77
<license>GPL</license>
88
<licenseversion>3.0+</licenseversion>
99
</library>

version.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

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

19-
$plugin->version = 2019091200;
19+
$plugin->version = 2019091300;
2020
$plugin->requires = 2011120500; // Moodle 2.2.
21-
22-
$plugin->maturity = MATURITY_BETA;
21+
$plugin->release = '3.77.1';
22+
$plugin->maturity = MATURITY_STABLE;
2323
$plugin->component = 'qtype_wq';
2424
$plugin->dependencies = array (
2525
'filter_wiris' => ANY_VERSION

0 commit comments

Comments
 (0)