Source for file loadfile.php
Documentation is available at loadfile.php
* SquirrelMail NewMail plugin
* Script loads user's media file.
* @copyright 2001-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: loadfile.php 14845 2020-01-07 08:09:34Z pdontthink $
* Path for SquirrelMail required files.
require
('../../include/init.php');
/** Load plugin functions */
include_once(SM_PATH .
'plugins/newmail/functions.php');
$media =
getPref($data_dir,$username,'newmail_media', '(none)');
$newmail_userfile_type=
getPref($data_dir,$username,'newmail_userfile_type',false);
$newmail_userfile_location=
getHashedFile($username, $data_dir, $username .
'.sound');
if ($newmail_uploadsounds &&
$newmail_userfile_type!=
false &&
file_exists($newmail_userfile_location)) {
$newmail_userfile_handle =
fopen($newmail_userfile_location,'rb');
if ($newmail_userfile_handle) {
$newmail_userfile_filesize =
filesize($newmail_userfile_location);
$newmail_userfile_contents =
fread($newmail_userfile_handle,$newmail_userfile_filesize);
fclose ($newmail_userfile_handle);
// user prefs use only integer values to store file type
switch($newmail_userfile_type) {
$newmail_userfile_contenttype=
'audio/x-wav';
$newmail_userfile_contenttype=
'audio/mpeg';
$newmail_userfile_contenttype=
'application/ogg';
$newmail_userfile_contenttype=
'application/x-shockwave-flash';
$newmail_userfile_contenttype=
'image/svg+xml';
$newmail_userfile_contenttype=
'unknown';
// make sure that media file is in correct format
// last check before sending file contents to browser.
if ($newmail_userfile_extension!=
false) {
$newmail_send_filename=
'mediafile.' .
$newmail_userfile_extension;
header ('Content-Disposition: inline; filename="' .
$newmail_send_filename .
'"');
header('Content-Type: "' .
$newmail_userfile_contenttype .
'"; ' .
'name="' .
$newmail_send_filename .
'"');
header('Content-Length: ' .
$newmail_userfile_filesize );
echo
$newmail_userfile_contents;
} // file type detection failed
} // failed to open userfile
} // userfile is missing or preferences don't store file type.
// maybe we should send some error code
Documentation generated on Mon, 13 Jan 2020 04:22:57 +0100 by phpDocumentor 1.4.3