-
50lib/controller/addNetworkNode.php
-
9lib/controller/clearEventCloud.php
-
26lib/controller/getDetectionProfile.php
-
4lib/controller/getDeviceMask.php
-
118lib/controller/getEventRecords.php
-
50lib/controller/getGeoAlerts.php
-
166lib/controller/getGeoZones.php
-
2lib/controller/getIpCamCredentials.php
-
44lib/controller/getLocationItems.php
-
146lib/controller/getLocationNodeProps.php
-
7lib/controller/getLocationNodes.php
-
514lib/controller/getModuleEditor.php
-
36lib/controller/getNetworkNodeProps.php
-
0lib/controller/getNetworkSe2rverProps.php
-
235lib/controller/getNodeSettings.php
-
430lib/controller/getResourceEditor.php
-
6lib/controller/getSettingsLRF.php
-
4lib/controller/getStatus.php
-
4lib/controller/listAndDiscoverOnvifProfiles.php
-
22lib/controller/listMediaSources.php
-
4lib/controller/listServers.php
-
70lib/controller/props/1_node_prop.js
-
130lib/controller/props/loc_prop.js
-
40lib/controller/updateDetecttionProfile.php
-
127lib/controller/updateLocation.php
-
28lib/controller/updateLrfSettings.php
-
43lib/controller/updateLrfSettings_baseshift.php
-
35lib/controller/updateResource.php
-
86lib/controller/uploadDeviceMask.php
-
2lib/defines.php
-
121lib/javascript/jsapi_dynamic/rgoose_cameras.js
-
436lib/javascript/jsapi_dynamic/rgoose_dashboard.js
-
735lib/javascript/jsapi_dynamic/rgoose_devices.js
-
173lib/javascript/jsapi_dynamic/rgoose_location_editor.js
-
11lib/javascript/jsapi_dynamic/rgoose_main.js
-
407lib/javascript/jsapi_dynamic/rgoose_reports.js
-
2lib/javascript/jsapi_dynamic/rgoose_swupgrade.js
-
142lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js
-
343lib/php/argus/argus.php
-
64lib/php/onvif/oooo.txt
-
21lib/php/onvif/test_v11.php
-
10lib/php/onvif/toto.php
-
838lib/php/onvif/toto2.php
-
1lib/php/setup_toolkit
-
13lib/php/setup_toolkit/cleanNewTask.php
-
66lib/php/setup_toolkit/createNewTask.php
-
52lib/php/setup_toolkit/getTaskStatus.php
-
39lib/php/setup_toolkit/list_vault.php
-
54lib/php/setup_toolkit/upload.php
-
1lib/php/setup_toolkit/vault
-
1lib/version.var
-
BINstyle/assets/10_node.png
-
BINstyle/assets/Argus User Guide Breef.doc
-
BINstyle/assets/Circle_arrow_left_font_awesome.svg.png
-
0style/assets/Home-Server-icon 256.png
-
BINstyle/assets/Kafka-logo.png
-
BINstyle/assets/Kafka.png
-
BINstyle/assets/NIC.png
-
BINstyle/assets/NICs.png
-
BINstyle/assets/Untitled-8891.png
-
BINstyle/assets/ZL_logo.png
-
BINstyle/assets/argus_logo_text_outlined.png
-
BINstyle/assets/ffmpeg.png
-
BINstyle/assets/image_processing20210831-10967-z0rra0.png
-
BINstyle/assets/images (1).png
-
BINstyle/assets/logo.png
-
BINstyle/assets/modem.png
-
BINstyle/assets/onvif.png
-
BINstyle/assets/rad_c_ico.png
-
BINstyle/assets/rad_o_ico.png
-
BINstyle/assets/rad_r_ico.png
-
BINstyle/assets/rad_v_ico.png
-
BINstyle/assets/rad_y_ico.png
-
BINstyle/assets/rado_ico.psd
-
BINstyle/assets/rado_ico_small.psd
-
BINstyle/assets/rtsp.png
-
BINstyle/assets/screans-1.psd
-
BINstyle/assets/upnp.png
-
BINstyle/assets/vg.png
-
66style/style.css
@ -1,9 +1,12 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
//$QS = "INSERT INTO `events_archive` (`id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid`) SELECT `id`, `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`ref_id`,`ref_uuid` FROM `events_cloud`";
|
|||
//$DATABASE->Query( $QS, false );
|
|||
$QS = "DELETE FROM events_cloud"; |
|||
if( isset( $_POST['NID'] )){ |
|||
$NODE = intval( $_POST['NID'] ); |
|||
$QS = "DELETE FROM `events_cloud` WHERE `node_id`={$NODE}"; |
|||
} else { |
|||
$QS = "DELETE FROM `events_cloud`"; |
|||
}; |
|||
$DATABASE->Query( $QS, false ); |
|||
} else { |
|||
header('location: /'); |
|||
|
|||
@ -1,83 +1,81 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/utm/gPoint.php'); |
|||
|
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Node = intval( $_POST['NODE'] ); |
|||
$QS = "SELECT * FROM nodes WHERE id = {$Node}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$Props = $Result[0]; |
|||
$Type = intval( $Props['type'] ); |
|||
$TName = 'props/loc_prop.js';// '.$Type.'_node_prop.js';
|
|||
$Data = file_get_contents( $TName ); |
|||
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); |
|||
$Data = str_replace('%%%TYPE%%%', $Type, $Data ); |
|||
switch( $Type ){ |
|||
case 1: |
|||
case 2: |
|||
case 3: |
|||
case 4: |
|||
case ARGUS_3D_SENSOR:{ |
|||
$QS = "SELECT * FROM lrf_sensors WHERE id={$Props['aux_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$C = $RR[0]; |
|||
|
|||
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); |
|||
$Data = str_replace('%%%NAME%%%', $Props['name'] , $Data ); |
|||
//Loc
|
|||
$LAT = floatval( $C['lat'] ); |
|||
$LON = floatval( $C['lon'] ); |
|||
$ALT = floatval( $C['alt'] ); |
|||
$ROLL = floatval( $C['roll'] ); |
|||
$PITCH = floatval( $C['pitch'] ); |
|||
$YAW = floatval( $C['yaw'] ); |
|||
$Data = str_replace( '%%%LAT%%%', $LAT, $Data ); |
|||
$Data = str_replace( '%%%LON%%%', $LON, $Data ); |
|||
$Data = str_replace( '%%%ALT%%%', $ALT, $Data ); |
|||
$Data = str_replace( '%%%ROLL%%%', $ROLL, $Data ); |
|||
$Data = str_replace( '%%%PITCH%%%', $PITCH, $Data ); |
|||
$Data = str_replace( '%%%YAW%%%', $YAW, $Data ); |
|||
//Info
|
|||
$InfoData = ''; |
|||
$InfoParts = array(); |
|||
$InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ID">'.$Server['identity'].'</div>\'}'; |
|||
switch( intval($Props['online']) ){ |
|||
case 0: $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_OFF">Offline</div>\'}'; break; |
|||
case 1: $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Handler Online</div>\'}'; break; |
|||
case 3: $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Master Online</div>\'}'; break; |
|||
case 5: $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Slave Online</div>\'}'; break; |
|||
case 7: $InfoParts[] = '{ xtype: \'panel\', html: \'<div class="sideInfo_item" id="INFO_ON">Device Online</div>\'}'; break; |
|||
$Node = intval( $_POST['NODE'] ); |
|||
$QS = "SELECT * FROM `nodes` WHERE id = {$Node}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$Props = $Result[0]; |
|||
$Type = intval( $Props['type'] ); |
|||
$TName = 'props/loc_prop.js'; |
|||
$QS = "SELECT * FROM `sites` WHERE `id`={$Props['site_id']}"; |
|||
$R = $DATABASE->Query($QS); |
|||
$SLAT = $R[0]['anchor_lat']; |
|||
$SLON = $R[0]['anchor_lon']; |
|||
$SALT = $R[0]['anchor_alt']; |
|||
$A = new gPoint(); |
|||
$A->setLongLat( $SLON, $SLAT ); |
|||
$A->convertLLtoTM(); |
|||
$XC = $A->E(); |
|||
$YC = $A->N(); |
|||
$Zo = floatval( $SALT ); |
|||
$ZC = $A->Z(); |
|||
|
|||
$Data = file_get_contents( $TName ); |
|||
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); |
|||
$Data = str_replace('%%%TYPE%%%', $Type, $Data ); |
|||
$Data = str_replace('%%%NAME%%%', $Props['name'] , $Data ); |
|||
switch( $Type ){ |
|||
case 1: |
|||
case 2: |
|||
case 3: |
|||
case 4: |
|||
case ARGUS_3D_SENSOR: |
|||
case 6:{ |
|||
$QS = "SELECT * FROM lrf_sensors WHERE id={$Props['aux_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$C = $RR[0]; |
|||
break; |
|||
}; |
|||
$InfoData = implode( ',', $InfoParts ); |
|||
$Data = str_replace('%%%INFO%%%', $InfoData, $Data ); |
|||
break; |
|||
}; |
|||
case 10: |
|||
case 13:{ |
|||
$QS="SELECT * FROM cameras WHERE id={$Props['aux_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$C = $RR[0]; |
|||
$LAT = floatval( $C['lat'] ); |
|||
$LON = floatval( $C['lon'] ); |
|||
$ALT = floatval( $C['alt'] ); |
|||
$ROLL = floatval( $C['roll'] ); |
|||
$PITCH = floatval( $C['pitch'] ); |
|||
$YAW = floatval( $C['yaw'] ); |
|||
$Data = str_replace( '%%%LAT%%%', $LAT, $Data ); |
|||
$Data = str_replace( '%%%LON%%%', $LON, $Data ); |
|||
$Data = str_replace( '%%%ALT%%%', $ALT, $Data ); |
|||
$Data = str_replace( '%%%ROLL%%%', $ROLL, $Data ); |
|||
$Data = str_replace( '%%%PITCH%%%', $PITCH, $Data ); |
|||
$Data = str_replace( '%%%YAW%%%', $YAW, $Data ); |
|||
$Data = str_replace( '%%%NAME%%%', urldecode( $C['name'] ), $Data ); |
|||
break; |
|||
case 10: |
|||
case 11: |
|||
case 12: |
|||
case 13:{ |
|||
$QS="SELECT * FROM cameras WHERE id={$Props['aux_id']}"; |
|||
$RR = $DATABASE->Query( $QS ); |
|||
$C = $RR[0]; |
|||
break; |
|||
}; |
|||
default: $Data = '{}'; |
|||
}; |
|||
default: $Data = '{}'; |
|||
$DX = floatval( $C['x'] ); |
|||
$DY = floatval( $C['y'] ); |
|||
$DZ = floatval( $C['z'] ); |
|||
$CC = new gPoint(); |
|||
$CC->setUTM( $XC + $DX, $YC + $DY, $ZC ); |
|||
$CC->convertTMtoLL(); |
|||
$LAT = $CC->Lat(); |
|||
$LON = $CC->Long(); |
|||
$ALT = $Zo + $DZ; |
|||
$ROLL = floatval( $C['x_rot'] ); |
|||
$PITCH = floatval( $C['y_rot'] ); |
|||
$YAW = floatval( $C['z_rot'] ); |
|||
$Data = str_replace( '%%%LAT%%%', $LAT, $Data ); |
|||
$Data = str_replace( '%%%LON%%%', $LON, $Data ); |
|||
$Data = str_replace( '%%%ALT%%%', $ALT, $Data ); |
|||
$Data = str_replace( '%%%ROLL%%%', $ROLL, $Data ); |
|||
$Data = str_replace( '%%%PITCH%%%', $PITCH, $Data ); |
|||
$Data = str_replace( '%%%YAW%%%', $YAW, $Data ); |
|||
$Data = str_replace( '%%%DX%%%', $DX, $Data ); |
|||
$Data = str_replace( '%%%DY%%%', $DY, $Data ); |
|||
$Data = str_replace( '%%%DZ%%%', $DZ, $Data ); |
|||
echo $Data; |
|||
} else { |
|||
echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; |
|||
}; |
|||
echo $Data; |
|||
} else { |
|||
echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; |
|||
}; |
|||
} else { |
|||
header('location: /'); |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,514 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
|
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$EID = intval( $_POST['MID'] ); |
|||
$QS = "SELECT * FROM server_modules WHERE id = {$EID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$CR = $Result[0]; |
|||
switch( $CR['type'] ){ |
|||
case 1: //ZLMedia
|
|||
$QS = "SELECT * FROM uart_settings WHERE id={$CR['aux_id']}"; |
|||
$Result = $DATABASE->Query( $QS ); |
|||
$Z = $Result[0]; |
|||
$R_name = $Labels->GetLabel('_RES_HW_UART_DESC_'); |
|||
$R_dev = $CR['device']; |
|||
$R_nfo = 'Speed: ' . $Z['speed'] . ', Bits: ' . $Z['bit'] . ', Parity: ' . $Z['parity'] . ', Stop Bit: '. $Z['stop_bit']; |
|||
$R_image = 'unnamed.png'; |
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_edit_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Edit Module Config', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 2: //DCB USB
|
|||
break; |
|||
case 3: //Kafka
|
|||
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
$R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'<img title="SSL Encription" src="/style/icons/icons/rosette.png">':'<img title="NO Encription" src="/style/icons/icons/flag_green.png">'); |
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_edit_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Edit Module Config', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 7: // SSDP
|
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="SSDP"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 8: // Onvif
|
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="ONVIF"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%',$Labels->GetLabel('_MOD_NO_NEDCONF_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 9://Embed Video Encoder |
|||
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="EVE"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_edit_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Edit Module Config', |
|||
handler: function(){ |
|||
embedVideoEncoderSettings(0); |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 10: //Modem
|
|||
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
$R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'<img title="SSL Encription" src="/style/icons/icons/rosette.png">':'<img title="NO Encription" src="/style/icons/icons/flag_green.png">'); |
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
autoScroll: 'auto', |
|||
labelWidth: 120, |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<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>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Module Status', |
|||
id: 'mod_ena', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['status_val','status_txt'], |
|||
data: [[0,'Disabled'],[1,'Enabled']] |
|||
}), |
|||
value: %%%ENA_VAL%%%, |
|||
valueField: 'status_val', |
|||
displayField: 'status_txt' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_edit_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Edit Module Config', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'mo_del_btn', |
|||
disabled: false, |
|||
width: '100%', |
|||
text: 'Remove Module', |
|||
handler: function(){ |
|||
} |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 5 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); |
|||
$TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL ); |
|||
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
}; |
|||
} else { |
|||
echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; |
|||
}; |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -1,4 +1,233 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
echo "{}"; |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$Z = intval( $_POST['NID'] ); |
|||
if( $Z ){ |
|||
$QS = "SELECT * FROM `nodes` WHERE `id`={$Z}"; |
|||
$NN = $DATABASE->Query( $QS ); |
|||
if( count( $NN ) ){ |
|||
$Node = $NN[0]; |
|||
switch( $Node['type'] ){ |
|||
case 0:{ |
|||
$QS="SELECT * FROM `servers` WHERE `id`={$Node['aux_id']}"; |
|||
$SDD = $DATABASE->Query( $QS ); |
|||
$NData = $SDD[0]; |
|||
$QS="SELECT * FROM `resources` WHERE `node_id`={$Z} AND ( `type`=101 OR `type`=102 )"; |
|||
$CN = $DATABASE->Query( $QS ); |
|||
$IL=array(); |
|||
foreach( $CN as $N ){ |
|||
$QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0"; |
|||
$NWD = $DATABASE->Query( $QS ); |
|||
$NW = $NWD[0]; |
|||
$IL[]="<td width=\"50px\"><img width=\"32\" src=\"/style/assets/".(($N['type']==101)?'NICs.png':'wifi-icon.png')."\"></td><td align=\"right\"><b>{$N['device']}:</b></td><td><b>{$NW['address']}</b></td>"; |
|||
}; |
|||
$NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>'; |
|||
?>
|
|||
{ |
|||
xtype: 'tabpanel', |
|||
frame: false, |
|||
id: 'node_settings_content', |
|||
border: false, |
|||
activeTab: 0, |
|||
items: [{ |
|||
xtype: 'panel', |
|||
title: 'General Info', |
|||
layout: 'hbox', |
|||
items:[{ |
|||
xtype: 'panel', |
|||
flex: 1, |
|||
height: 303, |
|||
autoScroll: false, |
|||
html: '<table width="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr></table>' |
|||
},{ |
|||
xtype: 'form', |
|||
id: '_ed_small', |
|||
flex: 1, |
|||
height: 303, |
|||
autoScroll: false, |
|||
//layout: 'vbox',
|
|||
labelWidth: 120, |
|||
labelAlign: 'right', |
|||
items:[{ |
|||
xtype: 'textfield', |
|||
fieldLabel: '<?=$Labels->GetLabel( 'SERV_NAME' );?>', |
|||
id: 'node_name', |
|||
value: '<?=$Node['name'];?>', |
|||
listeners:{ |
|||
change: function(){ |
|||
settingsChangeNotifier( 'node_name' ); |
|||
Ext.getCmp('sasa_bo').enable(); |
|||
} |
|||
} |
|||
},{ |
|||
xtype: 'panel', |
|||
width: '100%', |
|||
html: '<div class="sideInfo_item" id="INFO_ON"><?=$Labels->GetLabel( 'SERV_BLD_TAG' ).': '.$NData['version_string'];?></div>' |
|||
},{ |
|||
xtype: 'panel', |
|||
width: '100%', |
|||
html: '<div class="setEd_infoPanel" id="INFO_IPS"><?=$NIFO;?></div>' |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'sasa_bo', |
|||
width: '100%', |
|||
disabled: true, |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
} |
|||
}] |
|||
}] |
|||
},{ |
|||
xtype: 'panel', |
|||
title: 'Resources', |
|||
layout: 'hbox', |
|||
items:[{ |
|||
xtype: 'panel', |
|||
flex: 1, |
|||
height: 303, |
|||
autoScroll: 'auto', |
|||
//layout: 'fit',
|
|||
items:[<?php |
|||
$QS = "SELECT * FROM resources WHERE `node_id`={$Z}"; |
|||
$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>\'}'; |
|||
}; |
|||
}; |
|||
echo implode( ',', $SockDataParts ); |
|||
}; |
|||
?>]
|
|||
},{ |
|||
xtype: 'panel', |
|||
id: 'res_ed_small', |
|||
flex: 1, |
|||
height: 303, |
|||
layout: 'fit', |
|||
items:[{ |
|||
html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' |
|||
}] |
|||
}] |
|||
},{ |
|||
xtype: 'panel', |
|||
title: 'Modules', |
|||
layout: 'hbox', |
|||
items:[{ |
|||
xtype: 'panel', |
|||
flex: 1, |
|||
height: 303, |
|||
autoScroll: 'auto', |
|||
tbar:[{ |
|||
text: 'Add Module' |
|||
}], |
|||
items:[<?php |
|||
$QS = "SELECT * FROM server_modules WHERE `server_id`={$Node['aux_id']}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
foreach( $Result as $R ){ |
|||
$QS = "SELECT * FROM server_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>\'}'; |
|||
}; |
|||
}; |
|||
echo implode( ',', $ModPart ); |
|||
}; |
|||
?>]
|
|||
},{ |
|||
xtype: 'panel', |
|||
id: 'mod_ed_small', |
|||
flex: 1, |
|||
height: 303, |
|||
layout: 'fit', |
|||
items:[{ |
|||
html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' |
|||
}] |
|||
}] |
|||
},{ |
|||
xtype: 'panel', |
|||
title: 'Network', |
|||
items:[] |
|||
}], |
|||
listeners:{ |
|||
afterrender: function(){ |
|||
settingsAreChanged = false; |
|||
} |
|||
}, |
|||
updateSettings: function(){ |
|||
alert('Update Settings'); |
|||
} |
|||
} |
|||
<?php |
|||
break; |
|||
}; |
|||
}; |
|||
} else { |
|||
echo "{}"; |
|||
}; |
|||
} else { |
|||
echo "{}"; |
|||
}; |
|||
} else { |
|||
echo "{}"; |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,430 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
function makeEthernetInfo( $RessourceID ){ |
|||
global $DATABASE, $CUser, $Labels; |
|||
$TTL = $Labels->GetLabel('_RES_ETHERNET_DESC_'); |
|||
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$RessourceID}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
switch( $CI['mode'] ){ |
|||
case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break; |
|||
case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break; |
|||
case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break; |
|||
case 3: $MS = $Labels->GetLabel( 'MODE_ETHROUTER' ); break; |
|||
}; |
|||
$QS="SELECT * FROM `networks` WHERE `nif_id`={$RessourceID}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$NetInfo =''; |
|||
$IP = array(); |
|||
foreach($II as $I){ |
|||
if( $I['type'] == 0 ){ |
|||
$IP = $I; |
|||
$NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
} else { |
|||
$NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
}; |
|||
}; |
|||
if( count( $IP ) ){ |
|||
$TArr = explode( '.', $IP['address'] ); |
|||
$Base = ''; |
|||
} else { |
|||
}; |
|||
$R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo; |
|||
$R_image = 'Ethernet-Cable-icon.png'; |
|||
$POPUS = 123; |
|||
$A_EDIT = ( $CI['mode'] < 2 )?'true':'false'; |
|||
$TPL = <<<END_TEMPLATE |
|||
{ |
|||
xtype: 'panel', |
|||
border: false, |
|||
frame: false, |
|||
layout:'table', |
|||
//autoHeight:true,
|
|||
autoWidth:true, |
|||
defaults: { |
|||
bodyStyle:'padding:0px' |
|||
}, |
|||
layoutConfig: { |
|||
tableAttrs: { |
|||
style: { |
|||
width: '100%' |
|||
} |
|||
}, |
|||
columns: 4 |
|||
}, |
|||
items: [{ |
|||
border: false, |
|||
width: 10 |
|||
},{ |
|||
border: false, |
|||
width: 270, |
|||
html: '<img width="256px" id="res_info_image" src="/style/assets/{$R_image}">', |
|||
},{ |
|||
xtype: 'panel', |
|||
border: false, |
|||
frame: false, |
|||
width: 420, |
|||
height: 320, |
|||
items:[{ |
|||
frame: false, |
|||
border: false, |
|||
html: '<p style="font-size: 16px;">{$TTL}</p>' |
|||
},{ |
|||
xtype: 'tabpanel', |
|||
id: 'ifo_tab', |
|||
activeTab: 0, |
|||
items:[{ |
|||
title: 'Info', |
|||
html: '{$R_nfo}' |
|||
},{ |
|||
title: 'Settings', |
|||
layout: 'form', |
|||
labelAlign: 'right', |
|||
labelWidth: 150, |
|||
items:[{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Address Allocation', |
|||
lazyRender: true, |
|||
id: 'aa_type', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
listeners:{ |
|||
change: function(t,n,o){ |
|||
if( n < 2 ){ |
|||
Ext.getCmp('aa_adr').disable(); |
|||
} else { |
|||
Ext.getCmp('aa_adr').enable(); |
|||
}; |
|||
} |
|||
}, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['aa_t','aa_txt'], |
|||
data: [ |
|||
[0,'Disabled'], |
|||
[1,'Dynamic (DHCP)'], |
|||
[2,'Static'], |
|||
[3,'Router'], |
|||
] |
|||
}), |
|||
value: {$CI['mode']}, |
|||
valueField: 'aa_t', |
|||
displayField: 'aa_txt' |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'aa_adr', |
|||
fieldLabel: 'Address', |
|||
value: '{$IP['address']}', |
|||
disabled: {$A_EDIT} |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'aa_mask', |
|||
fieldLabel: 'Net Mask', |
|||
value: '{$IP['mask']}', |
|||
disabled: {$A_EDIT} |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'aa_gtw', |
|||
fieldLabel: 'Gateway', |
|||
value: '{$IP['gateway']}', |
|||
disabled: true |
|||
},{ |
|||
xtype: 'textfield', |
|||
id: 'aa_bcast', |
|||
fieldLabel: 'Broadcast', |
|||
value: '{$IP['broadcast']}', |
|||
disabled: true |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 100 |
|||
},{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: 'Apply Changes' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 20 |
|||
}] |
|||
},{ |
|||
title: 'Router', |
|||
layout: 'form', |
|||
labelAlign: 'right', |
|||
labelWidth: 150, |
|||
items:[{ |
|||
xtype: 'checkbox', |
|||
fieldLabel: 'Act as DHCP Server', |
|||
},{ |
|||
xtype: 'textfield', |
|||
fieldLabel: 'Start IP Range' |
|||
},{ |
|||
xtype: 'textfield', |
|||
fieldLabel: 'End IP Range' |
|||
}] |
|||
}] |
|||
}] |
|||
},{ |
|||
border: false, |
|||
width: 10 |
|||
}], |
|||
koko: {$POPUS} |
|||
} |
|||
END_TEMPLATE; |
|||
return $TPL; |
|||
}; |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$EID = intval( $_POST['RID'] ); |
|||
$QS = "SELECT * FROM resources WHERE id = {$EID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$CR = $Result[0]; |
|||
switch( $CR['type'] ){ |
|||
case 1: //https://bufferwall.com/posts/330881001ji1a/
|
|||
$QS = "SELECT * FROM uart_settings WHERE id={$CR['aux_id']}"; |
|||
$Result = $DATABASE->Query( $QS ); |
|||
$Z = $Result[0]; |
|||
$R_name = $Labels->GetLabel('_RES_HW_UART_DESC_'); |
|||
$R_dev = $CR['device']; |
|||
$R_nfo = 'Speed: ' . $Z['speed'] . ', Bits: ' . $Z['bit'] . ', Parity: ' . $Z['parity'] . ', Stop Bit: '. $Z['stop_bit']; |
|||
$R_image = 'unnamed.png'; |
|||
$TPL =<<<EFUFU |
|||
{ |
|||
xtype: 'form', |
|||
labelAlign: 'right', |
|||
items:[{ |
|||
border: false, |
|||
frame: false, |
|||
xtype: 'panel', |
|||
html: '<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td width="65px"><img width="64px" src="/style/assets/unnamed.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table><br/>' |
|||
},{ |
|||
id: 'uart_spd', |
|||
xtype: 'combo', |
|||
fieldLabel: '%%%SPD%%%', |
|||
lazyRender: true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['speed'], |
|||
data: [[1200],[2400],[9600],[19200],[38400],[57600],[115200]] |
|||
}), |
|||
valueField: 'speed', |
|||
displayField: 'speed', |
|||
listeners:{ |
|||
change: function(){ |
|||
settingsChangeNotifier( 'uart_spd' ); |
|||
Ext.getCmp('ua_apply_btn').enable(); |
|||
} |
|||
}, |
|||
value: %%%SPD_VAL%%% |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Bits', |
|||
id: 'ued_bit', |
|||
lazyRender:true, |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['bits'], |
|||
data: [[5],[6],[7],[8],[9]] |
|||
}), |
|||
value: %%%BITS_VAL%%%, |
|||
valueField: 'bits', |
|||
displayField: 'bits' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Stop Bit', |
|||
lazyRender:true, |
|||
id: 'ued_stops', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['stops'], |
|||
data: [[1],[1.5],[2]] |
|||
}), |
|||
value: %%%STOPS_VAL%%%, |
|||
valueField: 'stops', |
|||
displayField: 'stops' |
|||
},{ |
|||
xtype: 'combo', |
|||
fieldLabel: 'Parity', |
|||
lazyRender:true, |
|||
id: 'ued_parity', |
|||
mode: 'local', |
|||
forceSelection: true, |
|||
triggerAction: 'all', |
|||
editable: false, |
|||
disableKeyFilter: true, |
|||
store: new Ext.data.ArrayStore({ |
|||
fields: ['par_val','parity'], |
|||
data: [['O','Odd'], ['E','Even'],['N','None']] |
|||
}), |
|||
value: '%%%PARITY_VAL%%%', |
|||
valueField: 'par_val', |
|||
displayField: 'parity' |
|||
},{ |
|||
xtype: 'spacer', |
|||
height: 10 |
|||
},{ |
|||
xtype: 'button', |
|||
id: 'ua_apply_btn', |
|||
disabled: true, |
|||
width: '100%', |
|||
text: 'Apply Changes', |
|||
handler: function(){ |
|||
var UART_SPD = Ext.getCmp('uart_spd').getValue(); |
|||
var UART_BIT = Ext.getCmp('ued_bit').getValue(); |
|||
var UART_STP = Ext.getCmp('ued_stops').getValue(); |
|||
var UART_PAR = Ext.getCmp('ued_parity').getValue(); |
|||
Ext.Ajax.request({ |
|||
url: '/lib/controller/updateResource.php', |
|||
params: { |
|||
RID: %%%%RES_ID%%%, |
|||
UID: %%%USER_ID%%%, |
|||
SID: '%%%SESSION%%%', |
|||
USPD: UART_SPD, |
|||
UBIT: UART_BIT, |
|||
USTP: UART_STP, |
|||
UPAR: UART_PAR |
|||
}, |
|||
success: function( response, opts ){ |
|||
data = Ext.decode(response.responseText); |
|||
if( data.status ){ |
|||
cleanupChangeNotifier(); |
|||
editResource( %%%%RES_ID%%% ); |
|||
} else { |
|||
Ext.Msg.show({ |
|||
title:'Error', |
|||
msg: data.msg, |
|||
buttons: Ext.Msg.OK, |
|||
icon: Ext.MessageBox.ERROR, |
|||
fn: function(btn, text){ |
|||
cleanupChangeNotifier(); |
|||
editResource( %%%%RES_ID%%% ); |
|||
} |
|||
}); |
|||
}; |
|||
//doRefresh();
|
|||
}, |
|||
failure: failureAJAXFunction |
|||
}); |
|||
} |
|||
}] |
|||
|
|||
} |
|||
EFUFU; |
|||
$TPL = str_ireplace( '%%%NAME%%%', $R_name, $TPL ); |
|||
$TPL = str_ireplace( '%%%INFO%%%', $R_dev, $TPL ); |
|||
$TPL = str_ireplace( '%%%SPD%%%', $Labels->GetLabel('UART_COM_SPEED'), $TPL ); |
|||
$TPL = str_ireplace( '%%%SPD_VAL%%%', $Z['speed'], $TPL ); |
|||
$TPL = str_ireplace( '%%%BITS_VAL%%%',$Z['bit'], $TPL ); |
|||
$TPL = str_ireplace( '%%%PARITY_VAL%%%',$Z['parity'], $TPL ); |
|||
$TPL = str_ireplace( '%%%STOPS_VAL%%%',$Z['stop_bit'], $TPL ); |
|||
$TPL = str_ireplace( '%%%%RES_ID%%%',$EID, $TPL ); |
|||
$TPL = str_ireplace( '%%%USER_ID%%%',$UserID, $TPL ); |
|||
$TPL = str_ireplace( '%%%SESSION%%%',$Session, $TPL ); |
|||
echo $TPL; |
|||
break; |
|||
case 31: //Video In
|
|||
$R_name = 'Video Frame Grabber'; |
|||
$R_dev = $CR['device']; |
|||
$QS="SELECT * FROM `media_streams` WHERE `id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
$R_nfo = 'Frame Size: '.$CI['img_width'].'x'.$CI['img_height'].'<br/>Driver: '.$CI['mrl_proto']; |
|||
$R_image = 'RCA-Connector-Plug-icon.png'; |
|||
break; |
|||
case 101: // Ethernet
|
|||
$R_name = $Labels->GetLabel('_RES_ETHERNET_DESC_'); |
|||
$R_dev = $CR['device']; |
|||
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}"; |
|||
echo makeEthernetInfo( $CR['aux_id'] ); |
|||
exit; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
switch( $CI['mode'] ){ |
|||
case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break; |
|||
case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break; |
|||
case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break; |
|||
case 1: $MS = $Labels->GetLabel( 'MODE_ETHROUTER' ); break; |
|||
}; |
|||
$QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$NetInfo =''; |
|||
foreach($II as $I){ |
|||
if( $I['type'] == 0 ){ |
|||
$NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
} else { |
|||
$NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
}; |
|||
}; |
|||
$R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo; |
|||
$R_image = 'Ethernet-Cable-icon.png'; |
|||
break; |
|||
case 102: // WiFi
|
|||
$R_name = $Labels->GetLabel('_RES_WIFI_DESC_'); |
|||
$R_dev = $CR['device']; |
|||
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
switch( $CI['mode'] ){ |
|||
case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break; |
|||
case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break; |
|||
case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break; |
|||
case 3: $MS = $Labels->GetLabel( 'MODE_ACCESS_POINT' ); break; |
|||
}; |
|||
$QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$NetInfo =''; |
|||
foreach($II as $I){ |
|||
if( $I['type'] == 0 ){ |
|||
$NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
} else { |
|||
$NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
}; |
|||
}; |
|||
$R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo; |
|||
$R_image = 'wifi-modem-Vista-icon.png'; |
|||
break; |
|||
case 105: |
|||
$R_name = $Labels->GetLabel('_RES_WAN_DESC_'); |
|||
$R_dev = $CR['device']; |
|||
$QS="SELECT * FROM `network_interfaces` WHERE `id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$CI = $II[0]; |
|||
switch( $CI['mode'] ){ |
|||
case 0: $MS = $Labels->GetLabel( 'MODE_DISABLED' ); break; |
|||
case 1: $MS = $Labels->GetLabel( 'MODE_ETHDYNAMIC' ); break; |
|||
case 2: $MS = $Labels->GetLabel( 'MODE_ETHSTATIC' ); break; |
|||
case 3: $MS = $Labels->GetLabel( 'MODE_ACCESS_POINT' ); break; |
|||
}; |
|||
$QS="SELECT * FROM `networks` WHERE `nif_id`={$CR['aux_id']}"; |
|||
$II = $DATABASE->Query( $QS ); |
|||
$NetInfo =''; |
|||
foreach($II as $I){ |
|||
if( $I['type'] == 0 ){ |
|||
$NetInfo .= '<br/>Address IPv4: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
} else { |
|||
$NetInfo .= '<br/>Address IPv6: '.$I['address'].'<br/>Net Mask: '.$I['mask']; |
|||
}; |
|||
}; |
|||
$R_nfo = 'Mode: '.$MS.'<br/>MAC: '.$CI['mac'] . $NetInfo; |
|||
$R_image = 'wifi-modem-Vista-icon.png'; |
|||
break; |
|||
}; |
|||
} else { |
|||
echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; |
|||
}; |
|||
} else { |
|||
header('location: /'); |
|||
}; |
|||
?>
|
|||
@ -1,85 +1,119 @@ |
|||
{ |
|||
xtype: 'form', |
|||
labelWidth: 75, // label settings here cascade unless overridden
|
|||
labelWidth: 40, // label settings here cascade unless overridden
|
|||
frame: false, |
|||
bodyStyle:'padding:5px 5px 0', |
|||
defaultType: 'textfield', |
|||
labelAlign: 'right', |
|||
items: [{ |
|||
xtype: 'panel', |
|||
height: 100, |
|||
html: '<p align="center"><img src="/style/assets/%%%TYPE%%%_node.png"><br/>%%%NAME%%%<br/></p>' |
|||
xtype: 'panel', |
|||
height: 100, |
|||
html: '<p align="center"><img src="/style/assets/%%%TYPE%%%_node.png"><br/>%%%NAME%%%<br/></p>' |
|||
},{ |
|||
xtype:'fieldset', |
|||
//checkboxToggle:true,
|
|||
collapsible: true, |
|||
collapsible: true, |
|||
title: 'Location', |
|||
autoHeight: true, |
|||
defaults: { |
|||
//width: 180
|
|||
}, |
|||
//width: 180
|
|||
}, |
|||
defaultType: 'textfield', |
|||
collapsed: false, |
|||
items :[{ |
|||
fieldLabel: 'Latitude', |
|||
name: 'slat', |
|||
value: %%%LAT%%%, |
|||
id: 'slat', |
|||
allowBlank:false |
|||
fieldLabel: 'Lat', |
|||
name: 'slat', |
|||
value: %%%LAT%%%, |
|||
id: 'slat', |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'Longitude', |
|||
id: 'slon', |
|||
value: %%%LON%%%, |
|||
name: 'slon', |
|||
allowBlank:false |
|||
fieldLabel: 'Lon', |
|||
id: 'slon', |
|||
value: %%%LON%%%, |
|||
name: 'slon', |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'Altitude', |
|||
id: 'salt', |
|||
value: %%%ALT%%%, |
|||
name: 'salt', |
|||
allowBlank:false |
|||
},{ |
|||
xtype: 'button', |
|||
text: 'Set To Anchor Position', |
|||
width: '100%', |
|||
handler: setNodeLocationToAnchor |
|||
}] |
|||
fieldLabel: 'Alt', |
|||
id: 'salt', |
|||
value: %%%ALT%%%, |
|||
name: 'salt', |
|||
allowBlank:false |
|||
},{ |
|||
xtype: 'button', |
|||
text: 'Set To Anchor Position', |
|||
width: '100%', |
|||
handler: setNodeLocationToAnchor |
|||
}] |
|||
},{ |
|||
xtype:'fieldset', |
|||
title: 'Orientation', |
|||
collapsible: true, |
|||
autoHeight:true, |
|||
defaults: { |
|||
//width: 168
|
|||
}, |
|||
//width: 168
|
|||
}, |
|||
defaultType: 'textfield', |
|||
items :[{ |
|||
fieldLabel: 'Roll', |
|||
id: 'sroll', |
|||
value: %%%ROLL%%%, |
|||
id: 'sroll', |
|||
value: %%%ROLL%%%, |
|||
name: 'sroll', |
|||
allowBlank:false |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'Pitch', |
|||
id: 'spitch', |
|||
value: %%%PITCH%%%, |
|||
id: 'spitch', |
|||
value: %%%PITCH%%%, |
|||
name: 'spitch', |
|||
allowBlank:false |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'Yaw', |
|||
id: 'syaw', |
|||
value: %%%YAW%%%, |
|||
id: 'syaw', |
|||
value: %%%YAW%%%, |
|||
name: 'syaw', |
|||
allowBlank:false |
|||
allowBlank:false |
|||
},{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: 'Edit Orientation', |
|||
handler: orientationEditor |
|||
}] |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: 'Edit Orientation', |
|||
handler: orientationEditor |
|||
}] |
|||
},{ |
|||
xtype: 'button', |
|||
text: 'Update', |
|||
width: '100%', |
|||
handler: updateLocationOrientation |
|||
xtype:'fieldset', |
|||
title: 'Diff Position', |
|||
collapsible: true, |
|||
autoHeight:true, |
|||
defaults: { |
|||
//width: 168
|
|||
}, |
|||
defaultType: 'numberfield', |
|||
items :[{ |
|||
fieldLabel: 'ΔX', |
|||
id: 'dx', |
|||
value: %%%DX%%%, |
|||
name: 'dx', |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'ΔY', |
|||
id: 'dy', |
|||
value: %%%DY%%%, |
|||
name: 'dy', |
|||
allowBlank:false |
|||
},{ |
|||
fieldLabel: 'ΔZ', |
|||
id: 'dz', |
|||
value: %%%DZ%%%, |
|||
name: 'dz', |
|||
allowBlank:false |
|||
},{ |
|||
xtype: 'button', |
|||
width: '100%', |
|||
text: 'Set Position', |
|||
handler: setNodeLocationByDelta |
|||
}] |
|||
},{ |
|||
xtype: 'button', |
|||
text: 'Update', |
|||
width: '100%', |
|||
handler: updateLocationOrientation |
|||
}] |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
if( isset( $_POST['NID'] ) ) $NID = intval($_POST['NID']); else $NID = 0; |
|||
if( isset( $_POST['PID'] ) ) $PID = intval($_POST['PID']); else $PID = 0; |
|||
if( $PID > 3 ) $PID = 3; |
|||
if( $NID ){ |
|||
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$NID}"; |
|||
$RR = $DATABASE->Query( $QS, false ); |
|||
$CSID = intval( $RR[0]['aux_id'] ); |
|||
if( $CSID ){ |
|||
if( isset( $_POST['MOFS'] ) ) $MOFS = intval( $_POST['MOFS'] ); else $MOFS = 10; |
|||
if( isset( $_POST['MDEL'] ) ) $MDEL = intval( $_POST['MDEL'] ); else $MDEL = 20; |
|||
if( isset( $_POST['MWIT'] ) ) $MWIT = intval( $_POST['MWIT'] ); else $MWIT = 1800; |
|||
if( isset( $_POST['MORD'] ) ) $MORD = intval( $_POST['MORD'] ); else $MORD = 5; |
|||
if( isset( $_POST['MSST'] ) ) $MSST = intval( $_POST['MSST'] ); else $MSST = 1; |
|||
if( isset( $_POST['MFLP'] ) ) $MFLP = intval( $_POST['MFLP'] ); else $MFLP = 16; |
|||
if( isset( $_POST['MSUN'] ) ) $MSUN = intval( $_POST['MSUN'] ); else $MSUN = 100; |
|||
if( isset( $_POST['MGP'] ) ) $MGP = intval( $_POST['MGP'] ); else $MGP = 8; |
|||
if( isset( $_POST['MSPK'] ) ) $MSPK = intval( $_POST['MSPK'] ); else $MSPK = 2; |
|||
if( isset( $_POST['SOFS'] ) ) $SOFS = intval( $_POST['SOFS'] ); else $SOFS = 10; |
|||
if( isset( $_POST['SDEL'] ) ) $SDEL = intval( $_POST['SDEL'] ); else $SDEL = 20; |
|||
if( isset( $_POST['SWIT'] ) ) $SWIT = intval( $_POST['SWIT'] ); else $SWIT = 1800; |
|||
if( isset( $_POST['SORD'] ) ) $SORD = intval( $_POST['SORD'] ); else $SORD = 5; |
|||
if( isset( $_POST['SSST'] ) ) $SSST = intval( $_POST['SSST'] ); else $SSST = 1; |
|||
if( isset( $_POST['SFLP'] ) ) $SFLP = intval( $_POST['SFLP'] ); else $SFLP = 16; |
|||
if( isset( $_POST['SSUN'] ) ) $SSUN = intval( $_POST['SSUN'] ); else $SSUN = 100; |
|||
if( isset( $_POST['SGP'] ) ) $SGP = intval( $_POST['SGP'] ); else $SGP = 8; |
|||
if( isset( $_POST['SSPK'] ) ) $SSPK = intval( $_POST['SSPK'] ); else $SSPK = 2; |
|||
$QS = "INSERT INTO `lrf_detection_profiles` SET `aux_id`={$CSID}, `profile_id`={$PID}, `master`=b'1', `order`={$MORD},`offset`={$MOFS},`delta`={$MDEL},`flip`={$MFLP},`width`={$MWIT},`sst`={$MSST},`sun`={$MSUN},`gp`={$MGP},`spikes`={$MSPK} ON DUPLICATE KEY UPDATE `order`={$MORD},`offset`={$MOFS},`delta`={$MDEL},`flip`={$MFLP},`width`={$MWIT},`sst`={$MSST},`sun`={$MSUN},`gp`={$MGP},`spikes`={$MSPK}"; |
|||
$DATABASE->Query( $QS ); |
|||
$QS = "INSERT INTO `lrf_detection_profiles` SET `aux_id`={$CSID}, `profile_id`={$PID}, `master`=b'0', `order`={$SORD},`offset`={$SOFS},`delta`={$SDEL},`flip`={$SFLP},`width`={$SWIT},`sst`={$SSST},`sun`={$SSUN},`gp`={$SGP},`spikes`={$SSPK} ON DUPLICATE KEY UPDATE `order`={$SORD},`offset`={$SOFS},`delta`={$SDEL},`flip`={$SFLP},`width`={$SWIT},`sst`={$SSST},`sun`={$SSUN},`gp`={$SGP},`spikes`={$SSPK}"; |
|||
$DATABASE->Query( $QS ); |
|||
$NCMD = 100+$PID; |
|||
$QS = "INSERT INTO `nodes_qcq` SET `node_id`={$NID}, `cmd`={$NCMD}"; |
|||
$DATABASE->Query( $QS ); |
|||
}; |
|||
}; |
|||
}; |
|||
?>
|
|||
@ -1,55 +1,88 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
require_once('../php/utm/gPoint.php'); |
|||
|
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$SITE = 0; $NID = 0; |
|||
if( isset( $_POST['SITE'] ) ) $SITE = intval($_POST['SITE']); |
|||
$TYP = intval($_POST['TYPE']); |
|||
if( isset( $_POST['NODE'] ) ) $NID = intval($_POST['NODE']); |
|||
$LAT = floatval( $_POST['LAT'] ); |
|||
$LON = floatval( $_POST['LON'] ); |
|||
if( $TYP > 0 ){ |
|||
$ALT = floatval( $_POST['ALT'] ); |
|||
if( $TYP > 1 ){ |
|||
$PITCH = floatval( $_POST['PITCH'] ); |
|||
$ROLL = floatval( $_POST['ROLL'] ); |
|||
$YAW = floatval( $_POST['YAW'] ); |
|||
}; |
|||
}; |
|||
if( $TYP == 1 ){ |
|||
$QS="UPDATE sites SET anchor_lat={$LAT}, anchor_lon={$LON}, anchor_alt={$ALT} WHERE id ={$SITE}"; |
|||
} else { |
|||
$QS = "SELECT * FROM nodes WHERE id ={$NID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
foreach( $Result as $CD ){ |
|||
switch( $CD['type'] ){ |
|||
case ARGUS_ALS_SENSOR: |
|||
case ARGUS_LFS_SENSOR: |
|||
case ARGUS_PLS_200_SENSOR: |
|||
case ARGUS_PLS_360_SENSOR: |
|||
case ARGUS_3D_SENSOR: |
|||
case ARGUS_NET_PLS_200: |
|||
if( $TYP > 0 ){ |
|||
$QS="UPDATE lrf_sensors SET lat={$LAT}, lon={$LON}, alt={$ALT}, roll={$ROLL}, pitch={$PITCH}, yaw={$YAW} WHERE id={$CD['aux_id']}"; |
|||
} else { |
|||
$QS="UPDATE lrf_sensors SET lat={$LAT}, lon={$LON} WHERE id={$CD['aux_id']}"; |
|||
$SITE = 0; $NID = 0; |
|||
if( isset( $_POST['SITE'] ) ) $SITE = intval($_POST['SITE']); |
|||
$TYP = intval($_POST['TYPE']); |
|||
if( isset( $_POST['NODE'] ) ) $NID = intval($_POST['NODE']); |
|||
$LAT = floatval( $_POST['LAT'] ); |
|||
$LON = floatval( $_POST['LON'] ); |
|||
if( $TYP > 0 ){ |
|||
$ALT = floatval( $_POST['ALT'] ); |
|||
if( $TYP == 2 ){ |
|||
$PITCH = floatval( $_POST['PITCH'] ); |
|||
$ROLL = floatval( $_POST['ROLL'] ); |
|||
$YAW = floatval( $_POST['YAW'] ); |
|||
}; |
|||
break; |
|||
case ARGUS_ANALOG_STATIC_CAMERA: |
|||
case ARGUS_ANALOG_PTZ_CAMERA: |
|||
case ARGUS_IP_STATIC_CAMERA: |
|||
case ARGUS_IP_PTZ_CAMERA: |
|||
if( $TYP > 0 ){ |
|||
$QS="UPDATE cameras SET lat={$LAT}, lon={$LON}, alt={$ALT}, roll={$ROLL}, pitch={$PITCH}, yaw={$YAW} WHERE id={$CD['aux_id']}"; |
|||
} else { |
|||
$QS="UPDATE cameras SET lat={$LAT}, lon={$LON} WHERE id={$CD['aux_id']}"; |
|||
}; |
|||
break; |
|||
}; |
|||
}; |
|||
echo "{ nid: {$NID} }"; |
|||
}; |
|||
$DATABASE->Query( $QS ); |
|||
if( $TYP != 1 ){ |
|||
$QS="SELECT `anchor_lat`, `anchor_lon`, `anchor_alt` FROM `sites` WHERE `id`={$SITE}"; |
|||
$R = $DATABASE->Query( $QS ); |
|||
$SLAT = $R[0]['anchor_lat']; |
|||
$SLON = $R[0]['anchor_lon']; |
|||
$SALT = $R[0]['anchor_alt']; |
|||
$A = new gPoint(); |
|||
$A->setLongLat( $SLON, $SLAT ); |
|||
$A->convertLLtoTM(); |
|||
$XC = $A->E(); |
|||
$YC = $A->N(); |
|||
$ZC = $A->Z(); |
|||
|
|||
$QS = "SELECT * FROM nodes WHERE id ={$NID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
$CD = $Result[0]; |
|||
switch( $CD['type'] ){ |
|||
case ARGUS_ALS_SENSOR: |
|||
case ARGUS_LFS_SENSOR: |
|||
case ARGUS_PLS_200_SENSOR: |
|||
case ARGUS_PLS_360_SENSOR: |
|||
case ARGUS_3D_SENSOR: |
|||
case ARGUS_NET_PLS_200: |
|||
$TBL = 'lrf_sensors'; |
|||
break; |
|||
case ARGUS_ANALOG_STATIC_CAMERA: |
|||
case ARGUS_ANALOG_PTZ_CAMERA: |
|||
case ARGUS_IP_STATIC_CAMERA: |
|||
case ARGUS_IP_PTZ_CAMERA: |
|||
$TBL = 'cameras'; |
|||
break; |
|||
}; |
|||
}; |
|||
switch( $TYP ){ |
|||
case 0://Short update |
|||
$CC = new gPoint(); |
|||
$CC->setLongLat( $LON, $LAT ); |
|||
$CC->convertLLtoTM(); |
|||
$XX = $CC->E(); |
|||
$YY = $CC->N(); |
|||
$ZO = $CC->Z(); |
|||
$DX = $XX - $XC; |
|||
$DY = $YY - $YC; |
|||
$QS="UPDATE `{$TBL}` SET `x`={$DX}, `y`={$DY} WHERE `id`={$CD['aux_id']}"; |
|||
break; |
|||
case 1://Anchore update |
|||
$QS="UPDATE `sites` SET `anchor_lat`={$LAT}, `anchor_lon`={$LON}, `anchor_alt`={$ALT} WHERE `id`={$SITE}"; |
|||
break; |
|||
case 2://long update |
|||
$CC = new gPoint(); |
|||
$CC->setLongLat( $LON, $LAT ); |
|||
$CC->convertLLtoTM(); |
|||
$XX = $CC->E(); |
|||
$YY = $CC->N(); |
|||
$ZO = $CC->Z(); |
|||
$DX = $XX - $XC; |
|||
$DY = $YY - $YC; |
|||
$QS="UPDATE `{$TBL}` SET `x`={$XX}, `y`={$YY}, `z`={$ALT}, `x_rot`={$ROLL}, `y_rot`={$PITCH}, `z_rot`={$YAW} WHERE `id`={$CD['aux_id']}"; |
|||
break; |
|||
case 3://update by diff -> no orientation |
|||
$QS="UPDATE `{$TBL}` SET `x`={$LAT}, `y`={$LON}, `z`={$ALT} WHERE `id`={$CD['aux_id']}"; |
|||
break; |
|||
}; |
|||
$DATABASE->Query( $QS ); |
|||
echo "{ nid: {$NID}, QS:'{$QS}' }"; |
|||
} else { |
|||
echo "[]"; |
|||
echo "[]"; |
|||
}; |
|||
?>
|
|||
@ -1,28 +0,0 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
if( isset( $_POST['SENSOR'] ) ){ |
|||
$S_ID = intval($_POST['SENSOR']); |
|||
if( $S_ID ){ |
|||
$NAME = $DATABASE->escape($_POST['SNAME']); |
|||
if(isset($_POST['SADDR'])){ |
|||
$ADDR = intval($_POST['SADDR']); |
|||
$RANGE = floatval($_POST['SRANGE']); |
|||
$QS="UPDATE `lrf_sensors` SET `device_id`={$ADDR}, `max_range`={$RANGE} WHERE id={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
//$QS="UPDATE `lrf_sensors` SET `device_id`={$ADDR}, `max_range`={$RANGE}, `label`='{$NAME}' WHERE id={$S_ID}";
|
|||
//$DATABASE->Query( $QS );
|
|||
} else { |
|||
$IP= $DATABASE->escape($_POST['SIPADDR']); |
|||
$NAME = $DATABASE->escape($_POST['SNAME']); |
|||
$QS="UPDATE `lrf_sensors` SET `ip_address`='{$IP}' WHERE id={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
//$QS="UPDATE `lrf_sensors` SET `ip_address`='{$IP}', `label`='{$NAME}' WHERE id={$S_ID}";
|
|||
//$DATABASE->Query( $QS );
|
|||
}; |
|||
$QS="UPDATE `nodes` SET `name`='{$NAME}' WHERE `aux_id`={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
}; |
|||
}; |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,43 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$NodeID = intval($_POST['NID']); |
|||
//$Master = intval($_POST['MST']);
|
|||
$QS = "SELECT * FROM nodes WHERE id={$NodeID}"; |
|||
$Data = array(); |
|||
$result = $DATABASE->Query( $QS, false ); |
|||
if( count( $result ) ){ |
|||
$T = $result[0]; |
|||
$AID = $T['aux_id']; |
|||
if(isset($_POST['BASH'])){ |
|||
$BSH = intval( $_POST['BASH'] ); |
|||
$QS = "UPDATE `lrf_sensors` SET `base_shift`={$BSH} WHERE `id`={$AID}"; |
|||
$DATABASE->Query( $QS ); |
|||
}; |
|||
//if( isset( $_POST['SENSOR'] ) ){
|
|||
//$S_ID = intval($_POST['SENSOR']);
|
|||
//if( $S_ID ){
|
|||
/* |
|||
$NAME = $DATABASE->escape($_POST['SNAME']); |
|||
if(isset($_POST['SADDR'])){ |
|||
$ADDR = intval($_POST['SADDR']); |
|||
$RANGE = floatval($_POST['SRANGE']); |
|||
$QS="UPDATE `lrf_sensors` SET `device_id`={$ADDR}, `max_range`={$RANGE} WHERE id={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
//$QS="UPDATE `lrf_sensors` SET `device_id`={$ADDR}, `max_range`={$RANGE}, `label`='{$NAME}' WHERE id={$S_ID}";
|
|||
//$DATABASE->Query( $QS );
|
|||
} else { |
|||
$IP= $DATABASE->escape($_POST['SIPADDR']); |
|||
$NAME = $DATABASE->escape($_POST['SNAME']); |
|||
$QS="UPDATE `lrf_sensors` SET `ip_address`='{$IP}' WHERE id={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
//$QS="UPDATE `lrf_sensors` SET `ip_address`='{$IP}', `label`='{$NAME}' WHERE id={$S_ID}";
|
|||
//$DATABASE->Query( $QS );
|
|||
}; |
|||
$QS="UPDATE `nodes` SET `name`='{$NAME}' WHERE `aux_id`={$S_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
*/ |
|||
|
|||
}; |
|||
}; |
|||
?>
|
|||
@ -0,0 +1,35 @@ |
|||
<?php |
|||
require_once('../ajax_asm.php'); |
|||
$Data['status'] = 0; |
|||
if( $CUser->Data['id'] > 1 ){ |
|||
$EID = intval( $_POST['RID'] ); |
|||
$QS = "SELECT * FROM resources WHERE id = {$EID}"; |
|||
$Result = $DATABASE->Query( $QS, false ); |
|||
if( count( $Result ) ){ |
|||
$R = $Result[0]; |
|||
switch( $R['type'] ){ |
|||
case 1:{ |
|||
$UART_ID = intval($R['aux_id']); |
|||
$UART_SPEED = intval($_POST['USPD']); |
|||
$UART_BIT = intval($_POST['UBIT']); |
|||
$UART_STOP = floatval($_POST['USTP']); |
|||
switch( strtoupper( substr( $_POST['UPAR'], 1 ) ) ){ |
|||
case 'E': $UART_PARITY = 'E'; break; |
|||
case 'O': $UART_PARITY = 'O'; break; |
|||
default: |
|||
$UART_PARITY = 'N'; |
|||
}; |
|||
$QS="UPDATE `uart_settings` SET `speed`={$UART_SPEED}, `bit`={$UART_BIT}, `parity`='{$UART_PARITY}', `stop_bit`={$UART_STOP} WHERE id ={$UART_ID}"; |
|||
$DATABASE->Query( $QS ); |
|||
break; |
|||
}; |
|||
}; |
|||
$Data['status'] = 1; |
|||
} else { |
|||
$Data['msg']='Wrong Resource'; |
|||
}; |
|||
} else { |
|||
$Data['msg']='Access Error!'; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
?>
|
|||
@ -0,0 +1,64 @@ |
|||
QU: http://192.168.200.127/onvif/device_service |
|||
|
|||
------------------ |
|||
string(261) "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
string(630) "HTTP/1.1 401 Unauthorized |
|||
Date: Sun, 24 Jul 2022 16:40:09 GMT |
|||
Server: Apache/2.4.43 (Unix) OpenSSL/1.1.1g |
|||
WWW-Authenticate: Digest realm="AXIS_WS_B8A44F2C878D", nonce="E/V0uI/kBQA=6638cbdcec1f1c924eadeb76905d8b9d195293c4", algorithm=MD5, qop="auth" |
|||
Content-Type: text/xml; charset=utf-8 |
|||
Content-Length: 0 |
|||
|
|||
HTTP/1.1 200 OK |
|||
Date: Sun, 24 Jul 2022 16:40:09 GMT |
|||
Server: Apache/2.4.43 (Unix) OpenSSL/1.1.1g |
|||
Authentication-Info: rspauth="314438a6a6e3a991ec4c62dce6e80dc2", cnonce="ZWI0OTk4Y2IyYTQwMWZjMzBiZTRlZjQ0YzI5YjNiNjQ=", nc=00000001, qop=auth |
|||
Content-Type: application/soap+xml; charset=utf-8 |
|||
Content-Length: 3722 |
|||
|
|||
" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
string(3722) "<?xml version="1.0" encoding="UTF-8"?> |
|||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:acert="http://www.axis.com/vapix/ws/cert" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:aa="http://www.axis.com/vapix/ws/action1" xmlns:acertificates="http://www.axis.com/vapix/ws/certificates" xmlns:aentry="http://www.axis.com/vapix/ws/entry" xmlns:aev="http://www.axis.com/vapix/ws/event1" xmlns:aeva="http://www.axis.com/vapix/ws/embeddedvideoanalytics1" xmlns:ali1="http://www.axis.com/vapix/ws/light/CommonBinding" xmlns:ali2="http://www.axis.com/vapix/ws/light/IntensityBinding" xmlns:ali3="http://www.axis.com/vapix/ws/light/AngleOfIlluminationBinding" xmlns:ali4="http://www.axis.com/vapix/ws/light/DayNightSynchronizeBinding" xmlns:ali="http://www.axis.com/vapix/ws/light" xmlns:apc="http://www.axis.com/vapix/ws/panopsiscalibration1" xmlns:arth="http://www.axis.com/vapix/ws/recordedtour1" xmlns:asd="http://www.axis.com/vapix/ws/shockdetection" xmlns:aweb="http://www.axis.com/vapix/ws/webserver" xmlns:tan1="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:tan2="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev1="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:tev2="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev4="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tnsaxis="http://www.axis.com/2009/event/topics"><SOAP-ENV:Body><tds:GetSystemDateAndTimeResponse><tds:SystemDateAndTime><tt:DateTimeType>NTP</tt:DateTimeType><tt:DaylightSavings>true</tt:DaylightSavings><tt:TimeZone><tt:TZ>IST-2IDT,M3.4.4/26,M10.5.0</tt:TZ></tt:TimeZone><tt:UTCDateTime><tt:Time><tt:Hour>16</tt:Hour><tt:Minute>40</tt:Minute><tt:Second>9</tt:Second></tt:Time><tt:Date><tt:Year>2022</tt:Year><tt:Month>7</tt:Month><tt:Day>24</tt:Day></tt:Date></tt:UTCDateTime><tt:LocalDateTime><tt:Time><tt:Hour>19</tt:Hour><tt:Minute>40</tt:Minute><tt:Second>9</tt:Second></tt:Time><tt:Date><tt:Year>2022</tt:Year><tt:Month>7</tt:Month><tt:Day>24</tt:Day></tt:Date></tt:LocalDateTime></tds:SystemDateAndTime></tds:GetSystemDateAndTimeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
(Init) An Error Catched! |
|||
|
|||
|
|||
|
|||
|
|||
Time Is OK |
|||
|
|||
|
|||
QU: http://192.168.200.127/onvif/device_service |
|||
|
|||
------------------ |
|||
string(924) "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>argus</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">XWPl7lQvtx2+7BmNC+a8AQ==</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">FwNTYmA=</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2022-07-24T17:39:28.000Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"><Category>All</Category></GetCapabilities></s:Body></s:Envelope>" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
string(658) "HTTP/1.1 401 Unauthorized |
|||
Date: Sun, 24 Jul 2022 16:40:09 GMT |
|||
Server: Apache/2.4.43 (Unix) OpenSSL/1.1.1g |
|||
WWW-Authenticate: Digest realm="AXIS_WS_B8A44F2C878D", nonce="oUB1uI/kBQA=bde62d90be3bb4fcdfd588e32b4f1cecb871614e", algorithm=MD5, qop="auth" |
|||
Content-Type: text/xml; charset=utf-8 |
|||
Content-Length: 0 |
|||
|
|||
HTTP/1.1 400 Bad Request |
|||
Date: Sun, 24 Jul 2022 16:40:09 GMT |
|||
Server: Apache/2.4.43 (Unix) OpenSSL/1.1.1g |
|||
Authentication-Info: rspauth="92c44022653249fb58f336049bb2d41b", cnonce="NmFmMTQ2NmJmNmVhMjFiYzgzYTUyMjIwYWNiMTM3YjI=", nc=00000001, qop=auth |
|||
Content-Type: application/soap+xml; charset=utf-8 |
|||
Content-Length: 3518 |
|||
Connection: close |
|||
|
|||
" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
string(3518) "<?xml version="1.0" encoding="UTF-8"?> |
|||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:acert="http://www.axis.com/vapix/ws/cert" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:aa="http://www.axis.com/vapix/ws/action1" xmlns:acertificates="http://www.axis.com/vapix/ws/certificates" xmlns:aentry="http://www.axis.com/vapix/ws/entry" xmlns:aev="http://www.axis.com/vapix/ws/event1" xmlns:aeva="http://www.axis.com/vapix/ws/embeddedvideoanalytics1" xmlns:ali1="http://www.axis.com/vapix/ws/light/CommonBinding" xmlns:ali2="http://www.axis.com/vapix/ws/light/IntensityBinding" xmlns:ali3="http://www.axis.com/vapix/ws/light/AngleOfIlluminationBinding" xmlns:ali4="http://www.axis.com/vapix/ws/light/DayNightSynchronizeBinding" xmlns:ali="http://www.axis.com/vapix/ws/light" xmlns:apc="http://www.axis.com/vapix/ws/panopsiscalibration1" xmlns:arth="http://www.axis.com/vapix/ws/recordedtour1" xmlns:asd="http://www.axis.com/vapix/ws/shockdetection" xmlns:aweb="http://www.axis.com/vapix/ws/webserver" xmlns:tan1="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:tan2="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev1="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:tev2="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:tev4="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tnsaxis="http://www.axis.com/2009/event/topics"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:NotAuthorized</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">Sender not authorized</SOAP-ENV:Text></SOAP-ENV:Reason><SOAP-ENV:Detail><SOAP-ENV:Text>The action requested requires authorization and the sender is not authorized</SOAP-ENV:Text></SOAP-ENV:Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>" |
|||
|
|||
~~~~~~~~~~~~~~~~~~ |
|||
Caught exception: GetCapabilities: Communication error |
|||
@ -0,0 +1,838 @@ |
|||
<?php |
|||
|
|||
class Ponvif { |
|||
|
|||
protected $ipaddress=''; |
|||
protected $username=''; |
|||
protected $password=''; |
|||
protected $mediauri=''; |
|||
protected $snapshoturi=''; |
|||
protected $deviceuri=''; |
|||
protected $ptzuri=''; |
|||
protected $baseuri=''; |
|||
protected $onvifversion=array(); |
|||
protected $deltatime=0; |
|||
protected $capabilities=array(); |
|||
protected $videosources=array(); |
|||
protected $sources=array(); |
|||
protected $profiles=array(); |
|||
protected $proxyhost=''; |
|||
protected $proxyport=''; |
|||
protected $proxyusername=''; |
|||
protected $proxypassword=''; |
|||
protected $lastresponse=''; |
|||
protected $intransingent=true; |
|||
protected $discoverytimeout=2; |
|||
protected $discoverybindip='0.0.0.0'; |
|||
protected $discoverymcastip='239.255.255.250'; |
|||
protected $discoverymcastport=3702; |
|||
protected $discoveryhideduplicates=true; |
|||
protected $useDigest= false; |
|||
protected $qop='auth'; |
|||
protected $auth_realm = ''; |
|||
protected $auth_nonce = ''; |
|||
protected $auth_cnonce = ''; |
|||
protected $auth_nc = 0; |
|||
protected $digestMethod = 'SHA-256'; |
|||
|
|||
public function setProxyHost($proxyHost) { $this->proxyhost = $proxyHost; } |
|||
public function getProxyHost() { return $this->proxyhost; } |
|||
public function setProxyPort($proxyPort) { $this->proxyport = $proxyPort; } |
|||
public function getProxyPort() { return $this->proxyport; } |
|||
public function setProxyUsername($proxyUsername) { $this->proxyusername = $proxyUsername; } |
|||
public function getProxyUsername() { return $this->proxyusername; } |
|||
public function setProxyPassword($proxyPassword) { $this->proxypassword = $proxyPassword; } |
|||
public function getProxyPassword() { return $this->proxypassword; } |
|||
public function setUsername($username) { $this->username = $username; } |
|||
public function getUsername() { return $this->username; } |
|||
public function setPassword($password) { $this->password = $password; } |
|||
public function getPassword() { return $this->password; } |
|||
public function getDeviceUri() { return $this->mediauri; } |
|||
public function setDeviceUri($deviceUri) { $this->mediauri=$deviceUrl; } |
|||
public function getIPAddress($ipAddress) { return $this->ipAddress; } |
|||
public function setIPAddress($ipAddress) { $this->ipaddress=$ipAddress; } |
|||
public function getSources() { return $this->sources; } |
|||
public function getMediaUri() { return $this->mediauri; } |
|||
public function getPTZUri() { return $this->ptzuri; } |
|||
public function getBaseUrl() { return $this->baseuri; } |
|||
public function getSupportedVersion() { return $this->onvifversion; } |
|||
public function getCapabilities() { return $this->capabilities; } |
|||
public function setBreakOnError($intransingent) { $this->intransingent=$intransingent; } |
|||
public function getLastResponse() { return $this->lastresponse; } |
|||
public function setDiscoveryTimeout($discoverytimeout) { $this->discoverytimeout = $discoverytimeout; } |
|||
public function setDiscoveryBindIp($discoverybindip) { $this->discoverybindip = $discoverybindip; } |
|||
public function setDiscoveryMcastIp($discoverymcastip) { $this->discoverymcastip = $discoverymcastip; } |
|||
public function setDiscoveryMcastPort($discoverymcastport) { $this->discoverymcastport = $discoverymcastport; } |
|||
public function setDiscoveryHideDuplicates($discoveryhideduplicates) { $this->discoveryhideduplicates = $discoveryhideduplicates; } |
|||
public function getSnapshotUri() { return $this->snapshoturi; } |
|||
public function setDigestMethod( $DM ){ $this->digestMethod = $DM; } |
|||
public function getDigestMethod(){ return $this->digestMethod; } |
|||
|
|||
/* |
|||
Constructor & Destructor |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// nothing to do
|
|||
} |
|||
|
|||
public function __destruct() |
|||
{ |
|||
// nothing to do
|
|||
} |
|||
|
|||
/* |
|||
WS-Discovery |
|||
*/ |
|||
public function discover(){ |
|||
$result = array(); |
|||
$timeout = time() + $this->discoverytimeout; |
|||
$post_string = '<?xml version="1.0" encoding="UTF-8"?><e:Envelope xmlns:e="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"><e:Header><w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID><w:To e:mustUnderstand="true">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action a:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></e:Header><e:Body><d:Probe><d:Types>dn:NetworkVideoTransmitter</d:Types></d:Probe></e:Body></e:Envelope>'; |
|||
try { |
|||
if(FALSE == ($sock = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP))){ |
|||
echo('Create socket error: ['.socket_last_error().'] '.socket_strerror(socket_last_error())); |
|||
} |
|||
//if(FALSE == @socket_bind($sock, $this->discoverybindip, rand(20000, 40000))){
|
|||
// echo('Bind socket error: ['.socket_last_error().'] '.socket_strerror(socket_last_error()));
|
|||
//}
|
|||
//socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array('group' => $this->discoverymcastip));
|
|||
socket_sendto($sock, $post_string, strlen($post_string), 0, $this->discoverymcastip, $this->discoverymcastport); |
|||
socket_set_nonblock($sock); |
|||
while(time() < $timeout){ |
|||
if( FALSE !== @socket_recvfrom($sock, $response, 9999, 0, $from, $this->discoverymcastport)){ |
|||
if( $response != NULL && $response != $post_string ){ |
|||
$response = $this->_xml2array($response); |
|||
if(!$this->isFault($response)){ |
|||
$response['Envelope']['Body']['ProbeMatches']['ProbeMatch']['IPAddr'] = $from; |
|||
if($this->discoveryhideduplicates){ |
|||
$result[$from] = $response['Envelope']['Body']['ProbeMatches']['ProbeMatch']; |
|||
}else{ |
|||
$result[] = $response['Envelope']['Body']['ProbeMatches']['ProbeMatch']; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
socket_close($sock); |
|||
} catch (Exception $e) {} |
|||
sort($result); |
|||
return $result; |
|||
} |
|||
|
|||
/* |
|||
Public functions (basic initialization method and other collaterals) |
|||
*/ |
|||
public function initialize() { |
|||
$this->mediauri='http://'.$this->ipaddress.'/onvif/device_service'; |
|||
|
|||
try { |
|||
$datetime=$this->core_GetSystemDateAndTime(); |
|||
$timestamp=mktime($datetime['Time']['Hour'], $datetime['Time']['Minute'], $datetime['Time']['Second'], |
|||
$datetime['Date']['Month'], $datetime['Date']['Day'], $datetime['Date']['Year']); |
|||
$this->deltatime = time()-$timestamp;//-5;
|
|||
} catch( Exception $e ) { |
|||
} |
|||
$this->capabilities=$this->core_GetCapabilities(); |
|||
echo "\n\n\n\nGet Cap\n\n\n"; |
|||
$onvifVersion=$this->_getOnvifVersion($this->capabilities); |
|||
$this->mediauri=$onvifVersion['media']; |
|||
$this->deviceuri=$onvifVersion['device']; |
|||
$this->ptzuri=$onvifVersion['ptz']; |
|||
preg_match("/^http(.*)onvif\//",$this->mediauri,$matches); |
|||
$this->baseuri=$matches[0]; |
|||
$this->onvifversion=array('major'=>$onvifVersion['major'],'minor'=>$onvifVersion['minor']); |
|||
$this->videosources=$this->media_GetVideoSources(); |
|||
$this->profiles=$this->media_GetProfiles(); |
|||
$this->sources=$this->_getActiveSources($this->videosources,$this->profiles); |
|||
} |
|||
|
|||
public function isFault($response) { // Useful to check if response contains a fault
|
|||
if( is_array( $response ) ){ |
|||
if( array_key_exists('Fault', $response ) ) return true; |
|||
if( array_key_exists('Envelope', $response ) ) |
|||
if( is_array( $response['Envelope'] ) ) |
|||
if( array_key_exists('Body', $response['Envelope'] ) ) |
|||
if( is_array( $response['Envelope']['Body'] ) ) |
|||
if( array_key_exists('Fault', $response['Envelope']['Body'] ) ) return true; |
|||
}; |
|||
return false; |
|||
} |
|||
|
|||
/* |
|||
Public wrappers for a subset of ONVIF primitives |
|||
*/ |
|||
public function core_GetSystemDateAndTime() { |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'; |
|||
if( $this->isFault($response=$this->_send_request($this->mediauri,$post_string)) ){ |
|||
if ($this->intransingent) throw new Exception('GetSystemDateAndTime: Communication error'); |
|||
} else { |
|||
return $response['Envelope']['Body']['GetSystemDateAndTimeResponse']['SystemDateAndTime']['UTCDateTime']; |
|||
} |
|||
} |
|||
|
|||
public function core_GetCapabilities() { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"><Category>All</Category></GetCapabilities></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP']), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetCapabilities: Communication error'); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetCapabilitiesResponse']['Capabilities']; |
|||
} |
|||
|
|||
public function media_GetVideoSources() { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetVideoSources xmlns="http://www.onvif.org/ver10/media/wsdl"/></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP']), |
|||
$post_string); |
|||
//echo "POST STRING:" . $post_string . "\n\n";
|
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetVideoSources: Communication error'); |
|||
} |
|||
else |
|||
// var_dump( $response );
|
|||
return $response['Envelope']['Body']['GetVideoSourcesResponse']['VideoSources']; |
|||
} |
|||
|
|||
public function media_GetProfiles() { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP']), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetProfiles: Communication error'); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetProfilesResponse']['Profiles']; |
|||
} |
|||
|
|||
public function media_GetServices() { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>false</IncludeCapability></GetServices></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP']), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetServices: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function core_GetDeviceInformation() { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP']), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetDeviceInformation: Communication error'); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetDeviceInformationResponse']; |
|||
} |
|||
|
|||
public function media_GetStreamUri($profileToken,$stream="RTP-Unicast",$protocol="RTSP") { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetStreamUri xmlns="http://www.onvif.org/ver10/media/wsdl"><StreamSetup><Stream xmlns="http://www.onvif.org/ver10/schema">%%STREAM%%</Stream><Transport xmlns="http://www.onvif.org/ver10/schema"><Protocol>%%PROTOCOL%%</Protocol></Transport></StreamSetup><ProfileToken>%%PROFILETOKEN%%</ProfileToken></GetStreamUri></s:Body></s:Envelope>'; |
|||
$post_string=str_replace( |
|||
array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%STREAM%%", |
|||
"%%PROTOCOL%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$stream, |
|||
$protocol), |
|||
$post_string |
|||
); |
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetStreamUri: Communication error'); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetStreamUriResponse']['MediaUri']['Uri']; |
|||
} |
|||
|
|||
public function media_GetSnapshotUri($profileToken) { |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSnapshotUri xmlns="http://www.onvif.org/ver10/media/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken></GetSnapshotUri></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->mediauri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetSnapshotUri: Communication error'); |
|||
var_dump($response); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetSnapshotUriResponse']['MediaUri']['Uri']; |
|||
} |
|||
|
|||
public function ptz_GetPresets($profileToken) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetPresets xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken></GetPresets></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetPresets: Communication error'); |
|||
} |
|||
else { |
|||
$getpresetsresponse=$response['Envelope']['Body']['GetPresetsResponse']['Preset']; |
|||
$presets=array(); |
|||
foreach ($getpresetsresponse as $preset) { |
|||
$presets[]=array('Token'=>$preset['@attributes']['token'], |
|||
'Name'=>$preset['Name'], |
|||
'PTZPosition'=>$preset['PTZPosition']); |
|||
} |
|||
return $presets; |
|||
} |
|||
} |
|||
|
|||
public function ptz_GetNode($ptzNodeToken) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetNode xmlns="http://www.onvif.org/ver20/ptz/wsdl"><NodeToken>%%NODETOKEN%%</NodeToken></GetNode></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%NODETOKEN%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$ptzNodeToken), |
|||
$post_string); |
|||
if ($this->isFault($response=$this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GetNode: Communication error'); |
|||
} |
|||
else |
|||
return $response['Envelope']['Body']['GetNodeResponse']; |
|||
} |
|||
|
|||
public function ptz_GotoPreset($profileToken,$presetToken,$speed_pantilt_x,$speed_pantilt_y,$speed_zoom_x) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GotoPreset xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><PresetToken>%%PRESETTOKEN%%</PresetToken><Speed><PanTilt x="%%SPEEDPANTILTX%%" y="%%SPEEDPANTILTY%%" xmlns="http://www.onvif.org/ver10/schema"/><Zoom x="%%SPEEDZOOMX%%" xmlns="http://www.onvif.org/ver10/schema"/></Speed></GotoPreset></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%PRESETTOKEN%%", |
|||
"%%SPEEDPANTILTX%%", |
|||
"%%SPEEDPANTILTY%%", |
|||
"%%SPEEDZOOMX%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$presetToken, |
|||
$speed_pantilt_x, |
|||
$speed_pantilt_y, |
|||
$speed_zoom_x), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('GotoPreset: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_RemovePreset($profileToken,$presetToken) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><RemovePreset xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><PresetToken>%%PRESETTOKEN%%</PresetToken></RemovePreset></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%PRESETTOKEN%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$presetToken), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('RemovePreset: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_SetPreset($profileToken,$presetName) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SetPreset xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><PresetName>%%PRESETNAME%%</PresetName></SetPreset></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%PRESETNAME%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$presetName), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('SetPreset: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_RelativeMove($profileToken,$translation_pantilt_x,$translation_pantilt_y,$speed_pantilt_x,$speed_pantilt_y) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><RelativeMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><Translation><PanTilt x="%%TRANSLATIONPANTILTX%%" y="%%TRANSLATIONPANTILTY%%" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/TranslationGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/></Translation><Speed><PanTilt x="%%SPEEDPANTILTX%%" y="%%SPEEDPANTILTY%%" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/GenericSpeedSpace" xmlns="http://www.onvif.org/ver10/schema"/></Speed></RelativeMove></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%TRANSLATIONPANTILTX%%", |
|||
"%%TRANSLATIONPANTILTY%%", |
|||
"%%SPEEDPANTILTX%%", |
|||
"%%SPEEDPANTILTY%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$translation_pantilt_x, |
|||
$translation_pantilt_y, |
|||
$speed_pantilt_x, |
|||
$speed_pantilt_y), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('RelativeMove: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_RelativeMoveZoom($profileToken,$zoom,$speedZoom) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><RelativeMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><Translation><Zoom x="%%ZOOM%%" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/TranslationGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/></Translation><Speed><Zoom x="%%SPEEDZOOM%%" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/ZoomGenericSpeedSpace" xmlns="http://www.onvif.org/ver10/schema"/></Speed></RelativeMove></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%SPEEDZOOM%%", |
|||
"%%ZOOM%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$speedZoom, |
|||
$zoom), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('RelativeMoveZoom: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_GetStatus( $profileToken ){ |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetStatus xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken></GetStatus></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken), |
|||
$post_string); |
|||
if ($this->isFault($response = $this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('ptz Get Status: Communication error'); |
|||
} else { |
|||
var_dump( $response ); |
|||
$cpos=$response['Envelope']['Body']['GetStatusResponse']['PTZStatus']['Position']; |
|||
return $cpos; |
|||
}; |
|||
} |
|||
|
|||
public function ptz_AbsoluteMove($profileToken,$position_pantilt_x,$position_pantilt_y,$zoom, $PSpeed=1.0, $TSpeed=1.0, $ZSpeed=1.0 ) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><AbsoluteMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><Position><PanTilt x="%%POSITIONPANTILTX%%" y="%%POSITIONPANTILTY%%" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/><Zoom x="%%ZOOM%%" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/></Position><Speed><PanTilt x="%%SPEEDPANTILTX%%" y="%%SPEEDPANTILTY%%" xmlns="http://www.onvif.org/ver10/schema"/><Zoom x="%%SPEEDZOOMX%%" xmlns="http://www.onvif.org/ver10/schema"/></Speed></AbsoluteMove></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%POSITIONPANTILTX%%", |
|||
"%%POSITIONPANTILTY%%", |
|||
"%%ZOOM%%", |
|||
"%%SPEEDPANTILTX%%", |
|||
"%%SPEEDPANTILTY%%", |
|||
"%%SPEEDZOOMX%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$position_pantilt_x, |
|||
$position_pantilt_y, |
|||
$zoom, |
|||
$PSpeed, |
|||
$TSpeed, |
|||
$ZSpeed), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('AbsoluteMove: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_ContinuousMove($profileToken,$velocity_pantilt_x,$velocity_pantilt_y) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ContinuousMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><Velocity><PanTilt x="%%VELOCITYPANTILTX%%" y="%%VELOCITYPANTILTY%%" space="http://www.onvif.org/ver10/tptz/PanTiltSpaces/VelocityGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/></Velocity></ContinuousMove></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%VELOCITYPANTILTX%%", |
|||
"%%VELOCITYPANTILTY%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$velocity_pantilt_x, |
|||
$velocity_pantilt_y), |
|||
$post_string); |
|||
if ( $this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if( $this->intransingent ) throw new Exception('ContinuousMove: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_ContinuousMoveZoom($profileToken,$zoom) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ContinuousMove xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><Velocity><Zoom x="%%ZOOM%%" space="http://www.onvif.org/ver10/tptz/ZoomSpaces/VelocityGenericSpace" xmlns="http://www.onvif.org/ver10/schema"/></Velocity></ContinuousMove></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%ZOOM%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$zoom), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('ContinuousMoveZoom: Communication error'); |
|||
} |
|||
} |
|||
|
|||
public function ptz_Stop($profileToken,$pantilt,$zoom) { |
|||
if ($this->ptzuri=='') return array(); |
|||
$REQ=$this->_makeToken(); |
|||
$post_string='<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>%%USERNAME%%</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">%%PASSWORD%%</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">%%NONCE%%</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">%%CREATED%%</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Stop xmlns="http://www.onvif.org/ver20/ptz/wsdl"><ProfileToken>%%PROFILETOKEN%%</ProfileToken><PanTilt>%%PANTILT%%</PanTilt><Zoom>%%ZOOM%%</Zoom></Stop></s:Body></s:Envelope>'; |
|||
$post_string=str_replace(array("%%USERNAME%%", |
|||
"%%PASSWORD%%", |
|||
"%%NONCE%%", |
|||
"%%CREATED%%", |
|||
"%%PROFILETOKEN%%", |
|||
"%%PANTILT%%", |
|||
"%%ZOOM%%"), |
|||
array($REQ['USERNAME'], |
|||
$REQ['PASSDIGEST'], |
|||
$REQ['NONCE'], |
|||
$REQ['TIMESTAMP'], |
|||
$profileToken, |
|||
$pantilt, |
|||
$zoom), |
|||
$post_string); |
|||
if ($this->isFault($this->_send_request($this->ptzuri,$post_string))) { |
|||
if ($this->intransingent) throw new Exception('Stop: Communication error'); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
Internal functions |
|||
*/ |
|||
protected function _makeToken() { |
|||
$timestamp=time()-$this->deltatime; |
|||
return $this->_passwordDigest($this->username,$this->password,date('Y-m-d\TH:i:s.000\Z',$timestamp)); |
|||
} |
|||
|
|||
protected function _getOnvifVersion($capabilities) { |
|||
$version=array(); |
|||
if (isset($capabilities['Device']['System']['SupportedVersions']['Major'])) { |
|||
// NVT supports a specific onvif version
|
|||
$version['major']=$capabilities['Device']['System']['SupportedVersions']['Major']; |
|||
$version['minor']=$capabilities['Device']['System']['SupportedVersions']['Minor']; |
|||
} else { |
|||
// NVT supports more onvif versions
|
|||
$currentma=0; |
|||
$currentmi=0; |
|||
foreach ($capabilities['Device']['System']['SupportedVersions'] as $cver) { |
|||
if ($cver['Major']>$currentma) { $currentma=$cver['Major'];$currentmi=$cver['Minor']; } |
|||
} |
|||
$version['major']=$currentma; |
|||
$version['minor']=$currentmi; |
|||
} |
|||
$version['media']=$capabilities['Media']['XAddr']; |
|||
$version['device']=$capabilities['Device']['XAddr']; |
|||
$version['event']=$capabilities['Events']['XAddr']; |
|||
if (isset($capabilities['PTZ']['XAddr'])) $version['ptz']=$capabilities['PTZ']['XAddr']; else $version['ptz']=''; |
|||
return $version; |
|||
} |
|||
|
|||
protected function _getActiveSources($videoSources,$profiles) { |
|||
$sources=array(); |
|||
|
|||
if (isset($videoSources['@attributes'])) { |
|||
// NVT is a camera
|
|||
$sources[0]['sourcetoken']=$videoSources['@attributes']['token']; |
|||
$this->_getProfileData($sources,0,$profiles); |
|||
} |
|||
else { |
|||
// NVT is an encoder
|
|||
for ($i=0;$i<count($videoSources);$i++) { |
|||
if (strtolower($videoSources[$i]['@attributes']['SignalActive'])=='true') { |
|||
$sources[$i]['sourcetoken']=$videoSources[$i]['@attributes']['token']; |
|||
$this->_getProfileData($sources,$i,$profiles); |
|||
} |
|||
} // for
|
|||
} |
|||
|
|||
return $sources; |
|||
} |
|||
|
|||
protected function _getProfileData(&$sources,$i,$profiles) { |
|||
$inprofile=0; |
|||
for ($y=0; $y < count($profiles); $y++) { |
|||
if ($profiles[$y]['VideoSourceConfiguration']['SourceToken']==$sources[$i]['sourcetoken']) { |
|||
$sources[$i][$inprofile]['profilename']=$profiles[$y]['Name']; |
|||
$sources[$i][$inprofile]['profiletoken']=$profiles[$y]['@attributes']['token']; |
|||
if ( isset($profiles[$y]['VideoEncoderConfiguration'])) { |
|||
$sources[$i][$inprofile]['encoding']=$profiles[$y]['VideoEncoderConfiguration']['Encoding']; |
|||
$sources[$i][$inprofile]['width']=$profiles[$y]['VideoEncoderConfiguration']['Resolution']['Width']; |
|||
$sources[$i][$inprofile]['height']=$profiles[$y]['VideoEncoderConfiguration']['Resolution']['Height']; |
|||
$sources[$i][$inprofile]['fps']=$profiles[$y]['VideoEncoderConfiguration']['RateControl']['FrameRateLimit']; |
|||
$sources[$i][$inprofile]['bitrate']=$profiles[$y]['VideoEncoderConfiguration']['RateControl']['BitrateLimit']; |
|||
} |
|||
if ( isset($profiles[$y]['PTZConfiguration'])) { |
|||
$sources[$i][$inprofile]['ptz']['name']=$profiles[$y]['PTZConfiguration']['Name']; |
|||
$sources[$i][$inprofile]['ptz']['nodetoken']=$profiles[$y]['PTZConfiguration']['NodeToken']; |
|||
} |
|||
$inprofile++; |
|||
} |
|||
} |
|||
} |
|||
|
|||
protected function _xml2array($response) { |
|||
$sxe = new SimpleXMLElement($response); |
|||
$dom_sxe = dom_import_simplexml($sxe); |
|||
$dom = new DOMDocument('1.0'); |
|||
$dom_sxe = $dom->importNode($dom_sxe, true); |
|||
$dom_sxe = $dom->appendChild($dom_sxe); |
|||
$element = $dom->childNodes->item(0); |
|||
foreach ($sxe->getDocNamespaces() as $name => $uri) { |
|||
$element->removeAttributeNS($uri, $name); |
|||
} |
|||
$xmldata=$dom->saveXML(); |
|||
$xmldata=substr($xmldata,strpos($xmldata,"<Envelope>")); |
|||
$xmldata=substr($xmldata,0,strpos($xmldata,"</Envelope>")+strlen("</Envelope>")); |
|||
$xml=simplexml_load_string($xmldata); |
|||
$data=json_decode(json_encode((array)$xml),1); |
|||
$data=array($xml->getName()=>$data); |
|||
return $data; |
|||
} |
|||
|
|||
protected function _passwordDigest( $username, $password, $timestamp = "default", $nonce = "default", $realm='', $cnonce='' ) { |
|||
if ($timestamp=='default') $timestamp=date('Y-m-d\TH:i:s.000\Z'); |
|||
if ($nonce=='default') $nonce=mt_rand(); |
|||
$REQ=array(); |
|||
switch( $this->digestMethod ){ |
|||
case 'SHA-256': |
|||
$H1 = pack('H*', sha1(pack('H*', $nonce) . pack('a*',$timestamp) . pack('a*',$password))); |
|||
break; |
|||
case 'SHA-256-sess': |
|||
case 'SHA-512-256': |
|||
case 'SHA-512-256-sess': |
|||
case 'MD5': |
|||
$H1 = pack('H*', md5( pack('a*', $username) . pack('a*', $realm) . pack('a*', $password) ) ); |
|||
//$H2 =
|
|||
break; |
|||
case 'MD5-sess': |
|||
$H1 = pack('H*', md5( pack('H*', md5( pack('a*', $username) . pack('a*', $realm) . pack('a*', $password) ) ) . pack('H*', $nonce).pack('H*', $cnonce ) ) ); |
|||
|
|||
break; |
|||
default: |
|||
$passdigest=base64_encode(sha1($nonce.$timestamp.$password,true)); // alternative
|
|||
}; |
|||
$REQ['USERNAME']=$username; |
|||
$REQ['PASSDIGEST']=base64_encode( $H1 );//$passdigest );
|
|||
$REQ['NONCE']=base64_encode(pack('H*', $nonce)); |
|||
//$REQ['NONCE']=base64_encode($nonce); // alternative
|
|||
//$REQ['NONCE']=base64_encode(pack('H*', $nonce));
|
|||
$REQ['TIMESTAMP']=$timestamp; |
|||
return $REQ; |
|||
} |
|||
|
|||
protected function _send_request($url,$post_string) { |
|||
$soap_do = curl_init(); |
|||
curl_setopt($soap_do, CURLOPT_URL, $url ); |
|||
if ($this->proxyhost!='' && $this->proxyport!='') { |
|||
curl_setopt($soap_do, CURLOPT_PROXY, $this->proxyhost); |
|||
curl_setopt($soap_do, CURLOPT_PROXYPORT, $this->proxyport); |
|||
if ($this->proxyusername!='' && $this->proxypassword!='') |
|||
curl_setopt($soap_do, CURLOPT_PROXYUSERPWD, $this->proxyusername.':'.$this->proxypassword); |
|||
} |
|||
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 2 ); |
|||
curl_setopt($soap_do, CURLOPT_TIMEOUT, 2 ); |
|||
curl_setopt($soap_do, CURLOPT_HEADER, true ); |
|||
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); |
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); |
|||
//curl_setopt($soap_do, CURLOPT_VERBOSE, true);
|
|||
//curl_setopt($soap_do, CURLOPT_DEBUG, true);
|
|||
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); |
|||
curl_setopt($soap_do, CURLOPT_POST, true ); |
|||
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $post_string); |
|||
curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('Expect:', 'Content-Type: application/soap+xml; charset=utf-8', 'Content-Length: '.strlen($post_string) )); |
|||
curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); |
|||
curl_setopt($soap_do, CURLOPT_USERPWD, $this->username . ":" . $this->password ); // HTTP authentication
|
|||
if ( ($result = curl_exec($soap_do)) === false) { |
|||
$err = curl_error($soap_do); |
|||
$this->lastresponse=array("Fault"=>$err); |
|||
} else { |
|||
$headerSize = curl_getinfo( $soap_do, CURLINFO_HEADER_SIZE ); |
|||
$headerStr = substr( $result , 0 , $headerSize ); |
|||
$bodyStr = substr( $result , $headerSize ); |
|||
echo "QU: {$url}\n"; |
|||
echo "\n------------------\n"; |
|||
var_dump( $post_string ); |
|||
echo "\n~~~~~~~~~~~~~~~~~~\n"; |
|||
var_dump( $headerStr ); |
|||
echo "\n~~~~~~~~~~~~~~~~~~\n"; |
|||
var_dump( $bodyStr ); |
|||
echo "\n~~~~~~~~~~~~~~~~~~\n"; |
|||
$headersTmpArray = explode( "\r\n" , $headerStr ); |
|||
$R_CONT = 'text/html'; |
|||
$R_CODE = 0; |
|||
foreach( $headersTmpArray as $H ){ |
|||
$CL = trim( $H ); |
|||
if( $CL!= '' ){ |
|||
$SS = explode( ' ', $CL ); |
|||
$Biba = explode( ':', $CL ); |
|||
if( $SS[0] == 'HTTP/1.1' ){ |
|||
$R_CODE = intval( $SS[1] ); |
|||
$R_REASON = $SS[2]; |
|||
} else { |
|||
switch( $Biba[0] ){ |
|||
case 'WWW-Authenticate':{ |
|||
$AA = str_ireplace( ',','', trim( $Biba[1] )); |
|||
$AA = str_ireplace( '"','', $AA ); |
|||
$BB = explode( ' ', $AA ); |
|||
if( $BB[0] == 'Digest' ){ |
|||
$this->useDigest = true; |
|||
foreach( $BB as $B ){ |
|||
$PO = explode( '=', $B ); |
|||
switch( $PO[0] ){ |
|||
case 'qop': $this->qop=$PO[1]; break; |
|||
case 'realm': $this->auth_realm=$PO[1]; break; |
|||
case 'algorithm': $this->digestMethod=$PO[1]; break; |
|||
case 'nonce':{ |
|||
$this->auth_nonce = substr( $B, 6 );//base64_decode( substr( $B, 6 ) );
|
|||
break; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
break; |
|||
}; |
|||
case 'Authentication-Info':{ |
|||
break; |
|||
}; |
|||
case 'Content-Type':{ |
|||
$R_CONT = str_ireplace( ';', '', $SS[1] ); |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
}; |
|||
if( $R_CODE == 200 ){ |
|||
if( $R_CONT != 'text/html' ){ |
|||
$this->lastresponse=$this->_xml2array( $bodyStr ); |
|||
} else { |
|||
$this->lastresponse=array("Fault"=>"Content is TEXT/HTML!"); |
|||
}; |
|||
} else { |
|||
$err = 'Code: '.$R_CODE.' '.$R_REASON; |
|||
$this->lastresponse=array("Fault"=>$err); |
|||
}; |
|||
}; |
|||
return $this->lastresponse; |
|||
} |
|||
|
|||
} // end class
|
|||
?>
|
|||
@ -0,0 +1 @@ |
|||
/srv/vault/lib/setup_toolkit |
|||
@ -1,13 +0,0 @@ |
|||
<?php |
|||
require_once('../../settings.php'); |
|||
require_once('../../defines.php'); |
|||
require_once('/srv/etc/sys_map.php'); |
|||
require_once( 'toolkit.php' ); |
|||
out_log("Removing Task"); |
|||
if( unlink( $GVAULT_PATH.'/new_task.var' ) ){ |
|||
$CMD='rm -R -f -v '.$GTEMP_DIR.'/uploads/*'; |
|||
run_command( $CMD ); |
|||
} else { |
|||
out_log("Ops Task already started!"); |
|||
}; |
|||
?>
|
|||
@ -1,66 +0,0 @@ |
|||
<?php |
|||
require_once('../../defines.php'); |
|||
require_once('/srv/etc/sys_map.php'); |
|||
require_once( 'toolkit.php' ); |
|||
$Data['status'] = 0; |
|||
if( isset( $_POST['TID'] )){ |
|||
$TID = intval( $_POST['TID'] ); |
|||
} else { |
|||
$TID = intval( $_GET['TID'] ); |
|||
}; |
|||
if( isset( $_POST['PRM'] )){ |
|||
$PRM = trim( $_POST['PRM'] ); |
|||
} else { |
|||
$PRM = trim( $_GET['PRM'] ); |
|||
}; |
|||
if( $TID > 0 ){ |
|||
switch( $TID ){ |
|||
case 1: |
|||
if( $PRM!= '' ){ |
|||
$TArr = explode( '.', $PRM ); |
|||
$TBrr = explode( '_', $TArr[0] ); |
|||
createNewTask( $TID, $TBrr[1], "Restore Database Backup" ); |
|||
$Data['status'] = 1; |
|||
} else { |
|||
$Data['error'] = 'No Backup ID Provided!'; |
|||
}; |
|||
break; |
|||
case 2: |
|||
createNewTask( $TID, '', "Create Database Backup" ); |
|||
$Data['status'] = 1; |
|||
break; |
|||
case 100:{ |
|||
if( $PRM!= '' ){ |
|||
$TArr = explode( '.', $PRM ); |
|||
$TBrr = explode( '_', $TArr[0] ); |
|||
createNewTask( $TID, $GVAULT_PATH.'/'.$TBrr[0].'/'. $PRM , "Delete Package" ); |
|||
$Data['status'] = 1; |
|||
} else { |
|||
$Data['error'] = 'No Snapeshot ID Provided!'; |
|||
}; |
|||
$Data['status'] = 1; |
|||
break; |
|||
}; |
|||
case 128: |
|||
if( $PRM!= '' ){ |
|||
$TArr = explode( '.', $PRM ); |
|||
$TBrr = explode( '_', $TArr[0] ); |
|||
createNewTask( $TID, $GVAULT_PATH.'/'.$TBrr[0].'/'. $PRM , "Restore Full System Snapeshot" ); |
|||
$Data['status'] = 1; |
|||
} else { |
|||
$Data['error'] = 'No Snapeshot ID Provided!'; |
|||
}; |
|||
$Data['status'] = 1; |
|||
break; |
|||
case 255: |
|||
createNewTask( $TID, '', "Create Full System Snapeshot" ); |
|||
$Data['status'] = 1; |
|||
break; |
|||
default: |
|||
$Data['error'] = 'Unrecognized Task ID!'; |
|||
}; |
|||
} else { |
|||
$Data['error'] = 'No Task Type Provided!'; |
|||
}; |
|||
echo json_encode( $Data ); |
|||
?>
|
|||
@ -1,52 +0,0 @@ |
|||
<?php |
|||
require_once('/srv/etc/sys_map.php'); |
|||
$Data = array(); |
|||
$Data['status'] = 0; |
|||
$Data['msg'] = 'Idle'; |
|||
$RMD5 = ''; |
|||
if( isset( $_POST['IMD'] ) ){ |
|||
$RMD5 = $_POST['IMD']; |
|||
} else { |
|||
$RMD5 = $_GET['IMD']; |
|||
}; |
|||
if( file_exists( $GVAULT_PATH.'/new_task.var' ) ){ |
|||
$Data['status'] = 1; |
|||
$Data['msg'] = 'Task is Pending'; |
|||
$Task = json_decode( file_get_contents( $GVAULT_PATH.'/new_task.var' )); |
|||
} elseif( file_exists( $GVAULT_PATH.'/cur_task.var' ) ){ |
|||
$Data['msg'] = 'Task is Running'; |
|||
$Data['status'] = 2; |
|||
$Task = json_decode( file_get_contents( $GVAULT_PATH.'/cur_task.var' )); |
|||
}; |
|||
if( file_exists( $GVAULT_PATH.'/task_log.var' ) ) { |
|||
$TLOG = file_get_contents( $GVAULT_PATH.'/task_log.var' ); |
|||
} else { |
|||
$TLOG = ''; |
|||
}; |
|||
$Data['log_md5'] = md5( $TLOG ); |
|||
if( $Data['log_md5'] != $RMD5 ){ |
|||
$Data['status_log'] = $TLOG; |
|||
}; |
|||
switch( $Data['status'] ){ |
|||
case 0:{ |
|||
$Data['status_desc'] = 'No Pending Tasks'; |
|||
break; |
|||
}; |
|||
case 1:{ |
|||
$Data['status_desc']=$Task->description; |
|||
break; |
|||
}; |
|||
case 2:{ |
|||
$Data['status_desc']=$Task->description; |
|||
if( file_exists( $GVAULT_PATH.'/task_perc.var' ) ){ |
|||
$ACO = intval( file_get_contents( $GVAULT_PATH.'/task_perc.var' ) ); |
|||
} else { |
|||
$ACO = 0; |
|||
}; |
|||
break; |
|||
}; |
|||
}; |
|||
|
|||
echo json_encode( $Data ); |
|||
|
|||
?>
|
|||
@ -1,39 +0,0 @@ |
|||
<?php |
|||
require_once('../../defines.php'); |
|||
require_once('/srv/etc/sys_map.php'); |
|||
require_once('toolkit.php' ); |
|||
|
|||
$DD = file( $GVAULT_PATH . '/versions.var'); |
|||
$Data = array(); |
|||
$Data['backups'] = array(); |
|||
$CID = 0; |
|||
foreach( $DD as $V ){ |
|||
$CV = trim( $V ); |
|||
$BB = file( $GVAULT_PATH.'/'.$CV.'/backups.var' ); |
|||
foreach( $BB as $B ){ |
|||
$TArr = explode( ':', trim( $B ) ); |
|||
if( count( $TArr ) > 1 ){ |
|||
$CR['id'] = $CID; |
|||
$CR['ts'] = date( "Y-m-d H:i", intval($TArr[0])); |
|||
$CR['bk_type'] = intval( $TArr[1] ); |
|||
$CR['base_version']=$CV; |
|||
$CR['file_name']=$CV.'_'.$TArr[0].'.tar.bz2'; |
|||
$CR['size']=filesize( $GVAULT_PATH.'/'.$CV.'/'.$CR['file_name'] ); |
|||
if( $CR['size'] > 268435456 ){ |
|||
$CR['size'] = sprintf("%0.1fGb", $CR['size'] / 1073741824 ); |
|||
} else if( $CR['size'] > 716800 ){ |
|||
$CR['size'] = sprintf("%0.1fMb", $CR['size'] / 1048576 ); |
|||
} else if( $CR['size'] > 1023 ){ |
|||
$CR['size'] = sprintf("%0.1fKb", $CR['size'] / 1024 ); |
|||
} else { |
|||
$CR['size'] = sprintf("%dB", $CR['size'] ); |
|||
}; |
|||
$Data['backups'][]=$CR; |
|||
$CID ++; |
|||
}; |
|||
}; |
|||
}; |
|||
$Data['totalCount'] = $CID; |
|||
echo json_encode( $Data ); |
|||
|
|||
?>
|
|||
@ -1,54 +0,0 @@ |
|||
<?php |
|||
require_once( '/srv/etc/sys_map.php' ); |
|||
require_once( 'toolkit.php' ); |
|||
// the response function
|
|||
function verbose( $ok=1,$info=""){ |
|||
// failure to upload throws 400 error
|
|||
if( $ok==0 ){ |
|||
http_response_code(400); |
|||
}; |
|||
die(json_encode(["ok"=>$ok, "info"=>$info])); |
|||
}; |
|||
// invalid upload
|
|||
if( empty( $_FILES ) || $_FILES['file']['error'] ){ |
|||
verbose( 0, "Failed to move uploaded file.[" . $_FILES['file']['error'] . "]" ); |
|||
}; |
|||
// upload destination
|
|||
//$filePath = __DIR__ . DIRECTORY_SEPARATOR . "../../vault/working_dir/uploads";
|
|||
$filePath = $GTEMP_DIR . '/uploads'; |
|||
if( !file_exists($filePath) ){ |
|||
if (!mkdir($filePath, 0777, true)) { |
|||
verbose(0, "Failed to create $filePath"); |
|||
}; |
|||
}; |
|||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"]; |
|||
$filePath = $filePath . DIRECTORY_SEPARATOR . $fileName; |
|||
// dealing with the chunks
|
|||
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0; |
|||
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0; |
|||
$out = @fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab"); |
|||
if( $out ) { |
|||
$in = @fopen($_FILES['file']['tmp_name'], "rb"); |
|||
if( $in ){ |
|||
while( $buff = fread( $in, 4096 ) ){ |
|||
fwrite($out, $buff); |
|||
}; |
|||
} else { |
|||
verbose(0, "Failed to open input stream"); |
|||
}; |
|||
@fclose($in); |
|||
@fclose($out); |
|||
@unlink($_FILES['file']['tmp_name']); |
|||
} else { |
|||
verbose(0, "Failed to open output stream"); |
|||
}; |
|||
// check if file was uploaded
|
|||
if (!$chunks || $chunk == $chunks - 1) { |
|||
rename("{$filePath}.part", $filePath); |
|||
if( createNewTask( 3, $fileName, 'Handle Upload File' ) == 0 ){ |
|||
unlink( $filePath ); |
|||
verbose(0, "Failed to create new Task"); |
|||
}; |
|||
}; |
|||
verbose(1, "Upload OK"); |
|||
?>
|
|||
@ -1 +0,0 @@ |
|||
/srv/vault |
|||
@ -0,0 +1 @@ |
|||
20220701 |
|||
|
After Width: 64 | Height: 64 | Size: 10 KiB |
|
After Width: 1024 | Height: 1024 | Size: 18 KiB |
|
After Width: 474 | Height: 516 | Size: 14 KiB |
|
After Width: 256 | Height: 256 | Size: 6.9 KiB |
|
After Width: 1875 | Height: 1875 | Size: 125 KiB |
|
After Width: 256 | Height: 256 | Size: 23 KiB |
|
Before Width: 816 | Height: 377 | Size: 68 KiB |
|
After Width: 256 | Height: 256 | Size: 22 KiB |
|
After Width: 1833 | Height: 525 | Size: 73 KiB |
|
After Width: 256 | Height: 256 | Size: 2.4 KiB |
|
After Width: 1600 | Height: 1200 | Size: 359 KiB |
|
After Width: 227 | Height: 222 | Size: 2.3 KiB |
|
After Width: 1519 | Height: 381 | Size: 30 KiB |
|
After Width: 256 | Height: 256 | Size: 72 KiB |
|
After Width: 256 | Height: 256 | Size: 6.6 KiB |
|
After Width: 32 | Height: 32 | Size: 3.8 KiB |
|
After Width: 32 | Height: 32 | Size: 3.7 KiB |
|
After Width: 32 | Height: 32 | Size: 3.6 KiB |
|
After Width: 32 | Height: 32 | Size: 3.6 KiB |
|
After Width: 32 | Height: 32 | Size: 3.8 KiB |
|
After Width: 227 | Height: 222 | Size: 2.0 KiB |
|
After Width: 256 | Height: 256 | Size: 18 KiB |
|
After Width: 1024 | Height: 1024 | Size: 8.7 KiB |