wiki editor removing external html links

wiki editor removing external html links

by Marco Carvalho -
Number of replies: 14
When I save edited pages of my wikies, the external links insert through the link icon are being removed from the html code.

For example,  the ´href part´ of a text like:
< a title="" target="" href="http://www.dcc.ufjf.br/sbie2005/">SBIE2005< /a >
will disapper from the saved html code).

People from the support team of my university don´t know how to deal with this. I suspect it would be some configuration parameter to prevent external linking from the wiki pages (I can´t guess why...). Anyway, could anybody give me a clue?

In time, I know moving to DFWiki would be great, but this is out of my control for now.

Thanks a lot,
Marco
Average of ratings: -
In reply to Marco Carvalho

Re: wiki editor removing external html links

by A.J. Colianni -
Hello! This is happening to us as well. We are on the latest Moodle point release...
In reply to A.J. Colianni

Re: wiki editor removing external html links

by A.J. Colianni -
Hi there!

I found the answer to this problem in relation to another problem we were having:

See this link: <http://moodle.org/mod/forum/discuss.php?d=37738>
I think I figured out what is causing the behavior I am observing in the standard wiki module. It appears to be related to my magic_quotes_gpc PHP setting in the main php.ini. When I turn that "On", wiki formatting appears to work again.

http://moodle.org/doc/?frame=install.html#webserver

This setting fixed both the 'href' being stripped out, and the escaping characters when trying to do an ' apostrophe (it was showing up like \' )
In reply to A.J. Colianni

Re: wiki editor removing external html links

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yup,

after a bit of debug, the problem seems to be that Moodle, always addslashes() for each GET and POST variable and then, the wiki module itself is adding them again.

So strings become double-slashed when magic_quotes_gpc is disabled. In the other hand, when magic_quotes_gpc is enabled Moodle addslahes() wiki strip them and finally it add them again (so it works fine).

So my proposal is to avoid all those module stripslashes() and addslashes() to keep only the original one performed by Moodle.

Then it should work independently of the magic_quotes_gpc status.

How does it sound to you?
In reply to Eloy Lafuente (stronk7)

Re: wiki editor removing external html links

by Ali Banani -
Hi

even if turn magic quotes on, old links are still not working. Only the new ones are beeing shown correctly. What would be the best and fastest way to fix this, because a lot of students invested a lot of time in wiki-contents.

another thing I noticed, which I am not sure it is related to this matter, is the fact that the page browser on the attachments page ist not working. If you have a lot of attachements, they are listet on several pages, but the link >>[0] opens an editor for a new page instead of the next attachements page.

thanks for your help .. ali
In reply to Ali Banani

Re: wiki editor removing external html links

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ali,

I've make a quick hack to the module to make it to work properly both with magic_quotes_gpc() enabled and disabled. It'll be available in next daily built. For your info I've slightly modified this files:
- mod/wiki/view.php
- mod/wiki/ewiki/fragments/strip_wonderful_slashes.php
and replacing your current files (don't forget to save them safely before) such problem should be out.

About how to solve the all those entries currently incorrect, the easier thing to do would be, once installed the last version, to edit and save each problematic page. New version should be correct. Also, you could perform some direct database updates to solve it (basically, replace each occurrence of \" (backslash+double quotes) to " (double quotes). The SQL sentence to do that against ALL your wiki pages is:

UPDATE mdl_wiki_pages set content=replace(content, '\\\"', '\"')

although you can restrict such update to only your problematic wiki by adding some condition like:

WHERE wiki=XX
(where XX is the id of the wiki that you want to update)

Anyway, don't forget to make a copy of your table before executing the statement above. Direct handling of DB doesn't seem to be a good idea!

Hope it helps, ciao smile
In reply to Eloy Lafuente (stronk7)

Re: wiki editor removing external html links

by Ali Banani -
Hi Eloy,

thanks for your help. Your code works fine and I feel better with the magic_quotes turned off again. The a tags in the databse were empty so I did not do any direct updates on the content wiki but I could recover the pages from previous versions.

Has anyone else expirienced the bug concerning the page browser when you have a lot of attachments?


cheers ali
In reply to Ali Banani

Re: wiki editor removing external html links

by Ali Banani -
Hi,

unfortunately my initial problem is still present, or returned after the patch. Folders having a german-umlaut in their name are created two times, just as I described them in this thread: http://moodle.org/mod/forum/discuss.php?d=18233

Am I the only one having these problems ??

ali
In reply to Ali Banani

Re: wiki editor removing external html links

by Judy Steidl -

Yes, this is a frustrating problem. The wiki strips out embedded files. My students want to insert their movies or youtube videos and make their wiki more of a multi-media collection.  Any way around this?  I am running 1.9.3 and I know no code and have no access to the directory files.

I am hoping there is a solution.  The kids are using the wiki like an e-portfolio of collected writing and media.  So far, the wiki provided is disappointing to them.

In reply to Eloy Lafuente (stronk7)

Re: wiki editor removing external html links

by Will H -
Sorry to dig up an old thread but this still appears to be happening in Moodle 1.9 (2.5 years after the solution was proposed). Am I missing something?
In reply to Will H

Re: wiki editor removing external html links

by Phill Pover -
I'm getting the same with moodle 1.9.2+ (20080924). The magic_quotes_gpc is on, but it's still happening. Any suggestions?

EDIT: It seems to be happening when there's capitalisations in links, as well as apostrophes.
In reply to Phill Pover

Re: wiki editor removing external html links - also with Nanogong link

by Mike Smith -
Same or perhaps related problem for me. I have Nanogong HTMLArea applet running in Moodle 1.93+ and it works beautifully in every Moodle HTML editor except the Wiki module. The applet operates OK, recording its sound and inserting the necessary link into wiki html, but then the link to that recording spx sound file becomes horribly mussed up.
In reply to Mike Smith

Re: wiki editor removing external html links - also with Nanogong link

by Tobias Marx -

hi,

i just wanted to add, that we've got the same problem. it only occures, when there are capital letters in the url, though.

e.g.: http://www.e-teaching.org/didaktik/gestaltung/visualisierung/textbild/Lernen_mit_Text_und_Bild.pdf

we are using 1.9.11+

In reply to Tobias Marx

Re: wiki editor removing external html links - also with Nanogong link

by Tobias Marx -

just wanted to add, that the problem still persists with moodle 1.9.12+ sad

In reply to Tobias Marx

Re: wiki editor removing external html links - also with Nanogong link

by Tobias Marx -

Hi! Just wanted to add, that deactivating camel case in the wiki's settings will "fix" this problem.