All $cfg variables are now accessed through a propper helper function.

This preparation is needed to implement that the user can overwrite
the global general settings later, when userdb system is enabled.
This commit is contained in:
Andre Lorbach 2008-07-29 17:30:47 +02:00
parent 6e47202f00
commit b41ef42aba
12 changed files with 122 additions and 103 deletions

View File

@ -98,9 +98,8 @@ class Template {
function parser ($vars = '', $filename = '')
{
// BEGIN DELTA MOD
global $CFG;
// For MiscShowPageRenderStats
if ( $CFG['MiscShowPageRenderStats'] == 1 )
if ( GetConfigSetting("MiscShowPageRenderStats", 1, CFGLEVEL_USER) == 1 )
FinishPageRenderStats( $vars );
// END DELTA MOD

View File

@ -772,9 +772,7 @@ class LogStreamDB extends LogStream {
*/
private function PrintDebugError($szErrorMsg)
{
global $CFG;
if ( isset($CFG['MiscShowDebugMsg']) && $CFG['MiscShowDebugMsg'] == 1 )
if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 )
{
$errdesc = mysql_error();
$errno = mysql_errno();

View File

@ -788,8 +788,7 @@ class LogStreamPDO extends LogStream {
*/
private function PrintDebugError($szErrorMsg)
{
global $CFG;
if ( isset($CFG['MiscShowDebugMsg']) && $CFG['MiscShowDebugMsg'] == 1 )
if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 )
{
$errdesc = $this->_dbhandle == null ? "" : implode( ";", $this->_dbhandle->errorInfo() );
$errno = $this->_dbhandle == null ? "" : $this->_dbhandle->errorCode();

View File

@ -52,8 +52,9 @@ InitFrontEndDefaults(); // Only in WebFrontEnd
// --- PreCheck if conversion is allowed!
if (
(isset($CFG['UserDBEnabled']) && $CFG['UserDBEnabled']) &&
(isset($CFG['UserDBConvertAllowed']) && $CFG['UserDBConvertAllowed'])
GetConfigSetting("UserDBEnabled", false) &&
GetConfigSetting("UserDBConvertAllowed", false)
)
{
// Setup static values
@ -113,16 +114,14 @@ $content['LN_CONVERT_TITLETOP'] = GetAndReplaceLangStr( $content['LN_CONVERT_TIT
if ( $content['CONVERT_STEP'] == 2 )
{
// Check the database connect
$link_id = mysql_connect( $CFG['UserDBServer'], $CFG['UserDBUser'], $CFG['UserDBPass']);
$link_id = mysql_connect( GetConfigSetting("UserDBServer"), GetConfigSetting("UserDBUser"), GetConfigSetting("UserDBPass") );
if (!$link_id)
RevertOneStep( $content['CONVERT_STEP']-1, GetAndReplaceLangStr( $content['LN_INSTALL_ERRORCONNECTFAILED'], $CFG['UserDBServer']) . "<br>" . DB_ReturnSimpleErrorMsg() );
RevertOneStep( $content['CONVERT_STEP']-1, GetAndReplaceLangStr( $content['LN_INSTALL_ERRORCONNECTFAILED'], GetConfigSetting("UserDBServer") . "<br>" . DB_ReturnSimpleErrorMsg() ) );
// Try to select the DB!
$db_selected = mysql_select_db($CFG['UserDBName'], $link_id);
$db_selected = mysql_select_db(GetConfigSetting("UserDBName"), $link_id);
if(!$db_selected)
RevertOneStep( $content['CONVERT_STEP']-1,GetAndReplaceLangStr( $content['LN_INSTALL_ERRORACCESSDENIED'], $CFG['UserDBName']) . "<br>" . DB_ReturnSimpleErrorMsg());
RevertOneStep( $content['CONVERT_STEP']-1,GetAndReplaceLangStr( $content['LN_INSTALL_ERRORACCESSDENIED'], GetConfigSetting("UserDBName") . "<br>" . DB_ReturnSimpleErrorMsg() ) );
}
else if ( $content['CONVERT_STEP'] == 3 )
{
@ -145,7 +144,7 @@ else if ( $content['CONVERT_STEP'] == 3 )
}
// Replace stats_ with the custom one ;)
$totaldbdefs = str_replace( "`logcon_", "`" . $CFG["UserDBPref"], $totaldbdefs );
$totaldbdefs = str_replace( "`logcon_", "`" . GetConfigSetting("UserDBPref"), $totaldbdefs );
// Now split by sql command
$mycommands = split( ";\n", $totaldbdefs );
@ -163,7 +162,7 @@ else if ( $content['CONVERT_STEP'] == 3 )
}
// Append INSERT Statement for Config Table to set the Database Version ^^!
$mycommands[count($mycommands)] = "INSERT INTO `" . $CFG["UserDBPref"] . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', 1)";
$mycommands[count($mycommands)] = "INSERT INTO `" . GetConfigSetting("UserDBPref") . "config` (`propname`, `propvalue`, `is_global`) VALUES ('database_installedversion', '" . $content['database_internalversion'] . "', 1)";
// --- Now execute all commands
ini_set('error_reporting', E_WARNING); // Enable Warnings!

View File

@ -57,6 +57,12 @@ define('STR_DEBUG_WARN', "Warning");
define('STR_DEBUG_ERROR', "Error");
define('STR_DEBUG_ERROR_WTF', "WTF OMFG");
// --- Config Level defines
define('CFGLEVEL_GLOBAL', 0);
define('CFGLEVEL_GROUP', 1);
define('CFGLEVEL_USER', 2);
// ---
// --- Source Type defines
define('SOURCE_DISK', '1');
define('SOURCE_DB', '2');

View File

@ -81,7 +81,7 @@ if ( $myPhpVerArray[0] < 5 )
function InitBasicPhpLogCon()
{
// Needed to make global
global $CFG, $gl_root_path, $content;
global $gl_root_path, $content;
// Check RunMode first!
CheckAndSetRunMode();
@ -99,9 +99,9 @@ function InitBasicPhpLogCon()
function InitUserSystemPhpLogCon()
{
// global vars needed
global $CFG, $gl_root_path, $content;
global $gl_root_path, $content;
if ( isset($CFG['UserDBEnabled']) && $CFG['UserDBEnabled'] )
if ( GetConfigSetting("UserDBEnabled", false) )
{
// Include User Functions
include($gl_root_path . 'include/functions_users.php');
@ -135,7 +135,7 @@ function GetFileLength($szFileName)
function InitPhpLogCon()
{
// Needed to make global
global $CFG, $gl_root_path, $content;
global $gl_root_path, $content;
// Init Basics which do not need a database
InitBasicPhpLogCon();
@ -150,7 +150,7 @@ function InitPhpLogCon()
InitRuntimeInformations();
// Establish DB Connection
if ( $CFG['UserDBEnabled'] )
if ( GetConfigSetting("UserDBEnabled", false) )
DB_Connect();
// Now load the Page configuration values
@ -272,10 +272,11 @@ function CreateDBTypesList( $selectedDBType )
function CreatePagesizesList()
{
global $CFG, $content;
global $content;
$tmpViewsPerPage = GetConfigSetting("ViewEntriesPerPage", 50, CFGLEVEL_USER);
$iCounter = 0;
$content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $CFG['ViewEntriesPerPage'] . ")", "Value" => $CFG['ViewEntriesPerPage'] ); $iCounter++;
$content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_GEN_PRECONFIGURED'] . " (" . $tmpViewsPerPage . ")", "Value" => $tmpViewsPerPage ); $iCounter++;
$content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 25 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 25 ); $iCounter++;
$content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 50 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 50 ); $iCounter++;
$content['pagesizes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 75 " . $content['LN_GEN_RECORDSPERPAGE'], "Value" => 75 ); $iCounter++;
@ -292,14 +293,15 @@ function CreatePagesizesList()
function CreateReloadTimesList()
{
global $CFG, $content;
global $content;
// $CFG['ViewEnableAutoReloadSeconds']
$iCounter = 0;
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_DISABLED'], "Value" => 0 ); $iCounter++;
if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
$tmpReloadSeconds = GetConfigSetting("ViewEnableAutoReloadSeconds", "", CFGLEVEL_USER);
if ( $tmpReloadSeconds > 0 )
{
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $CFG['ViewEnableAutoReloadSeconds'] . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $CFG['ViewEnableAutoReloadSeconds'] ); $iCounter++;
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => $content['LN_AUTORELOAD_PRECONFIGURED'] . " (" . $tmpReloadSeconds . " " . $content['LN_AUTORELOAD_SECONDS'] . ") ", "Value" => $tmpReloadSeconds ); $iCounter++;
}
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 5 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 5 ); $iCounter++;
$content['reloadtimes'][$iCounter] = array( "ID" => $iCounter, "Selected" => "", "DisplayName" => " 10 " . $content['LN_AUTORELOAD_SECONDS'], "Value" => 10 ); $iCounter++;
@ -349,10 +351,10 @@ function CreatePredefinedSearches()
function InitPhpDebugMode()
{
global $content, $CFG;
global $content;
// --- Set Global DEBUG Level!
if ( $CFG['MiscShowDebugMsg'] == 1 )
if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 )
ini_set( "error_reporting", E_ALL ); // ALL PHP MESSAGES!
else
ini_set( "error_reporting", E_ERROR ); // ONLY PHP ERROR'S!
@ -372,12 +374,12 @@ function CheckAndSetRunMode()
function InitRuntimeInformations()
{
global $content, $CFG;
global $content;
// TODO| maybe not needed!
// Enable GZIP Compression if enabled!
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && (isset($CFG['MiscEnableGzipCompression']) && $CFG['MiscEnableGzipCompression'] == 1) )
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && GetConfigSetting("MiscEnableGzipCompression", 1, CFGLEVEL_USER) == 1 )
{
// This starts gzip compression!
ob_start("ob_gzhandler");
@ -491,7 +493,7 @@ function InitConfigurationValues()
if ( !defined('IN_PHPLOGCON_CONVERT') )
{
// If Database is enabled, try to read from database!
if ( $CFG['UserDBEnabled'] )
if ( GetConfigSetting("UserDBEnabled", false) )
{
// Get configuration variables
$result = DB_Query("SELECT * FROM " . DB_CONFIG . " WHERE is_global = true");
@ -519,7 +521,7 @@ function InitConfigurationValues()
{
// Check if user needs to be logged in
if ( isset($CFG["UserDBLoginRequired"]) && $CFG["UserDBLoginRequired"] == true )
if ( GetConfigSetting("UserDBLoginRequired", false) )
{
// User needs to be logged in, redirect to login page
if ( !defined("IS_NOLOGINPAGE") )
@ -569,7 +571,7 @@ function InitConfigurationValues()
}
else // Failsave!
{
$content['user_lang'] = $CFG['ViewDefaultLanguage'] /*"en"*/;
$content['user_lang'] = GetConfigSetting("ViewDefaultLanguage", "en", CFGLEVEL_USER) /*"en"*/;
$LANG = $content['user_lang'];
$content['gen_lang'] = $content['user_lang'];
}
@ -585,14 +587,14 @@ function InitConfigurationValues()
// Auto reload handling!
if ( !isset($_SESSION['AUTORELOAD_ID']) )
{
if ( isset($CFG['ViewEnableAutoReloadSeconds']) && $CFG['ViewEnableAutoReloadSeconds'] > 0 )
if ( GetConfigSetting("ViewEnableAutoReloadSeconds", 0, CFGLEVEL_USER) > 0 )
$_SESSION['AUTORELOAD_ID'] = 1; // Autoreload ID will be the first item!
else // Default is 0, which means auto reload disabled
$_SESSION['AUTORELOAD_ID'] = 0;
}
// Theme Handling
if ( !isset($content['web_theme']) ) { $content['web_theme'] = $CFG['ViewDefaultTheme'] /*"default"*/; }
if ( !isset($content['web_theme']) ) { $content['web_theme'] = GetConfigSetting("ViewDefaultTheme", "default", CFGLEVEL_USER); }
if ( isset($_SESSION['CUSTOM_THEME']) && VerifyTheme($_SESSION['CUSTOM_THEME']) )
$content['user_theme'] = $_SESSION['CUSTOM_THEME'];
else
@ -700,10 +702,11 @@ function DieWithFriendlyErrorMsg( $szerrmsg )
*/
function InitPageTitle()
{
global $content, $CFG, $currentSourceID;
global $content, $currentSourceID;
if ( isset($CFG['PrependTitle']) && strlen($CFG['PrependTitle']) > 0 )
$szReturn = $CFG['PrependTitle'] . " :: ";
$tmpTitle = GetConfigSetting("PrependTitle", "");
if ( strlen($tmpTitle) > 0 )
$szReturn = $tmpTitle . " :: ";
else
$szReturn = "";
@ -885,10 +888,10 @@ function GetMonthFromString($szMonth)
*/
function AddContextLinks(&$sourceTxt)
{
global $szTLDDomains, $CFG;
global $szTLDDomains;
// Return if not enabled!
if ( !isset($CFG['EnableIPAddressResolve']) || $CFG['EnableIPAddressResolve'] == 1 )
if ( GetConfigSetting("EnableIPAddressResolve", 0, CFGLEVEL_USER) == 1 )
{
// Search for IP's and Add Reverse Lookup first!
$sourceTxt = preg_replace( '/([^\[])\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/e', "'\\1\\2.\\3.\\4.\\5' . ReverseResolveIP('\\2.\\3.\\4.\\5', '<font class=\"highlighted\"> {', '} </font>')", $sourceTxt );
@ -1076,4 +1079,23 @@ function SaveGeneralSettingsIntoDB()
WriteConfigValue( "DefaultSourceID", true );
}
function GetConfigSetting($szSettingName, $szDefaultValue = "", $DesiredConfigLevel = CFGLEVEL_GLOBAL)
{
global $content, $CFG;
if ( isset($CFG['UserDBEnabled']) && $CFG['UserDBEnabled'] )
{
if ( $DesiredConfigLevel == CFGLEVEL_USER )
{
// TODO!
}
}
// Either UserDB disabled, or global setting wanted - easier handling
if ( isset($CFG[$szSettingName]) )
return $CFG[$szSettingName];
else
return $szDefaultValue;
}
?>

View File

@ -76,7 +76,8 @@ function InitSourceConfigs()
// ---
// Set default view id to source
$szDefaultViewID = isset($CFG['DefaultViewsID']) && strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG";
$tmpVar = GetConfigSetting("DefaultViewsID", "", CFGLEVEL_USER);
$szDefaultViewID = strlen($tmpVar) > 0 ? $tmpVar : "SYSLOG";
if ( isset($_SESSION[$iSourceID . "-View"]) )
{
@ -169,7 +170,7 @@ function InitSourceConfigs()
}
// Set generic configuration options
$content['Sources'][$iSourceID]['ObjRef']->_pageCount = $CFG['ViewEntriesPerPage'];
$content['Sources'][$iSourceID]['ObjRef']->_pageCount = GetConfigSetting("ViewEntriesPerPage", 50);
// Set default SourceID here!
if ( isset($content['Sources'][$iSourceID]) && !isset($currentSourceID) )
@ -191,9 +192,10 @@ function InitSourceConfigs()
$currentSourceID = $_SESSION['currentSourceID'];
else
{
if ( isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ]) )
$tmpVar = GetConfigSetting("DefaultSourceID", "", CFGLEVEL_USER);
if ( isset($content['Sources'][ $tmpVar ]) )
// Set Source to preconfigured sourceID!
$_SESSION['currentSourceID'] = $CFG['DefaultSourceID'];
$_SESSION['currentSourceID'] = $tmpVar;
else
// No Source stored in session, then to so now!
$_SESSION['currentSourceID'] = $currentSourceID;
@ -211,7 +213,8 @@ function InitSourceConfigs()
$content['Views'][ $currentViewID ]['selected'] = "selected";
// If DEBUG Mode is enabled, we prepend the UID field into the col list!
if ( $CFG['MiscShowDebugMsg'] == 1 && isset($content['Views'][$currentViewID]) )
if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 && isset($content['Views'][$currentViewID]) )
array_unshift( $content['Views'][$currentViewID]['Columns'], SYSLOG_UID);
// ---
}
@ -262,7 +265,8 @@ function AppendLegacyColumns()
);
// set default to legacy of no default view is specified!
if ( !isset($CFG['DefaultViewsID']) || strlen($CFG['DefaultViewsID']) <= 0 )
$tmpVar = GetConfigSetting("DefaultViewsID", "", CFGLEVEL_USER);
if ( strlen($tmpVar) <= 0 )
$CFG['DefaultViewsID'] = "LEGACY";
}
@ -277,13 +281,14 @@ function InitPhpLogConConfigFile($bHandleMissing = true)
include_once($gl_root_path . 'config.php');
// Easier DB Access
define('DB_CONFIG', $CFG['UserDBPref'] . "config");
define('DB_GROUPS', $CFG['UserDBPref'] . "groups");
define('DB_GROUPMEMBERS', $CFG['UserDBPref'] . "groupmembers");
define('DB_SEARCHES', $CFG['UserDBPref'] . "searches");
define('DB_SOURCES', $CFG['UserDBPref'] . "sources");
define('DB_USERS', $CFG['UserDBPref'] . "users");
define('DB_VIEWS', $CFG['UserDBPref'] . "views");
$tblPref = GetConfigSetting("UserDBPref", "logcon");
define('DB_CONFIG', $tblPref . "config");
define('DB_GROUPS', $tblPref . "groups");
define('DB_GROUPMEMBERS', $tblPref . "groupmembers");
define('DB_SEARCHES', $tblPref . "searches");
define('DB_SOURCES', $tblPref . "sources");
define('DB_USERS', $tblPref . "users");
define('DB_VIEWS', $tblPref . "views");
// Legacy support for old columns definition format!
if ( isset($CFG['Columns']) && is_array($CFG['Columns']) )
@ -295,7 +300,7 @@ function InitPhpLogConConfigFile($bHandleMissing = true)
// ---
// For MiscShowPageRenderStats
if ( $CFG['MiscShowPageRenderStats'] == 1 )
if ( GetConfigSetting("MiscShowPageRenderStats", 1) )
{
$content['ShowPageRenderStats'] = "true";
InitPageRenderStats();

View File

@ -51,16 +51,16 @@ $content['database_installedversion'] = "0"; // 0 is default which means Prior V
function DB_Connect()
{
global $userdbconn, $CFG;
global $userdbconn;
// Avoid if already OPEN
if ($userdbconn)
return;
//TODO: Check variables first
$userdbconn = mysql_connect($CFG['UserDBServer'],$CFG['UserDBUser'],$CFG['UserDBPass']);
$userdbconn = mysql_connect( GetConfigSetting("UserDBServer"), GetConfigSetting("UserDBUser"), GetConfigSetting("UserDBPass"));
if (!$userdbconn)
DB_PrintError("Link-ID == false, connect to ".$CFG['UserDBServer']." failed", true);
DB_PrintError("Link-ID == false, connect to " . GetConfigSetting("UserDBServer") . " failed", true);
// --- Now, check Mysql DB Version!
$strmysqlver = mysql_get_server_info();
@ -82,9 +82,9 @@ function DB_Connect()
}
// ---
$db_selected = mysql_select_db($CFG['UserDBName'], $userdbconn);
$db_selected = mysql_select_db( GetConfigSetting("UserDBName"), $userdbconn );
if(!$db_selected)
DB_PrintError("Cannot use database '" . $CFG['UserDBName'] . "'", true);
DB_PrintError("Cannot use database '" .GetConfigSetting("UserDBName") . "'", true);
// :D Success connecting to db
// TODO Do some more validating on the database
@ -99,8 +99,7 @@ function DB_Disconnect()
function DB_Query($query_string, $bProcessError = true, $bCritical = false)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -118,8 +117,7 @@ function DB_Query($query_string, $bProcessError = true, $bCritical = false)
function DB_FreeQuery($query_id)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -130,8 +128,7 @@ function DB_FreeQuery($query_id)
function DB_GetRow($query_id)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -143,8 +140,7 @@ function DB_GetRow($query_id)
function DB_GetSingleRow($query_id, $bClose)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -165,8 +161,7 @@ function DB_GetSingleRow($query_id, $bClose)
function DB_GetAllRows($query_id, $bClose)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -191,8 +186,7 @@ function DB_GetAllRows($query_id, $bClose)
function DB_GetMysqlStats()
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -209,7 +203,7 @@ function DB_ReturnSimpleErrorMsg()
function DB_PrintError($MyErrorMsg, $DieOrNot)
{
global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep, $CFG;
global $n,$HTTP_COOKIE_VARS, $errdesc, $errno, $linesep;
$errdesc = mysql_error();
$errno = mysql_errno();
@ -260,8 +254,7 @@ function DB_StripSlahes($myString)
function DB_ReturnLastInsertID($myResult = false)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -272,8 +265,7 @@ function DB_ReturnLastInsertID($myResult = false)
function DB_GetRowCount($query)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -288,8 +280,7 @@ function DB_GetRowCount($query)
function DB_GetRowCountByResult($myresult)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -300,8 +291,7 @@ function DB_GetRowCountByResult($myresult)
function DB_Exec($query)
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -323,9 +313,10 @@ function PrepareValueForDB($szValue)
function WriteConfigValue($szPropName, $is_global = true, $userid = false, $groupid = false)
{
global $content;
// --- Abort in this case!
global $CFG, $content;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -366,8 +357,7 @@ function WriteConfigValue($szPropName, $is_global = true, $userid = false, $grou
function GetSingleDBEntryOnly( $myqry )
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---
@ -384,8 +374,7 @@ function GetSingleDBEntryOnly( $myqry )
function GetRowsAffected()
{
// --- Abort in this case!
global $CFG;
if ( $CFG['UserDBEnabled'] == false )
if ( GetConfigSetting("UserDBEnabled", false) == false )
return;
// ---

View File

@ -41,7 +41,7 @@ require_once($gl_root_path . 'include/constants_filters.php');
function InitFilterHelpers()
{
global $CFG, $content, $filters;
global $content, $filters;
// Init Default DateMode from SESSION!
if ( isset($_SESSION['filter_datemode']) )
@ -196,7 +196,7 @@ function InitFilterHelpers()
function FillDateRangeArray($sourcearray, $szArrayListName, $szFilterName) // $content['years'], "filter_daterange_from_year_list", "filter_daterange_from_year")
{
global $CFG, $content, $filters;
global $content, $filters;
$iCount = count($sourcearray);
for ( $i = 0; $i < $iCount; $i++)

View File

@ -117,7 +117,7 @@ function GetAdditionalUrl($skipParam, $appendParam = "")
function CreateCurrentUrl()
{
global $content, $CFG;
global $content;
$content['CURRENTURL'] = $_SERVER['PHP_SELF']; // . "?" . $_SERVER['QUERY_STRING']
// Init additional_url helper variable
@ -131,11 +131,12 @@ function CreateCurrentUrl()
$hvCounter = 0;
// Append SourceID into everything!
if ( (isset($CFG['DefaultSourceID']) && isset($content['Sources'][ $CFG['DefaultSourceID'] ])) && isset($_SESSION['currentSourceID']) )
$tmpDefSourceID = GetConfigSetting("DefaultSourceID", "", CFGLEVEL_USER);
if ( isset($content['Sources'][ $tmpDefSourceID ]) && isset($_SESSION['currentSourceID']) )
{
// If the DefaultSourceID differes from the SourceID in our Session, we will append the sourceid within all URL's!
if ( $CFG['DefaultSourceID'] != $_SESSION['currentSourceID'] )
if ( $tmpDefSourceID != $_SESSION['currentSourceID'] )
{
// $content['additional_url'] .= "&sourceid=" . $_SESSION['currentSourceID'];
$content['additional_url_uidonly'] = "&sourceid=" . $_SESSION['currentSourceID'];
@ -210,13 +211,13 @@ function CreateCurrentUrl()
function GetFormatedDate($evttimearray)
{
global $content, $CFG;
global $content;
if ( !is_array($evttimearray) )
return $evttimearray;
if (
( isset($CFG['ViewUseTodayYesterday']) && $CFG['ViewUseTodayYesterday'] == 1 )
GetConfigSetting("ViewUseTodayYesterday", 0, CFGLEVEL_USER) == 1
&&
( date('m', $evttimearray[EVTIME_TIMESTAMP]) == date('m') && date('Y', $evttimearray[EVTIME_TIMESTAMP]) == date('Y') )
)
@ -233,9 +234,7 @@ function GetFormatedDate($evttimearray)
function OutputDebugMessage($szDbg)
{
global $CFG;
if ( $CFG['MiscShowDebugMsg'] == 1 )
if ( GetConfigSetting("MiscShowDebugMsg", 0, CFGLEVEL_USER) == 1 )
{
print("<table width=\"600\" align=\"center\" class=\"with_border\">");
print("<tr><td valign='top'><B>Debugmessage:</B> </td>");

View File

@ -125,7 +125,7 @@ function CreateUserName( $username, $password, $is_admin )
function CheckUserLogin( $username, $password )
{
global $content, $CFG;
global $content;
// TODO: SessionTime and AccessLevel check
@ -180,7 +180,7 @@ function CheckUserLogin( $username, $password )
}
else
{
if ( $CFG['DebugUserLogin'] == 1 )
if ( GetConfigSetting("DebugUserLogin", 0) == 1 )
DieWithFriendlyErrorMsg( "Debug Error: Could not login user '" . $username . "' <br><br><B>Sessionarray</B> <pre>" . var_export($_SESSION, true) . "</pre><br><B>SQL Statement</B>: " . $sqlselect );
// Default return false

View File

@ -300,7 +300,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
{
// --- Extra stuff for suppressing messages
if (
isset($CFG['SuppressDuplicatedMessages']) && $CFG['SuppressDuplicatedMessages'] == 1
GetConfigSetting("SuppressDuplicatedMessages", 0, CFGLEVEL_USER) == 1
&&
isset($logArray[SYSLOG_MESSAGE])
)
@ -474,7 +474,10 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
// Set truncasted message for display
if ( isset($logArray[SYSLOG_MESSAGE]) )
{
$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > $CFG['ViewMessageCharacterLimit'] ? substr($logArray[SYSLOG_MESSAGE], 0, $CFG['ViewMessageCharacterLimit'] ) . " ..." : $logArray[SYSLOG_MESSAGE]);
// Copy tmp
$tmpCharLimit = GetConfigSetting("ViewMessageCharacterLimit", 80, CFGLEVEL_USER);
$content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue'] = GetStringWithHTMLCodes(strlen($logArray[SYSLOG_MESSAGE]) > $tmpCharLimit ? substr($logArray[SYSLOG_MESSAGE], 0, $tmpCharLimit) . " ..." : $logArray[SYSLOG_MESSAGE]);
// Enable LINK property! for this field
$content['syslogmessages'][$counter]['values'][$mycolkey]['ismessagefield'] = true;
@ -493,7 +496,7 @@ if ( isset($content['Sources'][$currentSourceID]) ) // && $content['Sources'][$c
AddContextLinks($content['syslogmessages'][$counter]['values'][$mycolkey]['fieldvalue']);
// ---
if ( isset($CFG['ViewEnableDetailPopups']) && $CFG['ViewEnableDetailPopups'] == 1 )
if ( GetConfigSetting("ViewEnableDetailPopups", 0, CFGLEVEL_USER) )
{
$content['syslogmessages'][$counter]['values'][$mycolkey]['popupcaption'] = GetAndReplaceLangStr( $content['LN_GRID_POPUPDETAILS'], $logArray[SYSLOG_UID]);
$content['syslogmessages'][$counter]['values'][$mycolkey]['hasdetails'] = "true";