diff --git a/bin/system_info.php b/bin/system_info.php index e31108c..8c3ae59 100644 --- a/bin/system_info.php +++ b/bin/system_info.php @@ -49,7 +49,6 @@ require_once('../config/dmsDefaults.php'); global $default; $default->log->debug('System information collection script starting...'); -$cache_file = $default->cacheDirectory . '/system_info'; // Get installation guid function getGuid() @@ -167,44 +166,11 @@ function sendForm($data) curl_close($ch); } -// Check the last time the call home executed -function checkRunTime($cache_file) -{ - if(!file_exists($cache_file)){ - return true; - } - - $run_time = trim(file_get_contents($cache_file)); - $now = time(); - - if($run_time < $now){ - return true; - } - - return false; -} - -// update the time of the last call home execution -function updateRunTime($cache_file) -{ - // Generate the time for the next call - $now = time(); - $period = rand(12, 36); - $next = $now + (60*60*$period); - - file_put_contents($cache_file, $next); -} - -if(!checkRunTime($cache_file)){ - exit(0); -} - $post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo(); $data['system_info'] = $post_str; sendForm($data); -updateRunTime($cache_file); $default->log->debug('System information collection script finishing.'); exit(0); -?> \ No newline at end of file +?> diff --git a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php index cade322..b1a232a 100644 --- a/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php +++ b/plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php @@ -265,7 +265,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher { function getUsersDocument($sUserName, $iDropDocsFolderID) { $oUser = $this->oUser; - $oDropDocsFolder = Folder::get($iDropDocsFolderID); $fullPath = $oDropDocsFolder->getFullPath() . '/' . $sUserName; @@ -338,20 +337,7 @@ class MyDropDocumentsPage extends KTStandardDispatcher { } } - $sUserName = (string)$this->oUser->getUserName(); - $subFolders = Folder::getByParentId($iDropDocsFolderID); - - $myDropFolder = false; - foreach ($subFolders as $sub){ - if($sub->getName() == $sUserName){ - $myDropFolder = $sub; - break; - } - } - - $iMyDropDocsFolderID = $myDropFolder->getID(); - - $location = 'browse.php?fFolderId='.$iMyDropDocsFolderID; + $location = 'browse.php?fFolderId='.$iMyDocsFolderID; $sReturnTable .= ''. ''. '
'. diff --git a/plugins/ktcore/KTWidgets.php b/plugins/ktcore/KTWidgets.php index a88aedb..1ff2053 100755 --- a/plugins/ktcore/KTWidgets.php +++ b/plugins/ktcore/KTWidgets.php @@ -967,6 +967,7 @@ class KTCoreTextAreaWidget extends KTWidget { $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); + $this->aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js'; $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js'; $this->aJavascript[] = 'resources/js/kt_tinymce_init.js'; diff --git a/setup/migrate/migrateUtil.php b/setup/migrate/migrateUtil.php index 9f8b573..28fd474 100644 --- a/setup/migrate/migrateUtil.php +++ b/setup/migrate/migrateUtil.php @@ -62,15 +62,15 @@ class MigrateUtil extends InstallUtil { public function error($error) { $template_vars['error'] = $error; $file = "templates/error.tpl"; - if (file_exists($file)) { - extract($template_vars); // Extract the vars to local namespace - ob_start(); - include($file); - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; + if (!file_exists($file)) { + return false; } - return false; + extract($template_vars); // Extract the vars to local namespace + ob_start(); + include($file); + $contents = ob_get_contents(); + ob_end_clean(); + echo $contents; } /** diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php index a03c2d1..0b099e7 100644 --- a/setup/migrate/migrateWizard.php +++ b/setup/migrate/migrateWizard.php @@ -52,17 +52,17 @@ 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 { - 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"); - } + return null; } - return true; } class MigrateWizard { @@ -233,6 +233,8 @@ class MigrateWizard { return true; break; } + + return $res; } /** @@ -259,7 +261,7 @@ class MigrateWizard { } } else { // TODO: Die gracefully - $this->util->error("System has been migrated Goto Login"); + $this->util->error("System has been migrated Goto Login"); } } } diff --git a/setup/migrate/migrater.php b/setup/migrate/migrater.php index 86f78f5..249fa36 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: $e"); + $util->error("Error reading configuration file: $name"); exit(); } } @@ -431,7 +431,8 @@ class Migrater { if($class->runMigrate()) { // Check if step needs to be migrated $class->setDataFromSession($className); // Set Session Information $class->setPostConfig(); // Set any posted variables - $class->migrateStep(); // Run migrate step + $response = $class->migrateStep(); // Run migrate step + // TODO : Break on error response } } else { $util = new MigrateUtil(); diff --git a/setup/migrate/step.php b/setup/migrate/step.php index 9188209..897b710 100644 --- a/setup/migrate/step.php +++ b/setup/migrate/step.php @@ -186,6 +186,30 @@ class Step } /** + * Load default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return void + */ + public function loadDefaults() { + + } + + /** + * Return default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return array + */ + public function getDefaults() { + return array(); + } + + /** * Checks if edit button has been clicked * * @author KnowledgeTree Team diff --git a/setup/migrate/stepAction.php b/setup/migrate/stepAction.php index e6ac993..30724ed 100644 --- a/setup/migrate/stepAction.php +++ b/setup/migrate/stepAction.php @@ -229,14 +229,12 @@ class stepAction { } 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'); - $response = ''; } - - return $response; } /** @@ -310,7 +308,7 @@ class stepAction { $menu = ''; $active = false; if($this->stepClassNames) { - foreach ($this->stepClassNames as $step) { + foreach ($this->stepClassNames as $k=>$step) { if($this->step_names[$step] != '') { $item = $this->step_names[$step]; } else { @@ -454,7 +452,7 @@ class stepAction { * @access private * @return void */ - private function _loadValueToSession($class, $k, $v) { + private function _loadValueToSession($class, $k, $v, $overwrite = false) { if($this->session != null) { $this->session->setClass($class, $k, $v); } else { @@ -504,7 +502,8 @@ class stepAction { * @access private * @return void */ - private function _loadErrorToSession($class, $k = "errors", $v) { + private function _loadErrorToSession($class, $k, $v, $overwrite = false) { + $k = "errors"; if($this->session != null) { $this->session->setClassError($class, $k, $v); } else { diff --git a/setup/migrate/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php index d0eaaa3..26fb90b 100644 --- a/setup/migrate/steps/migrateDatabase.php +++ b/setup/migrate/steps/migrateDatabase.php @@ -122,11 +122,13 @@ class migrateDatabase extends Step $manual = false; // If file was exported manually $dbSettings = $installation['dbSettings']; $location = $installation['location']; + $uname = $this->temp_variables['duname']; + $pwrd = $this->temp_variables['dpassword']; $port = $this->util->getPort($location); $tmpFolder = $this->resolveTempDir(); if(WINDOWS_OS) { $termOrBash = "command prompt window"; - $exe = "\"$location".DS."mysql".DS."bin".DS."mysqldump.exe\""; // Location of dump + $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump } else { $termOrBash = "terminal window"; $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump @@ -145,7 +147,7 @@ class migrateDatabase extends Step if(!$manual) { // Try to export database $sqlFile = $tmpFolder."/kt-backup-$date.sql"; $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; - $this->util->pexec($cmd); + $response = $this->util->pexec($cmd); } if(file_exists($sqlFile)) { $fileContents = file_get_contents($sqlFile); @@ -155,14 +157,10 @@ class migrateDatabase extends Step } } // Handle failed dump - if(WINDOWS_OS) { - $sqlFile = "\"C:\kt-backup-$date.sql\""; // Use tmp instead due to permissions - } else { - $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions - } + $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; - $this->error[]['error'] = "Could not export database"; - $this->error[]['msg'] = "Execute the following command in a $termOrBash:"; + $this->error[]['error'] = "Could not export database:"; + $this->error[]['msg'] = "Execute the following command in a $termOrBash."; $this->error[]['cmd'] = $cmd; $this->temp_variables['manual_export'] = $sqlFile; diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php index a7cea9b..07230bb 100644 --- a/setup/migrate/steps/migrateInstallation.php +++ b/setup/migrate/steps/migrateInstallation.php @@ -162,7 +162,6 @@ class migrateInstallation extends step if($this->foundVersion < $this->supportedVersion) { $this->versionError = true; $this->error[] = "KT installation needs to be 3.6.1 or higher"; - return false; } else { return true; } @@ -223,8 +222,6 @@ class migrateInstallation extends step } else { $this->error[] = "Please Enter a Location"; } - - return false; } private function loadConfig($path) { @@ -245,6 +242,7 @@ class migrateInstallation extends step } $this->ktSettings = array('fileSystemRoot'=> $froot, ); + $urlPaths = $ini->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 50f9e5b..b0bc18e 100644 --- a/setup/migrate/steps/migrateServices.php +++ b/setup/migrate/steps/migrateServices.php @@ -202,11 +202,11 @@ class migrateServices extends Step */ public function unixStop() { $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); $cmd = $this->conf['location']."/dmsctl.sh stop soffice"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); } /** @@ -215,11 +215,11 @@ class migrateServices extends Step */ public function windowsStop() { $cmd = "sc delete KTLucene"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); $cmd = "sc delete KTScheduler"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); $cmd = "sc delete KTOpenoffice"; - $this->util->pexec($cmd); + $res = $this->util->pexec($cmd); } /** @@ -233,7 +233,7 @@ class migrateServices extends Step $serv->load(); $sStatus = $serv->status(); if($sStatus != '') { - $serv->uninstall(); + $res = $serv->uninstall(); } } } diff --git a/setup/upgrade/step.php b/setup/upgrade/step.php index 0b8c103..49890fd 100644 --- a/setup/upgrade/step.php +++ b/setup/upgrade/step.php @@ -172,6 +172,30 @@ class Step public function getWarnings() { return $this->warnings; } + + /** + * Load default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return void + */ + public function loadDefaults() { + + } + + /** + * Return default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return array + */ + public function getDefaults() { + return array(); + } /** * Checks if edit button has been clicked diff --git a/setup/upgrade/stepAction.php b/setup/upgrade/stepAction.php index 48083f0..438df77 100644 --- a/setup/upgrade/stepAction.php +++ b/setup/upgrade/stepAction.php @@ -229,14 +229,12 @@ class stepAction { } 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'); - $response = ''; } - - return $response; } /** @@ -310,7 +308,7 @@ class stepAction { $menu = ''; $active = false; if($this->stepClassNames) { - foreach ($this->stepClassNames as $step) { + foreach ($this->stepClassNames as $k=>$step) { if($this->step_names[$step] != '') { $item = $this->step_names[$step]; } else { @@ -454,7 +452,7 @@ class stepAction { * @access private * @return void */ - private function _loadValueToSession($class, $k, $v) { + private function _loadValueToSession($class, $k, $v, $overwrite = false) { if($this->session != null) { $this->session->setClass($class, $k, $v); } else { @@ -504,7 +502,8 @@ class stepAction { * @access private * @return void */ - private function _loadErrorToSession($class, $k = "errors", $v) { + private function _loadErrorToSession($class, $k, $v, $overwrite = false) { + $k = "errors"; if($this->session != null) { $this->session->setClassError($class, $k, $v); } else { diff --git a/setup/upgrade/steps/upgradeBackup.php b/setup/upgrade/steps/upgradeBackup.php index ba5219e..6977416 100644 --- a/setup/upgrade/steps/upgradeBackup.php +++ b/setup/upgrade/steps/upgradeBackup.php @@ -120,7 +120,7 @@ class upgradeBackup extends Step { if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe')) { -// $curdir=getcwd(); + $curdir=getcwd(); chdir($dir); $handle = popen($stmt['cmd'], 'r'); @@ -198,7 +198,7 @@ class upgradeBackup extends Step { $adminUser = $oKTConfig->get('db/dbAdminUser'); $adminPwd = $oKTConfig->get('db/dbAdminPass'); -// $dbHost = $oKTConfig->get('db/dbHost'); + $dbHost = $oKTConfig->get('db/dbHost'); $dbName = $oKTConfig->get('db/dbName'); $dbPort = trim($oKTConfig->get('db/dbPort')); diff --git a/setup/upgrade/steps/upgradeDatabase.php b/setup/upgrade/steps/upgradeDatabase.php index 945db30..f58f571 100644 --- a/setup/upgrade/steps/upgradeDatabase.php +++ b/setup/upgrade/steps/upgradeDatabase.php @@ -144,10 +144,10 @@ class upgradeDatabase extends Step $this->readConfig(KTConfig::getConfigFilename()); if($this->dbSettings['dbPort'] == '') { - $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'], + $con = $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'], $this->dbSettings['dbPass'], $this->dbSettings['dbName']); } else { - $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'], + $con = $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'], $this->dbSettings['dbPass'], $this->dbSettings['dbName']); } @@ -285,8 +285,7 @@ class upgradeDatabase extends Step } $res = $this->performAllUpgrades(); -// if (PEAR::isError($res) || PEAR::isError($pres)) { - if (PEAR::isError($res)) { + if (PEAR::isError($res) || PEAR::isError($pres)) { $errors = true; // TODO instantiate error details hideable section? $this->temp_variables['upgradeStatus'] = 'Database upgrade failed @@ -301,8 +300,7 @@ class upgradeDatabase extends Step } $post_pres = $this->performPostUpgradeActions(); -// if (PEAR::isError($post_res)) { - if (PEAR::isError($post_pres)) { + if (PEAR::isError($post_res)) { $errors = true; $this->temp_variables['postUpgrade'] = 'Post-Upgrade actions failed.'; } @@ -336,7 +334,7 @@ class upgradeDatabase extends Step // Ensure all plugins are re-registered. $sql = "TRUNCATE plugin_helper"; - DBUtil::runQuery($sql); + $res = DBUtil::runQuery($sql); // Clear out all caches and proxies - they need to be regenerated with the new code $proxyDir = $default->proxyCacheDirectory; diff --git a/setup/upgrade/steps/upgradeRestore.php b/setup/upgrade/steps/upgradeRestore.php index 25a6aa8..270978f 100644 --- a/setup/upgrade/steps/upgradeRestore.php +++ b/setup/upgrade/steps/upgradeRestore.php @@ -111,14 +111,14 @@ class upgradeRestore extends Step { private function restoreDatabase() { $this->temp_variables['restore'] = true; -// $status = $_SESSION['backupStatus']; + $status = $_SESSION['backupStatus']; $filename = $_SESSION['backupFile']; $stmt = $this->util->create_restore_stmt($filename); $dir = $stmt['dir']; if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe')) { -// $curdir=getcwd(); + $curdir=getcwd(); chdir($dir); $ok=true; @@ -181,11 +181,9 @@ class upgradeRestore extends Step { $dir = $this->util->resolveTempDir(); $files = array(); - $dh = opendir($dir); - if ($dh) + if ($dh = opendir($dir)) { - $file = readdir($dh); - while ($file !== false) + while (($file = readdir($dh)) !== false) { if (!preg_match('/kt-backup.+\.sql/',$file)) { continue; @@ -219,7 +217,7 @@ class upgradeRestore extends Step { return; } -// $status = $_SESSION['backupStatus']; + $status = $_SESSION['backupStatus']; $filename = $_SESSION['backupFile']; $stmt = $this->util->create_restore_stmt($filename); diff --git a/setup/upgrade/steps/upgradeWelcome.php b/setup/upgrade/steps/upgradeWelcome.php index c07b07f..0082985 100644 --- a/setup/upgrade/steps/upgradeWelcome.php +++ b/setup/upgrade/steps/upgradeWelcome.php @@ -81,7 +81,7 @@ class upgradeWelcome extends step { } private function checkPassword($username, $password) { -// global $default; + global $default; $sTable = KTUtil::getTableName('users'); $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?"; diff --git a/setup/upgrade/templates/complete.tpl b/setup/upgrade/templates/complete.tpl index a10016a..52eb513 100644 --- a/setup/upgrade/templates/complete.tpl +++ b/setup/upgrade/templates/complete.tpl @@ -9,5 +9,5 @@ Your database has been upgraded to systemVersion; ?> - Goto Login + Goto Login \ No newline at end of file diff --git a/setup/upgrade/upgradeUtil.php b/setup/upgrade/upgradeUtil.php index a2b571b..3bc2ea5 100644 --- a/setup/upgrade/upgradeUtil.php +++ b/setup/upgrade/upgradeUtil.php @@ -64,16 +64,15 @@ class UpgradeUtil extends InstallUtil { public function error($error) { $template_vars['error'] = $error; $file = "templates/error.tpl"; - if (file_exists($file)) { - extract($template_vars); // Extract the vars to local namespace - ob_start(); - include($file); - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; + if (!file_exists($file)) { + return false; } - - return false; + extract($template_vars); // Extract the vars to local namespace + ob_start(); + include($file); + $contents = ob_get_contents(); + ob_end_clean(); + echo $contents; } public function loadInstallIni($path) { @@ -100,16 +99,15 @@ class UpgradeUtil extends InstallUtil { } } $file = "templates/" . $template; - if (file_exists($file)) { - extract($template_vars); // Extract the vars to local namespace - ob_start(); - include($file); - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; + if (!file_exists($file)) { + return false; } - - return false; + extract($template_vars); // Extract the vars to local namespace + ob_start(); + include($file); + $contents = ob_get_contents(); + ob_end_clean(); + echo $contents; } /** @@ -135,7 +133,7 @@ class UpgradeUtil extends InstallUtil { $adminUser = $oKTConfig->get('db/dbAdminUser'); $adminPwd = $oKTConfig->get('db/dbAdminPass'); -// $dbHost = $oKTConfig->get('db/dbHost'); + $dbHost = $oKTConfig->get('db/dbHost'); $dbName = $oKTConfig->get('db/dbName'); $dbPort = trim($oKTConfig->get('db/dbPort')); if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port'); @@ -160,7 +158,7 @@ class UpgradeUtil extends InstallUtil { $mechanism="--port=\"$dbPort\""; } -// $tmpdir = $this->resolveTempDir(); + $tmpdir = $this->resolveTempDir(); $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"
"; $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"
"; @@ -195,13 +193,11 @@ class UpgradeUtil extends InstallUtil { } $oKTConfig =& KTConfig::getSingleton(); -// $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir); - $mysqldir = $oKTConfig->get('backup/mysqlDirectory'); + $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir); $dirs[] = $mysqldir; if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false) { -// $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin'); - $dirs [] = realpath('/../../mysql/bin'); + $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin'); } foreach($dirs as $dir) diff --git a/setup/upgrade/upgradeWizard.php b/setup/upgrade/upgradeWizard.php index b05ca5c..fa2b6b3 100644 --- a/setup/upgrade/upgradeWizard.php +++ b/setup/upgrade/upgradeWizard.php @@ -52,17 +52,17 @@ 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 { - 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"); - } + return null; } - - return true; } class UpgradeWizard { @@ -191,7 +191,26 @@ class UpgradeWizard { * @return mixed */ public function systemChecks() { - return true; // for now we don't write to any locations + // for now we don't write to any of these locations + return true; + + $res = $this->util->checkStructurePermissions(); + if($res === true) return $res; + switch ($res) { + case "wizard": + $this->util->error("Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)"); + return 'Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)'; + break; + case "/": + $this->util->error("System root is not writable (KT_Installation_Directory/)"); + return "System root is not writable (KT_Installation_Directory/)"; + break; + default: + return true; + break; + } + + return $res; } /** diff --git a/setup/upgrade/upgrader.php b/setup/upgrade/upgrader.php index 55bdffb..30dedf9 100644 --- a/setup/upgrade/upgrader.php +++ b/setup/upgrade/upgrader.php @@ -157,7 +157,7 @@ class Upgrader { $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); } catch (Exception $e) { $util = new UpgradeUtil(); - $util->error("Error reading configuration file: $e"); + $util->error("Error reading configuration file: $name"); exit(); } } @@ -431,7 +431,8 @@ class Upgrader { if($class->runUpgrade()) { // Check if step needs to be upgraded $class->setDataFromSession($className); // Set Session Information $class->setPostConfig(); // Set any posted variables - $class->upgradeStep(); // Run upgrade step + $response = $class->upgradeStep(); // Run upgrade step + // TODO : Break on error response } } else { $util = new UpgradeUtil(); diff --git a/setup/wizard/iniUtilities.php b/setup/wizard/iniUtilities.php index c9dc4fa..b036724 100644 --- a/setup/wizard/iniUtilities.php +++ b/setup/wizard/iniUtilities.php @@ -63,12 +63,11 @@ class iniUtilities { return false; } $date = date('YmdHis'); + $backupFile = $iniFile . '.' .$date; if (is_writeable($backupFile)) { file_put_contents($backupFile, $content); } - - return true; } function read($iniFile) { @@ -154,20 +153,13 @@ class iniUtilities { } function itemExists($checkSection, $checkItem) { -/* - foreach ($items as $key => $value) { - if($key == $checkItem) { - return true; - } - } -*/ + $this->exists = ''; foreach($this->cleanArray as $section => $items) { if($section == $checkSection) { $this->exists = 'section'; - $items = array_flip($items); - foreach ($items as $value) { - if($value == $checkItem) { + foreach ($items as $key => $value) { + if($key == $checkItem) { return true; } } diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 2e59356..25452f5 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -70,16 +70,15 @@ class InstallUtil { public function error($error) { $template_vars['error'] = $error; $file = "templates/error.tpl"; - if (file_exists($file)) { - extract($template_vars); // Extract the vars to local namespace - ob_start(); - include($file); - $contents = ob_get_contents(); - ob_end_clean(); - echo $contents; + if (!file_exists($file)) { + return false; } - - return false; + extract($template_vars); // Extract the vars to local namespace + ob_start(); + include($file); + $contents = ob_get_contents(); + ob_end_clean(); + echo $contents; } /** * Check if system needs to be installed @@ -166,8 +165,7 @@ class InstallUtil { return $url; } if (!empty($protocol)) { - $array = explode(':', $url, 2); - $url = $protocol .':'. end($array); + $url = $protocol .':'. end($array = explode(':', $url, 2)); } if (!empty($port)) { $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', @@ -323,15 +321,13 @@ class InstallUtil { while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; - if(is_link($fullpath)) { + if(is_link($fullpath)) return false; - } elseif(!is_dir($fullpath)) { + elseif(!is_dir($fullpath)) { $perms = substr(sprintf('%o', fileperms($fullpath)), -4); - if($perms != $filemode) { - if (!chmod($fullpath, $filemode)) { + if($perms != $filemode) + if (!chmod($fullpath, $filemode)) return false; - } - } } elseif(!$this->chmodRecursive($fullpath, $filemode)) return false; } @@ -358,8 +354,7 @@ class InstallUtil { */ public function canWriteFile($filename) { $fh = fopen($filename, "w+"); - $fr = fwrite($fh, 'test'); - if($fr === false) { + if($fr = fwrite($fh, 'test') === false) { return false; } @@ -377,9 +372,9 @@ class InstallUtil { */ public function javaBridge() { try { - new Java('java.lang.System'); + $javaSystem = new Java('java.lang.System'); } catch (JavaException $e) { - return $e; + return false; } return true; } @@ -768,7 +763,6 @@ class InstallUtil { * @return string */ public function installEnvironment() { - $matches = false; preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type if($matches) { return 'Zend'; @@ -798,7 +792,7 @@ class InstallUtil { array_pop($sysdir); array_pop($sysdir); $zendsys = ''; - foreach ($sysdir as $v) { + foreach ($sysdir as $k=>$v) { $zendsys .= $v.DS; } return $zendsys."ZendServer".DS."bin".DS; @@ -821,16 +815,15 @@ class InstallUtil { if(WINDOWS_OS) { // Mysql bin [Windows] $serverPaths = explode(';',$_SERVER['PATH']); foreach ($serverPaths as $apath) { - $matches = false; preg_match('/mysql/i', $apath, $matches); if($matches) { return $apath.DS; break; } } + } else { + return "mysql"; // Assume its linux and can be executed from command line } - - return "mysql"; // Assume its linux and can be executed from command line } public function sqlInstallDir() { diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php index 986d706..72adbf1 100644 --- a/setup/wizard/installWizard.php +++ b/setup/wizard/installWizard.php @@ -62,13 +62,9 @@ function __autoload($class) { // Attempt and autoload classes } else { if(preg_match('/Helper/', $class)) { require_once(HELPER_DIR."$class.php"); - } else if(preg_match('/Test/i', $class)) { - if($_GET['step'] != '') { - require_once(TEST_DIR."$class.php"); - } } + return null; } - return true; } class InstallWizard { @@ -100,15 +96,6 @@ class InstallWizard { protected $util = null; /** - * Step name - * - * @author KnowledgeTree Team - * @access protected - * @var mixed - */ - protected $stepName = ''; - - /** * Constructs installation wizard object * * @author KnowledgeTree Team @@ -196,27 +183,15 @@ class InstallWizard { } /** - * Is the step being accessed directly + * Bypass and force an install * * @author KnowledgeTree Team - * @access public - * @param none - * @return boolean - */ - public function isActionOnStep() { - return $this->stepName; - } - - /** - * Set step being accessed directly - * - * @author KnowledgeTree Team - * @access public + * @access private * @param none * @return boolean */ - private function setStep($stepName) { - $this->stepName = $stepName; + private function bypass() { + } /** @@ -256,9 +231,6 @@ class InstallWizard { if(isset($_GET['bypass'])) { $this->setBypass($_GET['bypass']); } - if(isset($_GET['step'])) { - $this->setStep($_GET['step']); - } if(isset($_GET['debug'])) { $this->setDebugLevel($_GET['debug']); } else { @@ -291,6 +263,8 @@ class InstallWizard { return true; break; } + + return $res; } /** @@ -304,14 +278,10 @@ class InstallWizard { public function dispatch() { $this->load(); if($this->getBypass() === "1") { // Helper to force install - $this->removeInstallFile(); + $this->removeInstallFile(); // TODO: Remove } elseif ($this->getBypass() === "0") { $this->createInstallFile(); } - if($this->isActionOnStep()) { // Testing purposes - $testStepClass = $this->stepName."Test"; - new $testStepClass(); - } if(!$this->isSystemInstalled()) { // Check if the systems not installed if($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed $this->util->redirect('../migrate'); @@ -326,7 +296,7 @@ class InstallWizard { } } else { // TODO: Die gracefully - $this->util->error("System has been installed Goto Login"); + $this->util->error("System has been installed Goto Login"); } } } diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php index aa4e06e..e3ae105 100644 --- a/setup/wizard/installer.php +++ b/setup/wizard/installer.php @@ -157,7 +157,7 @@ class Installer { $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); } catch (Exception $e) { $util = new InstallUtil(); - $util->error("Error reading configuration file: $e"); + $util->error("Error reading configuration file: $name"); exit(); } } @@ -431,7 +431,8 @@ class Installer { if($class->runInstall()) { // Check if step needs to be installed $class->setDataFromSession($className); // Set Session Information $class->setPostConfig(); // Set any posted variables - $class->installStep(); // Run install step + $response = $class->installStep(); // Run install step + // TODO : Break on error response } } else { $util = new InstallUtil(); diff --git a/setup/wizard/lib/helpers/htmlHelper.php b/setup/wizard/lib/helpers/htmlHelper.php index d2a6565..50150b5 100644 --- a/setup/wizard/lib/helpers/htmlHelper.php +++ b/setup/wizard/lib/helpers/htmlHelper.php @@ -41,7 +41,7 @@ */ class htmlHelper { - private $tags = array( + var $tags = array( 'meta' => '', 'metalink' => '', 'link' => '%s', @@ -96,76 +96,76 @@ class htmlHelper { 'error' => '%s' ); - public function __construct() { - } - - public function js($name) { - return ""; - } - - public function css($name) { - return ""; - } - - public function image($name, $options = array()) { - $path = "../wizard/resources/graphics/$name"; - $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' ')); - - return $image; - } - - public function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { - if (is_array($options)) { - $options = array_merge(array('escape' => true), $options); + function __construct() { + } - if (!is_array($exclude)) { - $exclude = array(); + function js($name) { + return ""; } - $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape'))); - $values = array_intersect_key(array_values($options), $keys); - $escape = $options['escape']; - $attributes = array(); - foreach ($keys as $index => $key) { - $attributes[] = $this->__formatAttribute($key, $values[$index], $escape); + function css($name) { + return ""; } - $out = implode(' ', $attributes); - } else { - $out = $options; + + function image($name, $options = array()) { + $path = "../wizard/resources/graphics/$name"; + $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' ')); + + return $image; } - return $out ? $insertBefore . $out . $insertAfter : ''; - } + + function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { + if (is_array($options)) { + $options = array_merge(array('escape' => true), $options); - public function __formatAttribute($key, $value, $escape = true) { + if (!is_array($exclude)) { + $exclude = array(); + } + $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape'))); + $values = array_intersect_key(array_values($options), $keys); + $escape = $options['escape']; + $attributes = array(); + + foreach ($keys as $index => $key) { + $attributes[] = $this->__formatAttribute($key, $values[$index], $escape); + } + $out = implode(' ', $attributes); + } else { + $out = $options; + } + return $out ? $insertBefore . $out . $insertAfter : ''; + } + + function __formatAttribute($key, $value, $escape = true) { $attribute = ''; $attributeFormat = '%s="%s"'; $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize'); if (is_array($value)) { - $value = ''; + $value = ''; } - + if (in_array($key, $minimizedAttributes)) { - if ($value === 1 || $value === true || $value === 'true' || $value == $key) { - $attribute = sprintf($attributeFormat, $key, $key); - } + if ($value === 1 || $value === true || $value === 'true' || $value == $key) { + $attribute = sprintf($attributeFormat, $key, $key); + } } else { - $attribute = sprintf($attributeFormat, $key, $this->ife($escape, $this->h($value), $value)); + $attribute = sprintf($attributeFormat, $key, $this->ife($escape, $this->h($value), $value)); } return $attribute; } - public function ife($condition, $val1 = null, $val2 = null) { + function ife($condition, $val1 = null, $val2 = null) { if (!empty($condition)) { - return $val1; + return $val1; } return $val2; } - public function h($text, $charset = 'UTF-8') { + function h($text, $charset = 'UTF-8') { if (is_array($text)) { - return array_map('h', $text); + return array_map('h', $text); } return htmlspecialchars($text, ENT_QUOTES, $charset); - } +} } ?> \ No newline at end of file diff --git a/setup/wizard/lib/services/unixLucene.php b/setup/wizard/lib/services/unixLucene.php index b4b14f2..ff574e1 100644 --- a/setup/wizard/lib/services/unixLucene.php +++ b/setup/wizard/lib/services/unixLucene.php @@ -59,7 +59,7 @@ class unixLucene extends unixService { * @param string * @return void */ - public function load() { + public function load($options = null) { $this->setLuceneSource("ktlucene.jar"); $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); @@ -155,8 +155,7 @@ class unixLucene extends unixService { $response = $this->util->pexec($cmd); return $response; } - - return $state; + } public function install() { @@ -174,7 +173,6 @@ class unixLucene extends unixService { if(is_array($response['out'])) { if(count($response['out']) > 1) { foreach ($response['out'] as $r) { - $matches = false; preg_match('/grep/', $r, $matches); // Ignore grep if(!$matches) { return 'STARTED'; @@ -209,14 +207,20 @@ class unixLucene extends unixService { $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); return $response; + } elseif ($state == '') { + // Start Service + return true; + } else { + // Service Running Already + return true; } - return true; + return false; } public function getName() { diff --git a/setup/wizard/lib/services/unixOpenOffice.php b/setup/wizard/lib/services/unixOpenOffice.php index b476102..b4b9d1d 100644 --- a/setup/wizard/lib/services/unixOpenOffice.php +++ b/setup/wizard/lib/services/unixOpenOffice.php @@ -106,14 +106,13 @@ class unixOpenOffice extends unixService { } } - public function status() { + public function status($updrade = false) { sleep(1); $cmd = "ps ax | grep soffice"; $response = $this->util->pexec($cmd); if(is_array($response['out'])) { if(count($response['out']) > 1) { foreach ($response['out'] as $r) { - $matches = false; preg_match('/grep/', $r, $matches); // Ignore grep if(!$matches) { return 'STARTED'; @@ -138,17 +137,23 @@ class unixOpenOffice extends unixService { public function start() { $state = $this->status(); if($state != 'STARTED') { - $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." &1> /dev/null &"; + $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!"; if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); return $response; + } elseif ($state == '') { + // Start Service + return true; + } else { + // Service Running Already + return true; } - return true; + return false; } /** diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index ba14d0a..aae16f3 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -57,7 +57,7 @@ class unixScheduler extends unixService { * @param string * @return void */ - public function load() { + public function load($options = null) { $this->setPhpCli(); $this->scheduler = 'scheduler'; $this->setSchedulerSource('schedulerTask.sh'); @@ -155,7 +155,6 @@ class unixScheduler extends unixService { if(is_array($response['out'])) { if(count($response['out']) > 1) { foreach ($response['out'] as $r) { - $matches = false; preg_match('/grep/', $r, $matches); // Ignore grep if(!$matches) { return 'STARTED'; @@ -191,7 +190,7 @@ class unixScheduler extends unixService { } if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); diff --git a/setup/wizard/lib/services/windowsLucene.php b/setup/wizard/lib/services/windowsLucene.php index 2882794..ff7a231 100644 --- a/setup/wizard/lib/services/windowsLucene.php +++ b/setup/wizard/lib/services/windowsLucene.php @@ -140,8 +140,8 @@ class windowsLucene extends windowsService { * @param string * @return void */ - public function load() { - $this->findJavaBin(); + public function load($options = null) { + $this->setJavaBin(); $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); $this->setLuceneExe("KTLuceneService.exe"); $this->setJavaJVM(); @@ -172,14 +172,14 @@ class windowsLucene extends windowsService { } /** - * Dind Java Directory path + * Set Java Directory path * * @author KnowledgeTree Team * @access private * @param string * @return void */ - private function findJavaBin() { + private function setJavaBin($javaBin = '') { if($this->util->zendBridge()) { if($this->util->javaBridge()) { $this->javaSystem = new Java('java.lang.System'); @@ -379,8 +379,6 @@ class windowsLucene extends windowsService { } else { return false; } - - return true; } /** @@ -409,11 +407,12 @@ class windowsLucene extends windowsService { $luceneExe = $this->getLuceneExe(); $luceneSource = $this->getLuceneSource(); $luceneDir = $this->getluceneDir(); + $javaJVM = $this->getJavaJVM(); if($luceneExe && $luceneSource && $luceneDir) { $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); return $response; diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php index ae46c9f..4722c65 100644 --- a/setup/wizard/lib/services/windowsOpenOffice.php +++ b/setup/wizard/lib/services/windowsOpenOffice.php @@ -183,11 +183,10 @@ class windowsOpenOffice extends windowsService { } private function setWinservice($winservice = "winserv.exe") { - if(file_exists(SYS_BIN_DIR . $winservice)) { + if(file_exists(SYS_BIN_DIR . $winservice)) $this->winservice = SYS_BIN_DIR . $winservice; - } else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) { + else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice; - } } public function getWinservice() { @@ -204,10 +203,10 @@ 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 -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); return $response; diff --git a/setup/wizard/lib/services/windowsScheduler.php b/setup/wizard/lib/services/windowsScheduler.php index 1e163e2..e6d8a95 100644 --- a/setup/wizard/lib/services/windowsScheduler.php +++ b/setup/wizard/lib/services/windowsScheduler.php @@ -85,7 +85,7 @@ class windowsScheduler extends windowsService { * @param string * @return void */ - function load() { + function load($options = null) { $this->setSchedulerDIR($this->varDir."bin"); $this->setSchedulerScriptPath("taskrunner.bat"); $this->setSchedulerSource("schedulerService.php"); @@ -209,7 +209,7 @@ class windowsScheduler extends windowsService { echo '
';
             		print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
     	            echo '
'; - return true; + return ; } $response = win32_create_service(array( 'service' => $this->name, @@ -224,7 +224,7 @@ class windowsScheduler extends windowsService { $cmd = "\"{$this->winservice}\" install $this->name $this->options"; if(DEBUG) { echo "Command : $cmd
"; - return true; + return ; } $response = $this->util->pexec($cmd); return $response; diff --git a/setup/wizard/lib/services/windowsService.php b/setup/wizard/lib/services/windowsService.php index eebe002..41e48bd 100644 --- a/setup/wizard/lib/services/windowsService.php +++ b/setup/wizard/lib/services/windowsService.php @@ -163,7 +163,7 @@ class windowsService extends Service { * @return array */ public function restart() { - $this->stop(); + $response = $this->stop(); sleep(1); $this->start(); } diff --git a/setup/wizard/lib/system/config-path-mock b/setup/wizard/lib/system/config-path-mock index e404185..169cb02 100644 --- a/setup/wizard/lib/system/config-path-mock +++ b/setup/wizard/lib/system/config-path-mock @@ -1,9 +1,9 @@ -/var/lib/knowledgetree -/var/lib/knowledgetree/Documents -/var/lib/knowledgetree/indexes +/var/lib/knowledgetree-ce +/var/lib/knowledgetree-ce/Documents +/var/lib/knowledgetree-ce/indexes /etc/knowledgetree/config.ini -/var/log/knowledgetree -/var/tmp/knowledgetree -/var/tmp/knowledgetree/proxies -/var/tmp/knowledgetree/uploads -/var/tmp/knowledgetree/cache \ No newline at end of file +/var/log/knowledgetree-ce +/var/tmp/knowledgetree-ce +/var/tmp/knowledgetree-ce/proxies +/var/tmp/knowledgetree-ce/uploads +/var/tmp/knowledgetree-ce/cache \ No newline at end of file diff --git a/setup/wizard/lib/validation/luceneValidation.php b/setup/wizard/lib/validation/luceneValidation.php index 4e58d3c..b35c72d 100644 --- a/setup/wizard/lib/validation/luceneValidation.php +++ b/setup/wizard/lib/validation/luceneValidation.php @@ -264,7 +264,7 @@ class luceneValidation extends serviceValidation { public function binaryChecks() { if($this->util->javaSpecified()) { $this->disableExtension = true; // Disable the use of the php bridge extension - if($this->detSettings()) { // AutoDetect java settings + if($this->detSettings(true)) { // AutoDetect java settings return true; } else { $this->specifyJava(); // Ask for settings @@ -274,16 +274,16 @@ class luceneValidation extends serviceValidation { if($auto) { return $auto; } else { - $auto = $this->detSettings(); // Check if auto detected java works + $auto = $this->useDetected(); // Check if auto detected java works if($auto) { $this->disableExtension = true; // Disable the use of the php bridge extension + return $auto; } else { $this->specifyJava(); // Ask for settings } } return $auto; } - return false; } /** @@ -363,7 +363,7 @@ class luceneValidation extends serviceValidation { * @access private * @return boolean */ - private function detSettings() { + private function detSettings($attempt = false) { $javaExecutable = $this->util->javaSpecified();// Retrieve java bin if($javaExecutable == '') { if($this->java == '') { @@ -388,7 +388,7 @@ class luceneValidation extends serviceValidation { } function windowsReadJVFromFile($cmd) { - $this->util->pexec($cmd); + $response = $this->util->pexec($cmd); if(file_exists($this->outputDir.'outJV')) { $version = file_get_contents($this->outputDir.'outJV'); if($version != '') { @@ -409,23 +409,21 @@ class luceneValidation extends serviceValidation { } else { $this->javaVersionWarning(); $this->javaCheck = 'cross_orange'; -// if($attempt) { + if($attempt) { $this->javaExeMessage = "Incorrect java path specified"; $this->javaExeError = true; $this->error[] = "Requires Java 1.5+ to be installed"; -// } + } return false; } } - return false; } function unixReadJVFromFile($cmd) { - $this->util->pexec($cmd); + $response = $this->util->pexec($cmd); if(file_exists($this->outputDir.'outJV')) { $tmp = file_get_contents($this->outputDir.'outJV'); - $matches = false; preg_match('/"(.*)"/',$tmp, $matches); if($matches) { if($matches[1] < $this->javaVersion) { // Check Version of java @@ -445,17 +443,27 @@ class luceneValidation extends serviceValidation { } else { $this->javaVersionWarning(); $this->javaCheck = 'cross_orange'; -// if($attempt) { + if($attempt) { $this->javaExeMessage = "Incorrect java path specified"; $this->javaExeError = true; $this->error[] = "Requires Java 1.5+ to be installed"; -// } + } return false; } } - - return false; + } + + /** + * Attempt detection without logging errors + * + * @author KnowledgeTree Team + * @param none + * @access private + * @return boolean + */ + private function useDetected() { + return $this->detSettings(); } /** diff --git a/setup/wizard/lib/validation/openofficeValidation.php b/setup/wizard/lib/validation/openofficeValidation.php index bc3b052..f2d1b2b 100644 --- a/setup/wizard/lib/validation/openofficeValidation.php +++ b/setup/wizard/lib/validation/openofficeValidation.php @@ -92,7 +92,7 @@ class openofficeValidation extends serviceValidation { * @access private * @var mixed */ - private $windowsLocations = array("\"C:\Program Files\OpenOffice.org 3\program\"", "\"C:\OpenOffice.org 3\program\""); + private $windowsLocations = array("C:\Program Files\OpenOffice.org 3\program", "C:\OpenOffice.org 3\program"); /** * Open Office unix locations @@ -103,7 +103,7 @@ class openofficeValidation extends serviceValidation { */ private $unixLocations = array("/usr/bin/"); - public function preset() { + public function preset($options = null) { $this->specifyOpenOffice(); } diff --git a/setup/wizard/lib/validation/schedulerValidation.php b/setup/wizard/lib/validation/schedulerValidation.php index 752592b..b39b9ad 100644 --- a/setup/wizard/lib/validation/schedulerValidation.php +++ b/setup/wizard/lib/validation/schedulerValidation.php @@ -92,37 +92,36 @@ class schedulerValidation extends serviceValidation { public function binaryChecks() { // TODO: Better detection return true; -// $this->setPhp(); -// if($this->util->phpSpecified()) { -// return $this->detPhpSettings(); -// } else { -// $this->specifyPhp();// Ask for settings -// return false; -// } + $this->setPhp(); + if($this->util->phpSpecified()) { + return $this->detPhpSettings(); + } else { + $this->specifyPhp();// Ask for settings + return false; + } } function detPhpSettings() { // TODO: Better php handling return true; -// $phpExecutable = $this->util->phpSpecified();// Retrieve java bin -// $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!"; -// $this->util->pexec($cmd); -// if(file_exists($this->outputDir.'outPHP')) { -// $tmp = file_get_contents($this->outputDir.'outPHP'); -// $matches = false; -// preg_match('/PHP/',$tmp, $matches); -// if($matches) { -// $this->phpCheck = 'tick'; -// -// return true; -// } else { -// $this->phpCheck = 'cross_orange'; -// $this->phpExeError = "PHP : Incorrect path specified"; -// $this->error[] = "PHP executable required"; -// -// return false; -// } -// } + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin + $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!"; + $response = $this->util->pexec($cmd); + if(file_exists($this->outputDir.'outPHP')) { + $tmp = file_get_contents($this->outputDir.'outPHP'); + preg_match('/PHP/',$tmp, $matches); + if($matches) { + $this->phpCheck = 'tick'; + + return true; + } else { + $this->phpCheck = 'cross_orange'; + $this->phpExeError = "PHP : Incorrect path specified"; + $this->error[] = "PHP executable required"; + + return false; + } + } } /** @@ -138,13 +137,13 @@ class schedulerValidation extends serviceValidation { } private function setPhp() { - $phpDir = $this->util->useZendPhp(); if($this->php != '') { // PHP Found $this->phpCheck = 'tick'; - } elseif ($phpDir) { // Use System Defined Settings + } elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings $this->php = $phpDir; + } else { + } - $this->temp_variables['php']['location'] = $this->php; } diff --git a/setup/wizard/lib/validation/steps/databaseTest.php b/setup/wizard/lib/validation/steps/databaseTest.php deleted file mode 100644 index aa72af7..0000000 --- a/setup/wizard/lib/validation/steps/databaseTest.php +++ /dev/null @@ -1,41 +0,0 @@ -stepName.php"); - } - - /** - * Test database connectivity - * - * @author KnowledgeTree Team - * @param none - * @access public - * @return boolean - */ - public function doAjaxTest($host, $uname, $dname) { - echo "$host, $uname, $dname"; - die; - } - - public function doCreateSchema() { - $this->dhost = '127.0.0.1'; - $this->duname = 'root'; - $this->dpassword = 'root'; - $this->dname = 'dms_install'; - $this->dbbinary = 'mysql'; - $this->dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); - $this->createSchema(); - echo 'Schema loaded
'; - } -} - - -?> \ No newline at end of file diff --git a/setup/wizard/lib/validation/steps/test.php b/setup/wizard/lib/validation/steps/test.php deleted file mode 100644 index 5d9cbed..0000000 --- a/setup/wizard/lib/validation/steps/test.php +++ /dev/null @@ -1,33 +0,0 @@ -$v) { - if(in_array($k, $this->ignore)) { - $temp[] = $_GET[$k]; - unset($_GET[$k]); - } - } - $funcargs = array_slice($_GET,0); - require_once("$class.php"); - $Test = new $class(); - $func_call = strtoupper(substr($func,0,1)).substr($func,1); - $method = "do$func_call"; - call_user_func_array(array($Test, $method), $funcargs); - } - } - */ -// } -} - -?> \ No newline at end of file diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 2bdb9a2..676230b 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -114,7 +114,6 @@ define('SYS_DIR', WIZARD_LIB."system".DS); define('HELPER_DIR', WIZARD_LIB."helpers".DS); define('VALID_DIR', WIZARD_LIB."validation".DS); - define('TEST_DIR', VALID_DIR."steps".DS); // Define paths to system webroot define('SYSTEM_DIR', $sys); define('SYS_VAR_DIR', SYSTEM_DIR."var".DS); diff --git a/setup/wizard/resources/js/wizard.js b/setup/wizard/resources/js/wizard.js index dff2bd0..3809f30 100644 --- a/setup/wizard/resources/js/wizard.js +++ b/setup/wizard/resources/js/wizard.js @@ -4,8 +4,7 @@ function wizard() { // Toggle Advance Database options wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details|php_ext_details|php_con_details - var state = $('.'+ele).attr('style'); - if(state.match(/none/g) == 'none') { + if($('.'+ele).attr('style') == 'display: none;') { $('.'+ele).attr('style', 'display: block;'); if($('#'+option).attr('innerHTML') != '  Advanced Options') $('#'+option).attr('innerHTML', 'Hide Details'); @@ -15,7 +14,7 @@ wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details $('#'+option).attr('innerHTML', 'Show Details'); } } - //alert($('.'+ele) + " " + $('.'+ele).attr('style')); + // Focus on element wizard.prototype.focusElement = function(el) { el.focus(); diff --git a/setup/wizard/session.php b/setup/wizard/session.php index e0bf657..c7eecce 100644 --- a/setup/wizard/session.php +++ b/setup/wizard/session.php @@ -228,4 +228,13 @@ class Session } } + +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + $ses = new Session(); + $method = "$func"; + $ses->$method(); + } +} ?> \ No newline at end of file diff --git a/setup/wizard/step.php b/setup/wizard/step.php index 472c082..ff0acd0 100644 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -42,15 +42,6 @@ class Step { /** - * Salt to use in session - * - * @author KnowledgeTree Team - * @access private - * @var string - */ - private $salt = 'installers'; - - /** * List of variables to be loaded to template * * @author KnowledgeTree Team @@ -82,7 +73,7 @@ class Step * * @author KnowledgeTree Team * @access public - * @var boolean + * @var array */ protected $storeInSession = false; @@ -91,7 +82,7 @@ class Step * * @author KnowledgeTree Team * @access public - * @var boolean + * @var array */ protected $runInstall = false; @@ -100,7 +91,7 @@ class Step * * @author KnowledgeTree Team * @access public - * @var boolean + * @var string */ protected $order = false; @@ -113,15 +104,10 @@ class Step */ protected $silent = false; - /** - * Display the confirmation page first - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ public $displayFirst = false; + private $salt = 'installers'; + /** * Reference to utility object * @@ -129,7 +115,7 @@ class Step * @access protected * @var object */ - public $util = null; + public $util; /** * Reference to utility object @@ -138,20 +124,12 @@ class Step * @access protected * @var object */ - public $dbhandler = null; + public $dbhandler; - /** - * Constructs step object - * - * @author KnowledgeTree Team - * @access public - * @param none - */ public function __construct() { $this->dbhandler = new dbUtilities(); $this->util = new InstallUtil(); } - /** * Returns step state * @@ -164,13 +142,6 @@ class Step return ''; } - /** - * Returns display flag - * - * @author KnowledgeTree Team - * @access public - * @var boolean - */ public function displayFirst() { return $this->displayFirst; } @@ -212,6 +183,30 @@ class Step } /** + * Load default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return void + */ + public function loadDefaults() { + + } + + /** + * Return default step values + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return array + */ + public function getDefaults() { + return array(); + } + + /** * Checks if edit button has been clicked * * @author KnowledgeTree Team diff --git a/setup/wizard/stepAction.php b/setup/wizard/stepAction.php index 9953437..5fde474 100644 --- a/setup/wizard/stepAction.php +++ b/setup/wizard/stepAction.php @@ -472,7 +472,7 @@ class stepAction { * @access private * @return void */ - private function _loadValueToSession($class, $k, $v) { + private function _loadValueToSession($class, $k, $v, $overwrite = false) { if($this->session != null) { $this->session->setClass($class, $k, $v); } else { diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php index 3f8bf70..8089fd1 100644 --- a/setup/wizard/steps/database.php +++ b/setup/wizard/steps/database.php @@ -40,6 +40,16 @@ * @version Version 0.1 */ +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + require_once("../step.php"); + require_once("../installUtil.php"); + require_once("../path.php"); + require_once("../dbUtilities.php"); + } +} + class database extends Step { /** @@ -710,15 +720,15 @@ class database extends Step */ private function createDmsUser() { $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; - $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; - if ($this->dbhandler->execute($user1) && $this->dbhandler->execute($user2)) { - return true; - } else { - $this->error['con'] = "Could not create users for database: {$this->dname}"; - return false; - } - } - + $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; + if ($this->dbhandler->query($user1) && $this->dbhandler->query($user2)) { + return true; + } else { + $this->error['con'] = "Could not create users for database: {$this->dname}"; + return false; + } + } + /** * Create schema * @@ -800,7 +810,17 @@ class database extends Step return $this->error; } - + /** + * Test database connectivity + * + * @author KnowledgeTree Team + * @param none + * @access public + * @return boolean + */ + public function doAjaxTest($host, $uname, $dname) { + + } /** * Initialize errors to false @@ -816,8 +836,25 @@ class database extends Step } } - + public function doCreateSchema() { + $this->dhost = '127.0.0.1'; + $this->duname = 'root'; + $this->dpassword = 'root'; + $this->dname = 'dms_install'; + $this->dbbinary = 'mysql'; + $this->dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); + $this->createSchema(); + echo 'Schema loaded
'; + } } - +if(isset($_GET['action'])) { + $func = $_GET['action']; + if($func != '') { + $serv = new database(); + $func_call = strtoupper(substr($func,0,1)).substr($func,1); + $method = "do$func_call"; + $serv->$method(); + } +} ?> \ No newline at end of file diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index 55dc1cf..8385446 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -131,7 +131,7 @@ $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; ?> - Goto Login + Goto Database Upgrade Goto Login diff --git a/setup/wizard/templates/welcome.tpl b/setup/wizard/templates/welcome.tpl index 652c790..c91ce67 100644 --- a/setup/wizard/templates/welcome.tpl +++ b/setup/wizard/templates/welcome.tpl @@ -4,6 +4,7 @@

This wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.

Press Next to continue.

+
image('kt_browse.png'); ?>
diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index 167cd18..5cb4c0b 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -1377,7 +1377,7 @@ INSERT INTO `scheduler_tasks` VALUES (9,'Refresh Index Statistics','search2/bin/cronIndexStats.php','',0,'1min','2007-10-01',NULL,0,'enabled'), (10,'Refresh Resource Dependancies','search2/bin/cronResources.php','',0,'1min','2007-10-01',NULL,0,'enabled'), (11,'Bulk Download Queue','bin/ajaxtasks/downloadTask.php','',0,'1min','2007-10-01',NULL,0,'system'), -(12,'Call Home','bin/system_info.php','',1,'half_hourly','2009-10-01',NULL,0,'system'); +(12,'Call Home','bin/system_info.php','',0,'daily','2009-10-01',NULL,0,'system'); /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mysql/upgrade/3.7.0/call_home_task.sql b/sql/mysql/upgrade/3.7.0/call_home_task.sql index 8bde4b0..0ba0234 100644 --- a/sql/mysql/upgrade/3.7.0/call_home_task.sql +++ b/sql/mysql/upgrade/3.7.0/call_home_task.sql @@ -1,2 +1,2 @@ -INSERT INTO `scheduler_tasks` (task, script_url, is_complete, frequency, run_time, status) -VALUES ('Call Home','bin/system_info.php', 1, 'half_hourly','2009-10-01','system'); \ No newline at end of file +INSERT INTO `scheduler_tasks` (task, script_url, frequency, run_time, status) +VALUES ('Call Home','bin/system_info.php','daily','2009-10-01','system'); \ No newline at end of file diff --git a/templates/ktcore/principals/about.smarty b/templates/ktcore/principals/about.smarty index dfd95a8..dcbb1b3 100644 --- a/templates/ktcore/principals/about.smarty +++ b/templates/ktcore/principals/about.smarty @@ -10,15 +10,15 @@
{if ($smallVersion == 'Community Edition')} {i18n}This program is free software and published under the GNU General Public License version 3{/i18n}

- {i18n}KnowledgeTree Community Edition is supplied with no support, - no maintenance, + {i18n}KnowledgeTree Community Edition is supplied with no support, + no maintenance, and no warranty.{/i18n}
{i18n}Please contact the KnowledgeTree Sales team should you wish to learn more about commercially supported editions of KnowledgeTree.{/i18n}
{else}
{i18n}This is a professionally supported edition of KnowledgeTree.{/i18n}
{i18n}Please refer to the documentation provided to you at subscription to learn more about how to access KnowledgeTree's professional support team.{/i18n}
- + {/if}


@@ -28,7 +28,7 @@
  • Forums: Discuss KnowledgeTree with expert community users and developers
  • Wiki: Search the knowledge base of user and developer topics
  • Issues: Log a bug or suggest a new feature
  • -
  • Blogs: See what the KnowledgeTree team have to say
  • +
  • Blogs: See what the KnowledgeTree team have to say
  • @@ -63,12 +63,12 @@

  • Kenny Horan -
  • +
  • Artur Kiwa
  • - Michael Knight + Michael Knight
  • Jeongkyu Kim @@ -77,7 +77,7 @@ Rogerio Kohler
  • - Piotr Krawiecki + Piotr Krawiecki
  • Ola Larsson @@ -86,7 +86,7 @@ Pavel Lastovicka
  • - Michel Loiseleur + Michel Loiseleur
  • Renat Lumpau @@ -143,13 +143,13 @@ Phillip Steinbachs
  • - Tahir Tahang + Tahir Tahang
  • Paul Trgina
  • - Harry Tsio + Harry Tsio
  • Bjarte Kalstveit Vebjørnsen @@ -161,19 +161,13 @@ Jaime Zarate
  • - RATP -
  • -
  • - NXC -
  • -
  • And all the KnowledgeTree staff that "dogfood" KnowledgeTree every day.
  • - +

    [If you feel you should be here too, please let us know at contributions@knowledgetree.com]

    -

    This software utilizes third-party software from Pear, PHPMailer, Smarty Template Engine, Apache Tika, Mochikit, Moxiecode Systems, ExtJS, Yahoo Developer Network.

    - +

    This software utilizes third-party software from Pear, PHPMailer, Smarty Template Engine, JSCalendar, Mochikit, Moxiecode Systems, Yahoo Developer Network.

    +