Problem with handling of 'n' character in description

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-05-2007, 12:07 PM
New Pligger
 
Join Date: Jul 2007
Posts: 8
I'm having a similar problem to the one described here.

It happened when submitting a new story. When the text in Description field contains the character 'n', the n is converted into a newline character \n, causing the text is break up.

Here's the code from editlink.php I think is causing the problem. After publishing the story I can go back to edit it, replace the 'n', take out the linebreaks and then submit, and everything's back to normal.


HTML Code:
			$linkres->category=$_POST['category'];
			if($linkres->title != strip_tags(trim($_POST['title']))){
				$linkres->title = strip_tags(trim($_POST['title']));
				$linkres->title_url = makeUrlFriendly($linkres->title);
			}
			$linkres->content = strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow);
			$linkres->tags = tags_normalize_string(strip_tags(trim($_POST['tags'])));
         if($_POST['summarytext'] == ""){
		$linkres->link_summary = utf8_substr(strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow), 0, StorySummary_ContentTruncate - 1);
		$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);				
                // added
		$linkres->link_summary = str_replace("\\r\\n", "<br />", $linkres->link_summary);// +			
	} else {
		$linkres->link_summary = $db->escape($_POST['summarytext']);
		$linkres->link_summary = strip_tags(trim($linkres->link_summary), Story_Content_Tags_To_Allow);
        	$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
                // added
		$linkres->link_summary = str_replace("\\r\\n", "<br />", $linkres->link_summary);// +		
		if(strlen($linkres->link_summary) > StorySummary_ContentTruncate){
				loghack('SubmitAStory-SummaryGreaterThanLimit', 'username: ' . $_POST["username"].'|email: '.$_POST["email"], true);
				$linkres->link_summary = utf8_substr($linkres->link_summary, 0, StorySummary_ContentTruncate - 1);
					$linkres->link_summary = str_replace("\n", "<br />", $linkres->link_summary);
			}
	}

Any help appreciated.
Reply With Quote
  #2 (permalink)  
Old 07-16-2007, 06:44 PM
New Pligger
 
Join Date: Jul 2007
Posts: 8
Still stuck on this problem - any help appreciated.
Reply With Quote
  #3 (permalink)  
Old 09-15-2007, 09:11 AM
New Pligger
 
Join Date: Sep 2007
Posts: 4
Quote:
Originally Posted by iPodness View Post
Still stuck on this problem - any help appreciated.

Same problem here....any kind of help is greatly appreciated....
This solution did not work for me: http://forums.pligg.com/core-develop...tlink-php.html
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Story Meta Description ffarhann Questions and Comments 3 01-26-2010 03:58 PM
welcome_email Special character problem xiesi Questions and Comments 3 05-11-2008 11:15 PM
Character limit on description field projectman Questions and Comments 4 11-02-2007 11:08 PM
"n" character works like <br> in description box nicocahuin Questions and Comments 0 08-13-2007 01:06 PM
URL Method 2 problem with strange character TrailofDead Questions and Comments 2 03-29-2007 02:07 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development