Beispiel #1
0
$action = $_REQUEST['action'];
$token = isset($_REQUEST['token']) ? $_REQUEST['token'] : "";
// temp override for development.
$override = false;
//if (isset($_REQUEST['override'])) {
//    if ($_REQUEST['override'] == '1') {
//        $override = true;
//    }
//}
if (isset($_FILES['userfile'])) {
    $uploaded_file = $_FILES['userfile'];
    //print_r($uploaded_file['error']);
}
$authlib = new authlib();
$returnStr = '';
if ($authlib->validateToken($token) || $action == 'login' || $action == 'checksunbeam' || $override) {
    switch ($action) {
        // Put this at the top, because it needs to be the most responsive
        // Show the student image
        case 'showstudentimage':
            include 'lib/MediaLib.php';
            $medialib = new MediaLib();
            if ($_REQUEST['getbig'] == 'true') {
                $path = $medialib->displayRawStudentImage($_REQUEST['studentid']);
                //$fp = fopen($path, 'rb');
                header("Content-Type: image/png");
                header("Content-Length: " . filesize($path));
                readfile($path);
                die;
            } else {
                $thumb = $medialib->displayStudentThumb($_REQUEST['studentid'], $_REQUEST['getbig']);