From 0b0800e79b0437ec5c5acc489e0baa7e88eedc03 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 06:01:36 +0000 Subject: [PATCH] Migrating stuff from Paths to Node_Controller --- browse.php | 2 ++ global.php | 2 +- includes/node.php | 17 +++++++++ includes/paths.php | 88 +++++----------------------------------------- 4 files changed, 29 insertions(+), 80 deletions(-) diff --git a/browse.php b/browse.php index fa19899..ef8c976 100644 --- a/browse.php +++ b/browse.php @@ -28,6 +28,8 @@ require_once('./global.php'); $navbar = $controller->construct_breadcrumb(); +print_r($controller); + // ################################################################### $node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath)); diff --git a/global.php b/global.php index 2d381c3..1a0e002 100644 --- a/global.php +++ b/global.php @@ -25,7 +25,7 @@ $dochooser = ((defined('PATH_OVERRIDE') AND PATH_OVERRIDE == 1) ? false : true); if ($dochooser) { require_once('./includes/node.php'); - $controller = new Node_Controller($viewsvn->paths->parse()); + $controller = new Node_Controller(Paths::init()); if (isset($viewsvn->in['rebuild']) AND $viewsvn->in['rebuild'] == 1 AND $viewsvn->get('debug') == true) { diff --git a/includes/node.php b/includes/node.php index f588c58..2dee937 100644 --- a/includes/node.php +++ b/includes/node.php @@ -91,6 +91,20 @@ class Node_Controller */ var $path; + /** + * The current revision number + * @var integer + * @access public + */ + var $revnum; + + /** + * The current revision as a string argument + * @var string + * @access public + */ + var $revstr; + // ################################################################### /** * Constructor @@ -116,6 +130,9 @@ class Node_Controller $this->repospath = $this->registry->repos->fetch_path($this->repos); + $this->revnum = Paths::fetch_rev_num(); + $this->revstr = Paths::fetch_rev_str(); + require_once('./includes/shellcmd.php'); $this->xquery = new Shell($this); diff --git a/includes/paths.php b/includes/paths.php index 572c41e..fa6a615 100644 --- a/includes/paths.php +++ b/includes/paths.php @@ -43,72 +43,16 @@ the string creators may need to go into a static class or something. or not. we' */ class Paths { + // ################################################################### /** - * Path manager type - * @var integer - */ - var $type; - - /** - * The universal path that is currently being browsed - * @var string - */ - var $path; - - /** - * Current repository that we're in - * @var string - */ - var $repos; - - /** - * Current internal path inside the repository - * @var string - */ - var $relpath; - - /** - * The current revision number - * @var integer - */ - var $revnum; - - /** - * The current revision as a string argument - * @var string - */ - var $revstr; - - /** - * Constructor: determine the type of linking to use - * - * @param integer Path management type - */ - function Paths($type) - { - global $viewsvn; - - if ($type < 1 OR $type > 2) - { - $viewsvn->trigger->error($viewsvn->lang->string('Invalid path management type specified in [includes/config.php]')); - } - - $this->type = (int)$type; - - $this->path = $this->parse(); - $this->revnum = $this->revnum; - $this->revstr = $this->revstr; - } - - /** - * Parses an incoming path with the various methods - * and returns a universal form + * Parses the incoming path variables and returns a sanitized path that + * is used to init the Node_Controller * * @access public * * @return string Universal path, separated using '/' */ - function parse() + function init() { global $viewsvn; @@ -117,22 +61,13 @@ class Paths return; } - // standard URL type - if ($this->type == 1) + if (@$_SERVER['PATH_INFO']) { - $path = $viewsvn->in['path']; + $path = $viewsvn->sanitize($_SERVER['PATH_INFO']); } - // advanced path system - else if ($this->type == 2) + else { - if (@$_SERVER['PATH_INFO']) - { - $path = $viewsvn->sanitize($_SERVER['PATH_INFO']); - } - else - { - $viewsvn->trigger->error($viewsvn->lang->string('Your server does not support type-2 path management')); - } + $viewsvn->trigger->error($viewsvn->lang->string('Your server does not support type-2 path management')); } if (!$path) @@ -140,11 +75,6 @@ class Paths $viewsvn->trigger->error($viewsvn->lang->string('Invalid path sent')); } - if (!$viewsvn->repos->verify($this->repos = $this->fetch_repos($path), $this->relpath = $this->fetch_path($path))) - { - $viewsvn->trigger->error($viewsvn->lang->string('The path specified could not be verified')); - } - return $path; } @@ -313,7 +243,7 @@ class Paths */ function fetch_rev_str($highlow = false, $high = null, $low = null) { - $rev = $this->fetch_rev_num($highlow, $high, $low); + $rev = Paths::fetch_rev_num($highlow, $high, $low); if ($highlow) { -- 2.43.5