greyhound.php
changeset 31 48004643a8a5
parent 29 8210fdc7c317
child 34 3b817b961984
equal deleted inserted replaced
30:4421e2bb4400 31:48004643a8a5
    93   global $httpd;
    93   global $httpd;
    94   status("Caught SIGTERM, cleaning up.");
    94   status("Caught SIGTERM, cleaning up.");
    95   exit(0);
    95   exit(0);
    96 }
    96 }
    97 
    97 
       
    98 status('doing PHP capabilities check');
       
    99 if ( !function_exists('pcntl_signal') )
       
   100 {
       
   101   warning('System does not support POSIX functions. Termination signals will result in unclean shutdown.');
       
   102 }
       
   103 
       
   104 if ( !function_exists('simplexml_load_file') )
       
   105 {
       
   106   warning('Can\'t find support for SimpleXML, which is needed to parse the Amarok playlist file.');
       
   107   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.');
       
   108 }
       
   109 
    98 status('initializing playlist');
   110 status('initializing playlist');
    99 
   111 
   100 // init playlist object
   112 // init playlist object
   101 $playlist = array();
   113 $playlist = array();
   102 rebuild_playlist();
   114 rebuild_playlist();
   106 $port = 7447;
   118 $port = 7447;
   107 
   119 
   108 try
   120 try
   109 {
   121 {
   110   status('starting PhpHttpd');
   122   status('starting PhpHttpd');
   111   status('doing PHP capabilities check');
       
   112   if ( !function_exists('pcntl_signal') )
       
   113   {
       
   114     warning('System does not support POSIX functions. Termination signals will result in unclean shutdown.');
       
   115   }
       
   116   $httpd = new WebServer($ip, $port);
   123   $httpd = new WebServer($ip, $port);
   117   
   124   
   118   // setup handlers
   125   // setup handlers
   119   status('initializing handlers');
   126   status('initializing handlers');
   120   $httpd->add_handler('index',                'function', 'amarok_playlist');
   127   $httpd->add_handler('index',                'function', 'amarok_playlist');