示例#1
0
文件: api.php 项目: KingNoosh/Teknik
             default:
                 array_push($jsonArray, array('error' => $CONF['errors']['InvRequest']));
                 break;
         }
     } else {
         array_push($jsonArray, array('error' => $CONF['errors']['InvRequest']));
     }
     break;
 case 'paste':
     if (isset($_POST['code'])) {
         // Create our pastebin object
         $pastebin = new Pastebin($CONF, $db);
         /// Clean up older posts
         $pastebin->doGarbageCollection();
         $id = $pastebin->doPost($_POST);
         $post = $pastebin->getPaste($id);
         array_push($jsonArray, array('results' => array('paste' => array('id' => $id, 'url' => get_page_url("p", $CONF) . '/' . $id, 'title' => $post['title'], 'format' => $post['format'], 'expiration' => $post['expires'], 'password' => $post['password']))));
     } else {
         array_push($jsonArray, array('error' => $CONF['errors']['NoPaste']));
     }
     break;
 case 'ricehalla':
     if (isset($_GET['action'])) {
         $action = strtolower($_GET['action']);
         switch ($action) {
             case "post":
                 if (isset($_POST['username'])) {
                     if (isset($_POST['password'])) {
                         $username = $_POST['username'];
                         $password = hashPassword($_POST['password'], $CONF);
                         if ($userTools->login($username, $password, false)) {
示例#2
0
if (isset($_POST['code'])) {
    /* Process posting and redirect */
    $id = $pastebin->doPost($_POST);
    if ($id) {
        $pastebin->redirectToPost($id);
        exit;
    }
}
// Process downloads.
if (isset($_GET['dl'])) {
    global $errors;
    if (isset($_GET['pass'])) {
        $getPass = $_GET['pass'];
    }
    $pid = intval($_GET['dl']);
    $result = $pastebin->getPaste($pid);
    if ($result == FALSE) {
        echo "Paste {$pid} is not available.";
        exit;
    }
    $pass = $result['password'];
    if ($pass == 'EMPTY') {
        $pastebin->doDownload($pid);
        exit;
    } else {
        if ($pass != $getPass) {
        } else {
            $pastebin->doDownload($pid);
            exit;
        }
    }