mariovaldez.net
http://www.mariovaldez.net/webapps/forums/

Strange links
http://www.mariovaldez.net/webapps/forums/viewtopic.php?f=1&t=81
Page 1 of 1

Author:  Benjamin [ 13 Jul 2004, 01:31 ]
Post subject:  Strange links

Hello!

I can't get URL links to work in CM documents.
Having:
<a href="redir.php?cm_elink=http://www.test.com">http://www.test.com</a>
in a "Edit document" window, after saving I get
-CMGT-a href=\-CMDQ-redir.php?cm_elink=http://www.test.com\-CMDQ--CMLT-http://www.test.com-CMGT-/a-CMLT-
in a database. And then opening that document my link looks this way:
http://myserver.com/phprojekt/cm/%5C%22redir.php?cm_elink=http://www.test.com\%22

I use Apache with Oracle database on Windows 2000 server.
If magic quotes matters, my settings in php.ini are:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off


Thanks for suggestion / solution in advance!
Benjamin

Author:  mvaldez [ 13 Jul 2004, 10:33 ]
Post subject:  Strange links, Oracle and slashes...

Benjamin:

> Hello! I can't get URL links to work in
> CM documents. Having: <a href="redir.php?
> cm_elink=http ://www.test.com">http://www.test.com
> </a> in a "Edit document" window...

Yes, that is expected as external links are converted to be redirected by the redir.php script.


> after saving I get -CMGT-a href=\-CMDQ-redir.php?
> cm_elink=http ://www.test.com\-CMDQ--CMLT-
> http ://www.test.com-CMGT-/a-CMLT- in a database.

This is expected too, as those characters (<, >, ") are converted before being stored in the database. (The purpose of this is that all content in the database is stored as character entities and those characters should be preserved later).


> And then opening that document my link looks
> this way: http ://myserver.com/phprojekt/cm/
> %5C%22redir.php?cm_elink=http://www.test.com\%22

Ok, now that is weird. That link is equivalent to this:
Code:
http://myserver.com/phprojekt/cm/\"redir.php?cm_elink=http://www.test.com\"


The link reference is quoted and the quotes are escaped.

This escaping is happening after the data is extracted from the database, as the links in the database are not escaped.


> I use Apache with Oracle database on Windows 2000 server.
> If magic quotes matters, my settings in php.ini are:
> magic_quotes_gpc = Off
> magic_quotes_runtime = Off
> magic_quotes_sybase = Off
> Thanks for suggestion / solution in advance!
> Benjamin

The CMS has not been tested on Oracle (at least by me). I will try to replicate your configuration to search for an answer. Benjamin, in the mean time try the following:

In the script cm/display.php, around line 136, 141, and 147 wrap the fcm_process_markup function call with the stripslashes function so that it looks like this:
Code:
echo stripslashes (fcm_process_markup (fcm_secure_html (fcm_decode_htmlfull ($row1[2])), $cm_path, true));


...like this:
Code:
echo stripslashes (fcm_process_markup (fcm_htmlentity (fcm_decode_html ($row1[2])), $cm_path, false));


...and like this:
Code:
echo stripslashes (fcm_process_markup ($row1[2], $cm_path, false));



Then tell me if it worked.

Regards,

Mario A. Valdez-Ramirez.

Author:  mvaldez [ 13 Jul 2004, 15:33 ]
Post subject:  What CMS version are you using...

Benjamin:

I forgot to ask, what version of the CMS, what version of Phprojekt, and what version of PHP are you using?


Regards,

Mario A. Valdez-Ramirez.

Author:  Benjamin [ 13 Jul 2004, 23:12 ]
Post subject: 

Hello Mario!

Thanks for your quick and detailed answer. Links are working now very good. :-)

> I forgot to ask, what version of the CMS, what version of Phprojekt, and what version of PHP are you using?
This is from my browser:
C: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040614 Firefox/0.8
S: CMS4P/0.6.0b12 Phprojekt/4.2 Oracle Oracle/unknown Windows

and PHP is PHP Version 4.3.7

Best regards!
Benjamin

Author:  mvaldez [ 14 Jul 2004, 03:33 ]
Post subject:  Good it's fixed...

Benjamin:

> Thanks for your quick and detailed answer.
> Links are working now very good. Smile
> This is from my browser:
> C: Mozilla/5.0 (Windows; U; Windows NT
> 5.1; en-US; rv:1.7) Gecko/20040614 Firefox/0.8
> S: CMS4P/0.6.0b12 Phprojekt/4.2 Oracle
> Oracle/unknown Windows
> and PHP is PHP Version 4.3.7

Hello again. Good to know it is fixed now. :D

So, it was the stripslashes change needed or it was fixed by doing something else?

Also, thanks for the extra data. I was wondering if you downloaded the 0.6.0 stable release or if you are really using the 0.6.0beta 12. (Because of a bug in 0.6.0, it reports itself as being 0.6.0b12).

Thanks,

Mario A. Valdez-Ramirez.

Author:  Benjamin [ 14 Jul 2004, 05:54 ]
Post subject: 

Actually, it is cm4p_0.6.0.zip file which I downloaded.
And the solution was as you told me: by adding stripslashes.

Thanks again!

Benjamin

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/