[pLog-svn] r5180 - in plog/branches/lifetype-1.2/class: action/admin dao view/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sun Mar 25 08:45:07 EDT 2007


Author: oscar
Date: 2007-03-25 08:45:06 -0400 (Sun, 25 Mar 2007)
New Revision: 5180

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php
   plog/branches/lifetype-1.2/class/dao/bloginfo.class.php
   plog/branches/lifetype-1.2/class/dao/userinfo.class.php
   plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
   plog/branches/lifetype-1.2/class/view/admin/adminuserprofileview.class.php
Log:
Fix for mantis issue http://bugs.lifetype.net/view.php?id=1212, to allow basic formatting for the user bio and the "about" text for a blog. Technically there still is no formatting allowed, but now at least new lines are transformed to <p> tags and so on, via the TextFilter::autoP() function. We should analyze later on whether we want to allow here some HTML tags.


Modified: plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php	2007-03-25 11:33:09 UTC (rev 5179)
+++ plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php	2007-03-25 12:45:06 UTC (rev 5180)
@@ -20,7 +20,6 @@
 	{
 
     	var $_postText;
-        var $_postExtendedText;
         var $_postTopic;
         var $_postCategories;
         var $_postStatus;
@@ -123,8 +122,12 @@
 		
 		function _fetchCommonData()
 		{
-        	$this->_postText     = trim(Textfilter::xhtmlize(Textfilter::filterJavaScript($this->_request->getValue( "postText" ))));
-            $this->_postExtendedText = trim(Textfilter::xhtmlize(Textfilter::filterJavaScript($this->_request->getValue( "postExtendedText" ))));
+			if( ini_get( "magic_quotes_gpc" ))
+				$this->_postText = stripslashes($this->_request->getValue( "postText" ));
+			else
+				$this->_postText = $this->_request->getValue( "postText" );
+				
+        	$this->_postText     = trim(Textfilter::xhtmlize(Textfilter::filterJavaScript($this->_postText)));
             $this->_postTopic    = trim(Textfilter::xhtmlize(Textfilter::filterAllHTML($this->_request->getValue( "postTopic" ))));
             $this->_postCategories = $this->_request->getValue( "postCategories" );
 			$this->_postSlug = Textfilter::filterAllHTML($this->_request->getValue( "postSlug" ));

Modified: plog/branches/lifetype-1.2/class/dao/bloginfo.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/bloginfo.class.php	2007-03-25 11:33:09 UTC (rev 5179)
+++ plog/branches/lifetype-1.2/class/dao/bloginfo.class.php	2007-03-25 12:45:06 UTC (rev 5180)
@@ -89,7 +89,7 @@
 			$this->_fields = Array(
 				"blog" => "getBlog",
 				"owner_id" => "getOwnerId",
-				"about" => "getAbout",
+				"about" => "getUnformattedAbout",
 				"settings" => "getSettings",
 				"mangled_blog" => "getMangledBlogName",
 				"status" => "getStatus",
@@ -139,13 +139,29 @@
          * Returns a longer and descriptive text about this blog. It can also be empty since it is
          * configurable from within the "Blog Settings" in the administration interface.
          *
+		 * @param format Whether basic formatting should be applied to the text
          * @return A string containing the more descriptive text about the journal.
          */
-        function getAbout()
+        function getAbout( $format = true )
         {
-            return $this->_about;
+			$text = $this->_about;
+			
+			if( $format ) {
+				lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+				$text = TextFilter::autoP( $text );
+			}
+			
+            return( $text );
         }
 
+		/** 
+		 * @return Returns the information about this blog without any formatting.
+		 */
+		function getUnformattedAbout()
+		{
+			return( $this->getAbout( false ));
+		}
+
         /**
          * Returns a BlogSettings object with information about the settings of the journal.
          * @private

Modified: plog/branches/lifetype-1.2/class/dao/userinfo.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userinfo.class.php	2007-03-25 11:33:09 UTC (rev 5179)
+++ plog/branches/lifetype-1.2/class/dao/userinfo.class.php	2007-03-25 12:45:06 UTC (rev 5180)
@@ -67,7 +67,7 @@
 			   "password" => "getMD5Password",
 			   "email" => "getEmail",
 			   "full_name" => "getFullName",
-			   "about" => "getAboutMyself",
+			   "about" => "getUnformattedAboutMyself",
 			   "properties" => "getProperties",
 			   "status" => "getStatus",
 			   "resource_picture_id" => "getPictureId",
@@ -116,10 +116,32 @@
 			return $this->_id;
 		}
 
-		function getAboutMyself()
+		/**
+		 * Returns the text that was input in the 'about myself' text box
+		 * in the admin interface
+		 *
+		 * @param format Whether basic formatting should be applied to the text
+		 * @return Returns a string
+		 */
+		function getAboutMyself( $format = true ) 
 		{
-			return $this->_aboutmyself;
+			$text = $this->_aboutmyself;			
+			
+			if( $format ) {
+				lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+				$text = TextFilter::autoP( $text );
+			}
+			
+			return( $text );
 		}
+		
+		/**
+		 * @return Returns the information about this user without any formatting.
+		 */
+		function getUnformattedAboutMyself()
+		{
+			return( $this->getAboutMyself( false ));
+		}
 
 		function getEmail()
 		{

Modified: plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php	2007-03-25 11:33:09 UTC (rev 5179)
+++ plog/branches/lifetype-1.2/class/view/admin/adminblogsettingsview.class.php	2007-03-25 12:45:06 UTC (rev 5180)
@@ -22,7 +22,7 @@
 			$config =& Config::getConfig();			
 			
             $blogSettings = $blogInfo->getSettings();
-			$this->setValue( "blogAbout", $this->_blogInfo->getAbout());
+			$this->setValue( "blogAbout", $this->_blogInfo->getAbout( false ));
 			$this->setValue( "blogName", $this->_blogInfo->getBlog());
             $this->setValue( "blogLocale", $blogSettings->getValue( "locale" ));
 			$this->setValue( "blogMaxRecentItems", $blogSettings->getValue( "recent_posts_max" ));

Modified: plog/branches/lifetype-1.2/class/view/admin/adminuserprofileview.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/view/admin/adminuserprofileview.class.php	2007-03-25 11:33:09 UTC (rev 5179)
+++ plog/branches/lifetype-1.2/class/view/admin/adminuserprofileview.class.php	2007-03-25 12:45:06 UTC (rev 5180)
@@ -18,7 +18,8 @@
 			
 			$this->setValue( "userFullName", $userInfo->getFullName());
 			$this->setValue( "userEmail", $userInfo->getEmail());
-			$this->setValue( "userAbout", $userInfo->getAboutMyself());
+			// we use 'false' here because we don't want to get the formatting
+			$this->setValue( "userAbout", $userInfo->getAboutMyself( false ));
 		}
 		
 		function render()



More information about the pLog-svn mailing list