Example #1
0
<?php

/* add in custom route */
Routing::custom('lunor', function ($extra) {
    if (isset($_POST['type']) && !empty($_POST['type'])) {
        $type = $_POST['type'];
        $return['sucess'] = false;
        switch ($type) {
            case 'content_block':
                contentBlock($_POST['content_block']);
                break;
            case 'contactus':
                EmailUtil::fromContactUs($return);
                break;
            default:
                $return['error'] = 'Invalid Type.';
                break;
        }
        echo json_encode($return);
        return true;
    }
    return false;
});
Example #2
0
<?php

/* add in custom route */
Routing::custom('a', function ($extra) {
    if (isset($_POST['type']) && !empty($_POST['type'])) {
        $type = $_POST['type'];
        $return = array('sucess' => 'false');
        if ($type == 'register') {
            Account_AccountAPI::register($return);
        } else {
            if ($type == 'login') {
                Account_AccountAPI::login($return);
            } else {
                if ($type == 'logout') {
                    Account_AccountAPI::logout($return);
                } else {
                    if ($type == 'changepass') {
                        Account_AccountAPI::changePass($return);
                    } else {
                        $return['error'] = 'Invalid AccountAPI type! : ' . $type;
                    }
                }
            }
        }
        echo json_encode($return);
        return true;
    }
    return false;
});
Example #3
0
Routing::custom('f', function ($extra) {
    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 {
            if ($paste === false) {
                Lunor::$base->router->throwError(404);
                return true;
            }
        }
        if (file_exists($paste->datapath)) {
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename=' . basename($paste->datapath));
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
            header('Content-Length: ' . filesize($paste->datapath));
            ob_clean();
            flush();
            readfile($paste->datapath);
            exit;
        }
        return true;
    }
});
Example #4
0
<?php

Routing::custom('form', function ($extra) {
    session_start();
    echo session_status();
    echo 'custom route!<Br>';
    var_dump($_SESSION);
    if (isset($_SESSION['handle']) && !empty($_SESSION['handle'])) {
        $handle = $_SESSION['handle'];
        /* get the paste for the id supplied within the extra */
        call_user_func($handle);
        //session_destroy();
    }
    return true;
});