Bad handling of multi-line summary (editlink.php)

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2007, 06:53 AM
darek's Avatar
New Pligger
 
Join Date: Feb 2007
Posts: 4
Hi

I noticed (when news edited - editlink.php) newline character "\n"
in summary is converted to '\r\n' literal text (not carriage return, newline)
Fix - from scratch - is to add line
$linkres->link_summary = str_replace("\\r\\n", "<br />", $linkres->link_summary);//+
(two times) in editlink.php

Code:
...
         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);
			}
	}
...
regards
Darek

Last edited by darek; 05-25-2007 at 07:00 AM. Reason: correcting
Reply With Quote
  #2 (permalink)  
Old 09-10-2007, 12:21 PM
New Pligger
 
Join Date: Sep 2007
Posts: 4
well I have the same problem and even after doing the edits... the character n changes to a newline character...
I am also having another problem with my Pligg installation...maybe thats causing the newline char to get placed... http://forums.pligg.com/general-help...ny-values.html


Any help regarding this is appreciated....
Running Pligg Beta 9.8 - 09.08.2007

Last edited by cdinz; 09-10-2007 at 12:26 PM. Reason: Added xtra info
Reply With Quote
  #3 (permalink)  
Old 09-16-2007, 03:42 AM
New Pligger
Pligg Version: 9.8.2
Pligg Template: yget
 
Join Date: Aug 2007
Posts: 18
Thank you Darek!!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/log/httpd/error_log messages gr8rcake Questions and Comments 4 06-01-2010 12:25 PM
Pligg Errors tcritic Questions and Comments 4 09-01-2009 10:40 AM
Upgrading a 9.8.2 template to 9.9 AshDigg Wiki Articles 10 05-01-2008 02:38 PM
cann't vote in pligg (buliding 802) haxhax Questions and Comments 27 03-10-2007 07:53 AM
ERROR: my_base_url is not set. Please correct this using the admin panel. Then refres search Questions and Comments 7 11-14-2006 11:35 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