Beispiel #1
0
 * 	require ../'init.php';
 * 	require LIBRARY.'/api/api.php';
 * 	
 * För snyggare gränssnitt, använd ett Alias i apache-confen:
 *
 * 	Alias /api /<projekt>/pub/api.php
 * 
 * $Rev$
 * $Author$
 * $Date$
*/
if (isset($_SESSION['madr_formError'])) {
    unset($_SESSION['madr_formError']);
}
// kill errors
$data = rest_utils::processRequest();
// try to get querystring first.
$action = http_request::getString('serviceId');
$responseType = http_request::getString('responseType');
if (!$action) {
    // the user got in by /api.php, not /api
    preg_match('/^\\/api\\/(.+?)(\\..+?)*?$/', $_SERVER['PHP_SELF'], $matches);
    // stop if invalid URI
    if (!$matches) {
        rest_utils::sendResponse($data, 400);
    }
} else {
    $matches = array();
    $matches[1] = $action;
    if ($responseType) {
        $matches[2] = $responseType;