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