diff --git a/config/cache-path b/config/cache-path index 80a084a..e69de29 100644 --- a/config/cache-path +++ b/config/cache-path @@ -1 +0,0 @@ -var/cache diff --git a/config/config-path b/config/config-path index 4bfe59e..2be1a8b 100644 --- a/config/config-path +++ b/config/config-path @@ -1 +1 @@ -config/config.ini +C:\ktdms\config\config.ini \ No newline at end of file diff --git a/config/config.ini b/config/config.ini index 3168122..e97498f 100644 --- a/config/config.ini +++ b/config/config.ini @@ -9,14 +9,14 @@ dbType = mysql ; Database login details -dbHost = localhost -dbName = dms -dbUser = dms -dbPass = djw9281js -dbPort = default +dbHost = localhost +dbName = dms_migrate +dbUser = dmsadmin +dbPass = js9281djw +dbPort = 3306 -dbAdminUser = dmsadmin -dbAdminPass = js9281djw +dbAdminUser = dmsadmin +dbAdminPass = js9281djw [KnowledgeTree] @@ -31,7 +31,7 @@ dbAdminPass = js9281djw ; ; Leave as default to have it automatically detected. ; -fileSystemRoot = default +fileSystemRoot = D:/Program Files/Zend/Apache2/htdocs/knowledgetree ; Webserver name (host name) ; @@ -43,7 +43,7 @@ serverName = default ; ; Leave as default to have it automatically detected. ; -sslEnabled = default +sslEnabled = false ; Path to the web application from the root of the web site. ; If KT is at http://example.org/foo/, then rootUrl should be '/foo' @@ -115,11 +115,11 @@ phpErrorLogFile = false [urls] ; directories -varDirectory = ${fileSystemRoot}/var -logDirectory = ${varDirectory}/log -documentRoot = ${varDirectory}/Documents +varDirectory = C:\Program Files\ktdms\var +logDirectory = C:\Program Files\ktdms\var\log +documentRoot = C:\Program Files\ktdms\var\Documents uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree -tmpDirectory = ${varDirectory}/tmp +tmpDirectory = C:\Program Files\ktdms\var\tmp ;dedicated feed url ;dedicatedrsstitle = RSS Feed Title @@ -146,4 +146,4 @@ encoding = default ; cacheEnabled = true cacheDirectory = ${varDirectory}/cache -cachePlugins = true \ No newline at end of file +cachePlugins = true diff --git a/setup/migrate/migrateUtil.php b/setup/migrate/migrateUtil.php index 28fd474..ac07f0f 100644 --- a/setup/migrate/migrateUtil.php +++ b/setup/migrate/migrateUtil.php @@ -63,14 +63,14 @@ class MigrateUtil extends InstallUtil { $template_vars['error'] = $error; $file = "templates/error.tpl"; if (!file_exists($file)) { - return false; + extract($template_vars); // Extract the vars to local namespace + ob_start(); + include($file); + $contents = ob_get_contents(); + ob_end_clean(); + echo $contents; } - extract($template_vars); // Extract the vars to local namespace - ob_start(); - include($file); - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; + return false; } /** @@ -89,19 +89,10 @@ class MigrateUtil extends InstallUtil { return true; } - - public function loadInstallDBUtil() { - require_once("../wizard/dbUtilities.php"); - return new dbUtilities(); - } - - public function loadInstallUtil() { - require_once("../wizard/steps/services.php"); - return new services(); - } public function loadInstallServices() { - $s = $this->loadInstallUtil(); + require_once("../wizard/steps/services.php"); + $s = new services(); return $s->getServices(); } @@ -112,11 +103,6 @@ class MigrateUtil extends InstallUtil { return new $serviceName(); } - public function loadInstallIni($path) { - require_once("../wizard/iniUtilities.php"); - return new iniUtilities($path); - } - public function getPort($location) { if(WINDOWS_OS) { $myIni = "my.ini"; @@ -125,8 +111,8 @@ class MigrateUtil extends InstallUtil { } $dbConfigPath = $location.DS."mysql".DS."$myIni"; if(file_exists($dbConfigPath)) { - $ini = $this->loadInstallIni($dbConfigPath); - $dbSettings = $ini->getSection('mysqladmin'); + $this->iniUtilities->load($dbConfigPath); + $dbSettings = $this->iniUtilities->getSection('mysqladmin'); return $dbSettings['port']; } diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php index 0bb58d0..03c93fe 100644 --- a/setup/migrate/migrateWizard.php +++ b/setup/migrate/migrateWizard.php @@ -52,16 +52,14 @@ function __autoload($class) { // Attempt and autoload classes if ($class == "template") { // Load existing templating classes require_once("../wizard/template.php"); require_once("../wizard/lib/helpers/htmlHelper.php"); - return ; - } - if(file_exists(WIZARD_DIR."$class.php")) { - require_once(WIZARD_DIR."$class.php"); - } elseif (file_exists(STEP_DIR."$class.php")) { - require_once(STEP_DIR."$class.php"); - } elseif (file_exists(WIZARD_LIB."$class.php")) { - require_once(WIZARD_LIB."$class.php"); } else { - return null; + if(file_exists(WIZARD_DIR."$class.php")) { + require_once(WIZARD_DIR."$class.php"); + } elseif (file_exists(STEP_DIR."$class.php")) { + require_once(STEP_DIR."$class.php"); + } elseif (file_exists(WIZARD_LIB."$class.php")) { + require_once(WIZARD_LIB."$class.php"); + } } } @@ -233,8 +231,6 @@ class MigrateWizard { return true; break; } - - return $res; } /** diff --git a/setup/migrate/migrater.php b/setup/migrate/migrater.php index 249fa36..86f78f5 100644 --- a/setup/migrate/migrater.php +++ b/setup/migrate/migrater.php @@ -157,7 +157,7 @@ class Migrater { $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); } catch (Exception $e) { $util = new MigrateUtil(); - $util->error("Error reading configuration file: $name"); + $util->error("Error reading configuration file: $e"); exit(); } } @@ -431,8 +431,7 @@ class Migrater { if($class->runMigrate()) { // Check if step needs to be migrated $class->setDataFromSession($className); // Set Session Information $class->setPostConfig(); // Set any posted variables - $response = $class->migrateStep(); // Run migrate step - // TODO : Break on error response + $class->migrateStep(); // Run migrate step } } else { $util = new MigrateUtil(); diff --git a/setup/migrate/step.php b/setup/migrate/step.php index 897b710..315fd53 100644 --- a/setup/migrate/step.php +++ b/setup/migrate/step.php @@ -128,7 +128,6 @@ class Step public function __construct() { $this->util = new MigrateUtil(); - $this->dbhandler = $this->util->loadInstallDBUtil(); } /** diff --git a/setup/migrate/stepAction.php b/setup/migrate/stepAction.php index 30724ed..e804976 100644 --- a/setup/migrate/stepAction.php +++ b/setup/migrate/stepAction.php @@ -224,17 +224,18 @@ class stepAction { if($this->action->storeInSession()) { // Check if class values need to be stored in session $this->_loadStepToSession($this->stepName); // Send class to session } - if ($response == 'error') { - $this->_handleErrors(); // Send Errors to session - } else { - $this->_clearErrors($this->stepName); // Send Errors to session - } - return $response; } else { $this->stepName = 'errors'; $this->action = $this->createStep(); $this->action->error = array('Class File Missing in Step Directory'); + + } + if ($response == 'error') { + $this->_handleErrors(); // Send Errors to session + } else { + $this->_clearErrors($this->stepName); // Send Errors to session } + return $response; } /** @@ -308,7 +309,7 @@ class stepAction { $menu = ''; $active = false; if($this->stepClassNames) { - foreach ($this->stepClassNames as $k=>$step) { + foreach ($this->stepClassNames as $step) { if($this->step_names[$step] != '') { $item = $this->step_names[$step]; } else { @@ -452,7 +453,7 @@ class stepAction { * @access private * @return void */ - private function _loadValueToSession($class, $k, $v, $overwrite = false) { + private function _loadValueToSession($class, $k, $v) { if($this->session != null) { $this->session->setClass($class, $k, $v); } else { @@ -502,8 +503,7 @@ class stepAction { * @access private * @return void */ - private function _loadErrorToSession($class, $k, $v, $overwrite = false) { - $k = "errors"; + private function _loadErrorToSession($class, $k = "errors", $v) { if($this->session != null) { $this->session->setClassError($class, $k, $v); } else { diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php index 07230bb..e935c72 100644 --- a/setup/migrate/steps/migrateInstallation.php +++ b/setup/migrate/steps/migrateInstallation.php @@ -225,8 +225,10 @@ class migrateInstallation extends step } private function loadConfig($path) { - $ini = $this->util->loadInstallIni($path); - $dbSettings = $ini->getSection('db'); +// $ini = $this->util->loadInstallIni($path); + $this->util->iniUtilities->load($path); +// $dbSettings = $ini->getSection('db'); + $dbSettings = $this->util->iniUtilities->getSection('db'); $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 'dbName'=> $dbSettings['dbName'], 'dbUser'=> $dbSettings['dbUser'], @@ -235,14 +237,16 @@ class migrateInstallation extends step 'dbAdminUser'=> $dbSettings['dbAdminUser'], 'dbAdminPass'=> $dbSettings['dbAdminPass'], ); - $ktSettings = $ini->getSection('KnowledgeTree'); + $ktSettings = $this->util->iniUtilities->getSection('KnowledgeTree'); +// $ktSettings = $ini->getSection('KnowledgeTree'); $froot = $ktSettings['fileSystemRoot']; if ($froot == 'default') { $froot = $this->location; } $this->ktSettings = array('fileSystemRoot'=> $froot, ); - $urlPaths = $ini->getSection('urls'); +// $urlPaths = $ini->getSection('urls'); + $urlPaths = $this->util->iniUtilities->getSection('urls'); $varDir = $froot.DS.'var'; $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), diff --git a/setup/migrate/steps/migrateServices.php b/setup/migrate/steps/migrateServices.php index b0bc18e..756ec5d 100644 --- a/setup/migrate/steps/migrateServices.php +++ b/setup/migrate/steps/migrateServices.php @@ -127,7 +127,6 @@ class migrateServices extends Step public function doStep() { $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent); - $this->installServices = $this->util->loadInstallUtil(); // Use installer utility class $this->services = $this->util->loadInstallServices(); // Use installer services class $this->storeSilent(); if(!$this->inStep("services")) { diff --git a/setup/upgrade/step.php b/setup/upgrade/step.php index e762275..6a66986 100644 --- a/setup/upgrade/step.php +++ b/setup/upgrade/step.php @@ -110,7 +110,7 @@ class Step public function __construct() { $this->util = new UpgradeUtil(); - $this->dbhandler = $this->util->loadInstallDBUtil(); + //$this->dbhandler = $this->util->dbUtilities; } /** diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php index 8987695..88e8cda 100644 --- a/setup/upgrade/steps/upgradeDatabase.php +++ b/setup/upgrade/steps/upgradeDatabase.php @@ -242,7 +242,9 @@ class upgradeDatabase extends Step } private function readConfig($path) { - $ini = $this->util->loadInstallIni($path); + //$ini = $this->util->loadInstallIni($path); + $ini = $this->util->iniUtilities; + $ini->load($path); $dbSettings = $ini->getSection('db'); $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 'dbName'=> $dbSettings['dbName'], diff --git a/setup/upgrade/steps/upgradeWelcome.php b/setup/upgrade/steps/upgradeWelcome.php index c3df258..ae86767 100644 --- a/setup/upgrade/steps/upgradeWelcome.php +++ b/setup/upgrade/steps/upgradeWelcome.php @@ -40,6 +40,9 @@ * @version Version 0.1 */ +//require_once('../../config/dmsDefaults.php'); +//require_once KT_LIB_DIR . '/authentication/authenticationutil.inc.php'; + class upgradeWelcome extends step { protected $silent = false; @@ -91,15 +94,9 @@ class upgradeWelcome extends step { $dconf = $ini->getSection('db'); $this->dbhandler->load($dconf['dbHost'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); } - $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '$username' AND password = '".md5($password)."'"; - $res = $this->dbhandler->query($sQuery); - $ass = $this->dbhandler->fetchAssoc($res); - if(isset($ass[0]['match_count'])) { - if($ass[0]['match_count']) - return true; - } $this->error[] = 'Could Not Authenticate User'; return false; + } public function getErrors() { diff --git a/setup/upgrade/upgradeUtil.php b/setup/upgrade/upgradeUtil.php index 1816df1..ad78277 100644 --- a/setup/upgrade/upgradeUtil.php +++ b/setup/upgrade/upgradeUtil.php @@ -40,10 +40,9 @@ * @version Version 0.1 */ -//require_once('../../config/dmsDefaults.php'); require_once("../wizard/installUtil.php"); -class UpgradeUtil extends InstallUtil { +class UpgradeUtil extends InstallUtil { /** * Check if system needs to be upgraded * @@ -75,16 +74,6 @@ class UpgradeUtil extends InstallUtil { echo $contents; } - public function loadInstallIni($path) { - require_once("../wizard/iniUtilities.php"); - return new iniUtilities($path); - } - - public function loadInstallDBUtil() { - require_once("../wizard/dbUtilities.php"); - return new dbUtilities(); - } - /** * Function to send output to the browser prior to normal dynamic loading of a template after code execution * diff --git a/setup/wizard/iniUtilities.php b/setup/wizard/iniUtilities.php index 81c2914..e3488ae 100644 --- a/setup/wizard/iniUtilities.php +++ b/setup/wizard/iniUtilities.php @@ -43,11 +43,8 @@ class iniUtilities { private $lineNum = 0; private $exists = ''; - function iniUtilities() { - $this->iniFile = ''; - } - - function load($iniFile) { + + function load($iniFile) { if($this->iniFile != $iniFile) { $this->cleanArray = array(); $this->lineNum = 0; @@ -56,9 +53,11 @@ class iniUtilities { $this->iniFile = $iniFile; $this->backupIni($iniFile); $this->read($iniFile); - } + function __construct() { + } + /** * Create a backup with the date as an extension in the same location as the original config.ini * diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 47bd88d..935f5c3 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -40,12 +40,14 @@ * @version Version 0.1 */ +require_once("../wizard/iniUtilities.php"); +require_once("../wizard/dbUtilities.php"); class InstallUtil { private $salt = 'installers'; - public $dbHandler = null; - public $iniHandler = null; + public $dbUtilities = null; + public $iniUtilities = null; /** * Constructs installation object @@ -54,8 +56,8 @@ class InstallUtil { * @access public */ public function __construct() { - $this->dbHandler = new dbUtilities(); - $this->iniHandler = new iniUtilities(); + $this->dbUtilities = new dbUtilities(); + $this->iniUtilities = new iniUtilities(); } /** diff --git a/setup/wizard/step.php b/setup/wizard/step.php index 456ac8f..35edf1a 100644 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -127,7 +127,6 @@ class Step // public $dbhandler; public function __construct() { -// $this->dbhandler = new dbUtilities(); $this->util = new InstallUtil(); } /** diff --git a/setup/wizard/steps/complete.php b/setup/wizard/steps/complete.php index 3108468..e3b66cf 100644 --- a/setup/wizard/steps/complete.php +++ b/setup/wizard/steps/complete.php @@ -142,8 +142,8 @@ class complete extends Step { // retrieve database information from session $dbconf = $this->getDataFromSession("database"); // make db connection - admin - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); - $loaded = $this->util->dbHandler->getDatabaseLink(); + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); + $loaded = $this->util->dbUtilities->getDatabaseLink(); if (!$loaded) { $this->temp_variables['dbConnectAdmin'] .= '