No changes between revisions
/WebSVN/include/configclass.inc |
---|
497,6 → 497,7 |
var $flatIndex = true; |
var $openTree = false; |
var $serverIsWindows = false; |
var $phpCompatEnabled = false; |
var $cacheResults = false; |
var $multiViews = false; |
var $useEnscript = false; |
524,6 → 525,7 |
var $outputEnc = "UTF-8"; // Encoding of web page. Now forced to UTF-8 |
var $quote = "'"; |
var $pathSeparator = ":"; |
var $_repositories; |
597,12 → 599,28 |
$this->setInputEncoding("CP$cp", "iso-8859-1"); |
// On Windows machines, use double quotes around command line parameters |
$this->quote = '"'; |
$this->quote = '"'; |
// On Windows, semicolon separates path entries in a list rather than colon. |
$this->pathSeparator = ";"; |
} |
// }}} |
// {{{ setPHPCompatEnabled |
// |
// Used for PHP4 |
function setPHPCompatEnabled() { |
$this->phpCompatEnabled = true; |
} |
function isPHPCompatEnabled() { |
return $this->phpCompatEnabled; |
} |
// }}} |
// {{{ Caching |
// setCachingOn |
/WebSVN/include/distconfig.inc |
---|
145,6 → 145,7 |
// Uncomment the default language. If you want English then don't do anything here. |
// |
// include 'languages/catalan.inc'; |
// include 'languages/czech.inc'; |
// include 'languages/danish.inc'; |
// include 'languages/dutch.inc'; |
// include 'languages/finnish.inc'; |
/WebSVN/include/php5compat.inc |
---|
2,12 → 2,6 |
if (version_compare(phpversion(), '5.0.0', 'lt')) { |
# XXX: these includes shouldn't be necessary! |
require_once 'include/configclass.inc'; |
$config = new Config; |
require_once 'include/config.inc'; |
require_once($config->getPHPCompatFile()); |
// Configure necessary functions here |
$funcs = array( |
'stripos', |
16,6 → 10,13 |
// End configuration |
// JB: PHP_Compat expects to be able to find functions by including |
// 'PHP/Compat/Functions/functionname.php', but that hardcoded path |
// isn't relative to the standard include path '.' (it's instead relative |
// to './include'). So rather than hack PHP_Compat to work, just add |
// './include' to our include path. |
ini_set("include_path", ini_get("include_path").$config->pathSeparator."./include"); |
foreach ($funcs as $fn) { |
if (PHP_Compat::loadFunction($fn) != true) |
error_log('Could not load function `'.$fn.'\' as required by PHP Compat.'); |
/WebSVN/include/setup.inc |
---|
30,15 → 30,20 |
// Include the configuration class |
require_once 'include/configclass.inc'; |
require_once 'include/svnlook.inc'; |
// Create the config |
$config = new Config; |
// Set up the default character encodings |
if (function_exists('iconv_get_encoding')) |
{ |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); |
} |
// Define the language array |
$lang = array(); |
$langNames = array(); |
// Include a default language file. |
require 'languages/english.inc'; |
// Set up locwebsvnhttp |
// Note: we will use nothing in MultiViews mode so that the URLs use the root |
// directory by default. |
50,18 → 55,24 |
$vars['locwebsvnhttp'] = $locwebsvnhttp; |
// Make sure that the input locale is set up correctly |
setlocale(LC_ALL, ''); |
// Include a default language file (must go before config.inc) |
require 'languages/english.inc'; |
// Create the config |
$config = new Config; |
// Get the user's personalised config (requires the locwebsvnhttp stuff above) |
require_once 'config.inc'; |
// Set up the default character encodings |
if (function_exists('iconv_get_encoding')) |
{ |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); |
// Load PHP_Compat if we're going to use it. This needs to be done after including config.inc (which contains |
// the setting) but before svnlook.inc (which requires util.inc, which contains PHP4-incompatible functions) |
if ($config->isPHPCompatEnabled()) { |
require_once($config->getPHPCompatFile()); |
require_once 'include/php5compat.inc'; |
} |
require_once 'include/svnlook.inc'; |
// Make sure that the input locale is set up correctly |
setlocale(LC_ALL, ''); |
// {{{ Content-Type's |
// Set up the default content-type extension handling |
186,7 → 197,24 |
'.mov' => 'video/quicktime', // QuickTime Video |
'.avi' => 'video/msvideo', // Microsoft Windows Video |
'.movie' => 'video/x-sgi-movie', // SGI Movieplayer format |
'.wrl' => 'x-world/x-vrml' // VRML Worlds |
'.wrl' => 'x-world/x-vrml', // VRML Worlds |
'.odt' => 'application/vnd.oasis.opendocument.text', // OpenDocument Text |
'.ott' => 'application/vnd.oasis.opendocument.text-template', // OpenDocument Text Template |
'.ods' => 'application/vnd.oasis.opendocument.spreadsheet', // OpenDocument Spreadsheet |
'.ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', // OpenDocument Spreadsheet Template |
'.odp' => 'application/vnd.oasis.opendocument.presentation', // OpenDocument Presentation |
'.otp' => 'application/vnd.oasis.opendocument.presentation-template', // OpenDocument Presentation Template |
'.odg' => 'application/vnd.oasis.opendocument.graphics', // OpenDocument Drawing |
'.otg' => 'application/vnd.oasis.opendocument.graphics-template', // OpenDocument Drawing Template |
'.odc' => 'application/vnd.oasis.opendocument.chart', // OpenDocument Chart |
'.otc' => 'application/vnd.oasis.opendocument.chart-template', // OpenDocument Chart Template |
'.odf' => 'application/vnd.oasis.opendocument.formula', // OpenDocument Formula |
'.otf' => 'application/vnd.oasis.opendocument.formula-template', // OpenDocument Formula Template |
'.odi' => 'application/vnd.oasis.opendocument.image', // OpenDocument Image |
'.oti' => 'application/vnd.oasis.opendocument.image-template', // OpenDocument Image Template |
'.odm' => 'application/vnd.oasis.opendocument.text-master', // OpenDocument Master Document |
'.oth' => 'application/vnd.oasis.opendocument.text-web', // HTML Document Template |
'.odb' => 'application/vnd.oasis.opendocument.database', // OpenDocument Database |
); |
273,10 → 301,6 |
$zipped = array (); |
// Get the user's personalised config |
require_once 'config.inc'; |
// Set up the version info |
initSvnVersion($major,$minor); |
/WebSVN/include/svnlook.inc |
---|
- |
if ( function_exists("mb_detect_encoding") && function_exists("mb_convert_encoding")) |
{ |
$parts[$i] = mb_convert_encoding($parts[$i], "UTF-8", mb_detect_encoding($parts[$i])); |
/WebSVN/include/utils.inc |
---|
24,8 → 24,6 |
// |
// General utility commands |
#require_once 'php5compat.inc'; |
// {{{ createDirLinks |
// |
// Create a list of links to the current path that'll be available from the template |
153,11 → 151,68 |
function hardspace($s) |
{ |
return '<code>'.$s.'</code>'; |
return '<code>' . expandTabs($s) . '</code>'; |
} |
// }}} |
// {{{ expandTabs |
/** |
* Expands the tabs in a line that may or may not include HTML. |
* |
* Enscript generates code with HTML, so we need to take that into account. |
* |
* @param string $s Line of possibly HTML-encoded text to expand |
* @param int $tabwidth Tab width, -1 to use repository's default, 0 to collapse |
* all tabs. |
* @return string The expanded line. |
* @since 2.1 |
*/ |
function expandTabs($s, $tabwidth = -1) |
{ |
global $rep; |
if ($tabwidth == -1) |
$tabwidth = $rep->getExpandTabsBy(); |
$pos = 0; |
// Parse the string into chunks that are either 1 of: HTML tag, tab char, run of any other stuff |
$chunks = preg_split("/((?:<.+?>)|(?:&.+?;)|(?:\t))/", $s, -1, PREG_SPLIT_DELIM_CAPTURE); |
// Count the sizes of the chunks and replace tabs as we go |
for ($i = 0; $i < count($chunks); $i++) |
{ |
# make sure we're not dealing with an empty string |
if (empty($chunks[$i])) continue; |
switch ($chunks[$i]{0}) |
{ |
case '<': // HTML tag : ignore its width by doing nothing |
break; |
case '&': // HTML entity: count its width as 1 char |
$pos += 1; |
break; |
case "\t": // Tab char: replace it with a run of spaces between length tabwidth and 1 |
$tabsize = $tabwidth - ($pos % $tabwidth); |
$chunks[$i] = str_repeat(' ', $tabsize); |
$pos += $tabsize; |
break; |
default: // Anything else: just keep track of its width |
$pos += strlen($chunks[$i]); |
break; |
} |
} |
// Put the chunks back together and we've got the original line, detabbed. |
return join('', $chunks); |
} |
// }}} |
// {{{ datetimeFormatDuration |
// |
// Formats a duration of seconds for display. |
227,6 → 282,8 |
function getParameterisedSelfUrl($params = true) |
{ |
global $config; |
$url = null; |
if ($config->multiViews) |
256,4 → 313,28 |
// }}} |
// {{{ getUserLanguage |
function getUserLanguage() { |
$languages = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en'; |
if (strpos($languages, ',') === false) return $languages; # only one specified |
# split off the languages into an array of languages and q-values |
$qvals = array(); |
$langs = array(); |
preg_match_all('#(\S+?)\s*(?:;q=([01](?:\.\d{1,3})?))?\s*,\s*#', $languages, $qvals, PREG_SET_ORDER); |
foreach ($qvals as $q) { |
$langs[] = array ( |
$q[1], |
floatval(!empty($q[2]) ? $q[2] : 1.0) |
); |
} |
# XXX: now, we should loop through our available languages and choose an |
# appropriate one for the user |
# note that we shouldn't match the region unless we have a specific region |
# to use (e.g. zh-CN vs. zh-TW) |
# FIXME: see above; otherwise, this function doesn't really do anything |
} |
// }}} |
?> |