X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=fs_selfservice%2Ffri%2Fmisc%2Faudio.php;fp=fs_selfservice%2Ffri%2Fmisc%2Faudio.php;h=2dc355cb30e46ec96f574bb0f747309634be4760;hb=3a17b276638200475d54201fa62566b7440e819a;hp=0000000000000000000000000000000000000000;hpb=46c6025ca0759b96e5bd16e7ce4b16d4df8a0988;p=freeside.git
diff --git a/fs_selfservice/fri/misc/audio.php b/fs_selfservice/fri/misc/audio.php
new file mode 100644
index 000000000..2dc355cb3
--- /dev/null
+++ b/fs_selfservice/fri/misc/audio.php
@@ -0,0 +1,61 @@
+decrypt($_GET['recording'],$ARI_CRYPT_PASSWORD);
+
+ // strip ".." from path for security
+ $path = preg_replace('/\.\./','',$path);
+
+ // See if the file exists
+ if (!is_file($path)) { die("404 File not found!"); }
+
+ // Gather relevent info about file
+ $size = filesize($path);
+ $name = basename($path);
+ $extension = strtolower(substr(strrchr($name,"."),1));
+
+ // This will set the Content-Type to the appropriate setting for the file
+ $ctype ='';
+ switch( $extension ) {
+ case "mp3": $ctype="audio/mpeg"; break;
+ case "wav": $ctype="audio/x-wav"; break;
+ case "Wav": $ctype="audio/x-wav"; break;
+ case "WAV": $ctype="audio/x-wav"; break;
+ case "gsm": $ctype="audio/x-gsm"; break;
+
+ // not downloadable
+ default: die("404 File not found!"); break ;
+ }
+
+ // need to check if file is mislabeled or a liar.
+ $fp=fopen($path, "rb");
+ if ($size && $ctype && $fp) {
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
+ header("Content-Description: wav file");
+ header("Content-Type: " . $ctype);
+ header("Content-Disposition: attachment; filename=" . $name);
+ header("Content-Transfer-Encoding: binary");
+ header("Content-length: " . $size);
+ fpassthru($fp);
+ }
+}
+
+?>
\ No newline at end of file