]> git.mxchange.org Git - friendica.git/blobdiff - mod/api.php
Storing the protocol while following a contact
[friendica.git] / mod / api.php
index e81633531b748888c152749317caba85f4c27410..4a1db1be5511c7a0f7f6d19daeae38065cc14d6d 100644 (file)
@@ -6,16 +6,13 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
-use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Module\Login;
 
 require_once 'include/api.php';
 
-function oauth_get_client($request)
+function oauth_get_client(OAuthRequest $request)
 {
-
-
        $params = $request->get_parameters();
        $token = $params['oauth_token'];
 
@@ -38,7 +35,7 @@ function api_post(App $a)
                return;
        }
 
-       if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
+       if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
                notice(L10n::t('Permission denied.') . EOL);
                return;
        }
@@ -59,10 +56,10 @@ function api_content(App $a)
                } catch (Exception $e) {
                        echo "<pre>";
                        var_dump($e);
-                       killme();
+                       exit();
                }
 
-               if (x($_POST, 'oauth_yes')) {
+               if (!empty($_POST['oauth_yes'])) {
                        $app = oauth_get_client($request);
                        if (is_null($app)) {
                                return "Invalid request. Unknown token.";
@@ -79,10 +76,10 @@ function api_content(App $a)
                                        $glue = "?";
                                }
                                $a->internalRedirect($consumer->callback_url . $glue . 'oauth_token=' . OAuthUtil::urlencode_rfc3986($params['oauth_token']) . '&oauth_verifier=' . OAuthUtil::urlencode_rfc3986($verifier));
-                               killme();
+                               exit();
                        }
 
-                       $tpl = get_markup_template("oauth_authorize_done.tpl");
+                       $tpl = Renderer::getMarkupTemplate("oauth_authorize_done.tpl");
                        $o = Renderer::replaceMacros($tpl, [
                                '$title' => L10n::t('Authorize application connection'),
                                '$info' => L10n::t('Return to your app and insert this Securty Code:'),
@@ -104,7 +101,7 @@ function api_content(App $a)
                        return "Invalid request. Unknown token.";
                }
 
-               $tpl = get_markup_template('oauth_authorize.tpl');
+               $tpl = Renderer::getMarkupTemplate('oauth_authorize.tpl');
                $o = Renderer::replaceMacros($tpl, [
                        '$title' => L10n::t('Authorize application connection'),
                        '$app' => $app,
@@ -117,5 +114,5 @@ function api_content(App $a)
        }
 
        echo api_call($a);
-       killme();
+       exit();
 }