194 changed files with 4117 additions and 572 deletions
-
1.gitignore
-
7index.php
-
7lib/ajax_asm.php
-
5lib/assembler.php
-
72lib/controller/addModule.php
-
12lib/controller/addNode.php
-
BINlib/controller/data/factory.db
-
BINlib/controller/data/mysqlitedb.db
-
1lib/controller/data/mysqlitedb.sqbpro
-
BINlib/controller/data/reports.db
-
BINlib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4
-
BINlib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4
-
BINlib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4
-
BINlib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4
-
BINlib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4
-
BINlib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4
-
BINlib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4
-
BINlib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4
-
BINlib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4
-
108lib/controller/debug.txt
-
116lib/controller/discoverOnvifProfiles.php
-
0lib/controller/discoverOnvifSources.php
-
268lib/controller/doCameraOperation.php
-
13lib/controller/doModuleOperation.php
-
9lib/controller/doNodeOperation.php
-
33lib/controller/doResourceOperation.php
-
BINlib/controller/frame.raw
-
785lib/controller/getCameraEditor.php
-
78lib/controller/getCameraPreview.php
-
31lib/controller/getCameras.php
-
18lib/controller/getModuleEditor.php
-
16lib/controller/getModuleInfo.php
-
2lib/controller/getModuleSettings.php
-
43lib/controller/getModules.php
-
70lib/controller/getResources.php
-
31lib/controller/getServerStatus.php
-
59lib/controller/getVideoFeed.php
-
4lib/controller/help/topic_100.json
-
BINlib/controller/output.jpg
-
15lib/controller/test.sh
-
0lib/controller/validateUserSession.php
-
0lib/controller/zuza/addCameraNode.php
-
0lib/controller/zuza/addConnection.php
-
0lib/controller/zuza/addDetectionProfile.php
-
12lib/controller/zuza/addServerModule.php
-
0lib/controller/zuza/addWidthTableRow.php
-
0lib/controller/zuza/camMakeMove.php
-
0lib/controller/zuza/camStop.php
-
0lib/controller/zuza/checkDeviceOperation.php
-
0lib/controller/zuza/clearEventCloud.php
-
0lib/controller/zuza/clearServerLog.php
-
0lib/controller/zuza/getAnalogStreamCtrl.php
-
0lib/controller/zuza/getCameraSettings.php
-
2lib/controller/zuza/getDashBoardItems.php
-
0lib/controller/zuza/getDashBoardStatus.php
-
0lib/controller/zuza/getDetectionProfile.php
-
0lib/controller/zuza/getDeviceDraw.php
-
0lib/controller/zuza/getDeviceMask.php
-
4lib/controller/zuza/getEventDates.php
-
0lib/controller/zuza/getEventProps.php
-
0lib/controller/zuza/getEventRecords.php
-
0lib/controller/zuza/getGeoAlerts.php
-
3lib/controller/zuza/getGeoZones.php
-
12lib/controller/zuza/getHelpTopic.php
-
0lib/controller/zuza/getIpCamCredentials.php
-
0lib/controller/zuza/getLocationItems.php
-
0lib/controller/zuza/getLocationNodeProps.php
-
0lib/controller/zuza/getLocationNodes.php
-
0lib/controller/zuza/getM3U8.php
-
0lib/controller/zuza/getMaskSchedule.php
-
0lib/controller/zuza/getMaskScheduleEditor.php
-
4lib/controller/zuza/getNetwork.php
-
0lib/controller/zuza/getNetworkNodeProps.php
-
0lib/controller/zuza/getNetworkSe2rverProps.php
-
0lib/controller/zuza/getNodeAdvancedNfo.php
-
0lib/controller/zuza/getNodeBasicNfo.php
-
0lib/controller/zuza/getNodeSettings.php
-
0lib/controller/zuza/getPicture.php
-
0lib/controller/zuza/getResourceInfo.php
-
0lib/controller/zuza/getSettingsLRF.php
-
5lib/controller/zuza/getStatus.php
-
0lib/controller/zuza/getTimeLineEvents.php
-
0lib/controller/zuza/getTimeLineGroups.php
-
0lib/controller/zuza/getWidthTable.php
-
0lib/controller/zuza/getWidthTableEditor.php
-
0lib/controller/zuza/listAccessLog.php
-
53lib/controller/zuza/listAndDiscoverLocalSources.php
-
0lib/controller/zuza/listAndDiscoverOnvifProfiles.php
-
53lib/controller/zuza/listAndDiscoverOnvifSources.php
-
23lib/controller/zuza/listDiscoveredOnvifProfiles.php
-
0lib/controller/zuza/listMediaSources.php
-
0lib/controller/zuza/listNodeSockets.php
-
0lib/controller/zuza/listServerLog.php
-
0lib/controller/zuza/listServers.php
-
0lib/controller/zuza/listUarts.php
-
0lib/controller/zuza/listUsers.php
-
0lib/controller/zuza/removeNode.php
-
0lib/controller/zuza/resetAllSettings.php
-
0lib/controller/zuza/setAnalogStreamCtrl.php
-
0lib/controller/zuza/setSettingsLidsr3D.php
@ -0,0 +1 @@ |
|||
error.log |
|||
@ -0,0 +1,72 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
$UID = intval($CUser->Data['id'] ); |
|||
$ACCESS = intval($CUser->Data['access'] ); |
|||
if( $UID > 1 && $ACCESS > 4 ){ |
|||
$Data['status'] = 'nok'; |
|||
$T = intval( $_POST['TYPE'] ); |
|||
if( $T ){ |
|||
$QS = "SELECT * FROM `module_types` WHERE `id`={$T}"; |
|||
$ZZ = $DATABASE->Query( $QS ); |
|||
if( count( $ZZ ) ){ |
|||
$CTI = $ZZ[0]; |
|||
$ADE = true; |
|||
if( intval( $CTI['allow_multiply'] ) == 0 ){ |
|||
$QS = "SELECT * FROM `modules` WHERE `type`={$T}"; |
|||
$SS = $DATABASE->Query( $QS ); |
|||
if( count( $SS ) ){ |
|||
$ADE = false; |
|||
$Data['msg'] = 'This type of Module can be added only Once!'; |
|||
}; |
|||
}; |
|||
if( $ADE ){ |
|||
$QAS = "INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES({$T},0,0);"; |
|||
$DATABASE->Query( $QAS ); |
|||
$MID = $DATABASE->getLastInsertID(); |
|||
$MCID = 0; |
|||
switch( $T ){ |
|||
case 3:{ |
|||
//Kafka
|
|||
$QS = "INSERT INTO `module_kafka`(`brocker_port`) VALUES(2929)"; |
|||
$DATABASE->Query( $QS ); |
|||
$MCID = $DATABASE->getLastInsertID(); |
|||
$QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; |
|||
$DATABASE->Query( $QS ); |
|||
break; |
|||
}; |
|||
case 6:{ |
|||
//SSDP
|
|||
$QS = "INSERT INTO `module_ssdp`(`serial_number`) VALUES('2929')"; |
|||
$DATABASE->Query( $QS ); |
|||
$MCID = $DATABASE->getLastInsertID(); |
|||
$QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; |
|||
$DATABASE->Query( $QS ); |
|||
break; |
|||
}; |
|||
case 9:{ |
|||
//EmbedVido
|
|||
$QS = "INSERT INTO `module_eve`(`web_port`) VALUES(8972)"; |
|||
$DATABASE->Query( $QS ); |
|||
$MCID = $DATABASE->getLastInsertID(); |
|||
$QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; |
|||
$DATABASE->Query( $QS ); |
|||
break; |
|||
}; |
|||
}; |
|||
$Data['status'] = 'ok'; |
|||
//$fd = fopen( "debug.txt", "a+" );
|
|||
//fprintf( $fd, $DATABASE->getDebugLog() );
|
|||
//fclose( $fd );
|
|||
//$Data['dblog'] = $DATABASE->getDebugLog();
|
|||
}; |
|||
} else { |
|||
$Data['msg'] = 'Wrong Module Type is supplied!'; |
|||
}; |
|||
} else { |
|||
$Data['msg'] = 'No Module Type is supplied!'; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
exit(); |
|||
}; |
|||
header('location: /'); |
|||
?>
|
|||
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="Z:/dr_frucht/Projects/la_mojo/Debug/data/mysqlitedb.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="0"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="2569"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><current_table name="4,6:mainlabels"/><default_encoding codec=""/><browse_table_settings/></tab_browse><tab_sql><sql name="SQL 1"></sql><current_tab id="0"/></tab_sql></sqlb_project> |
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,108 @@ |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=7] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=7] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (2), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=7] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=7] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (2), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=8] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=8] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(8,0,0);] as (3), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (2), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (3), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (4), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (5), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (6), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=7] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=7] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (7), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (8), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=7] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=7] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (9), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=8] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=8] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(8,0,0);] as (10), |
|||
[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), |
|||
[SELECT * FROM users WHERE id=2] as (0), |
|||
[SELECT key, label FROM labels WHERE language_id='1'] as (0), |
|||
[SELECT * FROM `module_types` WHERE `id`=6] as (0), |
|||
[SELECT * FROM `modules` WHERE `type`=6] as (0), |
|||
[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), |
|||
@ -0,0 +1,116 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/onvif/toto.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Data = array(); |
|||
$Data['success'] = false; |
|||
if( isset( $_POST['CID'] ) ){ |
|||
$ECID = intval( $_POST['CID'] ); |
|||
if( $ECID > 0 ){ |
|||
//Check if Camera Already has password and discovered sources!
|
|||
$QS = "SELECT * FROM media_streams WHERE source_id={$ECID}"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
if( count( $Result ) > 0 ){ |
|||
foreach( $Result as $CD ){ |
|||
$cnode['id'] = $CD['id']; |
|||
$cnode['name'] = $CD['name']; |
|||
$cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; |
|||
$cnode['encode'] = $CD['compression_type']; |
|||
$cnode['bitrate'] = $CD['bitrate']; |
|||
$cnode['pic'] = $CD['picture_proto'] . '://' . $IP . ':' . $CD['picture_port'] . $CD['picture']; |
|||
$Data['nodes'][] = $cnode; |
|||
}; |
|||
$Data['success'] = true; |
|||
echo json_encode( $Data ); |
|||
exit(); |
|||
}; |
|||
}; |
|||
$EUser = $DATABASE->escape( $_POST['GUG'] ); |
|||
$EPass = $DATABASE->escape( $_POST['GOG'] ); |
|||
$AUTH = intval( $_POST['GAT'] ); |
|||
$QS = "SELECT * FROM cameras WHERE id = {$ECID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count($Result) ){ |
|||
$IP = $Result[0]['ip']; |
|||
$onvif = new Ponvif(); |
|||
$onvif->setUsername( $EUser ); |
|||
$onvif->setPassword( $EPass ); |
|||
$onvif->setIPAddress( $IP ); |
|||
$onvif->setAuthMethod( $AUTH ); |
|||
try { |
|||
$onvif->initialize(); |
|||
if ( !$onvif->isFault($devices=$onvif->getSources())){// die("Error getting sources");
|
|||
foreach( $devices[0] as $source ) if( is_array( $source ) ){ |
|||
//print_r( $source );
|
|||
$Ename = $DATABASE->escape( $source['profilename']); |
|||
$Etoken = $DATABASE->escape( $source['profiletoken']); |
|||
$Eencode = $DATABASE->escape( $source['encoding']); |
|||
$Ewidth = intval($source['width']); |
|||
$Eheight = intval($source['height']); |
|||
$Efps = intval($source['fps']); |
|||
$Ebitrate = intval($source['bitrate']); |
|||
if( isset( $source['ptz'] ) ){ |
|||
$Eptz = $DATABASE->escape( $source['ptz']['nodetoken'] ); |
|||
} else { |
|||
$Eptz=''; |
|||
}; |
|||
$mrl = $onvif->media_GetStreamUri($source['profiletoken']); |
|||
$pic = $onvif->media_GetSnapshotUri($source['profiletoken']); |
|||
$TPArr = explode(':',$mrl); |
|||
$mrl_proto = $TPArr[0]; |
|||
$mrl_port = intval( $TPArr[2] ); |
|||
if( $mrl_port == 0 ) { |
|||
switch( $mrl_proto ){ |
|||
case 'rtsp': $mrl_port = 554; break; |
|||
case 'http': $mrl_port = 80; break; |
|||
case 'https': $mrl_port = 443; break; |
|||
}; |
|||
}; |
|||
$Emrl = $DATABASE->escape( $mrl ); |
|||
$Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); |
|||
$Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); |
|||
$TPArr = explode(':',$pic ); |
|||
$pic_proto = $TPArr[0]; |
|||
$pic_port = intval( $TPArr[2] ); |
|||
if($pic_port == 0 ) $pic_port = 80; |
|||
$Epic = $DATABASE->escape( $pic ); |
|||
$Epic = str_replace( $pic_proto . '://' . $IP . ':' . $pic_port, '', $Epic ); |
|||
$Epic = str_replace( $pic_proto . '://' . $IP , '', $Epic ); |
|||
$QS = "INSERT INTO `media_streams`(`source_id`,`source_type`,`valid`,`name`,`token`,`img_width`,`img_height`,`compression_type`,`bitrate`,`fps`,`mrl`,`mrl_proto`,`mrl_port`,`picture_proto`,`picture_port`,`picture`) VALUES({$ECID},'D',1,'{$Ename}','{$Etoken}',{$Ewidth},{$Eheight},'{$Eencode}',{$Ebitrate},{$Efps},'{$Emrl}','{$mrl_proto}','{$mrl_port}','{$pic_proto}','{$pic_port}','{$Epic}') ON CONFLICT(`source_id`,`token`) DO UPDATE SET `source_type`='D', `valid`=1, `mrl`='{$Emrl}', `mrl_proto`='{$mrl_proto}', `mrl_port`='{$mrl_port}', `picture_proto`='{$pic_proto}', `picture_port`='{$pic_port}', `picture`='{$Epic}'"; |
|||
$DATABASE->Query( $QS, false ); |
|||
}; |
|||
$QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH}, ptz_token='{$Eptz}' WHERE id={$ECID}"; |
|||
$DATABASE->Query( $QS, false ); |
|||
} else { |
|||
$Data['error'] = 'Provided Credentials are Wrong!'; |
|||
echo json_encode( $Data ); |
|||
exit(); |
|||
}; |
|||
} catch (Exception $e) { |
|||
if( stripos( $e->getMessage(), 'GetCapabilities')!== false ){ |
|||
$Data['error'] = '<p align="center">Camera IP Address is Wrong!</p><p align="center">Please consider run network discovery.</p><p align="center">To refresh all aveable cameras addreses.</p>'; |
|||
} else { |
|||
$Data['error'] = 'Provided Credentials are Wrong!'; |
|||
}; |
|||
//$Data['error'] = 'Caught exception: '.$e->getMessage();
|
|||
echo json_encode( $Data ); |
|||
exit(); |
|||
}; |
|||
}; |
|||
$QS = "SELECT * FROM media_streams WHERE source_id={$ECID}"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
foreach( $Result as $CD ){ |
|||
$cnode['id'] = $CD['id']; |
|||
$cnode['name'] = $CD['name']; |
|||
$cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; |
|||
$cnode['encode'] = $CD['compression_type']; |
|||
$cnode['bitrate'] = $CD['bitrate']; |
|||
$Data['nodes'][] = $cnode; |
|||
}; |
|||
$Data['success'] = true; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,268 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Data = array(); |
|||
$Data['status'] = 'na'; |
|||
if( isset( $_POST['CMD'] ) ){ |
|||
$CMD = intval( $_POST['CMD'] ); |
|||
} else { |
|||
$CMD = 0; |
|||
}; |
|||
if( isset( $_POST['CID'] ) ) { |
|||
$CameraID = intval($_POST['CID']); |
|||
} else $CameraID = 0; |
|||
switch( $CMD ){ |
|||
case 0:{ |
|||
// List Discovered Cameras
|
|||
break; |
|||
}; |
|||
case 1:{ |
|||
// List Registered Cameras
|
|||
break; |
|||
}; |
|||
case 2: |
|||
case 3:{ |
|||
// Checkup Onvif Camera By IP
|
|||
require_once('../php/onvif/toto.php'); |
|||
$EUser = $DATABASE->escape( $_POST['UU'] ); |
|||
$EPass = $DATABASE->escape( $_POST['PP'] ); |
|||
$AUTH = intval( $_POST['AU'] ); |
|||
$onvif = new Ponvif(); |
|||
$IP = ''; |
|||
if( $CameraID ){ |
|||
$QS ="SELECT `ip` FROM `cameras` WHERE `id`={$CameraID}"; |
|||
$JJ = $DATABASE->Query( $QS ); |
|||
if( count( $JJ ) ){ |
|||
$IP = $JJ[0]['ip']; |
|||
$onvif->setIPAddress( $IP ); |
|||
} else $CameraID = 0; |
|||
} else { |
|||
$IP = $DATABASE->escape( $_POST['IP'] ); |
|||
$onvif->setIPAddress( $IP ); |
|||
$RR = $onvif->discover(); |
|||
if( count( $RR ) ){ |
|||
$R= $RR[0]; |
|||
if(isset($R['EndpointReference'])){ |
|||
if(isset($R['EndpointReference']['Address'])){ |
|||
$TArr = explode( ':', $R['EndpointReference']['Address'] ); |
|||
$CA = $DATABASE->escape( $TArr[2] ); |
|||
$TArr = explode( ' ', $R['Scopes']); |
|||
$CM = ''; |
|||
$CI = $DATABASE->escape($R['IPAddr']); |
|||
$Frr = explode( ' ', $R['XAddrs']); |
|||
$Crr = explode( $CI, $Frr[0] ); |
|||
$CP = $DATABASE->escape($Crr[1]); |
|||
$CN = ''; |
|||
$CH = ''; |
|||
$CC = 0; |
|||
foreach( $TArr as $T ){ |
|||
$TT = str_ireplace('onvif://www.onvif.org/','', $T ); |
|||
$TBrr = explode( '/', $TT ); |
|||
if( stripos($TBrr[0],'type') !== false ){ |
|||
if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; |
|||
if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; |
|||
if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; |
|||
}; |
|||
if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); |
|||
}; |
|||
$QS = "INSERT INTO `cameras`(hardware,name,uuid,mac,ip,status,onvif_ctrl,online) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1"; |
|||
$DATABASE->Query($QS,false); |
|||
$CameraID = $DATABASE->getLastInsertID(); |
|||
if( $CameraID == 0 ){ |
|||
$QS = "SELECT `id` FROM `cameras` WHERE `uuid`='{$CA}'"; |
|||
$RV = $DATABASE->Query( $QS ); |
|||
if( count( $RV ) ) $CameraID = intval( $RV[0]['id']); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
if( $CameraID ){ |
|||
$Data['status'] = 'ok'; |
|||
if( $EUser!= '' ){ |
|||
$onvif->setUsername( $EUser ); |
|||
$onvif->setPassword( $EPass ); |
|||
$onvif->setAuthMethod( $AUTH ); |
|||
try { |
|||
$onvif->initialize(); |
|||
if ( !$onvif->isFault($devices=$onvif->getSources())){ |
|||
foreach( $devices[0] as $source ) if( is_array( $source ) ){ |
|||
//print_r( $source );
|
|||
$Ename = $DATABASE->escape( $source['profilename']); |
|||
$Etoken = $DATABASE->escape( $source['profiletoken']); |
|||
$Eencode = $DATABASE->escape( $source['encoding']); |
|||
$Ewidth = intval($source['width']); |
|||
$Eheight = intval($source['height']); |
|||
$Efps = intval($source['fps']); |
|||
$Ebitrate = intval($source['bitrate']); |
|||
if( isset( $source['ptz'] ) ){ |
|||
$Eptz = $DATABASE->escape( $source['ptz']['nodetoken'] ); |
|||
} else { |
|||
$Eptz=''; |
|||
}; |
|||
$mrl = $onvif->media_GetStreamUri($source['profiletoken']); |
|||
$pic = $onvif->media_GetSnapshotUri($source['profiletoken']); |
|||
$TPArr = explode(':',$mrl); |
|||
$mrl_proto = $TPArr[0]; |
|||
$mrl_port = intval( $TPArr[2] ); |
|||
if( $mrl_port == 0 ) { |
|||
switch( $mrl_proto ){ |
|||
case 'rtsp': $mrl_port = 554; break; |
|||
case 'http': $mrl_port = 80; break; |
|||
case 'https': $mrl_port = 443; break; |
|||
}; |
|||
}; |
|||
$Emrl = $DATABASE->escape( $mrl ); |
|||
$Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); |
|||
$Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); |
|||
$TPArr = explode(':',$pic ); |
|||
$pic_proto = $TPArr[0]; |
|||
$pic_port = intval( $TPArr[2] ); |
|||
if($pic_port == 0 ) $pic_port = 80; |
|||
$Epic = $DATABASE->escape( $pic ); |
|||
$Epic = str_replace( $pic_proto . '://' . $IP . ':' . $pic_port, '', $Epic ); |
|||
$Epic = str_replace( $pic_proto . '://' . $IP , '', $Epic ); |
|||
$QS = "INSERT INTO `media_streams`(`source_id`,`source_type`,`valid`,`name`,`token`,`img_width`,`img_height`,`compression_type`,`bitrate`,`fps`,`mrl`,`mrl_proto`,`mrl_port`,`picture_proto`,`picture_port`,`picture`) VALUES({$CameraID},'D',1,'{$Ename}','{$Etoken}',{$Ewidth},{$Eheight},'{$Eencode}',{$Ebitrate},{$Efps},'{$Emrl}','{$mrl_proto}','{$mrl_port}','{$pic_proto}','{$pic_port}','{$Epic}') ON CONFLICT(`source_id`,`token`) DO UPDATE SET `source_type`='D', `valid`=1, `mrl`='{$Emrl}', `mrl_proto`='{$mrl_proto}', `mrl_port`='{$mrl_port}', `picture_proto`='{$pic_proto}', `picture_port`='{$pic_port}', `picture`='{$Epic}'"; |
|||
$DATABASE->Query( $QS, false ); |
|||
}; |
|||
$QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH}, ptz_token='{$Eptz}', `status`=1 WHERE id={$CameraID}"; |
|||
$DATABASE->Query( $QS, false ); |
|||
} else { |
|||
$Data['msg'] = 'Camera was added.<br/>However provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; |
|||
}; |
|||
} catch( Exception $e ){ |
|||
$Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; |
|||
}; |
|||
} else { |
|||
$Data['msg'] = 'Camera Sucessfully Added<br/>Please Provide Access Credentials and Other Camera Settings'; |
|||
}; |
|||
} else { |
|||
$Data['status'] = 'error'; |
|||
$Data['msg'] = '<p align="center">Camera IP Address is Wrong!</p><p align="center">Please consider run network discovery.</p><p align="center">To refresh all aveable cameras addreses.</p>'; |
|||
}; |
|||
break; |
|||
}; |
|||
case 4:{ |
|||
// Add Onvif Camera Manually (After 2 - checkup )
|
|||
break; |
|||
}; |
|||
case 5:{ |
|||
// Add Analog Video Stream Camera Manully
|
|||
}; |
|||
case 6:{ |
|||
// Register the Camera
|
|||
|
|||
break; |
|||
}; |
|||
case 10:{ |
|||
$OP = intval( $_POST['OPID'] ); |
|||
switch( $OP ){ |
|||
case 1:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "SELECT * FROM `cameras` WHERE `id`={$CameraID}"; |
|||
$JJ = $DATABASE->Query( $QS ); |
|||
if( count( $JJ ) ){ |
|||
$CC = $JJ[0]; |
|||
if( $CC['status'] == 3 ){ |
|||
$QS = "UPDATE `nodes` SET `aux_param`={$Param} WHERE `aux_id`={$CameraID} AND `type` IN(10,11,12,13)"; |
|||
$DATABASE->Query( $QS ); |
|||
}; |
|||
$QS = "UPDATE `cameras` SET `stream_id`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-1'; |
|||
}; |
|||
break; |
|||
}; |
|||
case 2:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `imager_type`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-2'; |
|||
break; |
|||
}; |
|||
case 3:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `lens_f`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-3'; |
|||
break; |
|||
}; |
|||
case 4:{ |
|||
$Param = floatval( $_POST['OPCODE'] ); |
|||
if( $Param > 0 ){ |
|||
$ZM = 1; |
|||
} else { |
|||
$ZM = 0; |
|||
}; |
|||
$QS = "UPDATE `cameras` SET `zoom`={$Param}, `zoom_model`={$ZM} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-4'; |
|||
break; |
|||
}; |
|||
case 5:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `protocol`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-5'; |
|||
break; |
|||
}; |
|||
case 6:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `uart_id`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-6'; |
|||
break; |
|||
}; |
|||
case 7:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `protocol_aux`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-7'; |
|||
break; |
|||
}; |
|||
case 8:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `pan_model`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-8'; |
|||
break; |
|||
}; |
|||
case 9:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `pan_angles`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-9'; |
|||
break; |
|||
}; |
|||
case 10:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `tilt_model`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-10'; |
|||
break; |
|||
}; |
|||
case 11:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `tilt_angles`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-11'; |
|||
break; |
|||
}; |
|||
case 12:{ |
|||
$Param = intval( $_POST['OPCODE'] ); |
|||
$QS = "UPDATE `cameras` SET `trigger_mode`={$Param} WHERE `id`={$CameraID}"; |
|||
$DATABASE->Query( $QS ); |
|||
$Data['status'] = 'ok-12'; |
|||
break; |
|||
}; |
|||
}; |
|||
break; |
|||
}; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,33 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Data = array(); |
|||
$Data['success'] = false; |
|||
if( isset( $_POST['NID'] ) ) { |
|||
$NodeID = intval($_POST['NID']); |
|||
} else $NodeID = 0; |
|||
if( isset( $_POST['CMD'] ) ){ |
|||
$CMD = intval( $_POST['CMD'] ); |
|||
} else { |
|||
$CMD = 0; |
|||
}; |
|||
if( isset( $_POST['PARAM'] ) ){ |
|||
$PARAM = $DATABASE->escape( $_POST['PARAM'] ); |
|||
} else { |
|||
$PARAM = ''; |
|||
}; |
|||
if( $NodeID > 0 && $CMD > 0 ){ |
|||
$Data['success'] = true; |
|||
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'{$PARAM}')"; |
|||
$Data['query'] = $QS ; |
|||
@$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); |
|||
$MEMDB->Query( $QS, false ); |
|||
$Data['operation_id'] = intval( $MEMDB->getLastInsertID() ); |
|||
} else { |
|||
$Data['msg']='Wrong Parameters'; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
exit(); |
|||
}; |
|||
header('location: /'); |
|||
?>
|
|||
Binary file not shown.
|
After Width: 1280 | Height: 720 | Size: 121 KiB |
@ -0,0 +1,785 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
$CID = intval( $_POST['CID'] ); |
|||
$QS = "SELECT * FROM `cameras` WHERE `id`={$CID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
$STREAMS = array(); |
|||
if( count( $Result ) ){ |
|||
$Cam = $Result[0]; |
|||
$Cam['name']=urldecode( $Cam['name'] ); |
|||
$TB = explode( ' ', $Cam['name'] ); |
|||
$Cam['name'] = $TB[0]; |
|||
if( stripos($Cam['ip'],'/dev/video') !==false ){ |
|||
$CLS = "camera_analog_set"; |
|||
$CAM_IP = false; |
|||
} else { |
|||
$CAM_IP = true; |
|||
$CamLabel = $Cam['name'] . '_' . $CID; |
|||
if( stripos( $Cam['name'], 'hikvision' ) !== false ){ |
|||
$CLS = "camera_hikvision_set"; |
|||
} elseif( stripos( $Cam['name'], 'dahua' ) !== false ){ |
|||
$CLS = "camera_dahua_set"; |
|||
} elseif( stripos( $Cam['name'], 'axis' ) !== false ){ |
|||
$CLS = "camera_axis_set"; |
|||
} else { |
|||
$CLS = "camera_generic_set"; |
|||
}; |
|||
}; |
|||
$QS = "SELECT * FROM media_streams WHERE source_id={$CID}"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
$SELECTED_STREAM = 0; |
|||
if( count( $Result ) > 0 ){ |
|||
$ii = 0; |
|||
foreach( $Result as $CD ){ |
|||
$STREAMS[] = "[{$CD['id']},'{$CD['name']}','{$CD['img_width']}x{$CD['img_height']}@{$CD['fps']}','{$CD['compression_type']}',{$CD['bitrate']}]"; |
|||
if( $Cam['stream_id'] == $CD['id'] ) $SELECTED_STREAM = $ii; |
|||
$ii++; |
|||
}; |
|||
}; |
|||
$STREAMS = implode(',',$STREAMS); |
|||
|
|||
$QS="SELECT re.aux_id, re.device FROM resources re LEFT JOIN nodes no ON( re.node_id = no.id ) WHERE ( re.type=1 OR re.type=129 ) "; |
|||
$RR=$DATABASE->Query( $QS ); |
|||
if( count( $RR ) ){ |
|||
$RE=array(); |
|||
foreach( $RR as $R ){ |
|||
$RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; |
|||
}; |
|||
$UARTS = implode( ',', $RE ); |
|||
} else { |
|||
$UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; |
|||
}; |
|||
$ATAB = 0; |
|||
//v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=output.jpg
|
|||
if( $CAM_IP ){ |
|||
$RESET_CREDENTIALS=<<<kskjhiiuwye |
|||
,{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: '{$Labels->GetLabel('_RSET_CREDENTIALS_')}', |
|||
handler: function(){ |
|||
} |
|||
} |
|||
kskjhiiuwye; |
|||
} else { |
|||
$RESET_CREDENTIALS=''; |
|||
}; |
|||
$ADD_CAMERA=<<<hzzhoiuyhetrkh |
|||
{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: '{$Labels->GetLabel('_ASSIGN_CAMERA_')}', |
|||
handler: function(){ |
|||
} |
|||
} |
|||
hzzhoiuyhetrkh; |
|||
$REMOVE_CAMERA=<<<hhoiuyhetrkh |
|||
{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: '{$Labels->GetLabel('_REMOVE_CAMERA_')}', |
|||
handler: function(){ |
|||
} |
|||
} |
|||
hhoiuyhetrkh; |
|||
$BBAR_BTN = $ADD_CAMERA; |
|||
$TPL_SET_CREDS_IP=<<<ZUZAKA |
|||
{ |
|||
xtype: 'form', |
|||
id: 'cam_credentials', |
|||
labelWidth: 260, |
|||
labelAlign: 'right', |
|||
items: [{ |
|||
xtype: 'panel', |
|||
height: 290, |
|||
border: false, |
|||
frame: false, |
|||
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>' |
|||
},{ |
|||
xtype: 'panel', |
|||
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>' |
|||
},{ |
|||
xtype: 'panel', |
|||
html: '<div class="sideInfo_item" id="INFO_ID">{$Labels->GetLabel('_PROV_CAC_')}</div>' |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'cam_login', |
|||
fieldLabel: '{$Labels->GetLabel('__LOGIN__')}', |
|||
width: 200 |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'cam_password', |
|||
inputType: 'password', |
|||
fieldLabel: '{$Labels->GetLabel('__PASSWORD__')}', |
|||
width: 200 |
|||
},{ |
|||
xtype: 'combo', |
|||
id: 'cam_auth_mode', |
|||
fieldLabel: '{$Labels->GetLabel('_AUTH_MODE_0_')}', |
|||
lazyRender: true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['mode','mode_txt'], |
|||
data: [ |
|||
[0,'BASIC'], |
|||
[1,'DIGEST'], |
|||
[2,'DIGEST_IE'], |
|||
[3,'BEARER'], |
|||
[4,'NEGOTIATE'], |
|||
[5,'NTLM'], |
|||
[6,'NTLM_WB'], |
|||
[7,'ANY'], |
|||
[8,'ANYSAFE'], |
|||
[9,'ONLY'], |
|||
[10,'AWS_SIGV4'] |
|||
] |
|||
}), |
|||
valueField: 'mode', |
|||
displayField: 'mode_txt', |
|||
value: 0, |
|||
width: 200 |
|||
},{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: '{$Labels->GetLabel('_SET_CREDENTIALS_')}', |
|||
handler: function(){ |
|||
addDetCamWM = new Ext.LoadMask( Ext.getCmp('cam_credentials').getEl(), {msg:"{$Labels->GetLabel('_Please_Wait_')}..."}); |
|||
addDetCamWM.show(); |
|||
var NUU = Ext.getCmp('cam_login').getValue(); |
|||
var NPP = Ext.getCmp('cam_password').getValue(); |
|||
var NAM = Ext.getCmp('cam_auth_mode').getValue(); |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/doCameraOperation.php', |
|||
params: { |
|||
UID: {$UserID}, |
|||
SID: '{$Session}', |
|||
CID: {$CID}, |
|||
UU: NUU, |
|||
PP: NPP, |
|||
AU: NAM, |
|||
CMD: 3 |
|||
}, |
|||
success: function( response, opts ){ |
|||
addDetCamWM.hide(); |
|||
var data = Ext.decode(response.responseText); |
|||
if( data.status == 'ok' ){ |
|||
Ext.Msg.show({ |
|||
title:'Sucess!', |
|||
msg: data.msg, |
|||
buttons: Ext.Msg.OK, |
|||
icon: Ext.MessageBox.INFO |
|||
}); |
|||
//loadDetectedCameras();
|
|||
} else { |
|||
Ext.Msg.show({ |
|||
title:'Error!', |
|||
msg: data.msg, |
|||
buttons: Ext.Msg.OK, |
|||
icon: Ext.MessageBox.WARNING |
|||
}); |
|||
}; |
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
} |
|||
}] |
|||
} |
|||
ZUZAKA; |
|||
$TPL_ANALOG_CAM =<<<CHUPAKABRA |
|||
{ |
|||
xtype: 'panel', |
|||
id: 'cam_info', |
|||
labelWidth: 260, |
|||
labelAlign: 'right', |
|||
bbar:[{$BBAR_BTN}], |
|||
items: [{ |
|||
xtype: 'panel', |
|||
height: 290, |
|||
border: false, |
|||
frame: false, |
|||
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>' |
|||
},{ |
|||
xtype: 'panel', |
|||
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>' |
|||
}] |
|||
} |
|||
CHUPAKABRA; |
|||
$TPL_CAM_EDITOR=<<<PZAKSJEJSDKGJHGASD |
|||
{ |
|||
id: 'camedi_tabs', |
|||
xtype: 'tabpanel', |
|||
activeTab: 0, |
|||
bbar:[{$BBAR_BTN}], |
|||
items: [{ |
|||
title: '{$Labels->GetLabel('_CAC_TAB_')}', |
|||
id: 'cam_info', |
|||
frame: false, |
|||
border: false, |
|||
items: [{ |
|||
xtype: 'panel', |
|||
height: 290, |
|||
border: false, |
|||
frame: false, |
|||
html: '<table width="100%" border=0><tr><td height=290 align="center"><div class="{$CLS}"></div></td>' |
|||
},{ |
|||
xtype: 'panel', |
|||
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>' |
|||
}{$RESET_CREDENTIALS}] |
|||
},{ |
|||
title: '{$Labels->GetLabel('_STREAMS_')}', |
|||
id: 'str_tab', |
|||
frame: false, |
|||
border: false, |
|||
items:[{ |
|||
xtype: 'grid', |
|||
height: 124, |
|||
id: 'nd_cam_grid', |
|||
frame: false, |
|||
ds: new Ext.data.ArrayStore({ |
|||
fields: ['id','name','size','encode','bitrate'], |
|||
data: [{$STREAMS}] |
|||
}), |
|||
cm: new Ext.grid.ColumnModel({ |
|||
columns: [ |
|||
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, |
|||
{header: "Name", dataIndex: 'name' }, |
|||
{header: "Encoding",width: 120, sortable: false, fixed: true, menuDisabled: true, dataIndex: 'encode' }, |
|||
{header: "Frame", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, |
|||
{header: "Bitrate", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'bitrate' } |
|||
], |
|||
defaults: { |
|||
sortable: false, |
|||
menuDisabled: true, |
|||
width: 100 |
|||
} |
|||
}), |
|||
sm: new Ext.grid.RowSelectionModel({ |
|||
singleSelect: true, |
|||
listeners: { |
|||
rowselect: function(sm, row, rec) { |
|||
SelectedSource = rec.data.id; |
|||
doCamOperation( {$CID}, 1, SelectedSource ); |
|||
var tt = Ext.getCmp('pic_prev'); |
|||
if( tt!= undefined ){ |
|||
tt.update( '<center><img width="100%" src="/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID='+SelectedSource+'"></center>' ); |
|||
}; |
|||
} |
|||
} |
|||
}), |
|||
listeners:{ |
|||
viewready: function( t ){ |
|||
var tt = t.getSelectionModel(); |
|||
tt.selectRow({$SELECTED_STREAM}); |
|||
} |
|||
} |
|||
},{ |
|||
height: PanelH, |
|||
id: 'pic_prev', |
|||
html: '<center><img width="100%" src="/style/img/cam_cap0.png"></center>', |
|||
listeners:{ |
|||
afterrender: function( t ){ |
|||
if( SelectedSource ){ |
|||
//t.update( '<center><img width="100%" src="/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID='+SelectedSource+'"></center>' );
|
|||
}; |
|||
} |
|||
} |
|||
}], |
|||
},{ |
|||
title: 'Lens Settings', |
|||
id: 'lens_tab', |
|||
frame: false, |
|||
border: false, |
|||
items:[{ |
|||
layout: 'table', |
|||
frame: false, |
|||
border: false, |
|||
layoutConfig: { |
|||
columns: 3 |
|||
}, |
|||
defaults: { |
|||
frame: false, |
|||
bodyStyle: 'padding:10px', |
|||
border: false |
|||
}, |
|||
items:[{ |
|||
width: 200, |
|||
html: 'Sensor Size' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Sensor Size', |
|||
lazyRender: true, |
|||
id: 'sens_size', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['size','size_txt'], |
|||
data: [ |
|||
[0,'1/3.6"'], |
|||
[1,'1/3.2"'], |
|||
[2,'1/3"'], |
|||
[3,'1/2.7"'], |
|||
[4,'1/2"'], |
|||
[5,'1/1.8"'], |
|||
[6,'2/3"'], |
|||
[7,'1"'], |
|||
[8,'4/3"'], |
|||
[9,'APS-C'], |
|||
[10,'35 mm'], |
|||
[11,'645'] |
|||
] |
|||
}), |
|||
valueField: 'size', |
|||
displayField: 'size_txt', |
|||
value: {$Cam['imager_type']}, |
|||
listeners:{ |
|||
select:function( c, r, i ){ |
|||
doCamOperation( {$CID}, 2, i ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Focal Length' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Lens Focal Length', |
|||
lazyRender: true, |
|||
id: 'lens_fl', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['fl','fl_txt'], |
|||
data: [ |
|||
[0,'2.7 mm.'], |
|||
[1,'3.0 mm.'], |
|||
[2,'3.2 mm.'], |
|||
[3,'3.5 mm.'], |
|||
[4,'3.7 mm.'], |
|||
[5,'3.9 mm.'], |
|||
[6,'4.0 mm.'], |
|||
[7,'4.3 mm.'], |
|||
[8,'4.8 mm.'], |
|||
[9,'5.0 mm.'], |
|||
[10,'5.1 mm.'], |
|||
[11,'5.5 mm.'], |
|||
[12,'5.8 mm.'], |
|||
[13,'6.0 mm.'], |
|||
[14,'6.2 mm.'], |
|||
[15,'6.6 mm.'], |
|||
[16,'7.0 mm.'], |
|||
[17,'7.1 mm.'], |
|||
[18,'7.5 mm.'], |
|||
[19,'7.6 mm.'], |
|||
[20,'8.0 mm.'], |
|||
[21,'8.6 mm.'], |
|||
[22,'8.9 mm.'], |
|||
[23,'9.0 mm.'], |
|||
[24,'9.2 mm.'], |
|||
[25,'9.3 mm.'], |
|||
[26,'10.0 mm.'], |
|||
[27,'10.5 mm.'], |
|||
[28,'10.6 mm.'], |
|||
[29,'10.7 mm.'], |
|||
[30,'11.0 mm.'], |
|||
[31,'11.3 mm.'], |
|||
[32,'12.0 mm.'], |
|||
[33,'12.9 mm.'], |
|||
[34,'13.0 mm.'], |
|||
[35,'13.5 mm.'], |
|||
[36,'13.6 mm.'], |
|||
[37,'14.0 mm.'], |
|||
[38,'14.6 mm.'], |
|||
[39,'15.0 mm.'], |
|||
[40,'15.1 mm.'], |
|||
[41,'15.5 mm.'], |
|||
[42,'16.0 mm.'], |
|||
[43,'17.0 mm.'], |
|||
[44,'17.5 mm.'], |
|||
[44,'17.7 mm.'], |
|||
[45,'18.0 mm.'], |
|||
[46,'18.2 mm.'], |
|||
[47,'19.0 mm.'] |
|||
] |
|||
}), |
|||
valueField: 'fl', |
|||
displayField: 'fl_txt', |
|||
value: {$Cam['lens_f']}, |
|||
listeners:{ |
|||
select:function( c, r, i ){ |
|||
doCamOperation( {$CID}, 3, i ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Fixed Zoom' |
|||
},{ |
|||
xtype: 'radio', |
|||
id: 'no_zoom', |
|||
name: 'zoom_ena', |
|||
value: ( parseFloat({$Cam['zoom']})==0 ), |
|||
checked: ( parseFloat({$Cam['zoom']})==0 ), |
|||
listeners:{ |
|||
change: function( r, n, o ){ |
|||
if( n ) { |
|||
doCamOperation( {$CID}, 4, 0.0 ); |
|||
}; |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Variable Zoom' |
|||
},{ |
|||
xtype: 'radio', |
|||
id: 'on_zoom', |
|||
hideLabel: false, |
|||
fieldLabel: 'Variable Zoom', |
|||
name: 'zoom_ena', |
|||
value: ({$Cam['zoom']}>0.0), |
|||
checked: ({$Cam['zoom']}>0.0), |
|||
handler: function( a, c ){ |
|||
if( c ){ |
|||
Ext.getCmp('zoom_val').enable(); |
|||
Ext.getCmp('zoom_val').setValue( 1 ); |
|||
var zz = Ext.getCmp('zoom_d'); |
|||
if( zz.rendered ) zz.update('<p>X 1</p>'); |
|||
} else { |
|||
Ext.getCmp('zoom_val').disable(); |
|||
var zz = Ext.getCmp('zoom_d'); |
|||
if( zz.rendered ) zz.update(' '); |
|||
}; |
|||
}, |
|||
listeners:{ |
|||
change: function( r, n, o ){ |
|||
if( n ) { |
|||
doCamOperation( {$CID}, 4, 1.0 ); |
|||
}; |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Zoom Ratio' |
|||
},{ |
|||
xtype: 'slider', |
|||
id: 'zoom_val', |
|||
disabled: ( parseFloat({$Cam['zoom']})==0 ), |
|||
minValue: 1.0, |
|||
maxValue: 40.0, |
|||
value: {$Cam['zoom']}, |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 4, c ); |
|||
var zz = Ext.getCmp('zoom_d'); |
|||
if( zz.rendered ) zz.update('<p>X '+ c + '</p>'); |
|||
} |
|||
} |
|||
},{ |
|||
id: 'zoom_d', |
|||
html: (( parseFloat({$Cam['zoom']})==0 )?' ':'<p>X '+ {$Cam['zoom']} + '</p>' ) |
|||
}] |
|||
}] |
|||
},{ |
|||
title: '{$Labels->GetLabel('_PTZ_TAB_')}', |
|||
id: 'ptz_tab', |
|||
frame: false, |
|||
border: false, |
|||
items:[{ |
|||
layout: 'table', |
|||
frame: false, |
|||
border: false, |
|||
layoutConfig: { |
|||
columns: 3 |
|||
}, |
|||
defaults: { |
|||
frame: false, |
|||
bodyStyle: 'padding:10px', |
|||
border: false |
|||
}, |
|||
items:[{ |
|||
width: 200, |
|||
html: '{$Labels->GetLabel('__PTZ_CONTROL__')}' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: '{$Labels->GetLabel('__PTZ_CONTROL__')}', |
|||
lazyRender: true, |
|||
id: 'ptz_proto', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['type','type_txt'], |
|||
data: [ |
|||
[0,'{$Labels->GetLabel('_NO_PTZ_')}'], |
|||
[1,'Sony VISCA'], |
|||
[2,'Pelco-D'], |
|||
[3,'OnVif'], |
|||
[4,'PSIA'], |
|||
[5,'GB/T28181'] |
|||
] |
|||
}), |
|||
value: {$Cam['protocol']}, |
|||
valueField: 'type', |
|||
displayField: 'type_txt', |
|||
listeners:{ |
|||
select: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 5, b ); |
|||
if( b > 0 ){ |
|||
if( b != 3 ){ |
|||
Ext.getCmp('uart_id').enable(); |
|||
Ext.getCmp('prot_id').enable(); |
|||
} else { |
|||
Ext.getCmp('uart_id').disable(); |
|||
Ext.getCmp('prot_id').disable(); |
|||
}; |
|||
Ext.getCmp('pan_mode').enable(); |
|||
Ext.getCmp('tilt_mode').enable(); |
|||
Ext.getCmp('pan_ang').enable(); |
|||
Ext.getCmp('tilt_ang').enable(); |
|||
} else { |
|||
Ext.getCmp('uart_id').disable(); |
|||
Ext.getCmp('prot_id').disable(); |
|||
Ext.getCmp('pan_mode').disable(); |
|||
Ext.getCmp('tilt_mode').disable(); |
|||
Ext.getCmp('pan_ang').disable(); |
|||
Ext.getCmp('tilt_ang').disable(); |
|||
}; |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: '{$Labels->GetLabel('_UART_PORT_')}' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}', |
|||
lazyRender: true, |
|||
id: 'uart_id', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )), |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['uart','uart_txt'], |
|||
data: [{$UARTS}] |
|||
}), |
|||
valueField: 'uart', |
|||
displayField: 'uart_txt', |
|||
value: {$Cam['uart_id']}, |
|||
listeners:{ |
|||
select: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 6, b ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: '{$Labels->GetLabel('_CAM_PROTO_ID_')}' |
|||
},{ |
|||
xtype: 'numberfield', |
|||
id: 'prot_id', |
|||
width: '95%', |
|||
disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )), |
|||
minValue: 0, |
|||
maxValue: 255, |
|||
value: {$Cam['protocol_aux']}, |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 7, c ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Pan Model' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Pan Model', |
|||
lazyRender: true, |
|||
id: 'pan_mode', |
|||
disabled: ({$Cam['protocol']} == 0), |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['pm','pm_txt'], |
|||
data: [ |
|||
[0,'Regular'], |
|||
[1,'Reversed'] |
|||
] |
|||
}), |
|||
valueField: 'pm', |
|||
displayField: 'pm_txt', |
|||
value: {$Cam['pan_model']}, |
|||
listeners:{ |
|||
select: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 8, b ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Tottal Pan Angles' |
|||
},{ |
|||
xtype: 'numberfield', |
|||
id: 'pan_ang', |
|||
width: '95%', |
|||
disabled: ({$Cam['protocol']} == 0), |
|||
minValue: 0, |
|||
maxValue: 360, |
|||
value: {$Cam['pan_angles']}, |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 9, c ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Tilt Model' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Tilt Model', |
|||
lazyRender: true, |
|||
id: 'tilt_mode', |
|||
disabled: ({$Cam['protocol']} == 0), |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['tm','tm_txt'], |
|||
data: [ |
|||
[0,'Regular'], |
|||
[1,'Reversed'], |
|||
[2,'Shifted 90°'], |
|||
[3,'Rev-Shifted 90°'] |
|||
] |
|||
}), |
|||
valueField: 'tm', |
|||
displayField: 'tm_txt', |
|||
value: {$Cam['tilt_model']}, |
|||
listeners:{ |
|||
select: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 10, b ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
},{ |
|||
html: 'Tottal Tilt Angles' |
|||
},{ |
|||
xtype: 'numberfield', |
|||
id: 'tilt_ang', |
|||
width: '95%', |
|||
disabled: ({$Cam['protocol']} == 0), |
|||
minValue: 0, |
|||
maxValue: 180, |
|||
value: {$Cam['tilt_angles']}, |
|||
listeners:{ |
|||
change: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 11, c ); |
|||
} |
|||
} |
|||
},{ |
|||
html: ' ' |
|||
}] |
|||
}] |
|||
},{ |
|||
title: '{$Labels->GetLabel('_TARGETING_TAB_')}', |
|||
id: 'target_tab', |
|||
frame: false, |
|||
border: false, |
|||
items:[{ |
|||
layout: 'table', |
|||
frame: false, |
|||
border: false, |
|||
layoutConfig: { |
|||
columns: 3 |
|||
}, |
|||
defaults: { |
|||
frame: false, |
|||
bodyStyle: 'padding:10px', |
|||
border: false |
|||
}, |
|||
items:[{ |
|||
width: 200, |
|||
html: '{$Labels->GetLabel('_CAM_TRIGGERING_MODE_')}' |
|||
},{ |
|||
xtype: 'combo', |
|||
lazyRender: true, |
|||
id: 'cam_targeting', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['type','type_txt'], |
|||
data: [ |
|||
[0,'Strict Visible Targets'], |
|||
[1,'All Near'], |
|||
[2,'ALL Far'], |
|||
[3,'All Targets'] |
|||
] |
|||
}), |
|||
value: {$Cam['trigger_mode']}, |
|||
valueField: 'type', |
|||
displayField: 'type_txt', |
|||
listeners:{ |
|||
select: function( a, c, b ){ |
|||
doCamOperation( {$CID}, 12, b ); |
|||
} |
|||
} |
|||
}] |
|||
}] |
|||
}] |
|||
} |
|||
PZAKSJEJSDKGJHGASD; |
|||
|
|||
$Data['status']='ok'; |
|||
|
|||
if( $Cam['status'] == 0 ){ |
|||
$ADDCAMPOPO = ''; |
|||
} else { |
|||
$ADDCAMPOPO = ''; |
|||
}; |
|||
if( $CAM_IP ){ |
|||
switch( $Cam['status'] ){ |
|||
case 0: $Data['content'] = $TPL_SET_CREDS_IP; break; |
|||
case 1: $Data['content'] = $TPL_CAM_EDITOR; break; |
|||
case 2: $Data['content'] = $TPL_CAM_EDITOR; break; |
|||
}; |
|||
} else { |
|||
$Data['content'] = $TPL_CAM_EDITOR; |
|||
}; |
|||
} else { |
|||
$Data['status']='error'; |
|||
}; |
|||
echo $Data['content']; |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,78 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
|||
header("Cache-Control: post-check=0, pre-check=0", false); |
|||
header("Pragma: no-cache"); |
|||
if(isset( $_POST['FID'] )){ |
|||
$FID = intval($_POST['FID']); |
|||
} else { |
|||
$FID = intval($_GET['FID']); |
|||
}; |
|||
if(isset( $_POST['AUX'] )){ |
|||
$AUX = intval($_POST['AUX']); |
|||
} else { |
|||
$AUX = 0;//intval($_GET['AUX']);
|
|||
}; |
|||
if( $FID > 0 ){ |
|||
$QS = "SELECT cs.picture AS pic_url, cs.picture_proto AS pic_proto, cs.img_width AS width, cs.img_height AS height, cs.picture_port AS pic_port, ca.* FROM media_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.source_id ) WHERE cs.id={$FID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
if( $Result[0]['pic_proto'] == 'v4l2' ){ |
|||
$tmp = '/tmp/some_tmp_file_'.md5(time()).'.jpg'; |
|||
$CMD_SET = "v4l2-ctl --device {$Result[0]['ip']} -set-fmt-video=width={$Result[0]['width']},height={$Result[0]['height'] },pixelformat=MJPG"; |
|||
$A = `$CMD_SET`; |
|||
$CMD_GRAB = "ffmpeg -f video4linux2 -i {$Result[0]['ip']} -frames:v 3 -update 1 {$tmp}"; |
|||
$B = `$CMD_GRAB`; |
|||
if( file_exists( $tmp ) ){ |
|||
$Data = file_get_contents( $tmp ); |
|||
unlink( $tmp ); |
|||
} else { |
|||
$Data = file_get_contents( '../../style/assets/no_picture.jpg' ); |
|||
}; |
|||
header("Content-type: image/jpeg"); |
|||
echo $Data; |
|||
} else { |
|||
//var_dump( $Result[0] );
|
|||
$soap_do = curl_init(); |
|||
//$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0";
|
|||
$URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; |
|||
curl_setopt($soap_do, CURLOPT_URL, $URL ); |
|||
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); |
|||
curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); |
|||
curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); |
|||
curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); |
|||
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); |
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); |
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); |
|||
//curl_setopt($soap_do, CURLOPT_USERNAME, $Result[0]['access_login']);
|
|||
curl_setopt($soap_do, CURLOPT_USERPWD, $Result[0]['access_login'] . ":" . $Result[0]['access_pass'] ); |
|||
if( ( $data = curl_exec($soap_do) ) === false ){ |
|||
$err = curl_error($soap_do); |
|||
//echo $err;
|
|||
$Data = file_get_contents( '../../style/assets/no_picture.jpg' ); |
|||
header("Content-type: image/jpeg"); |
|||
echo $Data; |
|||
} else { |
|||
//$AA = curl_getinfo( $soap_do );
|
|||
//var_dump($AA);
|
|||
if( $AUX > 0 ){ |
|||
$Image = imagecreatefromstring($data); |
|||
$Simage = imagescale( $Image, $AUX, -1, IMG_NEAREST_NEIGHBOUR ); |
|||
header("Content-type: image/jpeg"); |
|||
imagejpeg($Simage); |
|||
} else { |
|||
header("Content-type: image/jpeg"); |
|||
echo $data; |
|||
}; |
|||
}; |
|||
}; |
|||
} else { |
|||
//echo "\n\nNores!";
|
|||
loadNotPicture( $AUX ); |
|||
}; |
|||
exit(); |
|||
}; |
|||
}; |
|||
header('location: /'); |
|||
?>
|
|||
@ -0,0 +1,31 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
$TY = intval( $_POST['TYP'] ); |
|||
if( $TY ){ |
|||
$QS = "SELECT * FROM `cameras` WHERE `status` = 3"; |
|||
} else { |
|||
$QS = "SELECT * FROM `cameras` WHERE `status` < 3"; |
|||
}; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$CamPart = array(); |
|||
foreach( $Result as $R ){ |
|||
$CamPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['online']==0)?'N':'O').'" onclick="editCamera('.$R['id'].','.$TY.');">'.urldecode($R['name']).'['.$R['hardware'].']</a>\'}'; |
|||
}; |
|||
$Data['status']='ok'; |
|||
$Data['cameras'] = '['.implode( ',', $CamPart ) .']'; |
|||
} else { |
|||
$Data['status']='na'; |
|||
}; |
|||
$Data['messages'] = ob_get_clean(); |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
|
|||
|
|||
?>
|
|||
@ -0,0 +1,43 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
$QS = "SELECT * FROM modules"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
foreach( $Result as $R ){ |
|||
$QS = "SELECT * FROM module_types WHERE id={$R['type']}"; |
|||
$MOMO = $DATABASE->Query( $QS, false ); |
|||
$MOD = $MOMO[0]; |
|||
switch( $R['type'] ){ |
|||
case 1: |
|||
case 2: |
|||
case 3: |
|||
case 4: |
|||
case 5: |
|||
case 6: |
|||
case 7: |
|||
case 8: |
|||
case 9: |
|||
case 10: |
|||
$ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['enabled']==0)?'N':'O').'" onclick="editModule('.$R['id'].');">'.$Labels->GetLabel($MOD['name']).'</a>\'}'; |
|||
break; |
|||
default: |
|||
$ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}'; |
|||
}; |
|||
}; |
|||
$Data['status']='ok'; |
|||
$Data['modules'] = '['.implode( ',', $ModPart ) .']'; |
|||
} else { |
|||
$Data['status']='na'; |
|||
}; |
|||
$Data['messages'] = ob_get_clean(); |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
|
|||
|
|||
?>
|
|||
@ -0,0 +1,70 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
ob_start(); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
$QS = "SELECT * FROM resources WHERE `node_id`=1"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
foreach( $Result as $R ){ |
|||
switch( $R['type'] ){ |
|||
case 1: |
|||
//Uart
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 6: |
|||
//USB DC
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="USBDC_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 31: |
|||
//Video Grabber
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="VIDEO_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('FRAMEGRAB_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 100: |
|||
//Loopback
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('LOOPBACK_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 101: |
|||
//Ethernet Interface
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('ETHERNET_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 102: |
|||
//WiFi Interface
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WIFI_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 103: |
|||
//Virtual IP Interface
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VIRTUALIP_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 104: |
|||
//VPN Interface
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VPN_TUN_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 105: |
|||
//WAN Interface
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WAN_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
//Media Encoder Sink
|
|||
case 131: // Video Encoder Sink
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Video Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
case 132: // Audio Encoder Sink
|
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Audio Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
break; |
|||
default: |
|||
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}'; |
|||
}; |
|||
}; |
|||
$Data['resources'] = '['.implode( ',', $SockDataParts ).']'; |
|||
$Data['status']='ok'; |
|||
} else { |
|||
$Data['status']='na'; |
|||
$Data['resources'] = array(); |
|||
}; |
|||
$Data['messages'] = ob_get_clean(); |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,31 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
$UID = intval( $CUser->Data['id'] ); |
|||
$ACCESS = intval( $CUser->Data['access'] ); |
|||
if( $UID > 1 ){ |
|||
ob_start(); |
|||
@$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); |
|||
$QS = "SELECT * FROM `servers` LIMIT 1"; |
|||
$RV = $MEMDB->Query( $QS ); |
|||
if( count( $RV ) ){ |
|||
if( ( time() - intval( $RV[0]['ts'] ) ) < 3 ){ |
|||
$Data['status']='ok'; |
|||
$Data['stats']=$RV[0]; |
|||
$Data['online'] = 1; |
|||
} else { |
|||
$Data['status']='na'; |
|||
$Data['stats'] = array(); |
|||
$Data['online'] = 0; |
|||
}; |
|||
} else { |
|||
$Data['status']='na'; |
|||
$Data['stats'] = array(); |
|||
$Data['online'] = 0; |
|||
}; |
|||
$Data['messages'] = ob_get_clean(); |
|||
} else { |
|||
header('location: /'); |
|||
exit(); |
|||
}; |
|||
echo json_encode( $Data ); |
|||
?>
|
|||
@ -1,59 +0,0 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
|||
header("Cache-Control: post-check=0, pre-check=0", false); |
|||
header("Pragma: no-cache"); |
|||
if(isset( $_POST['FID'] )){ |
|||
$FID = intval($_POST['FID']); |
|||
} else { |
|||
$FID = intval($_GET['FID']); |
|||
}; |
|||
if(isset( $_POST['AUX'] )){ |
|||
$AUX = intval($_POST['AUX']); |
|||
} else { |
|||
$AUX = intval($_GET['AUX']); |
|||
}; |
|||
if( $FID > 0 ){ |
|||
$QS = "SELECT cs.picture AS pic_url, cs.picture_proto AS pic_proto, cs.picture_port AS pic_port, ca.* FROM media_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.source_id ) WHERE cs.id={$FID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
//var_dump( $Result[0] );
|
|||
$soap_do = curl_init(); |
|||
//$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0";
|
|||
$URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; |
|||
curl_setopt($soap_do, CURLOPT_URL, $URL ); |
|||
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); |
|||
curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); |
|||
curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); |
|||
curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); |
|||
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); |
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); |
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); |
|||
//curl_setopt($soap_do, CURLOPT_USERNAME, $Result[0]['access_login']);
|
|||
curl_setopt($soap_do, CURLOPT_USERPWD, $Result[0]['access_login'] . ":" . $Result[0]['access_pass'] ); |
|||
if( ( $data = curl_exec($soap_do) ) === false ){ |
|||
$err = curl_error($soap_do); |
|||
echo $err; |
|||
} else { |
|||
//$AA = curl_getinfo( $soap_do );
|
|||
//var_dump($AA);
|
|||
if( $AUX > 0 ){ |
|||
$Image = imagecreatefromstring($data); |
|||
$Simage = imagescale( $Image, $AUX, -1, IMG_NEAREST_NEIGHBOUR ); |
|||
header("Content-type: image/jpeg"); |
|||
imagejpeg($Simage); |
|||
} else { |
|||
header("Content-type: image/jpeg"); |
|||
echo $data; |
|||
}; |
|||
}; |
|||
} else { |
|||
//echo "\n\nNores!";
|
|||
loadNotPicture( $AUX ); |
|||
}; |
|||
exit(); |
|||
}; |
|||
}; |
|||
header('location: /'); |
|||
?>
|
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
xtype: 'panel', |
|||
html: 'Help Topic 100' |
|||
} |
|||
Binary file not shown.
|
After Width: 1280 | Height: 720 | Size: 177 KiB |
@ -0,0 +1,15 @@ |
|||
#!/bin/bash |
|||
|
|||
|
|||
#v4l2-ctl --device /dev/video0 --list-formats-ext |
|||
|
|||
#v4l2-ctl \ |
|||
# --device /dev/video0 \ |
|||
# --set-fmt-video=width=1280,height=720,pixelformat=MJPG \ |
|||
# --stream-mmap --stream-to=frame.raw --stream-count=1 |
|||
|
|||
#v4l2-ctl --device /dev/video0 -set-fmt-video=width=1280,height=720,pixelformat=MJPG |
|||
|
|||
#ffmpeg -y -f rawvideo -pix_fmt mjpg -ss 00:01 -r 1 -s 640x480 -i frame.raw -frames:v 1 output.png |
|||
|
|||
ffmpeg -f video4linux2 -i /dev/video0 -frames:v 3 -update 1 output.jpg |
|||
@ -0,0 +1,12 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$TID = intval( $_POST['TID'] ); |
|||
if( $TID ){ |
|||
echo file_get_contents('help/topic_'.$TID.'.json'); |
|||
exit(); |
|||
} |
|||
echo "{ xtype:'panel', html: 'Wrong Help Topic ID' }"; |
|||
}; |
|||
header( 'location: / '); |
|||
?>
|
|||
@ -0,0 +1,53 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/onvif/toto.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
if( 1 ){ |
|||
$onvif = new Ponvif(); |
|||
$result = $onvif->discover(); |
|||
if(count($result)){ |
|||
foreach( $result as $R ){ |
|||
if(isset($R['EndpointReference'])){ |
|||
if(isset($R['EndpointReference']['Address'])){ |
|||
$TArr = explode( ':', $R['EndpointReference']['Address'] ); |
|||
$CA = $DATABASE->escape( $TArr[2] ); |
|||
$TArr = explode( ' ', $R['Scopes']); |
|||
$CM = ''; |
|||
$CI = $DATABASE->escape($R['IPAddr']); |
|||
$Frr = explode( ' ', $R['XAddrs']); |
|||
$Crr = explode( $CI, $Frr[0] ); |
|||
$CP = $DATABASE->escape($Crr[1]); |
|||
$CN = ''; |
|||
$CH = ''; |
|||
$CC = 0; |
|||
foreach( $TArr as $T ){ |
|||
$TT = str_ireplace('onvif://www.onvif.org/','', $T ); |
|||
$TBrr = explode( '/', $TT ); |
|||
if( stripos($TBrr[0],'type') !== false ){ |
|||
if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; |
|||
if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; |
|||
if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; |
|||
}; |
|||
if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); |
|||
}; |
|||
$QS = "INSERT INTO cameras SET caps={$CC}, hardware='{$CH}', name='{$CN}', uuid='{$CA}', mac='{$CM}', ip='{$CI}', status=1, onvif_ctrl='{$CP}' ON DUPLICATE KEY UPDATE ip='{$CI}'"; |
|||
$DATABASE->Query($QS,false); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
$QS = "SELECT * FROM cameras WHERE status = 1"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
foreach( $Result as $CD ){ |
|||
$cnode['id'] = $CD['id']; |
|||
$cnode['title'] = $CD['name']; |
|||
$Data['nodes'][] = $cnode; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,53 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/onvif/toto.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
if( 1 ){ |
|||
$onvif = new Ponvif(); |
|||
$result = $onvif->discover(); |
|||
if(count($result)){ |
|||
foreach( $result as $R ){ |
|||
if(isset($R['EndpointReference'])){ |
|||
if(isset($R['EndpointReference']['Address'])){ |
|||
$TArr = explode( ':', $R['EndpointReference']['Address'] ); |
|||
$CA = $DATABASE->escape( $TArr[2] ); |
|||
$TArr = explode( ' ', $R['Scopes']); |
|||
$CM = ''; |
|||
$CI = $DATABASE->escape($R['IPAddr']); |
|||
$Frr = explode( ' ', $R['XAddrs']); |
|||
$Crr = explode( $CI, $Frr[0] ); |
|||
$CP = $DATABASE->escape($Crr[1]); |
|||
$CN = ''; |
|||
$CH = ''; |
|||
$CC = 0; |
|||
foreach( $TArr as $T ){ |
|||
$TT = str_ireplace('onvif://www.onvif.org/','', $T ); |
|||
$TBrr = explode( '/', $TT ); |
|||
if( stripos($TBrr[0],'type') !== false ){ |
|||
if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; |
|||
if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; |
|||
if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; |
|||
}; |
|||
if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); |
|||
if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); |
|||
}; |
|||
$QS = "INSERT INTO cameras SET caps={$CC}, hardware='{$CH}', name='{$CN}', uuid='{$CA}', mac='{$CM}', ip='{$CI}', status=1, onvif_ctrl='{$CP}' ON DUPLICATE KEY UPDATE ip='{$CI}'"; |
|||
$DATABASE->Query($QS,false); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
$QS = "SELECT * FROM cameras WHERE status = 1"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
foreach( $Result as $CD ){ |
|||
$cnode['id'] = $CD['id']; |
|||
$cnode['title'] = $CD['name']; |
|||
$Data['nodes'][] = $cnode; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,23 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/onvif/toto.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Data = array(); |
|||
if( isset( $_POST['CID'] ) ){ |
|||
$ECID = intval( $_POST['CID'] ); |
|||
$QS = "SELECT * FROM camera_streams WHERE camera_id={$ECID}"; |
|||
$Result = $DATABASE->Query($QS,false); |
|||
foreach( $Result as $CD ){ |
|||
$cnode['id'] = $CD['id']; |
|||
$cnode['name'] = $CD['name']; |
|||
$cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; |
|||
$cnode['encode'] = $CD['compression_type']; |
|||
$cnode['bitrate'] = $CD['bitrate']; |
|||
$Data['nodes'][] = $cnode; |
|||
}; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue