mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-15 02:04:54 +02:00
feat: Rewrite of the core: avoid globals where possible
Create services for: login, status, router, database, AnonymousStatistics Drop gesior.backward_support Drop compat/pages.php Drop part of compat/classes.php Move signature to routes
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
use MyAAC\App\App;
|
||||
use MyAAC\Cache\Cache;
|
||||
use MyAAC\CsrfToken;
|
||||
use MyAAC\Items;
|
||||
@@ -599,10 +600,8 @@ function template_form()
|
||||
return $twig->render('forms.change_template.html.twig', ['options' => $options]);
|
||||
}
|
||||
|
||||
function getStyle($i)
|
||||
{
|
||||
global $config;
|
||||
return is_int($i / 2) ? $config['darkborder'] : $config['lightborder'];
|
||||
function getStyle($i) {
|
||||
return is_int($i / 2) ? config('darkborder') : config('lightborder');
|
||||
}
|
||||
|
||||
$vowels = array('e', 'y', 'u', 'i', 'o', 'a');
|
||||
@@ -1210,7 +1209,7 @@ function clearCache()
|
||||
{
|
||||
News::clearCache();
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
$cache = app()->get('cache');
|
||||
if($cache->enabled()) {
|
||||
$keysToClear = [
|
||||
'status', 'templates',
|
||||
@@ -1260,7 +1259,7 @@ function clearCache()
|
||||
// routes cache
|
||||
clearRouteCache();
|
||||
|
||||
global $hooks;
|
||||
$hooks = app()->get('hooks');
|
||||
$hooks->trigger(HOOK_CACHE_CLEAR, ['cache' => Cache::getInstance()]);
|
||||
|
||||
return true;
|
||||
@@ -1314,9 +1313,6 @@ function getCustomPage($name, &$success): string
|
||||
$tmp = $page['body'];
|
||||
|
||||
global $config;
|
||||
if(setting('core.backward_support')) {
|
||||
global $SQL, $main_content, $subtopic;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
eval($tmp);
|
||||
@@ -1685,6 +1681,15 @@ function getAccountIdentityColumn(): string
|
||||
return 'id';
|
||||
}
|
||||
|
||||
function app() {
|
||||
static $_app;
|
||||
if (!isset($_app)) {
|
||||
$_app = new App();
|
||||
}
|
||||
|
||||
return $_app;
|
||||
}
|
||||
|
||||
// validator functions
|
||||
require_once SYSTEM . 'compat/base.php';
|
||||
|
||||
|
Reference in New Issue
Block a user