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.
44 lines
1.9 KiB
44 lines
1.9 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
|
|
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]));
|
|
};
|
|
if( $CUser->Data['id'] > 1 ){
|
|
$MID = intval( $_POST['MID'] );
|
|
if( $MID ){
|
|
$QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}";
|
|
$DDD = $DATABASE->Query( $QS );
|
|
if( count( $DDD ) ){
|
|
$MD = $DDD[0];
|
|
list( $width, $height, $type, $attr ) = getimagesize( $SYSPath . 'lib/controller/data/assets/images/' . $MD['layer_url'] );
|
|
$ENAME = $DATABASE->escape($_POST['map_name']);
|
|
$EDESC = $DATABASE->escape($_POST['map_desc']);
|
|
$EATTR = $DATABASE->escape($_POST['map_attr']);
|
|
$IZOOM = intval( $_POST['map_maxz'] );
|
|
$INZOOM = intval( $_POST['map_maxz'] );
|
|
$MA_WI = floatval( $_POST['map_width'] );
|
|
$MA_HE = floatval( $_POST['map_height'] );
|
|
$TB = intval( $_POST['map_tpb'] );
|
|
$LB = intval( $_POST['map_lpb'] );
|
|
$RB = intval( $_POST['map_rpb'] );
|
|
$BB = intval( $_POST['map_bpb'] );
|
|
$K_X = $MA_WI / ( $width - $LB - $RB );
|
|
$K_Y = $MA_HE / ( $height - $TB - $BB );
|
|
$IBLX = (-$LB)*$K_X;
|
|
$IBLY = (-$TB)*$K_Y;
|
|
$IBRX = ( $width + $RB ) * $K_X;
|
|
$IBRY = ( $height + $BB ) * $K_Y;
|
|
$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}";
|
|
$DATABASE->Query( $QS );
|
|
verbose( 1, "ALL IS OK" );
|
|
} else verbose( 0, "WRONG MAPID" );
|
|
} else verbose( 0, "WRONG MAPID" );
|
|
} else {
|
|
verbose( 0, 'Access Denied!' );
|
|
};
|
|
?>
|