You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(49) |
Sep
(25) |
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(24) |
Nov
(50) |
Dec
(4) |
2004 |
Jan
(2) |
Feb
(2) |
Mar
(5) |
Apr
|
May
(10) |
Jun
|
Jul
(10) |
Aug
(22) |
Sep
(10) |
Oct
|
Nov
(57) |
Dec
(5) |
2005 |
Jan
(24) |
Feb
(12) |
Mar
|
Apr
|
May
(3) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(5) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <il...@sc...> - 2006-12-27 07:19:13
|
Update of /cvsroot/meshdb/src/geo/dist In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3041 Modified Files: create.sql Log Message: Updated format to that produced by more recenty mysqldump. Index: create.sql =================================================================== RCS file: /cvsroot/meshdb/src/geo/dist/create.sql,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- create.sql 16 Feb 2005 11:17:34 -0000 1.3 +++ create.sql 27 Dec 2006 07:19:03 -0000 1.4 @@ -1,123 +1,138 @@ -# MySQL dump 8.12 -# -# Host: bo Database: mesh -#-------------------------------------------------------- -# Server version 3.23.39-log +-- MySQL dump 10.9 +-- +-- Host: bo Database: mesh +-- ------------------------------------------------------ +-- Server version 4.1.20-log -# -# Table structure for table 'admin' -# +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -DROP TABLE IF EXISTS admin; -CREATE TABLE admin ( - nodeid int(11) NOT NULL auto_increment, - nodename tinytext, - created datetime default NULL, - updated datetime default NULL, - url mediumtext NOT NULL, - comment text NOT NULL, - policy text, - status tinytext, - mailonupdate tinyint(4) default '0', - updatedip tinytext, - PRIMARY KEY (nodeid) -) TYPE=MyISAM; +-- +-- Table structure for table `admin` +-- -# -# Table structure for table 'config' -# +DROP TABLE IF EXISTS `admin`; +CREATE TABLE `admin` ( + `nodeid` int(11) NOT NULL auto_increment, + `nodename` tinytext, + `created` datetime default NULL, + `updated` datetime default NULL, + `url` mediumtext NOT NULL, + `comment` text NOT NULL, + `policy` text, + `status` tinytext, + `mailonupdate` tinyint(4) default '0', + `updatedip` tinytext, + PRIMARY KEY (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS config; -CREATE TABLE config ( - nodeid int(11) NOT NULL default '0', - carddesc tinytext, - cardurl tinytext, - antdesc tinytext, - anturl tinytext, - imageurl tinytext, - estgain double default NULL, - protocol tinytext, - antspread double default NULL, - channel tinyint(4) default NULL, - ifname varchar(16) NOT NULL default '', - direction double default NULL, - polarisation tinytext, - PRIMARY KEY (nodeid,ifname) -) TYPE=MyISAM; +-- +-- Table structure for table `config` +-- -# -# Table structure for table 'contact' -# +DROP TABLE IF EXISTS `config`; +CREATE TABLE `config` ( + `nodeid` int(11) NOT NULL default '0', + `carddesc` tinytext, + `cardurl` tinytext, + `antdesc` tinytext, + `anturl` tinytext, + `imageurl` tinytext, + `estgain` double default NULL, + `protocol` tinytext, + `antspread` double default NULL, + `channel` tinyint(4) default NULL, + `ifname` varchar(16) NOT NULL default '', + `direction` double default NULL, + `polarisation` tinytext, + PRIMARY KEY (`nodeid`,`ifname`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS contact; -CREATE TABLE contact ( - nodeid int(11) NOT NULL default '0', - contactname tinytext, - contactemail tinytext, - contactphone tinytext, - PRIMARY KEY (nodeid) -) TYPE=MyISAM; +-- +-- Table structure for table `contact` +-- -# -# Table structure for table 'netloc' -# +DROP TABLE IF EXISTS `contact`; +CREATE TABLE `contact` ( + `nodeid` int(11) NOT NULL default '0', + `contactname` tinytext, + `contactemail` tinytext, + `contactphone` tinytext, + PRIMARY KEY (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS netloc; -CREATE TABLE netloc ( - nodeid int(11) NOT NULL default '0', - family tinytext, - address tinytext, - peerid int(11) default NULL, - mac mediumtext, - ifname varchar(16) NOT NULL default '', - status tinytext, - active tinyint(4) NOT NULL default '0', - comment mediumtext, - channel tinyint(4) default NULL, - PRIMARY KEY (nodeid,ifname), - KEY nodeid (nodeid) -) TYPE=MyISAM; +-- +-- Table structure for table `netloc` +-- -# -# Table structure for table 'physaddr' -# +DROP TABLE IF EXISTS `netloc`; +CREATE TABLE `netloc` ( + `nodeid` int(11) NOT NULL default '0', + `family` tinytext, + `address` tinytext, + `peerid` int(11) default NULL, + `mac` mediumtext, + `ifname` varchar(16) NOT NULL default '', + `status` tinytext, + `active` tinyint(4) NOT NULL default '0', + `comment` mediumtext, + `channel` tinyint(4) default NULL, + PRIMARY KEY (`nodeid`,`ifname`), + KEY `nodeid` (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS physaddr; -CREATE TABLE physaddr ( - nodeid int(11) NOT NULL default '0', - streetno tinytext, - suburb tinytext, - state tinytext, - country char(2) default NULL, - postcode tinytext, - imageurl tinytext, - PRIMARY KEY (nodeid) -) TYPE=MyISAM; +-- +-- Table structure for table `physaddr` +-- -# -# Table structure for table 'physloc' -# +DROP TABLE IF EXISTS `physaddr`; +CREATE TABLE `physaddr` ( + `nodeid` int(11) NOT NULL default '0', + `streetno` tinytext, + `suburb` tinytext, + `state` tinytext, + `country` char(2) default NULL, + `postcode` tinytext, + `imageurl` tinytext, + PRIMARY KEY (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS physloc; -CREATE TABLE physloc ( - nodeid int(11) NOT NULL default '0', - e double default NULL, - n double default NULL, - h double default NULL, - error double default NULL, - PRIMARY KEY (nodeid) -) TYPE=MyISAM; +-- +-- Table structure for table `physloc` +-- -# -# Table structure for table 'imgcache' -# +DROP TABLE IF EXISTS `physloc`; +CREATE TABLE `physloc` ( + `nodeid` int(11) NOT NULL default '0', + `e` double default NULL, + `n` double default NULL, + `h` double default NULL, + `error` double default NULL, + PRIMARY KEY (`nodeid`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS imgcache; -CREATE TABLE imgcache ( - url varchar(255) NOT NULL default '', - img mediumblob, - cached datetime default NULL, - retreived datetime default NULL, - PRIMARY KEY (url) -) TYPE=MyISAM; +-- +-- Table structure for table `imgcache` +-- + +DROP TABLE IF EXISTS `imgcache`; +CREATE TABLE `imgcache` ( + `url` varchar(255) NOT NULL default '', + `img` mediumblob, + `cached` datetime default NULL, + `retreived` datetime default NULL, + PRIMARY KEY (`url`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
From: <il...@sc...> - 2006-08-28 21:58:17
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25428 Modified Files: submit.php config-local.php-dist Log Message: Added support for checking submissions against DNS blacklists. Index: submit.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/submit.php,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- submit.php 16 Feb 2005 11:17:33 -0000 1.16 +++ submit.php 28 Aug 2006 21:58:09 -0000 1.17 @@ -5,6 +5,12 @@ if ($READONLY) die("database has been marked read only"); +/* DNS blacklists. */ +$rev = implode('.', array_reverse(explode('.', $_SERVER["REMOTE_ADDR"]))); +foreach ($DNSBLS as $dnsbl) + if (checkdnsrr($rev . "." . $dnsbl . ".", "A")) + die("access denied"); + /* Looks up the mail-on-update related information that's currently * stored for this node so we can send mail (if desired) after we've * made the changes. */ Index: config-local.php-dist =================================================================== RCS file: /cvsroot/meshdb/www/db2/config-local.php-dist,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- config-local.php-dist 27 Nov 2003 04:52:28 -0000 1.4 +++ config-local.php-dist 28 Aug 2006 21:58:09 -0000 1.5 @@ -9,7 +9,7 @@ */ global $MYSQLHOST, $MYSQLUSER, $MYSQLPASS, $MYSQLDB; - global $READONLY, $OURPROXY, $DBADMIN; + global $READONLY, $OURPROXY, $DBADMIN, $DNSBLS; global $ZONE, $SHIFTFILE, $ALTFILE; $MYSQLHOST = "host"; /* MySQL hostname */ @@ -20,6 +20,11 @@ $OURPROXY = "proxy"; /* an HTTP proxy host available to us */ $DBADMIN = "db...@br..."; /* Address of a human administrator */ + $DNSBLS = array(); /* DNS blacklist query domains */ + /* $DNSBLS[] = "http.dnsbl.sorbs.net"; */ + /* $DNSBLS[] = "sbl-xbl.spamhaus.org"; */ + /* etc */ + $ZONE = 56; /* UTM zone (56 for Brisbane) */ $SHIFTFILE = "lib/QLD_0900.gsb";/* Shift file */ $ALTFILE = "lib/alt.desc"; /* Altitude file */ |
From: <ma...@sc...> - 2006-05-07 04:06:15
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8558a/www/db2 Modified Files: google.php Log Message: fixed content-disposition for wider browser support, based on feedback Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- google.php 1 May 2006 15:02:24 -0000 1.9 +++ google.php 7 May 2006 04:06:06 -0000 1.10 @@ -7,6 +7,7 @@ /* return xml header */ header("application/vnd.google-earth.kml+xml"); + header("Content-disposition: attachment; filename=brismesh.kml"); /* return error message*/ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -109,12 +110,10 @@ /* send headers if not buffering for zip */ if ($zip == 0) { if ($save == 1) { - //header("Content-Type: application/vnd.google-earth.kml+xml"); - /* above is broken, wont force download in mozilla (works in ie), below works for both */ - header("Content-Type: text/plain"); - header("Content-disposition: attachment; filename=brismesh.kml"); /* save as filename */ + header("Content-Type: text/plain"); } else { header("Content-Type: application/vnd.google-earth.kml+xml"); + header("Content-disposition: attachment; filename=brismesh.kml"); } } @@ -381,12 +380,10 @@ /* content type */ if ($save == 1) { - //header('Content-Type: application/vnd.google-earth.kmz'); - /* above is broken, wont force download in mozilla (works in ie), below works for both */ - header("Content-Type: application/octet-stream"); - header("Content-disposition: attachment; filename=brismesh.kmz"); /* save as filename */ + header('Content-Type: application/octet-stream'); } else { header('Content-Type: application/vnd.google-earth.kmz'); + header("Content-disposition: attachment; filename=brismesh.kml"); /* save as filename */ } /* send zip */ |
From: <ma...@sc...> - 2006-05-01 15:17:10
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18917/www/db2 Modified Files: index.php Log Message: added link to export nodes to google earth Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/index.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- index.php 16 Feb 2005 23:54:50 -0000 1.13 +++ index.php 1 May 2006 15:17:01 -0000 1.14 @@ -1,374 +1,376 @@ -<? - include("config.php"); - /* Use the imgsz query arg if it is there */ - $len = 0; - - $DEFAULTLEN = $PREF["imgsz"]; - - if (isset($_GET["imgsz"])) - $len = intval($_GET["imgsz"]); - if ($len < 50) $len = $DEFAULTLEN; - - $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); - mysql_select_db($MYSQLDB, $db) - or die(mysql_error($db)); - $result = mysql_query("SELECT max(unix_timestamp(updated)) from admin", $db) - or die(mysql_error($db)); - $row = mysql_fetch_row($result); - $updated = max(intval($row[0]), $PREF["_moddate"]); - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); -?> - -<html> -<head> -<link rel="stylesheet" href="<?=$PREF["stylesheet"]?>" type="text/css"> -<link rel="icon" href="favicon.ico"> -<title>Brisbane Mesh node database</title> -<style type="text/css"> - td { font-size: smaller; } - td.ID { text-align: right; } - td.Status { text-align: center; } - td.Ifs { text-align: right; } - td.Age { text-align: right; } - td.Map { color: red; } -</style> -</head> -<body> - -<img align=center src="../img/mesh-small.gif" - width=107 height=68 alt="Brisbane Mesh"> - -<h1>Brisbane Mesh node database</h1> - -<p> -This is a simple database for people operating or interested in operating -wireless network nodes in Brisbane. -If you're interested, please create a node for yourself. -</p> - -<h2>Node database</h2> - -<p> -Currently there <? - $result = mysql_query("SELECT count(*) from admin", $db) - or die(mysql_error($db)); - $row = mysql_fetch_row($result); - $nentries = intval($row[0]); - if ($nentries == 1) - printf("is 1 lonely node"); - else - printf("are $nentries nodes"); -?> and <? - $result = mysql_query("SELECT count(*) - FROM netloc - WHERE status = 'full' - AND active", $db) - or die(mysql_error($db)); - $row = mysql_fetch_row($result); - $nentries = intval($row[0]); - if ($nentries == 1) - printf("1 active interface"); - else - printf("$nentries active interfaces"); -?> (<? - $result = mysql_query("SELECT count(*) from netloc", $db) - or die(mysql_error($db)); - $row = mysql_fetch_row($result); - printf(strval($row[0])." total"); -?>). - -<form method=get action="search.php"> -Node search: <input name="q"> -</form> - -<ul><li><strong><? if (!$READONLY) { - ?><a href="create.php">Create a new node entry</a><? - } else { - ?>Database is in READ-ONLY (development) mode<? - } ?></strong></li></ul> - -<map name="summarymap"> -<? -/* figure out the limits of the map */ -$result = mysql_query("SELECT" - ." min(e) as mine," - ." min(n) as minn," - ." max(e) as maxe," - ." max(n) as maxn" - ." FROM physloc, admin" - /* limit to a 200km radius about UQ */ - ." WHERE (e-501372)*(e-501372)+(n-6958178)*(n-6958178) < 200000*200000" - ." AND admin.nodeid = physloc.nodeid" - ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"], - $db) - or die(mysql_error($db)); -$row = mysql_fetch_assoc($result); -$mwid = max(max( $row["maxn"]-$row["minn"] , $row["maxe"]-$row["mine"] ), 1); -$mapscale = $len/$mwid/1.1; -$mapn = ($row["minn"]+$row["maxn"])/2; -$mape = ($row["mine"]+$row["maxe"])/2; -$mapargb = "w=${len}&h=${len}&s=${mapscale}&n=${mapn}&e=${mape}&updated=${updated}&maxage=".$PREF["maxnodeage"]; - -$result = mysql_query("SELECT" - ." admin.nodeid," - ." nodename," - ." n," - ." e" - ." FROM admin, physloc" - ." WHERE admin.nodeid = physloc.nodeid" - ." AND n is not null" - ." AND e is not null" - ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"], - $db) - or die(mysql_error($db)); -while ($row = mysql_fetch_assoc($result)) { - if ($row["n"] && $row["e"]) { - $x = intval($len/2 + (doubleval($row["e"]) - $mape) * $mapscale); - $y = intval($len/2 - (doubleval($row["n"]) - $mapn) * $mapscale); - if ($x >= 0 && $y >= 0 && $x < $len && $y < $len) { - echo "<area href=\"view.php?nodeid=".$row["nodeid"]."\""; - echo " alt=\"".htmlspecialchars($row["nodename"])."\""; - echo " shape=circle coords=\"$x,$y,8\">\n"; - } - } -} -?> -</map> - -<map name="networkmap"> -<? -$result = mysql_query("SELECT" - ." admin.nodeid AS nodeid," - ." nodename," - ." e," - ." n" - ." FROM admin, netloc, physloc" - ." WHERE (netloc.nodeid = admin.nodeid" - ." OR netloc.peerid = admin.nodeid)" - ." AND physloc.nodeid = admin.nodeid" - ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"] - ." GROUP BY nodeid", - $db) - or die(mysql_error($db)); -while ($row = mysql_fetch_assoc($result)) { - if ($row["n"] && $row["e"]) { - $x = intval($len/2 + (doubleval($row["e"]) - $mape) * $mapscale); - $y = intval($len/2 - (doubleval($row["n"]) - $mapn) * $mapscale); - if ($x >= 0 && $y >= 0 && $x < $len && $y < $len) { - echo "<area href=\"view.php?nodeid=".$row["nodeid"]."\""; - echo " alt=\"".htmlspecialchars($row["nodename"])."\""; - echo " shape=circle coords=\"$x,$y,8\">\n"; - } - } -} -?> -</map> - -<table class="summary"> - -<tr valign=top> -<td><table> -<? - $havecmp = 0; - $cols = array("ID", "Name", "Suburb", "Map", "Ifs", "Status", "Age"); - if ($PREF["myid"] > 0) { - $result = mysql_query("SELECT e,n" - ." FROM physloc" - ." WHERE nodeid=".intval($PREF["myid"])) - or die(mysql_error($db)); - $row = mysql_fetch_assoc($result); - if ($row) { - $cmpe = $row["e"]; - $cmpn = $row["n"]; - if ($cmpe > 0 && $cmpn > 0) { - $cols[] = "Distance"; - $havecmp = 1; - } - } - } -?> -<tr><th class="major" colspan=<?=count($cols)?>>Current nodes</th></tr> -<tr> -<? - if (isset($_GET["orderkey"])) - $orderkey = $_GET["orderkey"]; - if (isset($_GET["orderdir"])) - $orderdir = $_GET["orderdir"]; - - /* fallback on cookies if no override */ - list($def_orderkey, $def_orderdir) = explode(":", $PREF["indexsort"]); - if (!isset($orderkey) || !in_array($orderkey, $cols)) - $orderkey = $def_orderkey; - if ($orderdir != "asc" && $orderdir != "desc") - $orderdir = $def_orderdir; - - /* fallback defaults */ - if (!isset($orderkey) || !in_array($orderkey, $cols)) - $orderkey = "ID"; - if ($orderdir != "asc" && $orderdir != "desc") - $orderdir = "asc"; - - $opporderdir = ($orderdir == "asc" ? "desc" : "asc"); - foreach ($cols as $col) { - if ($col == $orderkey) { - echo " <th class=\"minor\"><a href=\"index.php?orderkey=${col}&orderdir=${opporderdir}\">$col</a>"; - echo "<sup>".($orderdir== "asc" ? - /* "↓" : "↑" */ - "+" : "-" - )."</sup>"; - echo "</th>\n"; - } else - echo " <th class=\"minor\"><a href=\"index.php?orderkey=${col}&orderdir=asc\">$col</a></th>\n"; - } -?> -</tr> -<!-- <?=print_r($PREF)?> <?=$PREF["maxnodeage"]?> --> -<? - $infinite = 100000000; - $result = mysql_query("SELECT" - ." admin.nodeid AS ID" - .", admin.nodename AS Name" - .", physaddr.suburb AS Suburb" - .", admin.status AS Status" - .", TO_DAYS(NOW())-TO_DAYS(admin.updated) AS Age" - .", (e IS NOT NULL AND n IS NOT NULL) AS Map" - .", COUNT(netloc.ifname) AS Ifs" - .($havecmp ? - ",IFNULL(SQRT(POW(e - $cmpe,2)+POW(n - $cmpn,2))," - ."$infinite) AS Distance" : "") - ." FROM physaddr,physloc,admin" - ." LEFT JOIN netloc ON admin.nodeid=netloc.nodeid" - ." WHERE physaddr.nodeid = admin.nodeid" - ." AND physloc.nodeid = admin.nodeid" - ." AND to_days(now()) - to_days(admin.updated) <= " . $PREF["maxnodeage"] - ." GROUP BY admin.nodeid" - ." ORDER BY $orderkey $orderdir" - .($PREF["indexlimit"] > 0 ? " LIMIT ".$PREF["indexlimit"] : "") - , $db) - or die(mysql_error($db)); - - while ($row = mysql_fetch_assoc($result)) { - $nodeid = $row["ID"]; - if ($nodeid == $PREF["myid"]) - echo "<tr class=\"myrow\">\n"; - else - echo "<tr>\n"; - foreach($cols as $col) { - $v = htmlspecialchars($row[$col]); - if ($col == "Status") - echo " <td class=\"$col $v\">"; - else - echo " <td class=\"$col\">"; - if ($col == "Ifs" && $v == "0") - $v = " "; - else if ($col == "Ifs") - $v = "<a href=\"touchgraph.php?nodeid=$nodeid\">$v</a>"; - if ($col == "Name") - echo "<a href=\"view.php?nodeid=$nodeid\">$v</a>"; - else if ($col == "Age" && $row[$col] > 0) - echo $v."d"; - else if ($col == "Age") - echo " "; - else if ($col == "Map") - echo ($row[$col] ? " " : - "no"); - else if ($col == "Distance" && - ($v == "" || $v >= $infinite)) - echo " "; - else if ($col == "Distance") - echo sprintf("%.1fkm", $v/1000); - else - echo $v; - echo "</td>\n"; - } -?> -</tr> -<? - } -?> -</table> - -<? if ($PREF["indexlimit"] > 0) { ?> - <br>(List <a href="cookies.php">limited</a> to <?=$PREF["indexlimit"]?> entries.) -<? } ?> - -</td> - -<? - $maps = explode(" ", trim($PREF["viewmaplist"])); - if (count($maps)) { -?> -<td> - <table> - -<? foreach ($maps as $maptype) { - if ($maptype == "net") { ?> - - <tr><th class="major">Network connectivity view</th></tr> - <tr><td valign=top><img - width=<?=$len?> height=<?=$len?> - usemap="#networkmap" - src="map4b.php?<?=$mapargb?>&nonumbers=1" - ></td> - </tr> -<? } else if ($maptype == "loc") { ?> - - <tr><th class="major">Location view</th></tr> - <tr> - <td valign=top><img - width=<?=$len?> height=<?=$len?> - usemap="#summarymap" - src="map2b.php?<?=$mapargb?>" - ></td> - </tr> - -<? } else if ($maptype == "ter") { ?> - - <tr><th class="major">Terrain view</th></tr> - <tr><td valign=top><img - width=<?=$len?> height=<?=$len?> - usemap="#summarymap" - src="map3b.php?<?=$mapargb?>" - ></td> - </tr> -<? } else if ($maptype == "elev") { - /* ignore elevation */ - } else { ?> - <tr><th class="major">Unknown: <?=htmlspecialchars($maptype)?> - </th></tr> -<? } - } /* foreach */ ?> - </table> -</td> -<? } /* if maps */ ?> -</tr> -</table> - -<p> -Select a node for more information. The meanings of the columns are: -<dl compact> -<dt>Age</dt> <dd>How long ago the entry record was modified. </dd> -<dt>Map</dt> <dd>If the site coordinates are known, and hence if -the site is displayed on maps.</dd> -<dt>Ifs</dt> <dd>Number of interfaces (network cards) that the node has.</dt> -<? if ($PREF["myid"] > 0) { ?> -<dt>Distance</dt> <dd>Distance to node #<?=$PREF["myid"]?>.</dt> -<? } ?> -</dl> -</p> - -<ul> -<li>Make key maps -<a href="index.php?imgsz=<?=$len * 2?>">bigger</a> or -<a href="index.php?imgsz=<?=$len / 2?>">smaller</a></li> -<li><a href="about.html">About this database</a></li> -<li><a href="grid-instructions.html">How to find your grid coordinates</a></li> -<li><a href="policies.html">Node access policies</a></li> -<li><a href="address.html">Address allocation</a></li> -</ul> - -<hr> -<? include("footer.inc"); ?> - -</body> -</html> +<? + include("config.php"); + /* Use the imgsz query arg if it is there */ + $len = 0; + + $DEFAULTLEN = $PREF["imgsz"]; + + if (isset($_GET["imgsz"])) + $len = intval($_GET["imgsz"]); + if ($len < 50) $len = $DEFAULTLEN; + + $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); + mysql_select_db($MYSQLDB, $db) + or die(mysql_error($db)); + $result = mysql_query("SELECT max(unix_timestamp(updated)) from admin", $db) + or die(mysql_error($db)); + $row = mysql_fetch_row($result); + $updated = max(intval($row[0]), $PREF["_moddate"]); + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); +?> + +<html> +<head> +<link rel="stylesheet" href="<?=$PREF["stylesheet"]?>" type="text/css"> +<link rel="icon" href="favicon.ico"> +<title>Brisbane Mesh node database</title> +<style type="text/css"> + td { font-size: smaller; } + td.ID { text-align: right; } + td.Status { text-align: center; } + td.Ifs { text-align: right; } + td.Age { text-align: right; } + td.Map { color: red; } +</style> +</head> +<body> + +<img align=center src="../img/mesh-small.gif" + width=107 height=68 alt="Brisbane Mesh"> + +<h1>Brisbane Mesh node database</h1> + +<p> +This is a simple database for people operating or interested in operating +wireless network nodes in Brisbane. +If you're interested, please create a node for yourself. +</p> + +<h2>Node database</h2> + +<p> +Currently there <? + $result = mysql_query("SELECT count(*) from admin", $db) + or die(mysql_error($db)); + $row = mysql_fetch_row($result); + $nentries = intval($row[0]); + if ($nentries == 1) + printf("is 1 lonely node"); + else + printf("are $nentries nodes"); +?> and <? + $result = mysql_query("SELECT count(*) + FROM netloc + WHERE status = 'full' + AND active", $db) + or die(mysql_error($db)); + $row = mysql_fetch_row($result); + $nentries = intval($row[0]); + if ($nentries == 1) + printf("1 active interface"); + else + printf("$nentries active interfaces"); +?> (<? + $result = mysql_query("SELECT count(*) from netloc", $db) + or die(mysql_error($db)); + $row = mysql_fetch_row($result); + printf(strval($row[0])." total"); +?>). + +<form method=get action="search.php"> +Node search: <input name="q"> +</form> + +<ul><li><strong><? if (!$READONLY) { + ?><a href="create.php">Create a new node entry</a><? + } else { + ?>Database is in READ-ONLY (development) mode<? + } ?></strong></li> + <li><strong><a href="google.php">Export to Google Earth</a> (all nodes)</strong></li> +</ul> + +<map name="summarymap"> +<? +/* figure out the limits of the map */ +$result = mysql_query("SELECT" + ." min(e) as mine," + ." min(n) as minn," + ." max(e) as maxe," + ." max(n) as maxn" + ." FROM physloc, admin" + /* limit to a 200km radius about UQ */ + ." WHERE (e-501372)*(e-501372)+(n-6958178)*(n-6958178) < 200000*200000" + ." AND admin.nodeid = physloc.nodeid" + ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"], + $db) + or die(mysql_error($db)); +$row = mysql_fetch_assoc($result); +$mwid = max(max( $row["maxn"]-$row["minn"] , $row["maxe"]-$row["mine"] ), 1); +$mapscale = $len/$mwid/1.1; +$mapn = ($row["minn"]+$row["maxn"])/2; +$mape = ($row["mine"]+$row["maxe"])/2; +$mapargb = "w=${len}&h=${len}&s=${mapscale}&n=${mapn}&e=${mape}&updated=${updated}&maxage=".$PREF["maxnodeage"]; + +$result = mysql_query("SELECT" + ." admin.nodeid," + ." nodename," + ." n," + ." e" + ." FROM admin, physloc" + ." WHERE admin.nodeid = physloc.nodeid" + ." AND n is not null" + ." AND e is not null" + ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"], + $db) + or die(mysql_error($db)); +while ($row = mysql_fetch_assoc($result)) { + if ($row["n"] && $row["e"]) { + $x = intval($len/2 + (doubleval($row["e"]) - $mape) * $mapscale); + $y = intval($len/2 - (doubleval($row["n"]) - $mapn) * $mapscale); + if ($x >= 0 && $y >= 0 && $x < $len && $y < $len) { + echo "<area href=\"view.php?nodeid=".$row["nodeid"]."\""; + echo " alt=\"".htmlspecialchars($row["nodename"])."\""; + echo " shape=circle coords=\"$x,$y,8\">\n"; + } + } +} +?> +</map> + +<map name="networkmap"> +<? +$result = mysql_query("SELECT" + ." admin.nodeid AS nodeid," + ." nodename," + ." e," + ." n" + ." FROM admin, netloc, physloc" + ." WHERE (netloc.nodeid = admin.nodeid" + ." OR netloc.peerid = admin.nodeid)" + ." AND physloc.nodeid = admin.nodeid" + ." AND to_days(now()) - to_days(admin.updated) <= ".$PREF["maxnodeage"] + ." GROUP BY nodeid", + $db) + or die(mysql_error($db)); +while ($row = mysql_fetch_assoc($result)) { + if ($row["n"] && $row["e"]) { + $x = intval($len/2 + (doubleval($row["e"]) - $mape) * $mapscale); + $y = intval($len/2 - (doubleval($row["n"]) - $mapn) * $mapscale); + if ($x >= 0 && $y >= 0 && $x < $len && $y < $len) { + echo "<area href=\"view.php?nodeid=".$row["nodeid"]."\""; + echo " alt=\"".htmlspecialchars($row["nodename"])."\""; + echo " shape=circle coords=\"$x,$y,8\">\n"; + } + } +} +?> +</map> + +<table class="summary"> + +<tr valign=top> +<td><table> +<? + $havecmp = 0; + $cols = array("ID", "Name", "Suburb", "Map", "Ifs", "Status", "Age"); + if ($PREF["myid"] > 0) { + $result = mysql_query("SELECT e,n" + ." FROM physloc" + ." WHERE nodeid=".intval($PREF["myid"])) + or die(mysql_error($db)); + $row = mysql_fetch_assoc($result); + if ($row) { + $cmpe = $row["e"]; + $cmpn = $row["n"]; + if ($cmpe > 0 && $cmpn > 0) { + $cols[] = "Distance"; + $havecmp = 1; + } + } + } +?> +<tr><th class="major" colspan=<?=count($cols)?>>Current nodes</th></tr> +<tr> +<? + if (isset($_GET["orderkey"])) + $orderkey = $_GET["orderkey"]; + if (isset($_GET["orderdir"])) + $orderdir = $_GET["orderdir"]; + + /* fallback on cookies if no override */ + list($def_orderkey, $def_orderdir) = explode(":", $PREF["indexsort"]); + if (!isset($orderkey) || !in_array($orderkey, $cols)) + $orderkey = $def_orderkey; + if ($orderdir != "asc" && $orderdir != "desc") + $orderdir = $def_orderdir; + + /* fallback defaults */ + if (!isset($orderkey) || !in_array($orderkey, $cols)) + $orderkey = "ID"; + if ($orderdir != "asc" && $orderdir != "desc") + $orderdir = "asc"; + + $opporderdir = ($orderdir == "asc" ? "desc" : "asc"); + foreach ($cols as $col) { + if ($col == $orderkey) { + echo " <th class=\"minor\"><a href=\"index.php?orderkey=${col}&orderdir=${opporderdir}\">$col</a>"; + echo "<sup>".($orderdir== "asc" ? + /* "↓" : "↑" */ + "+" : "-" + )."</sup>"; + echo "</th>\n"; + } else + echo " <th class=\"minor\"><a href=\"index.php?orderkey=${col}&orderdir=asc\">$col</a></th>\n"; + } +?> +</tr> +<!-- <?=print_r($PREF)?> <?=$PREF["maxnodeage"]?> --> +<? + $infinite = 100000000; + $result = mysql_query("SELECT" + ." admin.nodeid AS ID" + .", admin.nodename AS Name" + .", physaddr.suburb AS Suburb" + .", admin.status AS Status" + .", TO_DAYS(NOW())-TO_DAYS(admin.updated) AS Age" + .", (e IS NOT NULL AND n IS NOT NULL) AS Map" + .", COUNT(netloc.ifname) AS Ifs" + .($havecmp ? + ",IFNULL(SQRT(POW(e - $cmpe,2)+POW(n - $cmpn,2))," + ."$infinite) AS Distance" : "") + ." FROM physaddr,physloc,admin" + ." LEFT JOIN netloc ON admin.nodeid=netloc.nodeid" + ." WHERE physaddr.nodeid = admin.nodeid" + ." AND physloc.nodeid = admin.nodeid" + ." AND to_days(now()) - to_days(admin.updated) <= " . $PREF["maxnodeage"] + ." GROUP BY admin.nodeid" + ." ORDER BY $orderkey $orderdir" + .($PREF["indexlimit"] > 0 ? " LIMIT ".$PREF["indexlimit"] : "") + , $db) + or die(mysql_error($db)); + + while ($row = mysql_fetch_assoc($result)) { + $nodeid = $row["ID"]; + if ($nodeid == $PREF["myid"]) + echo "<tr class=\"myrow\">\n"; + else + echo "<tr>\n"; + foreach($cols as $col) { + $v = htmlspecialchars($row[$col]); + if ($col == "Status") + echo " <td class=\"$col $v\">"; + else + echo " <td class=\"$col\">"; + if ($col == "Ifs" && $v == "0") + $v = " "; + else if ($col == "Ifs") + $v = "<a href=\"touchgraph.php?nodeid=$nodeid\">$v</a>"; + if ($col == "Name") + echo "<a href=\"view.php?nodeid=$nodeid\">$v</a>"; + else if ($col == "Age" && $row[$col] > 0) + echo $v."d"; + else if ($col == "Age") + echo " "; + else if ($col == "Map") + echo ($row[$col] ? " " : + "no"); + else if ($col == "Distance" && + ($v == "" || $v >= $infinite)) + echo " "; + else if ($col == "Distance") + echo sprintf("%.1fkm", $v/1000); + else + echo $v; + echo "</td>\n"; + } +?> +</tr> +<? + } +?> +</table> + +<? if ($PREF["indexlimit"] > 0) { ?> + <br>(List <a href="cookies.php">limited</a> to <?=$PREF["indexlimit"]?> entries.) +<? } ?> + +</td> + +<? + $maps = explode(" ", trim($PREF["viewmaplist"])); + if (count($maps)) { +?> +<td> + <table> + +<? foreach ($maps as $maptype) { + if ($maptype == "net") { ?> + + <tr><th class="major">Network connectivity view</th></tr> + <tr><td valign=top><img + width=<?=$len?> height=<?=$len?> + usemap="#networkmap" + src="map4b.php?<?=$mapargb?>&nonumbers=1" + ></td> + </tr> +<? } else if ($maptype == "loc") { ?> + + <tr><th class="major">Location view</th></tr> + <tr> + <td valign=top><img + width=<?=$len?> height=<?=$len?> + usemap="#summarymap" + src="map2b.php?<?=$mapargb?>" + ></td> + </tr> + +<? } else if ($maptype == "ter") { ?> + + <tr><th class="major">Terrain view</th></tr> + <tr><td valign=top><img + width=<?=$len?> height=<?=$len?> + usemap="#summarymap" + src="map3b.php?<?=$mapargb?>" + ></td> + </tr> +<? } else if ($maptype == "elev") { + /* ignore elevation */ + } else { ?> + <tr><th class="major">Unknown: <?=htmlspecialchars($maptype)?> + </th></tr> +<? } + } /* foreach */ ?> + </table> +</td> +<? } /* if maps */ ?> +</tr> +</table> + +<p> +Select a node for more information. The meanings of the columns are: +<dl compact> +<dt>Age</dt> <dd>How long ago the entry record was modified. </dd> +<dt>Map</dt> <dd>If the site coordinates are known, and hence if +the site is displayed on maps.</dd> +<dt>Ifs</dt> <dd>Number of interfaces (network cards) that the node has.</dt> +<? if ($PREF["myid"] > 0) { ?> +<dt>Distance</dt> <dd>Distance to node #<?=$PREF["myid"]?>.</dt> +<? } ?> +</dl> +</p> + +<ul> +<li>Make key maps +<a href="index.php?imgsz=<?=$len * 2?>">bigger</a> or +<a href="index.php?imgsz=<?=$len / 2?>">smaller</a></li> +<li><a href="about.html">About this database</a></li> +<li><a href="grid-instructions.html">How to find your grid coordinates</a></li> +<li><a href="policies.html">Node access policies</a></li> +<li><a href="address.html">Address allocation</a></li> +</ul> + +<hr> +<? include("footer.inc"); ?> + +</body> +</html> |
From: <ma...@sc...> - 2006-05-01 15:08:50
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12571/www/db2 Modified Files: view.php Log Message: add link to export node to google Index: view.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/view.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- view.php 8 Nov 2004 08:35:00 -0000 1.17 +++ view.php 1 May 2006 15:08:42 -0000 1.18 @@ -1,703 +1,704 @@ -<? - include("config.php"); - include("util.php"); - - $IMGWIDTH = $PREF["imgsz"]; - if ($IMGWIDTH <= 0) - $IMGWIDTH = 300; - $IMGHEIGHT = $IMGWIDTH; - - $EDITONLY = 0; - [...1376 lines suppressed...] +<p> +The grey line on the elevation diagram indicates cartesian line-of-sight, +and is thickened to indicate the first (5th?) Fresnel zone. +Intersections with ground terrain is reasonably accurate, but +features above or below the line may be distended and not to scale. +The elevation diagram does not include buildings or trees. +The actual signal path will also be slightly curved because of refraction +due to the ground. +</p> + +<p> +NB: Path loss for 915MHz is that for 2.4GHz minus 8.5dB. +</p> +<? } ?> + +<hr> +<? include("footer.inc"); ?> + + +</body></html> |
From: <ma...@sc...> - 2006-05-01 15:02:34
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7883/www/db2 Modified Files: google.php Log Message: minor tweaks Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- google.php 1 May 2006 07:49:50 -0000 1.8 +++ google.php 1 May 2006 15:02:24 -0000 1.9 @@ -37,13 +37,7 @@ $nodeid = $HTTP_GET_VARS['nodeid']; } - /* show links to peers */ - $links = 1; - if (isset($HTTP_GET_VARS['links'])) { - $links = $HTTP_GET_VARS['links']; - } - - /* show links to peers */ + /* restrict to 2 year old nodes */ $maxdays = 365 * 2; if (isset($HTTP_GET_VARS['maxdays'])) { $maxdays = $HTTP_GET_VARS['maxdays']; @@ -61,12 +55,19 @@ $save = $HTTP_GET_VARS['save']; } - /* dont default to having folders if only one node */ + /* dont show links or folders if only one node */ + $links = 1; $folders = 1; if (isset($nodeid)) { + $links = 0; $folders = 0; } - + + /* show links to peers */ + if (isset($HTTP_GET_VARS['links'])) { + $links = $HTTP_GET_VARS['links']; + } + /* categorise by status */ if (isset($HTTP_GET_VARS['folders'])) { $folders = $HTTP_GET_VARS['folders']; |
From: <ma...@sc...> - 2006-05-01 07:50:00
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1414/www/db2 Modified Files: google.php Log Message: changed defaults, bit of tweaking Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- google.php 14 Apr 2006 17:42:11 -0000 1.7 +++ google.php 1 May 2006 07:49:50 -0000 1.8 @@ -19,6 +19,18 @@ /* give up, leaving only the error */ exit(0); } + + /* either buffer when zipping or echo text directly */ + function output($data) { + + global $zip, $kml_text; + if ($zip == 1) { + $kml_text .= $data; + } else { + echo $data; + } + + } /* restrict to one node */ if (isset($HTTP_GET_VARS['nodeid'])) { @@ -26,7 +38,7 @@ } /* show links to peers */ - $links = 0; + $links = 1; if (isset($HTTP_GET_VARS['links'])) { $links = $HTTP_GET_VARS['links']; } @@ -37,7 +49,7 @@ $maxdays = $HTTP_GET_VARS['maxdays']; } - /* send as zip file */ + /* send as zip file (speed vs bandwidth) */ $zip = 0; if (isset($HTTP_GET_VARS['zip'])) { $zip = $HTTP_GET_VARS['zip']; @@ -49,8 +61,13 @@ $save = $HTTP_GET_VARS['save']; } + /* dont default to having folders if only one node */ + $folders = 1; + if (isset($nodeid)) { + $folders = 0; + } + /* categorise by status */ - $folders = 0; if (isset($HTTP_GET_VARS['folders'])) { $folders = $HTTP_GET_VARS['folders']; } @@ -74,17 +91,39 @@ if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { - $query = $query . " order by a.status, a.nodename"; + if ($folders == 1) { + $query = $query . " order by a.status, a.nodename"; + } else { + $query = $query . " order a.nodename"; + } } /* get all nodes (query from hell to trim out garbage nodes) */ $result = mysql_query($query, $db) or nice_die(mysql_error($db)); + + /* start empty */ + $kml_text = ""; + + /* send headers if not buffering for zip */ + if ($zip == 0) { + if ($save == 1) { + //header("Content-Type: application/vnd.google-earth.kml+xml"); + /* above is broken, wont force download in mozilla (works in ie), below works for both */ + header("Content-Type: text/plain"); + header("Content-disposition: attachment; filename=brismesh.kml"); /* save as filename */ + } else { + header("Content-Type: application/vnd.google-earth.kml+xml"); + } + } + + /* cache control - comment out if testing */ + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $gmt_updated)." GMT"); /* xml header (no nice_die() after here) */ - $kml_text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - $kml_text .= "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; - $kml_text .= "<Document>\n"; + output("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); + output("<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"); + output("<Document>\n"); /* 0 used to mark "not found" later */ $rows = 0; @@ -134,51 +173,51 @@ } /* generate the next icon style */ - $kml_text .= " <Style id=\"$validStyles[$i]\">\n"; - $kml_text .= " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; - $kml_text .= " <Icon>\n"; - $kml_text .= " <href>$pallette</href>\n"; - $kml_text .= " <x>$offsetx</x>\n"; - $kml_text .= " <y>$offsety</y>\n"; - $kml_text .= " <w>$sizex</w>\n"; - $kml_text .= " <h>$sizey</h>\n"; - $kml_text .= " </Icon>\n"; - $kml_text .= " </IconStyle>\n"; + output(" <Style id=\"$validStyles[$i]\">\n"); + output(" <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"); + output(" <Icon>\n"); + output(" <href>$pallette</href>\n"); + output(" <x>$offsetx</x>\n"); + output(" <y>$offsety</y>\n"); + output(" <w>$sizex</w>\n"); + output(" <h>$sizey</h>\n"); + output(" </Icon>\n"); + output(" </IconStyle>\n"); - /* default label seems to be fine, so no change for now */ - //$kml_text .= " <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"; - //$kml_text .= " <color>7fffaaff</color>\n"; - //$kml_text .= " <scale>1.5</scale>\n"; - //$kml_text .= " </LabelStyle>\n"; + /* default label font seems to be fine, so no change for now */ + //output(" <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"); + //output(" <color>7fffaaff</color>\n"); + //output(" <scale>1.5</scale>\n"); + //output(" </LabelStyle>\n"); /* style for line extrused from ground to $alt */ - $kml_text .= " <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"; - $kml_text .= " <color>ff0000ff</color>\n"; - $kml_text .= " <width>3</width>\n"; - $kml_text .= " </LineStyle>\n"; - $kml_text .= " </Style>\n"; + output(" <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"); + output(" <color>ff0000ff</color>\n"); + output(" <width>3</width>\n"); + output(" </LineStyle>\n"); + output(" </Style>\n"); } /* style for intra node links */ - $kml_text .= " <Style id=\"linkStyle\">\n"; - $kml_text .= " <LineStyle id=\"lineStyle_linkStyle\">\n"; - $kml_text .= " <color>7fff0000</color>\n"; - $kml_text .= " <width>3</width>\n"; - $kml_text .= " </LineStyle>\n"; - $kml_text .= " <IconStyle id=\"iconStyle_linkStyle\">\n"; - $kml_text .= " <Icon>\n"; - $kml_text .= " <href>root://icons/palette-5.png</href>\n"; - $kml_text .= " <x>96</x>\n"; - $kml_text .= " <y>64</y>\n"; - $kml_text .= " <w>32</w>\n"; - $kml_text .= " <h>32</h>\n"; - $kml_text .= " </Icon>\n"; - $kml_text .= " </IconStyle>\n"; - $kml_text .= " </Style>\n"; + output(" <Style id=\"linkStyle\">\n"); + output(" <LineStyle id=\"lineStyle_linkStyle\">\n"); + output(" <color>7fff0000</color>\n"); + output(" <width>3</width>\n"); + output(" </LineStyle>\n"); + output(" <IconStyle id=\"iconStyle_linkStyle\">\n"); + output(" <Icon>\n"); + output(" <href>root://icons/palette-5.png</href>\n"); + output(" <x>96</x>\n"); + output(" <y>64</y>\n"); + output(" <w>32</w>\n"); + output(" <h>32</h>\n"); + output(" </Icon>\n"); + output(" </IconStyle>\n"); + output(" </Style>\n"); /* default enclosing folder */ - $kml_text .= "<Folder><name>BrisMESH Nodes</name>\n"; + output("<Folder><name>BrisMESH Nodes</name>\n"); $last_status = ""; while (($row = mysql_fetch_assoc($result))) { @@ -202,11 +241,17 @@ /* skip invalid values (out of zone coords) */ if ($lat == 0 || $lon == 0) { - $kml_text .= "<!-- zero lat=$lat OR lon=$lon, skipping node ".$row['nodeid']." -->/n"; + output("<!-- zero lat=$lat OR lon=$lon, skipping node ".$row['nodeid']." -->/n"); + continue; + } + + /* skip invalid values (wrong sign on lat / lon) */ + if ($lat > 0 || $lon < 0) { + output("<!-- bogus lat=$lat OR lon=$lon, skipping node ".$row['nodeid']." (probably wrong sign) -->/n"); continue; } - /* find the style to use */ + /* find the style to use, or use #default */ $style = "#default"; $i = array_search($row['status'], $validStyles); if (isset($i)) { @@ -219,34 +264,34 @@ */ if ($folders == 1 && !isset($nodeid) && $last_status != $row['status']) { if ($last_status != "") { - $kml_text .= "</Folder>\n"; + output("</Folder>\n"); } - $kml_text .= "<Folder><name>".$row['status']."</name>\n"; + output("<Folder><name>".$row['status']."</name>\n"); $last_status = $row['status']; } /* display the row */ - $kml_text .= " <Placemark>\n"; - $kml_text .= " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - $kml_text .= " <name><![CDATA[" . $row['nodename'] . "]]></name>\n"; - $kml_text .= " <styleUrl>$style</styleUrl>\n"; - $kml_text .= " <LookAt>\n"; - $kml_text .= " <longitude>$lon</longitude>\n"; - $kml_text .= " <latitude>$lat</latitude>\n"; - $kml_text .= " <range>" . 500 . "</range>\n"; - $kml_text .= " <tilt>0</tilt>\n"; - $kml_text .= " <heading>3</heading>\n"; - $kml_text .= " </LookAt>\n"; + output(" <Placemark>\n"); + output(" <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) ."<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node #".$row['nodeid']."</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"); + output(" <name><![CDATA[" . $row['nodename'] . "]]></name>\n"); + output(" <styleUrl>$style</styleUrl>\n"); + output(" <LookAt>\n"); + output(" <longitude>$lon</longitude>\n"); + output(" <latitude>$lat</latitude>\n"); + output(" <range>" . 500 . "</range>\n"); + output(" <tilt>0</tilt>\n"); + //output(" <heading>3</heading>\n"); + output(" </LookAt>\n"); /* point on the map */ - $kml_text .= " <Point>\n"; - $kml_text .= " <extrude>1</extrude>\n"; - $kml_text .= " <altitudeMode>relativeToGround</altitudeMode>\n"; - $kml_text .= " <coordinates>$lon,$lat,$alt</coordinates>\n"; - $kml_text .= " </Point>\n"; + output(" <Point>\n"); + output(" <extrude>1</extrude>\n"); + output(" <altitudeMode>relativeToGround</altitudeMode>\n"); + output(" <coordinates>$lon,$lat,$alt</coordinates>\n"); + output(" </Point>\n"); /* finish placemark */ - $kml_text .= " </Placemark>\n"; + output(" </Placemark>\n"); /* add links as placemarks */ if ($links == 1) { @@ -279,17 +324,17 @@ } /* emit the link placemark */ - $kml_text .= " <Placemark>\n"; - $kml_text .= " <name>link_".$row2['nodeid']."_to_".$row2['peerid']."</name>\n"; - $kml_text .= " <styleUrl>#linkStyle</styleUrl>\n"; - $kml_text .= " <LineString>\n"; - $kml_text .= " <altitudeMode>relativeToGround</altitudeMode>\n"; - $kml_text .= " <coordinates>\n"; - $kml_text .= " $lon1, $lat1, $alt1\n"; - $kml_text .= " $lon2, $lat2, $alt2\n"; - $kml_text .= " </coordinates>\n"; - $kml_text .= " </LineString>\n"; - $kml_text .= " </Placemark>\n"; + output(" <Placemark>\n"); + output(" <name>link_".$row2['nodeid']."_to_".$row2['peerid']."</name>\n"); + output(" <styleUrl>#linkStyle</styleUrl>\n"); + output(" <LineString>\n"); + output(" <altitudeMode>relativeToGround</altitudeMode>\n"); + output(" <coordinates>\n"); + output(" $lon1, $lat1, $alt1\n"); + output(" $lon2, $lat2, $alt2\n"); + output(" </coordinates>\n"); + output(" </LineString>\n"); + output(" </Placemark>\n"); } @@ -309,36 +354,23 @@ /* if we got no rows, display an error */ if ($rows == 0) { if (isset($nodeid)) { - $kml_text .= "<Folder><name>Node ".$nodeid." not valid.</name></Folder>"; + output("<Folder><name>Node ".$nodeid." not valid.</name></Folder>"); } else { - $kml_text .= "<Folder><name>no results available</name></Folder>"; + output("<Folder><name>no results available</name></Folder>"); } } if ($folders) { - $kml_text .= "</Folder>\n"; + output("</Folder>\n"); } /* xml footer */ - $kml_text .= "</Folder>\n"; - $kml_text .= "</Document>\n"; - $kml_text .= "</kml>\n"; - - /* cache control - comment out if testing */ - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $gmt_updated)." GMT"); + output("</Folder>\n"); + output("</Document>\n"); + output("</kml>\n"); - if ($zip == 0) { - - /* send headers */ - header("Content-Type: application/vnd.google-earth.kml+xml"); - if ($save == 1) { - header("Content-disposition: attachment; filename=brismesh.kml"); - } - - /* send plain text */ - echo $kml_text; - - } else { + /* zip the buffered text */ + if ($zip == 1) { /* instantiate the zipfile */ $theZip = new zipfile; @@ -347,13 +379,18 @@ $theZip->add_file($kml_text, "doc.kml"); /* content type */ - header('Content-Type: application/vnd.google-earth.kmz'); if ($save == 1) { - header("Content-disposition: attachment; filename=brismesh.kmz"); + //header('Content-Type: application/vnd.google-earth.kmz'); + /* above is broken, wont force download in mozilla (works in ie), below works for both */ + header("Content-Type: application/octet-stream"); + header("Content-disposition: attachment; filename=brismesh.kmz"); /* save as filename */ + } else { + header('Content-Type: application/vnd.google-earth.kmz'); } /* send zip */ print ($theZip->file); } -?> + +?> \ No newline at end of file |
From: <ma...@sc...> - 2006-04-14 17:42:24
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30051 Modified Files: google.php Log Message: added a "save" option to force a save dialog box, and added a "folders" option to categorize nodes by status. Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- google.php 14 Apr 2006 14:21:05 -0000 1.6 +++ google.php 14 Apr 2006 17:42:11 -0000 1.7 @@ -42,6 +42,18 @@ if (isset($HTTP_GET_VARS['zip'])) { $zip = $HTTP_GET_VARS['zip']; } + + /* dont launch in google earth */ + $save = 0; + if (isset($HTTP_GET_VARS['save'])) { + $save = $HTTP_GET_VARS['save']; + } + + /* categorise by status */ + $folders = 0; + if (isset($HTTP_GET_VARS['folders'])) { + $folders = $HTTP_GET_VARS['folders']; + } /* Connect */ $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); @@ -62,18 +74,15 @@ if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { - $query = $query . " order by a.nodename"; + $query = $query . " order by a.status, a.nodename"; } /* get all nodes (query from hell to trim out garbage nodes) */ $result = mysql_query($query, $db) or nice_die(mysql_error($db)); - /* kml file as a string */ - $kml_text = ""; - /* xml header (no nice_die() after here) */ - $kml_text .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + $kml_text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $kml_text .= "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; $kml_text .= "<Document>\n"; @@ -169,7 +178,8 @@ $kml_text .= " </Style>\n"; /* default enclosing folder */ - $kml_text .= "<Folder><name>brismesh.org</name>\n"; + $kml_text .= "<Folder><name>BrisMESH Nodes</name>\n"; + $last_status = ""; while (($row = mysql_fetch_assoc($result))) { @@ -192,7 +202,7 @@ /* skip invalid values (out of zone coords) */ if ($lat == 0 || $lon == 0) { - $kml_text .= "<!-- zero lat=$lat OR lon=$lon, skipping node $row['nodeid'] -->/n"; + $kml_text .= "<!-- zero lat=$lat OR lon=$lon, skipping node ".$row['nodeid']." -->/n"; continue; } @@ -203,6 +213,18 @@ $style="#$validStyles[$i]"; } + /* + * break up nodes by status - emitting a folder whenever consecutive status fields change + * this relies on the ORDER BY clause being present in the query above.. + */ + if ($folders == 1 && !isset($nodeid) && $last_status != $row['status']) { + if ($last_status != "") { + $kml_text .= "</Folder>\n"; + } + $kml_text .= "<Folder><name>".$row['status']."</name>\n"; + $last_status = $row['status']; + } + /* display the row */ $kml_text .= " <Placemark>\n"; $kml_text .= " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; @@ -292,6 +314,10 @@ $kml_text .= "<Folder><name>no results available</name></Folder>"; } } + + if ($folders) { + $kml_text .= "</Folder>\n"; + } /* xml footer */ $kml_text .= "</Folder>\n"; @@ -304,8 +330,11 @@ if ($zip == 0) { /* send headers */ - header("application/vnd.google-earth.kml+xml"); - + header("Content-Type: application/vnd.google-earth.kml+xml"); + if ($save == 1) { + header("Content-disposition: attachment; filename=brismesh.kml"); + } + /* send plain text */ echo $kml_text; @@ -318,8 +347,11 @@ $theZip->add_file($kml_text, "doc.kml"); /* content type */ - header('Content-Type: application/vnd.google-earth.kmz'); - + header('Content-Type: application/vnd.google-earth.kmz'); + if ($save == 1) { + header("Content-disposition: attachment; filename=brismesh.kmz"); + } + /* send zip */ print ($theZip->file); |
From: <ma...@sc...> - 2006-04-14 17:30:56
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24264 Modified Files: zipfile.php Log Message: remove stupid white space Index: zipfile.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/zipfile.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- zipfile.php 14 Apr 2006 14:14:29 -0000 1.1 +++ zipfile.php 14 Apr 2006 17:30:41 -0000 1.2 @@ -1,4 +1,4 @@ - <?php +<?php /* * (freely) Gotten from : http://www.zend.com/zend/spotlight/creating-zip-files2.php @@ -191,4 +191,4 @@ } } - ?> \ No newline at end of file +?> \ No newline at end of file |
From: <ma...@sc...> - 2006-04-14 14:21:13
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13899 Modified Files: google.php Log Message: minor fixup Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- google.php 14 Apr 2006 14:14:29 -0000 1.5 +++ google.php 14 Apr 2006 14:21:05 -0000 1.6 @@ -192,7 +192,7 @@ /* skip invalid values (out of zone coords) */ if ($lat == 0 || $lon == 0) { - echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; + $kml_text .= "<!-- zero lat=$lat OR lon=$lon, skipping node $row['nodeid'] -->/n"; continue; } |
From: <ma...@sc...> - 2006-04-14 14:14:41
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7355 Modified Files: google.php Added Files: zipfile.php Log Message: added optional zipping ability to google.pgp google earth export function (disabled by default) and a php class to do zipping, from a freely available source. does the zipping in memory, no temporary files. --- NEW FILE: zipfile.php --- <?php /* * (freely) Gotten from : http://www.zend.com/zend/spotlight/creating-zip-files2.php */ /* Zip file creation class makes zip files on the fly... use the functions add_dir() and add_file() to build the zip file; see example code below by Eric Mueller http://www.themepark.com v1.1 9-20-01 - added comments to example v1.0 2-5-01 initial version with: - class appearance - add_file() and file() methods - gzcompress() output hacking by Denis O.Philippov, web...@at..., http://www.atlant.ru */ // official ZIP file format: http://www. // pkware.com/appnote.txt class zipfile { var $datasec = array(); // array to store compressed data var $ctrl_dir = array(); // central directory var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record var $old_offset = 0; function add_dir($name) // adds "directory" to archive - do this before putting any files in directory! // $name - name of directory... like this: "path/" // ...then you can add files using add_file with names like "path/file.txt" { $name = str_replace("\\", "/", $name); $fr = "\x50\x4b\x03\x04"; $fr .= "\x0a\x00"; // ver needed to extract $fr .= "\x00\x00"; // gen purpose bit flag $fr .= "\x00\x00"; // compression method $fr .= "\x00\x00\x00\x00"; // last mod time and date $fr .= pack("V",0); // crc32 $fr .= pack("V",0); //compressed filesize $fr .= pack("V",0); //uncompressed filesize $fr .= pack("v", strlen($name) ); //length of pathname $fr .= pack("v", 0 ); //extra field length $fr .= $name; // end of "local file header" segment // no "file data" segment for path // "data descriptor" segment (optional but necessary if archive is not served as file) $fr .= pack("V",$crc); //crc32 $fr .= pack("V",$c_len); //compressed filesize $fr .= pack("V",$unc_len); //uncompressed filesize // add this entry to array $this -> datasec[] = $fr; $new_offset = strlen(implode("", $this->datasec)); // ext. file attributes mirrors MS-DOS directory attr byte, detailed // at http://support.microsoft.com/support/kb/articles/Q125/0/19.asp // now add to central record $cdrec = "\x50\x4b\x01\x02"; $cdrec .="\x00\x00"; // version made by $cdrec .="\x0a\x00"; // version needed to extract $cdrec .="\x00\x00"; // gen purpose bit flag $cdrec .="\x00\x00"; // compression method $cdrec .="\x00\x00\x00\x00"; // last mod time & date $cdrec .= pack("V",0); // crc32 $cdrec .= pack("V",0); //compressed filesize $cdrec .= pack("V",0); //uncompressed filesize $cdrec .= pack("v", strlen($name) ); //length of filename $cdrec .= pack("v", 0 ); //extra field length $cdrec .= pack("v", 0 ); //file comment length $cdrec .= pack("v", 0 ); //disk number start $cdrec .= pack("v", 0 ); //internal file attributes $ext = "\x00\x00\x10\x00"; $ext = "\xff\xff\xff\xff"; $cdrec .= pack("V", 16 ); //external file attributes - 'directory' bit set $cdrec .= pack("V", $this -> old_offset ); //relative offset of local header $this -> old_offset = $new_offset; $cdrec .= $name; // optional extra field, file comment goes here // save to array $this -> ctrl_dir[] = $cdrec; } function add_file($data, $name) // adds "file" to archive // $data - file contents // $name - name of file in archive. Add path if your want { $name = str_replace("\\", "/", $name); //$name = str_replace("\\", "\\\\", $name); $fr = "\x50\x4b\x03\x04"; $fr .= "\x14\x00"; // ver needed to extract $fr .= "\x00\x00"; // gen purpose bit flag $fr .= "\x08\x00"; // compression method $fr .= "\x00\x00\x00\x00"; // last mod time and date $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); $zdata = substr( substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug $c_len = strlen($zdata); $fr .= pack("V",$crc); // crc32 $fr .= pack("V",$c_len); //compressed filesize $fr .= pack("V",$unc_len); //uncompressed filesize $fr .= pack("v", strlen($name) ); //length of filename $fr .= pack("v", 0 ); //extra field length $fr .= $name; // end of "local file header" segment // "file data" segment $fr .= $zdata; // "data descriptor" segment (optional but necessary if archive is not served as file) $fr .= pack("V",$crc); //crc32 $fr .= pack("V",$c_len); //compressed filesize $fr .= pack("V",$unc_len); //uncompressed filesize // add this entry to array $this -> datasec[] = $fr; $new_offset = strlen(implode("", $this->datasec)); // now add to central directory record $cdrec = "\x50\x4b\x01\x02"; $cdrec .="\x00\x00"; // version made by $cdrec .="\x14\x00"; // version needed to extract $cdrec .="\x00\x00"; // gen purpose bit flag $cdrec .="\x08\x00"; // compression method $cdrec .="\x00\x00\x00\x00"; // last mod time & date $cdrec .= pack("V",$crc); // crc32 $cdrec .= pack("V",$c_len); //compressed filesize $cdrec .= pack("V",$unc_len); //uncompressed filesize $cdrec .= pack("v", strlen($name) ); //length of filename $cdrec .= pack("v", 0 ); //extra field length $cdrec .= pack("v", 0 ); //file comment length $cdrec .= pack("v", 0 ); //disk number start $cdrec .= pack("v", 0 ); //internal file attributes $cdrec .= pack("V", 32 ); //external file attributes - 'archive' bit set $cdrec .= pack("V", $this -> old_offset ); //relative offset of local header // &n // bsp; echo "old offset is ".$this->old_offset.", new offset is $new_offset<br>"; $this -> old_offset = $new_offset; $cdrec .= $name; // optional extra field, file comment goes here // save to central directory $this -> ctrl_dir[] = $cdrec; } function file() { // dump out file $data = implode("", $this -> datasec); $ctrldir = implode("", $this -> ctrl_dir); return $data. $ctrldir. $this -> eof_ctrl_dir. pack("v", sizeof($this -> ctrl_dir)). // total # of entries "on this disk" pack("v", sizeof($this -> ctrl_dir)). // total # of entries overall pack("V", strlen($ctrldir)). // size of central dir pack("V", strlen($data)). // offset to start of central dir "\x00\x00"; // .zip file comment length } } ?> Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- google.php 14 Apr 2006 13:08:20 -0000 1.4 +++ google.php 14 Apr 2006 14:14:29 -0000 1.5 @@ -1,18 +1,22 @@ <? include("config.php"); include("util.php"); - - /* declare content type */ - header("Content-Type: application/keyhole"); - //header("Content-Type: text/plain"); /* TEST ONLY */ + include("zipfile.php"); function nice_die($error) { + + /* return xml header */ + header("application/vnd.google-earth.kml+xml"); + + /* return error message*/ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; echo " <Document>\n"; echo " <Folder><name>error: $error</name></Folder>\n"; echo " </Document>\n"; echo "</kml>\n"; + + /* give up, leaving only the error */ exit(0); } @@ -33,20 +37,23 @@ $maxdays = $HTTP_GET_VARS['maxdays']; } + /* send as zip file */ + $zip = 0; + if (isset($HTTP_GET_VARS['zip'])) { + $zip = $HTTP_GET_VARS['zip']; + } + /* Connect */ $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or nice_die(mysql_error($db)); - /* Last modified header */ + /* for last modified header */ $result = mysql_query("SELECT max(unix_timestamp(updated)) from admin", $db) or nice_die(mysql_error($db)); $row = mysql_fetch_row($result); - $updated = intval($row[0]); + $gmt_updated = intval($row[0]); - /* comment this out if testing */ - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); - /* give back memory */ mysql_free_result($result); @@ -62,10 +69,13 @@ $result = mysql_query($query, $db) or nice_die(mysql_error($db)); + /* kml file as a string */ + $kml_text = ""; + /* xml header (no nice_die() after here) */ - echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; - echo "<Document>\n"; + $kml_text .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; + $kml_text .= "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; + $kml_text .= "<Document>\n"; /* 0 used to mark "not found" later */ $rows = 0; @@ -115,51 +125,51 @@ } /* generate the next icon style */ - echo " <Style id=\"$validStyles[$i]\">\n"; - echo " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; - echo " <Icon>\n"; - echo " <href>$pallette</href>\n"; - echo " <x>$offsetx</x>\n"; - echo " <y>$offsety</y>\n"; - echo " <w>$sizex</w>\n"; - echo " <h>$sizey</h>\n"; - echo " </Icon>\n"; - echo " </IconStyle>\n"; + $kml_text .= " <Style id=\"$validStyles[$i]\">\n"; + $kml_text .= " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; + $kml_text .= " <Icon>\n"; + $kml_text .= " <href>$pallette</href>\n"; + $kml_text .= " <x>$offsetx</x>\n"; + $kml_text .= " <y>$offsety</y>\n"; + $kml_text .= " <w>$sizex</w>\n"; + $kml_text .= " <h>$sizey</h>\n"; + $kml_text .= " </Icon>\n"; + $kml_text .= " </IconStyle>\n"; /* default label seems to be fine, so no change for now */ - //echo " <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"; - //echo " <color>7fffaaff</color>\n"; - //echo " <scale>1.5</scale>\n"; - //echo " </LabelStyle>\n"; + //$kml_text .= " <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"; + //$kml_text .= " <color>7fffaaff</color>\n"; + //$kml_text .= " <scale>1.5</scale>\n"; + //$kml_text .= " </LabelStyle>\n"; /* style for line extrused from ground to $alt */ - echo " <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"; - echo " <color>ff0000ff</color>\n"; - echo " <width>3</width>\n"; - echo " </LineStyle>\n"; - echo " </Style>\n"; + $kml_text .= " <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"; + $kml_text .= " <color>ff0000ff</color>\n"; + $kml_text .= " <width>3</width>\n"; + $kml_text .= " </LineStyle>\n"; + $kml_text .= " </Style>\n"; } /* style for intra node links */ - echo " <Style id=\"linkStyle\">\n"; - echo " <LineStyle id=\"lineStyle_linkStyle\">\n"; - echo " <color>7fff0000</color>\n"; - echo " <width>3</width>\n"; - echo " </LineStyle>\n"; - echo " <IconStyle id=\"iconStyle_linkStyle\">\n"; - echo " <Icon>\n"; - echo " <href>root://icons/palette-5.png</href>\n"; - echo " <x>96</x>\n"; - echo " <y>64</y>\n"; - echo " <w>32</w>\n"; - echo " <h>32</h>\n"; - echo " </Icon>\n"; - echo " </IconStyle>\n"; - echo " </Style>\n"; + $kml_text .= " <Style id=\"linkStyle\">\n"; + $kml_text .= " <LineStyle id=\"lineStyle_linkStyle\">\n"; + $kml_text .= " <color>7fff0000</color>\n"; + $kml_text .= " <width>3</width>\n"; + $kml_text .= " </LineStyle>\n"; + $kml_text .= " <IconStyle id=\"iconStyle_linkStyle\">\n"; + $kml_text .= " <Icon>\n"; + $kml_text .= " <href>root://icons/palette-5.png</href>\n"; + $kml_text .= " <x>96</x>\n"; + $kml_text .= " <y>64</y>\n"; + $kml_text .= " <w>32</w>\n"; + $kml_text .= " <h>32</h>\n"; + $kml_text .= " </Icon>\n"; + $kml_text .= " </IconStyle>\n"; + $kml_text .= " </Style>\n"; /* default enclosing folder */ - echo "<Folder><name>brismesh.org</name>\n"; + $kml_text .= "<Folder><name>brismesh.org</name>\n"; while (($row = mysql_fetch_assoc($result))) { @@ -194,27 +204,27 @@ } /* display the row */ - echo " <Placemark>\n"; - echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - echo " <name><![CDATA[" . $row['nodename'] . "]]></name>\n"; - echo " <styleUrl>$style</styleUrl>\n"; - echo " <LookAt>\n"; - echo " <longitude>$lon</longitude>\n"; - echo " <latitude>$lat</latitude>\n"; - echo " <range>" . 500 . "</range>\n"; - echo " <tilt>0</tilt>\n"; - echo " <heading>3</heading>\n"; - echo " </LookAt>\n"; + $kml_text .= " <Placemark>\n"; + $kml_text .= " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; + $kml_text .= " <name><![CDATA[" . $row['nodename'] . "]]></name>\n"; + $kml_text .= " <styleUrl>$style</styleUrl>\n"; + $kml_text .= " <LookAt>\n"; + $kml_text .= " <longitude>$lon</longitude>\n"; + $kml_text .= " <latitude>$lat</latitude>\n"; + $kml_text .= " <range>" . 500 . "</range>\n"; + $kml_text .= " <tilt>0</tilt>\n"; + $kml_text .= " <heading>3</heading>\n"; + $kml_text .= " </LookAt>\n"; /* point on the map */ - echo " <Point>\n"; - echo " <extrude>1</extrude>\n"; - echo " <altitudeMode>relativeToGround</altitudeMode>\n"; - echo " <coordinates>$lon,$lat,$alt</coordinates>\n"; - echo " </Point>\n"; + $kml_text .= " <Point>\n"; + $kml_text .= " <extrude>1</extrude>\n"; + $kml_text .= " <altitudeMode>relativeToGround</altitudeMode>\n"; + $kml_text .= " <coordinates>$lon,$lat,$alt</coordinates>\n"; + $kml_text .= " </Point>\n"; /* finish placemark */ - echo " </Placemark>\n"; + $kml_text .= " </Placemark>\n"; /* add links as placemarks */ if ($links == 1) { @@ -247,17 +257,17 @@ } /* emit the link placemark */ - echo " <Placemark>\n"; - echo " <name>link_".$row2['nodeid']."_to_".$row2['peerid']."</name>\n"; - echo " <styleUrl>#linkStyle</styleUrl>\n"; - echo " <LineString>\n"; - echo " <altitudeMode>relativeToGround</altitudeMode>\n"; - echo " <coordinates>\n"; - echo " $lon1, $lat1, $alt1\n"; - echo " $lon2, $lat2, $alt2\n"; - echo " </coordinates>\n"; - echo " </LineString>\n"; - echo " </Placemark>\n"; + $kml_text .= " <Placemark>\n"; + $kml_text .= " <name>link_".$row2['nodeid']."_to_".$row2['peerid']."</name>\n"; + $kml_text .= " <styleUrl>#linkStyle</styleUrl>\n"; + $kml_text .= " <LineString>\n"; + $kml_text .= " <altitudeMode>relativeToGround</altitudeMode>\n"; + $kml_text .= " <coordinates>\n"; + $kml_text .= " $lon1, $lat1, $alt1\n"; + $kml_text .= " $lon2, $lat2, $alt2\n"; + $kml_text .= " </coordinates>\n"; + $kml_text .= " </LineString>\n"; + $kml_text .= " </Placemark>\n"; } @@ -277,14 +287,41 @@ /* if we got no rows, display an error */ if ($rows == 0) { if (isset($nodeid)) { - echo "<Folder><name>Node ".$nodeid." not valid.</name></Folder>"; + $kml_text .= "<Folder><name>Node ".$nodeid." not valid.</name></Folder>"; } else { - echo "<Folder><name>no results available</name></Folder>"; + $kml_text .= "<Folder><name>no results available</name></Folder>"; } } /* xml footer */ - echo "</Folder>\n"; - echo "</Document>\n"; - echo "</kml>\n"; + $kml_text .= "</Folder>\n"; + $kml_text .= "</Document>\n"; + $kml_text .= "</kml>\n"; + + /* cache control - comment out if testing */ + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $gmt_updated)." GMT"); + + if ($zip == 0) { + + /* send headers */ + header("application/vnd.google-earth.kml+xml"); + + /* send plain text */ + echo $kml_text; + + } else { + + /* instantiate the zipfile */ + $theZip = new zipfile; + + /* add kml data */ + $theZip->add_file($kml_text, "doc.kml"); + + /* content type */ + header('Content-Type: application/vnd.google-earth.kmz'); + + /* send zip */ + print ($theZip->file); + + } ?> |
From: <ma...@sc...> - 2006-04-14 13:08:28
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20671 Modified Files: google.php Log Message: got rid of the last few bugs, expiry now works properly Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- google.php 13 Apr 2006 18:02:40 -0000 1.3 +++ google.php 14 Apr 2006 13:08:20 -0000 1.4 @@ -13,7 +13,7 @@ echo " <Folder><name>error: $error</name></Folder>\n"; echo " </Document>\n"; echo "</kml>\n"; - return; + exit(0); } /* restrict to one node */ @@ -27,9 +27,12 @@ $links = $HTTP_GET_VARS['links']; } - /* used to mark an error */ - $rows = 0; - + /* show links to peers */ + $maxdays = 365 * 2; + if (isset($HTTP_GET_VARS['maxdays'])) { + $maxdays = $HTTP_GET_VARS['maxdays']; + } + /* Connect */ $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) @@ -42,13 +45,13 @@ $updated = intval($row[0]); /* comment this out if testing */ - //header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); /* give back memory */ mysql_free_result($result); - /* single or multiple query */ - $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null"; + /* single or multiple query (limits results to $maxdays, *unless* the node is "nan" or either end of an established link) */ + $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where (a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null) and ((DATE_SUB(CURDATE(),INTERVAL ".$maxdays." DAY) <= a.updated) or a.status = 'nan' or EXISTS (select * from netloc where peerid = a.nodeid) or EXISTS (select * from netloc where nodeid = a.nodeid))"; if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { @@ -64,8 +67,10 @@ echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; echo "<Document>\n"; - /* predefine styles to save space */ - /* start icon styles */ + /* 0 used to mark "not found" later */ + $rows = 0; + + /* predefine styles to save space later, these are referred to when the nodes and links are written out */ $validStyles = array ("nan","interest","build","gather","waiting","test","full","default"); for ($i=0; $i<8; $i++) { @@ -120,10 +125,14 @@ echo " <h>$sizey</h>\n"; echo " </Icon>\n"; echo " </IconStyle>\n"; + + /* default label seems to be fine, so no change for now */ //echo " <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"; //echo " <color>7fffaaff</color>\n"; //echo " <scale>1.5</scale>\n"; //echo " </LabelStyle>\n"; + + /* style for line extrused from ground to $alt */ echo " <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"; echo " <color>ff0000ff</color>\n"; echo " <width>3</width>\n"; @@ -138,7 +147,7 @@ echo " <color>7fff0000</color>\n"; echo " <width>3</width>\n"; echo " </LineStyle>\n"; - echo " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; + echo " <IconStyle id=\"iconStyle_linkStyle\">\n"; echo " <Icon>\n"; echo " <href>root://icons/palette-5.png</href>\n"; echo " <x>96</x>\n"; @@ -171,7 +180,7 @@ $lat = $lat_lon[0]; $lon = $lat_lon[1]; - /* skip invalid values */ + /* skip invalid values (out of zone coords) */ if ($lat == 0 || $lon == 0) { echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; continue; @@ -187,7 +196,7 @@ /* display the row */ echo " <Placemark>\n"; echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - echo " <name><![CDATA[" . htmlspecialchars($row['nodename']) . "]]></name>\n"; + echo " <name><![CDATA[" . $row['nodename'] . "]]></name>\n"; echo " <styleUrl>$style</styleUrl>\n"; echo " <LookAt>\n"; echo " <longitude>$lon</longitude>\n"; @@ -209,16 +218,17 @@ /* add links as placemarks */ if ($links == 1) { - - /* find this node's links, if none or error, do nothing */ + + /* find current node's peers, and thier locations (in eastings / northings) */ $query2 = "SELECT n.nodeid, n.peerid, p1.e as e1, p1.n as n1, p1.h as h1, p2.e as e2, p2.n as n2, p2.h as h2 from netloc n, physloc p1, physloc p2 where n.nodeid is not null and n.peerid is not null and n.nodeid=p1.nodeid and n.peerid=p2.nodeid and n.nodeid=" . $row['nodeid']; + /* find this node's links, if none or error, do nothing */ if ($result2 = mysql_query($query2, $db)) { /* now do "placemarks" for node links */ while (($row2 = mysql_fetch_assoc($result2))) { - /* convert to lat / lon for p1 */ + /* convert eastings / northings to lat / lon for nodeid */ $lat_lon1 = cvtlatlon($row2['e1'], $row2['n1']); $lat1 = $lat_lon1[0]; $lon1 = $lat_lon1[1]; @@ -227,7 +237,7 @@ $alt1 = $row2['h1']; } - /* convert to lat / lon for p2 */ + /* convert eastings / northings to lat / lon for peerid */ $lat_lon2 = cvtlatlon($row2['e2'], $row2['n2']); $lat2 = $lat_lon2[0]; $lon2 = $lat_lon2[1]; @@ -267,9 +277,9 @@ /* if we got no rows, display an error */ if ($rows == 0) { if (isset($nodeid)) { - echo "<Folder><name>no results available</name></Folder>"; + echo "<Folder><name>Node ".$nodeid." not valid.</name></Folder>"; } else { - echo "<Folder><name>Node ".$nodeid." is not valid.</name></Folder>"; + echo "<Folder><name>no results available</name></Folder>"; } } |
From: <ma...@sc...> - 2006-04-13 18:02:53
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26853 Modified Files: google.php Log Message: add display of links between nodes, turned off by default, add links=1 to the url arguments to enable it. the algoritm for trimming old nodes has been disabled for now, it wasn't very good when calculating links to nodes that had previously been excluded from display due to age. i expect this needs to be fixed before we make all-nodes functionality public Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- google.php 13 Apr 2006 12:49:23 -0000 1.2 +++ google.php 13 Apr 2006 18:02:40 -0000 1.3 @@ -4,7 +4,7 @@ /* declare content type */ header("Content-Type: application/keyhole"); - //header("Content-Type: text/plain"); + //header("Content-Type: text/plain"); /* TEST ONLY */ function nice_die($error) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -21,11 +21,10 @@ $nodeid = $HTTP_GET_VARS['nodeid']; } - /* restrict age of nodes */ - if (isset($HTTP_GET_VARS['maxdays'])) { - $maxdays = $HTTP_GET_VARS['maxdays']; - } else { - $maxdays = 365 * 2; /* default approx 2 years */ + /* show links to peers */ + $links = 0; + if (isset($HTTP_GET_VARS['links'])) { + $links = $HTTP_GET_VARS['links']; } /* used to mark an error */ @@ -49,7 +48,7 @@ mysql_free_result($result); /* single or multiple query */ - $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; + $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null"; if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { @@ -64,88 +63,55 @@ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; echo "<Document>\n"; - echo "<Folder><name>brismesh.org</name>\n"; - - while (($row = mysql_fetch_assoc($result))) { - - /* updated may be null */ - $updated = "N/A"; - if (isset($row['updated'])) { - $updated = $row['updated']; - } - /* height may be null */ - $alt = 0; - if (isset($row['h'])) { - $alt = $row['h']; - } - - /* convert to lat / lon */ - $lat_lon = cvtlatlon($row['e'], $row['n']); - $lat = $lat_lon[0]; - $lon = $lat_lon[1]; - - /* skip invalid values */ - if ($lat == 0 || $lon == 0) { - echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; - continue; - } - - /* display the row */ - echo " <Placemark>\n"; - echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - echo " <name><![CDATA[" . htmlspecialchars($row['nodename']) . "]]></name>\n"; - echo " <LookAt>\n"; - echo " <longitude>$lon</longitude>\n"; - echo " <latitude>$lat</latitude>\n"; - echo " <range>" . ($alt + 500) . "</range>\n"; - echo " <tilt>0</tilt>\n"; - echo " <heading>3</heading>\n"; - echo " </LookAt>\n"; - + /* predefine styles to save space */ + /* start icon styles */ + $validStyles = array ("nan","interest","build","gather","waiting","test","full","default"); + for ($i=0; $i<8; $i++) { + /* default pallette */ $pallette = "root://icons/palette-3.png"; $sizex = 32; $sizey = 32; - /* choose a icon for the user */ - if ($row['status'] == 'nan') { + /* create icon attribues */ + if ($validStyles[$i] == 'nan') { // landmark icon $offsetx=96; $offsety=64; - } else if ($row['status'] == 'interest') { + } else if ($validStyles[$i] == 'interest') { // small icon $pallette = "root://icons/palette-4.png"; $offsetx=32; $offsety=128; - } else if ($row['status'] == 'build' || $row['status'] == 'gather') { + } else if ($validStyles[$i] == 'build' || $validStyles[$i] == 'gather') { // bit bigger $pallette = "root://icons/palette-4.png"; $offsetx=64; $offsety=128; - } else if ($row['status'] == 'waiting') { + } else if ($validStyles[$i] == 'waiting') { // bit bigger $pallette = "root://icons/palette-4.png"; $offsetx=64; $offsety=128; - } else if ($row['status'] == 'test') { + } else if ($validStyles[$i] == 'test') { // looks like an inactive tower $offsetx=0; $offsety=64; - } else if ($row['status'] == 'full') { + } else if ($validStyles[$i] == 'full') { // looks like an active tower $offsetx=0; $offsety=96; - } else { - // low key icon + } else if ($validStyles[$i] == 'default') { + // default icon $pallette = "root://icons/palette-4.png"; $offsetx=0; $offsety=128; - } - - /* the icon to display */ - echo " <Style>\n"; - echo " <IconStyle>\n"; + } + + /* generate the next icon style */ + echo " <Style id=\"$validStyles[$i]\">\n"; + echo " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; echo " <Icon>\n"; echo " <href>$pallette</href>\n"; echo " <x>$offsetx</x>\n"; @@ -154,18 +120,145 @@ echo " <h>$sizey</h>\n"; echo " </Icon>\n"; echo " </IconStyle>\n"; + //echo " <LabelStyle id=\"labelStyle_$validStyles[$i]\">\n"; + //echo " <color>7fffaaff</color>\n"; + //echo " <scale>1.5</scale>\n"; + //echo " </LabelStyle>\n"; + echo " <LineStyle id=\"lineStyle_$validStyles[$i]\">\n"; + echo " <color>ff0000ff</color>\n"; + echo " <width>3</width>\n"; + echo " </LineStyle>\n"; echo " </Style>\n"; - + + } + + /* style for intra node links */ + echo " <Style id=\"linkStyle\">\n"; + echo " <LineStyle id=\"lineStyle_linkStyle\">\n"; + echo " <color>7fff0000</color>\n"; + echo " <width>3</width>\n"; + echo " </LineStyle>\n"; + echo " <IconStyle id=\"iconStyle_$validStyles[$i]\">\n"; + echo " <Icon>\n"; + echo " <href>root://icons/palette-5.png</href>\n"; + echo " <x>96</x>\n"; + echo " <y>64</y>\n"; + echo " <w>32</w>\n"; + echo " <h>32</h>\n"; + echo " </Icon>\n"; + echo " </IconStyle>\n"; + echo " </Style>\n"; + + /* default enclosing folder */ + echo "<Folder><name>brismesh.org</name>\n"; + + while (($row = mysql_fetch_assoc($result))) { + + /* updated may be null */ + $updated = "N/A"; + if (isset($row['updated'])) { + $updated = $row['updated']; + } + + /* height may be null */ + $alt = 0; + if (isset($row['h'])) { + $alt = $row['h']; + } + + /* convert to lat / lon */ + $lat_lon = cvtlatlon($row['e'], $row['n']); + $lat = $lat_lon[0]; + $lon = $lat_lon[1]; + + /* skip invalid values */ + if ($lat == 0 || $lon == 0) { + echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; + continue; + } + + /* find the style to use */ + $style = "#default"; + $i = array_search($row['status'], $validStyles); + if (isset($i)) { + $style="#$validStyles[$i]"; + } + + /* display the row */ + echo " <Placemark>\n"; + echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; + echo " <name><![CDATA[" . htmlspecialchars($row['nodename']) . "]]></name>\n"; + echo " <styleUrl>$style</styleUrl>\n"; + echo " <LookAt>\n"; + echo " <longitude>$lon</longitude>\n"; + echo " <latitude>$lat</latitude>\n"; + echo " <range>" . 500 . "</range>\n"; + echo " <tilt>0</tilt>\n"; + echo " <heading>3</heading>\n"; + echo " </LookAt>\n"; + /* point on the map */ - echo " <Point>\n"; - echo " <extrude>1</extrude>\n"; - echo " <altitudeMode>relativeToGround</altitudeMode>\n"; - echo " <coordinates>$lon,$lat,$alt</coordinates>\n"; - echo " </Point>\n"; + echo " <Point>\n"; + echo " <extrude>1</extrude>\n"; + echo " <altitudeMode>relativeToGround</altitudeMode>\n"; + echo " <coordinates>$lon,$lat,$alt</coordinates>\n"; + echo " </Point>\n"; + + /* finish placemark */ echo " </Placemark>\n"; + /* add links as placemarks */ + if ($links == 1) { + + /* find this node's links, if none or error, do nothing */ + $query2 = "SELECT n.nodeid, n.peerid, p1.e as e1, p1.n as n1, p1.h as h1, p2.e as e2, p2.n as n2, p2.h as h2 from netloc n, physloc p1, physloc p2 where n.nodeid is not null and n.peerid is not null and n.nodeid=p1.nodeid and n.peerid=p2.nodeid and n.nodeid=" . $row['nodeid']; + + if ($result2 = mysql_query($query2, $db)) { + + /* now do "placemarks" for node links */ + while (($row2 = mysql_fetch_assoc($result2))) { + + /* convert to lat / lon for p1 */ + $lat_lon1 = cvtlatlon($row2['e1'], $row2['n1']); + $lat1 = $lat_lon1[0]; + $lon1 = $lat_lon1[1]; + $alt1 = 0; + if (isset($row2['h1'])) { + $alt1 = $row2['h1']; + } + + /* convert to lat / lon for p2 */ + $lat_lon2 = cvtlatlon($row2['e2'], $row2['n2']); + $lat2 = $lat_lon2[0]; + $lon2 = $lat_lon2[1]; + $alt2 = 0; + if (isset($row2['h2'])) { + $alt2 = $row2['h2']; + } + + /* emit the link placemark */ + echo " <Placemark>\n"; + echo " <name>link_".$row2['nodeid']."_to_".$row2['peerid']."</name>\n"; + echo " <styleUrl>#linkStyle</styleUrl>\n"; + echo " <LineString>\n"; + echo " <altitudeMode>relativeToGround</altitudeMode>\n"; + echo " <coordinates>\n"; + echo " $lon1, $lat1, $alt1\n"; + echo " $lon2, $lat2, $alt2\n"; + echo " </coordinates>\n"; + echo " </LineString>\n"; + echo " </Placemark>\n"; + + } + + /* give back memory */ + mysql_free_result($result2); + } + } + /* count the rows */ $rows++; + } /* give back memory */ |
From: <ma...@sc...> - 2006-04-13 12:49:37
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19456 Modified Files: google.php Log Message: forgot about both html and xml data escaping. how very embrarrasment. Index: google.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/google.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- google.php 13 Apr 2006 09:51:27 -0000 1.1 +++ google.php 13 Apr 2006 12:49:23 -0000 1.2 @@ -4,6 +4,7 @@ /* declare content type */ header("Content-Type: application/keyhole"); + //header("Content-Type: text/plain"); function nice_die($error) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; @@ -42,13 +43,13 @@ $updated = intval($row[0]); /* comment this out if testing */ - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); + //header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); /* give back memory */ mysql_free_result($result); /* single or multiple query */ - $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname,n.channel,n.antspread,n.direction,n.polarisation FROM admin a, physloc p, contact c, config n where a.nodeid = p.nodeid and a.nodeid=c.nodeid and a.nodeid = n.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; + $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname FROM admin a, physloc p, contact c where a.nodeid = p.nodeid and a.nodeid=c.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { @@ -84,10 +85,16 @@ $lat = $lat_lon[0]; $lon = $lat_lon[1]; + /* skip invalid values */ + if ($lat == 0 || $lon == 0) { + echo "<!-- zero lat=$lat OR lon=$lon, skipping -->/n"; + continue; + } + /* display the row */ echo " <Placemark>\n"; - echo " <description><![CDATA[Contact's Name: ".$row['contactname']."<br>" . "View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; - echo " <name>" . $row['nodename'] . "</name>\n"; + echo " <description><![CDATA[Contact's Name: " . htmlspecialchars($row['contactname']) . "<br>View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; + echo " <name><![CDATA[" . htmlspecialchars($row['nodename']) . "]]></name>\n"; echo " <LookAt>\n"; echo " <longitude>$lon</longitude>\n"; echo " <latitude>$lat</latitude>\n"; |
From: <ma...@sc...> - 2006-04-13 11:50:33
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31904 Modified Files: footer.inc Log Message: change $this to $me ($this is a reserved name in php5) Index: footer.inc =================================================================== RCS file: /cvsroot/meshdb/www/db2/footer.inc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- footer.inc 18 Sep 2004 01:31:45 -0000 1.3 +++ footer.inc 13 Apr 2006 11:50:24 -0000 1.4 @@ -1,19 +1,19 @@ -<? -global $PREF; - -$this = basename($HTTP_SERVER_VARS['PHP_SELF']); -if ($PREF["myid"] != 0) { - $n = $PREF["myid"]; - if ($this != "view.php") - echo "<a href=\"view.php?nodeid=$n\">View #$n</a> | "; - if ($this != "edit.php") - echo "<a href=\"edit.php?nodeid=$n\">Edit #$n</a> | "; -} -if ($this != "cookies.php") - echo "<a href=\"cookies.php\">Preferences</a> | "; -if ($this != "index.php") - echo "<a href=\".\">Database index</a> | "; -?> -<a href="../">Brisbane Mesh home</a> -<br> -<a href="../copyright.html">© 2002-2004</a> +<? +global $PREF; + +$me = basename($HTTP_SERVER_VARS['PHP_SELF']); +if ($PREF["myid"] != 0) { + $n = $PREF["myid"]; + if ($me != "view.php") + echo "<a href=\"view.php?nodeid=$n\">View #$n</a> | "; + if ($me != "edit.php") + echo "<a href=\"edit.php?nodeid=$n\">Edit #$n</a> | "; +} +if ($me != "cookies.php") + echo "<a href=\"cookies.php\">Preferences</a> | "; +if ($me != "index.php") + echo "<a href=\".\">Database index</a> | "; +?> +<a href="../">Brisbane Mesh home</a> +<br> +<a href="../copyright.html">© 2002-2004</a> |
From: <ma...@sc...> - 2006-04-13 09:51:45
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28443 Added Files: google.php Log Message: page to return single nodes or all mesh nodes as s google earth .kml file --- NEW FILE: google.php --- <? include("config.php"); include("util.php"); /* declare content type */ header("Content-Type: application/keyhole"); function nice_die($error) { echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; echo " <Document>\n"; echo " <Folder><name>error: $error</name></Folder>\n"; echo " </Document>\n"; echo "</kml>\n"; return; } /* restrict to one node */ if (isset($HTTP_GET_VARS['nodeid'])) { $nodeid = $HTTP_GET_VARS['nodeid']; } /* restrict age of nodes */ if (isset($HTTP_GET_VARS['maxdays'])) { $maxdays = $HTTP_GET_VARS['maxdays']; } else { $maxdays = 365 * 2; /* default approx 2 years */ } /* used to mark an error */ $rows = 0; /* Connect */ $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or nice_die(mysql_error($db)); /* Last modified header */ $result = mysql_query("SELECT max(unix_timestamp(updated)) from admin", $db) or nice_die(mysql_error($db)); $row = mysql_fetch_row($result); $updated = intval($row[0]); /* comment this out if testing */ header("Last-Modified: ".gmdate("D, d M Y H:i:s", $updated)." GMT"); /* give back memory */ mysql_free_result($result); /* single or multiple query */ $query = "SELECT a.nodeid,a.nodename,a.status,a.updated,p.e,p.n,p.h,c.contactname,n.channel,n.antspread,n.direction,n.polarisation FROM admin a, physloc p, contact c, config n where a.nodeid = p.nodeid and a.nodeid=c.nodeid and a.nodeid = n.nodeid and p.e is not NULL and p.n is not null and (DATE_SUB(CURDATE(),INTERVAL $maxdays DAY) <= a.updated)"; if (isset($nodeid)) { $query = $query . " and a.nodeid=$nodeid"; } else { $query = $query . " order by a.nodename"; } /* get all nodes (query from hell to trim out garbage nodes) */ $result = mysql_query($query, $db) or nice_die(mysql_error($db)); /* xml header (no nice_die() after here) */ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"; echo "<Document>\n"; echo "<Folder><name>brismesh.org</name>\n"; while (($row = mysql_fetch_assoc($result))) { /* updated may be null */ $updated = "N/A"; if (isset($row['updated'])) { $updated = $row['updated']; } /* height may be null */ $alt = 0; if (isset($row['h'])) { $alt = $row['h']; } /* convert to lat / lon */ $lat_lon = cvtlatlon($row['e'], $row['n']); $lat = $lat_lon[0]; $lon = $lat_lon[1]; /* display the row */ echo " <Placemark>\n"; echo " <description><![CDATA[Contact's Name: ".$row['contactname']."<br>" . "View <a href=\"http://www.itee.uq.edu.au/~mesh/db-srtm/view.php?nodeid=".$row['nodeid']."\">Node Details</a> on BrisMESH<br>Last Updated: ".$updated."]]></description>\n"; echo " <name>" . $row['nodename'] . "</name>\n"; echo " <LookAt>\n"; echo " <longitude>$lon</longitude>\n"; echo " <latitude>$lat</latitude>\n"; echo " <range>" . ($alt + 500) . "</range>\n"; echo " <tilt>0</tilt>\n"; echo " <heading>3</heading>\n"; echo " </LookAt>\n"; /* default pallette */ $pallette = "root://icons/palette-3.png"; $sizex = 32; $sizey = 32; /* choose a icon for the user */ if ($row['status'] == 'nan') { // landmark icon $offsetx=96; $offsety=64; } else if ($row['status'] == 'interest') { // small icon $pallette = "root://icons/palette-4.png"; $offsetx=32; $offsety=128; } else if ($row['status'] == 'build' || $row['status'] == 'gather') { // bit bigger $pallette = "root://icons/palette-4.png"; $offsetx=64; $offsety=128; } else if ($row['status'] == 'waiting') { // bit bigger $pallette = "root://icons/palette-4.png"; $offsetx=64; $offsety=128; } else if ($row['status'] == 'test') { // looks like an inactive tower $offsetx=0; $offsety=64; } else if ($row['status'] == 'full') { // looks like an active tower $offsetx=0; $offsety=96; } else { // low key icon $pallette = "root://icons/palette-4.png"; $offsetx=0; $offsety=128; } /* the icon to display */ echo " <Style>\n"; echo " <IconStyle>\n"; echo " <Icon>\n"; echo " <href>$pallette</href>\n"; echo " <x>$offsetx</x>\n"; echo " <y>$offsety</y>\n"; echo " <w>$sizex</w>\n"; echo " <h>$sizey</h>\n"; echo " </Icon>\n"; echo " </IconStyle>\n"; echo " </Style>\n"; /* point on the map */ echo " <Point>\n"; echo " <extrude>1</extrude>\n"; echo " <altitudeMode>relativeToGround</altitudeMode>\n"; echo " <coordinates>$lon,$lat,$alt</coordinates>\n"; echo " </Point>\n"; echo " </Placemark>\n"; /* count the rows */ $rows++; } /* give back memory */ mysql_free_result($result); /* if we got no rows, display an error */ if ($rows == 0) { if (isset($nodeid)) { echo "<Folder><name>no results available</name></Folder>"; } else { echo "<Folder><name>Node ".$nodeid." is not valid.</name></Folder>"; } } /* xml footer */ echo "</Folder>\n"; echo "</Document>\n"; echo "</kml>\n"; ?> |
From: <le...@pr...> - 2005-06-26 13:10:19
|
Update of /cvsroot/meshdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14707 Modified Files: Tag: leonard-dev README.setup Log Message: extra notes on win32 Index: README.setup =================================================================== RCS file: /cvsroot/meshdb/src/Attic/README.setup,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- README.setup 7 Nov 2004 09:42:55 -0000 1.1.2.1 +++ README.setup 26 Jun 2005 13:10:09 -0000 1.1.2.2 @@ -41,7 +41,7 @@ but has a restrictive licence, is not free in VPF format and also requires a registration.) -2. Install required software: +2b Install required software: - mysql (server) - apache (web server) @@ -52,6 +52,20 @@ - zlib - gcc, make +2c For Win32: + - http://www.mingw.org/ + - http://gnuwin32.sourceforge.net/packages/libgw32c.htm + - http://gnuwin32.sourceforge.net/packages/libpng.htm + - http://gnuwin32.sourceforge.net/packages/zlib.htm + - http://gnuwin32.sourceforge.net/packages/gd.htm + - http://gnuwin32.sourceforge.net/packages/libintl.htm + - http://gnuwin32.sourceforge.net/packages/libiconv.htm + - http://gnuwin32.sourceforge.net/packages/xpm-nox.htm + - http://gnuwin32.sourceforge.net/packages/freetype.htm + - http://gnuwin32.sourceforge.net/packages/jpeg.htm + + Edit c:\program files\gnuwin32\bin\gd-config and remove the "-lX11" + 3. Set up your MySQL server and create a 'mesh' database. (a) Create db2/config-local.php |
From: <le...@pr...> - 2005-06-25 13:22:25
|
Update of /cvsroot/meshdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9693 Added Files: Tag: leonard-dev Makefile.am Log Message: missed this --- NEW FILE: Makefile.am --- # $Id: Makefile.am,v 1.1.2.1 2005/06/25 13:22:13 leonard Exp $ SUBDIRS = geo vpf mailt ACLOCAL_AMFLAGS = -I cf |
From: <le...@pr...> - 2005-05-02 04:48:23
|
Update of /cvsroot/meshdb/src/mailt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10859 Modified Files: Tag: leonard-dev swap.c Log Message: refactor checkmail0 Index: swap.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/Attic/swap.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- swap.c 2 May 2005 04:44:18 -0000 1.1.2.1 +++ swap.c 2 May 2005 04:48:14 -0000 1.1.2.2 @@ -1,5 +1,9 @@ /* $Id$ */ +/* + * Create a mail index that is a byte-swapped version of another + */ + #if defined(HAVE_CONFIG_H) # include "config.h" #endif @@ -19,8 +23,7 @@ } /* Functions to do byte swapping */ - -#define copydecl(name, halfname, type, halftype) \ +#define copyimpl(name, halfname, type, halftype) \ static void \ name(dst, src) \ type *dst; \ @@ -33,14 +36,14 @@ } #define uint8copy(dst, src) *(dst) = *(src) -copydecl(uint16copy, uint8copy, uint16_t, uint8_t) -copydecl(uint32copy, uint16copy, uint32_t, uint16_t) -copydecl(uint64copy, uint32copy, uint64_t, uint32_t) +copyimpl(uint16copy, uint8copy, uint16_t, uint8_t) +copyimpl(uint32copy, uint16copy, uint32_t, uint16_t) +copyimpl(uint64copy, uint32copy, uint64_t, uint32_t) #define int8copy(dst, src) *(dst) = *(src); -copydecl(int16copy, int8copy, int16_t, int8_t) -copydecl(int32copy, int16copy, int32_t, int16_t) -copydecl(int64copy, int32copy, int64_t, int32_t) +copyimpl(int16copy, int8copy, int16_t, int8_t) +copyimpl(int32copy, int16copy, int32_t, int16_t) +copyimpl(int64copy, int32copy, int64_t, int32_t) #define msgidcopy uint32copy @@ -102,6 +105,25 @@ } } +static void +checkmail0(m0in, m0out) + const struct mail0 *m0in; + const struct mail0 *m0out; +{ + if (m0in->version != MAIL0_VERSION && + m0out->version != MAIL0_VERSION) { + fprintf(stderr, "version mismatch: 0x%04x (expected %x)\n", + m0in->version, MAIL0_VERSION); + exit(1); + } + if (m0in->size != sizeof *m0in && + m0out->size != sizeof *m0in) { + fprintf(stderr, "size mismatch: 0x%04x (expected %x)\n", + m0in->size, sizeof *m0in); + exit(1); + } +} + int main(argc, argv) int argc; @@ -122,26 +144,16 @@ break; perror("fread"); } + convert(&m_out, &m_in); - if (first) { - struct mail0 *m0in = (struct mail0 *)&m_in; - struct mail0 *m0out = (struct mail0 *)&m_out; - if (m0in->version != MAIL0_VERSION && - m0out->version != MAIL0_VERSION) { - fprintf(stderr, "version mismatch: 0x%04x (expected %x)\n", - m0in->version, MAIL0_VERSION); - exit(1); - } - if (m0in->size != sizeof m_in && - m0out->size != sizeof m_in) { - fprintf(stderr, "size mismatch: 0x%04x (expected %x)\n", - m0in->size, sizeof m_in); - exit(1); - } - } + + /* Check the header after conversion because I am lazy */ + if (first) + checkmail0((struct mail0 *)&m_in, (struct mail0 *)&m_out); + first = 0; + if (fwrite(&m_out, sizeof m_out, 1, stdout) != 1) perror("fwrite"); - first = 0; } fflush(stdout); exit(0); |
Update of /cvsroot/meshdb/src/mailt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10213 Modified Files: Tag: leonard-dev Makefile.am index.h mail.inc size.c update.c Added Files: Tag: leonard-dev swap.c Log Message: index structure change (now version 2). align fields; provide a "swap" utility that performs byteswap on an index file --- NEW FILE: swap.c --- /* $Id: swap.c,v 1.1.2.1 2005/05/02 04:44:18 leonard Exp $ */ #if defined(HAVE_CONFIG_H) # include "config.h" #endif #if defined(STDC_HEADERS) # include <stdio.h> #endif #include "index.h" static void usage(name) const char *name; { fprintf(stderr, "usage: %s <mbox.mi >mbox.mi.swapped\n", name); exit(1); } /* Functions to do byte swapping */ #define copydecl(name, halfname, type, halftype) \ static void \ name(dst, src) \ type *dst; \ const type *src; \ { \ halftype *hdst = (halftype *)dst; \ const halftype *hsrc = (const halftype *)src; \ halfname(&hdst[0], &hsrc[1]); \ halfname(&hdst[1], &hsrc[0]); \ } #define uint8copy(dst, src) *(dst) = *(src) copydecl(uint16copy, uint8copy, uint16_t, uint8_t) copydecl(uint32copy, uint16copy, uint32_t, uint16_t) copydecl(uint64copy, uint32copy, uint64_t, uint32_t) #define int8copy(dst, src) *(dst) = *(src); copydecl(int16copy, int8copy, int16_t, int8_t) copydecl(int32copy, int16copy, int32_t, int16_t) copydecl(int64copy, int32copy, int64_t, int32_t) #define msgidcopy uint32copy static void convert(out, in) struct mail *out; const struct mail *in; { uint32copy(&out->hdrlen, &in->hdrlen); uint32copy(&out->bodylen, &in->bodylen); uint64copy(&out->pos, &in->pos); int32copy(&out->date, &in->date); msgidcopy(&out->parent, &in->parent); msgidcopy(&out->child, &in->child); msgidcopy(&out->sibling, &in->sibling); uint16copy(&out->flags, &in->flags); uint16copy(&out->pad, &in->pad); memcpy(out->from, in->from, sizeof out->from); memcpy(out->subject, in->subject, sizeof out->subject); } static void checksize() { struct mail m; size_t total = 0; #define chk(field, bits) \ if (sizeof m.field * 8 != bits) { \ fprintf(stderr, \ "%s: mismatch field %s size %d, not %d bits\n", \ __FILE__, #field, 8 * sizeof m.field, bits); \ exit(1); \ } \ if ((int)&(((struct mail *)0)->field) * 8 != total) { \ fprintf(stderr, \ "%s: mismatch field %s offset %d, not %d\n", \ __FILE__, #field, \ (int)&(((struct mail *)0)->field), \ total / 8); \ exit(1); \ } chk(hdrlen, 32); total += 32; chk(bodylen, 32); total += 32; chk(pos, 64); total += 64; chk(date, 32); total += 32; chk(parent, 32); total += 32; chk(child, 32); total += 32; chk(sibling, 32); total += 32; chk(flags, 16); total += 16; chk(pad, 16); total += 16; chk(from, 32*8); total += 32*8; chk(subject, 60*8); total += 60*8; if (total != 8 * sizeof m) { fprintf(stderr, "%s: mismatch struct size %d(%d), not %d(%d)\n", __FILE__, 8 * sizeof m, sizeof m, total, total / 8); exit(1); } } int main(argc, argv) int argc; char *argv[]; { struct mail m_in, m_out; int first; if (argc != 1) usage(argv[0]); checksize(); first = 1; while (!feof(stdin)) { if (fread(&m_in, sizeof m_in, 1, stdin) != 1) { if (feof(stdin)) break; perror("fread"); } convert(&m_out, &m_in); if (first) { struct mail0 *m0in = (struct mail0 *)&m_in; struct mail0 *m0out = (struct mail0 *)&m_out; if (m0in->version != MAIL0_VERSION && m0out->version != MAIL0_VERSION) { fprintf(stderr, "version mismatch: 0x%04x (expected %x)\n", m0in->version, MAIL0_VERSION); exit(1); } if (m0in->size != sizeof m_in && m0out->size != sizeof m_in) { fprintf(stderr, "size mismatch: 0x%04x (expected %x)\n", m0in->size, sizeof m_in); exit(1); } } if (fwrite(&m_out, sizeof m_out, 1, stdout) != 1) perror("fwrite"); first = 0; } fflush(stdout); exit(0); } Index: Makefile.am =================================================================== RCS file: /cvsroot/meshdb/src/mailt/Attic/Makefile.am,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- Makefile.am 8 Nov 2004 12:55:31 -0000 1.1.2.3 +++ Makefile.am 2 May 2005 04:44:17 -0000 1.1.2.4 @@ -4,7 +4,7 @@ cgibindir = @cgibindir@ htmlmaildir = @htmlmaildir@ -bin_PROGRAMS = update mkill msgid +bin_PROGRAMS = update mkill msgid swap noinst_PROGRAMS = size t noinst_LIBRARIES = libmail.a libmail_a_SOURCES = index.c datetime.c open.c util.c mime.c Index: index.h =================================================================== RCS file: /cvsroot/meshdb/src/mailt/index.h,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.1.1.1.2.2 diff -u -d -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- index.h 8 Nov 2004 12:55:34 -0000 1.1.1.1.2.1 +++ index.h 2 May 2005 04:44:17 -0000 1.1.1.1.2.2 @@ -18,26 +18,28 @@ uint32_t bodylen; uint64_t pos; /* start of headers in file */ int32_t date; - char from[40]; /* Sender's name */ - char subject[60]; /* Subject text */ msgid_t parent, child, sibling; /* Thread tree */ uint16_t flags; #define FLAGS_KILLED 0x0001 /* Message has been killed */ + uint16_t pad; + char from[32]; /* Sender's name */ + char subject[60]; /* Subject text */ }; /* First entry */ struct mail0 { uint32_t size; /* size of each entry */ uint32_t version; /* version check */ -#define MAIL0_VERSION 1 +#define MAIL0_VERSION 2 uint64_t end; /* total size of mbox */ int32_t date; /* index update time */ - char ign4[40]; - char ign5[60]; msgid_t msgs; /* number of messages */ msgid_t child; /* first unparented child */ msgid_t ign8; uint16_t flags; + uint16_t pad; + char ign4[32]; + char ign5[60]; }; int index_create(int fd); Index: mail.inc =================================================================== RCS file: /cvsroot/meshdb/src/mailt/mail.inc,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.3 diff -u -d -r1.1.1.1.2.2 -r1.1.1.1.2.3 --- mail.inc 1 May 2005 12:28:27 -0000 1.1.1.1.2.2 +++ mail.inc 2 May 2005 04:44:17 -0000 1.1.1.1.2.3 @@ -8,11 +8,16 @@ * program reports, ideally when it is run on the same host * as the web server. */ - $FMT = "Lhdrlen/Lbodylen/Lposhi/Lposlo/Ldate/a40from" - ."/a60subject/Lparent/Lchild/Lsibling/nflags"; - $FMT0 = "Lsize/Lversion/Lendhi/Lendlo/Ldate/a40ign4" - ."/a60ign5/Lmsgs/Lchild/Lign8/nflags"; - $FMTSZ = 136; + $FMT = "Lhdrlen/Lbodylen/Lposhi/Lposlo/Ldate" + ."/Lparent/Lchild/Lsibling/nflags/npad" + ."/a32from/a60subject" + ; + $FMT0 = "Lsize/Lversion/Lendhi/Lendlo/Ldate" + ."/Lmsgs/Lchild/Lign8/nflags/npad" + ."/a32ign4/a60ign5" + ; + $MAIL0_VERSION = 2; + $FMTSZ = 128; $KILLED = 1; /* off_t is a 64-bit value. (php probably doesnt handle it) */ @@ -22,15 +27,16 @@ /* Open an mbox/index file pair */ function openmbox($mbox, $index="") { - global $FMT, $FMT0, $FMTSZ; + global $FMT, $FMT0, $FMTSZ, $MAIL0_VERSION; if ($index == "") $index = $mbox . ".mi"; $mbxf = fopen($mbox, "rb"); $idxf = fopen($index, "rb"); $m0 = unpack($FMT0, fread($idxf, $FMTSZ)); if ($m0['size'] != $FMTSZ - || $m0['version'] != 1) { - die("$index: bad format"); + || $m0['version'] != $MAIL0_VERSION) { + die("$index: bad format; size=".$m0['size'] + ." version=".$m0['version']); } /* $m0["end"] = quad($m0["endlo"], $m0["endhi"]); */ fseek($idxf, 0); Index: size.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/size.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- size.c 8 Nov 2004 12:55:34 -0000 1.2.2.1 +++ size.c 2 May 2005 04:44:18 -0000 1.2.2.2 @@ -35,29 +35,32 @@ main() { printf("\t$FMT = \""); - P(mail, hdrlen); putchar('/'); - P(mail, bodylen); putchar('/'); - P(mail, pos); putchar('/'); - P(mail, date); putchar('/'); - P(mail, from); printf("\"\n\t\t.\"/"); - P(mail, subject); putchar('/'); - P(mail, parent); putchar('/'); - P(mail, child); putchar('/'); - P(mail, sibling); putchar('/'); - P(mail, flags); printf("\";\n"); + P(mail, hdrlen); putchar('/'); + P(mail, bodylen); putchar('/'); + P(mail, pos); putchar('/'); + P(mail, date); putchar('/'); + P(mail, parent); putchar('/'); + P(mail, child); putchar('/'); + P(mail, sibling); putchar('/'); + P(mail, flags); putchar('/'); + P(mail, pad); putchar('/'); + P(mail, from); putchar('/'); + P(mail, subject); printf("\";\n"); printf("\t$FMT0 = \""); - P(mail0, size); putchar('/'); - P(mail0, version); putchar('/'); - P(mail0, end); putchar('/'); - P(mail0, date); putchar('/'); - P(mail0, ign4); printf("\"\n\t\t.\"/"); - P(mail0, ign5); putchar('/'); - P(mail0, msgs); putchar('/'); - P(mail0, child); putchar('/'); - P(mail0, ign8); putchar('/'); - P(mail0, flags); printf("\";\n"); + P(mail0, size); putchar('/'); + P(mail0, version); putchar('/'); + P(mail0, end); putchar('/'); + P(mail0, date); putchar('/'); + P(mail0, msgs); putchar('/'); + P(mail0, child); putchar('/'); + P(mail0, ign8); putchar('/'); + P(mail0, flags); putchar('/'); + P(mail0, pad); putchar('/'); + P(mail0, ign4); putchar('/'); + P(mail0, ign5); printf("\";\n"); + printf("\t$MAIL0_VERSION = %d;\n", MAIL0_VERSION); printf("\t$FMTSZ = %d;\n", sizeof (struct mail)); printf("\t$KILLED = %d;\n", FLAGS_KILLED); exit(0); Index: update.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/update.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -u -d -r1.3.2.1 -r1.3.2.2 --- update.c 8 Nov 2004 12:55:34 -0000 1.3.2.1 +++ update.c 2 May 2005 04:44:18 -0000 1.3.2.2 @@ -173,6 +173,7 @@ break; } + m->pad = 0; m->pos = start-mbox; m->hdrlen = p - start; m->bodylen = end - p; |
Update of /cvsroot/meshdb/src/mailt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27166 Modified Files: Tag: leonard-dev mail.inc subjects.php util.c util.h view.c Added Files: Tag: leonard-dev style.css Log Message: A fairly large overhaul of the mail system. * added a sample style.css sheet * introduced lots of HTML class attributes (for css) * refactored the PHP so it is easier to maintain * corrected the way findhdr() is used --- NEW FILE: style.css --- body { color: black; background: white; font-family: sans-serif; } a:hover { background: #d0d0ff; } table.header { border: thin black solid; } table.header .email { font-family: monospace; font-style: italic; } span.indent1 { color: #004000; } span.indent2 { color: #004040; } span.indent3 { color: #000040; } span.indent4 { color: #400040; } span.indent5 { color: #400000; } span.indent6 { color: #404000; } table.envelope { background: #f0fff0; border-collapse: collapse; } table.envelope th { border-right: thin green solid; text-align: right; } table.envelope th , table.envelope td { vertical-align: top; } div.navigation, p.killed, p.messageid { font-size: smaller; } div.navigation a:hover { background: #d0d0ff; } div.navigation a, div.navigation span { padding-left: 1ex; padding-right: 1ex; } div.navigation a { border: thin blue solid; text-decoration: none; } div.navigation span { border: thin #c0c0c0 solid; color: grey } div.navigation { padding-bottom: 1ex; } pre { border-top: thin solid #c0c0c0; border-bottom: thin solid #c0c0c0; } p.killed, p.messageid { padding-left: 1ex; padding-right: 1ex; } p.killed { background: #ffd0d0; border: thin red solid; } p.messageid { background: #d0d0d0; border: thin black solid; } ul.thread { font-size: small; } ul.thread .shortdate { font-size: smaller; } ul.thread .author { font-style: italic; } /* The calendar group */ div.calendar { display: block; float: right; text-align: center; } /* The year-month index */ table.bymonth { font-size: xx-small; border-collapse: collapse; background: #e8e8ff; border: 1px #c0c0e0 solid; color: grey; } table.bymonth td { padding: 0 0 0 0.5ex ; } table.bymonth th { padding: 0 0.5ex 0 0; border-right: 1px #c0c0e0 solid; } table.bymonth a { text-decoration: none; } /* The day calendar */ table.byday { background: #f0f0f0; border: none; border-collapse: collapse; } table.byday td { vertical-align: top; } table.onemonth { font-size: x-small; border: thin solid white; border-collapse: collapse; } table.onemonth td { padding: 0 0 0 0; text-align: right } table.onemonth th { font-weight: normal; padding: 0 0 0 0; } table.onemonth tr.nav { background: #e8e8e8; } table.onemonth tr.weekday { background: #e0e0e0; } table.onemonth a { text-decoration: none; } table.onemonth td.mark { background: yellow; } table.onemonth td.dimmed { color: white; } table.onemonth td a:hover { background: blue; color: white; } /* The title */ h1 { font-size: 120%; background: #f8f8f8; border-bottom: thin solid #e0e0e0; border-top: thin solid #e0e0e0; } Index: mail.inc =================================================================== RCS file: /cvsroot/meshdb/src/mailt/mail.inc,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.1.1.1.2.2 diff -u -d -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- mail.inc 8 Nov 2004 12:55:34 -0000 1.1.1.1.2.1 +++ mail.inc 1 May 2005 12:28:27 -0000 1.1.1.1.2.2 @@ -8,11 +8,11 @@ * program reports, ideally when it is run on the same host * as the web server. */ - $FMT = "Lhdrlen/Lbodylen/Lpos/Ldate/a40from" - ."/a60subject/Lparent/Lchild/Lsibling/Lflags"; - $FMT0 = "Lsize/Lversion/Lend/Ldate/a40ign4" - ."/a60ign5/Lmsgs/Lchild/Lign8/Lflags"; - $FMTSZ = 132; + $FMT = "Lhdrlen/Lbodylen/Lposhi/Lposlo/Ldate/a40from" + ."/a60subject/Lparent/Lchild/Lsibling/nflags"; + $FMT0 = "Lsize/Lversion/Lendhi/Lendlo/Ldate/a40ign4" + ."/a60ign5/Lmsgs/Lchild/Lign8/nflags"; + $FMTSZ = 136; $KILLED = 1; /* off_t is a 64-bit value. (php probably doesnt handle it) */ @@ -52,8 +52,11 @@ function getmsg($o, $i) { global $FMT, $FMT0, $FMTSZ; $i = intval($i); - if ($i < 1 || $i >= $o["m0"]["msgs"]) - die("bad message ID ".$i); + if ($i < 1 || $i >= $o["m0"]["msgs"]) { + $bt = debug_backtrace(); + die("bad message ID ".$i." from " + .($bt[0]["file"]).":".($bt[0]["line"])); + } $m = unpack($FMT, substr($o["idx"], $FMTSZ * $i, $FMTSZ)); /* $m["pos"] = quad($m["poslo"], $m["poshi"]); */ $m["o"] = $o; Index: subjects.php =================================================================== RCS file: /cvsroot/meshdb/src/mailt/subjects.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -d -r1.2.2.1 -r1.2.2.2 --- subjects.php 8 Nov 2004 13:21:26 -0000 1.2.2.1 +++ subjects.php 1 May 2005 12:28:27 -0000 1.2.2.2 @@ -1,264 +1,350 @@ -<html> -<body> -<h1>Mail archive index</h1> <? - /* $Id$ */ + +/* $Id$ */ include("mail.inc"); +$title = "Subject index"; $self = "subjects.php"; -$viewcgi = "../cgi-bin/view-list.cgi"; +#$viewcgi = "../cgi-bin/view-list.cgi"; $viewcgi = "msg"; # relies on a .htaccess file to redirect - $o = openmbox("mbox"); $msgs = $o["msgs"]; -?> - -<h1>Messages by month</h1> -<table> -<? -$MONTHS = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $first_m = getmsg($o, 1); $last_m = getmsg($o, $msgs - 1); -$first_t = localtime($first_m["date"], true); -$last_t = localtime($last_m["date"] + 1, true); -for ($y = $first_t["tm_year"]; $y <= $last_t["tm_year"]; $y++) { - $s = sprintf("%04d%02d%02d", $y+1900, 1, 1); - $f = sprintf("%04d%02d%02d", $y+1900+1, 1, 0); -?> - <tr><th><a href="<?="$self?$s-$f"?>"><?=$y+1900?></a></th> -<? - for ($m = 0; $m < 12; $m++) { - echo "<td>"; - $havemail = false; - $t1 = mktime(0,0,0,$m+1,1,$y); - $i = findmsgbydate($o, $t1); /* Find first mail after that date */ - $havemail = false; - while ($i < $msgs) { /* Skip killed msgs at start of month */ - $msg = getmsg($o, $i); - if (iskilled($m)) - $i++; - else - break; - } - if ($i < $msgs) { /* Check first mail within the month */ - $msg_t = localtime($msg["date"], true); - if ($msg_t["tm_mon"] == $m) - $havemail = true; +/* Helper functions: */ + +/* Recursively prints the subject tree for messages in the range [ilo,ihi) */ +function echomsgtree($o, $i, $ilo, $ihi, $dosib) { + global $o, $viewcgi; + $m = getmsg($o, $i); + print "<li id=\"m$i\">" + ."<span class=\"shortdate\">" + .strftime("%e %b", $m["date"]) + ."</span> " + ."<span class=\"author\">" + .htmlspecialchars($m["from"]) + ."</span> " + ."<a class=\"subject\" href=\"$viewcgi/$i\">" + .htmlspecialchars($m["subject"]) + ."</a>" + ."</li>\n"; + $c = $m["child"]; + if ($c && $ilo <= $c && $c < $ihi) { + print "<ul>\n"; + echomsgtree($o, $c, $ilo, $ihi, 1); + print "</ul>\n"; + } + if ($dosib) { + $s = $m["sibling"]; + if ($s && $ilo <= $s && $s < $ihi) + echomsgtree($o, $s, $ilo, $ihi, 1); + } +} + +/* Prints an entire messae tree */ +function show_message_tree($start_t, $finish_t) { + global $o; + /* Show message threads, within the date range */ + $ilo = findmsgbydate($o, $start_t); + $ihi = findmsgbydate($o, $finish_t); + print "<ul class=\"thread\">\n"; + for ($i = $ilo; $i < $ihi; $i++) { + $m = getmsg($o, $i); + if (iskilled($m)) continue; + $pi = $m["parent"]; + if ($pi) { + $mp = getmsg($o, $pi); + if ($mp["date"] < $start_t) + $pi = 0; } - if ($havemail) { - $s = sprintf("%04d%02d%02d", $y+1900, $m+1, 1); - $f = sprintf("%04d%02d%02d", $y+1900, $m+2, 0); - echo "<a href=\"$self?$s-$f\">".$MONTHS[$m]."</a>"; - } else - echo $MONTHS[$m]; - echo "</td>"; + if ($pi == 0) + echomsgtree($o, $i, $ilo, $ihi, 0); } -?> - </tr> -<? } ?> -</table> + print "</ul>\n"; +} -<? +/* + * Convert a date of the form "YYYYMMDD" into a time_t. + * Special times of the form ".NNN" return the time_t of a single message. + */ +function parsetime($t) { + global $o; + if (substr($t, 0, 1) == ".") { + $id = intval(substr($t, 1)); + $m = getmsg($o, $id); + if ($m) + return $m["date"]; + die("invalid message id $t"); + } - /* function to recursively print a thread */ - function echomsgtree($o, $i, $ilo, $ihi, $dosib) { - global $KILLED, $viewcgi; - $m = getmsg($o, $i); - echo "<li id=\"m$i\"> ".strftime("%e %b", $m["date"]). " ". - htmlspecialchars($m["from"]).", ". - "<a href=\"$viewcgi/$i\">". - htmlspecialchars($m["subject"]). - "</a>". - "</li>\n"; - $c = $m["child"]; - if ($c && $ilo <= $c && $c < $ihi) { - echo "<ul>\n"; - echomsgtree($o, $c, $ilo, $ihi, 1); - echo "</ul>\n"; - } - if ($dosib) { - $s = $m["sibling"]; - if ($s && $ilo <= $s && $s < $ihi) - echomsgtree($o, $s, $ilo, $ihi, 1); - } - } + return mktime(0,0,0, + intval(substr($t, 4, 2)), + intval(substr($t, 6, 2)), + intval(substr($t, 0, 4)), + -1); +} - function parsetime($t) { - if (substr($t, 0, 1) == ".") { - global $o; - $id = intval(substr($t, 1)); - $m = getmsg($o, $id); - if ($m) - return $m["date"]; - die("invalid message id $t"); - } +/* + * Generate a 'Year/Month' table, that shows the span of the entire + * archive. It looks like this: + * + * 2004 Jan Feb Mar Apr May Jun Aug Sep Oct Nov Dec + * 2005 Jan Feb Mar Apr May Jun Aug Sep Oct Nov Dec + * 2006 Jan Feb Mar Apr May Jun Aug Sep Oct Nov Dec + * + * We make the month names and year numbers hyperlinks to display + * month-only or year-only ranges, respectively. + */ +function show_bymonth_table() +{ + global $o, $last_m, $first_m, $msgs; - return mktime(0,0,0, - intval(substr($t, 4, 2)), - intval(substr($t, 6, 2)), - intval(substr($t, 0, 4)), - -1); - } + $MONTHS = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); - /* - * figure out the range of dates to display, query string is - * of the found [YYYYMMDD]-[YYYYMMDD] - */ + /* Determine the dates of the first and last messages in + * the entire archive */ + $first_t = localtime($first_m["date"], true); + $last_t = localtime($last_m["date"] + 1, true); - if ($_SERVER[QUERY_STRING] == "") { - $start_t = mktime(0,0,0,date("m"), 1, date("Y")); - $finish_t= mktime(0,0,0,date("m")+1, 1, date("Y")) - 1; - } else { - list($start, $finish) = explode("-", $_SERVER[QUERY_STRING], 2); + print "<table class=\"bymonth\">\n"; + for ($y = $first_t["tm_year"]; $y <= $last_t["tm_year"]; $y++) { + print "<tr>"; - if ($start == "") $start_t = $first_m["date"]; - else $start_t = parsetime($start); + /* The year portion */ + $year = $y + 1900; + $s = sprintf("%04d%02d%02d", $year, 1, 1); + $f = sprintf("%04d%02d%02d", $year+1, 1, 0); + $yearuri = "$self?$s-$f"; + print "<th><a href=\"$yearuri\">$year</a></th>\n" ; - if ($finish == "") $finish_t = $last_m["date"] + 1; - else $finish_t = parsetime($finish) - + 24*60*60 - 1; - } + for ($m = 0; $m < 12; $m++) { + /* The month portion - find when it starts */ + $monthname = $MONTHS[$m]; + $t1 = mktime(0,0,0,$m+1,1,$y); + $i = findmsgbydate($o, $t1); -?> - <h1>Messages from <?=strftime("%a %b %e %Y", $start_t)?> - - <?=strftime("%a %b %e %Y", $finish_t - 1)?></h1> + /* Skip killed msgs at start of month */ + while ($i < $msgs) { + $msg = getmsg($o, $i); + if (iskilled($m)) + $i++; + else + break; + } + /* Are there any messages inside this month range? */ + $havemail = false; + if ($i < $msgs) { /* Check first mail within the month */ + $msg_t = localtime($msg["date"], true); + if ($msg_t["tm_mon"] == $m) + $havemail = true; + } -<? - /* print a month table */ + /* Print the month name, and hyperlink if it has content */ + print "<td>"; + if ($havemail) { + $s = sprintf("%04d%02d%02d", $y+1900, $m+1, 1); + $f = sprintf("%04d%02d%02d", $y+1900, $m+2, 0); + $monthuri = "$self?$s-$f"; + print "<a href=\"$monthuri\">$monthname</a>"; + } else + print $monthname; + print "</td>\n"; + } /* for $m */ + print "</tr>\n"; + } /* for $y */ + print "</table>\n"; +} - $endmonth = date("n", $finish_t); - $endyear = date("Y", $finish_t); - $nmonths = 0; +/* + * Print a table of month tables, each month showing the days + * in that month, hyperlinked to the URI which displays just that day. + */ +function show_byday_table($start_t, $finish_t) +{ + global $o; + $endmonth = date("n", $finish_t); + $endyear = date("Y", $finish_t); + $nmonths = 0; + $month = date("n", $start_t); + $year = date("Y", $start_t); - $month = date("n", $start_t); - $year = date("Y", $start_t); + $NCOLS = 4; - $NCOLS = 4; + while (1) { + if ($year > $endyear || + ($year == $endyear && $month > $endmonth)) + break; - while (1) { - if ($year > $endyear || - ($year == $endyear && $month > $endmonth)) - break; + $tlo = mktime(0,0,0,$month,1,$year-1900); + $thi = mktime(0,0,0,$month+1,1,$year-1900); + $ilo = findmsgbydate($o, $tlo); + $ihi = findmsgbydate($o, $thi); - $tlo = mktime(0,0,0,$month,1,$year-1900); - $thi = mktime(0,0,0,$month+1,1,$year-1900); - $ilo = findmsgbydate($o, $tlo); - $ihi = findmsgbydate($o, $thi); + /* The month range */ + $s = sprintf("%04d%02d%02d", $year, $month, 1); + $f = sprintf("%04d%02d%02d", $year, $month+1, 0); + /* Compute URIs for the month navigation */ + $prev_month_uri = "$self?" . sprintf("%04d%02d01-%04d%02d00", + $month == 1 ? $year - 1 : $year, + $month == 1 ? 12 : $month - 1, + $year, + $month); + $this_month_uri = "$self?$s-$f"; + $this_month_name = strftime("%b", $tlo); + $this_year_uri = "$self?" . sprintf("%04d0101-%04d0100", + $year, $year + 1); + $next_month_uri = "$self?".sprintf("%04d%02d01-%04d%02d00", + $year, $month + 1, $year,$month + 2); - if ($nmonths == 0) - echo "<table border>"; - if ($nmonths % $NCOLS == 0) - echo "<tr>"; + if ($nmonths == 0) echo "<table class=\"byday\">"; + if ($nmonths % $NCOLS == 0) echo "<tr>"; - $s = sprintf("%04d%02d%02d", $year, $month, 1); - $f = sprintf("%04d%02d%02d", $year, $month+1, 0); -?> -<td> -<table> - <tr> - <td><a href="<?="$self?".sprintf("%04d%02d01-%04d%02d00", - $month == 1 ? $year - 1 : $year, $month == 1 ? 12 : $month - 1, - $year, $month)?>" - ><</a></td> - <th colspan=5><a href="<?="$self?$s-$f"?>"><?=strftime("%b", $tlo)?></a> <a href="<?="$self?".sprintf("%04d0101-%04d0100", $year, $year+1)?>"><?=$year?></a></th> - <td><a href="<?="$self?".sprintf("%04d%02d01-%04d%02d00", - $year, $month+1, $year,$month+2)?>">></a></td> - </tr> - <tr><th>Su</th><th>Mo</th><th>Tu</th><th>We</th> - <th>Th</th><th>Fr</th><th>Sa</th></tr> -<? + /* Print the month navigation links */ + print "<td><table class=\"onemonth\"><tr class=\"nav\">"; + print "<th><a href=\"$prev_month_uri\"><</a></th>"; /* Prev month */ + print "<th colspan=5>" + ."<a href=\"$this_month_uri\">" /* This month */ + .$this_month_name + ."</a> " + ."<a href=\"$this_year_uri\">$year</a>" /* This year */ + ."</th>"; + print "<th><a href=\"$next_month_uri\">></a></th>"; /* Next month */ + + print "</tr>"; + + /* Print the day-of-the-week headings */ + print "<tr class=\"weekday\">"; + foreach(array("Su","Mo","Tu","We","Th","Fr","Sa") as $dayname) + print "<th>$dayname</th>"; + + /* Print the current-month calendar */ $wkday = 0; $ti = $ilo; if ($ti < $o["msgs"]) - $mi = getmsg($o, $ti); + $mi = getmsg($o, $ti); else - $mi = ""; + $mi = ""; for ($day = 1; $day < 32; $day++) { - $t = mktime(0,0,0,$month,$day+1,$year-1900)-1; - $ta = localtime($t, true); - if ($ta["tm_mon"] != $month - 1) - break; - $count = 0; - while ($ti < $o["msgs"] && $mi["date"] <= $t) { - if (!iskilled($mi)) - $count++; - $ti++; - if ($ti < $o["msgs"]) - $mi = getmsg($o, $ti); - } - if ($wkday == 7) { echo "</tr>"; $wkday = 0; } - if ($wkday == 0) echo "<tr>"; - while ($ta["tm_wday"] != $wkday) { - echo "<td></td>"; - $wkday++; - } - if ($start_t <= $t && $t <= $finish_t) - $dim = " class=\"dimmed\""; - else - $dim = ""; - if ($count) { - $s = $f = sprintf("%04d%02d%02d", $year, $month, $day); - echo "<td$dim><a href=\"$self?$s-$f\">$day</a></td>"; - } else - echo "<td$dim>$day</td>"; + $t = mktime(0,0,0,$month,$day+1,$year-1900)-1; + $ta = localtime($t, true); + + /* Break now if this is the wrong month */ + if ($ta["tm_mon"] != $month - 1) + break; + + /* Count the number of messages in the current day */ + $count = 0; + while ($ti < $o["msgs"] && $mi["date"] <= $t) { + if (!iskilled($mi)) + $count++; + $ti++; + if ($ti < $o["msgs"]) + $mi = getmsg($o, $ti); + } + + /* End/start a new row if necessary */ + if ($wkday == 7) $wkday = 0; + if ($wkday == 0) echo "</tr><tr>"; + while ($ta["tm_wday"] != $wkday) { + echo "<td></td>"; $wkday++; + } + + /* Dim the cell if it is outside the range */ + /* if ($start_t <= $t && $t <= $finish_t) + print "<td class=\"dimmed\">"; */ + + if ($count) + print "<td class=\"mark\">"; + else + print "<td>"; + + /* Print a link to show the day's mail, if there are any */ + if ($count) { + $s = $f = sprintf("%04d%02d%02d", $year, $month, $day); + echo "<a href=\"$self?$s-$f\">$day</a>"; + } else + echo "$day"; + + print "</td>"; + $wkday++; } + /* Finish off the month table */ while ($wkday < 7) { - echo "<td></td>"; - $wkday++; + echo "<td></td>"; + $wkday++; } - echo "</tr>\n"; -?> -</table> -</td> -<? - $month++; - if ($month == 13) { - $year++; - $month = 1; - } + echo "</tr></table></td>\n"; - $nmonths++; - if ($nmonths % $NCOLS == 0) - echo "</tr>"; + /* Try the next month */ + $month++; + if ($month == 13) { + $year++; + $month = 1; } - while ($nmonths > $NCOLS && $nmonths % $NCOLS != 0) { - echo "<td></td>"; - $nmonths++; - if ($nmonths % $NCOLS == 0) - echo "</tr>"; - } - if ($nmonths) - echo "</table>"; + $nmonths++; + if ($nmonths % $NCOLS == 0) + echo "</tr>"; + } -?> + /* Finish off the table-of-months table */ + while ($nmonths > $NCOLS && $nmonths % $NCOLS != 0) { + echo "<td></td>"; + $nmonths++; + if ($nmonths % $NCOLS == 0) + echo "</tr>"; + } + if ($nmonths) + echo "</table>"; +} -<ul> -<? - /* Show message threads, within the date range */ - $ilo = findmsgbydate($o, $start_t); - $ihi = findmsgbydate($o, $finish_t); - for ($i = $ilo; $i < $ihi; $i++) { - $m = getmsg($o, $i); - if (iskilled($m)) - continue; - $pi = $m["parent"]; - if ($pi) { - $mp = getmsg($o, $pi); - if ($mp["date"] < $start_t) - $pi = 0; - } - if ($pi == 0) - echomsgtree($o, $i, $ilo, $ihi, 0); - } +/* + * Figure out the range of dates the user wants displayed. + * The QUERY_STING should be of the form [YYYYMMDD]-[YYYYMMDD] + */ +if ($_SERVER[QUERY_STRING] == "") { + $start_t = mktime(0,0,0,date("m"), 1, date("Y")); + $finish_t= mktime(0,0,0,date("m")+1, 1, date("Y")) - 1; +} else { + list($start, $finish) = explode("-", $_SERVER[QUERY_STRING], 2); + + if ($start == "") $start_t = $first_m["date"]; + else $start_t = parsetime($start); + + if ($finish == "") { + if (substr($start, 0, 1) == ".") { + $start_t = mktime(0,0,0,date("m",$start_t), 1, date("Y",$start_t)); + $finish_t= mktime(0,0,0,date("m",$start_t)+1, 1, date("Y",$start_t)) - 1; + } else + $finish_t = $last_m["date"] + 1; + } else + $finish_t = parsetime($finish) + 24*60*60 - 1; +} + +/* ------------------------------------------------------------ */ ?> -</ul> +<html> +<head> + <title><?=htmlspecialchars($title)?></title> + <link rel="stylesheet" href="style.css" type="text/css"> +</head> +<body> + +<div class="calendar"> +<? show_bymonth_table(); ?> +<? show_byday_table($start_t, $finish_t); ?> +</div> + +<h1><?=strftime("%a %b %e %Y", $start_t)?> + — + <?=strftime("%a %b %e %Y", $finish_t - 1)?></h1> +<? show_message_tree($start_t, $finish_t); ?> <hr> <small>mailt by David Leonard</small> Index: util.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/util.c,v retrieving revision 1.1.1.1.2.2 retrieving revision 1.1.1.1.2.3 diff -u -d -r1.1.1.1.2.2 -r1.1.1.1.2.3 --- util.c 8 Nov 2004 13:31:20 -0000 1.1.1.1.2.2 +++ util.c 1 May 2005 12:28:27 -0000 1.1.1.1.2.3 @@ -150,7 +150,7 @@ } /* Find occurrence of a header, starting the seach at the given position */ -cstring_t +int findhdr(p, end, name, startp, endp) cstring_t p, end, name, *startp, *endp; { @@ -177,11 +177,11 @@ if (e < end && *n == '\0' && *e == ':') { *startp = e + 1; *endp = p; - return p; /* matched */ + return 1; /* matched */ } } *startp = *endp = NULL; - return p; + return 0; } /* Find first matching header */ @@ -191,8 +191,8 @@ cstring_t mbox; cstring_t name, *startp, *endp; { - findhdr(mbox + m->pos, mbox + m->pos + m->hdrlen, name, startp, endp); - return (*startp != NULL); + return findhdr(mbox + m->pos, mbox + m->pos + m->hdrlen, + name, startp, endp); } /* Extract a Message-ID, <blah>, from a header. Return next p or NULL */ Index: util.h =================================================================== RCS file: /cvsroot/meshdb/src/mailt/util.h,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- util.h 10 Aug 2002 03:45:14 -0000 1.1.1.1 +++ util.h 1 May 2005 12:28:27 -0000 1.1.1.1.2.1 @@ -1,7 +1,7 @@ /* $Id$ */ void fromname(cstring_t, cstring_t, cstring_t *, cstring_t *); int msgideq(cstring_t, cstring_t, cstring_t, cstring_t); -cstring_t findhdr(cstring_t, cstring_t, cstring_t, cstring_t *, cstring_t *); +int findhdr(cstring_t, cstring_t, cstring_t, cstring_t *, cstring_t *); int find1hdr(struct mail *, cstring_t, cstring_t, cstring_t *, cstring_t *); cstring_t msgid(cstring_t, cstring_t, cstring_t *, cstring_t *); int check_reply_tree(struct mail *, msgid_t, off_t max); Index: view.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/view.c,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -u -d -r1.4.2.1 -r1.4.2.2 --- view.c 8 Nov 2004 12:55:34 -0000 1.4.2.1 +++ view.c 1 May 2005 12:28:27 -0000 1.4.2.2 @@ -113,7 +113,7 @@ printf("</a>"); p = u - 1; } else if (c > '~') - printf("<i>\\x%02x</i>", c); + printf("<span class=\"hex\">\\x%02x</span>", c); else putchar(c); } @@ -333,43 +333,43 @@ if (id == 0) return; - printf("<LI>"); + printf("<li>"); /* printf("<SPAN CLASS=seqno>[%lu]</SPAN> ", id); */ if (id != displayed) - printf("<A HREF=\"%lu\">", id); + printf("<a href=\"%lu\" class=\"subject\">", id); else - printf("<SPAN CLASS=current>"); + printf("<span class=\"current subject\">"); printesc(o->m[id].subject, o->m[id].subject + strlen(o->m[id].subject)); if (id != displayed) - printf("</A>"); + printf("</a>"); else - printf("</SPAN>"); - printf(", <SPAN CLASS=email>"); + printf("</span>"); + printf(" <span class=\"author\">"); printesc(o->m[id].from, o->m[id].from + strlen(o->m[id].from)); - printf("</SPAN>"); + printf("</span>"); strftime(when, sizeof when, "%e%b%y", localtime(&o->m[id].date)); - printf(", <SPAN CLASS=shortdate>%s</SPAN> ", when); + printf(" <span class=\"shortdate\">%s</span> ", when); if (o->m[id].child) { if (nochld) { int replies = counttree(o, o->m[id].child); - printf("<SPAN CLASS=replies>["); + printf("<span class=\"replies\">"); if (replies == 1) printf("1 reply"); else printf("%u replies", replies); - printf("]</SPAN>"); + printf("</span>"); } else { - printf("<UL>\n"); + printf("<ul>\n"); print_threadlist(o, o->m[id].child, displayed, 0, 0); - printf("</UL>\n"); + printf("</ul>\n"); } } - printf("</LI>\n"); + printf("</li>\n"); if (!nosib && o->m[id].sibling) print_threadlist(o, o->m[id].sibling, displayed, 0, 0); @@ -425,9 +425,9 @@ isplain = 1; if (isplain) { - printf("<PRE WRAP=AUTO>"); + printf("<pre wrap=\"auto\">"); printescqp(bs, pe, isqp(ps, bs)); - printf("</PRE>\n"); + printf("</pre>\n"); } else if (bdry2) { showmixed(v2, ps, pe, &c, id); } else { @@ -474,31 +474,46 @@ isplain = 1; if (isplain) { - printf("<PRE WRAP=AUTO>"); + printf("<pre wrap=\"auto\">"); printescqp(bs, pe, isqp(ps, bs)); - printf("</PRE>\n"); + printf("</pre>\n"); shown = index; break; } } - printf("<P>Unshown multiparts:</P><UL>"); + printf("<div class=\"multiparts\"><p>Unshown multiparts:</p><ul>"); for (index = 1; getpart(b, e, bdry, index, &ps, &pe); index++) { cstring_t bs = find_bodystart(ps, pe); cstring_t hstart, hend; if (index == shown) continue; - printf("<LI>%u. <A HREF=\"%lu/%u\">", index, id, index); + printf("<li>%u. <a href=\"%lu/%u\">", index, id, index); if (findhdr(ps, bs, "content-type", &hstart, &hend)) printesc(hstart, hend); else printf("text/plain"); - printf("</A></LI>\n"); + printf("</a></li>\n"); } - printf("</UL>\n"); + printf("</ul></div>\n"); } +/* Prints a navigation bar */ +static void +navigation(o, id, prev, next) + struct open *o; + msgid_t id, prev, next; +{ + printf("<div class=\"navigation\">"); + if (prev) printf("<a class=\"prev\" href=\"%lu\">prev</a>", prev); + else printf("<span class=\"prev\">prev</span>"); + printf(" <a class=\"index\" href=\"%s%s?.%lu#m%lu\">index</a> ", + relpath, indexfile, id, id); + if (next) printf("<a class=\"next\" href=\"%lu\">next</a>", next); + else printf("<span class=\"next\">next</span>"); + printf("</div>\n"); +} /* Nice view of the document with HTML links */ static void nice_view(o, id) @@ -515,8 +530,8 @@ m = o->m + id; printf("Content-type: text/html\n\n"); - printf("<HTML><HEAD><REL LINK=STYLESHEET" - " TYPE=\"text/css\" HREF=\"../%s/style.css\">", relpath); + printf("<html><head><link rel=\"stylesheet\"" + " type=\"text/css\" href=\"%sstyle.css\">", relpath); if (!killed) { /* Start is the most distant ancestor */ @@ -529,63 +544,53 @@ prev = findprev(o, id); if (prev) - printf("<REL LINK=PREV HREF=\"%lu\">", prev); + printf("<link rel=\"prev\" href=\"%lu\">", prev); if (next) - printf("<REL LINK=NEXT HREF=\"%lu\">", next); + printf("<link rel=\"next\" href=\"%lu\">", next); if (start) - printf("<REL LINK=START HREF=\"%lu\">", start); + printf("<link rel=\"start\" href=\"%lu\">", start); } - printf("<TITLE>"); + printf("<title>"); /* printf("[%lu] ", id); */ printesc(m->subject, m->subject + strlen(m->subject)); - printf("</TITLE></HEAD>\n"); + printf("</title></head>\n"); - printf("<BODY>"); + printf("<body class=\"message\">"); if (killed) - printf("<P><STRONG>Message killed</STRONG></P>\n"); - else { - printf("<P>["); - if (prev) printf("<A HREF=\"%lu\">prev</A>", prev); - else printf("prev"); - printf(" | "); - printf("<A HREF=\"../%s/%s?.%lu#m%lu\">index</A>", - relpath, indexfile, id, id); - printf(" | "); - if (next) printf("<A HREF=\"%lu\">next</A>", next); - else printf("next"); - printf("]</P>\n"); - } + printf("<p class=\"killed\">Message killed</p>\n"); + else + navigation(o, id, prev, next); - printf("<TABLE CLASS=header>"); + printf("<table class=\"envelope\">"); ha = o->mbox + m->pos; hb = o->mbox + m->pos + m->hdrlen; if (findhdr(ha, hb, "from", &s, &e)) { - printf("<TR><TH>From:</TH><TD><SPAN CLASS=email>"); + printf("<tr class=\"envelope from\"><th>From:</th><td>"); printesc(s, e); - printf("</SPAN></TD></TR>\n"); + printf("</td></tr>\n"); } if (findhdr(ha, hb, "to", &s, &e)) { - printf("<TR><TH>To:</TH><TD><SPAN CLASS=email>"); + printf("<tr class=\"envelope to\"><th>To:</th><td>"); printesc(s, e); - printf("</SPAN></TD></TR>\n"); + printf("</td></tr>\n"); } if (findhdr(ha, hb, "reply-to", &s, &e)) { - printf("<TR><TH>Reply-To:</TH><TD><SPAN CLASS=email>"); + printf("<tr class=\"envelope reply\"><th>Reply-To:</th><td>"); printesc(s, e); - printf("</SPAN></TD></TR>\n"); + printf("</td></tr>\n"); } if (findhdr(ha, hb, "date", &s, &e)) { - printf("<TR><TH>Date:</TH><TD>"); + printf("<tr class=\"envelope date\"><th>Date:</th><td>"); printesc(s, e); - printf("</TD></TR>\n"); + printf("</td></tr>\n"); } if (findhdr(ha, hb, "subject", &s, &e)) { - printf("<TR><TH>Subject:</TH><TD>"); + printf("<tr class=\"envelope subject\"><th>Subject:</th><td>"); printesc(s, e); - printf("</TD></TR>\n"); + printf("</td></tr>\n"); } - printf("</TABLE><HR>\n"); + printf("</table>\n"); /* Choose text/plain from multipart/alternate */ /* @@ -608,7 +613,8 @@ else if (strcasecmp(v[0], "multipart/signed") == 0) choosemixed(v, s, e, id); else - printf("<a href=\"%lu/0\" type=\"%s\">" + printf("<a class=\"attachment\"" + " href=\"%lu/0\" type=\"%s\">" "Attachment of type %s</a>", id, v[0], v[0]); } else { textplain: @@ -616,7 +622,7 @@ bodystart = o->mbox + m->pos + m->hdrlen; bodyend = bodystart + m->bodylen; - printf("<PRE WRAP=AUTO>"); + printf("<pre wrap=\"auto\">"); #if 1 for (p = bodystart; p < bodyend; ) { @@ -631,9 +637,9 @@ gt++; while (q < bodyend && *q != '\n') q++; - if (gt) printf("<SPAN class=indent%d>", gt); + if (gt) printf("<span class=\"indent%d\">", gt); printescqp(p, q, qp); - if (gt) printf("</SPAN>"); + if (gt) printf("</span>"); p = q; if (p < bodyend && *p == '\n') { printf("\n"); @@ -643,47 +649,32 @@ #else printescqp(bodystart, bodyend, qp); #endif - printf("</PRE>"); + printf("</pre>"); } - printf("<HR>"); - if (!killed) { - printf("<P>["); - if (prev) printf("<A HREF=\"%lu\">prev</A>", prev); - else printf("prev"); - printf(" | "); - printf("<A HREF=\"../%s/%s#m%lu\">index</A>", relpath, - indexfile, start); - printf(" | "); - if (next) printf("<A HREF=\"%lu\">next</A>", next); - else printf("next"); - printf("]</P>\n"); - } - + navigation(o, id, prev, next); /* - printf("<P>["); - printf("<a href=\"%lu;mbox\">view raw</a>", id); - printf(" | "); - printf("<a href=\"%lu;raw\">download raw</a>", id); - printf("]</P>\n"); + printf("<div class=\"transform\">"); + printf("<a href=\"%lu;mbox\">view raw</a>", id); + printf("<a href=\"%lu;raw\">download raw</a>", id); + printf("</div>\n"); */ - if (!killed) { - printf("<UL CLASS=thread>"); + printf("<ul class=\"thread\">"); print_threadlist(o, findprevsib(o, start), id, 1, 1); print_threadlist(o, start, id, 1, 0); print_threadlist(o, o->m[start].sibling, id, 1, 1); - printf("</UL>\n"); + printf("</ul>\n"); } if (findhdr(ha, hb, "message-id", &s, &e)) { - printf("<P>[%ld] <SPAN CLASS=messageid>", id); + printf("<p class=\"messageid\">[%ld] ", id); printesc(s, e); - printf("</SPAN></P\n"); + printf("</p>\n"); } - printf("</BODY></HTML>\n"); + printf("</body></html>\n"); } /* Walk to a particular attachment and print the subtree literally */ @@ -758,15 +749,18 @@ int *path; int i, pathlen, raw; cstring_t mbox = "mbox"; + char relpath_buf[1024]; if (argc == 1) { - relpath = ""; + relpath = "../"; } else if (argc == 2) { - relpath = argv[1]; - if (chdir(relpath) == -1) { - perror(relpath); + if (chdir(argv[1]) == -1) { + perror(argv[1]); exit(1); } + snprintf(relpath_buf, sizeof relpath_buf, + "../%s/", argv[1]); + relpath = relpath_buf; } else { fprintf(stderr, "usage: %s [dir]\n", argv[0]); exit(1); |
From: Ian L. <il...@us...> - 2005-02-17 00:27:50
|
Fixed. Too many languages for that time of night :-) Ian |
From: <il...@pr...> - 2005-02-16 23:54:58
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25266 Modified Files: index.php Log Message: Oops... it's SQL, not PHP or C or anything else... Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/index.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- index.php 16 Feb 2005 11:17:32 -0000 1.12 +++ index.php 16 Feb 2005 23:54:50 -0000 1.13 @@ -61,7 +61,7 @@ ?> and <? $result = mysql_query("SELECT count(*) FROM netloc - WHERE status == 'full' + WHERE status = 'full' AND active", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); |
From: Paul J. <pau...@ja...> - 2005-02-16 23:46:13
|
Hi all, =20 The Mesh Db seems to be down with the folloing error =20 Currently there are 1522 nodes and You have an error in your SQL syntax. = Check the manual that corresponds to your MySQL server version for the = right syntax to use near '=3D=3D 'full' AND active' at line 3 This anything to do with the changes you made yesterday Ian? Ian, can you please have a look. Thank, Paul =20 ________________________________ From: mes...@li... on behalf of = il...@pr... Sent: Wed 16/02/2005 9:18 PM To: mes...@li... Subject: [Meshdb-cvs] www/db2 index.php,1.11,1.12 map4b.php,1.5,1.6 = submit.php,1.15,1.16 view-netloc.inc.php,1.4,1.5 Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25181/www/db2 Modified Files: index.php map4b.php submit.php view-netloc.inc.php Log Message: Added a status column to netloc, to allow people that have a pressing = desire to record interfaces that aren't yet working to do so without them = appearing on the network maps. Index: index.php |
From: <il...@pr...> - 2005-02-16 11:18:17
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25181/www/db2 Modified Files: index.php map4b.php submit.php view-netloc.inc.php Log Message: Added a status column to netloc, to allow people that have a pressing desire to record interfaces that aren't yet working to do so without them appearing on the network maps. Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/index.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- index.php 28 Jul 2004 07:43:01 -0000 1.11 +++ index.php 16 Feb 2005 11:17:32 -0000 1.12 @@ -59,7 +59,10 @@ else printf("are $nentries nodes"); ?> and <? - $result = mysql_query("SELECT count(*) from netloc where active", $db) + $result = mysql_query("SELECT count(*) + FROM netloc + WHERE status == 'full' + AND active", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); $nentries = intval($row[0]); Index: map4b.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/map4b.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- map4b.php 16 Feb 2005 10:52:46 -0000 1.5 +++ map4b.php 16 Feb 2005 11:17:33 -0000 1.6 @@ -105,6 +105,8 @@ ." AND" ." peerid is null" ." AND" + ." netloc.status = 'full'" + ." AND" ." n>".($n-$Dn)." AND n<".($n+$Dn) ." AND" ." e>".($e-$De)." AND e<".($e+$De) @@ -162,6 +164,8 @@ ." AND p2.e>".($e-$De)." AND p2.e<".($e+$De).")" .")" ." AND" + ." netloc.status = 'full'" + ." AND" ." to_days(now()) - to_days(a1.updated) <= ".$PREF["maxnodeage"] ." AND" ." to_days(now()) - to_days(a2.updated) <= ".$PREF["maxnodeage"] Index: submit.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/submit.php,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- submit.php 3 Feb 2005 10:30:57 -0000 1.15 +++ submit.php 16 Feb 2005 11:17:33 -0000 1.16 @@ -442,7 +442,7 @@ } else $newvals = $netloc; $s = setexp($newvals, $oldnetloc, $changes, - $strs = "mac family address comment", + $strs = "mac family address comment status", $ints = "peerid active", $dbls = "", $pfx = "$ifname."); Index: view-netloc.inc.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/view-netloc.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- view-netloc.inc.php 5 Aug 2004 08:04:43 -0000 1.4 +++ view-netloc.inc.php 16 Feb 2005 11:17:33 -0000 1.5 @@ -4,13 +4,25 @@ <tr> <th>Peer ID:</th> <td><?=valnodeid("netloc[$ifname.peerid]")?></td> - <?=edithelp("Node ID (or name) of other end of link.<br>(Leave blank if your interface is a base station)")?> + <?=edithelp("Node ID (or name) of other end of link.<br>(Leave blank if your interface is a base station, otherwise it <strong>must</strong> be filled in)")?> +</tr> + +<tr> + <th>Interface status:</th> + <td><?=selectval("netloc[$ifname.status]", + array( + "full" => "Fully operational", + "test" => "In testing", + "build" => "Building", + "gather" => "Gathering components", + ))?></td> + <?=edithelp("")?> </tr> <tr> <th>Active:</th> <td><?=valyesno("netloc[$ifname.active]")?></td> - <?=edithelp("Set to Yes if interface is active")?> + <?=edithelp("Set to Yes if interface is currently active (powered up and radiating)")?> </tr> <tr> @@ -149,6 +161,7 @@ <? if ($GLOBALS["EDITNETLOC"]) { $GLOBALS["netloc"]["NEW.family"] = "INET6"; $GLOBALS["config"]["NEW.protocol"] = "802.11b"; + $GLOBALS["netloc"]["NEW.status"] = "gather"; ?> <tr> |