diff options
author | ivan <ivan> | 2008-03-16 19:58:33 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-03-16 19:58:33 +0000 |
commit | 3a17b276638200475d54201fa62566b7440e819a (patch) | |
tree | e287d32efc93c5924bc63dec88a79d36e4383961 /fs_selfservice/fri/misc | |
parent | 46c6025ca0759b96e5bd16e7ce4b16d4df8a0988 (diff) |
Diffstat (limited to 'fs_selfservice/fri/misc')
-rw-r--r-- | fs_selfservice/fri/misc/audio.php | 61 | ||||
-rw-r--r-- | fs_selfservice/fri/misc/popup.css | 10 | ||||
-rw-r--r-- | fs_selfservice/fri/misc/recording_popup.php | 46 |
3 files changed, 117 insertions, 0 deletions
diff --git a/fs_selfservice/fri/misc/audio.php b/fs_selfservice/fri/misc/audio.php new file mode 100644 index 0000000..2dc355c --- /dev/null +++ b/fs_selfservice/fri/misc/audio.php @@ -0,0 +1,61 @@ +<?php + +/** + * @file + * plays recording file + */ + + + +if (isset($_GET['recording'])) { + + chdir(".."); + include_once("./includes/bootstrap.php"); + + global $ARI_CRYPT_PASSWORD; + + $crypt = new Crypt(); + + $path = $crypt->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("<b>404 File not found!</b>"); } + + // 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("<b>404 File not found!</b>"); 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 diff --git a/fs_selfservice/fri/misc/popup.css b/fs_selfservice/fri/misc/popup.css new file mode 100644 index 0000000..7a53528 --- /dev/null +++ b/fs_selfservice/fri/misc/popup.css @@ -0,0 +1,10 @@ +/* + * popup + */ + +.popup_download { + color: #105D90; + margin: 250px; + font-size: 12px; + text-align: right; +}
\ No newline at end of file diff --git a/fs_selfservice/fri/misc/recording_popup.php b/fs_selfservice/fri/misc/recording_popup.php new file mode 100644 index 0000000..1546adc --- /dev/null +++ b/fs_selfservice/fri/misc/recording_popup.php @@ -0,0 +1,46 @@ +<?php + +/** + * @file + * popup window for playing recording + */ + +chdir(".."); +include_once("./includes/bootstrap.php"); + +?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <TITLE>ARI</TITLE> + <link rel="stylesheet" href="popup.css" type="text/css"> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> + </head> + <body> + +<?php + + global $ARI_CRYPT_PASSWORD; + + $crypt = new Crypt(); + + $path = $crypt->encrypt($_GET['recording'],$ARI_CRYPT_PASSWORD); + + if (isset($path)) { + if (isset($_GET['date'])) { + echo($_GET['date'] . "<br>"); + } + if (isset($_GET['time'])) { + echo($_GET['time'] . "<br>"); + } + echo("<br>"); + echo("<embed src='audio.php?recording=" . $path . "' width=300, height=20 autoplay=true loop=false></embed><br>"); + echo("<a class='popup_download' href=/recordings/misc/audio.php?recording=" . $path . ">" . _("download") . "</a><br>"); + } + +?> + + </body> +</html> + |