OpenStreetMap contributors',1,19,24)"; $DEFAULT_DATA[0]['location_maps2']="INSERT INTO `location_maps`(`id`,`type`,`name`,`desc`,`layer_url`,`attribution`,`persistent`,`maxNativeZoom`,`maxZoom`) VALUES(2,1,'ESRI Street','ArcGIS StreetMap Premium provides enriched street data for use in ArcGIS software to deliver high-quality cartographic map display, geocoding, and routing.','https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}','© Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',1,19,24)"; $DEFAULT_DATA[0]['location_maps3']="INSERT INTO `location_maps`(`id`,`type`,`name`,`desc`,`layer_url`,`attribution`,`persistent`,`maxNativeZoom`,`maxZoom`) VALUES(3,1,'ESRI Sat','ArcGIS StreetMap Premium provides enriched street data for use in ArcGIS software to deliver high-quality cartographic map display, geocoding, and routing.','https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}','© Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',1,19,24)"; $DEFAULT_DATA[0]['location_maps4']="INSERT INTO `location_maps`(`id`,`type`,`name`,`desc`,`layer_url`,`attribution`,`persistent`,`maxNativeZoom`,`maxZoom`) VALUES(4,1,'ESRI Topo','ArcGIS StreetMap Premium provides enriched street data for use in ArcGIS software to deliver high-quality cartographic map display, geocoding, and routing.','https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}','© Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',1,19,24)"; $DEFAULT_DATA[0]['location_maps5']="INSERT INTO `location_maps`(`id`,`type`,`name`,`desc`,`layer_url`,`attribution`,`persistent`,`maxNativeZoom`,`maxZoom`) VALUES(5,1,'Open Topo','OpenStreetMap is a free, open geographic database updated and maintained by a community of volunteers via open collaboration. Contributors collect data from surveys, trace from aerial imagery and also import from other freely licensed geodata sources','https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png','© OpenStreetMap contributors',1,19,24)"; $DEFAULT_DATA[0]['modules1']="INSERT INTO `modules`(`id`,`type`,`aux_id`,`enabled`) VALUES(1,8,1,1)"; $DEFAULT_DATA[0]['module_eve']="INSERT INTO `module_eve`(`output_mode`,`web_port`,`width`,`height`) VALUES(2,8972,1280,720)"; //Project Data // Metro $DEFAULT_DATA[0]['system_props']="INSERT INTO `system_props`(`id`,`type`,`name`,`oem_logo`,`work_mode`,`app_layout`,`map_id`,`remote_ip`,`remote_backup_ip`,`use_remote_server`) VALUES(1,1,'TRAIN Sensor Module','20f21b4f01f1b7587f728b05dfc9f4ea',0,1,1,'10.144.2.223','10.144.2.223',1)"; $DEFAULT_DATA[0]['nodes1']="INSERT INTO `nodes`(`id`,`type`,`aux_id`,`aux_parameter`,`online`,`enable`,`name`) VALUES(1,0,1,0,0,0,'Controller')"; //-----------------------------------// $DEFAULT_DATA[0]['nodes2']="INSERT INTO `nodes`(`id`,`type`,`aux_id`,`aux_parameter`,`online`,`enable`,`name`) VALUES(2,3,1,0,0,1,'SENSOR_1')"; $DEFAULT_DATA[0]['nodes3']="INSERT INTO `nodes`(`id`,`type`,`aux_id`,`aux_parameter`,`online`,`enable`,`name`) VALUES(3,3,2,0,0,1,'SENSOR_2')"; $DEFAULT_DATA[0]['nodes4']="INSERT INTO `nodes`(`id`,`type`,`aux_id`,`aux_parameter`,`online`,`enable`,`name`) VALUES(4,13,1,1,0,1,'General_1')"; $DEFAULT_DATA[0]['lrf_sensors1']="INSERT INTO `lrf_sensors`(`id`,`type`,`x`,`y`,`z`,`max_range`,`enabled_lrf`,`uart_id`,`device_id`,`filter_id`,`dc_auto`,`dc_no`,`dc_window`) VALUES(1,3,0,0,0,65.0,255,1,0,1,0,1,2)"; $DEFAULT_DATA[0]['lrf_sensors2']="INSERT INTO `lrf_sensors`(`id`,`type`,`x`,`y`,`z`,`max_range`,`enabled_lrf`,`uart_id`,`device_id`,`filter_id`,`dc_auto`,`dc_no`,`dc_window`) VALUES(2,3,0,0,0,65.0,255,2,0,1,0,1,2)"; $DEFAULT_DATA[0]['lrf_draw1']="INSERT INTO `lrf_draw`(`id`,`node_id`,`lrf_id`,`type`,`ts`,`data`) VALUES(1,2,0,0,0,'')"; $DEFAULT_DATA[0]['lrf_draw2']="INSERT INTO `lrf_draw`(`id`,`node_id`,`lrf_id`,`type`,`ts`,`data`) VALUES(2,3,0,0,0,'')"; $DEFAULT_DATA[0]['cameras']="INSERT INTO `cameras`(`id`,`type`,`online`,`stream_id`,`hardware`,`name`,`status`,`protocol`,`imager_type`,`pan_model`,`pan_angles`,`tilt_model`,`tilt_angles`,`zoom_model`,`zoom`,`max_range`,`access_login`,`access_pass`,`ip`,`onvif_ctrl`,`ptz_token`,`trigger_mode`,`auth_mode`,`ptz_axel`,`manual`,`homing_enable`,`homing_to`,`home_token`)VALUES(1,13,0,1,'IP_Camera','General',3,3,1,1,360,0,180,1,28.0,350.0,'admin','aldsm1400','192.168.0.100','/onvif/device_service','1',1,0,5,1,1,3,NULL)"; $DEFAULT_DATA[0]['media_streams1']="INSERT INTO `media_streams`(`id`,`source_id`,`source_type`,`name`,`token`,`img_width`,`img_height`,`fps`,`compression_type`,`mrl_proto`,`mrl_port`,`mrl`,`picture_proto`,`picture_port`,`picture`)VALUES(1,1,'D','MediaProfile_Channel1_MainStream','MediaProfile000',1280,720,15,'JPEG','rtsp',554,'/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif','http',80,'/onvifsnapshot/media_service/snapshot?channel=1&subtype=0')"; $DEFAULT_DATA[0]['media_streams2']="INSERT INTO `media_streams`(`id`,`source_id`,`source_type`,`name`,`token`,`img_width`,`img_height`,`fps`,`compression_type`,`mrl_proto`,`mrl_port`,`mrl`,`picture_proto`,`picture_port`,`picture`)VALUES(2,1,'D','MediaProfile_Channel1_MainStream1','MediaProfile001',704,576,1,'JPEG','rtsp',554,'/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif','http',80,'/onvifsnapshot/media_service/snapshot?channel=1&subtype=1')"; $DEFAULT_DATA[0]['media_streams3']="INSERT INTO `media_streams`(`id`,`source_id`,`source_type`,`name`,`token`,`img_width`,`img_height`,`fps`,`compression_type`,`mrl_proto`,`mrl_port`,`mrl`,`picture_proto`,`picture_port`,`picture`)VALUES(3,1,'D','MediaProfile_Channel1_MainStream2','MediaProfile002',1280,720,1,'JPEG','rtsp',554,'/cam/realmonitor?channel=1&subtype=2&unicast=true&proto=Onvif','http',80,'/onvifsnapshot/media_service/snapshot?channel=1&subtype=2')"; //$DEFAULT_DATA[0]['modules1']="INSERT INTO `modules`(`id`,`type`,`aux_id`,`enabled`) VALUES(2,7,1,0)"; $DEFAULT_DATA[0]['uart_settings1']="INSERT INTO `uart_settings`(`id`,`node_id`,`type`,`speed`,`bit`,`parity`,`stop_bit`,`mode`,`port`,`path`) VALUES(1,1,1,19200,8,'N',1.0,0,0,'/dev/ttyS1')";//Bottom = Sen 1 $DEFAULT_DATA[0]['uart_settings2']="INSERT INTO `uart_settings`(`id`,`node_id`,`type`,`speed`,`bit`,`parity`,`stop_bit`,`mode`,`port`,`path`) VALUES(2,1,1,19200,8,'N',1.0,0,0,'/dev/ttyS0')";//Upper = Sen 2 $DEFAULT_DATA[0]['target_filters1']="INSERT INTO `target_filters`(`id`,`type`,`aux_id`,`enabled`) VALUES(1,1,1,1)"; $DEFAULT_DATA[0]['target_filters2']="INSERT INTO `target_filters`(`id`,`type`,`aux_id`,`enabled`) VALUES(2,3,1,1)"; $DEFAULT_DATA[0]['target_filter_train']="INSERT INTO `target_filter_train`(`id`,`UPPER_SENSOR`,`LOWER_SENSOR`,`TRAIN_DETECT`,`TRAIN_WIDTH`,`DECISION_TIME`,`SUSPECT_TIME`,`TRACK_TRAIN`,`DEBUG`) VALUES(1,3,2,1,15000,10,20,0,0)"; $DEFAULT_DATA[0]['target_filter_bubble']="INSERT INTO `target_filter_bubble`(`id`) VALUES(1)"; $DEFAULT_DATA[0]['node_tf1']="INSERT INTO `node_target_filters`(`id`,`node_id`,`filter_id`,`order`) VALUES(1,2,1,1)"; $DEFAULT_DATA[0]['node_tf2']="INSERT INTO `node_target_filters`(`id`,`node_id`,`filter_id`,`order`) VALUES(2,2,2,2)"; $DEFAULT_DATA[0]['node_tf3']="INSERT INTO `node_target_filters`(`id`,`node_id`,`filter_id`,`order`) VALUES(3,3,1,1)"; function createTables( $DBO, $DBID ){ global $CREATE_SENTENCE, $DEFAULT_DATA; $i = 0; if( $DBID < 6 ){ foreach( $CREATE_SENTENCE[0] as $SENTENCE ) { $i++; echo $i .":>"; echo $SENTENCE . "\n\n"; $DBO->Query( $SENTENCE, false ); }; if( $DBID ){ foreach( $CREATE_SENTENCE[$DBID] as $SENTENCE ) { $i++; echo $i .":>"; echo $SENTENCE . "\n\n"; $DBO->Query( $SENTENCE, false ); }; }; foreach( $DEFAULT_DATA[0] as $QS ){ echo $QS . "\n\n"; $DBO->Query( $QS, false ); }; if( $DBID ){ foreach( $DEFAULT_DATA[$DBID] as $QS ){ echo $QS . "\n\n"; $DBO->Query( $QS, false ); }; }; } else { echo "No Such Applicatui\n"; }; }; function getQuotedString( $S ){ $O = ''; $QQ = false; for( $idx = 0; $idx < strlen( $S ); $idx++ ){ $CC = substr( $S, $idx, 1 ); if( $QQ ){ if( $CC == '"' ){ $QQ = false; if( $idx == strlen( $S ) - 1 ) break; }; } else { if( $CC == '"' ){ $QQ = true; continue; }; }; $O .= $CC; }; return $O; }; function createLanguage( $DBN, $LID, $CVF ){ $CSEN = <<<_DATA_BOUNDARY CREATE TABLE "labels" ( "language_id" INTEGER NOT NULL, "key" TEXT NOT NULL, "label" BLOB NOT NULL, CONSTRAINT "uni" UNIQUE("language_id","key") ) _DATA_BOUNDARY; if( file_exists( $CVF ) ){ $DADA = new SQLite_DB( $DBN ); $DADA->Query( $CSEN, false ); $FD = fopen( $CVF, "r" ); $PLF = true; while( !feof( $FD ) ){ if( ( $L = fgets( $FD )) !== false ){ $CES = trim( $L ); $TArr = explode( ',', $L ); if( $PLF ){ if( count( $TArr ) > 1 ){ $CLID = intval( $TArr[0] ); if( $CLID == $LID ){ $LBL = $TArr[1]; $Z = stripos( $CES, $LBL )+strlen($LBL)+1; $CVL = substr( $CES, $Z ); if( substr( $CVL, 0, 1 )=='"' ){ $PLF = false; $LA_VAL = getQuotedString( $CVL ); } else { $LA_VAL = $CVL; }; if( substr( $CES, -1 ) == '"' ) $PLF = true; } else continue; }; } else { $LA_VAL .= getQuotedString( $CES ); if( substr( $CES, -1 ) == '"' ) $PLF = true; }; if( $PLF ){ // add to Database $ES = $DADA->escape( $LA_VAL ); $QS = "INSERT INTO `labels`(`language_id`,`key`,`label`) VALUES({$LID},'{$LBL}','$ES')"; $DADA->Query( $QS, false ); }; }; }; fclose( $FD ); }; }; function insertLanguageToDB( $DBN, $LDBN, $LANID, $LAN_NAME, $LANID_SHORT, $LANID_SHORT2 ){ }; function createLanguageJson( $FN, $LID, $CVF ){ if( file_exists( $CVF ) ){ $FD = fopen( $CVF, "r" ); $PLF = true; $LANGUAGE = array(); while( !feof( $FD ) ){ if( ( $L = fgets( $FD )) !== false ){ $CES = trim( $L ); $TArr = explode( ',', $L ); if( $PLF ){ if( count( $TArr ) > 1 ){ $CLID = intval( $TArr[0] ); if( $CLID == $LID ){ $LBL = $TArr[1]; $Z = stripos( $CES, $LBL )+strlen($LBL)+1; $CVL = substr( $CES, $Z ); if( substr( $CVL, 0, 1 )=='"' ){ $PLF = false; $LA_VAL = getQuotedString( $CVL ); } else { $LA_VAL = $CVL; }; if( substr( $CES, -1 ) == '"' ) $PLF = true; } else continue; }; } else { $LA_VAL .= getQuotedString( $CES ); if( substr( $CES, -1 ) == '"' ) $PLF = true; }; if( $PLF ){ // add to Database $LANGUAGE[$LBL] = $LA_VAL; //$ES = $DADA->escape( $LA_VAL ); //$QS = "INSERT INTO `labels`(`language_id`,`key`,`label`) VALUES({$LID},'{$LBL}','$ES')"; //echo $QS . "\n"; //$DADA->Query( $QS, false ); }; }; }; fclose( $FD ); $FD = fopen( $FN, "w+" ); fprintf( $FD, json_encode( $LANGUAGE ) ); fclose( $FD ); }; }; use Shuchkin\SimpleXLSX; require_once __DIR__.'/SimpleXLSX.php'; function generateLabelsFromXLSX( $FN, $LID, $IFN ){ if( file_exists( $IFN ) ){ if ($xlsx = SimpleXLSX::parse( $IFN )) { $LANGUAGE = array(); foreach( $xlsx->rows() as $r ){ $LANGUAGE[$r[1]]=$r[2]; }; $FD = fopen( $FN, "w+" ); fprintf( $FD, json_encode( $LANGUAGE ) ); fclose( $FD ); } else { echo SimpleXLSX::parseError(); }; }; }; use Shuchkin\SimpleXLS; require_once __DIR__.'/SimpleXLS.php'; function generateLabelsFromXLS( $FN, $LID, $IFN ){ if( file_exists( $IFN ) ){ if ($xlsx = SimpleXLS::parse( $IFN )) { $LANGUAGE = array(); foreach( $xlsx->rows() as $r ){ $LANGUAGE[$r[1]]=$r[2]; }; $FD = fopen( $FN, "w+" ); fprintf( $FD, json_encode( $LANGUAGE ) ); fclose( $FD ); } else { echo SimpleXLS::parseError(); }; }; }; ?>