You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dc-rest/_public.php

36 lines
842 B
PHTML

7 years ago
<?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;
}
//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');
}
7 years ago
header('Content-Type: application/json');
7 years ago
private function get_api_key_sended(){
$headers = getallheaders();
if(isset($headers['x_dc_key'])){
return $headers['x_dc_key'];
}else{
return false;
}
7 years ago
}
7 years ago
7 years ago
}