Changeset 3268:282b26727770
- Timestamp:
- 07/13/16 16:09:12 (9 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/media.php
r3245 r3268 140 140 } catch (Exception $e) { 141 141 $core->error->add($e->getMessage()); 142 } 143 144 # Zip download 145 if (!empty($_GET['zipdl']) && $core->auth->check('media_admin',$core->blog->id)) 146 { 147 try 148 { 149 if (strpos(realpath($core->media->root.'/'.$d),realpath($core->media->root)) === 0) { 150 // Media folder or one of it's sub-folder(s) 151 @set_time_limit(300); 152 $fp = fopen('php://output','wb'); 153 $zip = new fileZip($fp); 154 $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#'); 155 $zip->addDirectory($core->media->root.'/'.$d,'',true); 156 157 header('Content-Disposition: attachment;filename='.date('Y-m-d').'-'.$core->blog->id.'-'.($d ? $d : 'media').'.zip'); 158 header('Content-Type: application/x-zip'); 159 $zip->write(); 160 unset($zip); 161 exit; 162 } else { 163 $d = null; 164 $core->media->chdir($d); 165 throw new Exception(__('Not a valid directory')); 166 } 167 } 168 catch (Exception $e) 169 { 170 $core->error->add($e->getMessage()); 171 } 142 172 } 143 173 … … 193 223 // Store new list 194 224 $core->auth->user_prefs->interface->put('media_last_dirs',$last_dirs,'array'); 195 }196 }197 198 # Zip download199 if (!empty($_GET['zipdl']) && $core->auth->check('media_admin',$core->blog->id))200 {201 try202 {203 @set_time_limit(300);204 $fp = fopen('php://output','wb');205 $zip = new fileZip($fp);206 $zip->addExclusion('#(^|/).(.*?)_(m|s|sq|t).jpg$#');207 $zip->addDirectory($core->media->root.'/'.$d,'',true);208 209 header('Content-Disposition: attachment;filename='.date('Y-m-d').'-'.$core->blog->id.'-'.($d ? $d : 'media').'.zip');210 header('Content-Type: application/x-zip');211 $zip->write();212 unset($zip);213 exit;214 }215 catch (Exception $e)216 {217 $core->error->add($e->getMessage());218 225 } 219 226 }
Note: See TracChangeset
for help on using the changeset viewer.