From d1416322561730c47000bf9a6acbcbc8128a29c2 Mon Sep 17 00:00:00 2001
From: Isaac Connor
$shell_command"
);
} else {
- ZM\Logger::Debug( "Results from probe: " . implode( '
', $output ) );
+ ZM\Logger::Debug('Results from probe: '.implode('
', $output));
}
return $output;
}
-function probeCameras( $localIp ) {
+function probeCameras($localIp) {
$cameras = array();
- if ( $lines = @execONVIF( 'probe' ) ) {
+ if ( $lines = @execONVIF('probe') ) {
foreach ( $lines as $line ) {
- $line = rtrim( $line );
- if ( preg_match( '|^(.+),(.+),\s\((.*)\)$|', $line, $matches ) ) {
+ $line = rtrim($line);
+ if ( preg_match('|^(.+),(.+),\s\((.*)\)$|', $line, $matches) ) {
$device_ep = $matches[1];
$soapversion = $matches[2];
$camera = array(
@@ -65,7 +65,7 @@ function probeCameras( $localIp ) {
),
);
foreach ( preg_split('|,\s*|', $matches[3]) as $attr_val ) {
- if ( preg_match( '|(.+)=\'(.*)\'|', $attr_val, $tokens ) ) {
+ if ( preg_match('|(.+)=\'(.*)\'|', $attr_val, $tokens) ) {
if ( $tokens[1] == 'hardware' ) {
$camera['model'] = $tokens[2];
} elseif ( $tokens[1] == 'name' ) {
@@ -84,7 +84,7 @@ function probeCameras( $localIp ) {
return $cameras;
} // end function probeCameras
-function probeProfiles( $device_ep, $soapversion, $username, $password ) {
+function probeProfiles($device_ep, $soapversion, $username, $password) {
$profiles = array();
if ( $lines = @execONVIF("profiles $device_ep $soapversion $username $password") ) {
foreach ( $lines as $line ) {
@@ -94,7 +94,7 @@ function probeProfiles( $device_ep, $soapversion, $username, $password ) {
// add user@pass to URI
if ( preg_match('|^(\S+://)(.+)$|', $stream_uri, $tokens) ) {
$stream_uri = $tokens[1].$username.':'.$password.'@'.$tokens[2];
- }
+ }
$profile = array( # 'monitor' part of camera
'Type' => 'Ffmpeg',
@@ -125,8 +125,8 @@ xhtmlHeaders(__FILE__, translate('MonitorProbe') );
if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
$monitors = array();
- foreach ( dbFetchAll("SELECT Id, Name, Host FROM Monitors WHERE Type = 'Remote' ORDER BY Host") as $monitor ) {
- if ( preg_match( '/^(.+)@(.+)$/', $monitor['Host'], $matches ) ) {
+ foreach ( dbFetchAll("SELECT Id, Name, Host FROM Monitors WHERE Type='Remote' ORDER BY Host") as $monitor ) {
+ if ( preg_match('/^(.+)@(.+)$/', $monitor['Host'], $matches) ) {
//echo "1: ".$matches[2]." = ".gethostbyname($matches[2])."
";
$monitors[gethostbyname($matches[2])] = $monitor;
} else {
@@ -137,26 +137,12 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
$detcameras = probeCameras('');
foreach ( $detcameras as $camera ) {
- if ( preg_match( '|([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)|', $camera['monitor']['Host'], $matches ) ) {
+ if ( preg_match('|([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)|', $camera['monitor']['Host'], $matches) ) {
$ip = $matches[1];
}
$host = $ip;
-/*
- if ( isset($monitors[$ip]) )
- {
- $monitor = $monitors[$ip];
- $sourceString .= " (".$monitor['Name'].")";
- }
- else
- {
- $sourceString .= " - ".translate('Available');
- }
- $cameras[$sourceDesc] = $sourceString;
- }
-*/
-// $sourceDesc = htmlspecialchars(serialize($camera['monitor']));
$sourceDesc = base64_encode(json_encode($camera['monitor']));
- $sourceString = $camera['model'].' @ '.$host . ' using version ' . $camera['monitor']['SOAP'] ;
+ $sourceString = $camera['model'].' @ '.$host.' using version '.$camera['monitor']['SOAP'];
$cameras[$sourceDesc] = $sourceString;
}
@@ -179,39 +165,38 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
- 'configureButtons(this)')); ?> + 'configureButtons')); ?>
- - + +
- - + +