Ejemplo n.º 1
0
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');
            fpassthru($fp);
        } else {
Ejemplo n.º 2
0
        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';
}