diff --git a/web/zm_funcs.php b/web/zm_funcs.php index 2ccda8759..20b133b63 100644 --- a/web/zm_funcs.php +++ b/web/zm_funcs.php @@ -166,6 +166,22 @@ function getStreamSrc( $args ) return( $stream_src ); } +function getMimeType( $file ) +{ + if ( function_exists('mime_content_type ') ) + { + return( mime_content_type( $file ) ); + } + elseif ( function_exists('finfo_file ') ) + { + $finfo = finfo_open( FILEINFO_MIME ); + $mimetype = finfo_file( $finfo, $file ); + finfo_close($finfo); + return( $mimetype ); + } + return( trim( exec( 'file -bi '.escapeshellarg( $file ) ) ) ); +} + function outputVideoStream( $src, $width, $height, $name, $format ) { switch ( $format ) diff --git a/web/zm_xhtml.php b/web/zm_xhtml.php index 372bd79ca..a18dc1e17 100644 --- a/web/zm_xhtml.php +++ b/web/zm_xhtml.php @@ -45,12 +45,6 @@ require_once( 'zm_lang.php' ); require_once( 'zm_funcs.php' ); require_once( 'zm_xhtml_config.php' ); -noCacheHeaders(); -header("Content-type: application/xhtml+xml" ); - -echo( ''."\n" ); -echo( ''."\n" ); - ob_start(); if ( !isset($user) && ZM_OPT_USE_AUTH ) diff --git a/web/zm_xhtml_view_console.php b/web/zm_xhtml_view_console.php index 491ded6e1..dd796bf05 100644 --- a/web/zm_xhtml_view_console.php +++ b/web/zm_xhtml_view_console.php @@ -83,7 +83,12 @@ for ( $i = 0; $i < count($monitors); $i++ ) } $monitors[$i] = array_merge( $monitors[$i], $counts ); } + +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangConsole ?> diff --git a/web/zm_xhtml_view_devices.php b/web/zm_xhtml_view_devices.php index a98775f3a..5157151b5 100644 --- a/web/zm_xhtml_view_devices.php +++ b/web/zm_xhtml_view_devices.php @@ -25,7 +25,12 @@ foreach ( dbFetchAll( $sql ) as $row ) $row['Status'] = getDeviceStatusX10( $row['KeyString'] ); $devices[] = $row; } + +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangDevices ?> diff --git a/web/zm_xhtml_view_error.php b/web/zm_xhtml_view_error.php index 4cefa08a4..5f500b9be 100644 --- a/web/zm_xhtml_view_error.php +++ b/web/zm_xhtml_view_error.php @@ -18,7 +18,11 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangError ?> diff --git a/web/zm_xhtml_view_event.php b/web/zm_xhtml_view_event.php index 2cdf23ae2..fab3f3cc5 100644 --- a/web/zm_xhtml_view_event.php +++ b/web/zm_xhtml_view_event.php @@ -81,7 +81,11 @@ $frames_per_line = 3; $paged = $event['Frames'] > $frames_per_page; +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangEvent ?> - <?= $event['Name'] ?> diff --git a/web/zm_xhtml_view_eventdetails.php b/web/zm_xhtml_view_eventdetails.php index f24f3d734..05b7a0fda 100644 --- a/web/zm_xhtml_view_eventdetails.php +++ b/web/zm_xhtml_view_eventdetails.php @@ -75,7 +75,11 @@ function getThumbnail( $event, $fid, $scale ) return( $thumb_image ); } +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangEvent ?> <?= $eid ?> diff --git a/web/zm_xhtml_view_events.php b/web/zm_xhtml_view_events.php index bcf4e870b..7b9d99c31 100644 --- a/web/zm_xhtml_view_events.php +++ b/web/zm_xhtml_view_events.php @@ -90,7 +90,11 @@ elseif ( !empty( $limit ) ) $events_sql .= " limit 0, $limit"; } +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangEvents ?> diff --git a/web/zm_xhtml_view_filter.php b/web/zm_xhtml_view_filter.php index 8eb9cc8cc..b7566ea26 100644 --- a/web/zm_xhtml_view_filter.php +++ b/web/zm_xhtml_view_filter.php @@ -30,7 +30,11 @@ foreach( dbFetchAll( $sql ) as $row ) $filter_names[$row['Name']] = $row['Name']; } +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangEventFilter ?> diff --git a/web/zm_xhtml_view_frame.php b/web/zm_xhtml_view_frame.php index b2f701097..c6d147c84 100644 --- a/web/zm_xhtml_view_frame.php +++ b/web/zm_xhtml_view_frame.php @@ -50,7 +50,11 @@ $image_data = getImageSrc( $event, $frame, $scale, (isset($show)&&$show=="capt") $image_path = $image_data['thumbPath']; $event_path = $image_data['eventPath']; +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangFrame ?> <?= $eid."-".$fid ?> diff --git a/web/zm_xhtml_view_function.php b/web/zm_xhtml_view_function.php index 11b1321ab..c22baff19 100644 --- a/web/zm_xhtml_view_function.php +++ b/web/zm_xhtml_view_function.php @@ -25,7 +25,11 @@ if ( !canEdit( 'Monitors' ) ) } $monitor = dbFetchMonitor( $mid ); +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangFunction ?> - <?= $monitor['Name'] ?> diff --git a/web/zm_xhtml_view_login.php b/web/zm_xhtml_view_login.php index 788d4bf7e..cd6a027e1 100644 --- a/web/zm_xhtml_view_login.php +++ b/web/zm_xhtml_view_login.php @@ -18,7 +18,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangLogin ?> diff --git a/web/zm_xhtml_view_montage.php b/web/zm_xhtml_view_montage.php index f2ffdbcc8..4afed0e15 100644 --- a/web/zm_xhtml_view_montage.php +++ b/web/zm_xhtml_view_montage.php @@ -43,7 +43,11 @@ foreach( dbFetchAll( $sql ) as $row ) $monitors[] = $row; } +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangMontage ?> diff --git a/web/zm_xhtml_view_state.php b/web/zm_xhtml_view_state.php index 36ef26687..1fedd9c81 100644 --- a/web/zm_xhtml_view_state.php +++ b/web/zm_xhtml_view_state.php @@ -27,7 +27,11 @@ $running = daemonCheck(); $status = dbFetchAll( "select * from States" ); +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangState ?> diff --git a/web/zm_xhtml_view_video.php b/web/zm_xhtml_view_video.php index b414c5726..de4d9f41e 100644 --- a/web/zm_xhtml_view_video.php +++ b/web/zm_xhtml_view_video.php @@ -123,12 +123,18 @@ if ( $dir = opendir( $event_path ) ) if ( isset($download) ) { + header( "Content-type: ".getMimeType($video_files[$download])); + header( "Content-length: ".filesize($video_files[$download])); header( "Content-disposition: attachment; filename=".preg_replace( "/^.*\//", "", $video_files[$download] )."; size=".filesize($video_files[$download]) ); readfile( $video_files[$download] ); exit; } +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangVideo ?> - <?= $event['Name'] ?> diff --git a/web/zm_xhtml_view_watch.php b/web/zm_xhtml_view_watch.php index c093b26d2..d37300558 100644 --- a/web/zm_xhtml_view_watch.php +++ b/web/zm_xhtml_view_watch.php @@ -83,7 +83,12 @@ $prev_mid = $mon_idx==0?$mon_index[(count($monitors)-1)]['Id']:$monitors[$mon_id $scale = getDeviceScale( $monitor['Width'], $monitor['Height'] ); $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) ); + +noCacheHeaders(); +header("Content-type: application/xhtml+xml" ); +echo( ''."\n" ); ?> + <?= ZM_WEB_TITLE_PREFIX ?> - <?= $monitor['Name'] ?> - <?= $zmSlangWatch ?>