Changeset 7304

Show
Ignore:
Timestamp:
12/01/08 08:36:39 (4 years ago)
Author:
sasargen
Message:

fixes #3416, prevents ARI forwarding from mangling voicemail mp3 files created by Serge Mankovski's Voicemail RSS plug-in

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/recordings/modules/voicemail.module

    r7244 r7304  
    897897          if (is_file($msg_path)) { 
    898898            $path_parts = pathinfo($msg_path); 
    899             $num = preg_replace("/[a-zA-Z]|\./",'', $path_parts['basename']); 
     899            //fix for Serge Mankovski's "Voicemail RSS" 
     900            //split file basename into two pieces at the first '.' 
     901            //so that files like msg0000.7025f35d463ebbafa101db8a88c71b681aa8443d.mp3 
     902            //don't interfere with finding the true last file number 
     903            list($name,$ext) = split("\.",$path_parts['basename'],2); 
     904            $num = preg_replace("/[a-zA-Z]/",'', $name); 
    900905            if ($num > $lastNum) { 
    901906              $lastNum = $num; 
    902907              $lastNumLen = strlen($lastNum); 
    903908            } 
    904           } 
    905         } 
    906       } 
     909          }  
     910        } 
     911      }  
    907912    } 
    908913    else { 
     
    916921    } 
    917922 
    918     // copy files to new location, incrementing each message number 
    919     asort($filesPlain); 
    920     foreach($filesPlain as $key => $path) { 
     923    // copy files to new location, incrementing each message number  
     924    asort($files); 
     925    foreach($files as $key => $path) { 
    921926 
    922927      // get file parts for search 
     
    933938            $src = $path . $fn; 
    934939            $path_parts = pathinfo($src); 
    935             $folder_rx = preg_replace("/\d+/",sprintf("%0" . $lastNumLen . "d",$lastNum),$path_parts['basename']); 
     940            //fix for Serge Mankovski's "Voicemail RSS" 
     941            //split file basename into two pieces at the first '.' 
     942            //so that files like msg0000.7025f35d463ebbafa101db8a88c71b681aa8443d.mp3 
     943            //don't get clobbered by preg_replace() of digits 
     944            list($name,$ext) = split("\.",$path_parts['basename'],2); 
     945            $folder_rx = preg_replace("/\d+/",sprintf("%0" . $lastNumLen . "d",$lastNum),$name) . "." . $ext;  
    936946            $dst = appendPath($path_rx,$folder_rx); 
    937947            if (is_writable($src) && is_writable($path_rx)) { 
     
    949959              } 
    950960 
    951              if ($delete_moved) { 
     961              if ($delete_moved) { 
    952962                unlink($src); 
    953              
     963             
    954964            } 
    955965            else {