예제 #1
0
 public static function getQuery($query, $extends = null, $id = "")
 {
     $table = $query["TABLE"];
     $query = ArrestDB::PrepareQueryGET($query, false);
     $result = ArrestDB::Query($query);
     if ($result === false || count($result) == 0) {
         return null;
     } else {
         if (isset($result[0])) {
             foreach ($result as $k => $object) {
                 $result[$k]["__table"] = $table;
             }
         } else {
             $result["__table"] = $table;
         }
     }
     if (isset($extends) === true) {
         $extends = explode(",", $extends);
         try {
             $result = ArrestDB::Extend($result, $extends);
         } catch (Exception $e) {
             $result = ArrestDB::$HTTP[$e->getCode()];
             $result["error"]["detail"] = $e->getMessage();
             return ArrestDB::Reply($result);
         }
     }
     if (function_exists("ArrestDB_postProcess")) {
         $result = ArrestDB_postProcess('GET', $table, $id, $result);
     }
     return ArrestDB::ObfuscateId($result);
 }
예제 #2
0
        foreach ($result as $k => $object) {
            $result[$k]["__table"] = $tableBase;
        }
    } else {
        $result["__table"] = $tableBase;
    }
    if (isset($_GET['extends']) === true || isset($_GET['$extends']) === true) {
        if (isset($_GET['extends'])) {
            $extends = $_GET['extends'];
        }
        if (isset($_GET['$extends'])) {
            $extends = $_GET['$extends'];
        }
        $extends = explode(",", $extends);
        try {
            $result = ArrestDB::Extend($result, $extends);
        } catch (Exception $e) {
            $result = ArrestDB::$HTTP[$e->getCode()];
            $result["error"]["detail"] = $e->getMessage();
            return ArrestDB::Reply($result);
        }
    }
    if (function_exists("ArrestDB_postProcess")) {
        $result = ArrestDB_postProcess("GET", $table, $id, $result);
    }
    $result = ArrestDB::ObfuscateId($result);
    return ArrestDB::Reply($result);
});
ArrestDB::Serve('DELETE', '/(#any)/(#num)', function ($table, $id) {
    if (function_exists("ArrestDB_auth") && !ArrestDB_auth("DELETE", $table, $id)) {
        exit(ArrestDB::Reply(ArrestDB::$HTTP[403]));