playlist.php
changeset 44 92dd253f501c
parent 40 bd3372a2afc1
--- a/playlist.php	Mon Sep 01 16:50:03 2008 -0400
+++ b/playlist.php	Mon Sep 01 16:51:13 2008 -0400
@@ -16,28 +16,14 @@
 function amarok_playlist($httpd, $socket)
 {
   global $theme, $playlist, $allowcontrol;
-  global $use_auth, $auth_data;
+  global $use_auth;
   
-  if ( $use_auth )
+  if ( !session_check() )
   {
-    if ( !isset($_SERVER['PHP_AUTH_USER']) )
-    {
-      $httpd->header('WWW-Authenticate: basic');
-      $httpd->send_http_error($socket, 401, "A username and password are required to access this resource. Either you did not specify a username and password, or the supplied credentials were incorrect.");
-      return true;
-    }
-    if ( !isset($auth_data[$_SERVER['PHP_AUTH_USER']]) )
-    {
-      $httpd->header('WWW-Authenticate: basic');
-      $httpd->send_http_error($socket, 401, "A username and password are required to access this resource. Either you did not specify a username and password, or the supplied credentials were incorrect.");
-      return true;
-    }
-    else if ( $auth_data[$_SERVER['PHP_AUTH_USER']] !== $_SERVER['PHP_AUTH_PW'] )
-    {
-      $httpd->header('WWW-Authenticate: basic');
-      $httpd->send_http_error($socket, 401, "A username and password are required to access this resource. Either you did not specify a username and password, or the supplied credentials were incorrect.");
-      return true;
-    }
+    $httpd->header('HTTP/1.1 307 Temporary Redirect');
+    $httpd->header('Location: /login');
+    
+    return;
   }
   
   $iphone = ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
@@ -61,6 +47,8 @@
       'position.js'
     ));
   $smarty->assign('allow_control', $allowcontrol);
+  $smarty->assign('use_auth', $use_auth);
+  $smarty->assign('greyhound_version', GREY_VERSION);
   $smarty->register_function('sprite', 'smarty_function_sprite');
   $smarty->display('playlist.tpl');
 }