The '&' character

3.3 Forum ONLY: If you've run into a problem, such as an error message, blank page, or similar problem, this is where to look. Post any installation or other problems or questions here, and I and other users will try to help.
  
5 Oct '10 Tue Oct 05, 2010 14:50    
rosbif
BetaTester  BetaTester
  •  

Post The '&' character

When I submit an article with the '&' character in the title pro_news changes it to &. If I edit it it becomes '&' Within the edit page I can remove the extra bits and it saves & properly. Very odd!



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 15:26    
layingback
Site Admin  
  •  

Post Re: The '&' character

I'm not understanding. It should appear as & in edit page and in display, but be stored internally as & so that it doesn't generate XHTML validation errors.

Which submit article (admin or user)? Which field or fields? And which template? Which Pro_News version?



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 15:33    
rosbif
BetaTester  BetaTester
  •  

Post Re: The '&' character

The forum stripped some of the characters!

It should have said

When I submit an article with the '&' character in the title pro_news changes it to &. If I edit it it becomes '&' Within the edit page I can remove the extra bits and it saves & properly. Very odd!


This is using admin submit in the title field. Using index3fcs.html. Pro_news 3.3.2.0 at the moment..



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 18:00    
layingback
Site Admin  
  •  

Post Re: The '&' character

Try this, please.

In admin_functions.php (around line 2496) find:

PHP:
                'T_TITLE' => '<input type="text" name="title" size="50" value="'.htmlprepare($edit['title']).'" />',


and replace with:

PHP:
                'T_TITLE' => '<input type="text" name="title" size="50" value="'.$edit['title'].'" />',


ie. remove the htmlprepare call.

Similarly, in functions.php (around line 1516) find:

PHP:
                'T_TITLE' => '<input type="text" name="title" size="50" value="'.htmlprepare($edit['title']).'" />',


and replace with:

PHP:
                'T_TITLE' => '<input type="text" name="title" size="50" value="'.$edit['title'].'" />',


ie. remove the htmlprepare call.

If that works - and it seems to here - then this bug has always been in Pro_News! Although it may not have always shown up. It only affects the edit display, so no serious DB harm should have ever occurred from this one, although some double amp;amp;'s may have crept in over time.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 18:11    
rosbif
BetaTester  BetaTester
  •  

Post Re: The '&' character

Will do.. I only noticed it when trying the & character for the first time.

Seems to work perfectly. You always worry me when my line numbers are so different from yours - it was lines 2469 and 1490 for me!

Shall I change the topic title here to solved?



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 18:25    
layingback
Site Admin  
  •  

Post Re: The '&' character

Please do on the title change.

Reason for numbers being off, and why I said "around" is that I'm working with 3.2.2.1. Which I thought was ready! Sad

BTW, seen this post yet?

Looks as if I'll have to do a new release. It used to be a 10 minute job, plus checking, but now takes hours due to all the "extras" added/moved over time.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 18:26    
rosbif
BetaTester  BetaTester
  •  

Post Re: The '&' character

One other time (there may be more?) when the title contains an & and you link to CPGNuCalendar it is adding the amp: to it.



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 20:08    
layingback
Site Admin  
  •  

Post Re: The '&' character

Nope, can't reproduce. Can you give me more specifics please?

I did find a db error when using MySQL 5 in Strict mode though. Simple fix for that one.

NEVER MIND: I see - in the Calendar.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 20:12    
layingback
Site Admin  
  •  

Post Re: The '&' character

Hmmm. That has to be a CPGNuCalendar bug, 'cos the browser is displaying the tooltip correctly. So CPGNC is handling the 2 displays (from the same source) differently.



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 20:43    
layingback
Site Admin  
  •  

Post Re: The '&' character

OK, CPGNC presumes that it will receive just a &. So in admin_functions.php around (before) line 2863 find:

PHP:
        $sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("", "'.$postby.'", "'.formatDateTime($clsdttime,'%Y%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%Y%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.$title.'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';


and change to:

PHP:
        $sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("0", "'.$postby.'", "'.formatDateTime($clsdttime,'%Y%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%Y%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.htmlunprepare($title).'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';



Similarly in functions.php (~ 4536) find:

PHP:
        $sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("", "'.$postby.'", "'.formatDateTime($clsdttime,'%G%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%G%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.$title.'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';


and replace with:

PHP:
        $sql = 'INSERT INTO '.$prefix.'_cpgnucalendar VALUES ("0", "'.$postby.'", "'.formatDateTime($clsdttime,'%G%m%d').'", "'.$clstime.'", "'.formatDateTime(time(),'%G%m%d').'", "'.formatDateTime(time(),'%H%M%S').'", "'.$cal_durtn.'", "'.$cal_priority.'", "'.$cal_rpt.'", "'.$cal_view.'", "'.htmlunprepare($title).'", "'.$cal_content.'", "'.$cal_image.'", "'.$cal_appvd.'", "'.$cal_category.'")';



(The 0 added to the first parameter is to address the MySQL5 Strict issue.)



layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

2.6.32 / 1.3 - 2.4 / 5.5 - 5.6 / 5.4 - 5.5 / 9.4

 
 
 
 
  
5 Oct '10 Tue Oct 05, 2010 22:52    
rosbif
BetaTester  BetaTester
  •  

Post Re: The '&' character

That seems to work, thank you!



rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)

Linux/2.2.11/4.1.22/5.2.17/9.3.4.1

 
 
 
 
Link  QR 
Share this Printer Friendly Page  facebook   google+   linkedin   twitthis  
Show more ...


Forum Permissions - You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum