1
0
Fork 0

Move mod/toggle_mobile to src/Module/ToggleMobile

This commit is contained in:
Philipp Holzer 2019-05-18 21:13:19 +02:00
parent d252598821
commit 295d90d496
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
3 changed files with 31 additions and 20 deletions

View file

@ -1,20 +0,0 @@
<?php
use Friendica\App;
function toggle_mobile_init(App $a) {
if (isset($_GET['off'])) {
$_SESSION['show-mobile'] = false;
} else {
$_SESSION['show-mobile'] = true;
}
if (isset($_GET['address'])) {
$address = $_GET['address'];
} else {
$address = '';
}
$a->redirect($address);
}

View file

@ -201,6 +201,7 @@ class Router
$this->routeCollector->addRoute(['GET'], '/rsd.xml', Module\ReallySimpleDiscovery::class);
$this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class);
$this->routeCollector->addRoute(['GET'], '/statistics.json', Module\Statistics::class);
$this->routeCollector->addRoute(['GET'], '/toggle_mobile', Module\ToggleMobile::class);
$this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class);
$this->routeCollector->addRoute(['GET'], '/viewsrc/{item:\d+}', Module\ItemBody::class);
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);

View file

@ -0,0 +1,30 @@
<?php
namespace Friendica\Module;
use Friendica\BaseModule;
/**
* Toggles the mobile view (on/off)
*/
class ToggleMobile extends BaseModule
{
public static function content()
{
$a = self::getApp();
if (isset($_GET['off'])) {
$_SESSION['show-mobile'] = false;
} else {
$_SESSION['show-mobile'] = true;
}
if (isset($_GET['address'])) {
$address = $_GET['address'];
} else {
$address = '';
}
$a->redirect($address);
}
}