diff --git a/robots/tracker/RoboTrack.java b/robots/tracker/RoboTrack.java index 6e859b70012e972041aecde34609e8c541bbe666..e2ef7f8494921f5e16456738adb3df778cc2f45d 100644 --- a/robots/tracker/RoboTrack.java +++ b/robots/tracker/RoboTrack.java @@ -38,7 +38,7 @@ public class RoboTrack extends JApplet { static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("hh:mm:ss"); static final Date now = new Date(); - String uid, auth; + String uid, auth, building, floor; boolean shelled = false; /* @@ -55,10 +55,12 @@ public class RoboTrack extends JApplet { URLConnection uc; /* Get our parameters then */ - uid = this.getParameter("uid"); - auth = this.getParameter("auth"); - pipeurl = this.getParameter("pipeurl"); - baseurl = this.getParameter("floorurl"); + uid = this.getParameter("uid"); + auth = this.getParameter("auth"); + pipeurl = this.getParameter("pipeurl"); + baseurl = this.getParameter("floorurl"); + building = this.getParameter("building"); + floor = this.getParameter("floor"); pixels_per_meter = Double.parseDouble(this.getParameter("ppm")); // form the URL that we use to get the background image @@ -1387,6 +1389,8 @@ public class RoboTrack extends JApplet { */ public boolean GetNodeInfo() { String urlstring = "nodeinfo.php3?fromapplet=1" + + "&floor=" + floor + + "&building=" + building + "&nocookieuid=" + URLEncoder.encode(uid) + "&nocookieauth=" @@ -1458,6 +1462,8 @@ public class RoboTrack extends JApplet { */ public boolean GetObstacles() { String urlstring = "obstacles.php3?fromapplet=1" + + "&floor=" + floor + + "&building=" + building + "&nocookieuid=" + URLEncoder.encode(uid) + "&nocookieauth=" @@ -1528,6 +1534,8 @@ public class RoboTrack extends JApplet { */ public boolean GetCameras() { String urlstring = "cameras.php3?fromapplet=1" + + "&floor=" + floor + + "&building=" + building + "&nocookieuid=" + URLEncoder.encode(uid) + "&nocookieauth=" diff --git a/www/robotmap.php3 b/www/robotmap.php3 index dceb5aac3beb1cad9ba5991f196770be7c24091a..19f6ba1475d6538eb1fa2b58cf3cec7c38d12e31 100755 --- a/www/robotmap.php3 +++ b/www/robotmap.php3 @@ -261,7 +261,8 @@ if ($isadmin || TBWebCamAllowed($uid)) { echo " <a href=webcam.php3>Webcam View</a> (Updated in real time)"; echo " <br>\n"; } -echo " <a href=robotrack/robotrack.php3>Track robots in real time</a>"; +echo " <a href=robotrack/robotrack.php3?building=${building}&floor=${floor}>". + "Track robots in real time</a>"; echo " <br>\n"; if (isset($map_x) && isset($map_y)) { diff --git a/www/robotrack/cameras.php3 b/www/robotrack/cameras.php3 index 854157b9085e9dc09ed0d5f4663dc40418bbeb57..0888e885a3a85606637c49d818b64b0d22213a44 100644 --- a/www/robotrack/cameras.php3 +++ b/www/robotrack/cameras.php3 @@ -14,10 +14,22 @@ $uid = GETLOGIN(); LOGGEDINORDIE($uid); # -# One robot map right now ... -# -$building = "MEB-ROBOTS"; -$floor = 4; +# Verify page arguments. Allow user to optionally specify building/floor. +# +if (isset($building) && $building != "") { + # Sanitize for the shell. + if (!preg_match("/^[-\w]+$/", $building)) { + PAGEARGERROR("Invalid building argument."); + } + # Optional floor argument. Sanitize for the shell. + if (isset($floor) && !preg_match("/^[-\w]+$/", $floor)) { + PAGEARGERROR("Invalid floor argument."); + } +} +else { + $building = "MEB-ROBOTS"; + $floor = 4; +} # Initial goo. header("Content-Type: text/plain"); diff --git a/www/robotrack/nodeinfo.php3 b/www/robotrack/nodeinfo.php3 index 2454f3e1a364a865022e51725dbb169e3c926d94..6c6d1dc0479d2f83920e35e8fb2acb0ff75ce631 100644 --- a/www/robotrack/nodeinfo.php3 +++ b/www/robotrack/nodeinfo.php3 @@ -14,10 +14,22 @@ $uid = GETLOGIN(); LOGGEDINORDIE($uid); # -# One robot map right now ... -# -$building = "MEB-ROBOTS"; -$floor = 4; +# Verify page arguments. Allow user to optionally specify building/floor. +# +if (isset($building) && $building != "") { + # Sanitize for the shell. + if (!preg_match("/^[-\w]+$/", $building)) { + PAGEARGERROR("Invalid building argument."); + } + # Optional floor argument. Sanitize for the shell. + if (isset($floor) && !preg_match("/^[-\w]+$/", $floor)) { + PAGEARGERROR("Invalid floor argument."); + } +} +else { + $building = "MEB-ROBOTS"; + $floor = 4; +} # Initial goo. header("Content-Type: text/plain"); diff --git a/www/robotrack/obstacles.php3 b/www/robotrack/obstacles.php3 index 61536d10a0a42ffd0b731c256a18a377452ba4a5..589eacf7a55d1df605ea0d4e3675109147551990 100644 --- a/www/robotrack/obstacles.php3 +++ b/www/robotrack/obstacles.php3 @@ -14,10 +14,22 @@ $uid = GETLOGIN(); LOGGEDINORDIE($uid); # -# One robot map right now ... -# -$building = "MEB-ROBOTS"; -$floor = 4; +# Verify page arguments. Allow user to optionally specify building/floor. +# +if (isset($building) && $building != "") { + # Sanitize for the shell. + if (!preg_match("/^[-\w]+$/", $building)) { + PAGEARGERROR("Invalid building argument."); + } + # Optional floor argument. Sanitize for the shell. + if (isset($floor) && !preg_match("/^[-\w]+$/", $floor)) { + PAGEARGERROR("Invalid floor argument."); + } +} +else { + $building = "MEB-ROBOTS"; + $floor = 4; +} # Initial goo. header("Content-Type: text/plain"); diff --git a/www/robotrack/robopipe.php3 b/www/robotrack/robopipe.php3 index ff83f1a0a38a31075d6bb9faeb7cafa7b94282ee..cdebc36265f444063b54f5968c7da65c3a2fe31f 100644 --- a/www/robotrack/robopipe.php3 +++ b/www/robotrack/robopipe.php3 @@ -14,10 +14,22 @@ $uid = GETLOGIN(); LOGGEDINORDIE($uid); # -# One robot map right now ... -# -$building = "MEB-ROBOTS"; -$floor = 4; +# Verify page arguments. Allow user to optionally specify building/floor. +# +if (isset($building) && $building != "") { + # Sanitize for the shell. + if (!preg_match("/^[-\w]+$/", $building)) { + PAGEARGERROR("Invalid building argument."); + } + # Optional floor argument. Sanitize for the shell. + if (isset($floor) && !preg_match("/^[-\w]+$/", $floor)) { + PAGEARGERROR("Invalid floor argument."); + } +} +else { + $building = "MEB-ROBOTS"; + $floor = 4; +} # Initial goo. header("Content-Type: text/plain"); diff --git a/www/robotrack/robotrack.php3 b/www/robotrack/robotrack.php3 index 1d137a5fd163500f646467ee60a77b809dbb12ce..1d0c993fae6553b69801df7e90fee5a2cf24831a 100644 --- a/www/robotrack/robotrack.php3 +++ b/www/robotrack/robotrack.php3 @@ -13,7 +13,7 @@ LOGGEDINORDIE($uid); PAGEHEADER("Real Time Robot Tracking Applet"); # -# Verify page arguments. First allow user to optionally specify building/floor. +# Verify page arguments. Allow user to optionally specify building/floor. # if (isset($building) && $building != "") { # Sanitize for the shell. @@ -69,7 +69,7 @@ echo "<table cellspacing=5 cellpadding=5 border=0 class=\"stealth\"> shows the current position (x, y, orientation), the destination position, and the battery level (percentage and voltage). - The shaded areas (blue border) are <em>exclusion</em> + The shaded areas are <em>exclusion</em> zones where robots are not allowed to go. You can <b>right click</b> on a robot to bring up its info page. See below for instructions on how to @@ -104,7 +104,7 @@ if ($retval) { } $auth = $HTTP_COOKIE_VARS[$TBAUTHCOOKIE]; -$pipeurl = "robopipe.php3?foo=bar"; +$pipeurl = "robopipe.php3?building=$building&floor=$floor"; $baseurl = "../floormap_aux.php3?prefix=$uniqueid"; # Temp for debugging. @@ -120,6 +120,8 @@ echo "<applet name='tracker' code='RoboTrack.class' <param name='uid' value='$uid'> <param name='auth' value='$auth'> <param name='ppm' value='$ppm'> + <param name='building' value='$building'> + <param name='floor' value='$floor'> </applet>\n"; echo "<br> diff --git a/www/robotrack/tracker.jar b/www/robotrack/tracker.jar index 57aba24a2a2176a32a938ecc30cc5a0ccc27c5eb..866a1665e8efab3d19277e1ae7d50ce7687d7819 100644 Binary files a/www/robotrack/tracker.jar and b/www/robotrack/tracker.jar differ