Add support for using mpd as a backend music-playing
[adorno.git] / inc / header.php
blob2029e0ffee15cf50e25530849b2b38139e6dfe22
1 <?php
3 /////////////////////////////////////////////////////////
4 // Work out our page title
5 /////////////////////////////////////////////////////////
6 $refresh_time = 90;
7 if ( !isset($page_title) || $page_title == "" ) {
8 $current_track = current_track();
9 if ( is_object($current_track) ) {
10 $page_title = "$current_track->title : $current_track->album : $current_track->artist ";
11 $refresh_time = ( $current_track->finishing - time() ) + 5;
12 if ( $refresh_time < 0 ) $refresh_time = 180;
13 if ( $refresh_time < 90 && $refresh_time > 30 ) $refresh_time = 90;
14 error_log( "$sysabbr: DBG: Title >>$page_title<< Finish >>$current_track->finishing >>".time()." >>$refresh_time");
18 $refresh_url = $letter_get;
19 if ( isset($a) )
20 $refresh_url .= "&a=".urlencode($a);
21 else if ( isset($l) )
22 $refresh_url .= "&l=".urlencode($l);
23 $refresh_url = "http://$HTTP_HOST$PHP_SELF?act=no" . $refresh_url;
25 if ( isset($refresh) && ! $refresh) {
26 // Don't add a refresh header
27 error_log("Refresh forced off");
28 $meta_refresh = "";
30 else if ( "$submit" != "" ) {
31 daemon_other_command($action,$track);
32 $meta_refresh = "$refresh_time;URL=$refresh_url" ;
33 header("Refresh: ".$meta_refresh);
35 else if ( !isset($a) && !isset($t) ) {
36 $meta_refresh = $refresh_time;
37 header("Refresh: ".$meta_refresh);
39 else {
40 $meta_refresh = "$refresh_time; URL=$refresh_url" ;
41 header("Refresh: ".$meta_refresh);
43 error_log("Refresh header was : $meta_refresh");
45 if ( !isset($stylesheet) ) $stylesheet = "adorno.css";
46 echo <<<DOCHEADER
47 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN" "http://www.w3.org/TR/html4/DTD/html4-strict.dtd">
48 <html>
49 <head>
50 <title>$page_title</title>
51 <meta name="MSSmartTagsPreventParsing" content="TRUE">
52 <meta name="Refresh" content="$meta_refresh">
53 <link rel="stylesheet" type="text/css" href="$stylesheet" />
54 </head>
56 DOCHEADER;
58 include("menu.php");