nwiki images - file not found error: nwiki error or other?

nwiki images - file not found error: nwiki error or other?

by Lael ... -
Number of replies: 3
Hi,

I'm having an error with nwiki in 1.9
The images are not showing up in firefox at all (don't even show as a broken image), but in IE they show as broken images. The images were showing up previously... but I am not sure what changed when they broke.

Here is the weird thing - the files exist in the location that the broken image box indicates, BUT - if I try to navigate them using the site files browser, I get a file not found error. If I navigate the directory on the webserver, the files ARE there. If I try to re-upload the images inside the wiki, the wiki tells me the file already exists...

Any ideas?
Average of ratings: -
In reply to Lael ...

Re: nwiki images - file not found error: nwiki error or other?

by James Bossert -
We're having the same problem. Did you figure it out? Thanks! smile
In reply to James Bossert

Re: nwiki images - file not found error: nwiki error or other?

by Lael ... -
nope... came back hoping someone else had... still unsure - any joy for you?
In reply to Lael ...

Re: nwiki images - file not found error: nwiki error or other?

by Lael ... -
James sent me the following hack they are using to make this work - i can confirm it works for us as well, but we were both wondering if it might cause any security issues? Any one have more of an idea?


We made the following change to Moodle to fix this (in file.php):

Here is the code from before:

// security: force download of all attachments submitted by students
if (count($args) >= 3 and strtolower($args[1]) === 'moddata') {
$mod = clean_param($args[2], PARAM_SAFEDIR);
if (file_exists("$CFG->dirroot/mod/$mod/lib.php")) {
if (!$forcedownload) {
require_once("$CFG->dirroot/mod/$mod/lib.php");
$trustedfunction = $mod.'_is_moddata_trusted';
if (function_exists($trustedfunction)) {
// force download of all attachments that are not trusted
$forcedownload = !$trustedfunction();
} else {
$forcedownload = 1;
}
}
} else {
// module is not installed - better not serve file at all
not_found($course->id);
}
}

And here is the code after (the change is in the 2nd line):

// security: force download of all attachments submitted by students
if (count($args) >= 3 and strtolower($args[1]) === 'moddata' &&
strpos($args[2],'wiki') != FALSE) {
$mod = clean_param($args[2], PARAM_SAFEDIR);
if (file_exists("$CFG->dirroot/mod/$mod/lib.php")) {
if (!$forcedownload) {
require_once("$CFG->dirroot/mod/$mod/lib.php");
$trustedfunction = $mod.'_is_moddata_trusted';
if (function_exists($trustedfunction)) {
// force download of all attachments that are not trusted
$forcedownload = !$trustedfunction();
} else {
$forcedownload = 1;
}
}
} else {
// module is not installed - better not serve file at all
not_found($course->id);
}
}


Lael