Changeset 7304
- Timestamp:
- 12/01/08 08:36:39 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/htdocs/recordings/modules/voicemail.module
r7244 r7304 897 897 if (is_file($msg_path)) { 898 898 $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); 900 905 if ($num > $lastNum) { 901 906 $lastNum = $num; 902 907 $lastNumLen = strlen($lastNum); 903 908 } 904 } 905 } 906 } 909 } 910 } 911 } 907 912 } 908 913 else { … … 916 921 } 917 922 918 // copy files to new location, incrementing each message number 919 asort($files Plain);920 foreach($files Plainas $key => $path) {923 // copy files to new location, incrementing each message number 924 asort($files); 925 foreach($files as $key => $path) { 921 926 922 927 // get file parts for search … … 933 938 $src = $path . $fn; 934 939 $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; 936 946 $dst = appendPath($path_rx,$folder_rx); 937 947 if (is_writable($src) && is_writable($path_rx)) { … … 949 959 } 950 960 951 if ($delete_moved) {961 if ($delete_moved) { 952 962 unlink($src); 953 }963 } 954 964 } 955 965 else {
