X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fapi.php;h=cda97c729ce9bb5bfc80c622ede8530de4387938;hb=2196a0577b29dcec1ba4d2c32be10fa5f0e91034;hp=67564836e8386b6a58abadc2d4fd51999fe5edbe;hpb=0c67c89715df801e0c887be50c9739db3bae7ca3;p=friendica.git diff --git a/mod/api.php b/mod/api.php index 67564836e8..cda97c729c 100644 --- a/mod/api.php +++ b/mod/api.php @@ -1,8 +1,14 @@ get_parameters(); $token = $params['oauth_token']; @@ -12,16 +18,15 @@ function oauth_get_client($request){ AND `tokens`.`id`='%s' AND `tokens`.`scope`='request'", dbesc($token)); - if (!count($r)) + if (!DBM::is_result($r)) return null; return $r[0]; } -} -if(! function_exists('api_post')) { -function api_post(&$a) { - if(! local_user()) { +function api_post(App $a) { + + if (! local_user()) { notice( t('Permission denied.') . EOL); return; } @@ -30,11 +35,10 @@ function api_post(&$a) { notice( t('Permission denied.') . EOL); return; } -} + } -if(! function_exists('api_content')) { -function api_content(&$a) { +function api_content(App $a) { if ($a->cmd=='api/oauth/authorize'){ /* * api/oauth/authorize interact with the user. return a standard page @@ -58,7 +62,7 @@ function api_content(&$a) { $consumer = new OAuthConsumer($app['client_id'], $app['pw'], $app['redirect_uri']); $verifier = md5($app['secret'].local_user()); - set_config("oauth", $verifier, local_user()); + Config::set("oauth", $verifier, local_user()); if ($consumer->callback_url!=null) { @@ -84,7 +88,7 @@ function api_content(&$a) { } - if(! local_user()) { + if (! local_user()) { /// @TODO We need login form to redirect to this page notice( t('Please login to continue.') . EOL ); return login(false,$request->get_parameters()); @@ -106,12 +110,9 @@ function api_content(&$a) { '$no' => t('No'), )); - //echo "
"; var_dump($app); killme();
-
 		return $o;
 	}
 
 	echo api_call($a);
 	killme();
 }
-}