예제 #1
0
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('gmap');
// Access the gmap class
global $gContent;
require_once GMAP_PKG_PATH . 'BitGmap.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
$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