Browse Source

MOJO web December

master
Evgeny Gagua 4 years ago
parent
commit
165f96eb1b
  1. 1
      .gitignore
  2. 7
      index.php
  3. 7
      lib/ajax_asm.php
  4. 5
      lib/assembler.php
  5. 72
      lib/controller/addModule.php
  6. 12
      lib/controller/addNode.php
  7. BIN
      lib/controller/data/factory.db
  8. BIN
      lib/controller/data/mysqlitedb.db
  9. 1
      lib/controller/data/mysqlitedb.sqbpro
  10. BIN
      lib/controller/data/reports.db
  11. BIN
      lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4
  12. BIN
      lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4
  13. BIN
      lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4
  14. BIN
      lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4
  15. BIN
      lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4
  16. BIN
      lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4
  17. BIN
      lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4
  18. BIN
      lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4
  19. BIN
      lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4
  20. 108
      lib/controller/debug.txt
  21. 116
      lib/controller/discoverOnvifProfiles.php
  22. 0
      lib/controller/discoverOnvifSources.php
  23. 268
      lib/controller/doCameraOperation.php
  24. 13
      lib/controller/doModuleOperation.php
  25. 9
      lib/controller/doNodeOperation.php
  26. 33
      lib/controller/doResourceOperation.php
  27. BIN
      lib/controller/frame.raw
  28. 785
      lib/controller/getCameraEditor.php
  29. 78
      lib/controller/getCameraPreview.php
  30. 31
      lib/controller/getCameras.php
  31. 18
      lib/controller/getModuleEditor.php
  32. 16
      lib/controller/getModuleInfo.php
  33. 2
      lib/controller/getModuleSettings.php
  34. 43
      lib/controller/getModules.php
  35. 70
      lib/controller/getResources.php
  36. 31
      lib/controller/getServerStatus.php
  37. 59
      lib/controller/getVideoFeed.php
  38. 4
      lib/controller/help/topic_100.json
  39. BIN
      lib/controller/output.jpg
  40. 15
      lib/controller/test.sh
  41. 0
      lib/controller/validateUserSession.php
  42. 0
      lib/controller/zuza/addCameraNode.php
  43. 0
      lib/controller/zuza/addConnection.php
  44. 0
      lib/controller/zuza/addDetectionProfile.php
  45. 12
      lib/controller/zuza/addServerModule.php
  46. 0
      lib/controller/zuza/addWidthTableRow.php
  47. 0
      lib/controller/zuza/camMakeMove.php
  48. 0
      lib/controller/zuza/camStop.php
  49. 0
      lib/controller/zuza/checkDeviceOperation.php
  50. 0
      lib/controller/zuza/clearEventCloud.php
  51. 0
      lib/controller/zuza/clearServerLog.php
  52. 0
      lib/controller/zuza/getAnalogStreamCtrl.php
  53. 0
      lib/controller/zuza/getCameraSettings.php
  54. 2
      lib/controller/zuza/getDashBoardItems.php
  55. 0
      lib/controller/zuza/getDashBoardStatus.php
  56. 0
      lib/controller/zuza/getDetectionProfile.php
  57. 0
      lib/controller/zuza/getDeviceDraw.php
  58. 0
      lib/controller/zuza/getDeviceMask.php
  59. 4
      lib/controller/zuza/getEventDates.php
  60. 0
      lib/controller/zuza/getEventProps.php
  61. 0
      lib/controller/zuza/getEventRecords.php
  62. 0
      lib/controller/zuza/getGeoAlerts.php
  63. 3
      lib/controller/zuza/getGeoZones.php
  64. 12
      lib/controller/zuza/getHelpTopic.php
  65. 0
      lib/controller/zuza/getIpCamCredentials.php
  66. 0
      lib/controller/zuza/getLocationItems.php
  67. 0
      lib/controller/zuza/getLocationNodeProps.php
  68. 0
      lib/controller/zuza/getLocationNodes.php
  69. 0
      lib/controller/zuza/getM3U8.php
  70. 0
      lib/controller/zuza/getMaskSchedule.php
  71. 0
      lib/controller/zuza/getMaskScheduleEditor.php
  72. 4
      lib/controller/zuza/getNetwork.php
  73. 0
      lib/controller/zuza/getNetworkNodeProps.php
  74. 0
      lib/controller/zuza/getNetworkSe2rverProps.php
  75. 0
      lib/controller/zuza/getNodeAdvancedNfo.php
  76. 0
      lib/controller/zuza/getNodeBasicNfo.php
  77. 0
      lib/controller/zuza/getNodeSettings.php
  78. 0
      lib/controller/zuza/getPicture.php
  79. 0
      lib/controller/zuza/getResourceInfo.php
  80. 0
      lib/controller/zuza/getSettingsLRF.php
  81. 5
      lib/controller/zuza/getStatus.php
  82. 0
      lib/controller/zuza/getTimeLineEvents.php
  83. 0
      lib/controller/zuza/getTimeLineGroups.php
  84. 0
      lib/controller/zuza/getWidthTable.php
  85. 0
      lib/controller/zuza/getWidthTableEditor.php
  86. 0
      lib/controller/zuza/listAccessLog.php
  87. 53
      lib/controller/zuza/listAndDiscoverLocalSources.php
  88. 0
      lib/controller/zuza/listAndDiscoverOnvifProfiles.php
  89. 53
      lib/controller/zuza/listAndDiscoverOnvifSources.php
  90. 23
      lib/controller/zuza/listDiscoveredOnvifProfiles.php
  91. 0
      lib/controller/zuza/listMediaSources.php
  92. 0
      lib/controller/zuza/listNodeSockets.php
  93. 0
      lib/controller/zuza/listServerLog.php
  94. 0
      lib/controller/zuza/listServers.php
  95. 0
      lib/controller/zuza/listUarts.php
  96. 0
      lib/controller/zuza/listUsers.php
  97. 0
      lib/controller/zuza/removeNode.php
  98. 0
      lib/controller/zuza/resetAllSettings.php
  99. 0
      lib/controller/zuza/setAnalogStreamCtrl.php
  100. 0
      lib/controller/zuza/setSettingsLidsr3D.php

1
.gitignore

@ -0,0 +1 @@
error.log

7
index.php

@ -4,19 +4,22 @@
if( $CUser->Data['access'] > 5 ){
UI_PageHeaderExt(
'rgoose_general.js',
array(
array(
'rgoose_global_vars.js',
'rgoose_swupgrade.js',
'rgoose_map.js',
'rgoose_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'rgoose_sysmap_editor.js',
'mojo_monitoring.js',
//'rgoose_sysmap_editor.js',
'rgoose_location_editor.js',
'rgoose_dashboard.js',
'rgoose_users.js',
'rgoose_logs.js',
'rgoose_single_ipi.js',
'mojo_settings.js',
'rgoose_main.js'
)
);

7
lib/ajax_asm.php

@ -4,7 +4,7 @@ require_once('settings.php');
require_once('defines.php');
// SET DATA CONNECTION AND GLOBAL USER VARIABLES
$TT_123 = explode( '.', PHP_VERSION );
/*$TT_123 = explode( '.', PHP_VERSION );
if( $TT_123[0] == '4' ){
require_once( 'php/db/MySQL_class.php' );
$DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword);
@ -14,6 +14,9 @@ if( $TT_123[0] == '4' ){
} else {
exit();
};
*/
require_once( 'php/db/SQLite_Class.php');
$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db');
//$DATABASE->SetCacheDir( $DBCacheDir );
@ -24,7 +27,7 @@ require_once('php/db/user_class.php');
require_once('php/auth/web.php');
require_once('php/db/language_class.php');
require_once('php/sys/r-goose_sys.php');
require_once('php/argus/argus.php');
require_once('php/argus/mojo.php');

5
lib/assembler.php

@ -4,6 +4,7 @@ require_once('settings.php');
require_once('defines.php');
// SET DATA CONNECTION AND GLOBAL USER VARIABLES
/*
$TT_123 = explode( '.', PHP_VERSION );
if( $TT_123[0] == '4' ){
require_once( 'php/db/MySQL_class.php' );
@ -14,6 +15,10 @@ if( $TT_123[0] == '4' ){
} else {
exit();
};
*/
require_once( 'php/db/SQLite_Class.php');
$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db');
$str = @file_get_contents('/proc/uptime');
$num = floatval($str);

72
lib/controller/addModule.php

@ -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: /');
?>

lib/controller/addNetworkNode.php → lib/controller/addNode.php

BIN
lib/controller/data/factory.db

Binary file not shown.

BIN
lib/controller/data/mysqlitedb.db

Binary file not shown.

1
lib/controller/data/mysqlitedb.sqbpro

@ -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>

BIN
lib/controller/data/reports.db

Binary file not shown.

BIN
lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4

Binary file not shown.

BIN
lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4

Binary file not shown.

BIN
lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4

Binary file not shown.

BIN
lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4

Binary file not shown.

BIN
lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4

Binary file not shown.

BIN
lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4

Binary file not shown.

BIN
lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4

Binary file not shown.

BIN
lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4

Binary file not shown.

BIN
lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4

Binary file not shown.

108
lib/controller/debug.txt

@ -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),

116
lib/controller/discoverOnvifProfiles.php

@ -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: /');
};
?>

lib/controller/listAndDiscoverOnvifSources.php → lib/controller/discoverOnvifSources.php

268
lib/controller/doCameraOperation.php

@ -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: /');
};
?>

13
lib/controller/doModuleOperation.php

@ -20,7 +20,7 @@
$Data['success'] = true;
switch( $CMD ){
case 1: {
$QS = "SELECT * FROM `server_modules` WHERE `id`={$MID}";
$QS = "SELECT * FROM `modules` WHERE `id`={$MID}";
$TT = $DATABASE->Query( $QS );
if( count( $TT ) ){
$JJ = $TT[0];
@ -39,8 +39,13 @@
$DATABASE->Query( $QS );
break;
};
case 6:{//SSDP
$QS = "DELETE FROM `module_ssdp` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
case 9:{// Embed VIO
$QS = "DELETE FROM `module_embed_video_settings` WHERE `id`={$JJ['aux_id']}";
$QS = "DELETE FROM `module_eve` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
break;
};
@ -53,12 +58,12 @@
};
};
$QS = "DELETE FROM `server_modules` WHERE `id`={$MID}";
$QS = "DELETE FROM `modules` WHERE `id`={$MID}";
$DATABASE->Query( $QS );
};
break;
};
case 2: $QS = "UPDATE `server_modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break;
case 2: $QS = "UPDATE `modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break;
};
$DATABASE->Query( $QS, false );
$Data['query'] = $QS;

lib/controller/doDeviceOperation.php → lib/controller/doNodeOperation.php

33
lib/controller/doResourceOperation.php

@ -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: /');
?>

BIN
lib/controller/frame.raw

Binary file not shown.

After

Width: 1280  |  Height: 720  |  Size: 121 KiB

785
lib/controller/getCameraEditor.php

@ -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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
},{
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&nbsp;1</p>');
} else {
Ext.getCmp('zoom_val').disable();
var zz = Ext.getCmp('zoom_d');
if( zz.rendered ) zz.update('&nbsp;');
};
},
listeners:{
change: function( r, n, o ){
if( n ) {
doCamOperation( {$CID}, 4, 1.0 );
};
}
}
},{
html: '&nbsp;'
},{
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&nbsp;'+ c + '</p>');
}
}
},{
id: 'zoom_d',
html: (( parseFloat({$Cam['zoom']})==0 )?'&nbsp;':'<p>X&nbsp;'+ {$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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
},{
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: '&nbsp;'
}]
}]
},{
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: /');
};
?>

78
lib/controller/getCameraPreview.php

@ -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: /');
?>

31
lib/controller/getCameras.php

@ -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: /');
};
?>

18
lib/controller/getModuleEditor.php

@ -3,12 +3,12 @@
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['MID'] );
$QS = "SELECT * FROM server_modules WHERE id = {$EID}";
$QS = "SELECT * FROM modules WHERE id = {$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
switch( $CR['type'] ){
case 1: //ZLMedia
case 0: //ZLMedia
$TPL =<<<EFUFU
{
xtype: 'form',
@ -87,9 +87,9 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 2: //DCB USB
case 1: //DCB USB
break;
case 3: //Kafka
case 2: //Kafka
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];
@ -172,7 +172,9 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 7: // SSDP
case 6: // SSDP
//$QS = "SELECT * FROM `module_ssdp` WHERE `module_id`={$CR['aux_id']}";
//$ZZ = $DATABASE->Query( $QS );
$TPL =<<<EFUFU
{
xtype: 'form',
@ -239,7 +241,7 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 8: // Onvif
case 7: // Onvif
$TPL =<<<EFUFU
{
xtype: 'form',
@ -305,7 +307,7 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 9://Embed Video Encoder
case 8://Embed Video Encoder
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];
@ -387,7 +389,7 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 10: //Modem
case 9: //Modem
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];

16
lib/controller/getModuleInfo.php

@ -4,45 +4,45 @@
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['MID'] );
switch( $EID ){
case 1: //ZLMedia
case 0: //ZLMedia
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td width="65px"><img width="64px" src="/style/assets/ZL_logo.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL );
echo $TPL;
break;
case 2: //DCB USB
case 1: //DCB USB
echo "TBD";
break;
case 3: //Kafka
case 2: //Kafka
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td width="65px"><img width="64px" src="/style/assets/Kafka.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL );
echo $TPL;
break;
case 3:
case 4:
case 5:
case 6:
echo "TBD";
break;
case 7: // SSDP
case 6: // SSDP
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="SSDP"><tr><td width="65px"><img width="64px" src="/style/assets/upnp.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL );
echo $TPL;
break;
case 8: // Onvif
case 7: // Onvif
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="ONVIF"><tr><td width="65px"><img width="64px" src="/style/assets/onvif.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL );
echo $TPL;
break;
case 9://Embed Video Encoder
case 8://Embed Video Encoder
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="EVE"><tr><td width="65px"><img width="64px" src="/style/assets/ffmpeg.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL );
echo $TPL;
break;
case 10: //Modem
case 9: //Modem
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL );

2
lib/controller/getModuleSettings.php

@ -3,7 +3,7 @@
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['MID'] );
$QS = "SELECT * FROM server_modules WHERE id = {$EID}";
$QS = "SELECT * FROM modules WHERE id = {$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];

43
lib/controller/getModules.php

@ -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: /');
};
?>

70
lib/controller/getResources.php

@ -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: /');
};
?>

31
lib/controller/getServerStatus.php

@ -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 );
?>

59
lib/controller/getVideoFeed.php

@ -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: /');
?>

4
lib/controller/help/topic_100.json

@ -0,0 +1,4 @@
{
xtype: 'panel',
html: 'Help Topic 100'
}

BIN
lib/controller/output.jpg

Binary file not shown.

After

Width: 1280  |  Height: 720  |  Size: 177 KiB

15
lib/controller/test.sh

@ -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

lib/controller/updateUserSssion.php → lib/controller/validateUserSession.php

lib/controller/addCameraNode.php → lib/controller/zuza/addCameraNode.php

lib/controller/addConnection.php → lib/controller/zuza/addConnection.php

lib/controller/addDetectionProfile.php → lib/controller/zuza/addDetectionProfile.php

lib/controller/addServerModule.php → lib/controller/zuza/addServerModule.php

lib/controller/addWidthTableRow.php → lib/controller/zuza/addWidthTableRow.php

lib/controller/camMakeMove.php → lib/controller/zuza/camMakeMove.php

lib/controller/camStop.php → lib/controller/zuza/camStop.php

lib/controller/checkDeviceOperation.php → lib/controller/zuza/checkDeviceOperation.php

lib/controller/clearEventCloud.php → lib/controller/zuza/clearEventCloud.php

lib/controller/clearServerLog.php → lib/controller/zuza/clearServerLog.php

lib/controller/getAnalogStreamCtrl.php → lib/controller/zuza/getAnalogStreamCtrl.php

lib/controller/getCameraSettings.php → lib/controller/zuza/getCameraSettings.php

lib/controller/getDashBoardItems.php → lib/controller/zuza/getDashBoardItems.php

lib/controller/getDashBoardStatus.php → lib/controller/zuza/getDashBoardStatus.php

lib/controller/getDetectionProfile.php → lib/controller/zuza/getDetectionProfile.php

lib/controller/getDeviceDraw.php → lib/controller/zuza/getDeviceDraw.php

lib/controller/getDeviceMask.php → lib/controller/zuza/getDeviceMask.php

lib/controller/getEventDates.php → lib/controller/zuza/getEventDates.php

lib/controller/getEventProps.php → lib/controller/zuza/getEventProps.php

lib/controller/getEventRecords.php → lib/controller/zuza/getEventRecords.php

lib/controller/getGeoAlerts.php → lib/controller/zuza/getGeoAlerts.php

lib/controller/getGeoZones.php → lib/controller/zuza/getGeoZones.php

12
lib/controller/zuza/getHelpTopic.php

@ -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: / ');
?>

lib/controller/getIpCamCredentials.php → lib/controller/zuza/getIpCamCredentials.php

lib/controller/getLocationItems.php → lib/controller/zuza/getLocationItems.php

lib/controller/getLocationNodeProps.php → lib/controller/zuza/getLocationNodeProps.php

lib/controller/getLocationNodes.php → lib/controller/zuza/getLocationNodes.php

lib/controller/getM3U8.php → lib/controller/zuza/getM3U8.php

lib/controller/getMaskSchedule.php → lib/controller/zuza/getMaskSchedule.php

lib/controller/getMaskScheduleEditor.php → lib/controller/zuza/getMaskScheduleEditor.php

lib/controller/getNetwork.php → lib/controller/zuza/getNetwork.php

lib/controller/getNetworkNodeProps.php → lib/controller/zuza/getNetworkNodeProps.php

lib/controller/getNetworkSe2rverProps.php → lib/controller/zuza/getNetworkSe2rverProps.php

lib/controller/getNodeAdvancedNfo.php → lib/controller/zuza/getNodeAdvancedNfo.php

lib/controller/getNodeBasicNfo.php → lib/controller/zuza/getNodeBasicNfo.php

lib/controller/getNodeSettings.php → lib/controller/zuza/getNodeSettings.php

lib/controller/getPicture.php → lib/controller/zuza/getPicture.php

lib/controller/getResourceInfo.php → lib/controller/zuza/getResourceInfo.php

lib/controller/getSettingsLRF.php → lib/controller/zuza/getSettingsLRF.php

lib/controller/getStatus.php → lib/controller/zuza/getStatus.php

lib/controller/getTimeLineEvents.php → lib/controller/zuza/getTimeLineEvents.php

lib/controller/getTimeLineGroups.php → lib/controller/zuza/getTimeLineGroups.php

lib/controller/getWidthTable.php → lib/controller/zuza/getWidthTable.php

lib/controller/getWidthTableEditor.php → lib/controller/zuza/getWidthTableEditor.php

lib/controller/listAccessLog.php → lib/controller/zuza/listAccessLog.php

53
lib/controller/zuza/listAndDiscoverLocalSources.php

@ -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: /');
};
?>

lib/controller/listAndDiscoverOnvifProfiles.php → lib/controller/zuza/listAndDiscoverOnvifProfiles.php

53
lib/controller/zuza/listAndDiscoverOnvifSources.php

@ -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: /');
};
?>

23
lib/controller/zuza/listDiscoveredOnvifProfiles.php

@ -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: /');
};
?>

lib/controller/listMediaSources.php → lib/controller/zuza/listMediaSources.php

lib/controller/listNodeSockets.php → lib/controller/zuza/listNodeSockets.php

lib/controller/listServerLog.php → lib/controller/zuza/listServerLog.php

lib/controller/listServers.php → lib/controller/zuza/listServers.php

lib/controller/listUarts.php → lib/controller/zuza/listUarts.php

lib/controller/listUsers.php → lib/controller/zuza/listUsers.php

lib/controller/removeNode.php → lib/controller/zuza/removeNode.php

lib/controller/resetAllSettings.php → lib/controller/zuza/resetAllSettings.php

lib/controller/setAnalogStreamCtrl.php → lib/controller/zuza/setAnalogStreamCtrl.php

lib/controller/setSettingsLidsr3D.php → lib/controller/zuza/setSettingsLidsr3D.php

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save