You don't have permission to access /moodle/question/question.php on this server.
Re: You don't have permission to access /moodle/question/question.php on this server.
Re: You don't have permission to access /moodle/question/question.php on this server.
Re: You don't have permission to access /moodle/question/question.php on this server.
http://tracker.moodle.org/browse/MDL-21233
Clearly, mod_security blocks this behavior for a reason.
To check if this is your problem, when you see the error when using the question module, look at the url on your web browser's url window. Scroll right to look at the returnurl variable. You should see your site name beginning with http:// with some HEX encoded url stuff and ending with your .edu / .org, etc. Erase from the http to the .org part and hit return--you'll see your question.
Now this is a rather brutish hack, but it saves you from creating a .htaccess file and slowing the system. Besides, the problem will go way with 2.0 anyway. Do not attempt this unless you are familiar with editing and testing programs.
First, for the question/editlib.php file, add this function to the bottom of the code:
// make moodle 2.0-like return url 07/04/2010
function fix_embed_url($badurl){
$repaired_url = preg_replace( '/http.*org/','',$badurl);
return $repaired_url;
Next,
in the same file, everywhere you find $returnurl = blah blah, add the following line:
$returnurl = fix_embed_url($returnurl); // your_name_here
Re: You don't have permission to access /moodle/question/question.php on this server.
Thanks, Jerre, for your clear answer to this problem...
My question must look ridiculous to you (I know nothing about php editing - I just follow instructions), but could you please explain me where to add the last line.
My editlib.php looks like this:
$returnurl = $pageurl->out(false, array('category'=>"$tocategoryid,$contextid"));
if (!$checkforfiles){
if (!question_move_questions_to_category(implode(',', $questionids), $tocategory->id)) {
print_error('errormovingquestions', 'question', $returnurl, $questionids);
}
redirect($returnurl);
} else {
$movecontexturl = new moodle_url($CFG->wwwroot.'/question/contextmoveq.php',
array('returnurl' => $returnurl,
'ids'=>$questionidlist,
'tocatid'=> $tocategoryid));
if ($cm){
$movecontexturl->param('cmid', $cm->id);
} else {
$movecontexturl->param('courseid', $COURSE->id);
}
redirect($movecontexturl->out());
}
}
}
if (optional_param('deleteselected', false, PARAM_BOOL)) { // delete selected questions from the category
if (($confirm = optional_param('confirm', '', PARAM_ALPHANUM)) and confirm_sesskey()) { // teacher has already confirmed the action
$deleteselected = required_param('deleteselected');
Where exactly should I paste it?
Re: You don't have permission to access /moodle/question/question.php on this server.
$returnurl =
place the line I described directly beneath it.
$returnurl = fix_embed_url($returnurl); // eliana
This overrides the line above and helps you see what you've changed.
Paste the Function paragraph I showed you at the bottom of the file, before ?> at the end of the file.
Before you start editing, copy the original editlib.php to a safe place so that you can start over if necessary.
Re: You don't have permission to access /moodle/question/question.php on this server.
Thanks, Jerre, for your answer.
I´ve done it, but after the change it doesn´t show the quiz, just a blank page.
Is there anything else I could do?
Re: You don't have permission to access /moodle/question/question.php on this server.
Re: You don't have permission to access /moodle/question/question.php on this server.
Thanks again
The error:
Forbidden
You don't have permission to access /question/question.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at lingua.alcains.com Port 80Url:http://lingua.alcains.com/question/question.php?id=148&cmid=412&returnurl=http%3A%2F%2Flingua.alcains.com%2Fmod%2Fquiz%2Fattempt.php%3Fq%3D8%26amp%3Bpage%3D0%23q148
Re: You don't have permission to access /moodle/question/question.php on this server.
Reproduce error again, then erase the url and paste this one in.
http://lingua.alcains.com/question/question.php?id=148&cmid=412&returnurl=%2Fmod%2Fquiz%2Fattempt.php%3Fq%3D8%26amp%3Bpage%3D0%23q148
Your question should show.
Notice the substitute function was for .org, rather than .com
Replace the .org part with .com instead.
You probably want to temporarily set your System / Administration / Server / Debugging to development mode while you test your script. That way, errors you may introduce will be reported. Once, you've finished testing, set the Debugging back to None.
Re: You don't have permission to access /moodle/question/question.php on this server.
The url you gave shows the question edit window.
I replaced the org for com, and get this from the debugging error:
Parse error: syntax error, unexpected $end in /home/alcains/public_html/lingua/question/editlib.php on line 930
I've probably made some errors editing the file.
Re: You don't have permission to access /moodle/question/question.php on this server.
That means, when you get the edit right, your problem will be solved.
- Start with the original editlib.php
- Take the code with the function noted below and place it at the bottom of the file, above the ?>
- Ah! I see I left out a closing } in my original code post. Sorry. That what I get for trying to communicate in the middle of the night.
function fix_embed_url($badurl){
$repaired_url = preg_replace( '/http.*com/','',$badurl);
return $repaired_url;
}
Lastly, there are two occurrences where $returnurl are assigned. Directly beneath each of these add this line:
$returnurl = fix_embed_url($returnurl); // eliana
I am confident you will succeed.
Re: You don't have permission to access /moodle/question/question.php on this server.
Sorry, Jerre,
I still get the bad url
with the
Forbidden
You don't have permission to access /question/question.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at lingua.alcains.com Port 80
Re: You don't have permission to access /moodle/question/question.php on this server.
I had the same problem today, so I called my webhost and explained the return url security issue to them. They took care of it over the phone for me in two minutes and now it works fine. Not worth the aggravation of trying to fix it yourself.
Jack
Re: You don't have permission to access /moodle/question/question.php on this server.
Jerre made it work for me. (Thank you so much for your help, Jerre)
No need to change the mod_security.
Re: You don't have permission to access /moodle/question/question.php on this server.
Steve K
Re: You don't have permission to access /moodle/question/question.php on this server.
Similarly edited /mod/quiz/attempt.php to remove $CFG-wwwroot ie:
// jcope $quiz->thispageurl = $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . s($quiz->id) . '&page=' . s($page); $quiz->thispageurl = '/mod/quiz/attempt.php?q=' . s($quiz->id) . '&page=' . s($page); // jcope (dropped $CFG->wwwrootThat is, removed the $CFG->wwwroot
Re: You don't have permission to access /moodle/question/question.php on this server.
Can you help me to make all question in system context un-editable for everyone include the question creator, only admin can edit and delete it.
I'm using Moodle 1.9.9+.
Thanks.
Re: You don't have permission to access /moodle/question/question.php on this server.
Re: You don't have permission to access /moodle/question/question.php on this server.
THANK YOU
You don't have permission to access /planestic/moodle/question/question.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Re: You don't have permission to access /moodle/question/question.php on this server.
returnurl=%2Fquestionblah blah the rest of the line is unchanged
Now hit enter and you should end up where you expected.
If that pulled the question edit screen you expected, then you can:
1) disable mod_security at the server, or
2) make the changes I mentioned to question/editlib.php, or
3) convince the authors to more elegantly implement my temporary fix.
---
I noticed that English is probably not your first language so "blah blah" may not translate very well. What I meant was etc, or ..., or [ the normal stuff that follows that does not matter]. I was trying to use a words that would not be mistaken for something to be typed. Hope this helps.