function init($args = array()) { if ($this->params['force_secure'] && HTTPS_AVAILABLE && !on_secure_page()) { header('Location: ' . get_current_url(securest_available_protocol())); exit(0); } // Check for an existing database connection so we can restore it when we're done $this->db_conn = get_current_db_connection_name(); }
function init($args = array()) { parent::init($args); // force secure form due to a bug that causes images not to work in unsecure environment if (!on_secure_page()) { reason_include_once('function_libraries/user_functions.php'); force_secure_if_available(); } }
function Session_PHP() { if (defined('REASON_SESSION_TIMEOUT')) { $this->expires = REASON_SESSION_TIMEOUT * 60; } ini_set('session.use_cookies', 1) or trigger_error('Unable to set use_cookies ini'); ini_set('session.gc_maxlifetime', 86400); foreach ($this->errors as $err_num => $err) { if (!defined($err['name'])) { define($err['name'], $err_num); } } $this->secure_session_flag = HTTPS_AVAILABLE ? 1 : 0; $this->secure_if_available = !HTTPS_AVAILABLE || on_secure_page(); }
private function _match_protocol($url) { if (defined('ZENCODER_HTTPS_ENABLED') && ZENCODER_HTTPS_ENABLED && on_secure_page()) { if (strpos($url, 'http://') === 0) { return 'https://' . substr($url, 7); } } return $url; }
/** * redirects the current url to force a secure session * *If the current page is insecure, this function will header to the secure version of the page and die * * @return void */ function force_secure() { if (!on_secure_page()) { $url = get_current_url( 'https' ); header('Location: '.$url); exit(); } }
public function init($args = array()) { $head_items =& $this->parent->head_items; $head_items->add_javascript(JQUERY_URL, true); // do we need to do this? $head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'login/focus.js'); // Search engines should not be indexing versions of the index page with specific destinations if (isset($this->request['dest_page'])) { $head_items->add_head_item('meta', array('name' => 'robots', 'content' => 'none')); } $this->current_url = get_current_url(); $this->on_secure_page_if_available = !HTTPS_AVAILABLE || on_secure_page(); $this->set_dest_page(); if (isset($this->request['redir_link_text'])) { $this->redir_link_text = $this->request['redir_link_text']; } $this->dest_page = $this->localize_destination_page(); $this->sess =& get_reason_session(); $this->logged_in = false; // A session exists if ($this->sess->exists()) { if ($this->verbose_logging) { error_log('LOGIN: Session exists'); } if (!$this->sess->has_started()) { $this->sess->start(); if ($this->verbose_logging) { error_log('LOGIN: Session started'); } } // user is logging out if (isset($this->request['logout'])) { if ($this->verbose_logging) { error_log('LOGIN: do_logout'); } // Set the test cookie here, so they can log back in again $this->set_test_cookie(); $this->do_logout(); } elseif (!$this->sess->get('username')) { if ($this->verbose_logging) { error_log('LOGIN: Destroying bad session'); } $this->sess->destroy(); header('Location: ' . get_current_url()); exit; } else { if ($this->verbose_logging) { error_log('LOGIN: do_logged_in'); } $this->do_logged_in(); } } else { if ($this->verbose_logging) { error_log('LOGIN: No Session'); } // In the process of logging in if ($this->login_in_progress()) { if ($this->verbose_logging) { error_log('LOGIN: Login in progress'); } if ($this->test_cookie_exists()) { if ($this->verbose_logging) { error_log('LOGIN: Test cookie exists'); } $this->do_login(); } else { if ($this->verbose_logging) { error_log('LOGIN: NO test cookie'); } $this->status_msg = 'It appears that you do not have cookies enabled. Please enable cookies and try logging in again'; } } else { if ($this->verbose_logging) { error_log('LOGIN: No login in progress'); } $this->set_test_cookie(); if (isset($this->request['code'])) { $s =& get_reason_session(); $this->msg = $s->get_error_msg($this->request['code']); } if (isset($this->request['msg_uname'])) { $this->set_message_from_unique_name($this->request['msg_uname']); } } } }
/** * Get the absolute url for the site, given a reason entity or id for a site or page. * * @author Nathan White * @param mixed entity or entity_id corresponding to a page or site * @return mixed string absolute url if successful; else null */ function reason_get_site_url($page_or_site_entity_or_id) { $entity = is_numeric($page_or_site_entity_or_id) ? new entity($page_or_site_entity_or_id) : $page_or_site_entity_or_id; $type = $entity->has_value('type') ? $entity->get_value('type') : false; if ($type == id_of('minisite_page') || $type == id_of('site')) { $site = $type == id_of('minisite_page') ? $entity->get_owner() : $entity; $domain = $site->has_value('domain') && $site->get_value('domain') ? $site->get_value('domain') : REASON_HOST; $base_url = $site->get_value('base_url'); if (on_secure_page()) { if (isset($GLOBALS['_reason_domain_settings'][$domain]['HTTPS_AVAILABLE'])) { $secure = $GLOBALS['_reason_domain_settings'][$domain]['HTTPS_AVAILABLE']; } elseif (isset($GLOBALS['_default_domain_settings']['HTTPS_AVAILABLE'])) { $secure = $GLOBALS['_default_domain_settings']['HTTPS_AVAILABLE']; } else { $secure = $domain == REASON_HOST ? HTTPS_AVAILABLE : false; } } else { $secure = false; } return $secure ? 'https://' . $domain . $base_url : 'http://' . $domain . $base_url; } else { trigger_error('reason_get_site_url was not passed a valid site or page entity (or entity id) - a site url could not be built.'); return null; } }
function show_news_item(&$news_item) { $title = $news_item->get_value('release_title'); $parameters = $news_item->get_value('parameters'); $link = (strpos($news_item->get_value('page_url'), 'http') === false) // if it is not absoulte build the host for backwards compatibility ? '//' . REASON_HOST . $news_item->get_value('page_url') : $news_item->get_value('page_url'); // else it is what it is - an absolute multidomain safe URL if (!on_secure_page()) $link = alter_protocol($link, 'https', 'http'); // attempt to link over http if the home page is requested that way if (!empty($parameters)) { if ($this->textonly) $parameters['textonly'] = 1; foreach ($parameters as $k=>$v) { $param[$k] = $v; } $link .= '?' . implode_with_keys('&',$param); } echo '<a href="'. $link . '">'.$title.'</a>'; }
function init($args = array()) { $head_items =& $this->parent->head_items; $head_items->add_javascript(JQUERY_URL, true); $head_items->add_javascript(WEB_JAVASCRIPT_PATH . 'login/focus.js'); $this->current_url = get_current_url(); $this->on_secure_page_if_available = !HTTPS_AVAILABLE || on_secure_page(); if (empty($this->request['dest_page'])) { // in standalone mode, once the user has successfully logged in, they will be bounced back to the page // they came from if there was one. otherwise, they will see a successful login message if ($this->params['login_mode'] == 'standalone') { if (empty($this->request['popup'])) { // we have a referer. remember for later. if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) { $this->dest_page = $_SERVER['HTTP_REFERER']; } else { // we have no valid information on where to go back to. this will happen if a user goes // directly to the login page without clicking on a link. in this case, there will be no // jumping and a message saying you are logged in will appear along side the logout link. } } } else { $this->dest_page = $this->current_url; } } else { // Search engines should not be indexing versions of the index page with specific destinations $head_items->add_head_item('meta', array('name' => 'robots', 'content' => 'none')); $this->dest_page = $this->request['dest_page']; } if (!empty($this->request['redir_link_text'])) { $this->redir_link_text = $this->request['redir_link_text']; } $this->dest_page = $this->localize_destination_page(); $this->sess =& get_reason_session(); $this->logged_in = false; // A session exists if ($this->sess->exists()) { if (!$this->sess->has_started()) { $this->sess->start(); } // user is logging out if (!empty($this->request['logout'])) { $username = $this->sess->get('username'); $this->sess->destroy(); $this->msg = 'You are now logged out'; $this->log_authentication_event('logout succeeded', $username); if (empty($this->request['noredirect'])) { $parts = parse_url($this->dest_page); $port = isset($parts['port']) && !empty($parts['port']) ? ":" . $parts['port'] : ''; $query = isset($parts['query']) && !empty($parts['query']) ? '?' . $parts['query'] : ''; $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : ''; $loc = 'http://' . $parts['host'] . $port . $parts['path'] . $query . $fragment; header('Location: ' . $loc); exit; } } elseif (!$this->sess->get('username')) { $this->sess->destroy(); header('Location: ' . get_current_url()); exit; } else { $this->logged_in = true; $this->msg = 'You are logged in as ' . $this->sess->get('username') . '.'; if (!empty($this->dest_page)) { if ($this->dest_page != get_current_url()) { $dest_txt = $this->_get_dest_page_text(); $cleaned_dest_page = htmlspecialchars($this->dest_page); $this->msg_extra = '<p>Proceed to <a href="' . $cleaned_dest_page . '" title="' . $cleaned_dest_page . '">' . htmlspecialchars($dest_txt) . '</a></p>'; } } } } else { // trying to login if (!empty($this->request['username']) and !empty($this->request['password'])) { if ($this->test_cookie_exists()) { $auth = new directory_service($this->params['auth_service']); // succesful login if ($auth->authenticate($this->request['username'], $this->request['password'])) { $this->sess->start(); $this->logged_in = true; $this->sess->set('username', trim($this->request['username'])); $this->log_authentication_event('login succeeded', $this->request['username']); // pop user back to the top of the page. this makes sure that the session // info is available to all modules if (!empty($this->dest_page)) { $parts = parse_url($this->dest_page); $port = isset($parts['port']) && !empty($parts['port']) ? ":" . $parts['port'] : ''; $query = isset($parts['query']) && !empty($parts['query']) ? '?' . $parts['query'] : ''; $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : ''; $loc = securest_available_protocol() . '://' . $parts['host'] . $port . $parts['path'] . $query . $fragment; header('Location: ' . $loc); exit; } if (!empty($this->request['popup'])) { $this->close_window = true; $this->msg = 'You are now logged in. Please close this window.'; } } else { $this->log_authentication_event('login failed', $this->request['username']); $this->msg = 'The username and password you provided do not match. Please try again.'; } } else { $this->msg = 'It appears that you do not have cookies enabled. Please enable cookies and try logging in again'; } } else { $this->set_test_cookie(); if (!empty($this->request['code'])) { $s =& get_reason_session(); $this->msg = $s->get_error_msg($this->request['code']); } if (!empty($this->request['msg_uname'])) { $msg_id = id_of($this->request['msg_uname'], true, false); if (!empty($msg_id)) { $msg_ent = new entity($msg_id); if ($msg_ent->get_value('type') == id_of('text_blurb')) { $this->msg .= $msg_ent->get_value('content'); } } } } } }
function draw_google_map($gmaps) { $protocol = HTTPS_AVAILABLE && on_secure_page() ? 'https' : 'http'; $campusTemplateID = defined('GOOGLE_MAPS_CAMPUS_TEMPLATE_ID') ? GOOGLE_MAPS_CAMPUS_TEMPLATE_ID : ''; $aspectRatio = defined('GOOGLE_MAPS_ASPECT_RATIO') ? GOOGLE_MAPS_ASPECT_RATIO : 1.333333; foreach ($gmaps as $gmap) { echo '<script type="text/javascript" src="' . $protocol . '://maps.googleapis.com/maps/api/js?sensor=false"></script>'; echo ' <script type="text/javascript"> var directionsService = new google.maps.DirectionsService(); var directionsDisplay = new google.maps.DirectionsRenderer(); var map; var zoomLevel = ' . $gmap->get_value('google_map_zoom_level') . '; google.maps.visualRefresh = true; function initialize() { if (document.getElementById("map_canvas").offsetWidth < 275) { zoomLevel = zoomLevel - 1; // for smaller canvases zoom out one level. } var latLng = new google.maps.LatLng(' . $gmap->get_value('google_map_latitude') . ',' . $gmap->get_value('google_map_longitude') . '); var myOptions = { zoom: zoomLevel, center: latLng, mapTypeControlOptions: {mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.SATELLITE], style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: true, streetViewControl: false }; setMapCanvasWidthHeigth(); map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById("directionsPanel")); var arrayOfMsids = ["' . preg_replace("|\\s|", '","', $gmap->get_value('google_map_msid')) . '"];'; if ($gmap->get_value('google_map_show_campus_template') == "yes" && $campusTemplateID != '') { // campus map id in dedicated google account echo 'arrayOfMsids.splice(0, 0, "' . $campusTemplateID . '");'; } echo 'var nyLayer = []; setLayers(arrayOfMsids, nyLayer);'; if ($gmap->get_value('google_map_show_primary_pushpin') == "show") { echo 'var primaryPushpin = new google.maps.Marker({position: new google.maps.LatLng(' . $gmap->get_value('google_map_primary_pushpin_latitude') . ', ' . $gmap->get_value('google_map_primary_pushpin_longitude') . '),map: map});'; } echo '} function setMapCanvasWidthHeigth() { var defaultWidth = "460px"; if (document.getElementById("map_canvas").offsetHeight <= 0 && document.getElementById("map_canvas").offsetWidth <= 0) { document.getElementById("map_canvas").style.width = defaultWidth; document.getElementById("map_canvas").style.height=Math.floor(defaultWidth/' . $aspectRatio . ').toString().concat("px"); } else if (document.getElementById("map_canvas").offsetHeight <= 0) { document.getElementById("map_canvas").style.height=Math.floor(document.getElementById("map_canvas").offsetWidth/' . $aspectRatio . ').toString().concat("px"); } else if (document.getElementById("map_canvas").offsetWidth <= 0) { document.getElementById("map_canvas").style.width=Math.floor(document.getElementById("map_canvas").offsetHeight*' . $aspectRatio . ').toString().concat("px"); } } function setLayers(arrayOfMsids, nyLayer) { for (var i = 0; i < arrayOfMsids.length; i++) { nyLayer[i] = new google.maps.KmlLayer(\'' . $protocol . '://maps.google.com/maps/ms?msid=\' + arrayOfMsids[i] + \'&msa=0&output=kml\', { suppressInfoWindows: false, map: map, preserveViewport:true }); nyLayer[i].setMap(map); } } function calculateRoute() { if (document.getElementById("map_from").value != "") { document.getElementById("directionsPanel").style.display="block"; document.getElementById("totalDistance").style.display="block"; } else { document.getElementById("directionsPanel").style.display="none"; document.getElementById("totalDistance").style.display="none"; } var map_from = document.getElementById("map_from").value; var map_to = new google.maps.LatLng(' . $gmap->get_value('google_map_destination_latitude') . ',' . $gmap->get_value('google_map_destination_longitude') . '); var request = { origin: map_from, destination: map_to, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); } function resetDirections() { var latLng = new google.maps.LatLng(' . $gmap->get_value('google_map_latitude') . ',' . $gmap->get_value('google_map_longitude') . '); document.getElementById("directionsPanel").style.display="none"; document.getElementById("totalDistance").style.display="none"; directionsDisplay.setMap(null); directionsDisplay.setPanel(null); directionsDisplay = new google.maps.DirectionsRenderer(); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById("directionsPanel")); map.setCenter(latLng); map.setZoom(zoomLevel); } google.maps.event.addDomListener(window, \'load\', initialize); </script>' . "\n"; echo '<div id="map_canvas"></div><br/>' . "\n"; if ($gmap->get_value('google_map_show_directions') == 'show') { echo 'From:<br/><input type="text" name="map_from" id="map_from">' . "\n"; echo '<input type="submit" value="Get Directions" onClick="calculateRoute()">' . "\n"; echo '<input type="button" value="Reset" id="map_reset" onClick="resetDirections()">' . "\n"; echo '<div id="directionsPanel"><p><span id="totalDistance"></span></p></div><br/>' . "\n"; } } }
function equalize_protocol($url) { if (on_secure_page() && substr($url, 0, 7) == 'http://') { $url = 'https://' . substr($url, 7); } return $url; }
/** * Returns an absolute url with our best guess at the appropriate protocol * * @return string absolute url with a "smart" protocol choice */ function get_url() { return (on_secure_page()) ? $this->get_url_most_secure() : $this->get_url_http(); }
{ http_response_code($code); } function final_response($code, $message) { if (is_array($message) || is_object($message)) { header('Content-Type: application/json'); $message = json_encode($message); } else { header('Content-Type: text/plain'); } response_code($code); echo trim($message) . "\n"; exit; } if (HTTPS_AVAILABLE && !on_secure_page()) { final_response(403, "This script must be accessed over a secure " . "connection."); } if ($_SERVER['REQUEST_METHOD'] != 'POST') { final_response(405, "This script must be accessed via a POST request."); } if (defined('MAINTENANCE_MODE_ON') && MAINTENANCE_MODE_ON) { final_response(503, "This site is currently undergoing maintenance. " . "Uploads cannot be accepted at this time."); } // When Flash is running as an NPAPI plugin under Windows, it does not send // the correct cookies with HTTP requests, but instead sends whatever cookies // are associated with its IE plugin version. SWFUpload instances are made to // pass the session ID explicitly to work around this. $reason_session =& get_reason_session(); if (!empty($_REQUEST['reason_sid'])) { $reason_session->start($_REQUEST['reason_sid']);
function on_every_time() { $protocol = HTTPS_AVAILABLE && on_secure_page() ? 'https' : 'http'; $campusTemplateID = defined('GOOGLE_MAPS_CAMPUS_TEMPLATE_ID') ? GOOGLE_MAPS_CAMPUS_TEMPLATE_ID : ''; parent::on_every_time(); echo '<link href="' . $protocol . '://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />' . "\n"; echo '<style type="text/css"> #map_canvas { width: 600px; height: 400px; } #googlemapprimarypushpinlatitudeRow {display: none;} /* hack to avoid changing hidden input field */ #googlemapprimarypushpinlongitudeRow {display: none;} #googlemapdestinationlatitudeRow {display: none;} /* hack to avoid changing hidden input field */ #googlemapdestinationlongitudeRow {display: none;} </style>' . "\n"; echo ' <script type="text/javascript" src="' . $protocol . '://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script type="text/javascript" src="' . $protocol . '://google-maps-utility-library-v3.googlecode.com/svn/trunk/styledmarker/src/StyledMarker.js"></script> <script type="text/javascript"> google.maps.visualRefresh = true; function initialize() { var latLng = new google.maps.LatLng(' . $this->get_value('google_map_latitude') . ',' . $this->get_value('google_map_longitude') . '); var myOptions = { zoom:' . $this->get_value('google_map_zoom_level') . ', center: latLng, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, streetViewControl: false }; var map = new google.maps.Map(document.getElementById(\'map_canvas\'), myOptions); var arrayOfMsids = ["' . preg_replace("|\\s|", '","', $this->get_value('google_map_msid')) . '"]; if (document.disco_form.google_map_show_campus_template.options[document.disco_form.google_map_show_campus_template.options.selectedIndex].value == "yes" && "' . $campusTemplateID . '" != \'\') { arrayOfMsids.splice(0, 0, "' . $campusTemplateID . '"); } var nyLayer = []; setLayers(arrayOfMsids, nyLayer, map); var primaryPushpin = new google.maps.Marker({position: new google.maps.LatLng(' . $this->get_value('google_map_primary_pushpin_latitude') . ', ' . $this->get_value('google_map_primary_pushpin_longitude') . '),map: map,draggable:true}); //var primaryPushpin = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.MARKER,{color:"B0C4DE"}),position:new google.maps.LatLng(' . $this->get_value('google_map_primary_pushpin_latitude') . ', ' . $this->get_value('google_map_primary_pushpin_longitude') . '),map:map,draggable:true}); if (document.getElementById("radio_google_map_show_primary_pushpin_0").checked) { showMarker(primaryPushpin, 0); } else { showMarker(primaryPushpin, 1); } var destMarker = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.BUBBLE,{color:"#cccccc",text:"To"}),position:new google.maps.LatLng(' . $this->get_value('google_map_destination_latitude') . ', ' . $this->get_value('google_map_destination_longitude') . '),map:map,draggable:true}); if (document.getElementById("radio_google_map_show_directions_0").checked) { showMarker(destMarker, 0); } else { showMarker(destMarker, 1); } google.maps.event.addListener(map, \'dragend\', function(e) { updateMarkerPosition(map.getCenter()); }); google.maps.event.addListener(map, \'zoom_changed\', function(e) { document.disco_form.google_map_zoom_level.value = map.getZoom(); }); google.maps.event.addDomListener(document.disco_form.google_map_zoom_level, \'change\', function(e) { map.setZoom(parseInt(document.disco_form.google_map_zoom_level.value)); }); google.maps.event.addDomListener(document.disco_form.google_map_latitude, \'change\', function(e) { var cntr = new google.maps.LatLng(Math.min(85.0511, Math.max(-85.0511, parseFloat(document.disco_form.google_map_latitude.value))), parseFloat(document.disco_form.google_map_longitude.value)); map.setCenter(cntr); updateMarkerPosition(map.getCenter()); }); google.maps.event.addDomListener(document.disco_form.google_map_longitude, \'change\', function(e) { var cntr = new google.maps.LatLng(parseFloat(document.disco_form.google_map_latitude.value), parseFloat(document.disco_form.google_map_longitude.value)); map.setCenter(cntr); updateMarkerPosition(map.getCenter()); }); google.maps.event.addDomListener(document.getElementById("radio_google_map_show_primary_pushpin_0"), \'change\', function(e) { showMarker(primaryPushpin, 0); }); google.maps.event.addDomListener(document.getElementById("radio_google_map_show_primary_pushpin_1"), \'change\', function(e) { showMarker(primaryPushpin, 1); }); google.maps.event.addDomListener(primaryPushpin, \'dragend\', function(e) { var dragEnd = e.latLng; document.disco_form.google_map_primary_pushpin_latitude.value = dragEnd.lat(); document.disco_form.google_map_primary_pushpin_longitude.value = dragEnd.lng(); }); google.maps.event.addDomListener(document.getElementById("radio_google_map_show_directions_0"), \'change\', function(e) { showMarker(destMarker, 0); }); google.maps.event.addDomListener(document.getElementById("radio_google_map_show_directions_1"), \'change\', function(e) { showMarker(destMarker, 1); }); google.maps.event.addDomListener(destMarker, \'dragend\', function(e) { var dragEnd = e.latLng; document.disco_form.google_map_destination_latitude.value = dragEnd.lat(); document.disco_form.google_map_destination_longitude.value = dragEnd.lng(); }); google.maps.event.addDomListener(document.disco_form.google_map_show_campus_template, \'change\', function(e) { for (var i = 0; i < arrayOfMsids.length; i++) { nyLayer[i].setMap(null); } arrayOfMsids.splice(0, arrayOfMsids.length); nyLayer.length = 0; arrayOfMsids = document.disco_form.google_map_msid.value.split("\\n"); if (document.disco_form.google_map_show_campus_template.options[document.disco_form.google_map_show_campus_template.options.selectedIndex].value == "yes" && "' . $campusTemplateID . '" != \'\') { arrayOfMsids.splice(0, 0, "' . $campusTemplateID . '"); } setLayers(arrayOfMsids, nyLayer, map) }); google.maps.event.addDomListener(document.disco_form.google_map_msid, \'change\', function(e) { for (var i = 0; i < arrayOfMsids.length; i++) { nyLayer[i].setMap(null); } arrayOfMsids.splice(0, arrayOfMsids.length); nyLayer.length = 0; arrayOfMsids = document.disco_form.google_map_msid.value.split("\\n"); if (document.disco_form.google_map_show_campus_template.options[document.disco_form.google_map_show_campus_template.options.selectedIndex].value == "yes" && "' . $campusTemplateID . '" != \'\') { arrayOfMsids.splice(0, 0, "' . $campusTemplateID . '"); } setLayers(arrayOfMsids, nyLayer, map) }); } function updateMarkerPosition(latLng) { document.disco_form.google_map_latitude.value = latLng.lat(); document.disco_form.google_map_longitude.value = latLng.lng(); } function setLayers(arrayOfMsids, nyLayer, map) { for (var i = 0; i < arrayOfMsids.length; i++) { nyLayer[i] = new google.maps.KmlLayer(\'' . $protocol . '://maps.google.com/maps/ms?msid=\' + arrayOfMsids[i] + \'&msa=0&output=kml\', { suppressInfoWindows: false, map: map, preserveViewport:true }); nyLayer[i].setMap(map); } } function showMarker(marker, show) { if (show == 0) { marker.setVisible(true); } else { marker.setVisible(false); } } google.maps.event.addDomListener(window, \'load\', initialize); </script>' . "\n"; echo '<div id="map_canvas"></div><br/>' . "\n"; }