Current live code.
[adorno.git] / inc / header.php
bloba5d2d1f3ac6b08de88334bcd4557a7a2db7c21d5
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" . ereg_replace('^&','?',$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 $fifo = fopen( "/var/run/adorno/fifo", "w" );
32 if ( ! ereg( "^(/music)|(http://)", "$track" ) ) {
33 $track = "/music" . "$track";
35 # $track = eregi_replace( " ", "\\ ", $track);
36 fputs( $fifo, "$action $track\n" );
37 fclose($fifo);
38 $meta_refresh = "$refresh_time;URL=$refresh_url" ;
39 header("Refresh: ".$meta_refresh);
41 else if ( !isset($a) && !isset($t) ) {
42 $meta_refresh = $refresh_time;
43 header("Refresh: ".$meta_refresh);
45 else {
46 $meta_refresh = "$refresh_time; URL=$refresh_url" ;
47 header("Refresh: ".$meta_refresh);
49 error_log("Refresh header was : $meta_refresh");
51 if ( !isset($stylesheet) ) $stylesheet = "adorno.css";
52 echo <<<DOCHEADER
53 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
54 <html>
55 <head>
56 <title>$page_title</title>
57 <meta name="MSSmartTagsPreventParsing" content="TRUE">
58 <meta name="Refresh" content="$meta_refresh">
59 <link rel="stylesheet" type="text/css" href="$stylesheet" />
60 </head>
62 DOCHEADER;
64 include("menu.php");