X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Foauth.php;h=6a1d72d178f413fb68a94b8f7a64c7c35cb4d045;hb=df312402e46cc3cdc788c73d0c41874b6c71fcb3;hp=2724dcf7cf506fb2184414c004456659d69bf039;hpb=43d5876e8b35d53a0bef5248c5d63e5bc209dbbf;p=friendica.git diff --git a/include/oauth.php b/include/oauth.php index 2724dcf7cf..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)){ @@ -145,10 +145,12 @@ class FKOAuth1 extends OAuthServer { } $_SESSION['uid'] = $record['uid']; $_SESSION['theme'] = $record['theme']; + $_SESSION['mobile-theme'] = get_pconfig($record['uid'], 'system', 'mobile_theme'); $_SESSION['authenticated'] = 1; $_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; @@ -165,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']) );