From 0ad4650993b758ef2cc1fe6b2e6c07d2156fed64 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 25 Jul 2008 13:34:24 +0200 Subject: [PATCH] Fixed minor bug reading the correct default view for sources from DB --- src/include/functions_config.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/include/functions_config.php b/src/include/functions_config.php index 06f5476..a77179f 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -75,20 +75,30 @@ function InitSourceConfigs() } // --- - // Set different view if necessary + // Set default view id to source + $szDefaultViewID = isset($CFG['DefaultViewsID']) && strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG"; + if ( isset($_SESSION[$iSourceID . "-View"]) ) { - // Overwrite configured view! - $content['Sources'][$iSourceID]['ViewID'] = $_SESSION[$iSourceID . "-View"]; + // check if view is valid + $UserSessionViewID = $_SESSION[$iSourceID . "-View"]; + + if ( isset($content['Views'][$UserSessionViewID]) ) + { + // Overwrite configured view! + $content['Sources'][$iSourceID]['ViewID'] = $_SESSION[$iSourceID . "-View"]; + } + else + $content['Sources'][$iSourceID]['ViewID'] = $szDefaultViewID; } else { - if ( isset($mysource['ViewID']) && strlen($mysource['ViewID']) > 0 ) + if ( isset($mysource['ViewID']) && strlen($mysource['ViewID']) > 0 && isset($content['Views'][ $mysource['ViewID'] ]) ) // Set to configured Source ViewID $content['Sources'][$iSourceID]['ViewID'] = $mysource['ViewID']; else // Not configured, maybe old legacy cfg. Set default view. - $content['Sources'][$iSourceID]['ViewID'] = strlen($CFG['DefaultViewsID']) > 0 ? $CFG['DefaultViewsID'] : "SYSLOG"; + $content['Sources'][$iSourceID]['ViewID'] = $szDefaultViewID; } // Only for the display box