Ticket #3443: page.music.php.diff

File page.music.php.diff, 1.6 kB (added by mickecarlsson, 3 years ago)

Patch fixing uppercase uploaded files

  • page.music.php

    old new  
    156156  global $path_to_dir; 
    157157  $pattern = ''; 
    158158  $handle=opendir($path_to_dir) ; 
    159   $extensions = array('mp3','wav'); // list of extensions to match 
     159  $extensions = array('mp3','MP3','wav','WAV'); // list of extensions to match 
    160160   
    161161  //generate the pattern to look for. 
    162162  $pattern = '/(\.'.implode('|\.',$extensions).')$/i'; 
     
    204204      $newname = substr($mohfile,0,strrpos($mohfile,".")); 
    205205 
    206206      // If we are dealing with an MP3, we need to decode it to a wav file 
    207       if (strpos($origmohfile,'.mp3') !== false)  {  
     207      if (strpos($origmohfile,'.mp3') | strpos($origmohfile,'.MP3') !== false)  {  
    208208        $mpg123cmd = "mpg123 -w \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\" \"".$origmohfile."\" 2>&1 "; 
    209209        exec($mpg123cmd, $output, $returncode); 
    210210      } 
    211211      $newmohfile = $path_to_dir."/wav_".$newname.".wav"; 
    212212      //asdf 
    213       $soxcmd = "sox \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\""; 
     213      $soxcmd = "sox \"".$origmohfile."\""; 
    214214      $soxcmd .= " -r 8000 -c 1 \"".$newmohfile."\""; 
    215215      if($volume){ 
    216216        $soxcmd .= " vol ".$volume; 
     
    259259    // If this started as an mp3, we converted it to a wav and then transcoded it from there,  
    260260    // so we have two "original" files to delete 
    261261    // 
    262     if (strpos($origmohfile,'.mp3') !== false)  { 
     262    if (strpos($origmohfile,'.mp3') | strpos($origmohfile,'.MP3') !== false)  { 
    263263      $rmcmd="rm -f \"". substr($origmohfile,0,strrpos($origmohfile,".")).".wav\""; 
    264264      exec($rmcmd); 
    265265    }