cvs: pearweb /public_html/map index.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Wed, 16 Apr 2008 22:02:45 +0000 |
| Subject: | cvs: pearweb /public_html/map index.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7475@lists.php.net to get a copy of this message | ||
dufuz Wed Apr 16 22:02:45 2008 UTC
Modified files:
/pearweb/public_html/map index.php
Log:
Handle it a bit more gracefully when the site has no geo users
http://cvs.php.net/viewvc.cgi/pearweb/public_html/map/index.php?r1=1.13&r2=1.14&diff_format=u
Index: pearweb/public_html/map/index.php
diff -u pearweb/public_html/map/index.php:1.13 pearweb/public_html/map/index.php:1.14
--- pearweb/public_html/map/index.php:1.13 Sun Jan 13 20:54:41 2008
+++ pearweb/public_html/map/index.php Wed Apr 16 22:02:45 2008
@@ -15,7 +15,7 @@
* @author David Coallier <davidc@php.net>
* @copyright Copyright (c) 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: index.php,v 1.13 2008/01/13 20:54:41 dufuz Exp $
+ * @version $Id: index.php,v 1.14 2008/04/16 22:02:45 dufuz Exp $
*/
$maps = array(
'world' =>
@@ -82,8 +82,16 @@
}
$infos = $dbh->getAll($sql, $data);
-if (!empty($infos)) {
- $map = '<script type="text/javascript" language="javascript"
src="http://maps.google.com/maps?file=api&v=2&key='
. $_SERVER['Google_API_Key'] . '"></script>';
+$infos = array();
+if (empty($infos)) {
+ response_header('PEAR Maps');
+ report_warning('No users with geo info were found');
+} elseif (isset($_GET['handle']) && !empty($_GET['handle']) &&
empty($infos)) {
+ response_header('PEAR Maps');
+ echo '<h1>PEAR Developer Locations</h1>';
+ echo '<p>User <strong>' . $handle . '</strong> does not have
latitude & longitude set.</p>';
+} else {
+ $map = '<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key='
. $_SERVER['Google_API_Key'] . '"></script>';
response_header('PEAR Maps', false, $map);
?>
<h1>PEAR Developer Locations</h1>
@@ -106,7 +114,7 @@
<script language="javascript" type="text/javascript">
points = new Array();
-?>
+<?php
foreach ($infos as $info) {
echo " points.push(['" . addslashes($info[0]) . "', '" .
addslashes($info[1]) . "', '" . addslashes($info[2]) . "',
'" . addslashes($info[3]) . "']);\n";
}
@@ -114,17 +122,12 @@
</script>
<script language="javascript" type="text/javascript"
src="../javascript/peardev_map.js"></script>
-<div style="width: 100%; height: 500px; border: 1px solid black;"
- id="peardev_map">
+<div style="width: 100%; height: 500px; border: 1px solid black;"
id="peardev_map">
</div>
<?php
-} elseif (isset($_GET['handle']) && !empty($_GET['handle']) &&
empty($infos)) {
- response_header('PEAR Maps');
- echo '<h1>PEAR Developer Locations</h1>';
- echo '<p>User <strong>' . $handle . '</strong> does not
latitude & longitude set.</p>';
}
-if ($auth_user && empty($auth_user->latitude)) {
+if (isset($auth_user) && empty($auth_user->latitude)) {
echo "<p><strong>Tip:</strong> You can add your coordinates in your
"
. make_link("/account-edit.php?handle=" . $auth_user->handle, "profile")
. ".</p>";
@@ -132,9 +135,7 @@
?>
<?php
if (!empty($infos)) {
- $showMap = '<script language="javascript"
type="text/javascript">
-showfullmap();
-</script>';
+ $showMap = '<script language="javascript"
type="text/javascript">showfullmap();</script>';
response_footer(false, $showMap);
} else {
response_footer();