Rev 172 Rev 185
Line 1... Line 1...
1 <?php 1 <?php
2 # vim:et:ts=3:sts=3:sw=3:fdm=marker: 2 # vim:et:ts=3:sts=3:sw=3:fdm=marker:
3   3  
4 // WebSVN - Subversion repository viewing via the web using PHP 4 // WebSVN - Subversion repository viewing via the web using PHP
5 // Copyright © 2004-2006 Tim Armes, Matt Sicker 5 // Copyright © 2004-2006 Tim Armes, Matt Sicker
6 // 6 //
7 // This program is free software; you can redistribute it and/or modify 7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by 8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or 9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version. 10 // (at your option) any later version.
11 // 11 //
12 // This program is distributed in the hope that it will be useful, 12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details. 15 // GNU General Public License for more details.
16 // 16 //
17 // You should have received a copy of the GNU General Public License 17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software 18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // 20 //
21 // -- 21 // --
22 // 22 //
23 // listing.php 23 // listing.php
24 // 24 //
25 // Show the listing for the given repository/path/revision 25 // Show the listing for the given repository/path/revision
26   26  
27 require_once("include/setup.inc"); 27 require_once("include/setup.inc");
28 require_once("include/svnlook.inc"); 28 require_once("include/svnlook.inc");
29 require_once("include/utils.inc"); 29 require_once("include/utils.inc");
30 require_once("include/template.inc"); 30 require_once("include/template.inc");
31 require_once("include/bugtraq.inc"); 31 require_once("include/bugtraq.inc");
32   32  
33 function removeURLSeparator($url) 33 function removeURLSeparator($url)
34 { 34 {
35 return preg_replace('#(\?|&(amp;)?)$#', '', $url); 35 return preg_replace('#(\?|&(amp;)?)$#', '', $url);
36 } 36 }
37   37  
38 function fileLink($path, $file, $returnjoin = false) 38 function fileLink($path, $file, $returnjoin = false)
39 { 39 {
40 global $rep, $passrev, $showchanged, $config; 40 global $rep, $passrev, $showchanged, $config;
41 41
42 if ($path == "" || $path{0} != "/") 42 if ($path == "" || $path{0} != "/")
43 $ppath = "/".$path; 43 $ppath = "/".$path;
44 else 44 else
45 $ppath = $path; 45 $ppath = $path;
46   46  
47 if ($ppath{strlen($ppath)-1} != "/") 47 if ($ppath{strlen($ppath)-1} != "/")
48 $ppath .= "/"; 48 $ppath .= "/";
49 49
50 if ($file{0} == "/") 50 if ($file{0} == "/")
51 $pfile = substr($file, 1); 51 $pfile = substr($file, 1);
52 else 52 else
53 $pfile = $file; 53 $pfile = $file;
54 //$pfile = rawurldecode($pfile); 54  
55   55 if ($returnjoin)
56 if ($returnjoin) 56 return $ppath.$pfile;
57 return $ppath.$pfile; 57  
58   58 $isDir = $pfile{strlen($pfile) - 1} == "/";
59 $isDir = $pfile{strlen($pfile) - 1} == "/"; 59
60 60 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = "";
61 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = ""; 61 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = "";
62 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = ""; 62  
63   63 if ($isDir)
64 if ($isDir) 64 {
65 { 65 $url = $config->getURL($rep, $ppath.$pfile, "dir");
66 $url = $config->getURL($rep, $ppath.$pfile, "dir"); 66  
67   67 // XHTML doesn't allow slashes in IDs ~J
68 // XHTML doesn't allow slashes in IDs ~J 68 $id = str_replace('/', '_', $ppath.$pfile);
69 $id = str_replace('/', '_', $ppath.$pfile); 69 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr";
70 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr"; 70  
71   71 $url = removeURLSeparator($url);
72 $url = removeURLSeparator($url); 72 if ($config->treeView) $url .= "#$id";
73 if ($config->treeView) $url .= "#$id"; 73 $url .= "\">$pfile</a>";
74 $url .= "\">$pfile</a>"; 74 }
75 } 75 else
76 else 76 {
77 { 77 $url = $config->getURL($rep, $ppath.$pfile, "file");
78 $url = $config->getURL($rep, $ppath.$pfile, "file"); 78 $url .= $passrevstr.$showchangedstr;
79 $url .= $passrevstr.$showchangedstr; 79 $url = removeURLSeparator($url);
80 $url = removeURLSeparator($url); 80 $url = "<a href=\"${url}\">$pfile</a>";
81 $url = "<a href=\"${url}\">$pfile</a>"; 81 }
82 } 82  
83   83 return $url;
84 return $url; 84 }
85 } 85  
86   86 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
87 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true) 87 {
88 { 88 global $rep, $passrev, $showchanged, $config, $lang;
89 global $rep, $passrev, $showchanged, $config, $lang; 89  
90   90 $path = "";
91 $path = ""; 91  
92   92 if (!$treeview)
93 if (!$treeview) 93 $level = $limit;
94 $level = $limit; 94  
95   95 for ($n = 0; $n <= $level; $n++)
96 for ($n = 0; $n <= $level; $n++) 96 {
97 { 97 $path .= $subs[$n]."/";
98 $path .= $subs[$n]."/"; 98 }
99 } 99  
100   100 $contents = $svnrep->dirContents($path, $rev);
101 $contents = $svnrep->dirContents($path, $rev); 101  
102   102 // List each file in the current directory
103 // List each file in the current directory 103 $loop = 0;
104 $loop = 0; 104 $last_index = 0;
105 $last_index = 0; 105 $openDir = false;
106 $openDir = false; 106 $fullaccess = $rep->hasReadAccess($path, false);
107 $fullaccess = $rep->hasReadAccess($path, false); 107
108 108 foreach($contents as $file)
109 foreach($contents as $file) 109 {
110 { 110 $isDir = ($file{strlen($file) - 1} == "/"?1:0);
111 $isDir = ($file{strlen($file) - 1} == "/"?1:0); 111 $access = false;
112 $access = false; 112  
113   113 if ($isDir)
114 if ($isDir) 114 {
115 { 115 if ($rep->hasReadAccess($path.$file, true))
116 if ($rep->hasReadAccess($path.$file, true)) 116 {
117 { 117 $access = true;
118 $access = true; 118 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
119 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file)); 119
120 120 if ($openDir)
121 if ($openDir) 121 $listing[$index]["filetype"] = "diropen";
122 $listing[$index]["filetype"] = "diropen"; 122 else
123 else 123 $listing[$index]["filetype"] = "dir";
124 $listing[$index]["filetype"] = "dir"; 124  
125   125 if ($rep->isDownloadAllowed($path.$file))
126 if ($rep->isDownloadAllowed($path.$file)) 126 {
127 { 127 $dlurl = $config->getURL($rep, $path.$file, "dl");
128 $dlurl = $config->getURL($rep, $path.$file, "dl"); 128 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
129 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 129 }
130 } 130 else
131 else 131 $listing[$index]["fileviewdllink"] = "&nbsp;";
132 $listing[$index]["fileviewdllink"] = "&nbsp;"; 132 }
133 } 133 }
134 } 134 else
135 else 135 {
136 { 136 if ($fullaccess)
137 if ($fullaccess) 137 {
138 { 138 $access = true;
139 $access = true; 139 if ($level != $limit)
140 if ($level != $limit) 140 {
141 { 141 // List directories only, skip all files
142 // List directories only, skip all files 142 continue;
143 continue; 143 }
144 } 144
145 145 $listing[$index]["fileviewdllink"] = "&nbsp;";
146 $listing[$index]["fileviewdllink"] = "&nbsp;"; 146 $listing[$index]["filetype"] = strrchr($file, ".");
147 $listing[$index]["filetype"] = strrchr($file, "."); 147 }
148 } 148 }
149 } 149
150 150 if ($access)
151 if ($access) 151 {
152 { 152 $listing[$index]["rowparity"] = ($index % 2)?"1":"0";
153 $listing[$index]["rowparity"] = ($index % 2)?"1":"0"; 153
154 154 if ($treeview)
155 if ($treeview) 155 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />";
156 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />"; 156 else
157 else 157 $listing[$index]["compare_box"] = "";
158 $listing[$index]["compare_box"] = ""; 158
159 159 if ($openDir)
160 if ($openDir) 160 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>";
161 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>"; 161 else
162 else 162 $listing[$index]["filelink"] = fileLink($path, $file);
163 $listing[$index]["filelink"] = fileLink($path, $file); 163
164 164 // The history command doesn't return with a trailing slash. We need to remember here if the
165 // The history command doesn't return with a trailing slash. We need to remember here if the 165 // file is a directory or not!
166 // file is a directory or not! 166
167 167 $listing[$index]["isDir"] = $isDir;
168 $listing[$index]["isDir"] = $isDir; 168
169 169 if ($treeview)
170 if ($treeview) 170 $listing[$index]["level"] = $level;
171 $listing[$index]["level"] = $level; 171 else
172 else 172 $listing[$index]["level"] = 0;
173 $listing[$index]["level"] = 0; 173  
174   174 $listing[$index]["node"] = 0; // t-node
175 $listing[$index]["node"] = 0; // t-node 175
176 176 $fileurl = $config->getURL($rep, $path.$file, "log");
177 $fileurl = $config->getURL($rep, $path.$file, "log"); 177 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>";
178 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>"; 178
179 179 $rssurl = $config->getURL($rep, $path.$file, "rss");
180 $rssurl = $config->getURL($rep, $path.$file, "rss"); 180 if ($rep->getHideRss())
181 if ($rep->getHideRss()) 181 {
182 { 182 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>";
183 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>"; 183 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">";
184 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">"; 184 }
185 } 185
186 186 $index++;
187 $index++; 187 $loop++;
188 $loop++; 188 $last_index = $index;
189 $last_index = $index; 189
190 190 if (($level != $limit) && ($isDir))
191 if (($level != $limit) && ($isDir)) 191 {
192 { 192 if (!strcmp($subs[$level + 1]."/", $file))
193 if (!strcmp($subs[$level + 1]."/", $file)) 193 {
194 { 194 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
195 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index); 195 $index = count($listing);
196 $index = count($listing); 196 }
197 } 197 }
198 } 198  
199   199 }
200 } 200 }
201 } 201  
202   202 if ($last_index != 0 && $treeview)
203 if ($last_index != 0 && $treeview) 203 {
204 { 204 $listing[$last_index - 1]["node"] = 1; // l-node
205 $listing[$last_index - 1]["node"] = 1; // l-node 205 }
206 } 206  
207   207 return $listing;
208 return $listing; 208 }
209 } 209  
210   210 function showTreeDir($svnrep, $path, $rev, $listing)
211 function showTreeDir($svnrep, $path, $rev, $listing) 211 {
212 { 212 global $vars, $config;
213 global $vars, $config; 213  
214   214 $subs = explode("/", $path);
215 $subs = explode("/", $path); 215  
216   216 // For directory, the last element in the subs is empty.
217 // For directory, the last element in the subs is empty. 217 // For file, the last element in the subs is the file name.
218 // For file, the last element in the subs is the file name. 218 // Therefore, it is always count($subs) - 2
219 // Therefore, it is always count($subs) - 2 219 $limit = count($subs) - 2;
220 $limit = count($subs) - 2; 220  
221   221 for ($n = 0; $n < $limit; $n++)
222 for ($n = 0; $n < $limit; $n++) 222 {
223 { 223 $vars["last_i_node"][$n] = FALSE;
224 $vars["last_i_node"][$n] = FALSE; 224 }
225 } 225  
226   226 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView);
227 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView); 227  
228   228 }
229 } 229  
230   230 // Make sure that we have a repository
231 // Make sure that we have a repository 231 if (!isset($rep))
232 if (!isset($rep)) 232 {
233 { 233 echo $lang["NOREP"];
234 echo $lang["NOREP"]; 234 exit;
235 exit; 235 }
236 } 236  
237   237 $svnrep = new SVNRepository($rep);
238 $svnrep = new SVNRepository($rep); 238  
239   239 // Revision info to pass along chain
240 // Revision info to pass along chain 240 $passrev = $rev;
241 $passrev = $rev; 241  
242   242 // Get the directory contents of the given revision, or HEAD if not defined
243 // Get the directory contents of the given revision, or HEAD if not defined 243 $contents = $svnrep->dirContents($path, @$rev);
244 $contents = $svnrep->dirContents($path, @$rev); 244  
245   245 // If there's no revision info, go to the lastest revision for this path
246 // If there's no revision info, go to the lastest revision for this path 246 $history = $svnrep->getLog($path, "", "", false);
247 $history = $svnrep->getLog($path, "", "", false); 247  
248   248 if (!empty($history->entries[0]))
249 if (!empty($history->entries[0])) 249 $youngest = $history->entries[0]->rev;
250 $youngest = $history->entries[0]->rev; 250 else
251 else 251 $youngest = -1;
252 $youngest = -1; 252  
253   253 // Unless otherwise specified, we get the log details of the latest change
254 // Unless otherwise specified, we get the log details of the latest change 254 if (empty($rev))
255 if (empty($rev)) 255 $logrev = $youngest;
256 $logrev = $youngest; 256 else
257 else 257 $logrev = $rev;
258 $logrev = $rev; 258  
259   259 if ($logrev != $youngest)
260 if ($logrev != $youngest) 260 {
261 { 261 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
262 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false); 262 $logEntry = $logEntry->entries[0];
263 $logEntry = $logEntry->entries[0]; 263 }
264 } 264 else
265 else 265 $logEntry = $history->entries[0];
266 $logEntry = $history->entries[0]; 266  
267   267 $headlog = $svnrep->getLog("/", "", "", true, 1);
268 $headlog = $svnrep->getLog("/", "", "", true, 1); 268 $headrev = $headlog->entries[0]->rev;
269 $headrev = $headlog->entries[0]->rev; 269  
270   270 // If we're not looking at a specific revision, get the HEAD revision number
271 // If we're not looking at a specific revision, get the HEAD revision number 271 // (the revision of the rest of the tree display)
272 // (the revision of the rest of the tree display) 272  
273   273 if (empty($rev))
274 if (empty($rev)) 274 {
275 { 275 $rev = $headrev;
276 $rev = $headrev; 276 }
277 } 277  
278   278 if ($path == "" || $path{0} != "/")
279 if ($path == "" || $path{0} != "/") 279 $ppath = "/".$path;
280 $ppath = "/".$path; 280 else
281 else 281 $ppath = $path;
282 $ppath = $path; 282  
283   283 $vars["repname"] = $rep->getDisplayName();
284 $vars["repname"] = $rep->getDisplayName(); 284  
285   285 $dirurl = $config->getURL($rep, $path, "dir");
286 $dirurl = $config->getURL($rep, $path, "dir"); 286 $logurl = $config->getURL($rep, $path, "log");
287 $logurl = $config->getURL($rep, $path, "log"); 287 $rssurl = $config->getURL($rep, $path, "rss");
288 $rssurl = $config->getURL($rep, $path, "rss"); 288 $dlurl = $config->getURL($rep, $path, "dl");
289 $dlurl = $config->getURL($rep, $path, "dl"); 289 $compurl = $config->getURL($rep, "/", "comp");
290 $compurl = $config->getURL($rep, "/", "comp"); 290  
291   291 if ($passrev != 0 && $passrev != $headrev && $youngest != -1)
292 if ($passrev != 0 && $passrev != $headrev && $youngest != -1) 292 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>";
293 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>"; 293 else
294 else 294 $vars["goyoungestlink"] = "";
295 $vars["goyoungestlink"] = ""; 295  
296   296 $bugtraq = new Bugtraq($rep, $svnrep, $ppath);
297 $bugtraq = new Bugtraq($rep, $svnrep, $ppath); 297  
298   298 $vars["action"] = "";
299 $vars["action"] = ""; 299 $vars["rev"] = $rev;
300 $vars["rev"] = $rev; 300 $vars["path"] = $ppath;
301 $vars["path"] = $ppath; 301 $vars["lastchangedrev"] = $logrev;
302 $vars["lastchangedrev"] = $logrev; 302 $vars["date"] = $logEntry->date;
303 $vars["date"] = $logEntry->date; 303 $vars["author"] = $logEntry->author;
304 $vars["author"] = $logEntry->author; 304 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg)));
305 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))); 305  
306   306 if (!$showchanged)
307 if (!$showchanged) 307 {
308 { 308 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>";
309 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>"; 309 $vars["hidechangeslink"] = "";
310 $vars["hidechangeslink"] = ""; 310  
311   311 $vars["hidechanges"] = true;
312 $vars["hidechanges"] = true; 312 $vars["showchanges"] = false;
313 $vars["showchanges"] = false; 313 }
314 } 314 else
315 else 315 {
316 { 316 $vars["showchangeslink"] = "";
317 $vars["showchangeslink"] = ""; 317
318 318 $changes = $logEntry->mods;
319 $changes = $logEntry->mods; 319
320 320 $firstAdded = true;
321 $firstAdded = true; 321 $firstModded = true;
322 $firstModded = true; 322 $firstDeleted = true;
323 $firstDeleted = true; 323  
324   324 $vars["newfilesbr"] = "";
325 $vars["newfilesbr"] = ""; 325 $vars["newfiles"] = "";
326 $vars["newfiles"] = ""; 326 $vars["changedfilesbr"] = "";
327 $vars["changedfilesbr"] = ""; 327 $vars["changedfiles"] = "";
328 $vars["changedfiles"] = ""; 328 $vars["deletedfilesbr"] = "";
329 $vars["deletedfilesbr"] = ""; 329 $vars["deletedfiles"] = "";
330 $vars["deletedfiles"] = ""; 330  
331   331 foreach ($changes as $file)
332 foreach ($changes as $file) 332 {
333 { 333 switch ($file->action)
334 switch ($file->action) 334 {
335 { 335 case "A":
336 case "A": 336 if (!$firstAdded) $vars["newfilesbr"] .= "<br />";
337 if (!$firstAdded) $vars["newfilesbr"] .= "<br />"; 337 $firstAdded = false;
338 $firstAdded = false; 338 $vars["newfilesbr"] .= fileLink("", $file->path);
339 $vars["newfilesbr"] .= fileLink("", $file->path); 339 $vars["newfiles"] .= " ".fileLink("", $file->path);
340 $vars["newfiles"] .= " ".fileLink("", $file->path); 340 break;
341 break; 341
342 342 case "M":
343 case "M": 343 if (!$firstModded) $vars["changedfilesbr"] .= "<br />";
344 if (!$firstModded) $vars["changedfilesbr"] .= "<br />"; 344 $firstModded = false;
345 $firstModded = false; 345 $vars["changedfilesbr"] .= fileLink("", $file->path);
346 $vars["changedfilesbr"] .= fileLink("", $file->path); 346 $vars["changedfiles"] .= " ".fileLink("", $file->path);
347 $vars["changedfiles"] .= " ".fileLink("", $file->path); 347 break;
348 break; 348  
349   349 case "D":
350 case "D": 350 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />";
351 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />"; 351 $firstDeleted = false;
352 $firstDeleted = false; 352 $vars["deletedfilesbr"] .= $file->path;
353 $vars["deletedfilesbr"] .= $file->path; 353 $vars["deletedfiles"] .= " ".$file->path;
354 $vars["deletedfiles"] .= " ".$file->path; 354 break;
355 break; 355 }
356 } 356 }
357 } 357
358 358 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>";
359 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>"; 359
360 360 $vars["hidechanges"] = false;
361 $vars["hidechanges"] = false; 361 $vars["showchanges"] = true;
362 $vars["showchanges"] = true; 362 }
363 } 363  
364   364 createDirLinks($rep, $ppath, $passrev, $showchanged);
365 createDirLinks($rep, $ppath, $passrev, $showchanged); 365 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>";
366 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>"; 366  
367   367 if ($rev != $headrev)
368 if ($rev != $headrev) 368 {
369 { 369 $history = $svnrep->getLog($path, $rev, "", false);
370 $history = $svnrep->getLog($path, $rev, "", false); 370 }
371 } 371  
372   372 if (isset($history->entries[1]->rev))
373 if (isset($history->entries[1]->rev)) 373 {
374 { 374 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
375 $vars["curdircomplink"] = "<a href=\"${compurl}compare%5B%5D=". 375 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
376 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev. 376 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
377 "&amp;compare%5B%5D=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev. 377 "\">${lang["DIFFPREV"]}</a>";
378 "\">${lang["DIFFPREV"]}</a>"; 378 }
379 } 379 else
380 else 380 {
381 { 381 $vars["curdircomplink"] = "";
382 $vars["curdircomplink"] = ""; 382 }
383 } 383  
384   384 if ($rep->getHideRss())
385 if ($rep->getHideRss()) 385 {
386 { 386 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>";
387 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>"; 387 $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1";
388 $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1"; 388 $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">";
389 $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">"; 389 }
390 } 390  
391   391 // Set up the tarball link
392 // Set up the tarball link 392  
393   393 $subs = explode("/", $path);
394 $subs = explode("/", $path); 394 $level = count($subs) - 2;
395 $level = count($subs) - 2; 395 if ($rep->isDownloadAllowed($path))
396 if ($rep->isDownloadAllowed($path)) 396 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
397 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 397 else
398 else 398 $vars["curdirdllink"] = "";
399 $vars["curdirdllink"] = ""; 399
400 400 $url = $config->getURL($rep, "/", "comp");
401 $url = $config->getURL($rep, "/", "comp"); 401  
402   402 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">";
403 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">"; 403 $vars["compare_submit"] = "<input name=\"comparesubmit\" type=\"submit\" value=\"${lang["COMPAREPATHS"]}\" />";
404 $vars["compare_submit"] = "<input name=\"comparesubmit\" type=\"submit\" value=\"${lang["COMPAREPATHS"]}\" />"; 404 $vars["compare_endform"] = "<input type=\"hidden\" name=\"op\" value=\"comp\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>";
405 $vars["compare_endform"] = "<input type=\"hidden\" name=\"op\" value=\"comp\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>"; 405  
406   406 $listing = array();
407 $listing = array(); 407 $listing = showTreeDir($svnrep, $path, $rev, $listing);
408 $listing = showTreeDir($svnrep, $path, $rev, $listing); 408  
409   409 $vars["version"] = $version;
410 $vars["version"] = $version; 410  
411   411 if (!$rep->hasReadAccess($path, true))
412 if (!$rep->hasReadAccess($path, true)) 412 $vars["noaccess"] = true;
413 $vars["noaccess"] = true; 413  
414   414 if (!$rep->hasReadAccess($path, false))
415 if (!$rep->hasReadAccess($path, false)) 415 $vars["restricted"] = true;
416 $vars["restricted"] = true; 416  
417   417 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
418 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing); 418 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing);
419 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing); 419 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);
420 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing); 420  
421   421 ?>
422 ?> -