This blob has been accessed 492 times via Git panel.
- <?php
- require_once("core.php");
- if (!isset($_SESSION['logged_uid']) or !isset($_SESSION['logged_lvl']) or !isset($_SESSION['logged_key']) or ($_SESSION['logged_lvl'] != "subscriber") or !isset($_SESSION['filedrop_dir']) or empty($_SESSION['filedrop_dir'])) {
- exit;
- }
- $filedrop_box = $_SESSION['filedrop_dir'];
- if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj'])) {
- for ($i=0; $i<count($_FILES['filedrop_obj']['name']); $i++) {
- if (is_uploaded_file($_FILES['filedrop_obj']['tmp_name'][$i])) {
- if ($_FILES['filedrop_obj']['size'][$i] <= $max_file_size) {
- $filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name'][$i]);
- $filedrop_nom = preg_replace("/[^a-zA-Z0-9.\-_]/u", "", $filedrop_nom);
- if (!file_exists("attach/i/$fileUsr/$filedrop_box")) {
- mkdir("attach/i/$fileUsr/$filedrop_box",0700,1);
- }
- if (!file_exists("attach/i/$fileUsr/$filedrop_box/$filedrop_nom")) {
- $res = copy($_FILES['filedrop_obj']['tmp_name'][$i], "attach/i/$fileUsr/$filedrop_box/$filedrop_nom");
- unlink($_FILES['filedrop_obj']['tmp_name'][$i]);
- //echo "<script>alert(\"{$_FILES['filedrop_obj']['name'][$i]} saved as $filedrop_nom\");</script>";
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name'][$i]);
- }
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name'][$i]);
- //echo "<script>alert(\"Failed to save {$_FILES['filedrop_obj']['name'][$i]} because it is too big.\");</script>";
- }
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name'][$i]);
- }
- }
- }
- if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
- $fileAttachments = glob("attach/i/$fileUsr/$filedrop_box/*");
- if (count($fileAttachments) > 0) {
- if (file_exists("css.php")) {
- $css = file_get_contents("css.php");
- $css = str_replace("<style>","",$css);
- $css = str_replace("</style>","",$css);
- echo "<style>\r\n$css</style>\r\n\r\n";
- // compensate for body { margin-right: 1.25rem; margin-left: 1.25rem; } in css.php
- echo "<style>body { margin-right: 5px !important; margin-right: 0.313rem !important; margin-left: 5px !important; margin-left: 0.313rem !important; }</style>\r\n\r\n";
- }
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\">";
- foreach ($fileAttachments as $fileAttachment) {
- $fileName = str_replace("attach/i/$fileUsr/$filedrop_box/","",$fileAttachment);
- $fileSize = filesize($fileAttachment);
- $fileSize = HumanReadableFilesize($fileSize);
- $fileScan = "";
- $scanFile = exec("clamdscan -i --no-summary $fileAttachment",$scanResult,$scanErr);
- if ($scanErr == "1") {
- $fileScan = explode(" ", $scanFile);
- $fileScan = " <font color=\"red\">{$fileScan[1]}</font>";
- }
- if (is_image($fileAttachment)) {
- $img_size = getimagesize($fileAttachment);
- $imgSize = "";
- if (($img_size[0] > 0) and ($img_size[1] > 0)) {
- $imgSize = ", {$img_size[0]}x{$img_size[1]} pixels";
- if ($img_size[bits] > 0) {
- $imgSize = "$imgSize, {$img_size[bits]}-bit image";
- }
- }
- echo "\r\n<tr><td><a href=\"$fileAttachment\" target=\"_blank\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" target=\"_blank\">$fileName</a><br>$fileSize{$imgSize}{$fileScan}</td></tr>\r\n";
- }
- else {
- echo "\r\n<tr><td><a href=\"$fileAttachment\" download=\"$fileName\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\" download=\"$fileName\">$fileName</a><br>$fileSize{$fileScan}</td></tr>\r\n";
- }
- }
- echo "</table>";
- echo "<script>parent.top.document.getElementById('filedrop').style.display = 'block';</script>";
- echo "<script>parent.top.document.getElementById('filedrop').style.height = document.body.parentNode.clientHeight + 'px';</script>";
- }
- }
- $_SESSION['clean_up_i'] = $filedrop_box;
- ?>
- <script>
- parent.top.document.getElementById('filedrop_wait').innerHTML = '';
- parent.top.document.filedrop_form.filedrop_submit.disabled=false;
- </script>