Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -378,32 +378,41 @@ class _Email
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = md5( uniqid() );
|
||||
$filename = md5( mt_rand() );
|
||||
}
|
||||
|
||||
/* Save the file */
|
||||
$file = \IPS\File::create( 'core_Attachment', $filename, $data['body'] );
|
||||
|
||||
/* Add to the message */
|
||||
if ( $file->isImage() )
|
||||
try
|
||||
{
|
||||
if ( isset( $data['headers']['content-id'] ) and $contentId = trim( $data['headers']['content-id'], '<>' ) and isset( $this->imagePlaceholders[ $contentId ] ) )
|
||||
/* Save the file */
|
||||
$file = \IPS\File::create( 'core_Attachment', $filename, $data['body'] );
|
||||
|
||||
/* Add to the message */
|
||||
if ( $file->isImage() )
|
||||
{
|
||||
$imageTag = "<img src='<fileStore.core_Attachment>/{$file}' class='ipsImage ipsImage_thumbnailed'>";
|
||||
$this->message = preg_replace( "/<a href=\"#image-placeholder={$this->imagePlaceholders[ $contentId ]}\" rel=\"[^\"]*\"><\/a>/", $imageTag, $this->message );
|
||||
if ( isset( $data['headers']['content-id'] ) and $contentId = trim( $data['headers']['content-id'], '<>' ) and isset( $this->imagePlaceholders[ $contentId ] ) )
|
||||
{
|
||||
$imageTag = "<img src='<fileStore.core_Attachment>/{$file}' class='ipsImage ipsImage_thumbnailed'>";
|
||||
$this->message = preg_replace( "/<a href=\"#image-placeholder={$this->imagePlaceholders[ $contentId ]}\" rel=\"[^\"]*\"><\/a>/", $imageTag, $this->message );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message .= "<img src='<fileStore.core_Attachment>/{$file}' class='ipsImage ipsImage_thumbnailed'>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message .= "<img src='<fileStore.core_Attachment>/{$file}' class='ipsImage ipsImage_thumbnailed'>";
|
||||
$this->message .= "<a class='ipsAttachLink' href='<fileStore.core_Attachment>/{$file}'>{$file->originalFilename}</a>";
|
||||
}
|
||||
|
||||
/* Save to the $attachments array and exit */
|
||||
$this->attachments[] = $file;
|
||||
}
|
||||
else
|
||||
catch( \Exception $e )
|
||||
{
|
||||
$this->message .= "<a class='ipsAttachLink' href='<fileStore.core_Attachment>/{$file}'>{$file->originalFilename}</a>";
|
||||
\IPS\Log::log( $e, 'incoming_email' );
|
||||
|
||||
/* This could be a corrupt file, which we can't do anything about */
|
||||
}
|
||||
|
||||
/* Save to the $attachments array and exit */
|
||||
$this->attachments[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,7 +517,7 @@ class _Email
|
||||
*/
|
||||
protected function _replaceImageWithPlaceholder( $matches )
|
||||
{
|
||||
$id = md5( uniqid() );
|
||||
$id = mt_rand();
|
||||
$this->imagePlaceholders[ $matches[1] ] = $id;
|
||||
return '<a href="#image-placeholder=' . $id . '" rel=""></a>';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user