/** * Replace all substring occurences by another one in every keys on node and sub nodes. * @param {Integer} $id node index * @param {String} $old old substring value to replace * @param {String} $new new substring value */ static function setKeys($id, $old, $new) { $keys = model::keys($id); foreach ($keys as $key => $value) { model::setKey($id, $key, str_replace($old, $new, $value)); } $children = model::children($id); for ($i = 0; $i < sizeof($children); $i++) { model::setKeys($children[$i], $old, $new); } return true; }
} if (!model::setTags(arg("id"), arg("tags"))) { header("HTTP/1.1: 409 Conflict"); //$err = $ERR_NODE_UPDATE; echo "setTags Error, please change your values"; exit; } break; case "setKeys": if (is_null(arg('id')) || is_null(arg('old')) || is_null(arg('new'))) { header("HTTP/1.1: 400 Bad Request"); //ERR_COMMAND echo "Bad command"; exit; } if (!model::setKeys(arg("id"), arg("old"), arg("new"))) { header("HTTP/1.1: 409 Conflict"); //$err = $ERR_NODE_UPDATE; echo "setKeys Error, please change your values"; exit; } break; /** * * json output functions * model_json namespace * */ /** * * json output functions