} switch ($sendaction) { case 'add': //Adding the new file to the array if (is_uploaded_file($_FILES['mail_att']['tmp_name'])) { // Counting the attachments number in the array if (isset($_SESSION['attach_array'])) { for ($i = 1; $i <= count($_SESSION['attach_array']); $i++) { $attachments_size += $_SESSION['attach_array'][$i]->file_size; } } $attachments_size += $_FILES['mail_att']['size']; if ($attachments_size < $GO_CONFIG->max_attachment_size) { $tmp_file = $GO_CONFIG->tmpdir . md5(uniqid(time())); copy($_FILES['mail_att']['tmp_name'], $tmp_file); $email->register_attachment($tmp_file, basename($_FILES['mail_att']['name']), $_FILES['mail_att']['size'], $_FILES['mail_att']['type']); } else { $feedback = '<script type="text/javascript">alert("' . $ml_file_too_big . format_size($GO_CONFIG->max_attachment_size) . ' (' . number_format($GO_CONFIG->max_attachment_size, 0, $_SESSION['GO_SESSION']['decimal_seperator'], $_SESSION['GO_SESSION']['thousands_seperator']) . ' bytes)");</script>'; } } else { $feedback = '<script type="text/javascript">alert("' . $ml_file_too_big . format_size($GO_CONFIG->max_attachment_size) . ' (' . number_format($GO_CONFIG->max_attachment_size, 0, $_SESSION['GO_SESSION']['decimal_seperator'], $_SESSION['GO_SESSION']['thousands_seperator']) . ' bytes)");</script>'; } break; case 'send': if (!isset($_POST['mail_from'])) { $profile = $GO_USERS->get_user($GO_SECURITY->user_id); $middle_name = $profile['middle_name'] == '' ? '' : $profile['middle_name'] . ' '; $name = $profile['last_name'] . ' ' . $middle_name . $profile['first_name']; } else { $profile = $email->get_account($_POST['mail_from']); $name = $profile["name"];
case 'mail_files': $_SESSION['attach_array'] = array(); $_SESSION['num_attach'] = 0; require $email_module['class_path'] . "email.class.inc"; $email = new email(); if (isset($_POST['files'])) { while ($file = smartstrip(array_shift($_POST['files']))) { if ($fs->has_read_permission2($GO_SECURITY->user_id, $file)) { $tmp_file = $GO_CONFIG->tmpdir . md5(uniqid(time())); if ($fs->chroot_copy_r2($file, $tmp_file)) { $filename = basename($file); $extension = get_extension($filename); if (!($type = $filetypes->get_type($extension))) { $type = $filetypes->add_type($extension); } $email->register_attachment($tmp_file, $filename, $fs->chroot_filesize($file), $type['mime']); } } else { $popup_feedback .= access_denied_box(basename($file)); } } echo '<script type="text/javascript" language="javascript">'; echo 'popup("' . $email_module['url'] . 'send.php?email_file=true","' . $GO_CONFIG->composer_width . '","' . $GO_CONFIG->composer_height . '");'; echo '</script>'; } require 'listview.inc'; break; case 'delete': if (isset($_POST['files'])) { for ($i = 0; $i < count($_POST['files']); $i++) { $file = smartstrip($_POST['files'][$i]);
} } if (isset($_REQUEST['files'])) { for ($i = 0; $i < count($_REQUEST['files']); $i++) { $attachments_size += filesize(smartstrip($_REQUEST['files'][$i])); } if ($attachments_size < $GO_CONFIG->max_attachment_size) { while ($file = smartstrip(array_shift($_REQUEST['files']))) { $tmp_file = $GO_CONFIG->tmpdir . md5(uniqid(time())); if (copy($file, $tmp_file)) { $filename = basename($file); $extension = get_extension($filename); if (!($type = $filetypes->get_type($extension))) { $type = $filetypes->add_type($extension); } $email->register_attachment($tmp_file, $filename, filesize($file), $type['mime'], 'attachment'); } } } else { $task = 'too_big'; } } else { if (isset($path) && !is_dir($path)) { $filesize = filesize($path); $attachments_size += $filesize; if ($attachments_size < $GO_CONFIG->max_attachment_size) { $tmp_file = $GO_CONFIG->tmpdir . md5(uniqid(time())); if (copy($path, $tmp_file)) { $filename = basename($path); $email->register_attachment($tmp_file, $filename, $filesize); $task = 'attached';
$attachments_size += $_SESSION['attach_array'][$i]->file_size; } } $filesize = filesize($path); $attachments_size += $filesize; if ($attachments_size < $GO_CONFIG->max_attachment_size) { $GO_URL = $GO_MODULES->url . 'download.php?path=' . urlencode($path); $filename = basename($path); $content_id = md5(uniqid(time())) . '@groupoffice'; $extension = get_extension($filename); if (!($type = $filetypes->get_type($extension))) { $type = $filetypes->add_type($extension); } $tmp_file = $GO_CONFIG->tmpdir . md5(uniqid(time())); if (copy($path, $tmp_file)) { $email->register_attachment($path, $filename, $filesize, $type['mime'], 'inline', $content_id); $url_replacement['id'] = $content_id; $url_replacement['url'] = $GO_URL; $_SESSION['url_replacements'][] = $url_replacement; } else { die($strDataError); } ?> <html> <body> <script type="text/javascript"> opener.editor_insertHTML('<img src="<?php echo stripslashes($GO_URL); ?> " border="0" align="absmiddle" />');