This blob has been accessed 323 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")) {
- exit;
- }
- if (isset($_FILES['filedrop_obj']) and !empty($_FILES['filedrop_obj']) and isset($_POST['filedrop_box']) and !empty($_POST['filedrop_box'])) {
- if (is_uploaded_file($_FILES['filedrop_obj']['tmp_name'])) {
- if ($_FILES['filedrop_obj']['size'] <= $max_file_size) {
- $filedrop_box = $_POST['filedrop_box'];
- $filedrop_nom = str_replace(" ", "_", $_FILES['filedrop_obj']['name']);
- 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'], "attach/i/$fileUsr/$filedrop_box/$filedrop_nom");
- unlink($_FILES['filedrop_obj']['tmp_name']);
- echo "<script>alert(\"{$_FILES['filedrop_obj']['name']} saved as $filedrop_nom\");</script>";
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name']);
- echo "<script>alert(\"Failed to save {$_FILES['filedrop_obj']['name']} because it is too big.\");</script>";
- }
- }
- else {
- unlink($_FILES['filedrop_obj']['tmp_name']);
- }
- }
- 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";
- }
- 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\"><img src=\"images/file.png\" border=\"0\" width=\"36\" height=\"36\"></a></td><td><a href=\"$fileAttachment\">$fileName</a><br>$fileSize{$fileScan}</td></tr>\r\n";
- }
- }
- echo "</table>";
- }
- $_SESSION['clean_up_i'] = $filedrop_box;
- }
- ?>
- <script>
- parent.top.document.getElementById('filedrop_wait').innerHTML = '';
- parent.top.document.filedrop_form.filedrop_submit.disabled=false;
- </script>