mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed the custom config values for user in the first login.
This commit is contained in:
parent
e2fac6ccb2
commit
99786a5a16
@ -115,6 +115,7 @@ require_once ($ownDir. 'functions_config.php');
|
||||
|
||||
date_default_timezone_set("Europe/Madrid");
|
||||
|
||||
|
||||
config_process_config();
|
||||
|
||||
if (!isset($config["homeurl_static"])) {
|
||||
@ -142,32 +143,9 @@ else {
|
||||
$config["global_block_size"] = $config["block_size"];
|
||||
$config["global_flash_charts"] = $config["flash_charts"];
|
||||
|
||||
|
||||
if (isset ($config['id_user'])) {
|
||||
$userinfo = get_user_info ($config['id_user']);
|
||||
|
||||
// Refresh the last_connect info in the user table
|
||||
// if last update was more than 5 minutes ago
|
||||
if($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
|
||||
update_user($config['id_user'], array('last_connect' => time()));
|
||||
}
|
||||
|
||||
// If block_size or flash_chart are provided then override global settings
|
||||
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
||||
$config["block_size"] = $userinfo["block_size"];
|
||||
|
||||
if ($userinfo["flash_chart"] != -1)
|
||||
$config["flash_charts"] = $userinfo["flash_chart"];
|
||||
|
||||
// Each user could have it's own timezone)
|
||||
if (isset($userinfo["timezone"])) {
|
||||
if ($userinfo["timezone"] != "") {
|
||||
date_default_timezone_set($userinfo["timezone"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
|
||||
}
|
||||
config_user_set_custom_config();
|
||||
}
|
||||
|
||||
// Check if inventory_changes_blacklist is setted, if not create it
|
||||
|
@ -1414,8 +1414,8 @@ function config_check () {
|
||||
|
||||
function config_return_in_bytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
$last = strtolower($val[strlen($val) - 1]);
|
||||
switch ($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
@ -1428,4 +1428,33 @@ function config_return_in_bytes($val) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
function config_user_set_custom_config() {
|
||||
global $config;
|
||||
|
||||
$userinfo = get_user_info ($config['id_user']);
|
||||
|
||||
// Refresh the last_connect info in the user table
|
||||
// if last update was more than 5 minutes ago
|
||||
if ($userinfo['last_connect'] < (time()-SECONDS_1MINUTE)) {
|
||||
update_user($config['id_user'], array('last_connect' => time()));
|
||||
}
|
||||
|
||||
// If block_size or flash_chart are provided then override global settings
|
||||
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
||||
$config["block_size"] = $userinfo["block_size"];
|
||||
|
||||
if ($userinfo["flash_chart"] != -1)
|
||||
$config["flash_charts"] = $userinfo["flash_chart"];
|
||||
|
||||
// Each user could have it's own timezone)
|
||||
if (isset($userinfo["timezone"])) {
|
||||
if ($userinfo["timezone"] != "") {
|
||||
date_default_timezone_set($userinfo["timezone"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$config['metaconsole_access'] = $userinfo["metaconsole_access"];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -69,6 +69,7 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph
|
||||
session_start ();
|
||||
require_once ("include/config.php");
|
||||
|
||||
|
||||
// If metaconsole activated, redirect to it
|
||||
if ($config['metaconsole'] == 1 && $config['enterprise_installed'] == 1) {
|
||||
header ("Location: " . $config['homeurl'] . "enterprise/meta");
|
||||
@ -395,6 +396,13 @@ if (! isset ($config['id_user'])) {
|
||||
db_logon ($nick_in_db, $_SERVER['REMOTE_ADDR']);
|
||||
$_SESSION['id_usuario'] = $nick_in_db;
|
||||
$config['id_user'] = $nick_in_db;
|
||||
|
||||
//==========================================================
|
||||
//-------- SET THE CUSTOM CONFIGS OF USER ------------------
|
||||
|
||||
config_user_set_custom_config();
|
||||
//==========================================================
|
||||
|
||||
//Remove everything that might have to do with people's passwords or logins
|
||||
unset ($pass, $login_good);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user