From 3c1daef5a3b5e2141974ea953f5d9fb517f80c6a Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Mon, 18 Jul 2011 13:58:04 +0000
Subject: [PATCH] Do better call debug_report_bug() if something bad happened

---
 inc/filters.php                 |  4 +++-
 inc/modules/admin/admin-inc.php |  9 +++------
 inc/mysql-manager.php           | 13 +++++++------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/inc/filters.php b/inc/filters.php
index 881eb57395..34574e46a5 100644
--- a/inc/filters.php
+++ b/inc/filters.php
@@ -180,7 +180,9 @@ function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
 // Filter for solving task given task
 function FILTER_SOLVE_TASK ($data) {
 	// Don't solve anything if no admin!
-	if (!isAdmin()) return $data;
+	if (!isAdmin()) {
+		return $data;
+	} // END - if
 
 	// Is this a direct task id or array element task_id is found?
 	if (is_int($data)) {
diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php
index b7537c8b60..1f5d396740 100644
--- a/inc/modules/admin/admin-inc.php
+++ b/inc/modules/admin/admin-inc.php
@@ -1368,14 +1368,11 @@ function adminDeleteTask ($id) {
 
 // Function to update task data
 function adminUpdateTaskData ($id, $row, $data) {
-	// Should be admin!
+	// Should be admin and valid id
 	if (!isAdmin()) {
 		// Not an admin so redirect better
-		redirectToUrl('modules.php?module=index');
-	} // END - if
-
-	// Is the id not set, then we need a backtrace here... :(
-	if ($id <= 0) {
+		debug_report_bug(__FUNCTION__, __LINE__, 'id=' . $id . ',row=' . $row . ',data=' . $data . ' - isAdmin()=false');
+	} elseif ($id <= 0) {
 		// Initiate backtrace
 		debug_report_bug(__FUNCTION__, __LINE__, sprintf("id is invalid: %s. row=%s, data=%s",
 			$id,
diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php
index 48db0063ba..f38e7aec5d 100644
--- a/inc/mysql-manager.php
+++ b/inc/mysql-manager.php
@@ -163,10 +163,10 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
 			$GLOBALS['nav_depth'] = '0';
 
 			// Run the post-filter chain
-			$ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => ''));
+			$ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'content' => $OUT));
 
-			// Add additional content
-			$OUT .= $ret['content'];
+			// Get content from filter back
+			$OUT = $ret['content'];
 		} // END - if
 	} // END - if
 
@@ -184,7 +184,6 @@ function addYouAreHereLink ($accessLevel, $FQFN, $return = false) {
 function addMenu ($mode, $action, $what) {
 	// Init some variables
 	$main_cnt = '0';
-	$ADD = '';
 
 	// is the menu action valid?
 	if (!isMenuActionValid($mode, $action, $what, true)) {
@@ -192,8 +191,10 @@ function addMenu ($mode, $action, $what) {
 	} // END - if
 
 	// Non-admin shall not see all menus
-	if (!isAdmin()) {
-		$ADD = " AND `visible`='Y' AND `locked`='N'";
+	$ADD = " AND `visible`='Y' AND `locked`='N'";
+	if (isAdmin()) {
+		// Is admin, so make all visible
+		$ADD = '';
 	} // END - if
 
 	// Load SQL data and add the menu to the output stream...
-- 
2.39.5