Page 4 of 4

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Mon Nov 07, 2005 1:02 pm
by megabob3
Patricia wrote: actually, everything seems to come from that offsetpath I see in config. unfortunately, I don't know how to solve that, furthermore, can't have further look before tonight (CET timzone)

Bob, if we both have some time tonight, we could try debug together beeing at the same time on IRC ?? and maybe use a test site where I would give you access

tell me your prefered time?
Sorry i don't know if i can.

My solution on TESTING is as i said before....

made a beta version witha sequence of ALERT (or something else) with report on modification.

I will realese a new version soon.

See You All ;)

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 1:49 am
by nuspace
Just a bit more info about the disappearing slashes. I tried moving a subdomain cms.domain.com to www.domain.com and it still didn't work. But then when I moved it to a subdirectory www.domain.com/cms the problem disappeared. So it seems there must have been an assumption made somewhere that CMSMS would always be installed in a subdirectory...

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 7:44 am
by nuspace
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)

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 8:23 am
by nuspace
Oops, seems like I wasn't looking at the latest version of the code... But I think the analysis still holds.

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 8:35 am
by nuspace
Okay, from my preliminary tests, this seems to do the trick. First comment out this line:

Code: Select all

$offsetPath = str_replace( 'uploads', '', $offsetPath );
And then change this line:

Code: Select all

$oFCKeditor->Value = str_replace('src="uploads', 'src="'.$offsetPath.'uploads', $content) ;
to this:

Code: Select all

$oFCKeditor->Value = $content;
I just hope there are no unwanted side effects...

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 8:41 am
by nuspace
Sorry, actually no, that doesn't work. I was testing the wrong site. Must be time to call it a day... :)

Re: Patriciaaaaaaaaa :D -- I got IT!!!

Posted: Tue Nov 08, 2005 1:01 pm
by megabob3
I am doing ALL like if start all from beginning.

I am studying REGULAR EXPRESSION, into javascript.

And doing the replacement only into TAGs.

Like is now was the problem that replace everything.

For example into content one thing is replace into double quote the &quote; from showed information and another thing is replace from {smarty tag}

Using regular expression will all different, please wait few days.

See You All ;)