--- /dev/null
+<?php
+/*=====================================================================*\
+|| ################################################################### ||
+|| # ViewSVN [#]version[#]
+|| # --------------------------------------------------------------- # ||
+|| # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
+|| # This file may not be reproduced in any way without permission. # ||
+|| # --------------------------------------------------------------- # ||
+|| # User License Agreement at http://www.iris-studios.com/license/ # ||
+|| ################################################################### ||
+\*=====================================================================*/
+
+require_once('./global.php');
+
+$path = $viewsvn->paths->parse();
+$repos = $viewsvn->paths->fetch_repos($path);
+$relpath = $viewsvn->paths->fetch_path($path);
+
+
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file
}
}
+ /**
+ * Parses an incoming path with the various methods
+ * and returns a universal form
+ *
+ * @access public
+ *
+ * @return string Universal path, separated using '/'
+ */
+ function parse()
+ {
+ global $viewsvn;
+
+ // standard URL type
+ if ($this->type == 1)
+ {
+ $path = $viewsvn->in['path'];
+ }
+ // advanced path system
+ else if ($this->type == 2)
+ {
+ if ($_SERVER['PATH_INFO'])
+ {
+ $path = $viewsvn->sanitize($_SERVER['PATH_INFO']);
+ }
+ else
+ {
+ $viewsvn->trigger->error('server does not support type 2 management');
+ }
+ }
+
+ if (!$path)
+ {
+ $viewsvn->trigger->error('invalid path sent');
+ }
+
+ if (!$viewsvn->repos->verify($this->fetch_repos($path), $this->fetch_path($path)))
+ {
+ $viewsvn->trigger->error('invalid path');
+ }
+
+ return $path;
+ }
+
+ /**
+ * Returns the name of the repository from a upath
+ *
+ * @access public
+ *
+ * @param string Universal path
+ *
+ * @return string Repository name
+ */
+ function fetch_repos($path)
+ {
+ $temp = preg_split('#/#', $path, 0, PREG_SPLIT_NO_EMPTY);
+ return $temp[0];
+ }
+
+ /**
+ * Returns the path without the repository from a upath
+ *
+ * @access public
+ *
+ * @param string Universal path
+ *
+ * @return string Relative path
+ */
+ function fetch_path($path)
+ {
+ $temp = preg_split('#/#', $path, 0, PREG_SPLIT_NO_EMPTY);
+ unset($temp[0]);
+ return '/' . implode('/', $temp);
+ }
+
/**
* Fetches any URL parameters a link has
*
return $this->path;
}
}
+
+ /**
+ * Verifies a path inside a repository
+ *
+ * @access public
+ *
+ * @param string Repository name
+ * @param string Path
+ *
+ * @return bool Validity
+ */
+ function verify($repos, $path)
+ {
+ global $viewsvn;
+
+ if ($repospath = $this->fetch_path($repos))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
}
/*=====================================================================*\