130 |
kaklik |
1 |
<?php |
|
|
2 |
# vim:et:ts=3:sts=3:sw=3:fdm=marker: |
|
|
3 |
|
|
|
4 |
// WebSVN - Subversion repository viewing via the web using PHP |
|
|
5 |
// Copyright © 2004-2006 Tim Armes, Matt Sicker |
|
|
6 |
// |
|
|
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 |
|
|
9 |
// the Free Software Foundation; either version 2 of the License, or |
|
|
10 |
// (at your option) any later version. |
|
|
11 |
// |
|
|
12 |
// This program is distributed in the hope that it will be useful, |
|
|
13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
15 |
// GNU General Public License for more details. |
|
|
16 |
// |
|
|
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 |
|
|
19 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
20 |
// |
|
|
21 |
// -- |
|
|
22 |
// |
|
|
23 |
// wsvn.php |
|
|
24 |
// |
|
|
25 |
// Glue for MultiViews |
|
|
26 |
|
|
|
27 |
// --- CONFIGURE THESE VARIABLES --- |
|
|
28 |
|
|
|
29 |
// Location of websvn directory via HTTP |
|
|
30 |
// |
|
|
31 |
// e.g. For http://servername/websvn use /websvn |
|
|
32 |
// |
|
|
33 |
// Note that wsvn.php need not be in the /websvn directory (and normally isn't). |
|
|
34 |
// If you want to use the root server directory, just use a blank string (''). |
|
|
35 |
#$locwebsvnhttp = "/websvn"; |
|
|
36 |
$locwebsvnhttp = ''; |
|
|
37 |
|
|
|
38 |
// Physical location of websvn directory |
|
|
39 |
#$locwebsvnreal = "d:/websvn"; |
|
|
40 |
$locwebsvnreal = '/home/junx/docs/wsvn'; |
|
|
41 |
|
|
|
42 |
chdir($locwebsvnreal); |
|
|
43 |
|
|
|
44 |
// --- DON'T CHANGE BELOW HERE --- |
|
|
45 |
|
|
|
46 |
// this tells files that we are in multiviews if they are unable to access |
|
|
47 |
// the $config variable |
|
|
48 |
if (!defined('WSVN_MULTIVIEWS')) |
|
|
49 |
define('WSVN_MULTIVIEWS', 1); |
|
|
50 |
|
|
|
51 |
ini_set("include_path", $locwebsvnreal); |
|
|
52 |
|
|
|
53 |
require_once("include/setup.inc"); |
|
|
54 |
require_once("include/svnlook.inc"); |
|
|
55 |
|
|
|
56 |
if (!isset($_REQUEST["sc"])) |
|
|
57 |
$_REQUEST["sc"] = 1; |
|
|
58 |
|
|
|
59 |
if ($config->multiViews) |
|
|
60 |
{ |
|
|
61 |
// If this is a form handling request, deal with it |
|
|
62 |
if (@$_REQUEST["op"] == "form") |
|
|
63 |
{ |
|
|
64 |
include("$locwebsvnreal/form.php"); |
|
|
65 |
exit; |
|
|
66 |
} |
|
|
67 |
|
|
|
68 |
$path = @$_SERVER["PATH_INFO"]; |
|
|
69 |
|
|
|
70 |
// Remove initial slash |
|
|
71 |
$path = substr($path, 1); |
|
|
72 |
if (empty($path)) |
|
|
73 |
{ |
|
|
74 |
include("$locwebsvnreal/index.php"); |
|
|
75 |
exit; |
|
|
76 |
} |
|
|
77 |
|
|
|
78 |
// Split the path into repository and path elements |
|
|
79 |
// Note: we have to cope with the repository name |
|
|
80 |
// having a slash in it |
|
|
81 |
|
|
|
82 |
$found = false; |
|
|
83 |
|
|
|
84 |
foreach ($config->getRepositories() as $rep) |
|
|
85 |
{ |
|
|
86 |
$pos = strlen($rep->getDisplayName()); |
|
|
87 |
if (strlen($path) < $pos) |
|
|
88 |
continue; |
|
|
89 |
|
|
|
90 |
$name = substr($path, 0, $pos); |
|
|
91 |
if (strcasecmp($rep->getDisplayName(), $name) == 0) |
|
|
92 |
{ |
|
|
93 |
$tpath = substr($path, $pos); |
|
|
94 |
if ($tpath[0] == "/") { |
|
|
95 |
$found = true; |
|
|
96 |
$path = $tpath; |
|
|
97 |
break; |
|
|
98 |
} |
|
|
99 |
} |
|
|
100 |
} |
|
|
101 |
|
|
|
102 |
if ($found == false) |
|
|
103 |
{ |
|
|
104 |
include("$locwebsvnreal/index.php"); |
|
|
105 |
exit; |
|
|
106 |
} |
|
|
107 |
|
|
|
108 |
createProjectSelectionForm(); |
|
|
109 |
$vars["allowdownload"] = $rep->getAllowDownload(); |
|
|
110 |
|
|
|
111 |
// find the operation type |
|
|
112 |
$op = @$_REQUEST["op"]; |
|
|
113 |
switch ($op) |
|
|
114 |
{ |
|
|
115 |
case "dir": |
|
|
116 |
$file = "listing.php"; |
|
|
117 |
break; |
|
|
118 |
|
|
|
119 |
case "file": |
|
|
120 |
$file = "filedetails.php"; |
|
|
121 |
break; |
|
|
122 |
|
|
|
123 |
case "log": |
|
|
124 |
$file = "log.php"; |
|
|
125 |
break; |
|
|
126 |
|
|
|
127 |
case "diff": |
|
|
128 |
$file = "diff.php"; |
|
|
129 |
break; |
|
|
130 |
|
|
|
131 |
case "blame": |
|
|
132 |
$file = "blame.php"; |
|
|
133 |
break; |
|
|
134 |
|
|
|
135 |
case "rss": |
|
|
136 |
$file = "rss.php"; |
|
|
137 |
break; |
|
|
138 |
|
|
|
139 |
case "dl": |
|
|
140 |
$file = "dl.php"; |
|
|
141 |
break; |
|
|
142 |
|
|
|
143 |
case "comp": |
|
|
144 |
$file = "comp.php"; |
|
|
145 |
break; |
|
|
146 |
|
|
|
147 |
default: |
|
|
148 |
if ($path[strlen($path) - 1] == "/") |
|
|
149 |
$file = "listing.php"; |
|
|
150 |
else |
|
|
151 |
$file = "filedetails.php"; |
|
|
152 |
} |
|
|
153 |
|
|
|
154 |
// Now include the file that handles it |
|
|
155 |
include("$locwebsvnreal/$file"); |
|
|
156 |
} |
|
|
157 |
else |
|
|
158 |
{ |
|
|
159 |
print "<p>MultiViews must be configured in config.inc in order to use this file"; |
|
|
160 |
exit; |
|
|
161 |
} |