diff --git a/src/admin/charts.php b/src/admin/charts.php index a04c407..e79defb 100644 --- a/src/admin/charts.php +++ b/src/admin/charts.php @@ -69,6 +69,14 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY'] // --- // --- BEGIN Custom Code + +// --- Set Helpervariable for non-ADMIN users +if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + $content['READONLY_ISUSERONLY'] = "disabled"; +else + $content['READONLY_ISUSERONLY'] = ""; +// --- + if ( isset($_GET['op']) ) { if ($_GET['op'] == "add") @@ -96,6 +104,14 @@ if ( isset($_GET['op']) ) $content['userid'] = null; $content['CHECKED_ISUSERONLY'] = ""; $content['CHARTID'] = ""; + + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['CHECKED_ISUSERONLY'] = "checked"; + } + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -144,11 +160,17 @@ if ( isset($_GET['op']) ) CreateChartFields($content['chart_field']); // COMMON Fields - if ( $myChart['userid'] != null ) + $content['userid'] = $myChart['userid']; + if ( $content['userid'] != null ) $content['CHECKED_ISUSERONLY'] = "checked"; else $content['CHECKED_ISUSERONLY'] = ""; + // --- Can only EDIT own views! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 && $content['userid'] == NULL ) + DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] ); + // --- + // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); if ( is_array($content['SUBGROUPS']) ) @@ -248,11 +270,20 @@ if ( isset($_POST['op']) ) } else { - $content['userid'] = "null"; - if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) - $content['groupid'] = intval($_POST['groupid']); - else - $content['groupid'] = "null"; + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['groupid'] = "null"; + } + else + { + $content['userid'] = "null"; + if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) + $content['groupid'] = intval($_POST['groupid']); + else + $content['groupid'] = "null"; + } } // --- Check mandotary values diff --git a/src/admin/searches.php b/src/admin/searches.php index ec5b350..ebb4b26 100644 --- a/src/admin/searches.php +++ b/src/admin/searches.php @@ -69,6 +69,14 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY'] // --- // --- BEGIN Custom Code + +// --- Set Helpervariable for non-ADMIN users +if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + $content['READONLY_ISUSERONLY'] = "disabled"; +else + $content['READONLY_ISUSERONLY'] = ""; +// --- + if ( isset($_GET['op']) ) { if ($_GET['op'] == "add") @@ -86,6 +94,14 @@ if ( isset($_GET['op']) ) $content['userid'] = null; $content['CHECKED_ISUSERONLY'] = ""; $content['SEARCHID'] = ""; + + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['CHECKED_ISUSERONLY'] = "checked"; + } + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -116,11 +132,17 @@ if ( isset($_GET['op']) ) { $content['SEARCHID'] = $mysearch['ID']; $content['DisplayName'] = $mysearch['DisplayName']; + $content['userid'] = $mysearch['userid']; $content['SearchQuery'] = $mysearch['SearchQuery']; - if ( $mysearch['userid'] != null ) + if ( $content['userid'] != null ) $content['CHECKED_ISUSERONLY'] = "checked"; else $content['CHECKED_ISUSERONLY'] = ""; + + // --- Can only EDIT own views! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 && $content['userid'] == NULL ) + DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] ); + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -215,11 +237,20 @@ if ( isset($_POST['op']) ) } else { - $content['userid'] = "null"; - if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) - $content['groupid'] = intval($_POST['groupid']); - else - $content['groupid'] = "null"; + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['groupid'] = "null"; + } + else + { + $content['userid'] = "null"; + if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) + $content['groupid'] = intval($_POST['groupid']); + else + $content['groupid'] = "null"; + } } // --- Check mandotary values diff --git a/src/admin/sources.php b/src/admin/sources.php index 6ecfbbf..5e6bfe1 100644 --- a/src/admin/sources.php +++ b/src/admin/sources.php @@ -70,6 +70,14 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY'] // --- // --- BEGIN Custom Code + +// --- Set Helpervariable for non-ADMIN users +if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + $content['READONLY_ISUSERONLY'] = "disabled"; +else + $content['READONLY_ISUSERONLY'] = ""; +// --- + if ( isset($_GET['op']) ) { if ($_GET['op'] == "add") @@ -126,6 +134,14 @@ if ( isset($_GET['op']) ) $content['userid'] = null; $content['CHECKED_ISUSERONLY'] = ""; $content['SOURCEID'] = ""; + + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['CHECKED_ISUSERONLY'] = "checked"; + } + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -211,11 +227,17 @@ if ( isset($_GET['op']) ) } $content['SourceDBRecordsPerQuery'] = $mysource['DBRecordsPerQuery']; - - if ( $mysource['userid'] != null ) + // Set UserID if set! + $content['userid'] = $mysource['userid']; + if ( $content['userid'] != null ) $content['CHECKED_ISUSERONLY'] = "checked"; else $content['CHECKED_ISUSERONLY'] = ""; + + // --- Can only EDIT own views! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 && $content['userid'] == NULL ) + DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] ); + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -544,11 +566,20 @@ if ( isset($_POST['op']) ) } else { - $content['userid'] = "null"; - if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) - $content['groupid'] = intval($_POST['groupid']); - else - $content['groupid'] = "null"; + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['groupid'] = "null"; + } + else + { + $content['userid'] = "null"; + if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) + $content['groupid'] = intval($_POST['groupid']); + else + $content['groupid'] = "null"; + } } // --- Check mandotary values diff --git a/src/admin/views.php b/src/admin/views.php index 11cd905..ecc354c 100644 --- a/src/admin/views.php +++ b/src/admin/views.php @@ -77,6 +77,13 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY'] // Init helper variable to empty string $content['FormUrlAddOP'] = ""; +// --- Set Helpervariable for non-ADMIN users +if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + $content['READONLY_ISUSERONLY'] = "disabled"; +else + $content['READONLY_ISUSERONLY'] = ""; +// --- + if ( isset($_GET['op']) ) { if ($_GET['op'] == "add") @@ -88,10 +95,18 @@ if ( isset($_GET['op']) ) //PreInit these values $content['DisplayName'] = ""; - $content['userid'] = null; - $content['CHECKED_ISUSERONLY'] = ""; $content['VIEWID'] = ""; $content['FormUrlAddOP'] = "?op=add"; + $content['userid'] = null; + $content['CHECKED_ISUSERONLY'] = ""; + + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['CHECKED_ISUSERONLY'] = "checked"; + } + // --- // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); @@ -132,6 +147,11 @@ if ( isset($_GET['op']) ) else $content['CHECKED_ISUSERONLY'] = ""; + // --- Can only EDIT own views! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 && $content['userid'] == NULL ) + DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] ); + // --- + // --- Check if groups are available $content['SUBGROUPS'] = GetGroupsForSelectfield(); if ( is_array($content['SUBGROUPS']) ) @@ -301,11 +321,20 @@ if ( isset($_POST['op']) ) } else { - $content['userid'] = "null"; - if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) - $content['groupid'] = intval($_POST['groupid']); - else - $content['groupid'] = "null"; + // --- Can only create a USER source! + if ( !isset($_SESSION['SESSION_ISADMIN']) || $_SESSION['SESSION_ISADMIN'] == 0 ) + { + $content['userid'] = $content['SESSION_USERID']; + $content['groupid'] = "null"; + } + else + { + $content['userid'] = "null"; + if ( isset ($_POST['groupid']) && $_POST['groupid'] != -1 ) + $content['groupid'] = intval($_POST['groupid']); + else + $content['groupid'] = "null"; + } } // --- Check mandotary values diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index 0039c84..5f54d64 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -104,6 +104,7 @@ $content['LN_GEN_INJECTBODYHEADER'] = "Voranstellen von HTML Code am Anfang des $content['LN_GEN_INJECTBODYFOOTER'] = "Voranstellen von HTML Code Am Ende des <body> Bereichs."; $content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optionale LogAnalyzer-Logo-URL. Bitte für das Standard-Logo leer lassen."; $content['LN_ADMIN_ERROR_READONLY'] = "This is a READONLY User, you are not allowed to perform any change operations."; +$content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] = "You are not allowed to edit this configuration item."; // User Center $content['LN_USER_CENTER'] = "Benutzer Optionen"; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 695ed24..8574853 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -106,6 +106,7 @@ $content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of $content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area."; $content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional LogAnalyzer Logo URL. Leave empty to use the default one."; $content['LN_ADMIN_ERROR_READONLY'] = "This is a READONLY User, you are not allowed to perform any change operations."; +$content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] = "You are not allowed to edit this configuration item."; // User Center $content['LN_USER_CENTER'] = "User Options"; diff --git a/src/lang/it_IT/admin.php b/src/lang/it_IT/admin.php index f742402..c65c6d6 100644 --- a/src/lang/it_IT/admin.php +++ b/src/lang/it_IT/admin.php @@ -106,6 +106,7 @@ $content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of $content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area."; $content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional LogAnalyzer Logo URL. Leave empty to use the default one."; $content['LN_ADMIN_ERROR_READONLY'] = "This is a READONLY User, you are not allowed to perform any change operations."; +$content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] = "You are not allowed to edit this configuration item."; // User Center $content['LN_USER_CENTER'] = "User Options"; diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index 14f027e..71ec81d 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -104,6 +104,7 @@ $content['LN_GEN_INJECTBODYHEADER'] = "Inject this html code at the beginning of $content['LN_GEN_INJECTBODYFOOTER'] = "Inject this html code at the end <body> area."; $content['LN_ADMIN_PHPLOGCON_LOGOURL'] = "Optional LogAnalyzer Logo URL. Leave empty to use the default one."; $content['LN_ADMIN_ERROR_READONLY'] = "This is a READONLY User, you are not allowed to perform any change operations."; +$content['LN_ADMIN_ERROR_NOTALLOWEDTOEDIT'] = "You are not allowed to edit this configuration item."; // User Center $content['LN_USER_CENTER'] = "User Options"; diff --git a/src/templates/admin/admin_charts.html b/src/templates/admin/admin_charts.html index fd9bed3..8bcfe54 100644 --- a/src/templates/admin/admin_charts.html +++ b/src/templates/admin/admin_charts.html @@ -121,7 +121,7 @@