[pLog-svn] r2769 - plugins/trunk/moblog/class/moblog
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Jan 11 15:46:29 GMT 2006
Author: oscar
Date: 2006-01-11 15:46:29 +0000 (Wed, 11 Jan 2006)
New Revision: 2769
Modified:
plugins/trunk/moblog/class/moblog/moblogrequest.class.php
Log:
now the name of the attachment is fetch first from the 'filename' field and if nothing there,
from the content-location field. At least Sonera's (Finnish operator) MMS gateway seems to put it there.
Modified: plugins/trunk/moblog/class/moblog/moblogrequest.class.php
===================================================================
--- plugins/trunk/moblog/class/moblog/moblogrequest.class.php 2006-01-11 15:10:20 UTC (rev 2768)
+++ plugins/trunk/moblog/class/moblog/moblogrequest.class.php 2006-01-11 15:46:29 UTC (rev 2769)
@@ -179,10 +179,16 @@
$tmpFolderName = $config->getValue( "temp_folder" );
File::createDir( $tmpFolderName );
MoblogLogger::log( "Creating temp folder = $tmpFolderName" );
- $fileName = stripslashes($part->ctype_parameters["name"]);
- if( $fileName == "" )
- $fileName = stripslashes($part->d_parameters["filename"]);
-
+ $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']);
+
$fileName = str_replace( "\"", "", $fileName );
$fileName = str_replace( "'", "", $fileName );
$tmpName = $tmpFolderName."/".md5(microtime())."_".$fileName;
More information about the pLog-svn
mailing list