handle require_once and include_once, allow single quotes
[old-projects.git] / depview / file.php
1 <?php
2 require("config.inc.php");
3 require("header.inc.php");
4
5 /* validate parameters */
6 if (!isset($_REQUEST['id'])) {
7 echo "no file specified";
8 include("footer.inc.php");
9 exit;
10 }
11 $id = $_REQUEST['id'];
12 $res = mysql_query("select path from file where id=$id");
13 if (!list($page)=mysql_fetch_row($res)) {
14 echo "file $id not found";
15 include("footer.inc.php");
16 exit;
17 }
18 $d = isset($_REQUEST['d']) ? $_REQUEST['d'] : 0;
19 ?>
20
21 <h1>Dependencies for <?php echo $page; ?></h1>
22 <p>
23 Current context is highlighted in yellow.<br />
24 <a href="list.php">back to file list</a>
25 </p>
26
27 <h2>files that <?php echo $page; ?> depends on</h2>
28 <table>
29 <tr>
30 <th>relation</th>
31 <th>context</th>
32 <th>file</th>
33 </tr>
34 <?php
35 $res = mysql_query("select dep.dir,dep.type,dep.dep,file.path from dep left join file on dep.dep=file.id where page=$id order by dep.dir");
36 while (list($dir,$type,$cid,$cpath)=mysql_fetch_row($res)) {
37 $res2 = mysql_query("select path from dir where id=$dir");
38 list($dirname)=mysql_fetch_row($res2);
39 ?>
40 <tr <?php if ($d==$dir) echo 'class="current"'; ?>>
41 <td><?php echo $type; ?></td>
42 <td><?php echo $dirname; ?></td>
43 <td><a href="file.php?id=<?php echo $cid; ?>&d=<?php echo $dir; ?>"><?php echo $cpath; ?></a></td>
44 </tr>
45 <?php
46 }
47 ?>
48 </table>
49
50 <h2>files that depend on <?php echo $page; ?></h2>
51 <table>
52 <tr>
53 <th>relation</th>
54 <th>context</th>
55 <th>file</th>
56 </tr>
57 <?php
58 $res = mysql_query("select dep.dir,dep.type,dep.page,file.path from dep left join file on dep.page=file.id where dep=$id order by dep.dir");
59 while (list($dir,$type,$pid,$ppath)=mysql_fetch_row($res)) {
60 $res2 = mysql_query("select path from dir where id=$dir");
61 list($dirname)=mysql_fetch_row($res2);
62 ?>
63 <tr <?php if ($d==$dir) echo 'class="current"'; ?>>
64 <td><?php echo $type; ?></td>
65 <td><?php echo $dirname; ?></td>
66 <td><a href="file.php?id=<?php echo $pid; ?>&d=<?php echo $dir; ?>"><?php echo $ppath; ?></a></td>
67 </tr>
68 <?php
69 }
70 ?>
71 </table>
72
73
74 <?php
75 require("footer.inc.php");
76 ?>