mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +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:
@@ -98,7 +98,7 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
||||
}
|
||||
|
||||
global $config;
|
||||
$cache = Cache::getInstance();
|
||||
$cache = app()->get('cache');
|
||||
if($cache->enabled()) {
|
||||
$tmp = null;
|
||||
$need_revalidation = true;
|
||||
@@ -150,7 +150,7 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
||||
{
|
||||
global $config;
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
$cache = app()->get('cache');
|
||||
if($cache->enabled()) {
|
||||
if ($this->clearCacheAfter) {
|
||||
$cache->delete('database_tables');
|
||||
|
@@ -33,7 +33,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
||||
*/
|
||||
public function __construct($file = '')
|
||||
{
|
||||
global $db;
|
||||
$db = app()->get('db');
|
||||
if($db->hasTable('groups')) { // read groups from database
|
||||
foreach($db->query('SELECT `id`, `name`, `access` FROM `groups`;') as $group)
|
||||
{
|
||||
@@ -47,10 +47,8 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isset($file[0]))
|
||||
{
|
||||
global $config;
|
||||
$file = $config['data_path'] . 'XML/groups.xml';
|
||||
if(!isset($file[0])) {
|
||||
$file = config('data_path') . 'XML/groups.xml';
|
||||
}
|
||||
|
||||
if(!@file_exists($file)) {
|
||||
@@ -59,7 +57,7 @@ class OTS_Groups_List implements IteratorAggregate, Countable
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = Cache::getInstance();
|
||||
$cache = app()->get('cache');
|
||||
|
||||
$data = array();
|
||||
if($cache->enabled())
|
||||
|
@@ -655,8 +655,7 @@ class OTS_Player extends OTS_Row_DAO
|
||||
//if($path == '')
|
||||
// $path = $config['data_path'].'XML/groups.xml';
|
||||
|
||||
if( !isset($this->data['group_id']) )
|
||||
{
|
||||
if(!isset($this->data['group_id'])) {
|
||||
throw new E_OTS_NotLoaded();
|
||||
}
|
||||
|
||||
@@ -665,8 +664,9 @@ class OTS_Player extends OTS_Row_DAO
|
||||
|
||||
global $groups;
|
||||
$tmp = $groups->getGroup($this->data['group_id']);
|
||||
if($tmp)
|
||||
if($tmp) {
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
return new OTS_Group();
|
||||
// echo 'error while loading group..';
|
||||
|
Reference in New Issue
Block a user