access to $_GET parameters now done using required_param()
HTML tags made XHTML compatible
This commit is contained in:
+44
-44
@@ -5,28 +5,32 @@
|
||||
|
||||
require_login();
|
||||
|
||||
// check variables are all there
|
||||
if (isset($_GET['course']) && isset($_GET['reference']) && isset($_GET['action'])) {
|
||||
// fetch and clean the required $_GET parameters
|
||||
// (script stops here if any parameters are missing)
|
||||
unset($params);
|
||||
$params->action = required_param('action');
|
||||
$params->course = required_param('course');
|
||||
$params->reference = required_param('reference');
|
||||
|
||||
require_login($_GET['course']);
|
||||
|
||||
if (!isteacher($_GET['course'])) {
|
||||
error("You are not allowed to view this page!");
|
||||
}
|
||||
require_login($params->course);
|
||||
|
||||
// decode the reference (not usually necessary)
|
||||
$_GET['reference'] = urldecode($_GET['reference']);
|
||||
if (!isteacher($params->course)) {
|
||||
error("You are not allowed to view this page!");
|
||||
}
|
||||
|
||||
if (isadmin()) {
|
||||
$_GET['location'] = nvl($_GET['location'], HOTPOT_LOCATION_COURSEFILES);
|
||||
} else {
|
||||
$_GET['location'] = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
// decode the reference (not usually necessary)
|
||||
$params->reference = urldecode($params->reference);
|
||||
|
||||
$title = get_string($_GET['action'], 'hotpot').': '.$_GET['reference'];
|
||||
print_header($title, $title);
|
||||
if (isadmin()) {
|
||||
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES);
|
||||
} else {
|
||||
$params->location = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
|
||||
hotpot_print_show_links($_GET['course'], $_GET['location'], $_GET['reference']);
|
||||
$title = get_string($params->action, 'hotpot').': '.$params->reference;
|
||||
print_header($title, $title);
|
||||
|
||||
hotpot_print_show_links($params->course, $params->location, $params->reference);
|
||||
?>
|
||||
<SCRIPT>
|
||||
<!--
|
||||
@@ -49,33 +53,29 @@
|
||||
-->
|
||||
</SCRIPT>
|
||||
<?php
|
||||
print_simple_box_start("center", "96%");
|
||||
if($hp = new hotpot_xml_quiz($_GET)) {
|
||||
print '<PRE id="contents">';
|
||||
switch ($_GET['action']) {
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($hp->source);
|
||||
break;
|
||||
case 'showxmltree':
|
||||
print_r($hp->xml);
|
||||
break;
|
||||
case 'showhtmlsource':
|
||||
print htmlspecialchars($hp->html);
|
||||
break;
|
||||
case 'showhtmlquiz':
|
||||
print $hp->html;
|
||||
break;
|
||||
}
|
||||
print '</PRE>';
|
||||
} else {
|
||||
print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
|
||||
print_simple_box_start("center", "96%");
|
||||
if($hp = new hotpot_xml_quiz($_GET)) {
|
||||
print '<pre id="contents">';
|
||||
switch ($params->action) {
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($hp->source);
|
||||
break;
|
||||
case 'showxmltree':
|
||||
print_r($hp->xml);
|
||||
break;
|
||||
case 'showhtmlsource':
|
||||
print htmlspecialchars($hp->html);
|
||||
break;
|
||||
case 'showhtmlquiz':
|
||||
print $hp->html;
|
||||
break;
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
print '<BR>';
|
||||
close_window_button();
|
||||
|
||||
} else { // no form data given
|
||||
error("This script was called incorrectly");
|
||||
print '</pre>';
|
||||
} else {
|
||||
print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
|
||||
}
|
||||
|
||||
print_simple_box_end();
|
||||
print '<br />';
|
||||
close_window_button();
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user