]> git.mxchange.org Git - friendica.git/blobdiff - mod/api.php
Indentation fix
[friendica.git] / mod / api.php
index da2c40c3055a54b566cfd92bdcaf6a40680b65a0..cda97c729ce9bb5bfc80c622ede8530de4387938 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 
+use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Database\DBM;
+
 require_once('include/api.php');
 
 function oauth_get_client($request){
@@ -14,15 +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];
 }
 
-function api_post(&$a) {
+function api_post(App $a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
@@ -34,7 +38,7 @@ function api_post(&$a) {
 
 }
 
-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,8 +110,6 @@ function api_content(&$a) {
                        '$no'   => t('No'),
                ));
 
-               //echo "<pre>"; var_dump($app); killme();
-
                return $o;
        }