Esempio n. 1
0
        @unlink($f);
    }
    error_out("已經達到數量限制" . $user['limit']);
}
$type = determine_type($shiftx, $shifty);
$outx = ceil($shiftx / $tiles[$type]['x']);
$outy = ceil($shifty / $tiles[$type]['y']);
if (file_exists(str_replace(".tag.png", ".gpx", $outimage))) {
    $save_gpx = 1;
}
$mid = map_add($_SESSION['uid'], $title, $xx, $yy, $shiftx, $shifty, $outx, $outy, $_SERVER['REMOTE_ADDR'], $outimage, map_size($outimage), $version, $save_gpx);
// 最後搬移到正確目錄
map_migrate($out_root, $_SESSION['uid'], $mid);
// 如果有 gpx 就 import 到 gis 的 database 中
//if ($svg_params != "") {
//	import_gpx($mid);
//}
$okmsg = msglog("done");
// even here is exit(0)
// the ape client will still redirect user to the correct place?
sleep(1);
ok_out(implode("", $okmsg), $mid);
// function
//
function msglog($str)
{
    static $msg = array();
    $msg[] = sprintf("%s|%s", date('Y/m/d H:i:s'), $str);
    error_log($str);
    return $msg;
}
Esempio n. 2
0
// 2. check _POST
$_inp = $_POST;
if (!isset($_inp['mid'])) {
    error_out(print_r($_POST, true) . " requires mid");
}
// 3. 檢查 user 是否能刪除此檔
$map = map_get_single($_inp['mid']);
if ($map == null) {
    error_out("no such map" . $_inp['mid']);
}
if ($map['uid'] != $_SESSION['uid']) {
    error_out("you are not the owner");
}
// 3.1 正在搬移資料結構, 或重新整理
$block_msg = map_blocked($out_root, $_SESSION['uid']);
if ($block_msg != null) {
    error_out($block_msg);
}
// 4. 真的刪除/回收
if ($_inp['op'] && $_inp['op'] == 'recycle') {
    $ok = map_expire($_inp['mid']);
} else {
    $ok = map_del($_inp['mid']);
}
if ($ok === FALSE) {
    error_out("delete/expire fail");
}
sleep(1);
$mid = $_inp['mid'];
ok_out("{$mid} deleted", $mid);