Migrating stuff from Paths to Node_Controller
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 22 Jan 2006 06:01:36 +0000 (06:01 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 22 Jan 2006 06:01:36 +0000 (06:01 +0000)
browse.php
global.php
includes/node.php
includes/paths.php

index fa19899dc269b33f2fa12a24cbf8e2b6758f1b28..ef8c9763cf7b485de9d844ceaa3fb0bf7ad15001 100644 (file)
@@ -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));
index 2d381c3d5e2e628b72c1c1359f7e16b839de6314..1a0e00214c78244c39b2ca917847588c0f02975a 100644 (file)
@@ -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)
        {
index f588c5837193d9f97d36151ea066c9966a746ace..2dee9377407f011a6cc877c6004fc6f7aeac92e7 100644 (file)
@@ -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);
                
index 572c41eb1b3befe59e7d9fc99db4014bd0e13619..fa6a615fd107dfb211521b1b52f25754c26c19cc 100644 (file)
@@ -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)
                {