From a37b6f1c74d83d5404d8184f216939a6b78e8ee4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 28 Aug 2005 00:27:30 +0000 Subject: [PATCH] - added view.php - added svnlib::format() --- includes/svnlib.php | 32 +++++++++++++++++++++++++++++++- view.php | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 view.php diff --git a/includes/svnlib.php b/includes/svnlib.php index dbea3b9..962c736 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -55,6 +55,32 @@ class SVNLib } } + /** + * Prepares data for output + * + * @access public + * + * @param string Standard data + * + * @return string Output-ready data + */ + function format($string) + { + // convert entities + $string = htmlspecialchars($string); + + // tabs to 5 spaces + $string = str_replace("\t", ' ', $string); + + // spaces to nbsp + $string = str_replace(' ', ' ', $string); + + // nl2br + $string = nl2br($string); + + return $string; + } + /** * Executes the SVN binary * @@ -122,7 +148,11 @@ class SVNLib */ function cat($repos, $path, $revision) { - return $this->std('cat', $repos, $path, $revision); + global $viewsvn; + + $repospath = $viewsvn->repos->fetch_path($repos, false); + + return $this->svn('cat ' . $repospath . $path . '@' . $revision); } /** diff --git a/view.php b/view.php new file mode 100644 index 0000000..0decd02 --- /dev/null +++ b/view.php @@ -0,0 +1,38 @@ +paths->parse(); +$repos = $viewsvn->paths->fetch_repos($path); +$relpath = $viewsvn->paths->fetch_path($path); + +echo $viewsvn->paths->construct_breadcrumb($path, false); + +echo ' + + + +
'; + +echo $viewsvn->svn->format(implode("\n", $viewsvn->svn->cat($repos, $relpath, @$viewsvn->in['rev']))); + +echo ' +
'; + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.22.5