From 5c764f19660b253c94213db2bc5eb96ca1cf0fa4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 01:44:06 +0000 Subject: [PATCH] browse.php now works without throwing PHP errors --- browse.php | 14 +++++++------- includes/cachev.php | 2 +- includes/init.php | 2 ++ includes/node.php | 31 +++++++++++++++++++++++++++++++ includes/paths.php | 30 ------------------------------ includes/svncommon.php | 6 +++--- 6 files changed, 44 insertions(+), 41 deletions(-) diff --git a/browse.php b/browse.php index 094e6a1..1d77ff9 100644 --- a/browse.php +++ b/browse.php @@ -26,12 +26,12 @@ $fetchtemplates = array( require_once('./global.php'); -$navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path); +$navbar = $controller->construct_breadcrumb(); // ################################################################### $node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath)); -$latest = $cachev->fetch_node($node); +$latest = $controller->cachev->fetch_node($node); $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); @@ -42,7 +42,7 @@ if ($show['head']) $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path); } -$show['prev'] = ($prev = $cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum)); +$show['prev'] = ($prev = $controller->cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum)); if ($show['prev']) { $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path); @@ -50,12 +50,12 @@ if ($show['prev']) // ################################################################### -$revinfo = $cachev->fetch_revision($latest['revision']); -$revinfo['message_clean'] = $viewsvn->svn->format_log_message($revinfo['message']); +$revinfo = $controller->cachev->fetch_revision($latest['revision']); +$revinfo['message_clean'] = SVNCommon::format_log_message($revinfo['message']); -$revinfo['date'] = $viewsvn->svn->format_date_string($revinfo['dateline']); +$revinfo['date'] = SVNCommon::format_date_string($revinfo['dateline']); -$listing = $viewsvn->svn->ls($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum); +$listing = $controller->library->ls($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum); $nodes = ''; diff --git a/includes/cachev.php b/includes/cachev.php index d2a5391..6b16768 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -200,7 +200,7 @@ class cacheV return false; } - + // ################################################################### /** * Checks to see if it's necessary to rebuild the cacheV table for the diff --git a/includes/init.php b/includes/init.php index 1065b97..f4043cc 100644 --- a/includes/init.php +++ b/includes/init.php @@ -68,6 +68,8 @@ $template->set('extension', 'tpl'); // load options $viewsvn->svnpath = $conf['paths']['svn']; +require_once('./includes/svncommon.php'); + // ################################################################### // imaginary reporter require_once('./includes/imaginary.php'); diff --git a/includes/node.php b/includes/node.php index 70d5e93..deca95e 100644 --- a/includes/node.php +++ b/includes/node.php @@ -125,6 +125,37 @@ class Node_Controller require_once('./includes/cachev.php'); $this->cachev = new cacheV($this); } + + // ################################################################### + /** + * Create path breadcrumb + * + * @access public + * + * @param string Universal path + * @param bool Add trailing slash + * + * @return string Breadcrumb HTML + */ + function construct_breadcrumb($path, $doslash = true) + { + global $viewsvn, $cachev; + + $html = '/ '; + $itembit = '/'; + + $temp = preg_split('#/#', $path, -1, PREG_SPLIT_NO_EMPTY); + $count = count($temp) - 1; + + foreach ($temp AS $val => $item) + { + $itembit .= $item; + $itembit .= (($count != $val OR $cachev->isdir($itembit)) ? '/' : ''); + $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); + } + + return $html; + } } /*=====================================================================*\ diff --git a/includes/paths.php b/includes/paths.php index a74962a..25eb2d3 100644 --- a/includes/paths.php +++ b/includes/paths.php @@ -176,37 +176,7 @@ class Paths return $path; } - - /** - * Create path breadcrumb - * - * @access public - * - * @param string Universal path - * @param bool Add trailing slash - * - * @return string Breadcrumb HTML - */ - function construct_breadcrumb($path, $doslash = true) - { - global $viewsvn, $cachev; - $html = '/ '; - $itembit = '/'; - - $temp = preg_split('#/#', $path, -1, PREG_SPLIT_NO_EMPTY); - $count = count($temp) - 1; - - foreach ($temp AS $val => $item) - { - $itembit .= $item; - $itembit .= (($count != $val OR $cachev->isdir($itembit)) ? '/' : ''); - $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); - } - - return $html; - } - /** * Returns the name of the repository from a upath * diff --git a/includes/svncommon.php b/includes/svncommon.php index 7ce63a0..f40d66c 100644 --- a/includes/svncommon.php +++ b/includes/svncommon.php @@ -32,7 +32,7 @@ * @package ViewSVN * @version $Id$ */ -class SVNLib +class SVNCommon { /** * Path to the SVN binary @@ -57,7 +57,7 @@ class SVNLib $this->svnpath = $viewsvn->shell->cmd($svnpath); - $this->common =& new SVNCommon(); + $this->common =& new SVNCommon2(); $access = $viewsvn->shell->exec($this->svnpath . ' --version'); @@ -216,7 +216,7 @@ class SVNLib * @package ViewSVN * @version $Id$ */ -class SVNCommon +class SVNCommon2 { /** * Registry object -- 2.43.5