Add preview pane to advanced default template. This serves as an example of how...
[squirrelmail.git] / plugins / newmail / loadfile.php
index 8a32ab13929aa8632635022b5b4c1065c940a991..a452063929b266a72bc06780ff84162689eddab1 100644 (file)
@@ -1,21 +1,22 @@
 <?php
+
 /**
  * SquirrelMail NewMail plugin
  *
  * Script loads user's media file.
+ *
+ * @copyright &copy; 2001-2007 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
  * @subpackage newmail
  */
 
 /**
- * define SM_PATH 
+ * Path for SquirrelMail required files.
  * @ignore
  */
-define('SM_PATH','../../');
-
-/** Load squirrelmail functions */
-include_once(SM_PATH . 'include/validate.php');
+require('../../include/init.php');
 /** Load plugin functions */
 include_once(SM_PATH . 'plugins/newmail/functions.php');
 
@@ -25,10 +26,10 @@ global $data_dir;
 $media = getPref($data_dir,$username,'newmail_media', '(none)');
 // get other prefs
 $newmail_userfile_type=getPref($data_dir,$username,'newmail_userfile_type',false);
-    
+
 $newmail_userfile_location=getHashedFile($username, $data_dir, $username . '.sound');
 
-if ($newmail_userfile_type!=false && file_exists($newmail_userfile_location)) {
+if ($newmail_uploadsounds && $newmail_userfile_type!=false && file_exists($newmail_userfile_location)) {
     // open media file
     $newmail_userfile_handle = fopen($newmail_userfile_location,'rb');
     if ($newmail_userfile_handle) {
@@ -79,4 +80,3 @@ if ($newmail_userfile_type!=false && file_exists($newmail_userfile_location)) {
     } // failed to open userfile
 } // userfile is missing or preferences don't store file type.
 // maybe we should send some error code
-?>
\ No newline at end of file