diff --git a/.gitignore b/.gitignore index bdd7700..661da2b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ clienttools/Office *.out baobab/ ktoffice*/ +setup/wizard/install.lock diff --git a/setup/upgrade/config/databases.xml b/setup/upgrade/config/databases.xml new file mode 100644 index 0000000..24a818b --- /dev/null +++ b/setup/upgrade/config/databases.xml @@ -0,0 +1,22 @@ + + + + + + + mysql + + localhost + 3306 + dms + root + dmsadmin + js9281djw + dms + djw9281js + diff --git a/setup/upgrade/session.php b/setup/upgrade/session.php new file mode 100644 index 0000000..3942b4f --- /dev/null +++ b/setup/upgrade/session.php @@ -0,0 +1,224 @@ +. +* +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +* California 94120-7775, or email info@knowledgetree.com. +* +* The interactive user interfaces in modified source and object code versions +* of this program must display Appropriate Legal Notices, as required under +* Section 5 of the GNU General Public License version 3. +* +* In accordance with Section 7(b) of the GNU General Public License version 3, +* these Appropriate Legal Notices must retain the display of the "Powered by +* KnowledgeTree" logo and retain the original copyright notice. If the display of the +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices +* must display the words "Powered by KnowledgeTree" and retain the original +* copyright notice. +* +* @copyright 2008-2009, KnowledgeTree Inc. +* @license GNU General Public License version 3 +* @author KnowledgeTree Team +* @package Upgrader +* @version Version 0.1 +*/ +class session +{ + private $salt = 'upgrade'; + /** + * Constructs session object + * + * @author KnowledgeTree Team + * @access public + * @param none + */ + public function __construct() { + $this->startSession(); + } + + /** + * Starts a session if one does not exist + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return void + */ + public function startSession() { + if(!isset($_SESSION[$this->salt]['ready'])) { +// session_start(); + $_SESSION[$this->salt] ['ready'] = TRUE; + } + } + + /** + * Sets a value key pair in session + * + * @author KnowledgeTree Team + * @param string $fld + * @param string $val + * @access public + * @return void + */ + public function set($fld, $val) { + $this->startSession(); + $_SESSION[$this->salt] [$fld] = $val; + } + + /** + * Sets a value key pair in a class in session + * + * @author KnowledgeTree Team + * @param string $class + * @param string $fld + * @param string $val + * @access public + * @return void + */ + public function setClass($class , $k, $v) { + $this->startSession(); + $classArray = $this->get($class); + if(isset($classArray[$k])) { + $classArray[$k] = $v; + } else { + $classArray[$k] = $v; + } + $_SESSION[$this->salt] [ $class] = $classArray; + } + + /** + * Sets a error value key pair in a class in session + * + * @author KnowledgeTree Team + * @param string $class + * @param string $fld + * @param string $val + * @access public + * @return void + */ + public function setClassError($class, $k, $v) { + $this->startSession(); + $classArray = $this->get($class); + if(isset($classArray[$k])) { + $classArray[$k] = $v; + } else { + $classArray[$k] = $v; + } + $_SESSION[$this->salt] [ $class] = $classArray; + } + + /** + * Clear error values in a class session + * + * @author KnowledgeTree Team + * @param string $class + * @param string $fld + * @param string $val + * @access public + * @return void + */ + public function clearErrors($class) { + $classArray = $this->get($class); + unset($classArray['errors']); + $_SESSION[$this->salt] [ $class] = $classArray; + } + + /** + * Unset a value in session + * + * @author KnowledgeTree Team + * @param string $fld + * @access public + * @return void + */ + public function un_set($fld) { + $this->startSession(); + unset($_SESSION[$this->salt] [$fld]); + } + + /** + * Unset a class value in session + * + * @author KnowledgeTree Team + * @param string $class + * @access public + * @return void + */ + public function un_setClass($class) { + $this->startSession(); + if(isset($_SESSION[$this->salt] [$class])) + unset($_SESSION[$this->salt] [$class]); + } + + /** + * Destroy the session + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return void + */ + public function destroy() { + $this->startSession(); + unset($_SESSION[$this->salt]); + session_destroy(); + } + + /** + * Get a session value + * + * @author KnowledgeTree Team + * @param string $fld + * @access public + * @return string + */ + public function get($fld) { + $this->startSession(); + if(isset($_SESSION[$this->salt] [$fld])) + return $_SESSION[$this->salt] [$fld]; + return false; + } + + /** + * Check if a field exists in session + * + * @author KnowledgeTree Team + * @param string $fld + * @access public + * @return string + */ + public function is_set($fld) { + $this->startSession(); + return isset($_SESSION[$this->salt] [$fld]); + } + + /** + * Return a class from session + * + * @author KnowledgeTree Team + * @param string $fld + * @access public + * @return string + */ + public function getClass($class) { + return $_SESSION[$this->salt][$class]; + } +} +?> \ No newline at end of file diff --git a/setup/upgrade/steps/upgradeBackup.php b/setup/upgrade/steps/upgradeBackup.php index 6977416..8ce6505 100644 --- a/setup/upgrade/steps/upgradeBackup.php +++ b/setup/upgrade/steps/upgradeBackup.php @@ -40,7 +40,7 @@ * @version Version 0.1 */ -require_once('../../config/dmsDefaults.php'); +//require_once('../../config/dmsDefaults.php'); class upgradeBackup extends Step { protected $silent = false; diff --git a/setup/upgrade/steps/upgradeComplete.php b/setup/upgrade/steps/upgradeComplete.php index 7e8a08a..e8e6857 100644 --- a/setup/upgrade/steps/upgradeComplete.php +++ b/setup/upgrade/steps/upgradeComplete.php @@ -40,7 +40,7 @@ * @version Version 0.1 */ -require_once('../../config/dmsDefaults.php'); +//require_once('../../config/dmsDefaults.php'); class upgradeComplete extends Step { diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php index f58f571..8987695 100644 --- a/setup/upgrade/steps/upgradeDatabase.php +++ b/setup/upgrade/steps/upgradeDatabase.php @@ -40,10 +40,10 @@ * @version Version 0.1 */ -require_once('../../config/dmsDefaults.php'); -require_once(KT_LIB_DIR . '/config/config.inc.php'); -require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); -require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); +//require_once('../../config/dmsDefaults.php'); +//require_once(KT_LIB_DIR . '/config/config.inc.php'); +//require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); +//require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); class upgradeDatabase extends Step { diff --git a/setup/upgrade/steps/upgradeRestore.php b/setup/upgrade/steps/upgradeRestore.php index 270978f..0d3f503 100644 --- a/setup/upgrade/steps/upgradeRestore.php +++ b/setup/upgrade/steps/upgradeRestore.php @@ -40,7 +40,7 @@ * @version Version 0.1 */ -require_once('../../config/dmsDefaults.php'); +//require_once('../../config/dmsDefaults.php'); class upgradeRestore extends Step { diff --git a/setup/upgrade/steps/upgradeWelcome.php b/setup/upgrade/steps/upgradeWelcome.php index dca3a25..c3df258 100644 --- a/setup/upgrade/steps/upgradeWelcome.php +++ b/setup/upgrade/steps/upgradeWelcome.php @@ -40,14 +40,12 @@ * @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; protected $temp_variables = array(); - + protected $error = array() ; + public function doStep() { $this->temp_variables = array("step_name"=>"welcome"); if($this->next()) { @@ -81,9 +79,18 @@ class upgradeWelcome extends step { } private function checkPassword($username, $password) { -/* - $dconf = $this->getDataFromPackage('installers', 'database'); - $this->dbhandler->load($dconf['dhost'], $dconf['duname'], $dconf['dpassword'], $dconf['dname']); + $dconf = $this->getDataFromPackage('installers', 'database'); // Use info from install + if($dconf) { + $this->dbhandler->load($dconf['dhost'], $dconf['duname'], $dconf['dpassword'], $dconf['dname']); + } else { + require_once("../wizard/iniUtilities.php"); // ini to read the ini content + require_once("../wizard/steps/configuration.php"); // configuration to read the ini path + $wizConfigHandler = new configuration(); + $configPath = $wizConfigHandler->readConfigPathIni(); + $ini = new iniUtilities($configPath); + $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); @@ -91,28 +98,15 @@ class upgradeWelcome extends step { if($ass[0]['match_count']) return true; } + $this->error[] = 'Could Not Authenticate User'; return false; - */ - - global $default; - - $sTable = KTUtil::getTableName('users'); - $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?"; - $aParams = array($username, md5($password)); - $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'match_count'); - if (PEAR::isError($res)) { return false; } - else { - $sTable = KTUtil::getTableName('users_groups_link'); - $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE user_id = ? AND group_id = 1"; - $aParams = array($res); - $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'match_count'); - if (PEAR::isError($res)) { return false; } - else { - return ($res == 1); - } - } } + public function getErrors() { + return $this->error; + } + + } ?> \ No newline at end of file diff --git a/setup/upgrade/templates/welcome.tpl b/setup/upgrade/templates/welcome.tpl index 406578d..0625573 100644 --- a/setup/upgrade/templates/welcome.tpl +++ b/setup/upgrade/templates/welcome.tpl @@ -9,9 +9,14 @@

Only administrator users may access the upgrade wizard.

- + + +
Username -
Password +
Username
Password
Could Not Authenticate User
+
resolveErrors($response); // Run step } else { - $ins = new Upgrader(new UpgradeSession()); // Instantiate the upgrader and pass the session class + $ins = new Upgrader(new session()); // Instantiate the upgrader and pass the session class $ins->step(); // Run step } } diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 8dcb4ce..635817b 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -748,17 +748,17 @@ class InstallUtil { */ public function useZendPhp() { if($this->installEnvironment() == 'Zend') { - if(WINDOWS_OS) { + if(WINDOWS_OS) { // For Zend Installation only $sysdir = explode(DS, SYSTEM_DIR); array_pop($sysdir); array_pop($sysdir); - array_pop($sysdir); - array_pop($sysdir); $zendsys = ''; foreach ($sysdir as $k=>$v) { $zendsys .= $v.DS; } - return $zendsys."ZendServer".DS."bin".DS; + $bin = $zendsys."ZendServer".DS."bin".DS; + if(file_exists($bin)) + return $bin; } else { return DS."usr".DS."local".DS."zend".DS."bin".DS; } diff --git a/setup/wizard/lib/services/windowsLucene.php b/setup/wizard/lib/services/windowsLucene.php index ff7a231..3df9023 100644 --- a/setup/wizard/lib/services/windowsLucene.php +++ b/setup/wizard/lib/services/windowsLucene.php @@ -377,10 +377,32 @@ class windowsLucene extends windowsService { } elseif (file_exists($this->getJavaBin().DS."bin".DS."server".DS."jvm.dll")) { $this->javaJVM = $this->getJavaBin().DS."bin".DS."server".DS."jvm.dll"; } else { - return false; + $javaJVM = $this->useZendJVM(); + if(file_exists($javaJVM)) { + $this->javaJVM = $javaJVM; + } } } + public function useZendJVM() { + if($this->util->installEnvironment() == 'Zend') { + if(WINDOWS_OS) { // For Zend Installation only + $sysdir = explode(DS, SYSTEM_DIR); + array_pop($sysdir); + array_pop($sysdir); + $zendsys = ''; + foreach ($sysdir as $k=>$v) { + $zendsys .= $v.DS; + } + $jvm = $zendsys."jre".DS."bin".DS."client".DS."jvm.dll"; + if(file_exists($jvm)) + return $jvm; + } + } + + return false; + } + /** * Get Java JVM path * diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php index 4722c65..48df139 100644 --- a/setup/wizard/lib/services/windowsOpenOffice.php +++ b/setup/wizard/lib/services/windowsOpenOffice.php @@ -203,7 +203,7 @@ class windowsOpenOffice extends windowsService { //$binary = $this->util->openOfficeSpecified(); $binary = $this->getBin(); if($binary != '') { - $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; + $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -nofirststartwizard -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; if(DEBUG) { echo "Command : $cmd
"; return ; diff --git a/setup/wizard/lib/services/windowsScheduler.php b/setup/wizard/lib/services/windowsScheduler.php index e6d8a95..bc76f32 100644 --- a/setup/wizard/lib/services/windowsScheduler.php +++ b/setup/wizard/lib/services/windowsScheduler.php @@ -209,6 +209,9 @@ class windowsScheduler extends windowsService { echo '
';
             		print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
     	            echo '
'; + echo '
';
+    	            print_r(file_get_contents($this->getSchedulerScriptPath()));
+    	            echo '
'; return ; } $response = win32_create_service(array( diff --git a/setup/wizard/lib/validation/luceneValidation.php b/setup/wizard/lib/validation/luceneValidation.php index 83d47e8..2bf3205 100644 --- a/setup/wizard/lib/validation/luceneValidation.php +++ b/setup/wizard/lib/validation/luceneValidation.php @@ -355,6 +355,25 @@ class luceneValidation extends serviceValidation { } } + public function useZendJava() { + if($this->util->installEnvironment() == 'Zend') { + if(WINDOWS_OS) { // For Zend Installation only + $sysdir = explode(DS, SYSTEM_DIR); + array_pop($sysdir); + array_pop($sysdir); + $zendsys = ''; + foreach ($sysdir as $k=>$v) { + $zendsys .= $v.DS; + } + $java = $zendsys."jre".DS."bin".DS."java.exe"; + if(file_exists($java)) + return $java; + } + } + + return false; + } + /** * Attempts to use user input and configure java settings * @@ -374,11 +393,24 @@ class luceneValidation extends serviceValidation { if(WINDOWS_OS) { $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; $func = OS."ReadJVFromFile"; - if($this->$func($cmd)) return true; + if($this->$func($cmd)) { + return true; + } else { + $this->java = $this->useZendJava(); // Java not installed + $javaExecutable = $this->java; + $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; + if($this->$func($cmd)) { + return true; + } + } } else { $cmd = "\"$javaExecutable\" -version > ".$this->outputDir."outJV 2>&1 echo $!"; $func = OS."ReadJVFromFile"; - if($this->$func($cmd)) return true; + if($this->$func($cmd)) { + return true; + } else { + // TODO: Not sure + } } $this->javaVersionInCorrect(); diff --git a/setup/wizard/lib/validation/openofficeValidation.php b/setup/wizard/lib/validation/openofficeValidation.php index f2d1b2b..3f69fbb 100644 --- a/setup/wizard/lib/validation/openofficeValidation.php +++ b/setup/wizard/lib/validation/openofficeValidation.php @@ -159,9 +159,33 @@ class openofficeValidation extends serviceValidation { return $pathToBinary; } } - + $pathToBinary = $this->useZendOffice(); // Check for openoffice in zend + if(file_exists($pathToBinary)) { + return $pathToBinary; + } + return false; } + + public function useZendOffice() { + if($this->util->installEnvironment() == 'Zend') { + if(WINDOWS_OS) { // For Zend Installation only + $sysdir = explode(DS, SYSTEM_DIR); + array_pop($sysdir); + array_pop($sysdir); + $zendsys = ''; + foreach ($sysdir as $k=>$v) { + $zendsys .= $v.DS; + } + $soffice = $zendsys."openoffice".DS."program".DS."soffice.exe"; + if(file_exists($soffice)) + return $soffice; + } + } + + return false; + } + /** * Set all silent mode varibles * diff --git a/setup/wizard/steps/configuration.php b/setup/wizard/steps/configuration.php index 9d7e4ed..56abe58 100644 --- a/setup/wizard/steps/configuration.php +++ b/setup/wizard/steps/configuration.php @@ -576,7 +576,7 @@ class configuration extends Step return true; } - private function readConfigPathIni() { + public function readConfigPathIni() { if(isset($this->temp_variables['paths']['configFile']['path'])) { return $this->temp_variables['paths']['configFile']['path']; } diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php index 2fa45af..8c3f3dc 100644 --- a/setup/wizard/steps/database.php +++ b/setup/wizard/steps/database.php @@ -441,6 +441,8 @@ class database extends Step $this->temp_variables['tprefix'] = ''; $this->temp_variables['ddrop'] = false; } + + return $this->temp_variables; } /** @@ -493,11 +495,12 @@ class database extends Step * Read xml config file * * @author KnowledgeTree Team - * @access private + * @access public * @params none * @return object SimpleXmlObject */ - private function readXml() { + public function readXml() { +// echo CONF_DIR."databases.xml"; $simplexml = simplexml_load_file(CONF_DIR."databases.xml"); return $simplexml;