예제 #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['style_id']) && is_numeric($_REQUEST['style_id'])) {
    $style = $gContent->getMarkerStyle($_REQUEST['style_id']);
    if ($style != NULL && ($style['user_id'] == $gBitUser->mUserId || $gBitUser->hasPermission('p_gmap_admin')) != TRUE) {
        $gBitSystem->fatalError(tra("You can not edit this style!"));
    }
}
//check the user has permission to edit maptypes in general
$gBitSystem->verifyPermission('p_gmap_overlay_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_markerstyle"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storeMarkerStyle($_REQUEST)) {
        $gBitSmarty->assign_by_ref('markerstyleInfo', $result);
    }
} else {
    if (isset($_REQUEST["style_id"])) {
        $markerstyle = $gContent->getMarkerStyle($_REQUEST["style_id"]);
    }
    $gBitSmarty->assign_by_ref('markerstyleInfo', $markerstyle);
    $gBitSystem->display('bitpackage:gmap/edit_markerstyle.tpl', NULL, array('format' => 'center_only', 'display_mode' => 'edit'));
    die;
}
if (count($gContent->mErrors) > 0) {
    $gBitThemes->setFormatHeader('center_only');
    $gBitSmarty->assign_by_ref('errors', $gContent->mErrors);
} else {
    $gBitSystem->display('bitpackage:gmap/edit_markerstyle_xml.tpl', null, array('format' => $format, 'display_mode' => 'edit'));