Patch for CKeditor.body.php to make it work in MW 1.18

Jump to: navigation, search

Yes it works, but in my wikis I got a problems. I use "pretty URLs" like Wikipedia does ... and all the internal (wiki) links are broken after an edit.

129.194.31.3114:38, 24 January 2012

I don't use pretty URL and my internal links are broken too.. and replaced by "RTENOTITLE"

83.176.228.19822:43, 25 January 2012

Hi there,
please provide more details about this, i.e. WYSIWYG version, SMW, MW versions etc.
Does this happen in all browsers?
Does this happen to links with labels or without?
Thanks for reporting this, your feedback is important!

Ridmi08:08, 26 January 2012

I have got the same problem with RTENOTITLE. It happens with mediawiki 1.18 and this extension, but also with the FCKeditor extension. WYSIWYG version 1.6.0, mediawiki 1.18 which has been upgraded from a 1.17.

All the internal links with or without labels are modified... Example: [[Link title]] -> [[/mediawiki-1.18.0/index.php?title=Link_title&action=edit&redlink=1|RTENOTITLE]]

And if I switch a lot between classic editor and WYSISYG, I obtain much bigger things like : "[[/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=/mediawiki-1.18.0/index.php?title=Link_title&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1&action=edit&redlink=1]]"

It happens the same with a link and a label, except that the label is kept instead of RTENOTITLE.

Tested in Chrome and Firefox.

82.150.248.2814:03, 26 January 2012

I am getting the exact same problem.

85.229.113.25123:47, 1 March 2012
 

I just realised that the modification seem to happen when the wikisyntax is *loaded* into the page, not when is submitted/saved or loaded into the editor component. I have traced back through the javascript and it seems like the php code at CKeditorParser.body.php overrides the replaceInternalLinks method and always converts internal links. I don't have time to dig further until later, but this is the only place in all the code where something is replaced by RTENOTITLE. It seems that this is a somewhat too indiscriminate conversion to always make.

 function replaceInternalLinks($text) {
   $text = preg_replace("/\[\[([^|\[\]]*?)\]\]/", "RTENOTITLE", $text); // #2223: ()      =>   RTENOTITLE
   $text = preg_replace("/\[\[:(.*?)\]\]/", "RTECOLON$1", $text); // change ':' => 'RTECOLON' in links
   $text = parent::replaceInternalLinks($text);
   $text = preg_replace("/\|RTENOTITLE\]\]/", "]]", $text); // remove unused RTENOTITLE

   return $text;
 }
85.229.113.25101:16, 2 March 2012

Removing this function fixes the problem. But is there a security issue without it?

function replaceInternalLinks($text) {return $text;}

Florian Jesse (talk)11:13, 2 May 2012
 
 
 
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox