Example #1
0
<?php

if (!empty($_POST)) {
    echo PasteHandler_PasteAPI::upload();
}
Example #2
0
<?php

/* add in custom route */
Routing::custom('p', function ($extra) {
    $return = array();
    $type = $_POST['type'];
    if (isset($type) && !empty($type)) {
        if ($type == 'upload') {
            PasteHandler_PasteAPI::upload($return);
        } else {
            if ($type == 'DELETE') {
                PasteHandler_PasteAPI::delete($return);
            } else {
                if ($type == 'CHECK_FOR_DELETE') {
                    PasteHandler_PasteAPI::checkForExpired($return);
                } else {
                    $return['error'] = 'Invalid request type!';
                }
            }
        }
        echo json_encode($return);
        return true;
    }
    if ($extra != false) {
        $pasteId = $extra;
        /* get the paste for the id supplied within the extra */
        $paste = PasteHandler_PasteAPI::forId($pasteId);
        if ($paste === true) {
            /* paste threw its one error when fetching id */
            return true;
        } else {