oauth wasn't logging in properly, also fixed api status_show to return last public post, not the last private post
This commit is contained in:
parent
66f427db5e
commit
100043da38
@ -72,7 +72,9 @@ require_once('include/photos.php');
|
|||||||
// login with oauth
|
// login with oauth
|
||||||
try {
|
try {
|
||||||
$oauth = new FKOAuth1();
|
$oauth = new FKOAuth1();
|
||||||
list($consumer,$token) = $oauth->verify_request(OAuthRequest::from_request());
|
$req = OAuthRequest::from_request();
|
||||||
|
list($consumer,$token) = $oauth->verify_request($req);
|
||||||
|
// list($consumer,$token) = $oauth->verify_request(OAuthRequest::from_request());
|
||||||
if (!is_null($token)){
|
if (!is_null($token)){
|
||||||
$oauth->loginUser($token->uid);
|
$oauth->loginUser($token->uid);
|
||||||
call_hooks('logged_in', $a->user);
|
call_hooks('logged_in', $a->user);
|
||||||
@ -676,7 +678,6 @@ require_once('include/photos.php');
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// call out normal post function
|
// call out normal post function
|
||||||
|
|
||||||
require_once('mod/item.php');
|
require_once('mod/item.php');
|
||||||
@ -696,7 +697,7 @@ require_once('include/photos.php');
|
|||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
|
|
||||||
$lastwall = q("SELECT * from item where 1
|
$lastwall = q("SELECT * from item where 1
|
||||||
and item_private != 0 and item_restrict = 0
|
and item_private = 0 and item_restrict = 0
|
||||||
and author_xchan = '%s'
|
and author_xchan = '%s'
|
||||||
and allow_cid = '' and allow_gid = '' and deny_cid = '' and deny_gid = ''
|
and allow_cid = '' and allow_gid = '' and deny_cid = '' and deny_gid = ''
|
||||||
and verb = '%s'
|
and verb = '%s'
|
||||||
@ -749,6 +750,7 @@ require_once('include/photos.php');
|
|||||||
);
|
);
|
||||||
$status_info['user'] = $user_info;
|
$status_info['user'] = $user_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
return api_apply_template("status", $type, array('$status' => $status_info));
|
return api_apply_template("status", $type, array('$status' => $status_info));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -151,15 +151,22 @@ class FKOAuth1 extends OAuthServer {
|
|||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
die('This api requires login');
|
die('This api requires login');
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['uid'] = $record['channel_id'];
|
$_SESSION['uid'] = $record['channel_id'];
|
||||||
$_SESSION['theme'] = $record['channel_theme'];
|
$_SESSION['theme'] = $record['channel_theme'];
|
||||||
$_SESSION['account_id'] = $record['channel_account_id'];
|
$_SESSION['account_id'] = $record['channel_account_id'];
|
||||||
$_SESSION['mobile_theme'] = get_pconfig($record['channel_id'], 'system', 'mobile_theme');
|
$_SESSION['mobile_theme'] = get_pconfig($record['channel_id'], 'system', 'mobile_theme');
|
||||||
$_SESSION['authenticated'] = 1;
|
$_SESSION['authenticated'] = 1;
|
||||||
// $_SESSION['page_flags'] = $record['page-flags'];
|
|
||||||
$_SESSION['my_url'] = $a->get_baseurl() . '/channel/' . $record['channel_address'];
|
$_SESSION['my_url'] = $a->get_baseurl() . '/channel/' . $record['channel_address'];
|
||||||
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
|
$_SESSION['addr'] = $_SERVER['REMOTE_ADDR'];
|
||||||
$_SESSION['allow_api'] = true;
|
$_SESSION['allow_api'] = true;
|
||||||
|
$x = q("select * from account where account_id = %d limit 1",
|
||||||
|
intval($record['channel_account_id'])
|
||||||
|
);
|
||||||
|
if($x)
|
||||||
|
$a->account = $x[0];
|
||||||
|
|
||||||
|
change_channel($record['channel_id']);
|
||||||
|
|
||||||
$a->channel = $record;
|
$a->channel = $record;
|
||||||
|
|
||||||
|
@ -161,7 +161,6 @@ function item_post(&$a) {
|
|||||||
|
|
||||||
$observer = $a->get_observer();
|
$observer = $a->get_observer();
|
||||||
|
|
||||||
|
|
||||||
if($parent) {
|
if($parent) {
|
||||||
logger('mod_item: item_post parent=' . $parent);
|
logger('mod_item: item_post parent=' . $parent);
|
||||||
$can_comment = false;
|
$can_comment = false;
|
||||||
|
Reference in New Issue
Block a user