refactor global array
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -124,11 +124,11 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
$userinfo = $customer;
|
||||
\Froxlor\User::getAll() = $customer;
|
||||
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($userinfo),
|
||||
'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($userinfo), // < keep this for compatibility
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()),
|
||||
'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()), // < keep this for compatibility
|
||||
'DB_NAME' => $username,
|
||||
'DB_PASS' => $password,
|
||||
'DB_DESC' => $databasedescription,
|
||||
@@ -137,9 +137,9 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
);
|
||||
|
||||
// get template for mail subject
|
||||
$mail_subject = $this->getMailTemplate($userinfo, 'mails', 'new_database_by_customer_subject', $replace_arr, $this->lng['mails']['new_database_by_customer']['subject']);
|
||||
$mail_subject = $this->getMailTemplate(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_subject', $replace_arr, $this->lng['mails']['new_database_by_customer']['subject']);
|
||||
// get template for mail body
|
||||
$mail_body = $this->getMailTemplate($userinfo, 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']);
|
||||
$mail_body = $this->getMailTemplate(\Froxlor\User::getAll(), 'mails', 'new_database_by_customer_mailbody', $replace_arr, $this->lng['mails']['new_database_by_customer']['mailbody']);
|
||||
|
||||
$_mailerror = false;
|
||||
$mailerr_msg = "";
|
||||
@@ -147,7 +147,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$this->mailer()->addAddress($userinfo['email'], \Froxlor\User::getCorrectUserSalutation($userinfo));
|
||||
$this->mailer()->addAddress(\Froxlor\User::getAll()['email'], \Froxlor\User::getCorrectUserSalutation(\Froxlor\User::getAll()));
|
||||
$this->mailer()->send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
@@ -159,7 +159,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
|
||||
if ($_mailerror) {
|
||||
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
|
||||
\Froxlor\UI\Response::standard_error('errorsendingmail', $userinfo['email'], true);
|
||||
\Froxlor\UI\Response::standard_error('errorsendingmail', \Froxlor\User::getAll()['email'], true);
|
||||
}
|
||||
|
||||
$this->mailer()->clearAddresses();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 . "'");
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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)]);
|
||||
|
||||
@@ -29,16 +29,14 @@ class IpAddr
|
||||
|
||||
public static function getIpPortCombinations($ssl = false)
|
||||
{
|
||||
global $userinfo;
|
||||
|
||||
$additional_conditions_params = array();
|
||||
$additional_conditions_array = array();
|
||||
|
||||
if ($userinfo['ip'] != '-1') {
|
||||
if (\Froxlor\User::getAll()['ip'] != '-1') {
|
||||
$admin_ip_stmt = Database::prepare("
|
||||
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = IN (:ipid)
|
||||
");
|
||||
$myips = implode(",", json_decode($userinfo['ip'], true));
|
||||
$myips = implode(",", json_decode(\Froxlor\User::getAll()['ip'], true));
|
||||
Database::pexecute($admin_ip_stmt, array(
|
||||
'ipid' => $myips
|
||||
));
|
||||
|
||||
27
lib/Froxlor/I18N/Lang.php
Normal file
27
lib/Froxlor/I18N/Lang.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace Froxlor\I18N;
|
||||
|
||||
class Lang
|
||||
{
|
||||
|
||||
private static $lng = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $lng
|
||||
*/
|
||||
public static function setLanguageArray($lng = array())
|
||||
{
|
||||
self::$lng = $lng;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAll()
|
||||
{
|
||||
return self::$lng;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,10 +7,10 @@ class HTML
|
||||
/**
|
||||
* Build Navigation Sidebar
|
||||
*
|
||||
* @param
|
||||
* array navigation data
|
||||
* @param
|
||||
* array userinfo the userinfo of the user
|
||||
* @param array $navigation
|
||||
* data
|
||||
* @param array $userinfo
|
||||
* the userinfo of the user
|
||||
* @return string the content of the navigation bar
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
@@ -254,7 +254,7 @@ class HTML
|
||||
*/
|
||||
public static function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
global $s, $header, $footer;
|
||||
|
||||
$hiddenparams = '';
|
||||
|
||||
@@ -277,7 +277,7 @@ class HTML
|
||||
|
||||
public static function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
global $s, $header, $footer, $theme;
|
||||
|
||||
$hiddenparams = '';
|
||||
|
||||
|
||||
@@ -26,13 +26,6 @@ namespace Froxlor\UI;
|
||||
class Paging
|
||||
{
|
||||
|
||||
/**
|
||||
* Userinfo
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* MySQL-Table
|
||||
*
|
||||
@@ -109,16 +102,15 @@ class Paging
|
||||
* Class constructor.
|
||||
* Loads settings from request or from userdata and saves them to session.
|
||||
*
|
||||
* @param
|
||||
* array userinfo
|
||||
* @param
|
||||
* string Name of Table
|
||||
* @param
|
||||
* array Fields, in format array( 'fieldname_in_mysql' => 'field_caption' )
|
||||
* @param
|
||||
* int *deprecated* entries per page
|
||||
* @param
|
||||
* bool *deprecated* Switch natsorting on/off (global, affects all calls of sort)
|
||||
* @param array $userinfo
|
||||
* @param string $table
|
||||
* Name of Table
|
||||
* @param array $fields
|
||||
* Fields, in format array( 'fieldname_in_mysql' => 'field_caption' )
|
||||
* @param int $entriesperpage
|
||||
* *deprecated* entries per page
|
||||
* @param bool $natSorting
|
||||
* *deprecated* Switch natsorting on/off (global, affects all calls of sort)
|
||||
* @param int $default_field
|
||||
* default sorting-field-index
|
||||
* @param string $default_order
|
||||
|
||||
@@ -81,7 +81,7 @@ class Response
|
||||
*/
|
||||
public static function standard_error($errors = '', $replacer = '', $throw_exception = false)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
global $s, $header, $footer, $theme;
|
||||
|
||||
$_SESSION['requestData'] = $_POST;
|
||||
$replacer = htmlentities($replacer);
|
||||
@@ -125,7 +125,7 @@ class Response
|
||||
|
||||
public static function dynamic_error($message)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
global $s, $header, $footer, $theme;
|
||||
$_SESSION['requestData'] = $_POST;
|
||||
$link = '';
|
||||
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
|
||||
@@ -150,7 +150,7 @@ class Response
|
||||
*/
|
||||
public static function standard_success($success_message = '', $replacer = '', $params = array(), $throw_exception = false)
|
||||
{
|
||||
global $s, $header, $footer, $lng, $theme;
|
||||
global $s, $header, $footer, $theme;
|
||||
|
||||
if (isset($lng['success'][$success_message])) {
|
||||
$success_message = strtr($lng['success'][$success_message], array(
|
||||
|
||||
@@ -6,6 +6,26 @@ use Froxlor\Database\Database;
|
||||
class User
|
||||
{
|
||||
|
||||
private static $userinfo = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $userinfo
|
||||
*/
|
||||
public static function setUserinfoArray($userinfo = array())
|
||||
{
|
||||
self::$userinfo = $userinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAll()
|
||||
{
|
||||
return self::$userinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full style user details "Name, Firstname | Company"
|
||||
*
|
||||
|
||||
@@ -40,26 +40,26 @@ return array(
|
||||
'value' => array(
|
||||
$result['deactivated']
|
||||
),
|
||||
'visible' => ($result['adminid'] == $userinfo['userid'] ? false : true)
|
||||
'visible' => ($result['adminid'] == \Froxlor\User::getAll()['userid'] ? false : true)
|
||||
),
|
||||
'admin_password' => array(
|
||||
'label' => $lng['login']['password'] . ' (' . $lng['panel']['emptyfornochanges'] . ')',
|
||||
'type' => 'password',
|
||||
'autocomplete' => 'off',
|
||||
'visible' => ($result['adminid'] == $userinfo['userid'] ? false : true)
|
||||
'visible' => ($result['adminid'] == \Froxlor\User::getAll()['userid'] ? false : true)
|
||||
),
|
||||
'admin_password_suggestion' => array(
|
||||
'label' => $lng['customer']['generated_pwd'],
|
||||
'type' => 'text',
|
||||
'visible' => (\Froxlor\Settings::Get('panel.password_regex') == ''),
|
||||
'value' => \Froxlor\System\Crypt::generatePassword(),
|
||||
'visible' => ($result['adminid'] == $userinfo['userid'] ? false : true)
|
||||
'visible' => ($result['adminid'] == \Froxlor\User::getAll()['userid'] ? false : true)
|
||||
),
|
||||
'def_language' => array(
|
||||
'label' => $lng['login']['language'],
|
||||
'type' => 'select',
|
||||
'select_var' => $language_options,
|
||||
'visible' => ($result['adminid'] == $userinfo['userid'] ? false : true)
|
||||
'visible' => ($result['adminid'] == \Froxlor\User::getAll()['userid'] ? false : true)
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -106,7 +106,7 @@ return array(
|
||||
'section_c' => array(
|
||||
'title' => $lng['admin']['servicedata'],
|
||||
'image' => 'icons/user_add.png',
|
||||
'visible' => ($result['adminid'] != $userinfo['userid'] ? true : false),
|
||||
'visible' => ($result['adminid'] != \Froxlor\User::getAll()['userid'] ? true : false),
|
||||
'fields' => array(
|
||||
'ipaddress' => array(
|
||||
'label' => $lng['serversettings']['ipaddress']['title'],
|
||||
|
||||
@@ -35,7 +35,7 @@ return array(
|
||||
'mandatory' => true
|
||||
),
|
||||
'adminid' => array(
|
||||
'visible' => ($userinfo['customers_see_all'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['customers_see_all'] == '1' ? true : false),
|
||||
'label' => $lng['admin']['admin'],
|
||||
'type' => 'select',
|
||||
'select_var' => $admins,
|
||||
@@ -91,7 +91,7 @@ return array(
|
||||
'image' => 'icons/domain_add.png',
|
||||
'fields' => array(
|
||||
'documentroot' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'label' => 'DocumentRoot',
|
||||
'desc' => $lng['panel']['emptyfordefault'],
|
||||
'type' => 'text'
|
||||
@@ -124,7 +124,7 @@ return array(
|
||||
'value' => array()
|
||||
),
|
||||
'specialsettings' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'style' => 'align-top',
|
||||
'label' => $lng['admin']['ownvhostsettings'],
|
||||
'desc' => $lng['serversettings']['default_vhostconf']['description'],
|
||||
@@ -133,7 +133,7 @@ return array(
|
||||
'rows' => 12
|
||||
),
|
||||
'notryfiles' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
|
||||
'visible' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' && \Froxlor\User::getAll()['change_serversettings'] == '1'),
|
||||
'label' => $lng['admin']['notryfiles']['title'],
|
||||
'desc' => $lng['admin']['notryfiles']['description'],
|
||||
'type' => 'checkbox',
|
||||
@@ -286,7 +286,7 @@ return array(
|
||||
'section_c' => array(
|
||||
'title' => $lng['admin']['phpserversettings'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false),
|
||||
'visible' => ((\Froxlor\User::getAll()['change_serversettings'] == '1' || \Froxlor\User::getAll()['caneditphpsettings'] == '1') ? true : false),
|
||||
'fields' => array(
|
||||
'openbasedir' => array(
|
||||
'label' => 'OpenBasedir',
|
||||
@@ -335,7 +335,7 @@ return array(
|
||||
'section_d' => array(
|
||||
'title' => $lng['admin']['nameserversettings'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
'visible' => (\Froxlor\Settings::Get('system.bind_enable') == '1' && $userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\Settings::Get('system.bind_enable') == '1' && \Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'fields' => array(
|
||||
'isbinddomain' => array(
|
||||
'label' => 'Nameserver',
|
||||
|
||||
@@ -37,7 +37,7 @@ return array(
|
||||
'mandatory' => true
|
||||
),
|
||||
'adminid' => array(
|
||||
'visible' => ($userinfo['customers_see_all'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['customers_see_all'] == '1' ? true : false),
|
||||
'label' => $lng['admin']['admin'],
|
||||
'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_admin') == '1' ? 'select' : 'label'),
|
||||
'select_var' => (isset($admins) ? $admins : null),
|
||||
@@ -102,7 +102,7 @@ return array(
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'fields' => array(
|
||||
'documentroot' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'label' => 'DocumentRoot',
|
||||
'desc' => $lng['panel']['emptyfordefault'],
|
||||
'type' => 'text',
|
||||
@@ -138,7 +138,7 @@ return array(
|
||||
)
|
||||
),
|
||||
'specialsettings' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'style' => 'align-top',
|
||||
'label' => $lng['admin']['ownvhostsettings'],
|
||||
'desc' => $lng['serversettings']['default_vhostconf']['description'],
|
||||
@@ -148,7 +148,7 @@ return array(
|
||||
'rows' => 12
|
||||
),
|
||||
'specialsettingsforsubdomains' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'label' => $lng['admin']['specialsettingsforsubdomains'],
|
||||
'desc' => $lng['serversettings']['specialsettingsforsubdomains']['description'],
|
||||
'type' => 'checkbox',
|
||||
@@ -163,7 +163,7 @@ return array(
|
||||
)
|
||||
),
|
||||
'notryfiles' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
|
||||
'visible' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' && \Froxlor\User::getAll()['change_serversettings'] == '1'),
|
||||
'label' => $lng['admin']['notryfiles']['title'],
|
||||
'desc' => $lng['admin']['notryfiles']['description'],
|
||||
'type' => 'checkbox',
|
||||
@@ -330,7 +330,7 @@ return array(
|
||||
'section_c' => array(
|
||||
'title' => $lng['admin']['phpserversettings'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'visible' => (($userinfo['change_serversettings'] == '1' || $userinfo['caneditphpsettings'] == '1') ? true : false),
|
||||
'visible' => ((\Froxlor\User::getAll()['change_serversettings'] == '1' || \Froxlor\User::getAll()['caneditphpsettings'] == '1') ? true : false),
|
||||
'fields' => array(
|
||||
'openbasedir' => array(
|
||||
'label' => 'OpenBasedir',
|
||||
@@ -365,7 +365,7 @@ return array(
|
||||
'select_var' => $phpconfigs
|
||||
),
|
||||
'phpsettingsforsubdomains' => array(
|
||||
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'label' => $lng['admin']['phpsettingsforsubdomains'],
|
||||
'desc' => $lng['serversettings']['phpsettingsforsubdomains']['description'],
|
||||
'type' => 'checkbox',
|
||||
@@ -396,7 +396,7 @@ return array(
|
||||
'section_d' => array(
|
||||
'title' => $lng['admin']['nameserversettings'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'visible' => (\Froxlor\Settings::Get('system.bind_enable') == '1' && $userinfo['change_serversettings'] == '1' ? true : false),
|
||||
'visible' => (\Froxlor\Settings::Get('system.bind_enable') == '1' && \Froxlor\User::getAll()['change_serversettings'] == '1' ? true : false),
|
||||
'fields' => array(
|
||||
'isbinddomain' => array(
|
||||
'label' => 'Nameserver',
|
||||
|
||||
@@ -60,7 +60,7 @@ return array(
|
||||
'select_var' => $redirectcode
|
||||
),
|
||||
'selectserveralias' => array(
|
||||
'visible' => ((($result['parentdomainid'] == '0' && $userinfo['subdomains'] != '0') || $result['parentdomainid'] != '0') ? true : false),
|
||||
'visible' => ((($result['parentdomainid'] == '0' && \Froxlor\User::getAll()['subdomains'] != '0') || $result['parentdomainid'] != '0') ? true : false),
|
||||
'label' => $lng['admin']['selectserveralias'],
|
||||
'desc' => $lng['admin']['selectserveralias_desc'],
|
||||
'type' => 'select',
|
||||
|
||||
34
lib/init.php
34
lib/init.php
@@ -210,8 +210,10 @@ if (isset($s) && $s != "" && $nosession != 1) {
|
||||
);
|
||||
$userinfo_stmt = Database::prepare($query);
|
||||
$userinfo = Database::pexecute_first($userinfo_stmt, $userinfo_data);
|
||||
\Froxlor\User::setUserinfoArray($userinfo);
|
||||
unset($userinfo);
|
||||
|
||||
if ((($userinfo['adminsession'] == '1' && AREA == 'admin' && isset($userinfo['adminid'])) || ($userinfo['adminsession'] == '0' && (AREA == 'customer' || AREA == 'login') && isset($userinfo['customerid']))) && (! isset($userinfo['deactivated']) || $userinfo['deactivated'] != '1')) {
|
||||
if (((\Froxlor\User::getAll()['adminsession'] == '1' && AREA == 'admin' && isset(\Froxlor\User::getAll()['adminid'])) || (\Froxlor\User::getAll()['adminsession'] == '0' && (AREA == 'customer' || AREA == 'login') && isset(\Froxlor\User::getAll()['customerid']))) && (! isset(\Froxlor\User::getAll()['deactivated']) || \Froxlor\User::getAll()['deactivated'] != '1')) {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
`lastactivity` = :lastactive
|
||||
@@ -262,11 +264,11 @@ foreach ($langs as $key => $value) {
|
||||
// ensure that we can display messages
|
||||
$language = Settings::Get('panel.standardlanguage');
|
||||
|
||||
if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) {
|
||||
if (isset(\Froxlor\User::getAll()['language']) && isset($languages[\Froxlor\User::getAll()['language']])) {
|
||||
// default: use language from session, #277
|
||||
$language = $userinfo['language'];
|
||||
$language = \Froxlor\User::getAll()['language'];
|
||||
} else {
|
||||
if (! isset($userinfo['def_language']) || ! isset($languages[$userinfo['def_language']])) // this will always evaluat true, since it is the above statement inverted. @todo remove
|
||||
if (! isset(\Froxlor\User::getAll()['def_language']) || ! isset($languages[\Froxlor\User::getAll()['def_language']])) // this will always evaluat true, since it is the above statement inverted. @todo remove
|
||||
{
|
||||
if (isset($_GET['language']) && isset($languages[$_GET['language']])) {
|
||||
$language = $_GET['language'];
|
||||
@@ -291,7 +293,7 @@ if (isset($userinfo['language']) && isset($languages[$userinfo['language']])) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$language = $userinfo['def_language'];
|
||||
$language = \Froxlor\User::getAll()['def_language'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,6 +312,10 @@ if ($language != 'English') {
|
||||
// last but not least include language references file
|
||||
include_once \Froxlor\FileDir::makeSecurePath('lng/lng_references.php');
|
||||
|
||||
// set language array
|
||||
\Froxlor\I18N\Lang::setLanguageArray($lng);
|
||||
unset($lng);
|
||||
|
||||
// Initialize our new link - class
|
||||
$linker = new \Froxlor\UI\Linker('index.php', $s);
|
||||
|
||||
@@ -321,8 +327,8 @@ $theme = (Settings::Get('panel.default_theme') !== null) ? Settings::Get('panel.
|
||||
/**
|
||||
* overwrite with customer/admin theme if defined
|
||||
*/
|
||||
if (isset($userinfo['theme']) && $userinfo['theme'] != $theme) {
|
||||
$theme = $userinfo['theme'];
|
||||
if (isset(\Froxlor\User::getAll()['theme']) && \Froxlor\User::getAll()['theme'] != $theme) {
|
||||
$theme = \Froxlor\User::getAll()['theme'];
|
||||
}
|
||||
|
||||
// Check if a different variant of the theme is used
|
||||
@@ -357,7 +363,7 @@ if (file_exists($hl_path . '/logo_custom.png')) {
|
||||
* Redirects to index.php (login page) if no session exists
|
||||
*/
|
||||
if ($nosession == 1 && AREA != 'login') {
|
||||
unset($userinfo);
|
||||
\Froxlor\User::setUserinfoArray(array());
|
||||
$params = array(
|
||||
"script" => basename($_SERVER["SCRIPT_NAME"]),
|
||||
"qrystr" => $_SERVER["QUERY_STRING"]
|
||||
@@ -371,13 +377,9 @@ if ($nosession == 1 && AREA != 'login') {
|
||||
*/
|
||||
$templatecache = array();
|
||||
|
||||
/**
|
||||
* Logic moved out of lng-file
|
||||
*/
|
||||
if (isset($userinfo['loginname']) && $userinfo['loginname'] != '') {
|
||||
$lng['menue']['main']['username'] .= $userinfo['loginname'];
|
||||
if (isset(\Froxlor\User::getAll()['loginname']) && \Froxlor\User::getAll()['loginname'] != '') {
|
||||
// Initialize logging
|
||||
$log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo);
|
||||
$log = \Froxlor\FroxlorLogger::getInstanceOf(\Froxlor\User::getAll());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,10 +421,10 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
)
|
||||
)
|
||||
);
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data['admin'], $userinfo);
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data['admin'], \Froxlor\User::getAll());
|
||||
} else {
|
||||
$navigation_data = \Froxlor\PhpHelper::loadConfigArrayDir('lib/navigation/');
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data[AREA], $userinfo);
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data[AREA], \Froxlor\User::getAll());
|
||||
}
|
||||
unset($navigation_data);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ return array(
|
||||
'label' => $lng['admin']['overview'],
|
||||
'elements' => array(
|
||||
array(
|
||||
'label' => $lng['menue']['main']['username']
|
||||
'label' => $lng['menue']['main']['username'] . (isset(\Froxlor\User::getAll()['loginname']) && \Froxlor\User::getAll()['loginname'] != '' ? " " . \Froxlor\User::getAll()['loginname'] : "")
|
||||
),
|
||||
array(
|
||||
'url' => 'customer_index.php?page=change_password',
|
||||
|
||||
Reference in New Issue
Block a user