From 45034e99643f1ec4efda07b1121002667b45144f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 Apr 2007 00:24:01 +0000 Subject: [PATCH] We now have a working index.php again: - Switched to ISSO3 trunk - Starting to migrate to PHP5-native code --- global.php | 22 ++---------------- includes/init.php | 38 ++++++++++++------------------- includes/repository.php | 19 ++++++---------- index.php | 38 +------------------------------ templates/default/headinclude.tpl | 2 +- templates/default/index_node.tpl | 2 +- 6 files changed, 27 insertions(+), 94 deletions(-) diff --git a/global.php b/global.php index d920725..7ef6af3 100644 --- a/global.php +++ b/global.php @@ -22,26 +22,8 @@ require_once('./includes/init.php'); require_once('./includes/controller.php'); -$dochooser = ((defined('PATH_OVERRIDE') AND PATH_OVERRIDE == 1) ? false : true); -if ($dochooser) -{ - $controller = new Controller(Paths::init()); - - if (isset($viewsvn->in['rebuild']) AND $viewsvn->in['rebuild'] == 1 AND $viewsvn->get('debug') == true) - { - $controller->cachev->build(null); - } - else - { - if ($controller->cachev->exec_build()) - { - unset($controller); - $controller = new Controller(Paths::init()); - } - } - - $viewsvn->maincontrol =& $controller; -} +$input->in['rev'] = $input->clean(substr($input->in['path'], strpos($input->in['path'], '@') + 1), TYPE_UINT); +$input->in['path'] = substr($input->in['path'], 0, strpos($input->in['path'], '@')); $fetchtemplates[] = 'header'; $fetchtemplates[] = 'footer'; diff --git a/includes/init.php b/includes/init.php index fb3622b..140fe13 100644 --- a/includes/init.php +++ b/includes/init.php @@ -20,7 +20,7 @@ \*=====================================================================*/ error_reporting(E_ALL & ~E_NOTICE); -//error_reporting(E_ALL); +// error_reporting(E_ALL); define('ISSO_MT_START', microtime()); @@ -36,37 +36,29 @@ require_once('./includes/config.php'); // ################################################################### // init isso -define('ISSO_ESCAPE_STRINGS', 1); -define('ISSO_CHECK_POST_REFERER', 1); -require_once('./framework/kernel.php'); -$viewsvn = new ISSO(); -$viewsvn->set('application', 'ViewSVN'); -$viewsvn->set('apppath', getcwd()); -$viewsvn->set('appversion', '[#]version[#]'); -$viewsvn->set('debug', $debug); +ini_set('include_path', ini_get('include_path') . ':' . dirname(dirname(__FILE__)) . '/framework'); -$viewsvn->load('functions', 'funct', true); +require_once('ISSO/Register.php'); +require_once('ISSO/Functions.php'); +require_once('ISSO/Xml.php'); -define('ISSO_DB_LAYER', 'db_mysql'); -$viewsvn->load('db_mysql', 'db', true); +BSRegister::Register('db', $db = BSRegister::LoadModule('DbMySql')); $db->connect($conf['db']['server'], $conf['db']['user'], $conf['db']['pass'], $conf['db']['name'], 0); -$viewsvn->load('xml', 'xml', true); - -// ################################################################### -// localization stystem -$viewsvn->load('localize', 'lang', true); +BSRegister::Register('input', $input = BSRegister::LoadModule('Input')); // ################################################################### // handle template system -$viewsvn->load('template_fs', 'template', true); -$template->set('templatedir', './templates/' . $conf['paths']['templateset']); -$template->set('extension', 'tpl'); + +BSRegister::Register('template', $template = BSRegister::LoadModule('Template')); + +$template->setTemplateDirectory('./templates/' . $conf['paths']['templateset']); +$template->setExtension('tpl'); // ################################################################### // load options -$viewsvn->svnpath = $conf['paths']['svn']; +BSRegister::Register('svnpath', $conf['paths']['svn']); require_once('./includes/svncommon.php'); @@ -78,12 +70,12 @@ $viewsvn->trigger =& new Imaginary(); // ################################################################### // setup repository require_once('./includes/repository.php'); -$viewsvn->repos =& new Repository($conf['repository']['path'], $conf['repository']['iscontainer']); +BSRegister::Register('repos', $repos = new Repository($conf['repository']['path'], $conf['repository']['iscontainer'])); // ################################################################### // path manager require_once('./includes/paths.php'); -$viewsvn->path = $conf['paths']['web']; +BSRegister::Register('webpath', $conf['paths']['web']); /*=====================================================================*\ || ################################################################### diff --git a/includes/repository.php b/includes/repository.php index d621895..90da906 100644 --- a/includes/repository.php +++ b/includes/repository.php @@ -30,7 +30,7 @@ * Repository class that can list repositories and prepare * them for use * -* @package DeskPRO +* @package ViewSVN * @version $Id$ */ class Repository @@ -38,23 +38,20 @@ class Repository /** * Array of valid repositories * @var array - * @access private */ - var $repositories = array(); + private $repositories = array(); /** * Root path to the repository * @var string - * @access private */ - var $path; + private $path; /** * Whether or not the path is a container * @var bool - * @access private */ - var $container; + private $container; // ################################################################### /** @@ -63,11 +60,11 @@ class Repository * @param string Path to repository or container * @param bool Whether the path is a container */ - function Repository($path, $iscontainer) + function __construct($path, $iscontainer) { global $viewsvn; - $this->path = $viewsvn->fetch_sourcepath($path); + $this->path = BSFunctions::FetchSourcePath($path); $this->container = (bool)$iscontainer; if ($this->container) @@ -104,11 +101,9 @@ class Repository /** * Returns a list of repositories * - * @access public - * * @return array List of repositories */ - function fetch_list() + public function fetchList() { return $this->repositories; } diff --git a/index.php b/index.php index 3e0628f..acb8ba4 100644 --- a/index.php +++ b/index.php @@ -32,44 +32,8 @@ require_once('./global.php'); $nodes = ''; -$tables = $db->query("SHOW TABLES"); -while ($table = $db->fetch_array($tables)) +foreach ($repos->fetchList() AS $repos) { - $value = array_values($table); - $tablelist[] = $value[0]; -} - -foreach ($viewsvn->repos->fetch_list() AS $repos) -{ - if (!in_array('c' . ($hash = md5($viewsvn->repos->fetch_path($repos))) . '_revs', $tablelist)) - { - $viewsvn->debug("creating new cacheV: $repos"); - $db->query(" - CREATE TABLE c{$hash}_revs - ( - revision INT(20) UNSIGNED NOT NULL DEFAULT 0, - author VARCHAR(255) NOT NULL DEFAULT '', - dateline VARCHAR(100) NOT NULL DEFAULT '', - files MEDIUMTEXT NOT NULL DEFAULT '', - message MEDIUMTEXT NOT NULL DEFAULT '', - PRIMARY KEY (revision) - )" - ); - - $db->query(" - CREATE TABLE c{$hash}_nodes - ( - name VARCHAR(255) NOT NULL DEFAULT '', - node VARCHAR(50) NOT NULL DEFAULT '', - revision INT(20) UNSIGNED NOT NULL DEFAULT 0, - history MEDIUMTEXT NOT NULL DEFAULT '', - properties MEDIUMTEXT NOT NULL DEFAULT '', - PRIMARY KEY (name) - )" - ); - } - - $link = 'browse.php/' . $repos . '/'; eval('$nodes .= "' . $template->fetch('index_node') . '";'); } diff --git a/templates/default/headinclude.tpl b/templates/default/headinclude.tpl index 619df9d..aec625b 100644 --- a/templates/default/headinclude.tpl +++ b/templates/default/headinclude.tpl @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/default/index_node.tpl b/templates/default/index_node.tpl index e44d75c..8a184a6 100644 --- a/templates/default/index_node.tpl +++ b/templates/default/index_node.tpl @@ -1 +1 @@ -
  • $repos
  • +
  • $repos
  • -- 2.43.5