X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Foauth.php;h=6a1d72d178f413fb68a94b8f7a64c7c35cb4d045;hb=d49325d177cf03b97df250ca3cb081421c541049;hp=28ac4428f0c22844720463b277978d76c9789eb5;hpb=1d91b2d1b3d1e24565cfc39bec5ac25b5a1e340d;p=friendica.git diff --git a/include/oauth.php b/include/oauth.php index 28ac4428f0..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,7 +129,7 @@ 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(); @@ -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']) );