refactor global array

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-21 20:31:17 +01:00
parent 5fa0f4b87e
commit c5a58e3f36
68 changed files with 646 additions and 613 deletions

View File

@@ -350,7 +350,7 @@ class Database
*/
private static function _showerror($error, $showerror = true, $json_response = false, \PDOStatement $stmt = null)
{
global $userinfo, $theme, $linker;
global $theme;
// include userdata.inc.php
require \Froxlor\Froxlor::getInstallDir() . "/lib/userdata.inc.php";
@@ -445,7 +445,7 @@ class Database
$err_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $err_hint);
$err_report_html = '';
if (is_array($userinfo) && (($userinfo['adminsession'] == '1' && \Froxlor\Settings::Get('system.allow_error_report_admin') == '1') || ($userinfo['adminsession'] == '0' && \Froxlor\Settings::Get('system.allow_error_report_customer') == '1'))) {
if (is_array(\Froxlor\User::getAll()) && ((\Froxlor\User::getAll()['adminsession'] == '1' && \Froxlor\Settings::Get('system.allow_error_report_admin') == '1') || (\Froxlor\User::getAll()['adminsession'] == '0' && \Froxlor\Settings::Get('system.allow_error_report_customer') == '1'))) {
$err_report_html = '<a href="<LINK>" title="Click here to report error">Report error</a>';
$err_report_html = str_replace("<LINK>", $linker->getLink(array(
'section' => 'index',

View File

@@ -35,13 +35,12 @@ class IntegrityCheck
*/
public function __construct()
{
global $userinfo;
if (! isset($userinfo) || ! is_array($userinfo)) {
$userinfo = array(
if (! isset(\Froxlor\User::getAll()) || ! is_array(\Froxlor\User::getAll())) {
\Froxlor\User::getAll() = array(
'loginname' => 'integrity-check'
);
}
$this->_log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo);
$this->_log = \Froxlor\FroxlorLogger::getInstanceOf(\Froxlor\User::getAll());
$this->available = get_class_methods($this);
unset($this->available[array_search('__construct', $this->available)]);
unset($this->available[array_search('checkAll', $this->available)]);