Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1823)
+++ branches/2.8.x/CHANGELOG	(revision 1824)
@@ -13,6 +13,8 @@
 
 
 
+20 Nov-2012 Build 1824 Dietmar Woellbrink (Luisehahne)
+! update media in look to the changes in user management
 20 Nov-2012 Build 1823 Dietmar Woellbrink (Luisehahne)
 ! update user management, now home folder only will be created
   if homefolders in settings are enabledPlugin
Index: branches/2.8.x/wb/admin/media/rename2.php
===================================================================
--- branches/2.8.x/wb/admin/media/rename2.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/rename2.php	(revision 1824)
@@ -28,7 +28,7 @@
 $admin = new admin('Media', 'media', false);
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // Get the current dir
 $requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
Index: branches/2.8.x/wb/admin/media/dse.php
===================================================================
--- branches/2.8.x/wb/admin/media/dse.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/dse.php	(revision 1824)
@@ -9,8 +9,9 @@
 $link = mysql_connect($DB_HOST, $DB_USER, $DB_PASS);
 mysql_select_db ( $DB_NAME, $link );
 */
-require_once(WB_PATH.'/framework/DseTwo.php');
 
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
+
 $CachePath = WB_PATH.'/temp/mediacache';
 // $ListFile = ADMIN_PATH.'/media/MediaBlackList'; // WhiteList   BlackList
 $ListFile = ADMIN_PATH.'/media/MediaWhiteList'; // WhiteList   BlackList
Index: branches/2.8.x/wb/admin/media/setparameter.php
===================================================================
--- branches/2.8.x/wb/admin/media/setparameter.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/setparameter.php	(revision 1824)
@@ -27,7 +27,7 @@
 
 $admin = new admin('Media', 'media', false);
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // check if theme language file exists for the language set by the user (e.g. DE, EN)
 if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
Index: branches/2.8.x/wb/admin/media/browse.php
===================================================================
--- branches/2.8.x/wb/admin/media/browse.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/browse.php	(revision 1824)
@@ -32,7 +32,7 @@
 $starttime = $starttime[0]+$starttime[1];
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 include ('parameters.php');
 
 // check if theme language file exists for the language set by the user (e.g. DE, EN)
@@ -129,7 +129,9 @@
 $template->set_block('page', 'main_block', 'main');
 
 // Get the current dir
-$currentHome = $admin->get_home_folder();
+//$currentHome = $admin->get_home_folder();
+$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
+
 // set directory if you call from menu
 $directory =	(($currentHome) AND (!array_key_exists('dir',$_GET)))
 				?
@@ -141,9 +143,20 @@
 if ($currentHome && stripos(WB_PATH.MEDIA_DIRECTORY.$directory,WB_PATH.MEDIA_DIRECTORY.$currentHome)===false) {
 	$directory = $currentHome;
 }
+if($directory == '/' OR $directory == '\\') {$directory = '';}
 
-if($directory == '/' OR $directory == '\\') {
-	$directory = '';
+$sBackLink = WB_PATH.MEDIA_DIRECTORY.$directory;
+if(!is_readable( $sBackLink )) {
+$directory = dirname($directory);
+// reload parent page to rebuild the dropdowns
+echo "<script type=\"text/javascript\">
+<!--
+// Get the location object
+var locationObj = document.location;
+// Set the value of the location object
+parent.document.location = 'index.php';
+-->
+</script>";
 }
 
 $dir_backlink = 'browse.php?dir='.$directory;
@@ -191,7 +204,8 @@
 			);
 
 // Get home folder not to show
-$home_folders = get_home_folders();
+//$home_folders = get_home_folders();
+$home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
 
 // Generate list
 $template->set_block('main_block', 'list_block', 'list');
@@ -330,7 +344,8 @@
 	$template->set_var('DISPLAY_NONE_FOUND', 'hide');
 }
 
-if($currentHome=='') {
+//if($currentHome=='') {
+if( !in_array($admin->get_username(), explode('/',$directory)) ) {
 // Insert permissions values
     if($admin->get_permission('media_rename') != true) {
     	$template->set_var('DISPLAY_RENAME', 'hide');
Index: branches/2.8.x/wb/admin/media/delete.php
===================================================================
--- branches/2.8.x/wb/admin/media/delete.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/delete.php	(revision 1824)
@@ -28,7 +28,7 @@
 $admin = new admin('Media', 'media', false);
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // Get the current dir
 $directory = $admin->get_get('dir');
Index: branches/2.8.x/wb/admin/media/create.php
===================================================================
--- branches/2.8.x/wb/admin/media/create.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/create.php	(revision 1824)
@@ -25,7 +25,7 @@
 }
 if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // suppress to print the header, so no new FTAN will be set
 $admin = new admin('Media', 'media_create', false);
Index: branches/2.8.x/wb/admin/media/parameters.php
===================================================================
--- branches/2.8.x/wb/admin/media/parameters.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/parameters.php	(revision 1824)
@@ -15,8 +15,13 @@
  *
  */
 
-// Must include code to stop this file being access directly
-if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
+/* -------------------------------------------------------- */
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
+}
+/* -------------------------------------------------------- */
 
 function __unserialize($sObject) {  // found in php manual :-)
     if($sObject=='') { return array( 'global' => array( 'admin_only' => false,'show_thumbs' => false ) );}
Index: branches/2.8.x/wb/admin/media/upload.php
===================================================================
--- branches/2.8.x/wb/admin/media/upload.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/upload.php	(revision 1824)
@@ -46,7 +46,7 @@
 $target = (isset(${$requestMethod}['target'])) ? ${$requestMethod}['target'] : '';
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 $directory = ($target == '/') ?  '' : $target;
 $dirlink = 'index.php?dir='.$directory;
Index: branches/2.8.x/wb/admin/media/index.php
===================================================================
--- branches/2.8.x/wb/admin/media/index.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/index.php	(revision 1824)
@@ -39,7 +39,7 @@
 $template->set_block('page', 'main_block', 'main');
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // Target location
 $requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
@@ -50,13 +50,12 @@
 $rootlink = 'index.php?dir=';
 
 // Get home folder not to show
-$home_folders = get_home_folders();
+$home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
 
 // Insert values
 $template->set_block('main_block', 'dir_list_block', 'dir_list');
 $dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
-$currentHome = $admin->get_home_folder();
-
+$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
 if ($currentHome!=''){
 	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
 }
Index: branches/2.8.x/wb/admin/media/rename.php
===================================================================
--- branches/2.8.x/wb/admin/media/rename.php	(revision 1823)
+++ branches/2.8.x/wb/admin/media/rename.php	(revision 1824)
@@ -28,7 +28,7 @@
 $admin = new admin('Media', 'media', false);
 
 // Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
+if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
 
 // Get the current dir
 $directory = $admin->get_get('dir');
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1823)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1824)
@@ -51,5 +51,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.3');
-if(!defined('REVISION')) define('REVISION', '1823');
+if(!defined('REVISION')) define('REVISION', '1824');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/framework/functions.php
===================================================================
--- branches/2.8.x/wb/framework/functions.php	(revision 1823)
+++ branches/2.8.x/wb/framework/functions.php	(revision 1824)
@@ -222,6 +222,39 @@
 	return $result_list;
 }
 
+function remove_home_subs($directory = '/', $home_folders = '')
+{
+	if( ($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) )
+	{
+		// Loop through the dirs to check the home folders sub-dirs are not shown
+		while(false !== ($file = readdir($handle)))
+		{
+			if($file[0] != '.' && $file != 'index.php')
+			{
+				if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file))
+				{
+					if($directory != '/') {
+						$file = $directory.'/'.$file;
+					}else {
+						$file = '/'.$file;
+					}
+					foreach($home_folders AS $hf)
+					{
+						$hf_length = strlen($hf);
+						if($hf_length > 0) {
+							if(substr($file, 0, $hf_length+1) == $hf) {
+								$home_folders[$file] = $file;
+							}
+						}
+					}
+					$home_folders = remove_home_subs($file, $home_folders);
+				}
+			}
+		}
+	}
+	return $home_folders;
+}
+
 // Function to get a list of home folders not to show
 function get_home_folders()
 {
@@ -241,38 +274,6 @@
 				$home_folders[$folder['home_folder']] = $folder['home_folder'];
 			}
 		}
-		function remove_home_subs($directory = '/', $home_folders = '')
-		{
-			if( ($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) )
-			{
-				// Loop through the dirs to check the home folders sub-dirs are not shown
-				while(false !== ($file = readdir($handle)))
-				{
-					if($file[0] != '.' && $file != 'index.php')
-					{
-						if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file))
-						{
-							if($directory != '/') {
-								$file = $directory.'/'.$file;
-							}else {
-								$file = '/'.$file;
-							}
-							foreach($home_folders AS $hf)
-							{
-								$hf_length = strlen($hf);
-								if($hf_length > 0) {
-									if(substr($file, 0, $hf_length+1) == $hf) {
-										$home_folders[$file] = $file;
-									}
-								}
-							}
-							$home_folders = remove_home_subs($file, $home_folders);
-						}
-					}
-				}
-			}
-			return $home_folders;
-		}
 		$home_folders = remove_home_subs('/', $home_folders);
 	}
 	return $home_folders;
@@ -289,7 +290,6 @@
 {
 	$path = str_replace($vars, '', $path);
 }
-
 /*
  * @param object &$wb: $wb from frontend or $admin from backend
  * @return array: list of ro-dirs
