Jump to content

Getting ' to work


Guest

Recommended Posts

Hi

Before I start I have searched the forum and I have made the changes Sir William Kindly posted as below.

However If I go to admin and try to change the homepage in the editor via source feature.

The ' goes missing and I get # 39: rubbish in its place please can anyone including the problem solver Sir William tell me what I would need to change so that the source feature keeps the '

Thanks

Ok, here is the quick, dirty fix. I'm going to talk to brooky before I write a full fix. I'm not sure if that's how he wants it handled.

The problem is that the htmlspecialchars() function is messing up your single and double quotes in your product names, etc. There is an optional command to include in that function call that will leave single and double quotes alone but will still parse out the HTML markup.

The syntax is htmlspecialchars($varname, ENT_NOQUOTES)

The ENT_NOQUOTES is not in there currently. To fix this issue, you need to add it into each instance of htmlspecialchars in each of these files. I believe there are 26 total instances of the function call.

Here's the file list:

/admin/products/index.php

/admin/settings/currency.php

/includes/content/viewProd.inc.php

/includes/content/cart.inc.php

/includes/content/index.inc.php

/includes/content/viewCat.inc.php

/includes/content/viewDoc.inc.php

/includes/boxes/siteDocs.inc.php

/includes/boxes/categories.inc.php

/includes/boxes/popularProducts.inc.php

/includes/boxes/randomProd.inc.php

/includes/boxes/saleItems.inc.php

/includes/boxes/shoppingCart.inc.php

/includes/functions.inc.php

/index.php

Here's an example from the index.php file:

CODE 

$body->assign("META_TITLE",$config['siteTitle'].c().htmlspecialchars($meta['siteTitle']));

Here's the adjusted version:

CODE 

$body->assign("META_TITLE",$config['siteTitle'].c().htmlspecialchars($meta['siteTitle'], ENT_NOQUOTES));

See? I told you I'd have a fix for ya. 

Link to comment
Share on other sites

searchty,

What version of CubeCart are you running, as the fix I have, was applied in 3.0.5 ?

Cheers.

Hi EverythingWeb

Did you mean you had used the fix in 3.05 or that the fix was already in 3.05 by brooky :huh:

Link to comment
Share on other sites

I have some ideas, but haven't had time to test them yet. Once I can, I'll confirm a solution....unless of course Brooky has already addressed it in 3.0.6 which is due out VERY soon. :rolleyes:

Link to comment
Share on other sites

Yes.  So far as I can tell, it's fixed properly.   :(

No...... Its not sorted still getting # 39 ;; rubbish instead of ' when using the source function in admin............? :o

I have updated to 3.06

ok the code below

<script language=JavaScript>

*/



var img_width = "468";

var img_height = "60";

var img_title = "Click Here";





var ad=new Array()

//insert here your images src

ad[0]='http://www.site.com/image1';

ad[1]='http://www.site.com/image2';

ad[2]='http://www.site.com/image3';

ad[3]='http://www.site.com/image4';

ad[4]='http://www.site.com/image5';



var links=new Array()

//insert here your links

links[0]='http://www.links1';

links[1]='http://www.links2';

links[2]='http://www.links3';

links[3]='http://www.links4';

links[4]='http://www.links5';



var xy=Math.floor(Math.random()*ad.length);

document.write('<a href="'+links[xy]+'" target="_blank"><img src="'+ad[xy]+'" width="'+img_width+'" height="'+img_height+'" alt="'+img_title+'"></a>');

</SCRIPT>

open admin got to homepage as if to edit it the click on source drop the code in then click update homepage then click source again and you will see what I mean

I hope ...... :blink:

Thanks

Edited by searchty
Link to comment
Share on other sites

Ok, since you wanna be pushy about it. I found your solution. :(

In /includes/functions.inc.php, you need to add this function before (or after) the validHTML function (2nd function in the file) as follows:

//////////////////////////////////

// leave single quotes/apostrophes in description so JavaScript can be used

// NOT w3c compliant, but some people don't care.

////////

function treatApostrophes($var){

	

	$var = eregi_replace("&amp;#39;","'",$var);

	$var = eregi_replace("'","'",$var);

	return $var;



}




Now, in /includes/functions/content/viewProd.inc.php around line 73, you'll find this:


	$view_prod->assign("TXT_DESCRIPTION",$prodArray[0]['description']);




Change it to this:


	$view_prod->assign("TXT_DESCRIPTION",treatApostrophes($prodArray[0]['description']));

Have fun!

:blink:

Link to comment
Share on other sites

Ok, since you wanna be pushy about it. I found your solution. :(

In /includes/functions.inc.php, you need to add this function before (or after) the validHTML function (2nd function in the file) as follows:

//////////////////////////////////

// leave single quotes/apostrophes in description so JavaScript can be used

// NOT w3c compliant, but some people don't care.

////////

function treatApostrophes($var){

	

	$var = eregi_replace("&amp;#39;","'",$var);

	$var = eregi_replace("'","'",$var);

	return $var;



}




Now, in /includes/functions/content/viewProd.inc.php around line 73, you'll find this:


	$view_prod->assign("TXT_DESCRIPTION",$prodArray[0]['description']);




Change it to this:


	$view_prod->assign("TXT_DESCRIPTION",treatApostrophes($prodArray[0]['description']));

Have fun!

:blink:

Dammm your good Sir William

WORKED A TREAT

THANKS :o FOR YOUR TIME

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...