Project

General

Profile

« Previous | Next » 

Revision 1023

Added by Matthias almost 15 years ago

- Added posibility to upload and unzip .zip packages to media section (Thanks to BerndJM)

- Updated Browse Media Window in wb_theme now supports file icons, more file informations and a new preview function (Thanks to BerndJM)

View differences:

upload.php
34 34
// Print admin header
35 35
require('../../config.php');
36 36
require_once(WB_PATH.'/framework/class.admin.php');
37
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');	// Required to unzip file.
37 38
$admin = new admin('Media', 'media_upload');
38 39

  
39 40
// Include the WB functions file
......
94 95
					change_mode($relative.$filename);
95 96
				}
96 97
			}
98
			// store file name of first file for possible unzip action
99
			if ($count == 1) {
100
				$filename1 = $relative . $filename;
101
			}
97 102
		}
98 103
	}
99 104
}
100 105

  
106
// If the user chose to unzip the first file, unzip into the current folder
107
if (isset($_POST['unzip']) && isset($filename1) && file_exists($filename1) ) {
108
	$archive = new PclZip($filename1);
109
	$list = $archive->extract(PCLZIP_OPT_PATH, $relative);
110
	if($list == 0) {
111
		// error while trying to extract the archive (most likely wrong format)
112
		$admin->print_error('UNABLE TO UNZIP FILE' . $archive -> errorInfo(true));
113
	}
114
}
115

  
101 116
if($good_uploads == 1) {
102
	$admin->print_success($good_uploads.$MESSAGE['MEDIA']['SINGLE_UPLOADED']);
117
	$admin->print_success($good_uploads.' '.$MESSAGE['MEDIA']['SINGLE_UPLOADED']);
118
	if (isset($_POST['delzip'])) {
119
		unlink($filename1);
120
	}
103 121
} else {
104
	$admin->print_success($good_uploads.$MESSAGE['MEDIA']['UPLOADED']);
122
	$admin->print_success($good_uploads.' '.$MESSAGE['MEDIA']['UPLOADED']);
105 123
}
106 124

  
107 125
// Print admin 

Also available in: Unified diff