mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
general cleanup of xxx_parameter() functions + fixed several register globals problems
This commit is contained in:
parent
44582764af
commit
0cdae0dcaa
@ -6,6 +6,9 @@
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
require_once($CFG->dirroot.'/mod/lams/constants.php');
|
||||
require_once($CFG->dirroot.'/lib/weblib.php');
|
||||
|
||||
$topic = optional_param('topic', -1, PARAM_INT);
|
||||
|
||||
// Bounds for block widths
|
||||
define('BLOCK_L_MIN_WIDTH', 100);
|
||||
define('BLOCK_L_MAX_WIDTH', 210);
|
||||
@ -17,7 +20,7 @@ $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_widt
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
if (isset($topic)) {
|
||||
if ($topic != -1) {
|
||||
$displaysection = course_set_display($course->id, $topic);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) { // for admins, mostly
|
||||
@ -269,7 +272,7 @@ while ($section <= $course->numsections) {
|
||||
|
||||
echo '<td class="right side">';
|
||||
if ($displaysection == $section) { // Show the zoom boxes
|
||||
echo '<a href="view.php?id='.$course->id.'&topic=all#section-'.$section.'" title="'.$strshowalltopics.'">'.
|
||||
echo '<a href="view.php?id='.$course->id.'&topic=0#section-'.$section.'" title="'.$strshowalltopics.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/all.gif" height="25" width="16" border="0" /></a><br />';
|
||||
} else {
|
||||
$strshowonlytopic = get_string('showonlytopic', '', $section);
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
|
||||
$topic = optional_param('topic', -1, PARAM_INT);
|
||||
|
||||
// Bounds for block widths
|
||||
define('BLOCK_L_MIN_WIDTH', 100);
|
||||
define('BLOCK_L_MAX_WIDTH', 210);
|
||||
@ -19,7 +21,7 @@
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
if (isset($topic)) {
|
||||
if ($topic != -1) {
|
||||
$displaysection = course_set_display($course->id, $topic);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) { // for admins, mostly
|
||||
@ -198,7 +200,7 @@
|
||||
|
||||
echo '<td class="right side">';
|
||||
if ($displaysection == $section) { // Show the zoom boxes
|
||||
echo '<a href="view.php?id='.$course->id.'&topic=all#section-'.$section.'" title="'.$strshowalltopics.'">'.
|
||||
echo '<a href="view.php?id='.$course->id.'&topic=0#section-'.$section.'" title="'.$strshowalltopics.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/all.gif" height="25" width="16" border="0" alt="'.$strshowalltopics.'" /></a><br />';
|
||||
} else {
|
||||
$strshowonlytopic = get_string('showonlytopic', '', $section);
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
require_once("$CFG->dirroot/mod/forum/lib.php");
|
||||
|
||||
$week = optional_param('week', -1, PARAM_INT);
|
||||
|
||||
// Bounds for block widths
|
||||
define('BLOCK_L_MIN_WIDTH', 100);
|
||||
define('BLOCK_L_MAX_WIDTH', 210);
|
||||
@ -15,7 +17,7 @@
|
||||
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
|
||||
BLOCK_R_MAX_WIDTH);
|
||||
|
||||
if (isset($week)) {
|
||||
if ($week != -1) {
|
||||
$displaysection = course_set_display($course->id, $week);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) {
|
||||
@ -198,7 +200,7 @@
|
||||
echo '<td class="right side">';
|
||||
|
||||
if ($displaysection == $section) {
|
||||
echo '<a href="view.php?id='.$course->id.'&week=all#section-'.$section.'" title="'.$strshowallweeks.'">'.
|
||||
echo '<a href="view.php?id='.$course->id.'&week=0#section-'.$section.'" title="'.$strshowallweeks.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/all.gif" class="icon wkall" alt="'.$strshowallweeks.'" /></a><br />';
|
||||
} else {
|
||||
$strshowonlyweek = get_string("showonlyweek", "", $section);
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
require_once("$CFG->dirroot/mod/forum/lib.php");
|
||||
|
||||
$week = optional_param('week', -1, PARAM_INT);
|
||||
|
||||
// Bounds for block widths; in PIXELS.
|
||||
define('BLOCK_L_MIN_WIDTH', 100);
|
||||
define('BLOCK_L_MAX_WIDTH', 210);
|
||||
@ -47,7 +49,7 @@
|
||||
$min_max_block= 'min-width:100px; max-width:210px; ';
|
||||
$min_max_main = 'min-width:25em; max-width:37em; '; //33em
|
||||
|
||||
if (isset($week)) {
|
||||
if ($week != -1) {
|
||||
$displaysection = course_set_display($course->id, $week);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) {
|
||||
@ -226,7 +228,7 @@
|
||||
echo '</div><div class="right side">';
|
||||
|
||||
if ($displaysection == $section) {
|
||||
echo '<a href="view.php?id='.$course->id.'&week=all#section-'.$section.'" title="'.$strshowallweeks.'">'.
|
||||
echo '<a href="view.php?id='.$course->id.'&week=0#section-'.$section.'" title="'.$strshowallweeks.'">'.
|
||||
'<img src="'.$CFG->pixpath.'/i/all.gif" class="icon wkall" alt="'.$strshowallweeks.'" /></a><br />';
|
||||
} else {
|
||||
$strshowonlyweek = get_string("showonlyweek", "", $section);
|
||||
|
@ -8,19 +8,21 @@
|
||||
require_login();
|
||||
|
||||
$sectionreturn = optional_param('sr', '', PARAM_INT);
|
||||
$add = optional_param( 'add','',PARAM_ALPHA );
|
||||
$type = optional_param( 'type','',PARAM_ALPHA );
|
||||
$indent = optional_param( 'indent',0,PARAM_INT );
|
||||
$update = optional_param( 'update',0,PARAM_INT );
|
||||
$hide = optional_param( 'hide',0,PARAM_INT );
|
||||
$show = optional_param( 'show',0,PARAM_INT );
|
||||
$copy = optional_param( 'copy',0,PARAM_INT );
|
||||
$moveto = optional_param( 'moveto',0,PARAM_INT );
|
||||
$movetosection = optional_param( 'movetosection',0,PARAM_INT );
|
||||
$delete = optional_param( 'delete',0,PARAM_INT );
|
||||
$course = optional_param( 'course',0,PARAM_INT );
|
||||
$groupmode = optional_param( 'groupmode',-1,PARAM_INT );
|
||||
$duplicate = optional_param( 'duplicate',0,PARAM_INT );
|
||||
$add = optional_param('add','', PARAM_ALPHA);
|
||||
$type = optional_param('type', '', PARAM_ALPHA);
|
||||
$indent = optional_param('indent', 0, PARAM_INT);
|
||||
$update = optional_param('update', 0, PARAM_INT);
|
||||
$hide = optional_param('hide', 0, PARAM_INT);
|
||||
$show = optional_param('show', 0, PARAM_INT);
|
||||
$copy = optional_param('copy', 0, PARAM_INT);
|
||||
$moveto = optional_param('moveto', 0, PARAM_INT);
|
||||
$movetosection = optional_param('movetosection', 0, PARAM_INT);
|
||||
$delete = optional_param('delete', 0, PARAM_INT);
|
||||
$course = optional_param('course', 0, PARAM_INT);
|
||||
$groupmode = optional_param('groupmode', -1, PARAM_INT);
|
||||
$duplicate = optional_param('duplicate', 0, PARAM_INT);
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
$cancelcopy = optional_param('cancelcopy', 0, PARAM_BOOL);
|
||||
|
||||
if (isset($SESSION->modform)) { // Variables are stored in the session
|
||||
$mod = $SESSION->modform;
|
||||
@ -29,7 +31,7 @@
|
||||
$mod = (object)$_POST;
|
||||
}
|
||||
|
||||
if (isset($cancel)) {
|
||||
if ($cancel) {
|
||||
if (!empty($SESSION->returnpage)) {
|
||||
$return = $SESSION->returnpage;
|
||||
unset($SESSION->returnpage);
|
||||
|
@ -7,14 +7,15 @@
|
||||
require_once($CFG->libdir.'/blocklib.php');
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT);
|
||||
$name = optional_param('name');
|
||||
$edit = optional_param('edit','',PARAM_ALPHA);
|
||||
$idnumber = optional_param('idnumber');
|
||||
$topic = optional_param('topic',0,PARAM_INT);
|
||||
$studentview = optional_param('studentview','',PARAM_ALPHA);
|
||||
$section = optional_param('section',0,PARAM_INT);
|
||||
$move = optional_param('move',0,PARAM_INT);
|
||||
$marker = optional_param('marker',0,PARAM_INT);
|
||||
$name = optional_param('name', '', PARAM_RAW);
|
||||
$edit = optional_param('edit', -1, PARAM_BOOL);
|
||||
$hide = optional_param('hide', 0, PARAM_INT);
|
||||
$show = optional_param('show', 0, PARAM_INT);
|
||||
$idnumber = optional_param('idnumber', '', PARAM_RAW);
|
||||
$studentview = optional_param('studentview', -1, PARAM_BOOL);
|
||||
$section = optional_param('section', 0, PARAM_INT);
|
||||
$move = optional_param('move', 0, PARAM_INT);
|
||||
$marker = optional_param('marker',0 , PARAM_INT);
|
||||
|
||||
|
||||
if (empty($id) && empty($name) && empty($idnumber)) {
|
||||
@ -69,14 +70,14 @@
|
||||
}
|
||||
|
||||
// need to check this here, as studentview=on disables edit allowed (where 'on' is checked)
|
||||
if (($studentview == 'off') and confirm_sesskey()) {
|
||||
if (($studentview == 0) and confirm_sesskey()) {
|
||||
$USER->studentview = false;
|
||||
}
|
||||
|
||||
if ($PAGE->user_allowed_editing()) {
|
||||
if (($edit == 'on') and confirm_sesskey()) {
|
||||
if (($edit == 1) and confirm_sesskey()) {
|
||||
$USER->editing = true;
|
||||
} else if (($edit == 'off') and confirm_sesskey()) {
|
||||
} else if (($edit == 0) and confirm_sesskey()) {
|
||||
$USER->editing = false;
|
||||
if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
|
||||
$USER->activitycopy = false;
|
||||
@ -84,16 +85,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (($studentview == 'on') and confirm_sesskey()) {
|
||||
if (($studentview == 1) and confirm_sesskey()) {
|
||||
$USER->studentview = true;
|
||||
$USER->editing = false;
|
||||
}
|
||||
|
||||
if (isset($hide) && confirm_sesskey()) {
|
||||
if ($hide && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $hide, '0');
|
||||
}
|
||||
|
||||
if (isset($show) && confirm_sesskey()) {
|
||||
if ($show && confirm_sesskey()) {
|
||||
set_section_visible($course->id, $show, '1');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user