1
0
Fork 0

Merge pull request #7161 from nupplaphil/task/mod_toggle_mobile

Move mod/toggle_mobile to src/Module/ToggleMobile
This commit is contained in:
Hypolite Petovan 2019-05-18 20:14:27 -04:00 committed by GitHub
commit 33ec3d8051
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

@ -207,6 +207,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);
}
}