public function __construct() { //$this->setCountry("Earth"); $this->setEndpointUrl("http://maps.google.com/maps/geo?"); //API Key will be collected from the database in future if (!($vhost = VirtualHost::getCurrentVirtualHost())) { $this->setAPIKey("0"); } else { $this->setAPIKey($vhost->getGoogleAPIKey()); } }
/** * Get the default network * * @return object A Network object, NEVER returns null. * * @static * @access public */ public static function getDefaultNetwork() { $retval = null; $vhost = VirtualHost::getCurrentVirtualHost(); if ($vhost == null) { $vhost = VirtualHost::getDefaultVirtualHost(); } return $vhost->getDefaultNetwork(); }
*/ /** * Load common include file */ require_once 'admin_common.php'; require_once 'classes/Node.php'; require_once 'classes/Network.php'; require_once 'classes/AbstractGeocoder.php'; require_once 'classes/MainUI.php'; require_once 'classes/Server.php'; $ui = MainUI::getObject(); $ui->setTitle(_("Hotspot location map")); if (!empty($_REQUEST['node_id'])) { $node = Node::getObject($_REQUEST['node_id']); // Add Google Maps JavaScript ( must set config values ) $html_headers = "<script src=\"http://maps.google.com/maps?file=api&v=1&key=" . VirtualHost::getCurrentVirtualHost()->getGoogleAPIKey() . "\" type=\"text/javascript\"></script>"; $ui->appendHtmlHeadContent($html_headers); // Create HTML body $html = _("Click anywhere on the map to extract the GIS location, then click on the button to save the data.") . "<br>"; $html .= "<div id=\"map_frame\"></div>\n"; $html .= "<input type='button' value='" . _("Use these coordinates") . "' onClick='setLocationInOriginalWindow();'>\n"; $ui->addContent('main_area_middle', $html); if (($gisLocation = $node->getGisLocation()) !== null && $gisLocation->getLatitude() != null) { } elseif (($gisLocation = $node->getNetwork()->getGisLocation()) !== null && $gisLocation->getLatitude() != null) { } else { $html .= "<div class='error'>" . _("Error: You need to set the GIS coordinates of the center of your network") . "</div\n"; $gisLocation = null; } if ($gisLocation !== null) { //pretty_print_r($gisLocation); $lat = $gisLocation->getLatitude();
* @version Subversion $Id$ * @link http://www.wifidog.org/ */ /* This section deals with PATHs used in URLs and local content * BASE_SSL_PATH should be used to enter SSL mode (if available) * BASE_NON_SSL_PATH should be used to break out of SSL mode of when we * explicitely do not want someting to be referenced over http * BASE_URL_PATH should be used in all other cases to avoid needless SSL warning * * */ require_once 'classes/VirtualHost.php'; /** * Check for SSL support */ try { $vhost = VirtualHost::getCurrentVirtualHost(); if ($vhost == null) { $vhost = VirtualHost::getDefaultVirtualHost(); } if ($vhost->isSSLAvailable()) { /** * @ignore */ define("SSL_AVAILABLE", true); } else { /** * @ignore */ define("SSL_AVAILABLE", false); } } catch (Exception $e) {
// Init ALL smarty values $smarty->assign('DEPRECATEDisSuperAdmin', false); $smarty->assign('selectNetworkUI', null); /** * Define user security levels for the template * * These values are used in the default template of WiFoDog but could be used * in a customized template to restrict certain links to specific user * access levels. */ $smarty->assign('DEPRECATEDisSuperAdmin', $currentUser && $currentUser->DEPRECATEDisSuperAdmin()); /* * Header JavaScripts */ // Add Google Maps JavaScript (must set config values) if (!($vhost = VirtualHost::getCurrentVirtualHost())) { throw new Exception(_("Unable to get the google API key, because I couldn't find a vhost matching the current hostname")); } $html_headers = "<script src='http://maps.google.com/maps?file=api&v=2&&key=" . $vhost->getGoogleAPIKey() . "' type='text/javascript'></script>"; $html_headers .= "<script src='js/hotspots_status_map.js' type='text/javascript'></script>"; $html = null; /* * Main content */ // Set section of Smarty template $smarty->assign('sectionMAINCONTENT', true); // Set network selector $preSelectedObject = !empty($_REQUEST['network_map']) ? Network::getObject($_REQUEST['network_map']) : Network::getCurrentNetwork(); //$selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "javascript: document.lang_form.submit();")); $selectNetworkUI = Network::getSelectUI('network_map', array('preSelectedObject' => $preSelectedObject, 'onChange' => "submit.click();")); $smarty->assign('selectNetworkUI', $selectNetworkUI . (count(Network::getAllNetworks()) > 1 ? '<input class="submit" type="submit" name="submit" value="' . _("Change network") . '">' : ""));