Moodle

404 in popups of algebra filter pictures

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.5
  • Fix Version/s: None
  • Component/s: Filters, Maths filters
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE

Description

Hi all

Following steps are needed for reproduction.

  • Activate algebra filter
  • Insert for example a label into a course and use the algebra filter @@....@@
  • Finish your editing and click on the generated image. There will be a 404.

The file name should be algebradebug.php instead of displaytex.php, shouldn't it? displaytex.php is just available at the TeX-Filter.

Thanks

Activity

Hide
Karsten Burger added a comment -

Please find attached a possible solution.

Show
Karsten Burger added a comment - Please find attached a possible solution.
Hide
Mauno Korpelainen added a comment -

No it's not correct.

Algebra filter used to call (in old versions of moodle) in links file displaytex.php from tex filter to show just notation when the image was clicked and path was

$CFG->wwwroot/$CFG->texfilterdir/displaytex.php

In the last two security updates this code was changed to allow only administrators see algebradebug.php and the correct lines 68-69 should be

$output .= "\"$CFG->wwwroot/filter/tex/displaytex.php?";
$output .= urlencode($tex) . "\" onclick=\"return openpopup('/filter/tex/displaytex.php?";

(even this is algebra filter) or file displaytex.php could be copied to folder /filter/algebra.

Show
Mauno Korpelainen added a comment - No it's not correct. Algebra filter used to call (in old versions of moodle) in links file displaytex.php from tex filter to show just notation when the image was clicked and path was $CFG->wwwroot/$CFG->texfilterdir/displaytex.php In the last two security updates this code was changed to allow only administrators see algebradebug.php and the correct lines 68-69 should be $output .= "\"$CFG->wwwroot/filter/tex/displaytex.php?"; $output .= urlencode($tex) . "\" onclick=\"return openpopup('/filter/tex/displaytex.php?"; (even this is algebra filter) or file displaytex.php could be copied to folder /filter/algebra.
Hide
Karsten Burger added a comment -

Thank you very much for your respond. Sorry, I don't catch how it should work.
Administrators should have the permission to call algebradebug.php. Even for administrators the called script is displaytex.php which doesn't exist.

In my opinion are the following changes necessary.

  • Administrators should have the possibility to debug their TeX notation. Therefore the link on a picture should point to algebradebug.php
  • For users, there are two possibilities. No link; or a link which points to tex/displaytex.php or filter/displaytex.php.

Please correct me, if I'm wrong. In my opinion a 404 is unacceptable.

Thank you.

Show
Karsten Burger added a comment - Thank you very much for your respond. Sorry, I don't catch how it should work. Administrators should have the permission to call algebradebug.php. Even for administrators the called script is displaytex.php which doesn't exist. In my opinion are the following changes necessary.
  • Administrators should have the possibility to debug their TeX notation. Therefore the link on a picture should point to algebradebug.php
  • For users, there are two possibilities. No link; or a link which points to tex/displaytex.php or filter/displaytex.php.
Please correct me, if I'm wrong. In my opinion a 404 is unacceptable. Thank you.
Hide
Mauno Korpelainen added a comment -

For administrators the the first tags of link are given by:

if (!file_exists("$CFG->dataroot/filter/algebra/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { $output .= "<a href=\"$CFG->wwwroot/filter/algebra/algebradebug.php\">"; }

which is correct and open algebradebug.php for administrators.

For other users current code is wrong and should either show the plain notation with file displaytex.php from folder filter/tex or that file should be copied to folder filter/elgebra . File displaytex.php only cleans all unwanted entities and shows the notation with

$texexp = urldecode($_SERVER['QUERY_STRING']);
// entities are usually encoded twice, first in HTML editor then in tex/filter.php
$texexp = html_entity_decode(html_entity_decode($texexp));
// encode all entities (saves non-ISO)
$texexp = htmlentities($texexp,ENT_COMPAT,'utf-8');

so the same file can be used with tex filter and algebra filter - or the link tags could be taken away from other users than administrators. I guess the original reason for adding links toi images was to show used syntax for users of algebra or tex filters so that they can learn from notations that others have written but the only people who need debugging are administrators.

I agree that 404 pages are not acceptable - for example Eloy can fix this if he is not too busy with other bugs. I don't have any access to these files...

Thank you for noticing this misbehaviour of algebra filter, Karsten

Show
Mauno Korpelainen added a comment - For administrators the the first tags of link are given by: if (!file_exists("$CFG->dataroot/filter/algebra/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { $output .= "<a href=\"$CFG->wwwroot/filter/algebra/algebradebug.php\">"; } which is correct and open algebradebug.php for administrators. For other users current code is wrong and should either show the plain notation with file displaytex.php from folder filter/tex or that file should be copied to folder filter/elgebra . File displaytex.php only cleans all unwanted entities and shows the notation with $texexp = urldecode($_SERVER['QUERY_STRING']); // entities are usually encoded twice, first in HTML editor then in tex/filter.php $texexp = html_entity_decode(html_entity_decode($texexp)); // encode all entities (saves non-ISO) $texexp = htmlentities($texexp,ENT_COMPAT,'utf-8'); so the same file can be used with tex filter and algebra filter - or the link tags could be taken away from other users than administrators. I guess the original reason for adding links toi images was to show used syntax for users of algebra or tex filters so that they can learn from notations that others have written but the only people who need debugging are administrators. I agree that 404 pages are not acceptable - for example Eloy can fix this if he is not too busy with other bugs. I don't have any access to these files... Thank you for noticing this misbehaviour of algebra filter, Karsten
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Dates

  • Created:
    Updated:
    Resolved: