Changeset 23592


Ignore:
Timestamp:
06/27/13 16:16:10 (6 years ago)
Author:
plg
Message:

clean spaces and dashes as well as underscores in filenames (see r23591)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/download_by_size/main.inc.php

    r23590 r23592  
    8585  $replace = array($row['id'], $row['filename']); 
    8686 
    87   if (!empty($row['author'])) $replace[] = $row['author']; 
    88   else $replace[] = null; 
    89    
    90   if (!empty($filesize)) $replace[] = $filesize['width'].'x'.$filesize['height']; 
    91   else $replace[] = null; 
     87  $replace[2] = empty($row['author']) ? null : $row['author']; 
     88  $replace[3] = empty($filesize) ? null : $filesize['width'].'x'.$filesize['height']; 
    9289 
    9390  $filename = str_replace($search, $replace, $conf['download_by_size_file_pattern']); 
    94   $filename = preg_replace(array('#_+#', '#^_#', '#_$#'), array('_', null, null), $filename); 
    95  
     91  $filename = preg_replace( 
     92    array('#_+#', '#-+#', '# +#', '#^([_\- ]+)#', '#([_\- ]+)$#'), 
     93    array('_', '-', ' ', null, null), 
     94    $filename 
     95    ); 
     96   
    9697  if (empty($filename) || $filename == $conf['download_by_size_file_pattern']) 
    9798  { 
Note: See TracChangeset for help on using the changeset viewer.