Project

General

Profile

« Previous | Next » 

Revision 1035

Added by Matthias over 15 years ago

- Added new functions to admin dir (Thanks Argos and Ruud)

- Updated install and upgrade-script

- Adapted wb_theme and classic_theme to changed admin dir files

View differences:

browse.php
34 34
// Byte convert for filesize
35 35
function byte_convert($bytes) {
36 36
	$symbol = array('B', 'KB', 'MB', 'GB', 'TB');
37
   $exp = 0;
38
   $converted_value = 0;
39
   if( $bytes > 0 ) {
40
   	$exp = floor( log($bytes)/log(1024) );
41
      $converted_value = ( $bytes/pow(1024,floor($exp)) );
42
   }
43
   return sprintf( '%.2f '.$symbol[$exp], $converted_value );
37
	$exp = 0;
38
	$converted_value = 0;
39
	if( $bytes > 0 ) {
40
		$exp = floor( log($bytes)/log(1024) );
41
		$converted_value = ( $bytes/pow(1024,floor($exp)) );
42
	}
43
	return sprintf( '%.2f '.$symbol[$exp], $converted_value );
44 44
}
45 45

  
46 46
// Get file extension
......
116 116
$template->set_block('main_block', 'list_block', 'list');
117 117
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
118 118
	// Loop through the files and dirs an add to list
119
   while(false !== ($file = readdir($handle))) {
119
	while(false !== ($file = readdir($handle))) {
120 120
		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
121 121
			if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
122 122
				if(!isset($home_folders[$directory.'/'.$file])) {
......
143 143
											'LINK_TARGET' => '',
144 144
											'ROW_BG_COLOR' => $row_bg_color,
145 145
											'FILETYPE_ICON' => THEME_URL.'/images/folder_16.png',
146
											'MOUSEOVER' => '',
147
											'IMAGEDETAIL' => '',
146 148
											'SIZE' => '',
147 149
											'DATE' => '',
148 150
											'PREVIEW' => ''
......
174 176
				$preview = '';
175 177
			}
176 178
			$temp_id++;
179
			$imgdetail = '';
180
			$icon = THEME_URL.'/images/blank.gif';
181
			$tooltip = '';
182
			$pathsettings['global']['show_thumbs'] = '';
183
			if (!$pathsettings['global']['show_thumbs']) {
184
				$info = getimagesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name);
185
				if ($info[0]) {
186
					$imgdetail = fsize(filesize(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)).', '.$info[0].'x'.$info[1].'px';
187
					$icon = 'thumb.php?t=1&img='.$directory.'/'.$name;
188
					$tooltip = ShowTip('thumb.php?t=2&img='.$directory.'/'.$name,$imgdetail);
189
				}
190
			}
177 191
			$template->set_var(array(
178 192
											'NAME' => $name,
179 193
											'NAME_SLASHED' => addslashes($name),
......
181 195
											'LINK' => WB_URL.MEDIA_DIRECTORY.$directory.'/'.$name,
182 196
											'LINK_TARGET' => '_blank',
183 197
											'ROW_BG_COLOR' => $row_bg_color,
198
											'ICON' => $icon,
184 199
											'FILETYPE_ICON' => THEME_URL.'/images/files/'.$filetypeicon.'.png',
200
											'MOUSEOVER' => $tooltip, 
201
											'IMAGEDETAIL' => $imgdetail,
185 202
											'SIZE' => $bytes,
186 203
											'DATE' => $date,
187 204
											'PREVIEW' => $preview
......
226 243
								'TEXT_TYPE' => $TEXT['TYPE'],
227 244
								'TEXT_UP' => $TEXT['UP'],
228 245
								'NONE_FOUND' => $MESSAGE['MEDIA']['NONE_FOUND'],
246
								'CHANGE_SETTINGS' => $TEXT['MODIFY_SETTINGS'],
229 247
								'CONFIRM_DELETE' => $MESSAGE['MEDIA']['CONFIRM_DELETE']
230 248
								)
231 249
						);
......
234 252
$template->parse('main', 'main_block', false);
235 253
$template->pparse('output', 'page');
236 254

  
255
function ShowTip($name,$detail='') {
256
$ext = strtolower(end(explode(".", $name)));
257
if (strpos('.gif.jpg.jpeg.png.bmp.',$ext) )
258
	return 'onmouseover="overlib(\'<img src=\\\''.$name.'\\\' width=\\\'200\\\'><br/><center>'.$detail.'</center>\',VAUTO, WIDTH, 200)" onmouseout="nd()" ' ;
259
else
260
	return '';
261
}
262

  
263
function fsize($size) {
264
   if($size == 0) return("0 Bytes");
265
   $filesizename = array(" Bytes", "kB", "MB", "GB", "TB");
266
   return round($size/pow(1024, ($i = floor(log($size, 1024)))), 1) . $filesizename[$i];
267
}
237 268
?>

Also available in: Unified diff