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

@@ -145,8 +145,6 @@ abstract class BulkAction
protected function importEntity($data_array = null)
{
global $userinfo;
$module = '\\Froxlor\\Api\\Commands\\' . substr($this->api_call, 0, strpos($this->api_call, "."));
$function = substr($this->api_call, strpos($this->api_call, ".") + 1);
@@ -159,7 +157,7 @@ abstract class BulkAction
$result = null;
try {
$json_result = $module::getLocal($userinfo, $new_data)->$function();
$json_result = $module::getLocal(\Froxlor\User::getAll(), $new_data)->$function();
$result = json_decode($json_result, true)['data'];
} catch (\Exception $e) {
$this->errors[] = $e->getMessage();

View File

@@ -51,17 +51,14 @@ class DomainBulkAction extends BulkAction
{
$this->preImport();
// get the admins userinfo to check for domains_used, etc.
global $userinfo;
if ($userinfo['domains'] == "-1") {
if (\Froxlor\User::getAll()['domains'] == "-1") {
$dom_unlimited = true;
} else {
$dom_unlimited = false;
}
$domains_used = (int) $userinfo['domains_used'];
$domains_avail = (int) $userinfo['domains'];
$domains_used = (int) \Froxlor\User::getAll()['domains_used'];
$domains_avail = (int) \Froxlor\User::getAll()['domains'];
if (empty($separator) || strlen($separator) != 1) {
throw new \Exception("Invalid separator specified: '" . $separator . "'");