diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 5571c4e5e..7b414d3e0 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -87,38 +87,37 @@ if (isset($_REQUEST['newMonitor'])) { } # What if it has less zeros? This is not robust code. -if ( $monitor->AnalysisFPSLimit() == '0.00' ) +if ($monitor->AnalysisFPSLimit() == '0.00') $monitor->AnalysisFPSLimit(''); -if ( $monitor->MaxFPS() == '0.00' ) +if ($monitor->MaxFPS() == '0.00') $monitor->MaxFPS(''); -if ( $monitor->AlarmMaxFPS() == '0.00' ) +if ($monitor->AlarmMaxFPS() == '0.00') $monitor->AlarmMaxFPS(''); -if ( !empty($_REQUEST['preset']) ) { - $preset = dbFetchOne( 'SELECT Type, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, DefaultRate, DefaultScale FROM MonitorPresets WHERE Id = ?', NULL, array($_REQUEST['preset']) ); - foreach ( $preset as $name=>$value ) { +if (!empty($_REQUEST['preset'])) { + $preset = dbFetchOne('SELECT Type, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, DefaultRate, DefaultScale FROM MonitorPresets WHERE Id = ?', NULL, array($_REQUEST['preset'])); + foreach ($preset as $name=>$value) { # Does isset handle NULL's? I don't think this code is correct. # Icon: It does, but this means we can't set a null value. - if ( isset($value) ) { + if (isset($value)) { $monitor->$name($value); } } } # end if preset -if ( !empty($_REQUEST['probe']) ) { +if (!empty($_REQUEST['probe'])) { $probe = json_decode(base64_decode($_REQUEST['probe'])); - foreach ( $probe as $name=>$value ) { - if ( isset($value) ) { - # Does isset handle NULL's? I don't think this code is correct. + foreach ($probe as $name=>$value) { + if (isset($value)) { $monitor->$name = urldecode($value); } } - if ( ZM_HAS_V4L2 && $monitor->Type() == 'Local' ) { - $monitor->Palette( fourCC( substr($monitor->Palette,0,1), substr($monitor->Palette,1,1), substr($monitor->Palette,2,1), substr($monitor->Palette,3,1) ) ); - if ( $monitor->Format() == 'PAL' ) - $monitor->Format( 0x000000ff ); - elseif ( $monitor->Format() == 'NTSC' ) - $monitor->Format( 0x0000b000 ); + if (ZM_HAS_V4L2 && ($monitor->Type() == 'Local')) { + $monitor->Palette(fourCC(substr($monitor->Palette,0,1), substr($monitor->Palette,1,1), substr($monitor->Palette,2,1), substr($monitor->Palette,3,1))); + if ($monitor->Format() == 'PAL') + $monitor->Format(0x000000ff); + else if ($monitor->Format() == 'NTSC') + $monitor->Format(0x0000b000); } } # end if apply probe settings @@ -133,14 +132,14 @@ $sourceTypes = array( 'NVSocket' => translate('NVSocket'), 'VNC' => translate('VNC'), ); -if ( !ZM_HAS_V4L2 ) +if (!ZM_HAS_V4L2) unset($sourceTypes['Local']); $localMethods = array( 'v4l2' => 'Video For Linux version 2', ); -if ( !ZM_HAS_V4L2 ) +if (!ZM_HAS_V4L2) unset($localMethods['v4l2']); $remoteProtocols = array( @@ -168,12 +167,12 @@ $httpMethods = array( 'jpegTags' => 'JPEG Tags' ); -if ( !ZM_PCRE ) +if (!ZM_PCRE) unset($httpMethods['regexp']); // Currently unsupported unset($httpMethods['jpegTags']); -if ( ZM_HAS_V4L2 ) { +if (ZM_HAS_V4L2) { $v4l2DeviceFormats = array( 0x000000ff => 'PAL', 0x0000b000 => 'NTSC', @@ -207,7 +206,7 @@ if ( ZM_HAS_V4L2 ) { $v4l2MaxChannels = 31; $v4l2DeviceChannels = array(); - for ( $i = 0; $i <= $v4l2MaxChannels; $i++ ) + for ($i = 0; $i <= $v4l2MaxChannels; $i++) $v4l2DeviceChannels[$i] = $i; $v4l2LocalPalettes = array( @@ -351,7 +350,7 @@ $label_size = array( $codecs = array( 'auto' => translate('Auto'), - 'MP4' => translate('MP4'), + 'MP4' => translate('MP4'), 'MJPEG' => translate('MJPEG'), ); @@ -362,11 +361,10 @@ xhtmlHeaders(__FILE__, translate('Monitor').' - '.validHtmlStr($monitor->Name()) getBodyTopHTML(); echo getNavBarHTML(); ?> -