示例#1
0
$gContent = new BitGmap();
//if a maptype_id is passed try to look it up and see if the user is the owner or has admin perms
if (isset($_REQUEST['maptype_id']) && is_numeric($_REQUEST['maptype_id'])) {
    $maptype = $gContent->getMapType($_REQUEST['maptype_id']);
    if ($maptype != NULL && ($maptype['user_id'] == $gBitUser->mUserId || $gBitUser->hasPermission('p_gmap_admin')) != TRUE) {
        $gBitSystem->fatalError(tra("You can not edit this maptype!"));
    }
}
//check the user has permission to edit maptypes in general
$gBitSystem->verifyPermission('p_gmap_update');
//Preview mode is handled by javascript on the client side.
//There is no callback to the server for previewing changes.
$format = 'xml';
if (!empty($_REQUEST["save_maptype"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storeMapType($_REQUEST)) {
        $gBitSmarty->assign_by_ref('maptypeInfo', $result);
    }
    //Check if this to remove from a set, or to delete completely
} elseif (!empty($_REQUEST["remove_maptype"])) {
    $gBitUser->verifyTicket();
    if ($gContent->removeMapTypeFromMap($_REQUEST)) {
        $gBitSmarty->assign('removeSucces', true);
    }
} elseif (!empty($_REQUEST["expunge_maptype"])) {
    $gBitUser->verifyTicket();
    if ($gContent->expungeMapType($_REQUEST)) {
        $gBitSmarty->assign('expungeSucces', true);
    }
} else {
    if (isset($_REQUEST["maptype_id"])) {