]> git.mxchange.org Git - friendica.git/blobdiff - mod/api.php
mobile view: show events and admin, but hide pm link
[friendica.git] / mod / api.php
index 716b484461aeff250e902a856a040da6e1ddbec7..4a1db1be5511c7a0f7f6d19daeae38065cc14d6d 100644 (file)
@@ -5,16 +5,14 @@
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
-use Friendica\Core\System;
+use Friendica\Core\Renderer;
 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'];
 
@@ -37,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;
        }
@@ -58,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.";
@@ -78,11 +76,11 @@ 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");
-                       $o = replace_macros($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:'),
                                '$code' => $verifier,
@@ -103,8 +101,8 @@ function api_content(App $a)
                        return "Invalid request. Unknown token.";
                }
 
-               $tpl = get_markup_template('oauth_authorize.tpl');
-               $o = replace_macros($tpl, [
+               $tpl = Renderer::getMarkupTemplate('oauth_authorize.tpl');
+               $o = Renderer::replaceMacros($tpl, [
                        '$title' => L10n::t('Authorize application connection'),
                        '$app' => $app,
                        '$authorize' => L10n::t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'),
@@ -116,5 +114,5 @@ function api_content(App $a)
        }
 
        echo api_call($a);
-       killme();
+       exit();
 }