dc-rest/_public.php

27 lines
678 B
PHP
Raw Normal View History

2017-04-13 22:46:51 +02:00
<?php
if (!defined('DC_RC_PATH')) { return; }
$core->url->register('rest','rest','^rest(?:/(.+))?$',array('rest','getResponse'));
class rest extends dcUrlHandlers
{
public static function getResponse($args)
{
global $core;
$active = (boolean)$core->blog->settings->rest->rest_active;
if (!$active){
self::p404();
return;
}
2017-04-27 19:35:58 +02:00
2017-04-27 20:01:47 +02:00
//coors headers
if($core->blog->settings->rest->rest_send_cors_headers){
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
}
2017-04-27 19:35:58 +02:00
2017-04-13 22:46:51 +02:00
echo "HELLO".$_SERVER['REQUEST_METHOD'].$args;
}
}