- /**
- ** attachment_common.php
- **
- ** Copyright (c) 1999-2001 The Squirrelmail Development Team
- ** Licensed under the GNU GPL. For full terms see the file COPYING.
- **
- ** This file provides the handling of often-used attachment types.
- **
- ** $Id$
- **/
-
- global $attachment_common_show_images_list;
- $attachment_common_show_images_list = array();
-
- global $FileExtensionToMimeType, $attachment_common_types;
- $FileExtensionToMimeType = array('bmp' => 'image/x-bitmap',
- 'gif' => 'image/gif',
- 'htm' => 'text/html',
- 'html' => 'text/html',
- 'jpg' => 'image/jpeg',
- 'jpeg' => 'image/jpeg',
- 'php' => 'text/plain',
- 'png' => 'image/png',
- 'rtf' => 'text/richtext',
- 'txt' => 'text/plain',
- 'vcf' => 'text/x-vcard');
-
- // Register browser-supported image types
- if (isset($attachment_common_types)) {
- // Don't run this before being logged in. That may happen
- // when plugins include mime.php
- foreach ($attachment_common_types as $val => $v) {
+
+/**
+ * attachment_common.php
+ *
+ * This file provides the handling of often-used attachment types.
+ *
+ * @copyright 1999-2011 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @todo document attachment $type hook arguments
+ */
+
+$attachment_common_show_images_list = array();
+
+/**
+ * Mapping of file extensions to mime types
+ *
+ * Used for application/octet-stream mime type detection.
+ * Supported extensions: bmp, gif, htm, html, jpg, jpeg, php,
+ * png, rtf, txt, patch (since 1.4.2), vcf
+ * @global array $FileExtensionToMimeType
+ */
+$FileExtensionToMimeType = array('bmp' => 'image/x-bitmap',
+ 'gif' => 'image/gif',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'jpe' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'php' => 'text/plain',
+ 'png' => 'image/png',
+ 'rtf' => 'text/richtext',
+ 'txt' => 'text/plain',
+ 'patch'=> 'text/plain',
+ 'vcf' => 'text/x-vcard');
+
+/* Register browser-supported image types */
+sqgetGlobalVar('attachment_common_types', $attachment_common_types);
+// FIXME: do we use $attachment_common_types that is not extracted by sqgetGlobalVar() ?
+if (isset($attachment_common_types)) {
+ // var is used to detect activation of jpeg image types
+ unset($jpeg_done);
+ /* Don't run this before being logged in. That may happen
+ when plugins include mime.php */
+ foreach ($attachment_common_types as $val => $v) {