greyhound.php
changeset 44 92dd253f501c
parent 40 bd3372a2afc1
child 45 7978f037eab3
--- a/greyhound.php	Mon Sep 01 16:50:03 2008 -0400
+++ b/greyhound.php	Mon Sep 01 16:51:13 2008 -0400
@@ -12,6 +12,8 @@
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  */
 
+define('GREY_VERSION', '0.1a4');
+
 // Try to trap termination signals to cleanly close the socket when needed
 // AmaroK sends a SIGTERM when it is shut down or the user requests to stop
 // the script
@@ -37,15 +39,13 @@
 // set this to false, it will only display the playlist.
 $allowcontrol = true;
 // The default theme. This should be a name of a directory in ./themes.
-$theme = 'grey';
+$theme = 'funkymonkey';
 // Allow forking when an HTTP request is received. This has advantages
 // and disadvantages. If this experimental option is enabled, it will
 // result in faster responses and load times but more memory usage.
 $allow_fork = true;
 // set to true to enable authentication
-// WARNING: THIS HAS SOME SERIOUS SECURITY PROBLEMS RIGHT NOW. I don't
-// know what's causing it to not prompt for authentication from any
-// client after the first successful auth.
+// this uses cookies, so make sure they're enabled in your browser
 $use_auth = false;
 // valid users and passwords
 $auth_data = array(
@@ -69,7 +69,7 @@
 
 // start up...
 
-status('Starting Greyhound Web Control v0.1a3');
+status('Starting Greyhound Web Control v' . GREY_VERSION);
 status('loading files');
 
 require('webserver.php');
@@ -79,6 +79,7 @@
 require(GREY_ROOT . '/json.php');
 require(GREY_ROOT . '/ajax.php');
 require(GREY_ROOT . '/imagetools.php');
+require(GREY_ROOT . '/sessions.php');
 
 // signal handler
 function sigterm($signal)
@@ -102,6 +103,11 @@
   burnout('SimpleXML required to continue. You may have an outdated version of PHP; most versions of PHP 5 have SimpleXML built-in. Check your distribution\'s documentation to find out how to enable PHP\'s SimpleXML support.');
 }
 
+if ( !function_exists('imagepng') || !function_exists('imagecopyresampled') || !function_exists('imagecreatefromjpeg') || !function_exists('imagecreatefromwbmp') )
+{
+  warning('Can\'t find support for GD 2.0. Artwork will not be displayed. Look around in your distro\'s package manager for php-gd or php5-gd.');
+}
+
 status('initializing playlist');
 
 // init playlist object
@@ -121,6 +127,8 @@
   // setup handlers
   status('initializing handlers');
   $httpd->add_handler('index',                'function', 'amarok_playlist');
+  $httpd->add_handler('login',                'function', 'greyhound_login_page');
+  $httpd->add_handler('logout',               'function', 'greyhound_logout');
   $httpd->add_handler('action.json',          'function', 'ajax_request_handler');
   $httpd->add_handler('artwork',              'function', 'artwork_request_handler');
   $httpd->add_handler('scripts',              'dir',      GREY_ROOT . '/scripts');