aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-19 20:13:24 -0700
committerFriendika <info@friendika.com>2011-06-19 20:13:24 -0700
commitb56e00c7c5ed1ee7043852b4ce025a3d02f139e8 (patch)
tree63482f7483016c0486f16fdcbc83cfedd876931b /include
parentcc7c72be9048941167d2e911c0db4b2050acd4f8 (diff)
downloadvolse-hubzilla-b56e00c7c5ed1ee7043852b4ce025a3d02f139e8.tar.gz
volse-hubzilla-b56e00c7c5ed1ee7043852b4ce025a3d02f139e8.tar.bz2
volse-hubzilla-b56e00c7c5ed1ee7043852b4ce025a3d02f139e8.zip
api post sort of working - output status,user need to be swapped
Diffstat (limited to 'include')
-rw-r--r--include/api.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/api.php b/include/api.php
index ef41c411c..d1f0f9330 100644
--- a/include/api.php
+++ b/include/api.php
@@ -27,10 +27,21 @@
* Simple HTTP Login
*/
function api_login(&$a){
+ // workaround for HTTP-auth in CGI mode
+ if(x($_SERVER,'REDIRECT_REMOTE_USER')) {
+ $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"],6)) ;
+ if(strlen($userpass)) {
+ list($name, $password) = explode(':', $userpass);
+ $_SERVER['PHP_AUTH_USER'] = $name;
+ $_SERVER['PHP_AUTH_PW'] = $password;
+ }
+ }
+
if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ logger('API_login: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendika"');
header('HTTP/1.0 401 Unauthorized');
- die('This api require login');
+ die('This api requires login');
}
$user = $_SERVER['PHP_AUTH_USER'];
@@ -52,9 +63,10 @@
if(count($r)){
$record = $r[0];
} else {
+ logger('API_login failure: ' . print_r($_SERVER,true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendika"');
header('HTTP/1.0 401 Unauthorized');
- die('This api require login');
+ die('This api requires login');
}
$_SESSION['uid'] = $record['uid'];
$_SESSION['theme'] = $record['theme'];
@@ -303,7 +315,7 @@
// TODO - media uploads and alternate 'source'
- function api_post_message(&$a, $type) {
+ function api_statuses_update(&$a, $type) {
if (local_user()===false) return false;
$user_info = api_get_user($a);
@@ -329,7 +341,7 @@
item_post($a);
// this should output the last post (the one we just posted).
- return api_users_show();
+ return api_users_show($a,$type);
}
api_register_func('api/statuses/update','api_statuses_update', true);