Esempio n. 1
0
 public static function ObfuscateId($data)
 {
     if (function_exists("ArrestDB_obfuscate_id")) {
         if (isset($data[0])) {
             foreach ($data as $k => $object) {
                 $data[$k] = ArrestDB::ObfuscateId($object);
             }
             return $data;
         } else {
             $data[ArrestDB::TableKeyName($data["__table"])] = ArrestDB_obfuscate_id($data["__table"], $data[ArrestDB::TableKeyName($data["__table"])], false);
             foreach ($data as $k => $value) {
                 if (is_array($value)) {
                     $data[$k] = ArrestDB::ObfuscateId($value);
                 }
             }
             return $data;
         }
     } else {
         return $data;
     }
 }
Esempio n. 2
0
            }
        }
    }
    return ArrestDB::Reply($result);
});
ArrestDB::Serve('PUT', '/(#any)/(#num)', function ($table, $id) {
    if (function_exists("ArrestDB_auth") && !ArrestDB_auth("PUT", $table, $id)) {
        exit(ArrestDB::Reply(ArrestDB::$HTTP[403]));
    }
    if (preg_match("/(?P<table>[^\\(]+)\\((?P<id>[^\\)]+)\\)/", $table, $matches)) {
        $table = $matches["table"];
        $id = $matches["id"];
    }
    if (function_exists("ArrestDB_obfuscate_id")) {
        if ($id != null && $id != "") {
            $id = ArrestDB_obfuscate_id($table, $id, true);
        }
    }
    if (function_exists("ArrestDB_allow")) {
        if (!ArrestDB_allow("PUT", $table, $id)) {
            $result = ArrestDB::$HTTP[403];
            return ArrestDB::Reply($result);
        }
    }
    if (function_exists("ArrestDB_tableAlias")) {
        $table = ArrestDB_tableAlias($table);
    }
    if (empty($GLOBALS['_PUT']) === true) {
        $result = ArrestDB::$HTTP[204];
    } else {
        if (is_array($GLOBALS['_PUT']) === true) {