X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Foauth.php;h=6a1d72d178f413fb68a94b8f7a64c7c35cb4d045;hb=d49325d177cf03b97df250ca3cb081421c541049;hp=103d4c2fa9458a306f4f37e1600f8d493595678a;hpb=d0994fc882dd18bb90df861cf515768dbb5d4cc1;p=friendica.git diff --git a/include/oauth.php b/include/oauth.php index 103d4c2fa9..6a1d72d178 100644 --- a/include/oauth.php +++ b/include/oauth.php @@ -1,8 +1,8 @@ - * + * */ define('REQUEST_TOKEN_DURATION', 300); @@ -15,11 +15,11 @@ class FKOAuthDataStore extends OAuthDataStore { function gen_token(){ return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid()))); } - + function lookup_consumer($consumer_key) { logger(__function__.":".$consumer_key); //echo "
"; var_dump($consumer_key); killme(); - + $r = q("SELECT client_id, pw, redirect_uri FROM clients WHERE client_id='%s'", dbesc($consumer_key) ); @@ -129,11 +129,11 @@ class FKOAuth1 extends OAuthServer { $this->add_signature_method(new OAuthSignatureMethod_PLAINTEXT()); $this->add_signature_method(new OAuthSignatureMethod_HMAC_SHA1()); } - + function loginUser($uid){ logger("FKOAuth1::loginUser $uid"); $a = get_app(); - $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `verified` = 1 LIMIT 1", + $r = q("SELECT * FROM `user` WHERE uid=%d AND `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 LIMIT 1", intval($uid) ); if(count($r)){ @@ -150,6 +150,7 @@ class FKOAuth1 extends OAuthServer { $_SESSION['page_flags'] = $record['page-flags']; $_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $record['nickname']; $_SESSION['addr'] = $_SERVER['REMOTE_ADDR']; + $_SESSION["allow_api"] = true; //notice( t("Welcome back ") . $record['username'] . EOL); $a->user = $record; @@ -166,7 +167,7 @@ class FKOAuth1 extends OAuthServer { $a->cid = $r[0]['id']; $_SESSION['cid'] = $a->cid; } - q("UPDATE `user` SET `login_date` = '%s' WHERE `uid` = %d LIMIT 1", + q("UPDATE `user` SET `login_date` = '%s' WHERE `uid` = %d", dbesc(datetime_convert()), intval($_SESSION['uid']) );