示例#1
0
            die;
        }
    }
}
//Preview mode is handled by javascript on the client side.
//There is no callback to the server for previewing changes.
//most of the time we want xml back so we make it the default
$format = 'xml';
$XMLContent = "";
$statusCode = 401;
if (!empty($_REQUEST["save_polyline"])) {
    $gBitUser->verifyTicket();
    $storeHash = $_REQUEST;
    // the user might be submitting encoded html chars by ajax - decode them before storing
    if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
        @BitGmap::decodeAjaxRequest($storeHash);
    }
    if ($gContent->store($storeHash)) {
        $statusCode = 200;
        if ($gContent->hasAdminPermission()) {
            $gContent->setUpdateSharing($_REQUEST);
        }
        $gBitSmarty->assign_by_ref('polylineInfo', $gContent->mInfo);
    }
} elseif (!empty($_REQUEST['move_pos']) && !empty($_REQUEST['set_id'])) {
    $gBitUser->verifyTicket();
    // this is a little ugly
    $gContent->mInfo['set_id'] = $_REQUEST['set_id'];
    if ($_REQUEST['move_pos'] == 'up' ? $gContent->moveUp() : $gContent->moveDown()) {
        $statusCode = 200;
        $XMLContent = tra("Success");
示例#2
0
 * @package gmap
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('gmap');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_gmap_update');
// 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();
//Preview mode is handled by javascript on the client side.
//There is no callback to the server for previewing changes.
$format = 'xml';
$XMLContent = "";
$statusCode = 401;
if (!empty($_REQUEST["save_tilelayer"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storeTilelayer($_REQUEST)) {
        $statusCode = 200;
        $gBitSmarty->assign_by_ref('tilelayerInfo', $result);
    }
    //Check if this to remove from a set, or to delete completely
} elseif (!empty($_REQUEST["remove_tilelayer"])) {
    $gBitUser->verifyTicket();
    if ($gContent->removeTilelayerFromMaptype($_REQUEST)) {
示例#3
0
    if ($gContent->hasAdminPermission()) {
        $gBitUser->verifyTicket();
        if ($gContent->expunge()) {
            $statusCode = 200;
            $gBitSmarty->assign('expungeSucces', true);
        } else {
            $XMLContent = tra("Sorry, there was an unknown error trying to delete the polygonset.");
        }
    } else {
        $XMLContent = tra("You do not have the required permission to delete this polygonset.");
    }
} else {
    $gContent->invokeServices('content_edit_function');
    $polygonset = $gContent->mInfo;
    require_once GMAP_PKG_PATH . 'BitGmap.php';
    $gmap = new BitGmap();
    $listHash = array();
    $polylineStyles = $gmap->getPolylineStyles($listHash);
    $polygonStyles = $gmap->getPolygonStyles($listHash);
    // match the style to get the name - some day we should get this in the load query
    if ($gContent->isValid()) {
        foreach ($polylineStyles as $style) {
            if ($style['style_id'] == $polygonset['polylinestyle_id']) {
                $polygonset['polylinestyle_name'] = $style['name'];
                break;
            }
        }
        foreach ($polygonStyles as $style) {
            if ($style['style_id'] == $polygonset['style_id']) {
                $polygonset['style_name'] = $style['name'];
                break;
示例#4
0
            $formHash['delete'] = TRUE;
            $formHash['submit_mult'] = 'remove_gmaps';
            foreach ($_REQUEST["checked"] as $del) {
                $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>';
            }
            $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete these gmaps?') . ' (' . tra('Count: ') . count($_REQUEST["checked"]) . ')', 'error' => tra('This cannot be undone!')));
        } else {
            foreach ($_REQUEST["checked"] as $deleteId) {
                $tmpPage = new BitGmap($deleteId);
                if (!$tmpPage->load() || !$tmpPage->expunge()) {
                    array_merge($errors, array_values($tmpPage->mErrors));
                }
            }
            if (!empty($errors)) {
                $gBitSmarty->assign_by_ref('errors', $errors);
            }
        }
    }
    $gmap = new BitGmap();
    $listgmaps = $gmap->getList($_REQUEST);
    $gBitSmarty->assign_by_ref('control', $_REQUEST["control"]);
    $gBitSmarty->assign_by_ref('list', $listgmaps["data"]);
    // add pagination info
    $_REQUEST['listInfo']['ihash']['content_type_guid'] = BITGMAP_CONTENT_TYPE_GUID;
    // getList() has now placed all the pagination information in $_REQUEST['listInfo']
    $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
    // Display the template
    $gBitSystem->display('bitpackage:gmap/list_gmaps.tpl', tra('Map'), array('display_mode' => 'list'));
} else {
    $gBitSystem->display('bitpackage:gmap/error_nokey.tpl', tra('Map'), array('display_mode' => 'list'));
}
示例#5
0
 * @author Will <*****@*****.**>
 * 
 * @package gmap
 * @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)) {
示例#6
0
 * @author Will <*****@*****.**>
 * 
 * @package gmap
 * @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['icon_id']) && is_numeric($_REQUEST['icon_id'])) {
    $style = $gContent->getIconStyle($_REQUEST['icon_id']);
    if ($style != NULL && ($style['user_id'] == $gBitUser->mUserId || $gBitUser->hasPermission('p_gmap_admin')) != TRUE) {
        $gBitSystem->fatalError(tra("You can not edit this icon!"));
    }
}
//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_iconstyle"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storeIconStyle($_REQUEST)) {
示例#7
0
 * @author Will <*****@*****.**>
 * 
 * @package gmap
 * @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['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)) {
示例#8
0
        if ($gContent->expunge()) {
            $statusCode = 200;
            $gBitSmarty->assign('expungeSucces', true);
        } else {
            $XMLContent = tra("Sorry, there was an unknown error trying to delete the markerset.");
        }
    } else {
        $XMLContent = tra("You do not have the required permission to delete this markerset.");
    }
} else {
    $gContent->invokeServices('content_edit_function');
    $markerset = $gContent->mInfo;
    $icon = $gContent->getIcon($gContent->getField('icon_id'));
    $gBitSmarty->assign_by_ref('icon', $icon);
    require_once GMAP_PKG_PATH . 'BitGmap.php';
    $gmap = new BitGmap();
    // $iconStyles = $gmap->getIconStyles();
    $markerStyles = $gmap->getMarkerStyles();
    // $gBitSmarty->assign( 'iconStyles', $iconStyles );
    $gBitSmarty->assign('markerStyles', $markerStyles);
    $gBitSmarty->assign('updateShared', $gContent->isUpdateShared());
    $gBitSmarty->assign('childrenAllowed', $gContent->childrenAllowed());
    $gBitSmarty->assign_by_ref('markersetInfo', $markerset);
    $gBitSystem->display('bitpackage:gmap/edit_markerset.tpl', NULL, array('format' => 'center_only', 'display_mode' => 'edit'));
    die;
}
if (count($gContent->mErrors) > 0) {
    $XMLContent = "There were errors with your request:";
    foreach ($gContent->mErrors as $key => $error) {
        $XMLContent .= "\n" . $error . "\n";
    }
示例#9
0
 * @package gmap
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('gmap');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_gmap_update');
// 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();
//Preview mode is handled by javascript on the client side.
//There is no callback to the server for previewing changes.
$format = 'xml';
$XMLContent = "";
$statusCode = 401;
if (!empty($_REQUEST["save_copyright"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storeCopyright($_REQUEST)) {
        $statusCode = 200;
        $gBitSmarty->assign_by_ref('copyrightInfo', $result);
    }
    //Check if this to remove from a set, or to delete completely
} elseif (!empty($_REQUEST["remove_copyright"])) {
    $gBitUser->verifyTicket();
    if ($gContent->removeCopyrightFromTilelayer($_REQUEST)) {
<?php

/* geoserver is so suck fantastic that 
 * we need to manually exclude some tilelayers we dont want stored these are them
 */
$excludeTilelayers = array('ca_zip_5_Type', 'liberty_feature_type_Type');
// lets get started
require_once '../../kernel/setup_inc.php';
require_once '../geoserver_lib.php';
require_once GMAP_PKG_PATH . 'BitGmap.php';
$gContent = new BitGmap();
// user must be gmap admin
$gContent->verifyAdminPermission();
// url to graphserver
$tileLayersUrl = BIT_BASE_URI . GEOSERVER_PKG_URL . 'rest/csv/tileLayers';
// get tileLayers XML that has everything we need
$tileLayersXML = geoserverGetXML($tileLayersUrl);
// for each layer get title, google url, and style url
$layers = $tileLayersXML->getElementsByTagName('Layer');
foreach ($layers as $layer) {
    $title = $layer->getElementsByTagName('Title')->item(0)->nodeValue;
    // make sure we should be storing this one
    if (!in_array($title, $excludeTilelayers)) {
        $styleUrl = BIT_BASE_URI . $layer->getElementsByTagName('StyleUrl')->item(0)->nodeValue;
        $tileUrl = $layer->getElementsByTagName('GoolgeUrl')->item(0)->nodeValue;
        // regex off the xyz
        $tileUrl = preg_replace('/&zoom={Z}&x={X}&y={Y}/', '', $tileUrl);
        // get the styles from which we will make a style key for the tilelayer
        $keyRows = array();
        $styleXML = geoserverGetXML($styleUrl);
        $rules = $styleXML->getElementsByTagName('Rule');
示例#11
0
 * @author Will <*****@*****.**>
 * 
 * @package gmap
 * @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['style_id']) && is_numeric($_REQUEST['style_id'])) {
    $style = $gContent->getPolylineStyle($_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_polylinestyle"])) {
    $gBitUser->verifyTicket();
    if ($result = $gContent->storePolylineStyle($_REQUEST)) {
示例#12
0
 */
global $gContent;
require_once GMAP_PKG_PATH . 'BitGmap.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
// this is needed when the center module is applied to avoid abusing $_REQUEST
if (empty($lookupHash)) {
    $lookupHash =& $_REQUEST;
}
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) {
    // if someone gives us a map_name we try to find it
    if (!empty($lookupHash['map_name'])) {
        global $gBitDb;
        $lookupHash['gmap_id'] = $gBitDb->getOne("SELECT gmap_id FROM `" . BIT_DB_PREFIX . "gmaps` g LEFT JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (g.`content_id` = lc.`content_id`) WHERE lc.`title` = ?", array($lookupHash['map_name']));
        if (empty($lookupHash['gmap_id'])) {
            $gBitSystem->fatalError(tra('No map found with the name: ') . $lookupHash['map_name']);
        }
    }
    if (!empty($lookupHash['gmap_id']) && is_numeric($lookupHash['gmap_id'])) {
        // if gmap_id supplied, use that
        $gContent = new BitGmap($lookupHash['gmap_id']);
    } elseif (!empty($lookupHash['content_id']) && is_numeric($lookupHash['content_id'])) {
        // if content_id supplied, use that
        $gContent = new BitGmap(NULL, $lookupHash['content_id']);
    } else {
        // otherwise create new object
        $gContent = new BitGmap();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}
示例#13
0
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 * @author Will <*****@*****.**>
 * 
 * @package gmap
 * @subpackage functions
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
// Is package installed and enabled
$gBitSystem->verifyPackage('gmap');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_gmap_view');
$gContent = new BitGmap();
//if a icon_id is passed try to look it up
if (@BitBase::verifyId($_REQUEST['icon_id'])) {
    if ($result = $gContent->getIconStyle($_REQUEST['icon_id'])) {
        $gBitSmarty->assign_by_ref('iconstyleInfo', $result);
        $statusCode = 200;
        $gBitSmarty->assign('statusCode', $statusCode);
    }
    $gBitSystem->display('bitpackage:gmap/edit_iconstyle_xml.tpl', null, array('format' => 'xml', 'display_mode' => 'display'));
} else {
    // this is how you store and update all icons found in the icons path
    $_REQUEST['max_records'] = $gBitSystem->getConfig('max_records') * 5;
    $icons = $gContent->getIconList($_REQUEST);
    if (empty($icons) || !empty($_REQUEST['update_icon_list'])) {
        $gContent->importIcons(GMAP_PKG_PATH . "icons");
        $icons = $gContent->getIconList($_REQUEST);