Project

General

Profile

« Previous | Next » 

Revision 1457

Added by Dietmar over 13 years ago

Preparing 2.8.2 stable, last tests

View differences:

browse.php
21 21
require_once(WB_PATH.'/framework/class.admin.php');
22 22
$admin = new admin('Media', 'media', false);
23 23

  
24
$starttime = explode(" ", microtime());
25
$starttime = $starttime[0]+$starttime[1];
26

  
24 27
// Include the WB functions file
25 28
require_once(WB_PATH.'/framework/functions.php');
26 29
include ('parameters.php');
......
60 63
	if (file_exists(THEME_PATH.'/images/files/'.$extension.'.png')) {
61 64
		return $extension;
62 65
	} else {
63
		return 'unknown';
66
		return 'blank_16';
64 67
	}
65 68
}
66 69

  
70
function ShowTip($name,$detail='') {
71
$parts = explode(".", $name);
72
$ext = strtolower(end($parts));
73
if (strpos('.gif.jpg.jpeg.png.bmp.',$ext) )
74
	return 'onmouseover="overlib(\'<img src=\\\''.$name.'\\\' maxwidth=\\\'200\\\' maxheight=\\\'200\\\'>\',VAUTO, WIDTH)" onmouseout="nd()" ' ;
75
else
76
	return '';
77
}
78

  
79
function fsize($size) {
80
   if($size == 0) return("0 Bytes");
81
   $filesizename = array(" bytes", " kB", " MB", " GB", " TB");
82
   return round($size/pow(1024, ($i = floor(log($size, 1024)))), 1) . $filesizename[$i];
83
}
84

  
67 85
// Setup template object
68 86
$template = new Template(THEME_PATH.'/templates');
69 87
$template->set_file('page', 'media_browse.htt');
......
72 90
// Get the current dir
73 91
$currentHome = $admin->get_home_folder();
74 92
$directory =	(($currentHome) AND (!array_key_exists('dir',$_GET)))
75
				? 
93
				?
76 94
				$currentHome
77 95
				:
78 96
				$admin->strip_slashes($admin->get_get('dir')) ;
......
113 131

  
114 132
// Insert values
115 133
$template->set_var(array(
116
								'THEME_URL' => THEME_URL,
117
								'CURRENT_DIR' => $directory,
118
								'PARENT_DIR_LINK' => $parent_dir_link,
119
								'DISPLAY_UP_ARROW' => $display_up_arrow,
120
								'INCLUDE_PATH' => WB_URL.'/include'
121
								)
122
						);
134
					'THEME_URL' => THEME_URL,
135
					// 'THEME_URL' => '',
136
					'CURRENT_DIR' => $directory,
137
					'PARENT_DIR_LINK' => $parent_dir_link,
138
					'DISPLAY_UP_ARROW' => $display_up_arrow,
139
					'INCLUDE_PATH' => WB_URL.'/include'
140
				)
141
			);
123 142

  
124 143
// Get home folder not to show
125 144
$home_folders = get_home_folders();
126 145

  
127 146
// Generate list
128 147
$template->set_block('main_block', 'list_block', 'list');
148

  
149
$usedFiles = array();
150
// require_once(ADMIN_PATH.'/media/dse.php');
151
// $filename =  $currentdir;
152
if(!empty($currentdir)) {
153
	$usedFiles = $Dse->getMatchesFromDir( $currentdir, DseTwo::RETURN_USED);
154
/* */
155
print '<pre><strong>function '.__FUNCTION__.'();</strong>  basename: '.basename(__FILE__).'  line: '.__LINE__.' -> <br />';
156
print_r( $usedFiles ); print '</pre>'; // flush ();sleep(10); die();
157

  
158
}
159

  
129 160
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
130 161
	// Loop through the files and dirs an add to list
131 162
	while(false !== ($file = readdir($handle))) {
......
148 179
			$link_name = str_replace(' ', '%20', $name);
149 180
			$temp_id++;
150 181
			$template->set_var(array(
151
											'NAME' => $name,
152
											'NAME_SLASHED' => addslashes($name),
153
											'TEMP_ID' => $admin->getIDKEY($temp_id),
154
											'LINK' => "browse.php?dir=$directory/$link_name",
155
											'LINK_TARGET' => '_self',
156
											'ROW_BG_COLOR' => $row_bg_color,
157
											'FT_ICON' => THEME_URL.'/images/folder_16.png',
158
											'FILETYPE_ICON' => THEME_URL.'/images/folder_16.png',
159
											'MOUSEOVER' => '',
160
											'IMAGEDETAIL' => '',
161
											'SIZE' => '',
162
											'DATE' => '',
163
											'PREVIEW' => ''
164
											)
165
									);
182
								'NAME' => $name,
183
								'NAME_SLASHED' => addslashes($name),
184
								'TEMP_ID' => $admin->getIDKEY($temp_id),
185
								'LINK' => "browse.php?dir=$directory/$link_name",
186
								'LINK_TARGET' => '_self',
187
								'ROW_BG_COLOR' => $row_bg_color,
188
								'FT_ICON' => THEME_URL.'/images/folder_16.png',
189
								'FILETYPE_ICON' => THEME_URL.'/images/folder_16.png',
190
								'MOUSEOVER' => '',
191
								'IMAGEDETAIL' => '',
192
								'SIZE' => '',
193
								'DATE' => '',
194
								'PREVIEW' => '',
195
								'IMAGE_TITLE' => $name,
196
								'IMAGE_EXIST' => 'blank_16.gif'
197
							)
198
						);
166 199
			$template->parse('list', 'list_block', true);
167 200
			// Code to alternate row colors
168 201
			if($row_bg_color == 'FFF') {
......
174 207
	}
175 208
	if(isset($FILE)) {
176 209
		sort($FILE);
177
		$filepreview = array('jpg','gif','tif','tiff','png','txt','css','js','cfg','conf');
210
		$filepreview = array('jpg','gif','tif','tiff','png','txt','css','js','cfg','conf','pdf','zip','gz','doc');
178 211
		foreach($FILE AS $name) {
179 212
			$size = filesize('../../'.MEDIA_DIRECTORY.$directory.'/'.$name);
180 213
			$bytes = byte_convert($size);
......
190 223
			}
191 224
			$temp_id++;
192 225
			$imgdetail = '';
193
			$icon = THEME_URL.'/images/blank.gif';
226
			// $icon = THEME_URL.'/images/blank_16.gif';
227
			$icon = '';
194 228
			$tooltip = '';
195
			
196
			
229

  
230

  
197 231
			if (!$pathsettings['global']['show_thumbs']) {
198 232
				$info = getimagesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name);
199 233
				if ($info[0]) {
......
202 236
					$tooltip = ShowTip('thumb.php?t=2&amp;img='.$directory.'/'.$name);
203 237
				}
204 238
			}
239

  
240
			$filetype_url = THEME_URL.'/images/files/'.$filetypeicon.'.png';
205 241
			$template->set_var(array(
206
											'NAME' => $name,
207
											'NAME_SLASHED' => addslashes($name),
208
											'TEMP_ID' => $admin->getIDKEY($temp_id),
209
											'LINK' => WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name,
210
											'LINK_TARGET' => '_blank',
211
											'ROW_BG_COLOR' => $row_bg_color,
212
											'FT_ICON' => $icon,
213
											'FILETYPE_ICON' => THEME_URL.'/images/files/'.$filetypeicon.'.png',
214
											'MOUSEOVER' => $tooltip, 
215
											'IMAGEDETAIL' => $imgdetail,
216
											'SIZE' => $bytes,
217
											'DATE' => $date,
218
											'PREVIEW' => $preview
219
											)
220
									);
242
								'NAME' => $name,
243
								'NAME_SLASHED' => addslashes($name),
244
								'TEMP_ID' => $admin->getIDKEY($temp_id),
245
								'LINK' => WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name,
246
								'LINK_TARGET' => '_blank',
247
								'ROW_BG_COLOR' => $row_bg_color,
248
								'FT_ICON' => empty($icon) ? $filetype_url : $icon,
249
								'FILETYPE_ICON' => $filetype_url,
250
								'MOUSEOVER' => $tooltip,
251
								'IMAGEDETAIL' => $imgdetail,
252
								'SIZE' => $bytes,
253
								'DATE' => $date,
254
								'PREVIEW' => $preview,
255
								'IMAGE_TITLE' => $name,
256
								// 'IMAGE_EXIST' =>  search_image($directory.'/',$name)
257
								'IMAGE_EXIST' =>  (in_array($name, $usedFiles) ? 'view_16.png' : 'pic_16.png')
258
							)
259
						);
221 260
			$template->parse('list', 'list_block', true);
222 261
			// Code to alternate row colors
223 262
			if($row_bg_color == 'FFF') {
......
246 285

  
247 286
// Insert language text and messages
248 287
$template->set_var(array(
249
								'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
250
								'TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'],
251
								'TEXT_RELOAD' => $TEXT['RELOAD'],
252
								'TEXT_RENAME' => $TEXT['RENAME'],
253
								'TEXT_DELETE' => $TEXT['DELETE'],
254
								'TEXT_SIZE' => $TEXT['SIZE'],
255
								'TEXT_DATE' => $TEXT['DATE'],
256
								'TEXT_NAME' => $TEXT['NAME'],
257
								'TEXT_TYPE' => $TEXT['TYPE'],
258
								'TEXT_UP' => $TEXT['UP'],
259
								'NONE_FOUND' => $MESSAGE['MEDIA']['NONE_FOUND'],
260
								'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
261
								'CONFIRM_DELETE' => $MESSAGE['MEDIA']['CONFIRM_DELETE']
262
								)
263
						);
288
					'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
289
					'TEXT_CURRENT_FOLDER' => $TEXT['CURRENT_FOLDER'],
290
					'TEXT_RELOAD' => $TEXT['RELOAD'],
291
					'TEXT_RENAME' => $TEXT['RENAME'],
292
					'TEXT_DELETE' => $TEXT['DELETE'],
293
					'TEXT_SIZE' => $TEXT['SIZE'],
294
					'TEXT_DATE' => $TEXT['DATE'],
295
					'TEXT_NAME' => $TEXT['NAME'],
296
					'TEXT_TYPE' => $TEXT['TYPE'],
297
					'TEXT_UP' => $TEXT['UP'],
298
					'NONE_FOUND' => $MESSAGE['MEDIA']['NONE_FOUND'],
299
					'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
300
					'CONFIRM_DELETE' => $MESSAGE['MEDIA']['CONFIRM_DELETE']
301
				)
302
			);
264 303

  
265 304
// Parse template object
266 305
$template->parse('main', 'main_block', false);
267 306
$template->pparse('output', 'page');
268

  
269
function ShowTip($name,$detail='') {
270
$parts = explode(".", $name);
271
$ext = strtolower(end($parts));
272
if (strpos('.gif.jpg.jpeg.png.bmp.',$ext) )
273
	return 'onmouseover="overlib(\'<img src=\\\''.$name.'\\\' maxwidth=\\\'200\\\' maxheight=\\\'200\\\'>\',VAUTO, WIDTH)" onmouseout="nd()" ' ;
274
else
275
	return '';
276
}
277

  
278
function fsize($size) {
279
   if($size == 0) return("0 Bytes");
280
   $filesizename = array(" bytes", " kB", " MB", " GB", " TB");
281
   return round($size/pow(1024, ($i = floor(log($size, 1024)))), 1) . $filesizename[$i];
282
}
283
?>
307
/*
308
$endtime=explode(" ", microtime());
309
$endtime=$endtime[0]+$endtime[1];
310
$debugVMsg = '';
311
if($admin->ami_group_member('1') ) {
312
	$debugVMsg  = "<p>Mask loaded in ".round($endtime - $starttime,6)." Sec,&nbsp;&nbsp;";
313
	$debugVMsg .= "Memory in use ".number_format(memory_get_usage(true), 0, ',', '.')."&nbsp;Byte,&nbsp;&nbsp;";
314
	$debugVMsg .= sizeof(get_included_files())."&nbsp;included files</p>";
315
	// $debugVMsg = print_message($debugVMsg,'#','debug',-1,false);
316
	print $debugVMsg.'<br />';
317
 }
318
*/ 

Also available in: Unified diff