aboutsummaryrefslogtreecommitdiffstats
path: root/include/api.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-02-22 20:21:05 -0800
committerfriendica <info@friendica.com>2012-02-22 20:21:05 -0800
commit58a9c652de09817b9c5d5132de51b8690ed32d53 (patch)
tree5d02b1eabde017f00911c133d2cae999e4251198 /include/api.php
parent8b2189f67fad1d35b3a74a1e333f9c21304af6c0 (diff)
parente34a648cadaf79e1749f220b9e26c52c5e295819 (diff)
downloadvolse-hubzilla-58a9c652de09817b9c5d5132de51b8690ed32d53.tar.gz
volse-hubzilla-58a9c652de09817b9c5d5132de51b8690ed32d53.tar.bz2
volse-hubzilla-58a9c652de09817b9c5d5132de51b8690ed32d53.zip
Merge pull request #45 from annando/master
New HTML to BBCode converter, changes to BBCode, nginx support, ...
Diffstat (limited to 'include/api.php')
-rwxr-xr-xinclude/api.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/include/api.php b/include/api.php
index 28d6c3f4b..013f4b97a 100755
--- a/include/api.php
+++ b/include/api.php
@@ -99,6 +99,10 @@
**************************/
function api_call(&$a){
GLOBAL $API, $called_api;
+
+ // preset
+ $type="json";
+
foreach ($API as $p=>$info){
if (strpos($a->query_string, $p)===0){
$called_api= explode("/",$p);
@@ -109,14 +113,14 @@
load_contact_links(local_user());
- logger('API call for ' . $a->user['username'] . ': ' . $a->query_string);
+ logger('API call for ' . $a->user['username'] . ': ' . $a->query_string);
logger('API parameters: ' . print_r($_REQUEST,true));
- $type="json";
+ $type="json";
if (strpos($a->query_string, ".xml")>0) $type="xml";
if (strpos($a->query_string, ".json")>0) $type="json";
if (strpos($a->query_string, ".rss")>0) $type="rss";
- if (strpos($a->query_string, ".atom")>0) $type="atom";
-
+ if (strpos($a->query_string, ".atom")>0) $type="atom";
+
$r = call_user_func($info['func'], $a, $type);
if ($r===false) return;
@@ -126,8 +130,8 @@
header ("Content-Type: text/xml");
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
- case "json":
- //header ("Content-Type: application/json");
+ case "json":
+ //header ("Content-Type: application/json");
foreach($r as $rr)
return json_encode($rr);
break;
@@ -139,19 +143,20 @@
header ("Content-Type: application/atom+xml");
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
-
+
}
//echo "<pre>"; var_dump($r); die();
}
}
+ logger('API call not implemented: '.$a->query_string." - ".print_r($_REQUEST,true));
$r = '<status><error>not implemented</error></status>';
switch($type){
case "xml":
header ("Content-Type: text/xml");
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
- case "json":
- header ("Content-Type: application/json");
+ case "json":
+ header ("Content-Type: application/json");
return json_encode(array('error' => 'not implemented'));
break;
case "rss":
@@ -162,7 +167,6 @@
header ("Content-Type: application/atom+xml");
return '<?xml version="1.0" encoding="UTF-8"?>'."\n".$r;
break;
-
}
}