playlist.php
changeset 21 74edc873234f
parent 10 d3059e20b0fa
child 25 5c377ceb0e4c
equal deleted inserted replaced
20:bb8237ca678d 21:74edc873234f
    11  *
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    14  */
    14  */
    15 
    15 
    16 function amarok_playlist($server)
    16 function amarok_playlist($httpd, $socket)
    17 {
    17 {
    18   global $theme, $playlist, $allowcontrol;
    18   global $theme, $playlist, $allowcontrol;
       
    19   global $use_auth, $auth_data;
       
    20   
       
    21   if ( $use_auth )
       
    22   {
       
    23     if ( !isset($_SERVER['PHP_AUTH_USER']) )
       
    24     {
       
    25       $httpd->header('WWW-Authenticate: basic');
       
    26       $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.");
       
    27       return true;
       
    28     }
       
    29     if ( !isset($auth_data[$_SERVER['PHP_AUTH_USER']]) )
       
    30     {
       
    31       $httpd->header('WWW-Authenticate: basic');
       
    32       $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.");
       
    33       return true;
       
    34     }
       
    35     else if ( $auth_data[$_SERVER['PHP_AUTH_USER']] !== $_SERVER['PHP_AUTH_PW'] )
       
    36     {
       
    37       $httpd->header('WWW-Authenticate: basic');
       
    38       $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.");
       
    39       return true;
       
    40     }
       
    41   }
    19   
    42   
    20   $iphone = ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
    43   $iphone = ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
    21        strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
    44        strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') ||
    22        strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
    45        strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
    23        isset($_GET['m']) )
    46        isset($_GET['m']) )