X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fapi.php;h=cd5d5241f86c8faa231407c51b9e6540ce17ac7e;hb=10ede7314136edb1c475e1af546a59ff4c5648cf;hp=67564836e8386b6a58abadc2d4fd51999fe5edbe;hpb=d6cf791677e3c676108f84e64818ba2a272f6d08;p=friendica.git diff --git a/mod/api.php b/mod/api.php index 67564836e8..cd5d5241f8 100644 --- a/mod/api.php +++ b/mod/api.php @@ -1,8 +1,12 @@ get_parameters(); $token = $params['oauth_token']; @@ -12,16 +16,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 +33,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 @@ -84,7 +86,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 +108,9 @@ function api_content(&$a) { '$no' => t('No'), )); - //echo "
"; var_dump($app); killme();
-
 		return $o;
 	}
 
 	echo api_call($a);
 	killme();
 }
-}