Example #1
0
File: index.php Project: K-atc/Kch
            $res = array("status" => "OK", "result" => $json);
        }
        break;
    case POST_CONTRIBUTION:
        $bool = Kch::save($thread, $contribution);
        if ($bool === false) {
            $res = array("status" => "ERROR", "message" => "post error");
        } else {
            $json = Kch::load($thread);
            if ($json === Null) {
                Kch::throw_404();
                $res = array("status" => "ERROR", "message" => "thread not found");
            } else {
                $res = array("status" => "OK", "result" => $json);
            }
        }
        break;
    case API_PARAM_ERROR:
        Kch::throw_404();
        $res = array("status" => "ERROR", "message" => "parameter error");
        break;
    case API_VALIDATION_ERROR:
        Kch::throw_404();
        $res = array("status" => "ERROR", "message" => "validation error");
        break;
    default:
        Kch::throw_404();
        $res = array("status" => "ERROR", "message" => "unsupported API");
}
Kch::send($res);
Example #2
0
File: Kch.php Project: K-atc/Kch
 public static function save($thread, $contribution)
 {
     // todo: スレッドに投稿を保存する機能
     self::$tmp_post = $contribution;
     return true;
 }