Skip to content

Commit

Permalink
"MDL-14129, fix error() in feedback module"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Dec 12, 2008
1 parent 47ceac4 commit cf238ea
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
10 changes: 5 additions & 5 deletions mod/feedback/analysis_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@
$courseid = optional_param('courseid', false, PARAM_INT);

if(($searchcourse OR $courseitemfilter OR $coursefilter) AND !confirm_sesskey()) {
error('no sesskey defined');
print_error('invalidsesskey');
}

if ($id) {
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}

if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
error("Course is misconfigured");
print_error('coursemisconf');
}

if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
error("Course module is incorrect");
print_error('invalidcoursemodule');
}
}
$capabilities = feedback_load_capabilities($cm->id);

require_login($course->id, true, $cm);

if( !( (intval($feedback->publish_stats) == 1) || $capabilities->viewreports)) {
error(get_string('error'));
print_error('error');
}

/// Print the page header
Expand Down
23 changes: 12 additions & 11 deletions mod/feedback/complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$highlightrequired = false;

if(($formdata = data_submitted()) AND !confirm_sesskey()) {
error('no sesskey defined');
print_error('invalidsesskey');
}

//if the use hit enter into a textfield so the form should not submit
Expand All @@ -48,7 +48,7 @@
$gonextpage = false;
$gopreviouspage = true;
}else {
error('parameter (gopage) required');
print_error('missingparameter');
}
}else {
$gonextpage = $gopreviouspage = false;
Expand All @@ -57,15 +57,15 @@

if ($id) {
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}

if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
error("Course is misconfigured");
print_error('coursemisconf');
}

if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
error("Course module is incorrect");
print_error('invalidcoursemodule');
}
}

Expand All @@ -84,7 +84,7 @@
if($course->id == SITEID AND !$capabilities->edititems) {
if($DB->get_records('feedback_sitecourse_map', array('feedbackid'=>$feedback->id))) {
if(!$DB->get_record('feedback_sitecourse_map', array('feedbackid'=>$feedback->id, 'courseid'=>$courseid))){
error("this feedback is not available");
print_error('notavailable', 'feedback');
}
}
}
Expand All @@ -109,12 +109,12 @@
require_course_login($course2); //this overwrites the object $course :-(
$course = $DB->get_record("course", array("id"=>$cm->course)); // the workaround
}else {
error("courseid is not correct");
print_error('invalidcourseid');
}
}

if(!$capabilities->complete) {
error(get_string('error'));
print_error('error');
}

/// Print the page header
Expand Down Expand Up @@ -168,7 +168,8 @@
if($feedback_can_submit) {
//preserving the items
if($preservevalues == 1){
if(!$SESSION->feedback->is_started == true)error('error', $CFG->wwwroot.'/course/view.php?id='.$course->id);
if(!$SESSION->feedback->is_started == true)
print_error('error', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
//checken, ob alle required items einen wert haben
if(feedback_check_values($_POST, $startitempos, $lastitempos)) {
$userid = $USER->id; //arb
Expand All @@ -183,7 +184,7 @@
if(isset($lastpage)) {
$gopage = $lastpage;
}else {
error('parameter failed');
print_error('missingparameter');
}
}
}else {
Expand All @@ -192,7 +193,7 @@
if(isset($lastpage)) {
$gopage = $lastpage;
}else {
error('parameter failed');
print_error('missingparameter');
}

}
Expand Down
2 changes: 1 addition & 1 deletion mod/feedback/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$id = required_param('id', PARAM_INT);

if (!$course = $DB->get_record('course', array('id'=>$id))) {
error("Course ID is incorrect");
print_error('invalidcourseid');
}
$capabilities = feedback_load_course_capabilities($course->id);

Expand Down
10 changes: 5 additions & 5 deletions mod/feedback/show_entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@

if ($id) {
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}

if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
error("Course is misconfigured");
print_error('coursemisconf');
}

if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
error("Course module is incorrect");
print_error('invalidcoursemodule');
}
}

Expand All @@ -65,11 +65,11 @@
require_login($course->id, true, $cm);

if(($formdata = data_submitted()) AND !confirm_sesskey()) {
error('no sesskey defined');
print_error('invalidsesskey');
}

if(!$capabilities->viewreports){
error(get_string('error'));
print_error('error');
}

////////////////////////////////////////////////////////
Expand Down
10 changes: 5 additions & 5 deletions mod/feedback/show_entries_anonym.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@
$userid = optional_param('userid', false, PARAM_INT);

if(($formdata = data_submitted()) AND !confirm_sesskey()) {
error('no sesskey defined');
print_error('invalidsesskey');
}

if ($id) {
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
error("Course Module ID was incorrect");
print_error('invalidcoursemodule');
}

if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
error("Course is misconfigured");
print_error('coursemisconf');
}

if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) {
error("Course module is incorrect");
print_error('invalidcoursemodule');
}
}
$capabilities = feedback_load_capabilities($cm->id);

require_login($course->id, true, $cm);

if(!$capabilities->viewreports){
error(get_string('error'));
print_error('error');
}


Expand Down

0 comments on commit cf238ea

Please sign in to comment.