1) Corrected errors with relative paths that prevented sounds from
[squirrelmail.git] / plugins / newmail / testsound.php
index b52c365103435ea3b916ace7b3dfb7b4af7cc030..d52b5ba5bbb0c2b6b012554f788d3e0d7c4dbe46 100644 (file)
@@ -13,27 +13,30 @@ define('SM_PATH','../../');
 
 /* SquirrelMail required files. */
 require_once(SM_PATH . 'include/validate.php');
+require_once(SM_PATH . 'functions/global.php');
 require_once(SM_PATH . 'functions/html.php');
 
-if (!isset($_GET['sound'])) {
-    $sound = 'Click.wav';
-} else {
-    $sound = $_GET['sound'];
-}
+displayHtmlHeader( _("Test Sound"), '', FALSE );
 
-$sound = str_replace('../plugins/newmail/', '', $sound);
-$sound = str_replace('../', '', $sound);
-$sound = str_replace("..\\", '', $sound);
+echo '<body bgcolor="'.$color[4].'" topmargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0>'."\n";
 
-   displayHtmlHeader( _("Test Sound"), '', FALSE );
+if ( ! sqgetGlobalVar('sound', $sound, SQ_GET) ) {
+    $sound = 'Click.wav';
+} elseif ( $sound == '(none)' ) {
+    echo '<center><form><br /><br />'.
+         '<b>' . _("No sound specified") . '</b><br /><br />'.
+         '<input type="button" name="close" value="' . _("Close") . '" onClick="window.close()">'.
+         '</form></center>'.
+         '</body></html>';
+    return;
+}
 
-   echo "<body bgcolor=\"$color[4]\" topmargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0>\n".
-        html_tag( 'table',
-            html_tag( 'tr',
-                html_tag( 'td',
+echo html_tag( 'table',
+         html_tag( 'tr',
+             html_tag( 'td',
                     "<embed src=\"$sound\" hidden=true autostart=true>".
                     '<br>'.
-                    '<b>' . _("Loading the sound...") . '</b><br><br>'.
+                    '<b>' . _("Loading the sound...") . '</b><br>'.
                     '<form>'.
                     '<input type="button" name="close" value="  ' .
                     _("Close") .
@@ -43,5 +46,4 @@ $sound = str_replace("..\\", '', $sound);
             ) ,
         'center' ) .
         '</body></html>';
-
 ?>