$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);
public static function save($thread, $contribution) { // todo: スレッドに投稿を保存する機能 self::$tmp_post = $contribution; return true; }