websvn |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 29... | Line 29... | |
// Include the configuration class |
// Include the configuration class | |
require_once 'include/configclass.php'; |
require_once 'include/configclass.php'; | |
|
| |
// Create the config |
// Create the config | |
$config = new WebSvnConfig(); |
$config = new WebSvnConfig(); | |
| ||
if (DIRECTORY_SEPARATOR == '\\') { | ||
$config->setServerIsWindows(); | ||
} | ||
|
| |
// Set up the default character encodings |
// Set up the default character encodings | |
if (function_exists('iconv_get_encoding')) { |
if (function_exists('iconv_get_encoding')) { | |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); | |
} |
} | |
Line 179... | Line 183... | |
|
| |
// List of extensions recognised by enscript. |
// List of extensions recognised by enscript. | |
|
| |
$extEnscript = array |
$extEnscript = array | |
( |
( | |
'.ada' => 'ada', |
'.ada' => 'ada', | |
'.adb' => 'ada', |
'.adb' => 'ada', | |
'.ads' => 'ada', |
'.ads' => 'ada', | |
'.awk' => 'awk', |
'.awk' => 'awk', | |
'.c' => 'c', |
'.c' => 'c', | |
'.c++' => 'cpp', |
'.c++' => 'cpp', | |
'.cc' => 'cpp', |
'.cc' => 'cpp', | |
'.cpp' => 'cpp', |
'.cpp' => 'cpp', | |
'.csh' => 'csh', |
'.csh' => 'csh', | |
'.cxx' => 'cpp', |
'.cxx' => 'cpp', | |
'.diff' => 'diffu', |
'.diff' => 'diffu', | |
'.dpr' => 'delphi', |
'.dpr' => 'delphi', | |
'.e' => 'eiffel', |
'.e' => 'eiffel', | |
'.el' => 'elisp', |
'.el' => 'elisp', | |
'.eps' => 'postscript', |
'.eps' => 'postscript', | |
'.f' => 'fortran', |
'.f' => 'fortran', | |
'.for' => 'fortran', |
'.for' => 'fortran', | |
'.gs' => 'haskell', |
'.gs' => 'haskell', | |
'.h' => 'c', |
'.h' => 'c', | |
'.hpp' => 'cpp', |
'.hpp' => 'cpp', | |
'.hs' => 'haskell', |
'.hs' => 'haskell', | |
'.htm' => 'html', |
'.htm' => 'html', | |
'.html' => 'html', |
'.html' => 'html', | |
'.idl' => 'idl', |
'.idl' => 'idl', | |
'.java' => 'java', |
'.java' => 'java', | |
'.js' => 'javascript', |
'.js' => 'javascript', | |
'.lgs' => 'haskell', |
'.lgs' => 'haskell', | |
'.lhs' => 'haskell', |
'.lhs' => 'haskell', | |
'.m' => 'objc', |
'.m' => 'objc', | |
'.m4' => 'm4', |
'.m4' => 'm4', | |
'.man' => 'nroff', |
'.man' => 'nroff', | |
'.nr' => 'nroff', |
'.nr' => 'nroff', | |
'.p' => 'pascal', |
'.p' => 'pascal', | |
'.pas' => 'delphi', |
'.pas' => 'delphi', | |
'.patch' => 'diffu', |
'.patch' => 'diffu', | |
'.pkg' => 'sql', |
'.pkg' => 'sql', | |
'.pl' => 'perl', |
'.pl' => 'perl', | |
'.pm' => 'perl', |
'.pm' => 'perl', | |
'.pp' => 'pascal', |
'.pp' => 'pascal', | |
'.ps' => 'postscript', |
'.ps' => 'postscript', | |
'.s' => 'asm', |
'.s' => 'asm', | |
'.scheme' => 'scheme', |
'.scheme' => 'scheme', | |
'.scm' => 'scheme', |
'.scm' => 'scheme', | |
'.scr' => 'synopsys', |
'.scr' => 'synopsys', | |
'.sh' => 'sh', |
'.sh' => 'sh', | |
'.shtml' => 'html', |
'.shtml' => 'html', | |
'.sql' => 'sql', |
'.sql' => 'sql', | |
'.st' => 'states', |
'.st' => 'states', | |
'.syn' => 'synopsys', |
'.syn' => 'synopsys', | |
'.synth' => 'synopsys', |
'.synth' => 'synopsys', | |
'.tcl' => 'tcl', |
'.tcl' => 'tcl', | |
'.tex' => 'tex', |
'.tex' => 'tex', | |
'.texi' => 'tex', |
'.texi' => 'tex', | |
'.texinfo' => 'tex', |
'.texinfo' => 'tex', | |
'.v' => 'verilog', |
'.v' => 'verilog', | |
'.vba' => 'vba', |
'.vba' => 'vba', | |
'.vh' => 'verilog', |
'.vh' => 'verilog', | |
'.vhd' => 'vhdl', |
'.vhd' => 'vhdl', | |
'.vhdl' => 'vhdl', |
'.vhdl' => 'vhdl', | |
'.py' => 'python', |
'.py' => 'python', | |
); | ||
|
| |
// The following are handled internally by WebSVN, since there's no |
// }}} | |
// support for them in Enscript |
||
|
| |
'.php' => 'php', |
// {{{ GeSHi file extensions | |
'.phtml' => 'php', |
| |
'.php3' => 'php', |
// List of extensions recognised by GeSHi. | |
'.php' => 'php' |
| |
$extGeshi = array | ||
( | ||
'actionscript3' => array('as'), | ||
'ada' => array('ada', 'adb', 'ads'), | ||
'asm' => array('ash', 'asi', 'asm'), | ||
'asp' => array('asp'), | ||
'bash' => array('sh'), | ||
'c' => array('c'), | ||
'cfm' => array('cfm', 'cfml'), | ||
'cobol' => array('cbl'), | ||
'cpp' => array('cc', 'cpp', 'cxx', 'c++', 'h', 'hpp'), | ||
'csharp' => array('cs'), | ||
'css' => array('css'), | ||
'd' => array('d'), | ||
'delphi' => array('dpk', 'dpr', 'pas'), | ||
'diff' => array('diff', 'patch'), | ||
'dos' => array('bat', 'cmd'), | ||
'eiffel' => array('e'), | ||
'email' => array('eml'), | ||
'fortran' => array('f', 'for'), | ||
'gettext' => array('po', 'pot'), | ||
'gml' => array('gml'), | ||
'gnuplot' => array('plt'), | ||
'groovy' => array('groovy'), | ||
'haskell' => array('gs', 'hs', 'lgs', 'lhs'), | ||
'html4strict' => array('html', 'htm'), | ||
'idl' => array('idl'), | ||
'ini' => array('desktop', 'ini'), | ||
'java5' => array('java'), | ||
'javascript' => array('js'), | ||
'latex' => array('tex'), | ||
'lisp' => array('lisp'), | ||
'lua' => array('lua'), | ||
'make' => array('make'), | ||
'matlab' => array('m'), | ||
'perl' => array('pl', 'pm'), | ||
'php' => array('php', 'php3', 'php4', 'php5', 'phps', 'phtml'), | ||
'povray' => array('pov'), | ||
'providex' => array('pvc', 'pvx'), | ||
'python' => array('py'), | ||
'reg' => array('reg'), | ||
'ruby' => array('rb'), | ||
'scala' => array('scala'), | ||
'scheme' => array('scm', 'scheme'), | ||
'scilab' => array('sci'), | ||
'smalltalk' => array('st'), | ||
'sql' => array('sql'), | ||
'tcl' => array('tcl'), | ||
'vb' => array('bas'), | ||
'vh' => array('v', 'verilog'), | ||
'vhdl' => array('vhd', 'vhdl'), | ||
'vim' => array('vim'), | ||
'whitespace' => array('ws'), | ||
'xml' => array('xml', 'xsl', 'xsd', 'xib', 'wsdl', 'svg', 'plist'), | ||
'z80' => array('z80'), | ||
); |
); | |
|
| |
// }}} |
// }}} | |
|
| |
// Include a default language file (must go before config.php) |
// Include a default language file (must go before config.php) | |
require 'languages/english.php'; |
require 'languages/english.php'; | |
|
| |
// Get the user's personalised config (requires the locwebsvnhttp stuff above) |
// Get the user's personalised config (requires the locwebsvnhttp stuff above) | |
require_once 'config.php'; |
if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'config.php')) { | |
require_once 'config.php'; | ||
} else { | ||
die('File "includes'.DIRECTORY_SEPARATOR.'config.php" does not exists, please create one. The example is located under "includes'.DIRECTORY_SEPARATOR.'distconfig.php"'); | ||
} | ||
|
| |
require_once 'include/svnlook.php'; |
require_once 'include/svnlook.php'; | |
|
| |
// Make sure that the input locale is set up correctly |
// Make sure that the input locale is set up correctly | |
setlocale(LC_ALL, ''); |
setlocale(LC_ALL, ''); | |
Line 268... | Line 331... | |
|
| |
$zipped = array(); |
$zipped = array(); | |
|
| |
// Set up the version info |
// Set up the version info | |
|
| |
initSvnVersion($major,$minor); |
initSvnVersion(); | |
$vars['svnversion'] = $config->getSubversionVersion(); | ||
|
| |
// Get the user choice if there is one, and memorise the setting |
// Get the user choice if there is one, and memorise the setting as a cookie | |
// as a cookie (since we don't have user accounts, we can't store the setting |
// (since we don't have user accounts, we can't store the setting anywhere | |
// anywhere else). We try to memorise a permanent cookie and a per session cookie |
// else). We try to memorise a permanent cookie and a per session cookie in | |
// in case the user has disabled permanent ones. |
// case the user has disabled permanent ones. | |
|
| |
$userLang = false; |
$userLang = false; | |
if (!empty($_REQUEST['langchoice'])) { |
if (!empty($_REQUEST['langchoice'])) { | |
$userLang = $_REQUEST['langchoice']; |
$userLang = $_REQUEST['langchoice']; | |
setcookie('storedlang', $_REQUEST['langchoice'], time()+(3600*24*356*10), '/'); |
setcookie('storedlang', $_REQUEST['langchoice'], time()+(3600*24*356*10), '/'); | |
Line 327... | Line 391... | |
// Set up headers |
// Set up headers | |
|
| |
header('Content-Type: text/html; charset=UTF-8'); |
header('Content-Type: text/html; charset=UTF-8'); | |
header('Content-Language: '.$userLang); |
header('Content-Language: '.$userLang); | |
|
| |
// Make sure that the user has set up a repository |
// multiviews has custom code to load the repository | |
if (!$config->multiViews) { | ||
// if the repoparameter has been set load the corresponding | ||
// repository, else load the default | ||
$repname = @$_REQUEST["repname"]; | ||
if (isset($repname)) { | ||
$rep = $config->findRepository($repname); | ||
} else { | ||
$reps = $config->getRepositories(); | ||
$rep = (isset($reps[0]) ? $reps[0] : null); | ||
} | ||
|
| |
$reps = $config->getRepositories(); |
// Make sure that the user has set up a repository | |
if (empty($reps[0])) { |
if ($rep == null) { | |
echo $lang["SUPPLYREP"]; |
echo $lang["SUPPLYREP"]; | |
exit; |
exit; | |
} | ||
} |
} | |
|
| |
// Override the rep parameter with the repository name if it's available |
||
$repname = @$_REQUEST["repname"]; |
||
if (isset($repname)) { |
||
$repname = urldecode($repname); |
||
$rep = $config->findRepository($repname); |
||
} else { |
||
$rep = $reps[0]; |
||
} |
||
|
| |
// Retrieve other standard parameters |
// Retrieve other standard parameters | |
|
| |
// due to possible XSS exploit, we need to clean up path first |
// due to possible XSS exploit, we need to clean up path first | |
$path = !empty($_REQUEST['path']) ? $_REQUEST['path'] : null; |
$path = !empty($_REQUEST['path']) ? $_REQUEST['path'] : null; | |
if ($path === null || $path === '') $path = '/'; | ||
$vars['safepath'] = htmlentities($path, ENT_QUOTES, 'UTF-8'); |
$vars['safepath'] = htmlentities($path, ENT_QUOTES, 'UTF-8'); | |
$rev = (int)@$_REQUEST["rev"]; |
$rev = (int)@$_REQUEST["rev"]; | |
|
| |
// Function to create the project selection HTML form |
// Function to create the project selection HTML form | |
function createProjectSelectionForm() { |
function createProjectSelectionForm() { | |
Line 402... | Line 470... | |
} |
} | |
|
| |
list($url, $params) = $config->getUrlParts($rep, '', 'revision'); |
list($url, $params) = $config->getUrlParts($rep, '', 'revision'); | |
$vars["revision_form"] = "<form action=\"$url\" method=\"get\" id=\"revisionform\">"; |
$vars["revision_form"] = "<form action=\"$url\" method=\"get\" id=\"revisionform\">"; | |
|
| |
$vars["revision_input"] = "<input type=\"text\" size=\"4\" name=\"rev\" value=\"$thisrev\" />"; |
$vars["revision_input"] = "<input type=\"text\" size=\"5\" name=\"rev\" value=\"$thisrev\" />"; | |
$hidden = ''; |
$hidden = ''; | |
foreach ($params as $k => $v) { |
foreach ($params as $k => $v) { | |
$hidden .= "<input type=\"hidden\" name=\"$k\" value=\"".htmlspecialchars($v)."\" />"; |
$hidden .= "<input type=\"hidden\" name=\"$k\" value=\"".htmlspecialchars($v)."\" />"; | |
} |
} | |
$vars["revision_hidden"] = $hidden; |
$vars["revision_hidden"] = $hidden; | |
Line 421... | Line 489... | |
if (!$config->multiViews) { |
if (!$config->multiViews) { | |
createProjectSelectionForm(); |
createProjectSelectionForm(); | |
createRevisionSelectionForm(); |
createRevisionSelectionForm(); | |
} |
} | |
|
| |
if ($rep) { |
if (!$config->multiViews && $rep) { | |
$vars["allowdownload"] = $rep->getAllowDownload(); |
$vars["allowdownload"] = $rep->getAllowDownload(); | |
$vars["repname"] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); |
$vars["repname"] = htmlentities($rep->getDisplayName(), ENT_QUOTES, 'UTF-8'); | |
} |
} | |
|
| |
// As of version 1.70 the output encoding is forced to be UTF-8, since this is the output |
// As of version 1.70 the output encoding is forced to be UTF-8, since this is the output |