// <-- END CORE LOAD MECHANISMS // Run Firewall Checks before hitting authentication if ($myApp['firewall'] == "on") { if ($ObjFirewall->runIPcheck() != true) { // Your IP address is not in the approved range or implicit speicification require_once '../web/core/security/ipviolation.php'; exit; } } if ($_SESSION['username'] != "") { if ($_SESSION['utype'] >= '1') { $urlVars = explode("/", $_SERVER['REQUEST_URI']); $contentUUID = db::escapechars(trim($urlVars[3])); require_once '../src/core/controller/content.php'; $ObjContent = new content(); $docID = $ObjContent->convertUUIDToDocumentID($contentUUID); // Grab file information from the DB $file_info = $ObjContent->getSingleDocument($docID); $downloadFile = ".." . $file_info['document_location']; $downloadFileNameArray = explode("/", $downloadFile); $downloadFileName = $downloadFileNameArray[4]; if (file_exists($downloadFile)) { // Get the file information from the file system $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($finfo, $downloadFile); // Set the headers for the download header("Content-Disposition: attachment; filename=\"{$downloadFileName}\";"); header("Content-Type: {$mime_type}"); header('Content-Length: ' . filesize($downloadFile)); // Now send the file as a data stream $fp = fopen($downloadFile, 'rb');
if ($d) { $documentID = $d; } elseif ($_POST['docid']) { $documentID = $_POST['docid']; } else { $documentID = ""; } if ($documentID) { if ($_POST['action'] == "confirm") { // Remove the document $deleteDoc = $ObjContent->deleteDoc($documentID); if ($deleteDoc) { $responseMsg = "Your document has been marked for removal"; } else { $responseMsg = "I couldn't mark this for removal right now, please try again."; } } $document = $ObjContent->getSingleDocument($ObjContent->convertUUIDToDocumentID($documentID)); $classid = $document['class_id']; $classes = $ObjClass->getClassInformation($classid); require_once 'web/core/content/delete.php'; } else { $classes = $ObjClass->getClassList(); require_once 'web/core/class/view.php'; } } else { require_once 'web/core/security/insufficient.php'; } } else { require_once 'web/core/login/index.php'; }