to avoid a little warning
[old-projects.git] / depview / file.php
index a0c99a3..02e6a76 100644 (file)
@@ -1,15 +1,28 @@
 <?php
 require("config.inc.php");
 require("header.inc.php");
+
+/* validate parameters */
+if (!isset($_REQUEST['id'])) {
+  echo "no file specified";
+  include("footer.inc.php");
+  exit;
+}
+$id = $_REQUEST['id'];
 $res = mysql_query("select path from file where id=$id");
 if (!list($page)=mysql_fetch_row($res)) {
-  echo "page not found";
+  echo "file $id not found";
   include("footer.inc.php");
   exit;
 }
+$d = isset($_REQUEST['d']) ? $_REQUEST['d'] : 0;
 ?>
 
 <h1>Dependencies for <?php echo $page; ?></h1>
+<p>
+  Current context is highlighted in yellow.<br />
+  <a href="list.php">back to file list</a>
+</p>
 
 <h2>files that <?php echo $page; ?> depends on</h2>
 <table>
@@ -24,10 +37,10 @@ while (list($dir,$type,$cid,$cpath)=mysql_fetch_row($res)) {
 $res2 = mysql_query("select path from dir where id=$dir");
 list($dirname)=mysql_fetch_row($res2);
 ?>
-<tr>
+<tr <?php if ($d==$dir) echo 'class="current"'; ?>>
   <td><?php echo $type; ?></td>
   <td><?php echo $dirname; ?></td>
-  <td><a href="file.php?id=<?php echo $cid; ?>"><?php echo $cpath; ?></a></td>
+  <td><a href="file.php?id=<?php echo $cid; ?>&d=<?php echo $dir; ?>"><?php echo $cpath; ?></a></td>
 </tr>
 <?php
 }
@@ -47,10 +60,10 @@ while (list($dir,$type,$pid,$ppath)=mysql_fetch_row($res)) {
 $res2 = mysql_query("select path from dir where id=$dir");
 list($dirname)=mysql_fetch_row($res2);
 ?>
-<tr>
+<tr <?php if ($d==$dir) echo 'class="current"'; ?>>
   <td><?php echo $type; ?></td>
   <td><?php echo $dirname; ?></td>
-  <td><a href="file.php?id=<?php echo $pid; ?>"><?php echo $ppath; ?></a></td>
+  <td><a href="file.php?id=<?php echo $pid; ?>&d=<?php echo $dir; ?>"><?php echo $ppath; ?></a></td>
 </tr>
 <?php
 }