Rev 185 Rev 1189
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   54  
55 if ($returnjoin) 55 if ($returnjoin)
56 return $ppath.$pfile; 56 return $ppath.$pfile;
57   57  
58 $isDir = $pfile{strlen($pfile) - 1} == "/"; 58 $isDir = $pfile{strlen($pfile) - 1} == "/";
59 59
60 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = ""; 60 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = "";
61 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = ""; 61 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = "";
62   62  
63 if ($isDir) 63 if ($isDir)
64 { 64 {
65 $url = $config->getURL($rep, $ppath.$pfile, "dir"); 65 $url = $config->getURL($rep, $ppath.$pfile, "dir");
66   66  
67 // XHTML doesn't allow slashes in IDs ~J 67 // XHTML doesn't allow slashes in IDs ~J
68 $id = str_replace('/', '_', $ppath.$pfile); 68 $id = str_replace('/', '_', $ppath.$pfile);
69 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr"; 69 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr";
70   70  
71 $url = removeURLSeparator($url); 71 $url = removeURLSeparator($url);
72 if ($config->treeView) $url .= "#$id"; 72 if ($config->treeView) $url .= "#$id";
73 $url .= "\">$pfile</a>"; 73 $url .= "\">$pfile</a>";
74 } 74 }
75 else 75 else
76 { 76 {
77 $url = $config->getURL($rep, $ppath.$pfile, "file"); 77 $url = $config->getURL($rep, $ppath.$pfile, "file");
78 $url .= $passrevstr.$showchangedstr; 78 $url .= $passrevstr.$showchangedstr;
79 $url = removeURLSeparator($url); 79 $url = removeURLSeparator($url);
80 $url = "<a href=\"${url}\">$pfile</a>"; 80 $url = "<a href=\"${url}\">$pfile</a>";
81 } 81 }
82   82  
83 return $url; 83 return $url;
84 } 84 }
85   85  
-   86 function fileLinkGetFile($path, $file)
-   87 {
-   88 global $rep, $passrev, $showchanged, $config;
-   89  
-   90 if ($path == "" || $path{0} != "/")
-   91 $ppath = "/".$path;
-   92 else
-   93 $ppath = $path;
-   94  
-   95 if ($ppath{strlen($ppath)-1} != "/")
-   96 $ppath .= "/";
-   97  
-   98 if ($file{0} == "/")
-   99 $pfile = substr($file, 1);
-   100 else
-   101 $pfile = $file;
-   102  
-   103 $isDir = $pfile{strlen($pfile) - 1} == "/";
-   104  
-   105 if (!$isDir)
-   106 {
-   107 $url = $config->getURL($rep, $ppath.$pfile, "file");
-   108 $url = removeURLSeparator($url);
-   109 $url = "<a href=\"${url}&getfile\">Get</a>";
-   110 }
-   111  
-   112 return $url;
-   113 }
-   114  
86 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true) 115 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
87 { 116 {
88 global $rep, $passrev, $showchanged, $config, $lang; 117 global $rep, $passrev, $showchanged, $config, $lang;
89   118  
90 $path = ""; 119 $path = "";
91   120  
-   121 // Explicitly requested file as attachment
-   122 if (isset($_REQUEST['getfile']))
-   123 {
-   124 $base = basename($path);
-   125  
-   126 header("Content-Type: application/octet-stream");
-   127 header("Content-Length: $size");
-   128 header("Content-Disposition: inline; filename=".urlencode($base));
-   129  
-   130 $svnrep->getFileContents($path, "", $rev);
-   131  
-   132 exit;
-   133 }
-   134  
92 if (!$treeview) 135 if (!$treeview)
93 $level = $limit; 136 $level = $limit;
94   137  
95 for ($n = 0; $n <= $level; $n++) 138 for ($n = 0; $n <= $level; $n++)
96 { 139 {
97 $path .= $subs[$n]."/"; 140 $path .= $subs[$n]."/";
98 } 141 }
99   142  
100 $contents = $svnrep->dirContents($path, $rev); 143 $contents = $svnrep->dirContents($path, $rev);
101   144  
102 // List each file in the current directory 145 // List each file in the current directory
103 $loop = 0; 146 $loop = 0;
104 $last_index = 0; 147 $last_index = 0;
105 $openDir = false; 148 $openDir = false;
106 $fullaccess = $rep->hasReadAccess($path, false); 149 $fullaccess = $rep->hasReadAccess($path, false);
107 150
108 foreach($contents as $file) 151 foreach($contents as $file)
109 { 152 {
110 $isDir = ($file{strlen($file) - 1} == "/"?1:0); 153 $isDir = ($file{strlen($file) - 1} == "/"?1:0);
111 $access = false; 154 $access = false;
112   155  
113 if ($isDir) 156 if ($isDir)
114 { 157 {
115 if ($rep->hasReadAccess($path.$file, true)) 158 if ($rep->hasReadAccess($path.$file, true))
116 { 159 {
117 $access = true; 160 $access = true;
118 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file)); 161 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
119 162  
120 if ($openDir) 163 if ($openDir)
121 $listing[$index]["filetype"] = "diropen"; 164 $listing[$index]["filetype"] = "diropen";
122 else 165 else
123 $listing[$index]["filetype"] = "dir"; 166 $listing[$index]["filetype"] = "dir";
124   167  
125 if ($rep->isDownloadAllowed($path.$file)) 168 if ($rep->isDownloadAllowed($path.$file))
126 { 169 {
127 $dlurl = $config->getURL($rep, $path.$file, "dl"); 170 $dlurl = $config->getURL($rep, $path.$file, "dl");
128 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 171 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
129 } 172 }
130 else 173 else
131 $listing[$index]["fileviewdllink"] = "&nbsp;"; 174 $listing[$index]["fileviewdllink"] = "&nbsp;";
132 } 175 }
133 } 176 }
134 else 177 else
135 { 178 {
136 if ($fullaccess) 179 if ($fullaccess)
137 { 180 {
138 $access = true; 181 $access = true;
139 if ($level != $limit) 182 if ($level != $limit)
140 { 183 {
141 // List directories only, skip all files 184 // List directories only, skip all files
142 continue; 185 continue;
143 } 186 }
144 187
145 $listing[$index]["fileviewdllink"] = "&nbsp;"; 188 $listing[$index]["fileviewdllink"] = "&nbsp;";
146 $listing[$index]["filetype"] = strrchr($file, "."); 189 $listing[$index]["filetype"] = strrchr($file, ".");
147 } 190 }
148 } 191 }
149 192  
150 if ($access) 193 if ($access)
151 { 194 {
152 $listing[$index]["rowparity"] = ($index % 2)?"1":"0"; 195 $listing[$index]["rowparity"] = ($index % 2)?"L1":"L0";
153 196
154 if ($treeview) 197 if ($treeview)
155 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />"; 198 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />";
156 else 199 else
157 $listing[$index]["compare_box"] = ""; 200 $listing[$index]["compare_box"] = "";
158 201  
159 if ($openDir) 202 if ($openDir)
160 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>"; 203 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>";
161 else 204 else
162 $listing[$index]["filelink"] = fileLink($path, $file); 205 $listing[$index]["filelink"] = fileLink($path, $file);
-   206  
-   207 if ($isDir)
-   208 $listing[$index]["filelinkgetfile"] = "";
-   209 else
-   210 $listing[$index]["filelinkgetfile"] = fileLinkGetFile($path, $file);
163 211  
164 // The history command doesn't return with a trailing slash. We need to remember here if the 212 // The history command doesn't return with a trailing slash. We need to remember here if the
165 // file is a directory or not! 213 // file is a directory or not!
166 214  
167 $listing[$index]["isDir"] = $isDir; 215 $listing[$index]["isDir"] = $isDir;
168 216  
169 if ($treeview) 217 if ($treeview)
170 $listing[$index]["level"] = $level; 218 $listing[$index]["level"] = $level;
171 else 219 else
172 $listing[$index]["level"] = 0; 220 $listing[$index]["level"] = 0;
173   221  
174 $listing[$index]["node"] = 0; // t-node 222 $listing[$index]["node"] = 0; // t-node
175 223  
176 $fileurl = $config->getURL($rep, $path.$file, "log"); 224 $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>"; 225 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>";
178 226  
179 $rssurl = $config->getURL($rep, $path.$file, "rss"); 227 $rssurl = $config->getURL($rep, $path.$file, "rss");
180 if ($rep->getHideRss()) 228 if ($rep->getHideRss())
181 { 229 {
182 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>"; 230 $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\">"; 231 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">";
184 } 232 }
185 233  
186 $index++; 234 $index++;
187 $loop++; 235 $loop++;
188 $last_index = $index; 236 $last_index = $index;
189 237  
190 if (($level != $limit) && ($isDir)) 238 if (($level != $limit) && ($isDir))
191 { 239 {
192 if (!strcmp($subs[$level + 1]."/", $file)) 240 if (!strcmp($subs[$level + 1]."/", $file))
193 { 241 {
194 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index); 242 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
195 $index = count($listing); 243 $index = count($listing);
196 } 244 }
197 } 245 }
198   246  
199 } 247 }
200 } 248 }
201   249  
202 if ($last_index != 0 && $treeview) 250 if ($last_index != 0 && $treeview)
203 { 251 {
204 $listing[$last_index - 1]["node"] = 1; // l-node 252 $listing[$last_index - 1]["node"] = 1; // l-node
205 } 253 }
206   254  
207 return $listing; 255 return $listing;
208 } 256 }
209   257  
210 function showTreeDir($svnrep, $path, $rev, $listing) 258 function showTreeDir($svnrep, $path, $rev, $listing)
211 { 259 {
212 global $vars, $config; 260 global $vars, $config;
213   261  
214 $subs = explode("/", $path); 262 $subs = explode("/", $path);
215   263  
216 // For directory, the last element in the subs is empty. 264 // For directory, the last element in the subs is empty.
217 // For file, the last element in the subs is the file name. 265 // For file, the last element in the subs is the file name.
218 // Therefore, it is always count($subs) - 2 266 // Therefore, it is always count($subs) - 2
219 $limit = count($subs) - 2; 267 $limit = count($subs) - 2;
220   268  
221 for ($n = 0; $n < $limit; $n++) 269 for ($n = 0; $n < $limit; $n++)
222 { 270 {
223 $vars["last_i_node"][$n] = FALSE; 271 $vars["last_i_node"][$n] = FALSE;
224 } 272 }
225   273  
226 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView); 274 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView);
227   275  
228 } 276 }
229   277  
230 // Make sure that we have a repository 278 // Make sure that we have a repository
231 if (!isset($rep)) 279 if (!isset($rep))
232 { 280 {
233 echo $lang["NOREP"]; 281 echo $lang["NOREP"];
234 exit; 282 exit;
235 } 283 }
236   284  
237 $svnrep = new SVNRepository($rep); 285 $svnrep = new SVNRepository($rep);
238   286  
239 // Revision info to pass along chain 287 // Revision info to pass along chain
240 $passrev = $rev; 288 $passrev = $rev;
241   289  
242 // Get the directory contents of the given revision, or HEAD if not defined 290 // Get the directory contents of the given revision, or HEAD if not defined
243 $contents = $svnrep->dirContents($path, @$rev); 291 $contents = $svnrep->dirContents($path, @$rev);
244   292  
245 // If there's no revision info, go to the lastest revision for this path 293 // If there's no revision info, go to the lastest revision for this path
246 $history = $svnrep->getLog($path, "", "", false); 294 $history = $svnrep->getLog($path, "", "", false);
247   295  
248 if (!empty($history->entries[0])) 296 if (!empty($history->entries[0]))
249 $youngest = $history->entries[0]->rev; 297 $youngest = $history->entries[0]->rev;
250 else 298 else
251 $youngest = -1; 299 $youngest = -1;
252   300  
253 // Unless otherwise specified, we get the log details of the latest change 301 // Unless otherwise specified, we get the log details of the latest change
254 if (empty($rev)) 302 if (empty($rev))
255 $logrev = $youngest; 303 $logrev = $youngest;
256 else 304 else
257 $logrev = $rev; 305 $logrev = $rev;
258   306  
259 if ($logrev != $youngest) 307 if ($logrev != $youngest)
260 { 308 {
261 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false); 309 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
262 $logEntry = $logEntry->entries[0]; 310 $logEntry = $logEntry->entries[0];
263 } 311 }
264 else 312 else
265 $logEntry = $history->entries[0]; 313 $logEntry = $history->entries[0];
266   314  
267 $headlog = $svnrep->getLog("/", "", "", true, 1); 315 $headlog = $svnrep->getLog("/", "", "", true, 1);
268 $headrev = $headlog->entries[0]->rev; 316 $headrev = $headlog->entries[0]->rev;
269   317  
270 // If we're not looking at a specific revision, get the HEAD revision number 318 // If we're not looking at a specific revision, get the HEAD revision number
271 // (the revision of the rest of the tree display) 319 // (the revision of the rest of the tree display)
272   320  
273 if (empty($rev)) 321 if (empty($rev))
274 { 322 {
275 $rev = $headrev; 323 $rev = $headrev;
276 } 324 }
277   325  
278 if ($path == "" || $path{0} != "/") 326 if ($path == "" || $path{0} != "/")
279 $ppath = "/".$path; 327 $ppath = "/".$path;
280 else 328 else
281 $ppath = $path; 329 $ppath = $path;
282   330  
283 $vars["repname"] = $rep->getDisplayName(); 331 $vars["repname"] = $rep->getDisplayName();
284   332  
285 $dirurl = $config->getURL($rep, $path, "dir"); 333 $dirurl = $config->getURL($rep, $path, "dir");
286 $logurl = $config->getURL($rep, $path, "log"); 334 $logurl = $config->getURL($rep, $path, "log");
287 $rssurl = $config->getURL($rep, $path, "rss"); 335 $rssurl = $config->getURL($rep, $path, "rss");
288 $dlurl = $config->getURL($rep, $path, "dl"); 336 $dlurl = $config->getURL($rep, $path, "dl");
289 $compurl = $config->getURL($rep, "/", "comp"); 337 $compurl = $config->getURL($rep, "/", "comp");
290   338  
291 if ($passrev != 0 && $passrev != $headrev && $youngest != -1) 339 if ($passrev != 0 && $passrev != $headrev && $youngest != -1)
292 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>"; 340 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>";
293 else 341 else
294 $vars["goyoungestlink"] = ""; 342 $vars["goyoungestlink"] = "";
295   343  
296 $bugtraq = new Bugtraq($rep, $svnrep, $ppath); 344 $bugtraq = new Bugtraq($rep, $svnrep, $ppath);
297   345  
298 $vars["action"] = ""; 346 $vars["action"] = "";
299 $vars["rev"] = $rev; 347 $vars["rev"] = $rev;
300 $vars["path"] = $ppath; 348 $vars["path"] = $ppath;
301 $vars["lastchangedrev"] = $logrev; 349 $vars["lastchangedrev"] = $logrev;
302 $vars["date"] = $logEntry->date; 350 $vars["date"] = $logEntry->date;
303 $vars["author"] = $logEntry->author; 351 $vars["author"] = $logEntry->author;
304 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))); 352 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg)));
305   353  
306 if (!$showchanged) 354 if (!$showchanged)
307 { 355 {
308 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>"; 356 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>";
309 $vars["hidechangeslink"] = ""; 357 $vars["hidechangeslink"] = "";
310   358  
311 $vars["hidechanges"] = true; 359 $vars["hidechanges"] = true;
312 $vars["showchanges"] = false; 360 $vars["showchanges"] = false;
313 } 361 }
314 else 362 else
315 { 363 {
316 $vars["showchangeslink"] = ""; 364 $vars["showchangeslink"] = "";
317 365
318 $changes = $logEntry->mods; 366 $changes = $logEntry->mods;
319 367
320 $firstAdded = true; 368 $firstAdded = true;
321 $firstModded = true; 369 $firstModded = true;
322 $firstDeleted = true; 370 $firstDeleted = true;
323   371  
324 $vars["newfilesbr"] = ""; 372 $vars["newfilesbr"] = "";
325 $vars["newfiles"] = ""; 373 $vars["newfiles"] = "";
326 $vars["changedfilesbr"] = ""; 374 $vars["changedfilesbr"] = "";
327 $vars["changedfiles"] = ""; 375 $vars["changedfiles"] = "";
328 $vars["deletedfilesbr"] = ""; 376 $vars["deletedfilesbr"] = "";
329 $vars["deletedfiles"] = ""; 377 $vars["deletedfiles"] = "";
330   378  
331 foreach ($changes as $file) 379 foreach ($changes as $file)
332 { 380 {
333 switch ($file->action) 381 switch ($file->action)
334 { 382 {
335 case "A": 383 case "A":
336 if (!$firstAdded) $vars["newfilesbr"] .= "<br />"; 384 if (!$firstAdded) $vars["newfilesbr"] .= "<br />";
337 $firstAdded = false; 385 $firstAdded = false;
338 $vars["newfilesbr"] .= fileLink("", $file->path); 386 $vars["newfilesbr"] .= fileLink("", $file->path);
339 $vars["newfiles"] .= " ".fileLink("", $file->path); 387 $vars["newfiles"] .= " ".fileLink("", $file->path);
340 break; 388 break;
341 -  
-   389  
342 case "M": 390 case "M":
343 if (!$firstModded) $vars["changedfilesbr"] .= "<br />"; 391 if (!$firstModded) $vars["changedfilesbr"] .= "<br />";
344 $firstModded = false; 392 $firstModded = false;
345 $vars["changedfilesbr"] .= fileLink("", $file->path); 393 $vars["changedfilesbr"] .= fileLink("", $file->path);
346 $vars["changedfiles"] .= " ".fileLink("", $file->path); 394 $vars["changedfiles"] .= " ".fileLink("", $file->path);
347 break; 395 break;
348   396  
349 case "D": 397 case "D":
350 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />"; 398 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />";
351 $firstDeleted = false; 399 $firstDeleted = false;
352 $vars["deletedfilesbr"] .= $file->path; 400 $vars["deletedfilesbr"] .= $file->path;
353 $vars["deletedfiles"] .= " ".$file->path; 401 $vars["deletedfiles"] .= " ".$file->path;
354 break; 402 break;
355 } 403 }
356 } 404 }
357 405  
358 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>"; 406 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>";
359 407  
360 $vars["hidechanges"] = false; 408 $vars["hidechanges"] = false;
361 $vars["showchanges"] = true; 409 $vars["showchanges"] = true;
362 } 410 }
363   411  
364 createDirLinks($rep, $ppath, $passrev, $showchanged); 412 createDirLinks($rep, $ppath, $passrev, $showchanged);
365 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>"; 413 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>";
366   414  
367 if ($rev != $headrev) 415 if ($rev != $headrev)
368 { 416 {
369 $history = $svnrep->getLog($path, $rev, "", false); 417 $history = $svnrep->getLog($path, $rev, "", false);
370 } 418 }
371   419  
372 if (isset($history->entries[1]->rev)) 420 if (isset($history->entries[1]->rev))
373 { 421 {
374 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=". 422 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
375 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev. 423 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
376 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev. 424 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
377 "\">${lang["DIFFPREV"]}</a>"; 425 "\">${lang["DIFFPREV"]}</a>";
378 } 426 }
379 else 427 else
380 { 428 {
381 $vars["curdircomplink"] = ""; 429 $vars["curdircomplink"] = "";
382 } 430 }
383   431  
384 if ($rep->getHideRss()) 432 if ($rep->getHideRss())
385 { 433 {
386 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>"; 434 $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"; 435 $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\">"; 436 $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">";
389 } 437 }
390   438  
391 // Set up the tarball link 439 // Set up the tarball link
392   440  
393 $subs = explode("/", $path); 441 $subs = explode("/", $path);
394 $level = count($subs) - 2; 442 $level = count($subs) - 2;
395 if ($rep->isDownloadAllowed($path)) 443 if ($rep->isDownloadAllowed($path))
396 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 444 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
397 else 445 else
398 $vars["curdirdllink"] = ""; 446 $vars["curdirdllink"] = "";
399 447
400 $url = $config->getURL($rep, "/", "comp"); 448 $url = $config->getURL($rep, "/", "comp");
401   449  
402 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">"; 450 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">";
403 $vars["compare_submit"] = "<input name=\"comparesubmit\" type=\"submit\" value=\"${lang["COMPAREPATHS"]}\" />"; 451 $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>"; 452 $vars["compare_endform"] = "<input type=\"hidden\" name=\"op\" value=\"comp\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>";
405   453  
406 $listing = array(); 454 $listing = array();
407 $listing = showTreeDir($svnrep, $path, $rev, $listing); 455 $listing = showTreeDir($svnrep, $path, $rev, $listing);
408   456  
409 $vars["version"] = $version; 457 $vars["version"] = $version;
410   458  
411 if (!$rep->hasReadAccess($path, true)) 459 if (!$rep->hasReadAccess($path, true))
412 $vars["noaccess"] = true; 460 $vars["noaccess"] = true;
413   461  
414 if (!$rep->hasReadAccess($path, false)) 462 if (!$rep->hasReadAccess($path, false))
415 $vars["restricted"] = true; 463 $vars["restricted"] = true;
416   464  
417 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing); 465 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
418 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing); 466 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing);
419 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing); 467 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);
420   468  
421 ?> 469 ?>