Data['id'] > 1 ){ $EID = intval( $_POST['MID'] ); $QS = "SELECT * FROM modules WHERE id = {$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; switch( $CR['type'] ){ case 1: //DCB USB break; case 2: //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)?'':''); $USSL = (intval($CI['use_ssl'])>0)?'true':'false'; $TPL =<<GetLabel("_ERROR_MSG_")}', msg: data['msg'], buttons: Ext.Msg.OK, fn: function(){ SettingsLidar3D.hide(); }, icon: Ext.MessageBox.ERROR }); }; }, failure: failureAJAXFunction }); }, items:[{ xtype: 'form', id: 'ks_fp_ms', title: '{$Labels->GetLabel('_KAFKA_BROKER_')}', labelWidth: 480, labelAlign: 'right', border: false, frame: false, items:[{ xtype: 'spacer', height: 10 },{ xtype: 'textfield', id: 'b_address', fieldLabel: 'Broker Address', value: '{$CI['brocker_address']}' },{ xtype: 'numberfield', id: 'b_port', fieldLabel: 'Broker Port', value: {$CI['brocker_port']} },{ xtype: 'checkbox', id: 'b_ssl', fieldLabel: 'Use SSL', checked: {$USSL} },{ xtype: 'button', id: 'cl_cert_select', fieldLabel: 'CA Root certificate to verify the broker\'s certificate [truststore]', text: 'Upload New', handler: function(){ currentSelectedFile = 1; } },{ xtype: 'button', id: 'ca_cert_select', fieldLabel: 'Client\'s certificate [keystore]', text: 'Upload New', handler: function(){ currentSelectedFile = 1; } },{ xtype: 'button', id: 'cl_key_select', fieldLabel: 'Client\'s key [key]', text: 'Upload New', handler: function(){ currentSelectedFile = 1; } },{ xtype: 'textfield', fieldLabel: 'Access Username', id: 'b_user', value: '{$CI['cred_username']}' },{ xtype: 'textfield', fieldLabel: 'Access Password', id: 'b_password', value: '{$CI['cred_password']}' },{ xtype: 'panel', id: 'validator', html: '

%%%VALIDATION%%%

' }] },{ title: '{$Labels->GetLabel('_KAFKA_TOP_EVTS_')}', html: '' }], listeners:{ afterrender: function(){ var currentSelectedFile = 0; var up_ca = new plupload.Uploader({ runtimes : 'html5,html4', browse_button : Ext.getDom('ca_cert_select'), max_file_size : '256kb', chunk_size: '10kb', max_retries: 0, multi_selection: false, max_file_count: 1, url: '/lib/controller/uploadModuleKafkaData.php', filters : [ {title : "Certificate files", extensions : "pem,crt,cert,jks"} ], init: { PostInit: function() { }, FilesAdded: function( up, files ) { up_ca.start(); }, UploadProgress: function(up, file) { if( file.percent == 100 ){ alert('Umpalumpa'); }; }, Error: function(up, err) { Ext.Msg.show({ title:'Upload Status', msg: "Error #" + err.code + ": " + err.message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }); var up_crt = new plupload.Uploader({ runtimes : 'html5,html4', browse_button : Ext.getDom('cl_cert_select'), max_file_size : '256kb', chunk_size: '10kb', max_retries: 0, multi_selection: false, max_file_count: 1, url: '/lib/controller/uploadModuleKafkaData.php', filters : [ {title : "Certificate files", extensions : "pem,crt,cert,jks"} ], init: { PostInit: function() { }, FilesAdded: function( up, files ) { up_crt.start(); }, UploadProgress: function(up, file) { if( file.percent == 100 ){ alert('Umpalumpa'); }; }, Error: function(up, err) { Ext.Msg.show({ title:'Upload Status', msg: "Error #" + err.code + ": " + err.message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }); var up_key = new plupload.Uploader({ runtimes : 'html5,html4', browse_button : Ext.getDom('cl_key_select'), max_file_size : '256kb', chunk_size: '10kb', max_retries: 0, multi_selection: false, max_file_count: 1, url: '/lib/controller/uploadModuleKafkaData.php', filters : [ {title : "Certificate files", extensions : "pem,crt,cert,jks"} ], init: { PostInit: function() { }, FilesAdded: function( up, files ) { up_key.start(); }, UploadProgress: function(up, file) { if( file.percent == 100 ){ alert('Umpalumpa'); }; }, Error: function(up, err) { Ext.Msg.show({ title:'Upload Status', msg: "Error #" + err.code + ": " + err.message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }); up_ca.init(); up_crt.init(); up_key.init(); } }, status: 'ok', wTitle: '{$Labels->GetLabel('_KAFKA_DESC_SHO_')}' } EFUFU; function CTS2UTS( $KAKA ){ $parsed = date_parse_from_format( "M d H:i:s Y T", $KAKA ); return mktime( $parsed['hour'], $parsed['minute'], $parsed['second'], $parsed['month'], $parsed['day'], $parsed['year'] ); }; // Validate $BPath = './data/modules/VAULT/'.$CI['vault_md5'].'/'; $CAValid = false; $PUValid = false; $PRValid = false; $PUMD5 = false; $PRMD5 = false; $ValidationOutput = "
Vault ID: {$CI['vault_md5']}
"; if( file_exists( $BPath.$CI['vault_md5'].'.CA.pem' ) ){ $CMD = "openssl x509 -in {$BPath}{$CI['vault_md5']}.CA.pem -passin pass:{$CI['cred_password']} -noout -text 2>&1"; $ININ = `$CMD`; $TArr = explode( "\n", $ININ ); $CAValid = true; foreach( $TArr as $T ){ $CL = trim( $T ); if( stripos( $CL, 'Not Before' ) !== false ){ if( time() < CTS2UTS( trim( substr( $CL, 11 ) ) ) ) $CAValid = false; }; if( stripos( $CL, 'Not After' ) !== false ){ if( time() > CTS2UTS( trim( substr( $CL, 11 ) ) ) ) $CAValid = false; }; if( stripos( $CL, 'CA:FALSE' ) !== false ) $CAValid = false; }; if( $CAValid ){ $ValidationOutput .= "
Root CA Certificate is Valid
"; } else { $ValidationOutput .= "
Root CA Certificate is Invalid!
"; }; } else { $ValidationOutput .= "
Root CA Certificate is not present!
[it\'s OK if the system uses Real Certs(not Self Signed)]
"; }; if( file_exists( $BPath.$CI['vault_md5'].'.key' ) ){ $CMD = "openssl rsa -check -noout -in {$BPath}{$CI['vault_md5']}.key -passin pass:{$CI['cred_password']} 2>&1"; $ChKey = trim( `$CMD` ); if( stripos( $ChKey, 'RSA key ok' ) !== false ){ $CMD = "openssl rsa -modulus -noout -in {$BPath}{$CI['vault_md5']}.key -passin pass:{$CI['cred_password']}"; $PRMD5 = md5( trim( `$CMD` ) ); $PRValid = true; }; } else { $ValidationOutput .= "
No Private Key is Set!
"; }; if( file_exists( $BPath.$CI['vault_md5'].'.CERT.pem' ) ){ $CMD = "openssl x509 -modulus -noout -in {$BPath}{$CI['vault_md5']}.CERT.pem -passin pass:{$CI['cred_password']} 2>&1"; $ChKey = trim( `$CMD` ); if( stripos( $ChKey, 'RSA key ok' ) === false ){ $CMD = "openssl x509 -modulus -noout -in {$BPath}{$CI['vault_md5']}.CERT.pem -passin pass:{$CI['cred_password']}"; $PUMD5 = md5( trim( `$CMD` ) ); $PUValid = true; }; } else { $ValidationOutput .= "
No Public Key Certificate is Set!
"; }; if( $PRValid && $PUValid ){ if( $PUMD5 == $PRMD5 ){ $ValidationOutput .= "
Public Key Certificate is Matched With Private Key
"; } else { $ValidationOutput .= "
Public Key Certificate is Not Matched With Private Key!
{$PUMD5}::{$PRMD5}
"; }; } else { $ValidationOutput .= "
Private/Public Key Can not be checked!
"; }; $TPL = str_replace( '%%%VALIDATION%%%', $ValidationOutput, $TPL ); echo $TPL; break; case 6: // SSDP $TPL =<<%%%NAME%%%%%%INFO%%%' },{ xtype: 'spacer', height: 5 },{ border: false, frame: false, xtype: 'panel', html: '
%%%LOINFO%%%
' },{ 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', listeners:{ select: function( t, r, i ){ if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); } } },{ xtype: 'spacer', height: 5 },{ xtype: 'button', id: 'mo_del_btn', disabled: false, width: '100%', text: 'Remove Module', handler: function(){ removeModule({$EID}); } }] } 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 7: // Onvif $TPL =<<%%%NAME%%%%%%INFO%%%' },{ xtype: 'spacer', height: 5 },{ border: false, frame: false, xtype: 'panel', html: '
%%%LOINFO%%%
' },{ 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: { xtype: 'arraystore', fields: ['status_val','status_txt'], data: [[0,'Disabled'],[1,'Enabled']] }, value: %%%ENA_VAL%%%, valueField: 'status_val', displayField: 'status_txt', listeners:{ select: function( t, r, i ){ if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); } } },{ xtype: 'spacer', height: 5 },{ xtype: 'button', id: 'mo_del_btn', disabled: false, width: '100%', text: 'Remove Module', handler: function(){ removeModule({$EID}); } }] } 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 8://Embed Video Encoder $QS="SELECT * FROM `module_eve` WHERE `id`={$CR['aux_id']}"; $II = $DATABASE->Query( $QS ); $CI = $II[0]; $TS = array( '320x240', '640x480', '800x600', '1280x720', '1024x768', '1920x1080' ); $YY = $CI['width'].'x'.$CI['height']; for( $i=0; $iGetLabel("_ERROR_MSG_")}', msg: data['msg'], buttons: Ext.Msg.OK, fn: function(){ SettingsLidar3D.hide(); }, icon: Ext.MessageBox.ERROR }); }; }, failure: failureAJAXFunction }); }, items:[{ xtype: 'panel', title: 'Output Settings', items:[{ xtype: 'panel', id: 'eve_frm_prev', html: '', height: 400, width: 760, border: false },{ xtype: 'form', labelWidth: 180, labelAlign: 'right', border: false, items: [{ xtype: 'combo', fieldLabel: '{$Labels->GetLabel('_OUTPUT_FRAME_SIZE_')}', id: 'FRM_SIZE', //width: 120, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: { xtype: 'arraystore', fields: [ 'szId', 'szText' ], data: [ [0, '320x240'], [1, '640x480'], [2, '800x600'], [3, '1280x720'], [4, '1024x768'], [5, '1920x1080'] ] }, valueField: 'szId', displayField: 'szText', value: {$CSID}, listeners:{ select: updateFramePreview, change: updateFramePreview } },{ xtype: 'numberfield', fieldLabel: '{$Labels->GetLabel('_EVE_PORT_')}', id: 'WA_PORT', width: 120, minValue: 1000, maxValue: 65535, value: {$CI['web_port']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_COMPRESS_QUA_')}', id: 'COMP_QUAL', width: 120, minValue: 0, maxValue: 100, value: {$CI['compression_quality']} },{ xtype: 'checkbox', fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_TS_')}', id: 'eve_show_ts', disabled: true, checked: {$CI['show_ts']}, handler: updateFramePreview },{ xtype: 'checkbox', fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LBL_')}', id: 'eve_show_lbl', disabled: true, checked: {$CI['show_label']}, handler: updateFramePreview },{ xtype: 'checkbox', fieldLabel: '{$Labels->GetLabel('_EVE_SHOW_LOGO_')}', id: 'eve_show_logo', disabled: true, checked: {$CI['show_logo']}, handler: updateFramePreview }] }] },{ xtype: 'form', title: 'Time Stamp', labelWidth: 180, labelAlign: 'right', disabled: true, items:[{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSX_')}', id: 'TS_POSX', width: 120, minValue: 0, maxValue: 100, value: {$CI['ts_x']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_TS_POSY_')}', id: 'TS_POSY', width: 120, minValue: 0, maxValue: 100, value: {$CI['ts_y']} },{ xtype: 'checkbox', fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_TS_')}', id: 'eve_transp_ts', checked: {$CI['ts_transperant']} },{ xtype: 'combo', fieldLabel: '{$Labels->GetLabel('_EVE_FONT_TS_')}', id: 'TS_FONT', width: 120, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: { xtype: 'arraystore', fields: [ 'szId', 'szText' ], data: [ [0, 'SIMPLEX'], [1, 'PLAIN'], [2, 'DUPLEX'], [3, 'COMPLEX'], [4, 'TRIPLEX'], [5, 'COMPLEX_SMALL'], [6, 'SCRIPT_SIMPLEX'], [7, 'SCRIPT_COMPLEX'] ] }, valueField: 'szId', displayField: 'szText', value: {$CI['ts_font_face']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_TS_FSCALE_')}', id: 'TS_FSCALE', width: 120, minValue: 0.0, maxValue: 4.0, value: {$CI['ts_font_scale']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_TS_FTHICK_')}', id: 'TS_FTHICK', width: 120, minValue: 1, maxValue: 8.0, value: {$CI['ts_font_thickness']} },{ xtype: 'combo', fieldLabel: '{$Labels->GetLabel('_EVE_TS_LINE_T_')}', id: 'TS_LINET', width: 120, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: { xtype: 'arraystore', fields: [ 'szId', 'szText' ], data: [ [0, 'THIN'], [1, 'ANTIALIAZED'], [2, 'THICK'] ] }, valueField: 'szId', displayField: 'szText', value: {$CI['ts_line_type']} }] },{ xtype: 'form', title: 'Label', labelWidth: 180, labelAlign: 'right', disabled: true, items:[{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSX_')}', id: 'LBL_POSX', width: 120, minValue: 0, maxValue: 100, value: {$CI['label_x']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LBL_POSY_')}', id: 'LBL_POSY', width: 120, minValue: 0, maxValue: 100, value: {$CI['label_y']} },{ xtype: 'checkbox', fieldLabel: '{$Labels->GetLabel('_EVE_TRANSO_LBL_')}', id: 'eve_transp_lbl', checked: {$CI['label_transperant']} },{ xtype: 'combo', fieldLabel: '{$Labels->GetLabel('_EVE_FONT_LBL_')}', id: 'LBL_FONT', width: 120, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store:{ xtype: 'arraystore', fields: [ 'szId', 'szText' ], data: [ [0, 'SIMPLEX'], [1, 'PLAIN'], [2, 'DUPLEX'], [3, 'COMPLEX'], [4, 'TRIPLEX'], [5, 'COMPLEX_SMALL'], [6, 'SCRIPT_SIMPLEX'], [7, 'SCRIPT_COMPLEX'] ] }, valueField: 'szId', displayField: 'szText', value: {$CI['label_font_face']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FSCALE_')}', id: 'LBL_FSCALE', width: 120, minValue: 0.0, maxValue: 4.0, value: {$CI['label_font_scale']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LBL_FTHICK_')}', id: 'LBL_FTHICK', width: 120, minValue: 1, maxValue: 8.0, value: {$CI['label_font_thickness']} },{ fieldLabel: '{$Labels->GetLabel('_EVE_LBL_LINE_T_')}', xtype: 'combo', id: 'LBL_LINET', width: 120, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: { xtype: 'arraystore', fields: [ 'szId', 'szText' ], data: [ [0, 'THIN'], [1, 'ANTIALIAZED'], [2, 'THICK'] ] }, valueField: 'szId', displayField: 'szText', value: {$CI['label_line_type']} }] },{ xtype: 'form', title: 'Logo', labelWidth: 180, labelAlign: 'right', disabled: true, items:[{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSX_')}', id: 'LOGO_POSX', width: 120, minValue: 0, maxValue: 100, value: {$CI['logo_x']} },{ xtype: 'slider', fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_POSY_')}', id: 'LOGO_POSY', width: 120, minValue: 0, maxValue: 100, value: {$CI['logo_y']} },{ xtype: 'numberfield', fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_WIDTH_')}', id: 'LOGO_WIDTH', width: 120, minValue: 0, maxValue: 256, value: {$CI['logo_w']} },{ xtype: 'numberfield', fieldLabel: '{$Labels->GetLabel('_EVE_LOGO_HEIGHT_')}', id: 'LOGO_HEIGHT', width: 120, minValue: 0, maxValue: 256, value: {$CI['logo_h']} },{ xtype: 'panel', id: 'eve_logo_ph', html: '
' },{ xtype: 'panel', html: '' }] }], listeners: { afterlayout: updateFramePreview }, status: 'ok', wTitle: '{$Labels->GetLabel('_EMBED_VIDEO_ENCODER_')}' } 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 ); $Data['status'] = 'ok'; $Data['title'] = $Labels->GetLabel('_EMBED_VIDEO_ENCODER_'); $Data['content'] = json_decode( $TPL ); echo $TPL; //json_encode($Data); break; case 9: //Modem $QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}"; $II = $DATABASE->Query( $QS ); $CI = $II[0]; $TPL =<<%%%NAME%%%%%%INFO%%%' },{ xtype: 'spacer', height: 5 },{ xtype: 'spacer', height: 5 },{ xtype: 'textfield', id: 'num_prefix', name: 'num_prefix', fieldLabel: 'Default Prefix', value: '{$CI['default_prefix']}' },{ xtype: 'spacer', height: 5 },{ xtype: 'slider', id: 'trig_window', name: 'trig_window', fieldLabel: 'Trigger Time (seconds)', maxValue: 15, width: '80%', minValue: 0, increment: 3, value: {$CI['trigger_window']} },{ xtype: 'spacer', height: 5 },{ xtype: 'slider', id: 'alarm_window', name: 'alarm_window', fieldLabel: 'Alarm Time (seconds)', width: '80%', increment: 60, maxValue: 3600, minValue: 180, value: {$CI['alarm_window']} },{ xtype: 'spacer', height: 5 },{ xtype: 'grid', id: 'phone_book_grid', border: false, frame: false, autoScroll: true, //width: '100%', lazyRender: true, tbar:[{ text: 'Add', handler: addNewPhoneNumber },{ text: 'Delete', id: 'ph_bo_de_bu', disabled: true }], height: 225, ds: archives_store, cm: new Ext.grid.ColumnModel( archivesColModel_ops ), sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ), viewConfig: { // forceFit: true }, },{ xtype: 'spacer', height: 5, html: '
' },{ xype: 'panel', layout: 'vbox', frame: false, height: 120, items:[{ xtype: 'panel', layout: 'table', width: '100%', defaults: { // applied to each contained panel bodyStyle:'padding:20px' }, layoytConfig:{ columns: 4 }, items: [{ xtype: 'spacer', html: '

New Phone Number:

' },{ xtype: 'textfield', id: 'n_ph_n', name: 'n_ph_n' },{ xtype: 'spacer', html: '

Custom Message:

' },{ xtype: 'textarea', id: 'n_ph_l', name: 'n_ph_l', fieldLabel: 'Custom Message', }] },{ xtype: 'button', width: '100%', text: 'Add Phone Number', handler: function(){ } }] }], listeners:{ afterrender: loadPhoneBook } } EFUFU; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_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: /'); }; ?>