} // look at lines that are rrd files if (preg_match('/.*[.]rrd$/', $line)) { // find out the directory it's in $dir = preg_replace('|(.*/).*|', '\\1', $line); // if it's already had a map file created, skip it if (count($exclude) > 0) { if (preg_grep("|^{$dir}\$|", $exclude)) { continue; } } // thank you Michael for Lady&Tramp! $eline = escapeshellarg($line); // ask the file for its dses $out = exec("{$rrdtool} info {$eline}", $outa, $rval); if ($rval == 0) { // get the dses from the output $dslines = preg_grep('/ds[[].*[.]type/', $outa); // a different var so that rrd files with yabba+others won't get ignored $ndslines = preg_grep('/[[]yabba\\]/', $dslines, PREG_GREP_INVERT); if (count($ndslines) > 0) { // add the dir to the excludes $exclude[] = $dir; // go create a map in that dir $nothing = createMap($dir); } } else { print "Failed {$line}\n"; } } }
<?php require_once dirname(__FILE__) . "/../include/master.inc.php"; if (!isLogin()) { redirect("login.php"); } $user = getUserInfo(); $map_id = createMap($user['id'], 550, 1000, 6, 'false', 'true', 'false', '', '[0,0]', '', '{}'); if ($map_id) { updateMap($map_id, $user['id'], 'source', 'website'); redirect("map-edit.php?action=create&id=" . $map_id); } else { redirect("map.php"); }
$legend_content = $get['legend_content']; // default Empty String '' /* Marker Properties */ $latlng = getLatLng($get['address']); if ($latlng) { $address = $get['address']; $latitude = $latlng['lat']; $longitude = $latlng['lng']; $description = isset($get['description']) ? $get['description'] : ''; $marker_color = strtolower($get['marker_color']); $marker_style = strtolower($get['marker_style']); $get_direction = strtolower($get['get_direction']) == 'yes' ? 'true' : 'false'; $bootstrap_popup = strtolower($get['use_infobox']) == 'yes' ? 'true' : 'false'; $showlocation = strtolower($get['showlocation']) == 'yes' ? 'true' : 'false'; $hide_label = strtolower($get['hide_label']) == 'no' ? 'false' : 'true'; $mapId = createMap($user['id'], $height, $width, $zoom, $defaultopen, $showsidebar, 'true', $name, '[' . $latlng['lat'] . ',' . $latlng['lng'] . ']', $password, '[]'); if ($mapId) { updateMap($mapId, $user['id'], 'cluster', $cluster); updateMap($mapId, $user['id'], 'show_overlay', $show_overlay); updateMap($mapId, $user['id'], 'overlay_title', $overlay_title); updateMap($mapId, $user['id'], 'overlay_blurb', $overlay_blurb); updateMap($mapId, $user['id'], 'overlay_content', $overlay_content); updateMap($mapId, $user['id'], 'show_legend', $show_legend); updateMap($mapId, $user['id'], 'legend_content', $legend_content); updateMap($mapId, $user['id'], 'show_export', $show_export); updateMap($mapId, $user['id'], 'show_measure', $show_measure); updateMap($mapId, $user['id'], 'show_minimap', $show_minimap); updateMap($mapId, $user['id'], 'show_filelayer', $show_filelayer); updateMap($mapId, $user['id'], 'show_static_sidebar', $show_static_sidebar); updateMap($mapId, $user['id'], 'static_sidebar_content', $static_sidebar_content); $properties = array();
if (in_array(strtolower($validHead[$i]), $requiredColumns) && $body[$key][$index]) { $requiredFound++; } if ($body[$key][$index]) { $row[$validHead[$i]] = $body[$key][$index]; } } if ($requiredFound == count($requiredColumns)) { $validRows[] = $row; } } if (json_decode($_POST['filteredColumns']) == "") { $_POST['filteredColumns'] = "[]"; } /* All iz Well, Now create map and shapes/markers */ $mapId = createMap($userId, 550, 1000, 6, 'false', 'true', 'true', '', '[0,0]', '', $_POST['filteredColumns']); if (!$mapId) { $error = "Map is not created!"; } else { updateMap($mapId, $userId, 'source', 'website'); $properties = array(); $type = array(); $coordinates = array(); $styles = array(); $customproperties = array(); foreach ($validRows as $row) { $shape = prepareShapeData($row); $type[] = $shape['type']; $coordinates[] = $shape['coordinates']; $properties[] = $shape['properties']; $styles[] = $shape['styles'];
$error = true; $_RESPONSE['success'] = false; $_RESPONSE['message'] = "Project with given Id not found!"; } } } if (!$error) { $name = $map['name']; $height = (int) $map['height'] == 0 ? 500 : (int) $map['height']; $width = (int) $map['width'] == 0 ? 500 : (int) $map['width']; $zoom = (int) $map['zoom'] == 0 ? 8 : (int) $map['zoom']; $center = "[" . $map['centerLatitude'] . "," . $map['centerLongitude'] . "]"; $showsidebar = $map['showSidebar'] ? 'true' : 'false'; $defaultopen = $map['defaultOpen'] ? 'true' : 'false'; $password = $map['password']; $mapId = createMap($user['id'], $height, $width, $zoom, $defaultopen, $showsidebar, 'true', $name, $center, $password, '[]'); if (!$mapId) { $error = true; } } if (!$error) { $useCluster = $map['useCluster'] ? 'true' : 'false'; $overlayEnable = $map['overlayEnable'] ? 'true' : 'false'; $overlayTitle = $map['overlayTitle']; $overlayBlurb = $map['overlayBlurb']; $overlayContent = $map['overlayContent']; $legendEnable = $map['legendEnable'] ? 'true' : 'false'; $legendContent = $map['legendContent']; updateMap($mapId, $user['id'], 'cluster', $useCluster); updateMap($mapId, $user['id'], 'overlay_enable', $overlayEnable); updateMap($mapId, $user['id'], 'overlay_title', $overlayTitle);
<html> <head> <style> body { font-family: "Courier New"; } </style> </head> <body> <?php $startX = 1; $startY = 1; $currentX = $startX; $currentY = $startY; $endX = 9; $endY = 9; $map = createMap(10, 10); $dirDice = array("Forward", "Backward", "Left", "Right"); travel($endX, $endY, 100); displayMap($map); function move($move) { global $map, $currentX, $currentY, $dirDice; $invalidMove = true; $tmpDice = array_merge(array(), $dirDice); while ($invalidMove) { $tmpX = $currentX; $tmpY = $currentY; if (!empty($tmpDice)) { $index = array_rand($tmpDice, 1); $direction = $tmpDice[$index]; if ($direction == "Forward") { $tmpX--;