if (strpos($var['maxfilesize'], 'M') !== false) { $var['maxfilesize'] = intval($var['maxfilesize']) * 1024 * 1024; } elseif (strpos($var['maxfilesize'], 'K') !== false) { $var['maxfilesize'] = intval($var['maxfilesize']) * 1024; } elseif (strpos($var['maxfilesize'], 'G') !== false) { $var['maxfilesize'] = intval($var['maxfilesize']) * 1024 * 1024 * 1024; } } print $atmail->parse("html/{$atmail->Language}/{$atmail->LoginType}/attachment.html", $var); } elseif ($var['func'] == "renameattach") { $sendmsg = new SendMsg(array('Account' => "{$atmail->username}@{$atmail->pop3host}")); $AttachmentList = $_REQUEST['Attachment']; // Loop through each attachment to rename on disk if (is_array($AttachmentList)) { foreach ($AttachmentList as $attach) { $attach = $atmail->myunescape($attach); $sendmsg->renameattach($var['unique'], $attach); } } echo "<ATTACH STATUS='OK'/>"; $atmail->end(); } elseif ($var['func'] == "attachmentmodallist") { $icon = $atmail->icon_hash(); $sendmsg = new SendMsg(array('Account' => "{$atmail->username}@{$atmail->pop3host}")); // Delete the selected attachment if ($var['delete']) { $var['status'] = $sendmsg->delete_attachment($var['delete'], $var['unique']); } // List the number of attachments . Based on the unique compose // window and our logged in account $h = $sendmsg->list_attachments($var['unique']);
$atmail->auth_error(); } if ($atmail->status == 2 && !preg_match('/xhtml/i', $_REQUEST['whoscalling'])) { $atmail->session_error(); } $var['src'] = rawurldecode($_REQUEST['file']); $var['src'] = preg_replace('/^.+[\\\\\\/]/', '', $var['src']); // Don't allow to go down a dir, sanity check $tmpfile = $pref['user_dir'] . "/tmp/" . $atmail->auth->get_account() . "/" . $var['src']; // Exit if no pathname is defined if (!$var['src']) { die("Not implemented"); } $size = filesize($tmpfile); $name = $_REQUEST['name']; $name = $atmail->myunescape($_REQUEST['name']); if (!$name) { $name = $var['src']; } if (preg_match('/.*\\.(.*)$/', $name, $match)) { $var['ext'] = $match[1]; } $var['type'] = $mime[$var['ext']]; if (!$var['type']) { $mime[$var['ext']] = "unknown/data"; } // Take off the extension //$name = str_replace(".{$var['ext']}", '', $name); //$name = urlencode($name); //$name = $name . ".{$var['ext']}"; // If the filename is too long, cut it to a size the HTTP header can read!