Project

General

Profile

« Previous | Next » 

Revision 1824

Added by Dietmar almost 12 years ago

! update media in look to the changes in user management

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
20 Nov-2012 Build 1824 Dietmar Woellbrink (Luisehahne)
17
! update media in look to the changes in user management
16 18
20 Nov-2012 Build 1823 Dietmar Woellbrink (Luisehahne)
17 19
! update user management, now home folder only will be created
18 20
  if homefolders in settings are enabledPlugin
branches/2.8.x/wb/admin/media/rename2.php
28 28
$admin = new admin('Media', 'media', false);
29 29

  
30 30
// Include the WB functions file
31
require_once(WB_PATH.'/framework/functions.php');
31
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
32 32

  
33 33
// Get the current dir
34 34
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
branches/2.8.x/wb/admin/media/dse.php
9 9
$link = mysql_connect($DB_HOST, $DB_USER, $DB_PASS);
10 10
mysql_select_db ( $DB_NAME, $link );
11 11
*/
12
require_once(WB_PATH.'/framework/DseTwo.php');
13 12

  
13
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
14

  
14 15
$CachePath = WB_PATH.'/temp/mediacache';
15 16
// $ListFile = ADMIN_PATH.'/media/MediaBlackList'; // WhiteList   BlackList
16 17
$ListFile = ADMIN_PATH.'/media/MediaWhiteList'; // WhiteList   BlackList
branches/2.8.x/wb/admin/media/setparameter.php
27 27

  
28 28
$admin = new admin('Media', 'media', false);
29 29
// Include the WB functions file
30
require_once(WB_PATH.'/framework/functions.php');
30
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
31 31

  
32 32
// check if theme language file exists for the language set by the user (e.g. DE, EN)
33 33
if(!file_exists(THEME_PATH .'/languages/'.LANGUAGE .'.php')) {
branches/2.8.x/wb/admin/media/browse.php
32 32
$starttime = $starttime[0]+$starttime[1];
33 33

  
34 34
// Include the WB functions file
35
require_once(WB_PATH.'/framework/functions.php');
35
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
36 36
include ('parameters.php');
37 37

  
38 38
// check if theme language file exists for the language set by the user (e.g. DE, EN)
......
129 129
$template->set_block('page', 'main_block', 'main');
130 130

  
131 131
// Get the current dir
132
$currentHome = $admin->get_home_folder();
132
//$currentHome = $admin->get_home_folder();
133
$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
134

  
133 135
// set directory if you call from menu
134 136
$directory =	(($currentHome) AND (!array_key_exists('dir',$_GET)))
135 137
				?
......
141 143
if ($currentHome && stripos(WB_PATH.MEDIA_DIRECTORY.$directory,WB_PATH.MEDIA_DIRECTORY.$currentHome)===false) {
142 144
	$directory = $currentHome;
143 145
}
146
if($directory == '/' OR $directory == '\\') {$directory = '';}
144 147

  
145
if($directory == '/' OR $directory == '\\') {
146
	$directory = '';
148
$sBackLink = WB_PATH.MEDIA_DIRECTORY.$directory;
149
if(!is_readable( $sBackLink )) {
150
$directory = dirname($directory);
151
// reload parent page to rebuild the dropdowns
152
echo "<script type=\"text/javascript\">
153
<!--
154
// Get the location object
155
var locationObj = document.location;
156
// Set the value of the location object
157
parent.document.location = 'index.php';
158
-->
159
</script>";
147 160
}
148 161

  
149 162
$dir_backlink = 'browse.php?dir='.$directory;
......
191 204
			);
192 205

  
193 206
// Get home folder not to show
194
$home_folders = get_home_folders();
207
//$home_folders = get_home_folders();
208
$home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
195 209

  
196 210
// Generate list
197 211
$template->set_block('main_block', 'list_block', 'list');
......
330 344
	$template->set_var('DISPLAY_NONE_FOUND', 'hide');
331 345
}
332 346

  
333
if($currentHome=='') {
347
//if($currentHome=='') {
348
if( !in_array($admin->get_username(), explode('/',$directory)) ) {
334 349
// Insert permissions values
335 350
    if($admin->get_permission('media_rename') != true) {
336 351
    	$template->set_var('DISPLAY_RENAME', 'hide');
branches/2.8.x/wb/admin/media/delete.php
28 28
$admin = new admin('Media', 'media', false);
29 29

  
30 30
// Include the WB functions file
31
require_once(WB_PATH.'/framework/functions.php');
31
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
32 32

  
33 33
// Get the current dir
34 34
$directory = $admin->get_get('dir');
branches/2.8.x/wb/admin/media/create.php
25 25
}
26 26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27 27
// Include the WB functions file
28
require_once(WB_PATH.'/framework/functions.php');
28
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
29 29

  
30 30
// suppress to print the header, so no new FTAN will be set
31 31
$admin = new admin('Media', 'media_create', false);
branches/2.8.x/wb/admin/media/parameters.php
15 15
 *
16 16
 */
17 17

  
18
// Must include code to stop this file being access directly
19
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
}
24
/* -------------------------------------------------------- */
20 25

  
21 26
function __unserialize($sObject) {  // found in php manual :-)
22 27
    if($sObject=='') { return array( 'global' => array( 'admin_only' => false,'show_thumbs' => false ) );}
branches/2.8.x/wb/admin/media/upload.php
46 46
$target = (isset(${$requestMethod}['target'])) ? ${$requestMethod}['target'] : '';
47 47

  
48 48
// Include the WB functions file
49
require_once(WB_PATH.'/framework/functions.php');
49
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
50 50

  
51 51
$directory = ($target == '/') ?  '' : $target;
52 52
$dirlink = 'index.php?dir='.$directory;
branches/2.8.x/wb/admin/media/index.php
39 39
$template->set_block('page', 'main_block', 'main');
40 40

  
41 41
// Include the WB functions file
42
require_once(WB_PATH.'/framework/functions.php');
42
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
43 43

  
44 44
// Target location
45 45
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
......
50 50
$rootlink = 'index.php?dir=';
51 51

  
52 52
// Get home folder not to show
53
$home_folders = get_home_folders();
53
$home_folders = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? get_home_folders() : array();
54 54

  
55 55
// Insert values
56 56
$template->set_block('main_block', 'dir_list_block', 'dir_list');
57 57
$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY);
58
$currentHome = $admin->get_home_folder();
59

  
58
$currentHome = (defined('HOME_FOLDERS') && HOME_FOLDERS) ? $admin->get_home_folder() : '';
60 59
if ($currentHome!=''){
61 60
	$dirs = directory_list(WB_PATH.MEDIA_DIRECTORY.$currentHome);
62 61
}
branches/2.8.x/wb/admin/media/rename.php
28 28
$admin = new admin('Media', 'media', false);
29 29

  
30 30
// Include the WB functions file
31
require_once(WB_PATH.'/framework/functions.php');
31
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
32 32

  
33 33
// Get the current dir
34 34
$directory = $admin->get_get('dir');
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1823');
54
if(!defined('REVISION')) define('REVISION', '1824');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/functions.php
222 222
	return $result_list;
223 223
}
224 224

  
225
function remove_home_subs($directory = '/', $home_folders = '')
226
{
227
	if( ($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) )
228
	{
229
		// Loop through the dirs to check the home folders sub-dirs are not shown
230
		while(false !== ($file = readdir($handle)))
231
		{
232
			if($file[0] != '.' && $file != 'index.php')
233
			{
234
				if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file))
235
				{
236
					if($directory != '/') {
237
						$file = $directory.'/'.$file;
238
					}else {
239
						$file = '/'.$file;
240
					}
241
					foreach($home_folders AS $hf)
242
					{
243
						$hf_length = strlen($hf);
244
						if($hf_length > 0) {
245
							if(substr($file, 0, $hf_length+1) == $hf) {
246
								$home_folders[$file] = $file;
247
							}
248
						}
249
					}
250
					$home_folders = remove_home_subs($file, $home_folders);
251
				}
252
			}
253
		}
254
	}
255
	return $home_folders;
256
}
257

  
225 258
// Function to get a list of home folders not to show
226 259
function get_home_folders()
227 260
{
......
241 274
				$home_folders[$folder['home_folder']] = $folder['home_folder'];
242 275
			}
243 276
		}
244
		function remove_home_subs($directory = '/', $home_folders = '')
245
		{
246
			if( ($handle = opendir(WB_PATH.MEDIA_DIRECTORY.$directory)) )
247
			{
248
				// Loop through the dirs to check the home folders sub-dirs are not shown
249
				while(false !== ($file = readdir($handle)))
250
				{
251
					if($file[0] != '.' && $file != 'index.php')
252
					{
253
						if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file))
254
						{
255
							if($directory != '/') {
256
								$file = $directory.'/'.$file;
257
							}else {
258
								$file = '/'.$file;
259
							}
260
							foreach($home_folders AS $hf)
261
							{
262
								$hf_length = strlen($hf);
263
								if($hf_length > 0) {
264
									if(substr($file, 0, $hf_length+1) == $hf) {
265
										$home_folders[$file] = $file;
266
									}
267
								}
268
							}
269
							$home_folders = remove_home_subs($file, $home_folders);
270
						}
271
					}
272
				}
273
			}
274
			return $home_folders;
275
		}
276 277
		$home_folders = remove_home_subs('/', $home_folders);
277 278
	}
278 279
	return $home_folders;
......
289 290
{
290 291
	$path = str_replace($vars, '', $path);
291 292
}
292

  
293 293
/*
294 294
 * @param object &$wb: $wb from frontend or $admin from backend
295 295
 * @return array: list of ro-dirs

Also available in: Unified diff