From: Philipp Holzer Date: Sun, 5 May 2019 15:59:57 +0000 (+0200) Subject: Rename BookMarklet to Bookmarklet X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=440d0a3a63ffc24f608504e8df8d2038fd95ca5b;p=friendica.git Rename BookMarklet to Bookmarklet --- diff --git a/src/App/Router.php b/src/App/Router.php index 1dffb6b406..11ce686770 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -89,7 +89,7 @@ class Router $this->routeCollector->addRoute(['GET'], '/apps', Module\Apps::class); $this->routeCollector->addRoute(['GET'], '/attach/{item:\d+}', Module\Attach::class); $this->routeCollector->addRoute(['GET'], '/babel', Module\Babel::class); - $this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\BookMarklet::class); + $this->routeCollector->addRoute(['GET'], '/bookmarklet', Module\Bookmarklet::class); $this->routeCollector->addGroup('/contact', function (RouteCollector $collector) { $collector->addRoute(['GET'], '[/]', Module\Contact::class); $collector->addRoute(['GET'], '/{id:\d+}[/posts|conversations]', Module\Contact::class); diff --git a/src/Module/BookMarklet.php b/src/Module/BookMarklet.php deleted file mode 100644 index 51feb25d7b..0000000000 --- a/src/Module/BookMarklet.php +++ /dev/null @@ -1,63 +0,0 @@ -getConfig(); - - if (!local_user()) { - $output = '

' . L10n::t('Login') . '

'; - $output .= Login::form($app->query_string, intval($config->get('config', 'register_policy')) === Register::CLOSED ? false : true); - return $output; - } - - $referer = Strings::normaliseLink(defaults($_SERVER, 'HTTP_REFERER', '')); - $page = Strings::normaliseLink($app->getBaseURL() . "/bookmarklet"); - - if (!strstr($referer, $page)) { - if (empty($_REQUEST["url"])) { - throw new HTTPException\BadRequestException(L10n::t('This page is missing a url parameter.')); - } - - $content = add_page_info($_REQUEST["url"]); - - $x = [ - 'is_owner' => true, - 'allow_location' => $app->user['allow_location'], - 'default_location' => $app->user['default-location'], - 'nickname' => $app->user['nickname'], - 'lockstate' => ((is_array($app->user) && ((strlen($app->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($app->user['deny_cid'])) || (strlen($app->user['deny_gid'])))) ? 'lock' : 'unlock'), - 'default_perms' => ACL::getDefaultUserPermissions($app->user), - 'acl' => ACL::getFullSelectorHTML($app->user, true), - 'bang' => '', - 'visitor' => 'block', - 'profile_uid' => local_user(), - 'title' => trim(defaults($_REQUEST, 'title', ''), '*'), - 'content' => $content - ]; - $output = status_editor($app, $x, 0, false); - $output .= ""; - } else { - $output = '

' . L10n::t('The post was created') . '

'; - $output .= ""; - } - - return $output; - } -} diff --git a/src/Module/Bookmarklet.php b/src/Module/Bookmarklet.php new file mode 100644 index 0000000000..1b6ff38459 --- /dev/null +++ b/src/Module/Bookmarklet.php @@ -0,0 +1,63 @@ +getConfig(); + + if (!local_user()) { + $output = '

' . L10n::t('Login') . '

'; + $output .= Login::form($app->query_string, intval($config->get('config', 'register_policy')) === Register::CLOSED ? false : true); + return $output; + } + + $referer = Strings::normaliseLink(defaults($_SERVER, 'HTTP_REFERER', '')); + $page = Strings::normaliseLink($app->getBaseURL() . "/bookmarklet"); + + if (!strstr($referer, $page)) { + if (empty($_REQUEST["url"])) { + throw new HTTPException\BadRequestException(L10n::t('This page is missing a url parameter.')); + } + + $content = add_page_info($_REQUEST["url"]); + + $x = [ + 'is_owner' => true, + 'allow_location' => $app->user['allow_location'], + 'default_location' => $app->user['default-location'], + 'nickname' => $app->user['nickname'], + 'lockstate' => ((is_array($app->user) && ((strlen($app->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($app->user['deny_cid'])) || (strlen($app->user['deny_gid'])))) ? 'lock' : 'unlock'), + 'default_perms' => ACL::getDefaultUserPermissions($app->user), + 'acl' => ACL::getFullSelectorHTML($app->user, true), + 'bang' => '', + 'visitor' => 'block', + 'profile_uid' => local_user(), + 'title' => trim(defaults($_REQUEST, 'title', ''), '*'), + 'content' => $content + ]; + $output = status_editor($app, $x, 0, false); + $output .= ""; + } else { + $output = '

' . L10n::t('The post was created') . '

'; + $output .= ""; + } + + return $output; + } +}