From 8c9198dcff05415f69ccef25a0448ede26af6b04 Mon Sep 17 00:00:00 2001 From: michu2k Date: Sat, 6 Jun 2020 22:59:12 +0200 Subject: [PATCH] getUserInfo() returns null if userCache doesn't exist, Updated defines.php --- inc/core/Main.php | 12 +++---- inc/core/defines.php | 82 ++++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/inc/core/Main.php b/inc/core/Main.php index 54609c8..aad26a9 100644 --- a/inc/core/Main.php +++ b/inc/core/Main.php @@ -28,7 +28,7 @@ abstract class Main * @var array */ public $lang = []; - + /** * Templates instance * @@ -95,13 +95,13 @@ abstract class Main $this->settings = new Settings($this); date_default_timezone_set($this->settings->get('settings.timezone')); - + $this->tpl = new Templates($this); $this->router = new Router; $this->append(base64_decode('PG1ldGEgbmFtZT0iZ2VuZXJhdG9yIiBjb250ZW50PSJCYXRmbGF0IiAvPg=='), 'header'); } - + /** * New instance of QueryBuilder * @@ -309,7 +309,7 @@ abstract class Main } setcookie('batflat_remember', null, -1, '/'); } - + return false; } @@ -329,7 +329,7 @@ abstract class Main self::$userCache = $this->db('users')->where('id', $id)->oneArray(); } - return self::$userCache[$field]; + return self::$userCache ? self::$userCache[$field] : null; } /** @@ -374,7 +374,7 @@ abstract class Main $core->db('modules')->save(['dir' => $name, 'sequence' => $order]); } - + redirect(url()); } } diff --git a/inc/core/defines.php b/inc/core/defines.php index d14d57b..bfbd287 100644 --- a/inc/core/defines.php +++ b/inc/core/defines.php @@ -1,51 +1,51 @@ - * @author Wojciech Król - * @copyright 2017 Paweł Klockiewicz, Wojciech Król - * @license https://batflat.org/license - * @link https://batflat.org - */ +/** +* This file is part of Batflat ~ the lightweight, fast and easy CMS +* +* @author Paweł Klockiewicz +* @author Wojciech Król +* @copyright 2017 Paweł Klockiewicz, Wojciech Król +* @license https://batflat.org/license +* @link https://batflat.org +*/ - if (!version_compare(PHP_VERSION, '5.5.0', '>=')) { - exit("Batflat requires at least PHP 5.5"); - } +if (!version_compare(PHP_VERSION, '5.5.0', '>=')) { + exit("Batflat requires at least PHP 5.5"); +} - // Admin cat name - define('ADMIN', 'admin'); +// Admin cat name +define('ADMIN', 'admin'); - // Themes path - define('THEMES', BASE_DIR . '/themes'); +// Themes path +define('THEMES', BASE_DIR . '/themes'); - // Modules path - define('MODULES', BASE_DIR . '/inc/modules'); +// Modules path +define('MODULES', BASE_DIR . '/inc/modules'); - // Uploads path - define('UPLOADS', BASE_DIR . '/uploads'); +// Uploads path +define('UPLOADS', BASE_DIR . '/uploads'); - // Lock files - define('FILE_LOCK', false); +// Lock files +define('FILE_LOCK', false); - // Basic modules - define('BASIC_MODULES', serialize([ - 8 => 'settings', - 0 => 'dashboard', - 2 => 'pages', - 3 => 'navigation', - 7 => 'users', - 1 => 'blog', - 4 => 'galleries', - 5 => 'snippets', - 6 => 'modules', - 9 => 'contact', - 10 => 'langswitcher', - 11 => 'devbar', - ])); +// Basic modules +define('BASIC_MODULES', serialize([ + 8 => 'settings', + 0 => 'dashboard', + 2 => 'pages', + 3 => 'navigation', + 7 => 'users', + 1 => 'blog', + 4 => 'galleries', + 5 => 'snippets', + 6 => 'modules', + 9 => 'contact', + 10 => 'langswitcher', + 11 => 'devbar', +])); - // HTML beautifier - define('HTML_BEAUTY', false); +// HTML beautifier +define('HTML_BEAUTY', false); - // Developer mode - define('DEV_MODE', false); \ No newline at end of file +// Developer mode +define('DEV_MODE', false); \ No newline at end of file