Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. function verbose( $ok=1,$info=""){
  4. // failure to upload throws 400 error
  5. if( $ok==0 ){
  6. http_response_code(400);
  7. };
  8. die(json_encode(["ok"=>$ok, "info"=>$info]));
  9. };
  10. if( $CUser->Data['id'] > 1 ){
  11. $MID = intval( $_POST['MID'] );
  12. if( $MID ){
  13. $QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}";
  14. $DDD = $DATABASE->Query( $QS );
  15. if( count( $DDD ) ){
  16. $MD = $DDD[0];
  17. list( $width, $height, $type, $attr ) = getimagesize( $SYSPath . 'lib/controller/data/assets/images/' . $MD['layer_url'] );
  18. $ENAME = $DATABASE->escape($_POST['map_name']);
  19. $EDESC = $DATABASE->escape($_POST['map_desc']);
  20. $EATTR = $DATABASE->escape($_POST['map_attr']);
  21. $IZOOM = intval( $_POST['map_maxz'] );
  22. $INZOOM = intval( $_POST['map_maxz'] );
  23. $MA_WI = floatval( $_POST['map_width'] );
  24. $MA_HE = floatval( $_POST['map_height'] );
  25. $TB = intval( $_POST['map_tpb'] );
  26. $LB = intval( $_POST['map_lpb'] );
  27. $RB = intval( $_POST['map_rpb'] );
  28. $BB = intval( $_POST['map_bpb'] );
  29. $K_X = $MA_WI / ( $width - $LB - $RB );
  30. $K_Y = $MA_HE / ( $height - $TB - $BB );
  31. $IBLX = (-$LB)*$K_X;
  32. $IBLY = (-$TB)*$K_Y;
  33. $IBRX = ( $width + $RB ) * $K_X;
  34. $IBRY = ( $height + $BB ) * $K_Y;
  35. $QS = "UPDATE `location_maps` SET `name`='{$ENAME}',`desc`='{$EDESC}', `maxNativeZoom`={$INZOOM},`maxZoom`={$IZOOM}, `attribution`='{$EATTR}',`bounds_lx`={$IBLX},`bounds_ly`={$IBLY}, `bounds_rx`={$IBRX},`bounds_ry`={$IBRY}, `img_w`={$width}, `img_h`={$height}, `img_lb`={$LB}, `img_rb`={$RB}, `img_tb`={$TB},`img_bb`={$BB}, `img_map_w`={$MA_WI}, `img_map_h`={$MA_HE} WHERE `id`={$MID}";
  36. $DATABASE->Query( $QS );
  37. verbose( 1, "ALL IS OK" );
  38. } else verbose( 0, "WRONG MAPID" );
  39. } else verbose( 0, "WRONG MAPID" );
  40. } else {
  41. verbose( 0, 'Access Denied!' );
  42. };
  43. ?>