appwrite/public/index.php

35 lines
930 B
PHP
Raw Normal View History

2019-05-09 06:54:39 +00:00
<?php
/**
* “Programming today is a race between software engineers striving to build bigger and better idiot-proof programs,
* and the Universe trying to produce bigger and better idiots.
* So far, the Universe is winning.
*
* Rick Cook, The Wizardry Compiled
*/
2019-08-20 15:43:01 +00:00
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
2019-05-09 06:54:39 +00:00
error_reporting(0);
2019-08-20 15:43:01 +00:00
ini_set('display_errors', 0);
2019-05-09 06:54:39 +00:00
$path = (isset($_GET['q'])) ? explode('/', $_GET['q']) : [];
$domain = (isset($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : '';
array_shift($path);
$version = array_shift($path);
switch ($version) { // Switch between API version
case 'v1':
$service = $version . '/' . array_shift($path);
2019-07-31 20:35:42 +00:00
include __DIR__ . '/../app/app.php';
2019-12-16 19:35:33 +00:00
break;
2019-05-09 06:54:39 +00:00
case 'console':
2019-12-16 19:35:33 +00:00
default:
2019-05-09 06:54:39 +00:00
$service = $version . '/';
2019-07-31 20:35:42 +00:00
include __DIR__ . '/../app/app.php';
2019-05-09 06:54:39 +00:00
break;
}