| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * v1 API Controller file.
- *
- * Provides a class to handle all posible API requests.
- *
- * @category Constroller
- */
- /**
- * v1 API controller.
- *
- * Handles every API request.
- *
- * @category Controller
- */
- class API_Controller {
- /**
- * Constructor.
- *
- * Handles every request, creating the required models and selecting the
- * view.
- *
- * @param mixed[] $params GET parameters of the request.
- */
- public function __construct($params){
- // API call: Use API controller
- if (count($params) == 0){
- require_once(__DIR__ . "main.php");
- }
- else{
- $command = strtoupper($params[1]);
- switch ($command){
- case "log-profile":
- require_once(__DIR__ . "log-profile/index.php");
- break;
- case "log-run":
- require_once(__DIR__ . "log-run/index.php");
- break;
- default:
- header("HTTP/1.1 404");
- }
- }
- }
- }
- ?>
|