* (at your option) any later version. * * damas-core is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with damas-core. If not, see <http://www.gnu.org/licenses/>. * */ session_start(); include_once "lib/http_service.php"; include_once "lib/model_json.php"; damas_service::init_http(); damas_service::accessGranted(); damas_service::allowed("model::" . arg("cmd")); if (!arg("cmd")) { header("HTTP/1.1: 400 Bad Request"); echo "Bad command"; exit; } header('Content-type: application/json'); $ret = false; switch (arg("cmd")) { /* SCRUD operations */ case "search": echo json_encode(model::search(json_decode(arg("keys")), arg("sortby"), arg("order"), arg("limit"))); break; case "create": if (is_null(arg('keys'))) {