123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * copyright 2014 Daniel Butum <danibutum at gmail dot com>
- *
- * This file is part of stk-addons.
- *
- * stk-addons is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * stk-addons 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 stk-addons. If not, see <http://www.gnu.org/licenses/>.
- */
- define('API_MODE', true);
- require_once(dirname(__DIR__) . DIRECTORY_SEPARATOR . "config.php");
- $klein = new \Klein\Klein();
- $klein->with(
- API_LOCATION . '/' . API_VERSION,
- function () use ($klein)
- {
- // user
- $klein->respond(
- ['GET', 'POST'],
- '/user/[:action]/?',
- function ($request, $response)
- {
- $_POST["action"] = $request->action;
- return Util::ob_get_require_once("user.php");
- }
- );
- // server
- $klein->respond(
- ['GET', 'POST'],
- '/server/[:action]/?',
- function ($request, $response)
- {
- $_POST["action"] = $request->action;
- return Util::ob_get_require_once("server.php");
- }
- );
- }
- );
- $klein->dispatch();
|