$main['repname'] = "phLXR"
$main['path'] = "/"
$main['file'] = "/ident"
$HTTP_SERVER_VARS['PATH_INFO']: /phLXR/ident
1 <?
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 error_reporting( E_ALL ) ;
40
41 require( './include/config.inc' ) ;
42 require( './include/functions.inc' ) ;
43 require( './include/class.layout.inc' ) ;
44
45 require( './include/class.logger.inc' ) ;
46 $log = new Clogger( './log/ident.log' , 'w' ) ;
47
48 newhtml( $page ) ;
49
50 $db = db_connect() ;
51
52 if( ! isset( $HTTP_SERVER_VARS['PATH_INFO'] ) || '/' == $HTTP_SERVER_VARS['PATH_INFO'] ) {
53 header( $_path ) ;
54 exit ;
55 }
56
57 $path = $HTTP_SERVER_VARS['PATH_INFO'] ;
58 if( $secondslash = strnpos( $path , '/' , 2 ) ) {
59 $repname = substr( $path , 1 , $secondslash-1 ) ;
60 $idname = substr( $path , $secondslash+1 ) ;
61 if( '/' == $idname ) {
62 header( "Location: $_path" ) ;
63 exit ;
64 }
65 } else {
66 header( "Location: $_path" ) ;
67 exit ;
68 }
69
70 $q = 'select
71 id.idtype ,
72 file.file ,
73 id.linenr
74 from
75 identifier id ,
76 file ,
77 repository rep
78 where
79 id.idname = "' . $idname . '"
80 and
81 id.fileid = file.fileid
82 and
83 file.repid = rep.repid
84 and
85 rep.repname="' . $repname . '"' ;
86
87 $rs = mysql_query( $q ) ;
88
89 while( $def = mysql_fetch_assoc( $rs ) ) {
90 $defs[] = $def ;
91 }
92
93 $rs = mysql_query( 'select
94 id.idname ,
95 file.file ,
96 loc.linenr
97 from
98 identifier id ,
99 file ,
100 location loc ,
101 repository rep
102 where
103 id.idname = "' . $idname . '"
104 and
105 id.idid = loc.idid
106 and
107 loc.fileid = file.fileid
108 and
109 file.repid = rep.repid
110 and
111 loc.linenr <> id.linenr
112 and
113 rep.repname="' . $repname . '"
114 order by file.file, loc.linenr' ) ;
115
116
117 while( $loc = mysql_fetch_assoc( $rs ) ) {
118 $locs[] = $loc ;
119 }
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 insert( $page , heading( 1 , $idname ) ) ;
135 foreach( $defs as $def ) {
136 insert( $page , block( 'Defined as <tt>' . get_identifier_type( $def['idtype'] ) . '</tt> in file ' ) ) ;
137 insert( $page , anchor( realuri( "source/$repname{$def['file']}
138 "<tt>{$def['file']}, line {$def['linenr']}</tt>" ) ) ;
139 insert( $page , generic( 'br' ) ) ;
140 }
141
142 insert( $page , block( 'Referenced (in ' . unique_files( $locs ) . ' files total) in:<br>' ) ) ;
143 foreach( $locs as $loc ) {
144
145 insert( $page , anchor( realuri( "source/$repname{$loc['file']}
146 "<tt>{$loc['file']}, line {$loc['linenr']}</tt>" ) ) ;
147 insert( $page , generic( 'br' ) ) ;
148
149
150
151 }
152
153 printhtml( $page ) ;
154
155 ?>