Menu

Mathjax backslash problem

Help
Jinroh
2012-01-07
2012-09-14
  • Jinroh

    Jinroh - 2012-01-07

    Hi,

    I would like to integrate Mathjax
    (http://www.mathjax.org/). This is quite simple
    (i did it on many websites) but phpmyChat removes all the back slash from
    Latex commands like:

    \

    Do you have a solution and can you integrate and special prefix that allows
    the use of Mathjax.

    Thanks for your answer

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-07

    I'm really confused about this.

    So to understand: you want to post messages containing commands that will be
    used by others with copy&paste to get the right formulas using mathjax? And
    the only issue is the removal of backslashes?

    As far as I remember, backslashes are removed for a good reason (not sure now,
    but I guess it's a security related thing).

    Which version of phpMyChat you're trying to patch? Standard or Plus?

    I'll take a look to see where and why the removal happens. Meantime, answer my
    questions.

    Ciprian M.

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-07

    After a few tests, I found this:

    Files: loader.php and messagesL.php

    Comment out this line:

    $Message = stripslashes($Message);

    Files: input.php and handle_inputH.php

    Search for this stripslashes($M) and replace with $M

    Please be aware that this could lead to some other errors, so if you keep
    getting frozen windows after posting... this could be a reason.

    Let me know how this is going for you.

    I'm still waiting to know of your version.

    Ciprian M.

     
  • Jinroh

    Jinroh - 2012-01-08

    Thanks for your quick answer.

    The stripslash is effectively for security reason (if i remember it's against
    SQL Injection).

    Your proposition works now. I still not render in Latex but i will found why.
    It but be a minor problem i think.

    Thanks for your help.

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-08

    I'm glad it helped somehow. Let us know your final solution to implement this
    plugin.

    Ciprian M.

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-08

    I just tested the Latex and it works. After the patches I described above, you
    need to add this line in both loader.php and messagesL.php

    <script type="text/javascript" src="[http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS- MML_HTMLorMML](http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX- AMS-MML_HTMLorMML)"></script>

    ... right before the tag </HEAD> (after the <LINK REL="..."> line)

    Give me your chat url so I can check together.

    Ciprian M.

     
  • Jinroh

    Jinroh - 2012-01-08

    I made the changes you indicated (it was difficult to guess...)

    http://www.sciences.ch/htmlfr/php/chat/index.php

    On Google Chrome 16.0.912.63 and Opera 11.6.1185 only Latex command like: $$
    x^2 $$ works. When i use Latex commands with back slash like \ or
    $$f(x)=\mathop{\int}{-\infty}^x~e^{-t^2}dt$$ he doubles all the slashes.

    On Firefox 9.0.1 and Internet Explorer 9.0.8112 .16421 nothing works.

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-08

    Hmm, that's why I needed to know your chat version, to test and suggest the
    right patches.

    I've read a bit mathjax forums and they said IE9 it's incompatible, it must be
    run in IE7 compatibility mode or something.

    I confess, I only tested with Chrome. Let's go deeper now.

    I'm in your chat and I'll let you other contact data.

    ciprian M.

     
  • Ciprian Murariu

    Ciprian Murariu - 2012-01-10

    Can you check your both emails please?

    Ciprian

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.