Example #1
0
}
include_once ROOT . DS . 'inc' . DS . 'core.php';
$pm = new PictshareModel();
if (UPLOAD_CODE != false && !$pm->uploadCodeExists($_REQUEST['upload_code'])) {
    exit(json_encode(array('status' => 'ERR', 'reason' => 'Wrong upload code provided')));
}
if ($_REQUEST['getimage']) {
    $url = $_REQUEST['getimage'];
    echo json_encode($pm->uploadImageFromURL($url));
} else {
    if ($_FILES['postimage']) {
        $image = $_FILES['postimage'];
        echo json_encode($pm->processSingleUpload($file, 'postimage'));
    } else {
        if ($_REQUEST['base64']) {
            $data = $_REQUEST['base64'];
            $format = $_REQUEST['format'];
            echo json_encode($pm->uploadImageFromBase64($data, $format));
        } else {
            if ($_REQUEST['geturlinfo']) {
                echo json_encode($pm->getURLInfo($_REQUEST['geturlinfo']));
            } else {
                if ($_REQUEST['a'] == 'oembed') {
                    echo json_encode($pm->oembed($_REQUEST['url'], $_REQUEST['t']));
                } else {
                    echo json_encode(array('status' => 'ERR', 'reason' => 'NO_VALID_COMMAND'));
                }
            }
        }
    }
}