Handle the PUT operation (modify).
241 if ($in_andisol_instance->logged_in()) {
243 $fuzz_factor = isset($in_query) && is_array($in_query) && isset($in_query[
'fuzz_factor']) ? floatval($in_query[
'fuzz_factor']) : 0;
246 if (isset($parameters) && is_array($parameters) && count($parameters) && isset($in_object_list) && is_array($in_object_list) && count($in_object_list)) {
254 $change_reports = [];
256 foreach ($in_object_list as $thing) {
257 if ($thing->user_can_write()) {
258 $thing->set_batch_mode();
264 if ($result && isset($parameters[
'key']) && (
false === strpos(
',', $parameters[
'key']))) {
265 $result = $thing->set_key($parameters[
'key']);
266 unset($parameters[
'key']);
269 if ($result && isset($parameters[
'name'])) {
270 $result = $thing->set_name($parameters[
'name']);
273 if ($result && isset($parameters[
'write_token'])) {
274 $result = $thing->set_write_security_id($parameters[
'write_token']);
277 if ($result && isset($parameters[
'lang'])) {
278 $result = $thing->set_lang($parameters[
'lang']);
281 if ($result && isset($parameters[
'longitude'])) {
282 $result = $thing->set_longitude($parameters[
'longitude']);
285 if ($result && isset($parameters[
'latitude'])) {
286 $result = $thing->set_latitude($parameters[
'latitude']);
289 if ($result && isset($parameters[
'fuzz_factor'])) {
290 $result = $thing->set_fuzz_factor($parameters[
'fuzz_factor']);
293 if ($result && isset($parameters[
'can_see_through_the_fuzz'])) {
294 $result = $thing->set_can_see_through_the_fuzz($parameters[
'can_see_through_the_fuzz']);
297 if ($result && isset($parameters[
'description'])) {
298 $result = $thing->set_tag(1, $parameters[
'description']);
301 if ($result && isset($parameters[
'tag2'])) {
302 $result = $thing->set_tag(2, $parameters[
'tag2']);
305 if ($result && isset($parameters[
'tag3'])) {
306 $result = $thing->set_tag(3, $parameters[
'tag3']);
309 if ($result && isset($parameters[
'tag4'])) {
310 $result = $thing->set_tag(4, $parameters[
'tag4']);
313 if ($result && isset($parameters[
'tag5'])) {
314 $result = $thing->set_tag(5, $parameters[
'tag5']);
317 if ($result && isset($parameters[
'tag6'])) {
318 $result = $thing->set_tag(6, $parameters[
'tag6']);
321 if ($result && isset($parameters[
'tag7'])) {
322 $result = $thing->set_tag(7, $parameters[
'tag7']);
325 if ($result && isset($parameters[
'tag8'])) {
326 $result = $thing->set_tag(8, $parameters[
'tag8']);
329 if ($result && isset($parameters[
'tag9'])) {
330 $result = $thing->set_tag(9, $parameters[
'tag9']);
333 if ($result && isset($parameters[
'remove_payload'])) {
334 $result = $thing->set_payload(NULL);
335 } elseif ($result && isset($parameters[
'payload'])) {
336 $result = $thing->set_payload($parameters[
'payload']);
340 if ($result && isset($parameters[
'child_ids'])) {
341 $add = $parameters[
'child_ids'][
'add'];
342 $remove = $parameters[
'child_ids'][
'remove'];
344 foreach ($remove as $id) {
345 if ($id != $thing->id()) {
346 $child = $in_andisol_instance->get_single_data_record_by_id($id);
348 $result = $thing->deleteThisElement($child);
358 foreach ($add as $id) {
359 if ($id != $thing->id()) {
360 $child = $in_andisol_instance->get_single_data_record_by_id($id);
362 $result = $thing->appendElement($child);
374 if ($result && isset($parameters[
'read_token'])) {
375 $result = $thing->set_read_security_id($parameters[
'read_token']);
380 $change_reports[] = [
'object' => $thing,
'report' => $changed_thing];
386 if ($result && count($change_reports)) {
387 $ret[
'changed_things'] = [];
388 foreach ($change_reports as $value) {
389 $result = $value[
'object']->clear_batch_mode();
391 $ret[
'changed_things'][] = $value[
'report'];
399 header(
'HTTP/1.1 403 Forbidden');