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

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sun Jan 14 14:16:01 EST 2024


Author: jondaley
Date: 2024-01-14 14:16:01 -0500 (Sun, 14 Jan 2024)
New Revision: 7267

Modified:
   plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
Log:
whitespace change only - tracking down a bug, so re-indented one function for easier comparison

Modified: plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php	2024-01-13 11:21:30 UTC (rev 7266)
+++ plugins/branches/lifetype-1.2/moblog/class/moblog/moblogrequest.class.php	2024-01-14 19:16:01 UTC (rev 7267)
@@ -182,81 +182,81 @@
          */
         function parseMimeParts( $parts )
         {
-            $this->_attachments = Array();
-            foreach( $parts as $part ) {
-                MoblogLogger::log( "attachment type = ".$part->ctype_primary."/".$part->ctype_secondary );            
-                
-                if( strtolower($part->ctype_primary) == "text" && strtolower($part->ctype_secondary) == "plain" ) {
-					// if ctype_primary == text and ctype_secondary == plain, it should be text format e-mail
-                    MoblogLogger::log( "Reparsing the body of the message!" );
-                    MoblogLogger::log( "text/plain part - contents = ".$part->body );
-                    $this->parseBody( $part->body );
-					$this->_inputEncoding = strtoupper( $part->ctype_parameters['charset'] );
+          $this->_attachments = Array();
+          foreach( $parts as $part ) {
+            MoblogLogger::log( "attachment type = ".$part->ctype_primary."/".$part->ctype_secondary );            
+              
+            if( strtolower($part->ctype_primary) == "text" && strtolower($part->ctype_secondary) == "plain" ) {
+                  // if ctype_primary == text and ctype_secondary == plain, it should be text format e-mail
+              MoblogLogger::log( "Reparsing the body of the message!" );
+              MoblogLogger::log( "text/plain part - contents = ".$part->body );
+              $this->parseBody( $part->body );
+              $this->_inputEncoding = strtoupper( $part->ctype_parameters['charset'] );
+            }
+            elseif( strtolower($part->ctype_primary) == "multipart" && strtolower($part->ctype_secondary) == "alternative") {
+                  // if ctype_primary == multipart and ctype_secondary == alternative, it should be html format e-mail
+                  // We should look into it's child to get the real body
+              foreach ( $part->parts as $childPart ) {
+                if( strtolower($childPart->ctype_primary) == "text" && strtolower($childPart->ctype_secondary) == "plain" ) {
+                  $this->parseBody( $childPart->body );
+                  $this->_inputEncoding = strtoupper( $childPart->ctype_parameters['charset'] );
                 }
-                elseif( strtolower($part->ctype_primary) == "multipart" && strtolower($part->ctype_secondary) == "alternative") {
-					// if ctype_primary == multipart and ctype_secondary == alternative, it should be html format e-mail
-					// We should look into it's child to get the real body
-                    foreach ( $part->parts as $childPart ) {
-                		if( strtolower($childPart->ctype_primary) == "text" && strtolower($childPart->ctype_secondary) == "plain" ) {
-                    		$this->parseBody( $childPart->body );
-							$this->_inputEncoding = strtoupper( $childPart->ctype_parameters['charset'] );
-                    	}
-                    }
-                }
-                else {
-                    // whatever comes as a part, we will take it and treat it as if it was 
-                    // a normal resource as long as it's not an application/smil thingie...
+              }
+            }
+            else {
+                  // whatever comes as a part, we will take it and treat it as if it was 
+                  // a normal resource as long as it's not an application/smil thingie...
                     
-                    if( strtolower($part->ctype_secondary) != 'html' && strtolower($part->ctype_secondary) != 'smil' && MOBLOG_IGNORE_SMIL_ATTACHMENTS ) {
-                        // GalleryResources::addResource only deals with uploaded files, so we'll
-                        // have to pretend that this is one of them!
-                        $config =& Config::getConfig();
-                        $tmpFolder = $config->getValue( "temp_folder" );
-                        $tmpFolderName = $tmpFolder."/".md5(microtime());
-                        //$tmpFolderName = $config->getValue( "temp_folder" );
-                        File::createDir( $tmpFolderName );
-                        MoblogLogger::log( "Creating temp folder = $tmpFolderName" );
-                        $fileName = stripslashes($part->ctype_parameters["name"]);
+              if( strtolower($part->ctype_secondary) != 'html' && strtolower($part->ctype_secondary) != 'smil' && MOBLOG_IGNORE_SMIL_ATTACHMENTS ) {
+                    // GalleryResources::addResource only deals with uploaded files, so we'll
+                    // have to pretend that this is one of them!
+                $config =& Config::getConfig();
+                $tmpFolder = $config->getValue( "temp_folder" );
+                $tmpFolderName = $tmpFolder."/".md5(microtime());
+                    //$tmpFolderName = $config->getValue( "temp_folder" );
+                File::createDir( $tmpFolderName );
+                MoblogLogger::log( "Creating temp folder = $tmpFolderName" );
+                $fileName = stripslashes($part->ctype_parameters["name"]);
                     
-                        // if the filename is not in the 'filename' field, then try with the 
-                        // 'content-location' field, since some MMS-to-email gateways seem to put
-                        // the file name there for wahtever reason
-                        if( $fileName == "" )
-                            $fileName = stripslashes($part->d_parameters["filename"]);
-                        if ( ($fileName == "") && (isset($part->headers['content-location'])) )
-                            $fileName = stripslashes($part->headers['content-location']);
+                    // if the filename is not in the 'filename' field, then try with the 
+                    // 'content-location' field, since some MMS-to-email gateways seem to put
+                    // the file name there for wahtever reason
+                if( $fileName == "" )
+                  $fileName = stripslashes($part->d_parameters["filename"]);
+                if ( ($fileName == "") && (isset($part->headers['content-location'])) )
+                  $fileName = stripslashes($part->headers['content-location']);
                                                    
-                        $fileName = str_replace( "\"", "", $fileName );
-                        $fileName = str_replace( "'", "", $fileName );
-                        $tmpName = $tmpFolderName."/".$fileName;
-                        $fileName = urldecode( $fileName );
+                $fileName = str_replace( "\"", "", $fileName );
+                $fileName = str_replace( "'", "", $fileName );
+                $tmpName = $tmpFolderName."/".$fileName;
+                $fileName = urldecode( $fileName );
                         
-			            if ( MOBLOG_FORCE_ENCODE_TO_UTF8 )
-			            	$fileName = $this->encodeToUTF8( $fileName, $this->_inputEncoding);
+                if ( MOBLOG_FORCE_ENCODE_TO_UTF8 )
+                  $fileName = $this->encodeToUTF8( $fileName, $this->_inputEncoding);
                         
-                        $f = new File( $tmpName );
-                        $f->open( "ab+" );
-                        MoblogLogger::log( "fileName = ".$tmpName );                    
-                        MoblogLogger::log( "Saving attachment as = ".$tmpName );
-                        //MoblogLogger::log( "base64 encoded data = ".$part->body );
-                        if( !$f->write( $part->body )) {
-                            MoblogLogger::log( "There was an error writing the temporary file" );
-                            die();
-                        }
-                        MoblogLogger::log( "File saved ok!" );
-                        MoblogLogger::log("FILENAME = $fileName");
-                        $uploadInfo = Array( "name" => urldecode($fileName),
-                                             "type" => $part->ctype_primary."/".$part->ctype_secondary,
-                                             "tmp_name" => $tmpName,
-                                             "size" => $f->getSize(),
-                                             "error" => 0 );
+                $f = new File( $tmpName );
+                $f->open( "ab+" );
+                MoblogLogger::log( "fileName = ".$tmpName );                    
+                MoblogLogger::log( "Saving attachment as = ".$tmpName );
+                    //MoblogLogger::log( "base64 encoded data = ".$part->body );
+                if( !$f->write( $part->body )) {
+                  MoblogLogger::log( "There was an error writing the temporary file" );
+                  die();
+                }
+                MoblogLogger::log( "File saved ok!" );
+                MoblogLogger::log("FILENAME = $fileName");
+                $uploadInfo = Array( "name" => urldecode($fileName),
+                                     "type" => $part->ctype_primary."/".$part->ctype_secondary,
+                                     "tmp_name" => $tmpName,
+                                     "size" => $f->getSize(),
+                                     "error" => 0 );
                         
-                        $upload = new FileUpload( $uploadInfo );
-                        $upload->setFolder( $tmpFolderName );
-                        array_push( $this->_attachments, $upload );
-                    }
-                }
+                $upload = new FileUpload( $uploadInfo );
+                $upload->setFolder( $tmpFolderName );
+                array_push( $this->_attachments, $upload );
+              }
             }
+          }
         }
 		
 		function encodeToUTF8( $input, $inputEncoding)



More information about the pLog-svn mailing list