Esempio n. 1
0
    $token = SEC_createToken();
    switch ($fieldname) {
        case "edit":
            $retval = COM_createLink($icon_arr['edit'], "{$_CONF['site_admin_url']}/plugins/maps/overlay_group_edit.php?mode=edit&o_group_id={$A['o_group_id']}");
            break;
        default:
            $retval = $fieldvalue;
            break;
    }
    return $retval;
}
// MAIN
$display .= COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']);
$display .= maps_admin_menu();
if (!empty($_REQUEST['msg'])) {
    $display .= MAPS_message($_REQUEST['msg']);
}
if (!file_exists($_MAPS_CONF['path_overlay_images']) || !is_writable($_MAPS_CONF['path_overlay_images'])) {
    $display .= COM_showMessageText('>> ' . $_MAPS_CONF['path_overlay_images'] . '<p>' . $LANG_MAPS_1['overlay_not_writable'] . '</p>');
} else {
    $display .= '<br /><h1>' . $LANG_MAPS_1['overlays_list'] . '</h1>';
    $display .= '<p><ul><li><a href="' . $_CONF['site_url'] . '/admin/plugins/maps/overlay_edit.php">' . $LANG_MAPS_1['create_overlay'] . '</a><li><a href="' . $_CONF['site_url'] . '/admin/plugins/maps/overlays.php?mode=groups">' . $LANG_MAPS_1['manage_groups'] . '</a><li><a href="' . $_CONF['site_url'] . '/admin/plugins/maps/overlay_group_edit.php?mode=new">' . $LANG_MAPS_1['create_group'] . '</a></ul></p>';
    MAPS_reorderOverlays();
    switch ($_REQUEST['mode']) {
        case 'groups':
            $display .= MAPS_listOverlaysGroups();
            break;
        case 'move':
            $oid = COM_applyFilter($_GET['oid']);
            $where = COM_applyFilter($_GET['where']);
            if (DB_count($_TABLES['maps_overlays'], "oid", $oid) == 1) {
Esempio n. 2
0
function MAPS_exportCSV($map, $separator = ";", $fields = array())
{
    global $_CONF, $_MAPS_CONF, $_TABLES, $LANG_MAPS_1;
    $count = count($fields);
    $i = 1;
    $selected_fields = '';
    $valid_fieds = MAPS_getFieldsImportExport();
    foreach ($fields as $value) {
        if (in_array($value, $valid_fieds)) {
            $selected_fields .= $value;
            if ($i < $count) {
                $selected_fields .= ', ';
            }
        }
        $i++;
    }
    //if ( $selected_fields == '' ) return;
    $result = DB_query("SELECT \n\t\t\t\t\t\t\t{$selected_fields}  \n\t\t\t\t\t\t\tFROM {$_TABLES['maps_markers']} WHERE mid={$map}");
    //Check if there is at least 1 marker
    $rows = DB_numRows($result);
    if ($rows < 1 || $selected_fields == '') {
        $display .= COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']);
        $display .= MAPS_admin_menu();
        $display .= MAPS_message($LANG_MAPS_1['no_marker_to_export']);
        $display .= COM_siteFooter(0);
        COM_output($display);
        exit;
    }
    $search = array(',', '\'', ' ', '.', '!', ':');
    $sitename = str_replace($search, "_", $_CONF['site_name']);
    // send response headers to the browser
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment;filename=map_' . $map . '_' . $sitename . '.csv');
    $fp1 = fopen('php://output', 'w');
    while ($row = DB_fetchArray($result, false)) {
        if ($separator == ',') {
            fputcsv($fp1, $row, ",", '"');
        } else {
            if ($separator == 'tab') {
                fputcsv($fp1, $row, "\t", '"');
            } else {
                fputcsv($fp1, $row, ";", '"');
            }
        }
    }
    fclose($fp1);
    //header("Refresh: 0;url={$_CONF['site_admin_url']}/plugins/maps/import_export.php");
}
Esempio n. 3
0
        return;
    }
    $pi = $_MAPS_CONF['path_icons_images'] . $image;
    if (!@unlink($pi)) {
        // log the problem but don't abort the script
        echo COM_errorLog('Unable to remove the following icon image from maps plugin: ' . $image);
    }
}
// MAIN
$display .= COM_siteHeader('menu', $LANG_MAPS_1['plugin_name']);
$display .= maps_admin_menu();
if (!empty($_REQUEST['msg'])) {
    $display .= MAPS_message($_REQUEST['msg']);
}
if (!file_exists($_MAPS_CONF['path_icons_images']) || !is_writable($_MAPS_CONF['path_icons_images'])) {
    $display .= MAPS_message('>> ' . $_MAPS_CONF['path_icons_images'] . '<p>' . $LANG_MAPS_1['icons_not_writable'] . '</p>');
} else {
    $id = $_REQUEST['id'];
    switch ($_REQUEST['mode']) {
        case 'delete':
            //Remove icon associations
            $q = "UPDATE " . $_TABLES['maps_markers'] . " SET mk_icon = 0, mk_default = 1 WHERE mk_icon = '" . $id . "'";
            DB_query($q);
            //Delete icon
            DB_delete($_TABLES['maps_map_icons'], 'icon_id', $id);
            if (DB_affectedRows('') == 1) {
                $msg = $LANG_MAPS_1['deletion_succes'];
            } else {
                $msg = $LANG_MAPS_1['deletion_fail'];
            }
            // delete complete, return to icon list