Okay, thanks to Patricia for pointing me in the right direction. I think I've found why the slashes are being stripped. Here's how offsetPath is being obtained (some commented out lines omitted):
Code: Select all
$offsetPath = $this->cms->config["uploads_url"];
$offsetPath = str_replace( 'http://', '', $offsetPath );
$offsetPath = substr($offsetPath, strpos($offsetPath, "/"));
$offsetPath = str_replace( 'uploads', '', $offsetPath );
Now, this deletes the http://, the domain, and the string 'uploads'. So if we don't use a subdirectory in the uploads URL (say '
http://www.domain.com/uploads') all that's left in $offsetPath is the slash.
Further down, here's what's being done:
Code: Select all
while (obj1.value.search(offsetPath) > 0)
obj1.value = obj1.value.replace(offsetPath,"");
So, since $offsetPath is equal to "/", all slashes in the HTML are being deleted, including those in the tag endings.
Question to megabob3: is there a particular reason why the string 'uploads' needs to be deleted from $offsetPath? The only other place I can see that variable being used is here:
Code: Select all
$oFCKeditor->Value = str_replace('src="uploads', 'src="'.$offsetPath.'uploads', $content) ;
and it seems 'uploads' is being added back on anyway?
Bear in mind that I've only looked at the code very superficially, and for all I know there might be a good reason. At this point though it seems to me that leaving 'uploads' in there would fix the problem.
As for Patricia's problem with compatibility with TinyMCE, you could probably hardcode $offsetPath to 'uploads' and that would give you a relative path from the current directory... (haven't tested, sorry)