‘setQuery(“SELECT * FROM #__$option”.”_conf WHERE id = 1″); $conf = $database->loadObjectList(); $conf = $conf[0]; if ($database->getErrorNum()) { exit($database->stderr()); } // switch based on a task switch($task) { case \’feed\’: case \’version\’: openUrl($option, $task, $conf); exit; } // load countries $countries = array(); if (file_exists($mosConfig_absolute_path .\’/administrator/components/\’. $option .\’/language/iso_3166_1.php\’)) { $count = count(get_defined_constants()); include_once($mosConfig_absolute_path .\’/administrator/components/\’. $option .\’/language/iso_3166_1.php\’); $constants = get_defined_constants(); end($constants); for ($i=$count, $n=count(get_defined_constants()); $i < $n; $i++) { array_unshift($countries, current($constants)); array_unshift($countries, substr(key($constants), -2)); prev ($constants); } array_unshift($countries, \' \', \' \'); } // load html colors $colors = array(); if (file_exists($mosConfig_absolute_path .\'/administrator/components/\'. $option .\'/html_colors.php\')) { $count = count(get_defined_constants()); include_once($mosConfig_absolute_path .\'/administrator/components/\'. $option .\'/html_colors.php\'); $constants = get_defined_constants(); end($constants); for ($i=$count, $n=count(get_defined_constants()); $i < $n; $i++) { array_unshift($colors, current($constants)); array_unshift($colors, substr(key($constants), -6)); prev ($constants); } } // check the language settings $language = \'\'; $contents = \'\'; if (file_exists($mosConfig_absolute_path .\'/administrator/components/\'. $option .\'/language/iso_639_1.php\')) { include_once($mosConfig_absolute_path .\'/administrator/components/\'. $option .\'/language/iso_639_1.php\'); if (isset($_SERVER[\'HTTP_ACCEPT_LANGUAGE\']) && $conf->autoLanguageFront == 1) { $constants = get_defined_constants(); $iso_code = \’_ISO_639_1_\’. strtoupper(substr($_SERVER[\’HTTP_ACCEPT_LANGUAGE\’], 0, 2)); @$language = strtolower($constants[$iso_code]); } } // load the language file if ($language == \’\’) $language = $mosConfig_lang; if (file_exists($mosConfig_absolute_path .\’/administrator/components/\’. $option .\’/language/\’. $language .\’.php\’)) { $contents = file_get_contents($mosConfig_absolute_path .\’/administrator/components/\’. $option .\’/language/\’. $language .\’.php\’); } else { $contents = file_get_contents($mosConfig_absolute_path .\’/administrator/components/\’. $option .\’/language/english.php\’); $language = \’english\’; } // language files charset is utf-8, if page is iso-8859-1 decode it first eval(str_replace(array(\’\’), \’\’, decode($contents))); // load the html drawing class require_once($mainframe->getPath(\’front_html\’)); require_once($mainframe->getPath(\’class\’)); // load variables $id = intval(mosGetParam($_REQUEST ,\’id\’, 0)); $redirect = mosGetParam($_REQUEST, \’redirect\’, \’\’); $category = mosGetParam($_REQUEST, \’category\’, null); $marker = mosGetParam($_REQUEST, \’marker\’, null); $download = mosGetParam($_REQUEST ,\’download\’, \’\’) == \’true\’ ? true : false; $xmlDate = mosGetParam($_REQUEST ,\’xmlDate\’, \’\’) == \’true\’ ? true : false; $xmlName = mosGetParam($_REQUEST ,\’xmlName\’, \’\’) == \’true\’ ? true : false; $xmlOrder = mosGetParam($_REQUEST ,\’xmlOrder\’, \’name ASC\’); $zip = mosGetParam($_REQUEST ,\’zip\’, \’\’) == \’true\’ ? true : false; // switch based on a task switch($task) { case \’new\’: editPlace(0, $option, $countries, $colors, $conf); break; case \’edit\’: editPlace($id, $option, $countries, $colors, $conf); break; case \’save\’: savePlace($option, $conf); break; case \’cancel\’: cancelPlace($option, $redirect); break; case \’remove\’: removePlace($id, $option); break; case \’xml\’: pureXML($option); break; case \’xml2\’: dynamicXML($category, $download, $marker, $option, $xmlDate, $xmlName, $xmlOrder, $zip); break; case \’kml\’: dynamicKML($option); break; case \’view\’: showWrap($option, $conf); break; default: showWrap($option, $conf); break; } // cancels editing and checks in the record function cancelPlace($option, $redirect) { global $database, $mosConfig_live_site; $row = new mosPlace($database); $row->bind($_POST); $row->checkin(); if ($redirect != \’\’) mosRedirect(“$redirect”); else mosRedirect(“$mosConfig_live_site/index.php”); } // edit a record function editPlace($id, $option, $countries, $colors, $conf) { global $database, $Itemid, $my, $mosConfig_live_site; // frontend demo mode if ($conf->frontInputDemo > 0 && $my->gid < 1) { $my->gid = $conf->frontInputDemo; } // check access level if ($id) { if ($my->gid < 2) { mosNotAuth(); return; } } else { if ($my->gid < 1) { mosNotAuth(); return; } } // load the database $row = new mosPlace($database); $row->load($id); // fail if checked out not by “me” if ($row->checked_out && $row->checked_out <> $my->id) { mosRedirect(“$mosConfig_live_site/index.php?option=$option&task=new”, _GMAP_MARKER_LOCKED_1 . $row->name . _GMAP_MARKER_LOCKED_2); } if ($id) { $row->checkout($my->id); } else { $row->ordering = 0; $row->published = 1; $row->sidebar = 1; } // check submit limit if ($my->gid < 2) { $userid = $my->id; $limit = $conf->userLimit; $time = $conf->userTime; $date = date(\’Y-m-d H:i:s\’); $query = “SELECT COUNT(*) AS count FROM #__$option” . “\\n WHERE UNIX_TIMESTAMP(created) > UNIX_TIMESTAMP(\’$date\’) – $time * 60” . “\\n AND userid = $userid” ; $database->setQuery($query); $submitted = $database->loadObjectList(); $submitted = $submitted[0]; if ($database->getErrorNum()) { exit($database->stderr()); } // fail if submit limit is exceeded if ($submitted->count >= $limit) { $msg = _GMAP_LIMIT_1; $msg .= $limit; $msg .= $limit == 1 ? _GMAP_LIMIT_2 : _GMAP_LIMIT_3; $msg .= $time; $msg .= $time == 1 ? _GMAP_LIMIT_4 : _GMAP_LIMIT_5; $msg .= _GMAP_LIMIT_6; mosRedirect(“$mosConfig_live_site/index.php?option=$option”, $msg); } } if ($conf->frontOrdering > 0) { // build the html select list for ordering $query = “SELECT ordering AS value, name AS text” . “\\n FROM #__$option” . “\\n WHERE published >= 0” . “\\n AND catid = \’$row->catid\'” . “\\n ORDER BY ordering” ; $lists[\’ordering\’] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1); } if ($conf->frontAuthor > 0) { // build list of users $query = “SELECT id, name, usertype” . “\\n FROM #__users” . “\\n WHERE block = 0” . “\\n AND gid > 18 OR id = \’$row->userid\'” . “\\n ORDER BY name” ; $database->setQuery($query); $users = $database->loadObjectList(); if ($database->getErrorNum()) { exit($database->stderr()); } for ($i=0, $n=count($users); $i < $n; $i++) $users[$i]->name = (strlen($users[$i]->name) > 20) ? substr($users[$i]->name, 0, 20).\’… (\’. $users[$i]->usertype .\’)\’ : $users[$i]->name .\’ (\’. $users[$i]->usertype .\’)\’; $active = $row->userid ? $row->userid : $my->id; $lists[\’author\’] = mosHTML::selectList($users, \’userid\’, \’class=”selectlist” size=”1″ \’, \’id\’, \’name\’, $active); } // build list of categories if ($my->gid > 1) $list = \’id > 0\’; elseif ($conf->regUserCats == \’\’) $list = \’id < 0\’; else $list = \’id = \’. str_replace(\’ \’,\’ OR id = \’, $conf->regUserCats); $query = “SELECT id AS value, title AS text” . “\\n FROM #__categories” . “\\n WHERE section = \’$option\'” . “\\n AND published = 1 AND ($list)” . “\\n ORDER BY ordering” ; $database->setQuery($query); $data = $database->loadObjectList(); if ($database->getErrorNum()) { exit($database->stderr()); } // fail if there is not at least one category to submit in if (count($data) == 0) mosRedirect(“$mosConfig_live_site/index.php?option=$option&Itemid=$Itemid”, _GMAP_MAP_ERROR); // make category list if (defined(\’_JEXEC\’)) $sel_category = \’- \’. JText::_(\’Select Category\’) .\’ -\’; else $sel_category = _SEL_CATEGORY; // joomla! 1.5 switch $categories[] = mosHTML::makeOption(\’0\’, $sel_category); if (is_array($data)) $categories = array_merge($categories, $data); $lists[\’catid\’] = mosHTML::selectList($categories, \’catid\’, \’class=”selectlist”\’, \’value\’, \’text\’, $row->catid); HTML_google_maps::editPlaceHtml($colors, $conf, $countries, $lists, $option, $row); } // saves the record on an edit form submit function savePlace($option, $conf) { global $database, $Itemid, $mosConfig_live_site, $my; if ($my->gid < 1) { mosNotAuth(); return; } // get the params $row = new mosPlace($database); if (!$row->bind(mosStripslashes($_POST), \’published\’)) { exit($database->getErrorMsg()); } // fail if category id is not allowed for user submissions if ($my->gid < 2 && !in_array($row->catid, explode(\’ \’, $conf->regUserCats))) mosRedirect(“$mosConfig_live_site/index.php?option=$option&Itemid=$Itemid”, _GMAP_CAT_ERROR); // set author if ($row->userid == \’\’) $row->userid = $my->id; $database->setQuery(“SELECT name FROM #__users WHERE id = \’$row->userid\'”); $author = $database->loadObjectList(); $author = $author[0]; if ($database->getErrorNum()) { exit($database->stderr()); } $row->author = $author->name; // set date if ($row->id == 0) $row->created = date(\’Y-m-d H:i:s\’); $row->modified = date(\’Y-m-d H:i:s\’); // trim text input – no html allowed $html = \’/<|>|&[lg]t;|[02];/i\’; $row->name = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->name))), 0, 48); $row->address = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->address))), 0, 48); $row->city = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->city))), 0, 48); $row->state = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->state))), 0, 24); $row->zipcode = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->zipcode))), 0, 16); $row->country = substr(preg_replace(\’/ +/\’, \’ \’, trim(preg_replace($html, \’ \’, $row->country))), 0, 48); // get geocode if set to yes if ($conf->geocode && $row->lat == \’\’ && $row->lng == \’\’) { if (!$row->check($conf)) { exit($database->getErrorMsg()); } } // set values according to group id and remove script tags if ($my->gid > 1) { // check if html is enabled if ($conf->htmlEnable == 0) $row->misc = preg_replace(\’/ +/\’, \’ \’, trim(preg_replace(array(\’/<.*?>/\’,\’/<|>|&[lg]t;|[02];/i\’), \’ \’, $row->misc))); // publish or unpublish $row->published = mosGetParam($_POST, \’published\’, 0); $msg = _GMAP_THANK_SUB_PUB; } else { // no script allowed in misc for registered users $row->misc = preg_replace(\’/< *script[\\S\\s\\n]*?script *>/\’, \’\’, $row->misc); // enforce misc text length limit $row->misc = substr($row->misc, 0, $conf->limitMiscText); // check if html is enabled if ($conf->htmlEnable != 1) $row->misc = preg_replace(\’/ +/\’, \’ \’, trim(preg_replace(array(\’/<.*?>/\’,\’/<|>|&[lg]t;|[02];/i\’), \’ \’, $row->misc))); // publish only if auto-approve is set to yes $row->published = $conf->autoApprove; if ($row->markertype == 0 || $row->markertype == 1) $row->sidebar = $conf->autoApprove; $msg = $row->published ? _GMAP_THANK_SUB_PUB : _GMAP_THANK_SUB; // notify admin\’s if user submit is not set to auto approve if ($conf->autoApprove == 0) { $query = “SELECT email, name” . “\\n FROM #__users” . “\\n WHERE usertype = \’Super Administrator\'” . “\\n AND sendemail = \’1\'” ; $database->setQuery($query); $admins = $database->loadObjectList(); if ($database->getErrorNum()) { exit($database->stderr()); } $suffix = ucwords(str_replace(array(\’com_google_maps\’, \’_\’), array(\’\’, \’ \’), $option)); $suffix = preg_replace(\’/(.+)/\’, \’ – $1\’, $suffix); $type = _GMAP_ADMIN_MAIL . $suffix; if (defined(\’_JEXEC\’)) { // joomla! 1.5 switch foreach ($admins as $admin) { JUtility::sendAdminMail($admin->name, $admin->email, Null, $type, $row->name, $my->username, $mosConfig_live_site); } } else { foreach ($admins as $admin) { mosSendAdminMail($admin->name, $admin->email, Null, $type, $row->name, $my->username, $mosConfig_live_site); } } } } // trim textarea $row->misc = trim($row->misc); // mark as unpublished if no lat/lng was generated if ($row->lat == \’\’ || $row->lng == \’\’) { $row->lat = -1; $row->lng = -1; $row->published = 0; } // save the changes if (!$row->store()) { exit($database->getErrorMsg()); } $row->checkin(); $row->updateOrder(“catid = ” . (int) $row->catid . ” AND state >= 0″); // update xml file $file = \’components/\’. $option .\’/data.xml.php\’; $xmlBuild = new xmlBuilder($option, $file); if ($xmlBuild->xmlCreate()) { $xmlBuild->xmlWrite(true); } mosRedirect(“$mosConfig_live_site/index.php?option=$option&Itemid=$Itemid”, $msg); } // removes records function removePlace($cid, $option) { global $database, $mosConfig_live_site, $my; if ($my->gid < 2) { mosNotAuth(); return; } $cid = intval($database->getEscaped($cid)); if ($cid > 0) { $database->setQuery(“DELETE FROM #__$option WHERE id = $cid”); $database->query(); if ($database->getErrorNum()) { exit($database->stderr()); } // update xml file $file = \’components/\’. $option .\’/data.xml.php\’; $xmlBuild = new xmlBuilder($option, $file); if ($xmlBuild->xmlCreate()) { $xmlBuild->xmlWrite(true); } } mosRedirect(“$mosConfig_live_site/index.php?option=$option”); } // load a file from a remote server function openUrl($option, $task, $conf, $url=null, $content=null) { global $database; if ($task == \’version\’) { $url = \’http://mapdemo.110mb.com/administrator/components/com_google_maps/version.php\’; } if ($task == \’feed\’) { $url = $conf->xmlFeedUrl; } if (function_exists(\’curl_init\’)) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $content = curl_exec($ch); curl_close($ch); } elseif (ini_get(\’allow_url_fopen\’)) { $timeout = ini_set(\’default_socket_timeout\’, 30); if($fp = @fopen($url, \’r\’)) { $content = \’\’; while (!feof($fp)) $content .= fread($fp, 8192); fclose($fp); } } if ($task == \’version\’ && strlen($content) > 10) { exit(\’-\’); } if ($task == \’feed\’ && substr($content, 0, 5) != \’\’); } exit($content); } // get geocode via url function geocodeAddress($query, $params) { // get geocode from google if ($params->get(\’geocodeProvider\’,\’\’) == \’Google\’) { $result = googleGeocode($query, $params); $lat = $result[\’lat\’]; $lng = $result[\’lng\’]; // if google didn\’t generate a lat/lng ask yahoo if ($lat == \’\’ || $lng == \’\’) { $result = yahooGeocode($query); $lat = $result[\’lat\’]; $lng = $result[\’lng\’]; } } if ($params->get(\’geocodeProvider\’,\’\’) == \’Yahoo\’) { $result = yahooGeocode($query); $lat = $result[\’lat\’]; $lng = $result[\’lng\’]; // if yahoo didn\’t generate a lat/lng ask google if ($lat == \’\’ || $lng == \’\’) { $result = googleGeocode($query, $params); $lat = $result[\’lat\’]; $lng = $result[\’lng\’]; } } if ($lat == \’\’ || $lng == \’\’) return false; return $result; } function googleGeocode($query, $params) { $query = sendGeoQuery(\’http://maps.google.com/maps/geo?output=csv&q=\’. $query .\’&key=\’. $params->get(\’APIKey\’,\’\’)); list($status, $accuracy, $lat, $lng) = explode(\’,\’, $query .\’,,,\’); if ($lat == 0 && $lng == 0) $lat = $lng = \’\’; $result[\’lat\’] = $lat; $result[\’lng\’] = $lng; return $result; } function yahooGeocode($query) { $query = sendGeoQuery(\’http://api.local.yahoo.com/MapsService/V1/geocode?appid=Yahoo&location=\’. $query); $query = trim(preg_replace(\’/(\\s*<.*?>\\s*)+/\’, \’,\’, $query), \’,\’); list($lat, $lng) = explode(\’,\’, $query .\’,,,\’); $result[\’lat\’] = $lat; $result[\’lng\’] = $lng; return $result; } function sendGeoQuery($url=null, $content=null) { if (function_exists(\’curl_init\’)) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $content = curl_exec($ch); curl_close($ch); } elseif (ini_get(\’allow_url_fopen\’)) { $timeout = ini_set(\’default_socket_timeout\’, 30); $fp = @fopen($url, \’r\’); $content = @fread($fp, 4096); @fclose($fp); } return $content; } // map html output function showWrap($option, $conf) { global $database, $Itemid, $mainframe, $mosConfig_back_button, $mosConfig_hidePrint, $mosConfig_icons, $mosConfig_lang, $my; // load the html drawing class $menu =& new mosMenu($database); $menu->load($Itemid); $params =& new mosParameters($menu->params); // params $params->set(\’introtext\’, 0); $params->set(\’popup\’, 0); $params->def(\’image\’, 0); $params->def(\’page_title\’, 0); $params->def(\’activeMapZoom\’, $conf->activeMapZoom); $params->def(\’activeZoomControl\’, $conf->activeZoomControl); $params->def(\’APIKey\’, $conf->APIKey); $params->def(\’APIVersionMap\’, $conf->APIVersionMap); $params->def(\’APIVersionSearch\’, $conf->APIVersionSearch); $params->def(\’aspectRatio\’, $conf->aspectRatio); $params->def(\’autoOpen\’, $conf->autoOpen); $params->def(\’cbOffset\’, $conf->cbOffset); $params->def(\’centerArrow\’, $conf->centerArrow); $params->def(\’centerLat\’, $conf->centerLat); $params->def(\’centerLatIframe\’, $conf->centerLatIframe); $params->def(\’centerLatMars\’, $conf->centerLatMars); $params->def(\’centerLatMoon\’, $conf->centerLatMoon); $params->def(\’centerLatSearch\’, $conf->centerLatSearch); $params->def(\’centerLatSky\’, $conf->centerLatSky); $params->def(\’centerLng\’, $conf->centerLng); $params->def(\’centerLngIframe\’, $conf->centerLngIframe); $params->def(\’centerLngMars\’, $conf->centerLngMars); $params->def(\’centerLngMoon\’, $conf->centerLngMoon); $params->def(\’centerLngSearch\’, $conf->centerLngSearch); $params->def(\’centerLngSky\’, $conf->centerLngSky); $params->def(\’contZoom\’, $conf->contZoom); $params->def(\’contZoomIframe\’, $conf->contZoomIframe); $params->def(\’contZoomMars\’, $conf->contZoomMars); $params->def(\’contZoomMoon\’, $conf->contZoomMoon); $params->def(\’contZoomOpener\’, $conf->contZoomOpener); $params->def(\’contZoomSky\’, $conf->contZoomSky); $params->def(\’dblClickZoom\’, $conf->dblClickZoom); $params->def(\’dblClickZoomIframe\’, $conf->dblClickZoomIframe); $params->def(\’dblClickZoomMars\’, $conf->dblClickZoomMars); $params->def(\’dblClickZoomMoon\’, $conf->dblClickZoomMoon); $params->def(\’dblClickZoomOpener\’, $conf->dblClickZoomOpener); $params->def(\’dblClickZoomSky\’, $conf->dblClickZoomSky); $params->def(\’debugging\’, $conf->debugging); $params->def(\’decimalPlaces\’, $conf->decimalPlaces); $params->def(\’description\’, $conf->description); $params->def(\’earthZoom\’, $conf->earthZoom); $params->def(\’filename\’, $conf->filename); $params->def(\’geocodeProvider\’, $conf->geocodeProvider); $params->def(\’heading\’, $conf->heading); $params->def(\’headingMars\’, $conf->headingMars); $params->def(\’headingMoon\’, $conf->headingMoon); $params->def(\’headingSky\’, $conf->headingSky); $params->def(\’idleMapZoom\’, $conf->idleMapZoom); $params->def(\’idleZoomControl\’, $conf->idleZoomControl); $params->def(\’infoPreload\’, $conf->infoPreload); $params->def(\’letteredIcons\’, $conf->letteredIcons); $params->def(\’listBlankRows\’, $conf->listBlankRows); $params->def(\’mainTypeOpener\’, $conf->mainTypeOpener); $params->def(\’mainZoomOpener\’, $conf->mainZoomOpener); $params->def(\’mapTypeControl\’, $conf->mapTypeControl); $params->def(\’matchLatLng\’, $conf->matchLatLng); $params->def(\’misc\’, $conf->misc); $params->def(\’miscMars\’, $conf->miscMars); $params->def(\’miscMoon\’, $conf->miscMoon); $params->def(\’miscSky\’, $conf->miscSky); $params->def(\’opacityPolygons\’, $conf->opacityPolygons); $params->def(\’opacityPolylines\’, $conf->opacityPolylines); $params->def(\’opacityTooltips\’, $conf->opacityTooltips); $params->def(\’openerInterval\’, $conf->openerInterval); $params->def(\’overrideMainMap\’, $conf->overrideMainMap); $params->def(\’overviewEnable\’, $conf->overviewEnable); $params->def(\’overviewEnableIframe\’, $conf->overviewEnableIframe); $params->def(\’overviewEnableMars\’, $conf->overviewEnableMars); $params->def(\’overviewEnableMoon\’, $conf->overviewEnableMoon); $params->def(\’overviewEnableOpener\’, $conf->overviewEnableOpener); $params->def(\’overviewEnableSky\’, $conf->overviewEnableSky); $params->def(\’overviewHeight\’, $conf->overviewHeight); $params->def(\’overviewHeightIframe\’, $conf->overviewHeightIframe); $params->def(\’overviewHeightMars\’, $conf->overviewHeightMars); $params->def(\’overviewHeightMoon\’, $conf->overviewHeightMoon); $params->def(\’overviewHeightOpener\’, $conf->overviewHeightOpener); $params->def(\’overviewHeightSky\’, $conf->overviewHeightSky); $params->def(\’overviewMargin\’, $conf->overviewMargin); $params->def(\’overviewMarginIframe\’, $conf->overviewMarginIframe); $params->def(\’overviewMarginMars\’, $conf->overviewMarginMars); $params->def(\’overviewMarginMoon\’, $conf->overviewMarginMoon); $params->def(\’overviewMarginOpener\’, $conf->overviewMarginOpener); $params->def(\’overviewMarginSky\’, $conf->overviewMarginSky); $params->def(\’overviewWidth\’, $conf->overviewWidth); $params->def(\’overviewWidthIframe\’, $conf->overviewWidthIframe); $params->def(\’overviewWidthMars\’, $conf->overviewWidthMars); $params->def(\’overviewWidthMoon\’, $conf->overviewWidthMoon); $params->def(\’overviewWidthOpener\’, $conf->overviewWidthOpener); $params->def(\’overviewWidthSky\’, $conf->overviewWidthSky); $params->def(\’polygonAlt\’, $conf->polygonAlt); $params->def(\’searchText\’, $conf->searchText); $params->def(\’searchTitle\’, $conf->searchTitle); $params->def(\’searchUrl\’, $conf->searchUrl); $params->def(\’sexagesimal\’, $conf->sexagesimal); $params->def(\’sexagesimalPlaces\’, $conf->sexagesimalPlaces); $params->def(\’sexagesimalZeros\’, $conf->sexagesimalZeros); $params->def(\’shortNames\’, $conf->shortNames); $params->def(\’shortNamesIframe\’, $conf->shortNamesIframe); $params->def(\’shortNamesOpener\’, $conf->shortNamesOpener); $params->def(\’shortNamesSearch\’, $conf->shortNamesSearch); $params->def(\’showAutoOpen\’, $conf->showAutoOpen); $params->def(\’showBackButton\’, $conf->showBackButton); $params->def(\’showCoordinates\’, $conf->showCoordinates); $params->def(\’showDemoLink\’, $conf->showDemoLink); $params->def(\’showDirections\’, $conf->showDirections); $params->def(\’showFullScreen\’, $conf->showFullScreen); $params->def(\’showGoogleLink\’, $conf->showGoogleLink); $params->def(\’showKmlLink\’, $conf->showKmlLink); $params->def(\’showMarkers\’, $conf->showMarkers); $params->def(\’showMarkersBox\’, $conf->showMarkersBox); $params->def(\’showMarkersList\’, $conf->showMarkersList); $params->def(\’showOkButton\’, $conf->showOkButton); $params->def(\’showPolygons\’, $conf->showPolygons); $params->def(\’showPolygonsBox\’, $conf->showPolygonsBox); $params->def(\’showPolylines\’, $conf->showPolylines); $params->def(\’showPolylinesBox\’, $conf->showPolylinesBox); $params->def(\’showPrintButton\’, $conf->showPrintButton); $params->def(\’showPrintNotice\’, $conf->showPrintNotice); $params->def(\’showProgress\’, $conf->showProgress); $params->def(\’showScale\’, $conf->showScale); $params->def(\’showScaleIframe\’, $conf->showScaleIframe); $params->def(\’showScaleMars\’, $conf->showScaleMars); $params->def(\’showScaleMoon\’, $conf->showScaleMoon); $params->def(\’showScaleOpener\’, $conf->showScaleOpener); $params->def(\’showScaleSky\’, $conf->showScaleSky); $params->def(\’showSearch\’, $conf->showSearch); $params->def(\’showTerrain\’, $conf->showTerrain); $params->def(\’showToggle\’, $conf->showToggle); $params->def(\’showTooltips\’, $conf->showTooltips); $params->def(\’showType\’, $conf->showType); $params->def(\’showTypeIframe\’, $conf->showTypeIframe); $params->def(\’showTypeMars\’, $conf->showTypeMars); $params->def(\’showTypeMoon\’, $conf->showTypeMoon); $params->def(\’showTypeOpener\’, $conf->showTypeOpener); $params->def(\’showZoom\’, $conf->showZoom); $params->def(\’showZoomIframe\’, $conf->showZoomIframe); $params->def(\’showZoomMars\’, $conf->showZoomMars); $params->def(\’showZoomMoon\’, $conf->showZoomMoon); $params->def(\’showZoomOpener\’, $conf->showZoomOpener); $params->def(\’showZoomSky\’, $conf->showZoomSky); $params->def(\’sidebarNav\’, $conf->sidebarNav); $params->def(\’sidebarNum\’, $conf->sidebarNum); $params->def(\’sidebarSort\’, $conf->sidebarSort); $params->def(\’sideShowCat\’, $conf->sideShowCat); $params->def(\’skyZoom\’, $conf->skyZoom); $params->def(\’svgEnable\’, $conf->svgEnable); $params->def(\’targetBlank\’, $conf->targetBlank); $params->def(\’title\’, $conf->title); $params->def(\’titleMars\’, $conf->titleMars); $params->def(\’titleMoon\’, $conf->titleMoon); $params->def(\’titleSky\’, $conf->titleSky); $params->def(\’updateTime\’, $conf->xmlCache); $params->def(\’urlSettings\’, $conf->urlSettings); $params->def(\’useCssExtendedMap\’, $conf->useCssExtendedMap); $params->def(\’useCssExtendedSearchMap\’, $conf->useCssExtendedSearchMap); $params->def(\’useCssMap\’, $conf->useCssMap); $params->def(\’useCssSearchMap\’, $conf->useCssSearchMap); $params->def(\’useCssSidebar\’, $conf->useCssSidebar); $params->def(\’useExtendedXml\’, $conf->useExtendedXml); $params->def(\’useExtendedXmlFeed\’, $conf->useExtendedXmlFeed); $params->def(\’useGeoXml\’, $conf->useGeoXml); $params->def(\’whichType\’, $conf->whichType); $params->def(\’whichTypeIframe\’, $conf->whichTypeIframe); $params->def(\’whichTypeMars\’, $conf->whichTypeMars); $params->def(\’whichTypeMoon\’, $conf->whichTypeMoon); $params->def(\’whichTypeOpener\’, $conf->whichTypeOpener); $params->def(\’whichTypeSky\’, $conf->whichTypeSky); $params->def(\’zoomLevel\’, $conf->zoomLevel); $params->def(\’zoomLevelIframe\’, $conf->zoomLevelIframe); $params->def(\’zoomLevelMars\’, $conf->zoomLevelMars); $params->def(\’zoomLevelMoon\’, $conf->zoomLevelMoon); $params->def(\’zoomLevelOpener\’, $conf->zoomLevelOpener); $params->def(\’zoomLevelSky\’, $conf->zoomLevelSky); // xml url dynamic or static if ($conf->xmlUrl > 0) { if (mosGetParam($_GET, \’category\’, \’\’)) $categoryFilter = “&category=”. mosGetParam($_GET, \’category\’, \’\’); else $categoryFilter = \’\’; if (mosGetParam($_GET, \’marker\’, \’\’)) $markerFilter = “&marker=”. mosGetParam($_GET, \’marker\’, \’\’); else $markerFilter = \’\’; $params->def(\’xmlUrl\’ , \’/index2.php?option=\’. $option .\’&task=xml2&no_html=1\’. $categoryFilter . $markerFilter); } else { $params->def(\’xmlUrl\’ , \’/components/\’. $option .\’/data.xml.php\’); } // community builder integration if ($conf->cbEnable > 0) { if ($conf->cbUserMapCenter > 0) { $query = “SELECT geoLat, geoLng” . “\\n FROM #__comprofiler” . “\\n WHERE user_id = \’$my->id\'” ; $database->setQuery($query); $rows = $database->loadObjectList(); if ($database->getErrorNum()) { exit($database->stderr()); } if ($rows && $rows[0]->geoLat && $rows[0]->geoLng) { $params->set(\’centerLat\’, $rows[0]->geoLat); $params->set(\’centerLng\’, $rows[0]->geoLng); } } $params->def(\’cbOnSidebar\’, $conf->cbOnSidebar); $params->def(\’cbRealname\’, $conf->cbRealname); } // get the global params for print and back buttons if (defined(\’_JEXEC\’)) { // joomla! 1.5 switch $database->setQuery(“SELECT params FROM #__components WHERE `option` = \’com_content\'”); $data = $database->loadObjectList(); if ($database->getErrorNum()) { exit($database->stderr()); } // display as text or icon preg_match(\’/show_icons=(.*?)\\n/\’, $data[0]->params, $match); array_push($match, 0, 0); $params->def(\’mosConfig_icons\’, $match[1] & 1); // print button on or off preg_match(\’/show_print_icon=(.*?)\\n/\’, $data[0]->params, $match); array_push($match, 0, 0); $params->def(\’mosConfig_hidePrint\’, 1 – $match[1] & 1); // back button always off in joomla! 1.5 $params->def(\’mosConfig_back_button\’, 0); } else { // display as text or icon $params->def(\’mosConfig_icons\’, $mosConfig_icons); // print button on or off $params->def(\’mosConfig_hidePrint\’, $mosConfig_hidePrint); // back button on or off $params->def(\’mosConfig_back_button\’, $mosConfig_back_button); } // create xml file if cache is used if ($conf->xmlCache > 0) { $file = \’components/\’. $option .\’/data.xml.php\’; $xmlBuild = new xmlBuilder($option, $file, null, null, false, true, true); if ($xmlBuild->xmlCreate()) { $xmlBuild->xmlWrite(false); } } // start html output HTML_google_maps::display($params); } // create xml file each time config is saved function pureXML($option) { global $mosConfig_live_site, $my; if ($my->gid < 2) { mosNotAuth(); return; } $file = \’components/\’. $option .\’/data.xml.php\’; $xmlBuild = new xmlBuilder($option, $file); if ($xmlBuild->xmlCreate()) { $xmlBuild->xmlWrite(true); } mosRedirect(“$mosConfig_live_site/index.php?option=$option”); } // send the xml file straight to the browser each time the page is loaded, or offer it for download function dynamicXML($category, $download, $marker, $option, $xmlDate, $xmlName, $xmlOrder, $zip) { $xml_replace = array(\’/<\\?php[\\S\\s\\n]*?echo \\\’/\’, \’/\\\’;\\n\\?>/\’); $file = \’components/\’. $option .\’/data.xml.php\’; $xmlBuild = new xmlBuilder($option, $file, $category, $marker, $download, true, false, $xmlOrder); if ($xmlBuild->xmlCreate($download, $xmlDate, $xmlName)) { header(“Cache-Control: private”); header(\’Cache-Control: no-store, no-cache, must-revalidate\’); header(\’Content-Type: text/xml\’); header(\’Pragma: no-cache\’); // download as xml file if ($download) { // set download header header(\’Content-Disposition: attachment; filename=data.xml\’); header(\’Content-Description: File Transfer\’); header(\’Content-Transfer-Encoding: binary\’); // create zip file if ($zip) { $file = \’administrator/components/\’. $option .\’/temp/data.\’; $fp = fopen($file.\’xml\’, \’w\’); fwrite($fp, stripslashes(preg_replace($xml_replace, \’\’, $xmlBuild->xmlData))); fclose($fp); include_once(\’administrator/includes/pcl/pclzip.lib.php\’); $zip = new PclZip($file.\’zip\’); $zip->create($file.\’xml\’,PCLZIP_OPT_REMOVE_ALL_PATH); unlink($file.\’xml\’); $fp = fopen($file.\’zip\’, \’r\’); header(\’Content-Type: application/zip\’); header(\’Content-Disposition: attachment; filename=data.zip\’); echo fread($fp, filesize($file.\’zip\’)); fclose($fp); unlink($file.\’zip\’); exit; } } echo preg_replace($xml_replace, \’\’, $xmlBuild->xmlData); exit; } } // search for the print button function print_button($icons) { global $mainframe, $mosConfig_absolute_path, $mosConfig_live_site; $print_buttons = array(\’printButton.png\’,\’printButton.gif\’,\’printButton.jpg\’,\’print_button.png\’,\’print_button.gif\’,\’print_button.jpg\’); for ($i=0; $i < count($print_buttons); $i++) { if ($icons && file_exists($mosConfig_absolute_path .\’/templates/\’. $mainframe->getTemplate() .\’/images/\’. $print_buttons[$i])) { $image = \’
\’; break; } elseif ($icons && file_exists($mosConfig_absolute_path .\’/images/M_images/\’. $print_buttons[$i])) { $image = \’
\’; break; } else { $image = _GMAP_ICON_SEP .\’ \’. _GMAP_PRINT .\’ \’. _GMAP_ICON_SEP; if (!$icons) break; } } return $image; } // decode or not decode (what does utf stand for? unexpected text frequently?) function decode($string) { if (_ISO == \’charset=utf-8\’) return $string; else return utf8_decode($string); } function encode($string) { if (_ISO == \’charset=utf-8\’) return utf8_encode($string); else return $string; } function is_utf8($string) { if (preg_match(\’/^([\\x00-\\x7f]|[\\xc0-\\xdf][\\x80-\\xbf]|[\\xe0-\\xef][\\x80-\\xbf]{2}|[\\xf0-\\xf7][\\x80-\\xbf]{3}|[\\xf8-\\xfb][\\x80-\\xbf]{4}|[\\xfc-\\xfd][\\x80-\\xbf]{5})*$/\’, $string) === 1) return decode($string); else return encode($string); } // creates a kml file dynamically for google earth with current google maps content function dynamicKML($option) { global $mosConfig_live_site, $mosConfig_sitename; if (!isset($_POST[\’task\’])) mosRedirect(“$mosConfig_live_site/index.php?option=$option”); if (defined(\’_JEXEC\’)) $filter = 4; else $filter = 2; // joomla! 1.5 switch // title and description (default set to site name) $filename = stripslashes(mosGetParam($_POST, \’filename\’, $mosConfig_sitename)); $filename = preg_replace(\’/[^a-z-A-Z_0-9]/\’, \’\’, $filename); $description = _GMAP_FILE_DESCRIPTION == \’\’ ? stripslashes(mosGetParam($_POST, \’description\’, $mosConfig_sitename)) : _GMAP_FILE_DESCRIPTION; // get the map params $altitudeMode = mosGetParam($_POST, \’altitudeMode\’, \’clampToGround\’); $altitude = mosGetParam($_POST, \’altitude\’, 0); $heading = mosGetParam($_POST, \’heading\’, 0); $range = mosGetParam($_POST, \’range\’, 0); $tilt = mosGetParam($_POST, \’tilt\’, 0); // map center $latitude = mosGetParam($_POST, \’latitude\’, 0); $longitude = mosGetParam($_POST, \’longitude\’, 0); // check if planetary map type is set to “sky” if ($_POST[\’place\’] == 3) $sky = true; else $sky = false; // sky switch if ($sky) { $hint = \’hint=”target=sky” \’; $longitude = 0 – $longitude; } else { $hint = \’\’; } // set content type header(“Cache-Control: private”); header(“Content-Description: File Transfer”); header(“Content-Disposition: attachment; filename=$filename.kml”); header(“Content-Transfer-Encoding: binary”); header(“Content-Type: application/vnd.google-earth”); // write kml file echo “\\n”; echo “\\n”; echo ” \\n”; echo ” \\n”; echo ” \\n”; echo ” 1\\n”; echo ” \\n”; echo ” $altitude\\n”; echo ”
$heading
\\n”; echo ” $latitude\\n”; echo ” $longitude\\n”; echo ” $range\\n”; echo ” $tilt\\n”; echo ” \\n”; $i=0; // write markers to kml file if (isset($_POST[\’markers\’])) { while (isset($_POST[“markers$i”])) { $lat = mosGetParam($_POST, “lat$i”, \’\’); $lng = mosGetParam($_POST, “lng$i”, \’\’); $color = mosGetParam($_POST, “color$i”, \’\’); $scale = mosGetParam($_POST, “scale$i”, \’\’); $name = stripslashes(mosGetParam($_POST, “name$i”, \’\’)); $address = stripslashes(mosGetParam($_POST, “address$i”, \’\’)); $city = stripslashes(mosGetParam($_POST, “city$i”, \’\’)); $state = stripslashes(mosGetParam($_POST, “state$i”, \’\’)); $zipcode = stripslashes(mosGetParam($_POST, “zipcode$i”, \’\’)); $country = stripslashes(mosGetParam($_POST, “country$i”, \’\’)); $phone = stripslashes(mosGetParam($_POST, “phone$i”, \’\’)); $misc = stripslashes(mosGetParam($_POST, “misc$i”, \’\’, $filter)); // convert longitude to right ascension if ($sky) $lng = 0 – $lng; // add line breaks if ($address != \’\’) $address .= \’,
\’; if ($city != \’\’) $city .= \’,
\’; if ($state != \’\’) $state .= \’,
\’; if ($zipcode != \’\’) $zipcode .= \’,
\’; if ($country != \’\’) $country .= \’,
\’; $address = preg_replace(\’/,
$/\’, \’\’, “$address$city$state$zipcode$country$phone”); $snippet = preg_replace(\’/<.*?>/\’, \’ \’, $misc); if ($name == \’\’) $name .= “$lat, $lng”; echo ”
\\n”; echo ” \\n”; echo ”
\\n”; echo ” \\n”; echo ” \\n”; echo ”
\\n”; echo ” \\n”; echo ” $altitude\\n”; echo ”
$heading
\\n”; echo ” $lat\\n”; echo ” $lng\\n”; echo ” $range\\n”; echo ” $tilt\\n”; echo ” \\n”; echo ”
\\n”; echo ” $lng,$lat,$altitude\\n”; echo ” \\n”; echo ” \\n”; $i++; } } // write polygons to kml file if (isset($_POST[\’polygons\’])) { while (isset($_POST[“polygons$i”])) { $fillColor = mosGetParam($_POST, “fillColor$i”, \’\’); $fillOpacity = mosGetParam($_POST, “fillOpacity$i”, \’\’); $lineColor = mosGetParam($_POST, “lineColor$i”, \’\’); $lineOpacity = mosGetParam($_POST, “lineOpacity$i”, \’\’); $name = stripslashes(mosGetParam($_POST, “name$i”, \’\’)); $points = mosGetParam($_POST, “points$i”, \’\’); $width = mosGetParam($_POST, “width$i”, \’\’); // convert longitude to right ascension if ($sky) { $points = explode(\’,\’,$points); for ($n=0; $n < count($points); $n+=3) $points[$n] = 0 – $points[$n]; $points = implode(\’,\’,$points); } echo ”
\\n”; echo ” \\n”; echo ”
\\n”; echo ”
\\n”; echo ” 1\\n”; echo ” $altitudeMode\\n”; echo ” \\n”; echo ”
\\n”; echo ” $points\\n”; echo ” \\n”; echo ” \\n”; echo ” \\n”; echo ” \\n”; $i++; } } // write polylines to kml file if (isset($_POST[\’polylines\’])) { while (isset($_POST[“polylines$i”])) { $lineColor = mosGetParam($_POST, “lineColor$i”, \’\’); $lineOpacity = mosGetParam($_POST, “lineOpacity$i”, \’\’); $name = stripslashes(mosGetParam($_POST, “name$i”, \’\’)); $points = mosGetParam($_POST, “points$i”, \’\’); $width = mosGetParam($_POST, “width$i”, \’\’); // convert longitude to right ascension if ($sky) { $points = explode(\’,\’,$points); for ($n=0; $n < count($points); $n+=3) $points[$n] = 0 – $points[$n]; $points = implode(\’,\’,$points); } echo ”
\\n”; echo ” \\n”; echo ”
\\n”; echo ”
\\n”; echo ” 1\\n”; echo ” $altitudeMode\\n”; echo ” $points\\n”; echo ” \\n”; echo ” \\n”; $i++; } } echo ” \\n”; echo “\\n”; exit; } ?>‘