Only accept zip files if supported; use filename part only for temp file
This commit is contained in:
parent
6d7acac603
commit
a694b7ad9e
2 changed files with 7 additions and 2 deletions
|
@ -1014,7 +1014,7 @@ class calendar extends rcube_plugin
|
|||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$filename = $zip->getNameIndex($i);
|
||||
if (preg_match('/\.ics$/i', $filename)) {
|
||||
$tmpfile = $tmpdir . '/' . $filename;
|
||||
$tmpfile = $tmpdir . '/' . basename($filename);
|
||||
if (copy('zip://' . $_FILES['_data']['tmp_name'] . '#'.$filename, $tmpfile)) {
|
||||
$count += $this->import_from_file($tmpfile, $calendar, $rangestart, $errors);
|
||||
unlink($tmpfile);
|
||||
|
|
|
@ -536,9 +536,14 @@ class calendar_ui
|
|||
// Get max filesize, enable upload progress bar
|
||||
$max_filesize = rcube_upload_init();
|
||||
|
||||
$accept = '.ics, text/calendar, text/x-vcalendar, application/ics';
|
||||
if (class_exists('ZipArchive', false)) {
|
||||
$accept .= ', .zip, application/zip';
|
||||
}
|
||||
|
||||
$input = new html_inputfield(array(
|
||||
'type' => 'file', 'name' => '_data', 'size' => $attrib['uploadfieldsize'],
|
||||
'accept' => '.ics, text/calendar, text/x-vcalendar, application/ics, .zip, application/zip'));
|
||||
'accept' => $accept));
|
||||
|
||||
$select = new html_select(array('name' => '_range', 'id' => 'event-import-range'));
|
||||
$select->add(array(
|
||||
|
|
Loading…
Add table
Reference in a new issue