} } else { report_problem(WEAVE_ERROR_INVALID_WBO, 400); } echo json_encode($server_time); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $json = get_json(); check_quota($db); check_timestamp($collection, $db); $success_ids = array(); $failed_ids = array(); $db->begin_transaction(); foreach ($json as $wbo_data) { $wbo = new wbo(); if (!$wbo->extract_json($wbo_data)) { $failed_ids[$wbo->id()] = $wbo->get_error(); continue; } $wbo->collection($collection); $wbo->modified($server_time); if ($wbo->validate()) { #if there's no payload (as opposed to blank), then update the metadata if ($wbo->payload_exists()) { $db->store_object($wbo); } else { $db->update_object($wbo); } $success_ids[] = $wbo->id(); } else { $failed_ids[$wbo->id()] = $wbo->get_error();