[pLog-svn] r6909 - plugins/branches/lifetype-1.2/moblog/class/moblog

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Jun 19 16:33:37 EDT 2009


Author: jondaley
Date: 2009-06-19 16:33:36 -0400 (Fri, 19 Jun 2009)
New Revision: 6909

Modified:
   plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
Log:
cleaned up code - parseBody is called twice sometimes, so the sanitize stuff can't be in the parseBody, but needs to be done right when the data is grabbed (mostly because I'm creating an Array() object, so I was getting an array inside an array when the second explode() function returned

Modified: plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php	2009-06-18 16:06:53 UTC (rev 6908)
+++ plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php	2009-06-19 20:33:36 UTC (rev 6909)
@@ -43,12 +43,17 @@
             isset( $request["blogId"] ) ? $this->_blogId = $request["blogId"] : $this->_blogId = "";
             isset( $request["user"] ) ? $this->_user = $request["user"] : $this->_user = "";
             isset( $request["password"] ) ? $this->_pass = $request["password"] : $this->_pass = "";
-            isset( $request["articleCategories"] ) ?
-                $this->_articlecategories = $request["articleCategories"] : $this->_articlecategories = "";
-            isset( $request["globalCategory"] ) ?
-                $this->_globalcategory = $request["globalCategory"] : $this->_globalcategory = "";
-            
-            
+
+            $this->_articlecategories = "";
+            if(isset($request["articleCategories"])){
+	        $this->_articlecategories = explode(",", preg_replace("/^0-9,/", "", $request["articleCategories"]));
+            }
+
+            $this->_globalcategory = "";
+	    if(isset($request["globalCategory"])){
+                $this->_globalcategory = preg_replace("/^0-9/", "", $request["globalCategory"]);
+            }
+
             // parse the mime message
             $decode = new Mail_mimeDecode( $this->_message, "\r\n" );
             $structure = $decode->decode(Array(
@@ -117,11 +122,11 @@
             }
                 // find cat, cats, category, or categories
             if (preg_match("/^cat(?:s|egor(?:y|ies)?)?:(.*)/mi", $body, $articlecategories)) {
-                $this->_articlecategories = trim($articlecategories[1]);
+	        $this->_articlecategories = explode(",", preg_replace("/^0-9,/", "", trim($articlecategories[1])));
             }
                 // find globalcat or globalcategory
             if (preg_match("/^globalcat(?:egory)?:(.*)/mi", $body, $globalcategory)) {
-                $this->_globalcategory = trim($globalcategory[1]);
+                $this->_globalcategory = preg_replace("/^0-9/", "", trim($globalcategory[1]));
             }
                 // find blogid
             if (preg_match("/^blogid:(.*)/mi", $body, $blog)) {
@@ -132,10 +137,6 @@
                 $this->_blogName = trim($blogname[1]); 
             }
 
-                // Sanitize the data
-            $this->_articlecategories = explode(",", preg_replace("/^0-9,/", "", $this->_articlecategories));
-            $this->_globalcategory = preg_replace("/^0-9/", "", $this->_globalcategory);
-
                 // TODO: sanitize/validate the rest of the data too
             
                 //We strip out all the lines we already used, and use what's left as the body



More information about the pLog-svn mailing list