Commit 62496869 authored by Matthias Larisch's avatar Matthias Larisch

WIP remove control/ intermediate routing

Directly use the 'Router' lookup also for regular controller routing.
This also hardens the path a little bit as well as refactors
updateActivity and getPage which were both used around the getCurrent()
control router lookup.
parent f5373acb
<?php
global $g_func;
$g_func->loadApp('API');
<?php
global $g_func;
$g_func->loadApp('Application');
<?php
global $g_func;
$g_func->loadApp('Basket');
<?php
global $g_func;
$g_func->loadApp('BusinessCard');
<?php
global $g_func;
$g_func->loadApp('Bell');
<?php
global $g_func;
$g_func->loadApp('Store');
<?php
global $g_func;
$g_func->loadApp('Region');
<?php
global $g_func;
$g_func->loadApp('Blog');
<?php
global $g_func;
$g_func->loadApp('Buddy');
<?php
global $g_func;
$g_func->loadApp('Content');
<?php
global $g_func;
$g_func->loadApp('Dashboard');
<?php
global $g_func;
$g_func->loadApp('Email');
<?php
global $g_func;
$g_func->loadApp('Event');
<?php
global $g_func;
$g_func->loadApp('FairTeiler');
<?php
global $g_func;
$g_func->loadApp('FAQAdmin');
<?php
global $g_func;
$g_func->loadApp('Foodsaver');
<?php
global $g_func;
$g_func->loadApp('StoreUser');
<?php
global $g_func;
$g_func->loadApp('GeoClean');
<?php
global $g_func;
$g_func->loadApp('WorkGroup');
<?php
global $g_func;
$g_func->loadApp('Index');
<?php
global $g_func;
$g_func->loadApp('Info');
<?php
global $g_func;
$g_func->loadApp('FAQList');
<?php
global $g_func;
$g_func->loadApp('Login');
<?php
global $g_func;
$g_func->loadApp('Logout');
<?php
global $g_func;
$g_func->loadApp('Mailbox');
<?php
global $g_func;
$g_func->loadApp('Main');
<?php
global $g_func;
$g_func->loadApp('Map');
<?php
global $g_func;
$g_func->go('/?page=msg');
<?php
global $g_func;
$g_func->loadApp('EmailTemplateAdmin');
<?php
global $g_func;
$g_func->loadApp('Message');
<?php
global $g_func;
$g_func->loadApp('NewArea');
<?php
global $g_func;
$g_func->loadApp('PassportGenerator');
<?php
global $g_func;
$g_func->loadApp('Profile');
<?php
global $g_func;
$g_func->loadApp('Quiz');
<?php
global $g_func;
$g_func->loadApp('RegionAdmin');
<?php
global $g_func;
$g_func->loadApp('Relogin');
<?php
global $g_func;
$g_func->loadApp('Report');
<?php
global $g_func;
$g_func->loadApp('Search');
<?php
global $g_func;
$g_func->loadApp('Settings');
<?php
global $g_func;
$g_func->loadApp('Statistics');
<?php
global $g_func;
$g_func->loadApp('Team');
......@@ -24,6 +24,7 @@ if(isset($_GET['g_path']))
use Foodsharing\Debug\DebugBar;
use Foodsharing\DI;
use Foodsharing\Lib\Func;
use Foodsharing\Lib\Routing;
use Foodsharing\Lib\Session\S;
use Foodsharing\Lib\View\Utils;
......@@ -36,6 +37,24 @@ $func = DI::$shared->get(Func::class);
$func->addCss('/css/gen/style.css?v=' . VERSION);
$func->addScript('/js/gen/script.js?v=' . VERSION);
$app = $func->getPage();
$class = Routing::getClassName($app, 'Control');
if ($class) {
$obj = DI::$shared->get(ltrim($class, '\\'));
if (isset($_GET['a']) && is_callable(array($obj, $_GET['a']))) {
$meth = $_GET['a'];
$obj->$meth();
} else {
$obj->index();
}
$sub = $sub = $obj->getSubFunc();
if ($sub !== false && is_callable(array($obj, $sub))) {
$obj->$sub();
}
}
$func->getCurrent();
$menu = $func->getMenu();
......
......@@ -649,12 +649,11 @@ abstract class Db
return false;
}
public function updateActivity($fs_id = false)
public function updateActivity($fs_id = null)
{
if ($fs_id === false) {
$fs_id = $this->func->fsId();
if ($fs_id) {
Mem::userSet($fs_id, 'active', time());
}
Mem::userSet($fs_id, 'active', time());
}
private function initSessionData($fs_id)
......
......@@ -1320,7 +1320,12 @@ Verantwortlich für den Inhalt nach § 55 Abs. 2 RStV:<br />
public function getPage()
{
return $this->getGet('page');
$page = $this->getGet('page');
if (!$page) {
$page = 'index';
}
return $page;
}
public function getGetId($name)
......
......@@ -14,27 +14,36 @@ class Routing
'bcard' => 'BusinessCard',
'content' => 'Content',
'dashboard' => 'Dashboard',
'email' => 'Email',
'event' => 'Event',
'faq' => 'FAQAdmin',
'fairteiler' => 'FairTeiler',
'foodsaver' => 'Foodsaver',
'geoclean' => 'GeoClean',
'index' => 'Index',
'info' => 'Info',
'listFaq' => 'FAQList',
'login' => 'Login',
'logout' => 'Logout',
'mailbox' => 'Mailbox',
'main' => 'Main',
'map' => 'Map',
'msg' => 'Message',
'message' => 'Message',
'message_tpl' => 'EmailTemplateAdmin',
'newarea' => 'NewArea',
'passport' => 'PassportGenerator',
'passgen' => 'PassportGenerator',
'profile' => 'Profile',
'quiz' => 'Quiz',
'bezirk' => 'Region',
'region' => 'RegionAdmin',
'relogin' => 'Relogin',
'report' => 'Report',
'search' => 'Search',
'settings' => 'Settings',
'statistics' => 'Statistics',
'betrieb' => 'Store',
'fsbetrieb' => 'StoreUser',
'team' => 'Team',
'wallpost' => 'WallPost',
'groups' => 'WorkGroup');
......
......@@ -74,6 +74,7 @@ abstract class Control
$this->func->addStyle(file_get_contents($dir . $moduleName . '.css'));
}
}
$this->model->updateActivity(S::id());
}
public function setTemplate($template)
......
......@@ -36,8 +36,6 @@ class LoginXhr extends Control
} else {
Mem::userSet($this->func->fsId(), 'infomail', false);
}
$this->model->updateActivity();
}
/**
......
......@@ -22,7 +22,7 @@ $action = $_GET['f'];
$db = new Model();
$db->updateActivity();
$db->updateActivity(S::id());
if (isset($_GET['f'])) {
$xhr = DI::$shared->get(XhrMethods::class);
$func = 'xhr_' . $action;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment