diff --git a/plugins/ktstandard/PDFGeneratorAction.php b/plugins/ktstandard/PDFGeneratorAction.php index 76d081b..e99c333 100644 --- a/plugins/ktstandard/PDFGeneratorAction.php +++ b/plugins/ktstandard/PDFGeneratorAction.php @@ -255,9 +255,10 @@ class PDFGeneratorAction extends KTDocumentAction { $converter->setDocument($this->oDocument); $res = $converter->processDocument(); - if(!$res){ + if($res !== true){ + // please contact your System Administrator $default->log->error('PDF Generator: PDF file could not be generated'); - $this->errorRedirectToMain(_kt('PDF file could not be generated, the file may be of an unsupported mime type or the PDF Generator could not connect.')); + $this->errorRedirectToMain($res . ' ' . _kt('Please contact your System Administrator for assistance.')); exit(); } @@ -268,7 +269,22 @@ class PDFGeneratorAction extends KTDocumentAction { } exit(); } - $this->errorRedirectToMain(_kt('PDF file could not be generated')); + + // Check if this is a office 2007 doc + $mime = $this->getMimeExtension(); + + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; + $o2007_types[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + + if(in_array($mime, $o2007_types)){ + $error = _kt('The document is an MS Office 2007 format. This may not be supported by your version of OpenOffice. Please contact your System Administrator for assistance'); + $default->log->error('PDF Generator: Document is an MS Office 2007 format. OpenOffice must be version 3.0 or higher to support this format. Please upgrade to the latest version.'); + }else{ + $error = _kt('PDF file could not be generated. The format may not be supported by your version of OpenOffice. Please contact your System Administrator for assistance'); + $default->log->error('PDF Generator: PDF file could not be generated. The format may not be supported by your version of OpenOffice. Please check that you have the latest version installed.'); + } + $this->errorRedirectToMain($error); exit(); } diff --git a/plugins/pdfConverter/pdfConverter.php b/plugins/pdfConverter/pdfConverter.php index bb2c38f..7068177 100644 --- a/plugins/pdfConverter/pdfConverter.php +++ b/plugins/pdfConverter/pdfConverter.php @@ -48,6 +48,25 @@ class pdfConverter extends BaseProcessor $this->ooPort = $config->get('openoffice/port','8100'); $this->xmlrpc = XmlRpcLucene::get($javaServerUrl); + + + + } + + /** + * Check that open office is running + * + * @return boolean + */ + private function checkOO() + { + $available = SearchHelper::checkOpenOfficeAvailablity(); + + if(is_null($available)){ + return true; + } + + return false; } /** @@ -63,17 +82,26 @@ class pdfConverter extends BaseProcessor if(!file_exists($path)){ global $default; - $default->log->debug('Document, id: '.$this->document->iId.', does not exist at given storage path: '.$path); - return false; + $default->log->debug('PDF Converter: Document, id: '.$this->document->iId.', does not exist at given storage path: '.$path); + return _kt("The document, id: {$this->document->iId}, does not exist at the given storage path: {$path}"); } + // check for OO + $available = $this->checkOO(); + // do pdf conversion + if(!$available){ + global $default; + $default->log->error("PDF Converter: Cannot connect to Open Office Server on host {$this->ooHost} : {$this->ooPort}"); + return _kt('Cannot connect to Open Office Server.'); + } + $res = $this->convertFile($path, $ext); - if($res === false){ + if($res !== true){ global $default; - $default->log->debug('Document, id: '.$this->document->iId.', could not be converted to pdf.'); - return false; + $default->log->debug('PDF Converter: Document, id: '.$this->document->iId.', could not be converted to pdf.'); + return _kt("The document, id: {$this->document->iId}, could not be converted to pdf format. The following error occurred: \"{$res}\"."); } return true; @@ -169,11 +197,11 @@ class pdfConverter extends BaseProcessor // Get contents and send to converter $result = $this->xmlrpc->convertDocument($sourceFile, $targetFile, $this->ooHost, $this->ooPort); - if($result === false){ + if(is_string($result)){ $default->log->error('PDF Converter Plugin: Conversion to PDF Failed'); @unlink($sourceFile); @unlink($targetFile); - return false; + return $result; } $pdfDir = $default->pdfDirectory; @@ -196,7 +224,7 @@ class pdfConverter extends BaseProcessor $res = @copy($targetFile, $pdfFile); @unlink($sourceFile); @unlink($targetFile); - return $pdfFile; + return true; } } diff --git a/search2/indexing/lib/XmlRpcLucene.inc.php b/search2/indexing/lib/XmlRpcLucene.inc.php index 156c929..38fc01c 100755 --- a/search2/indexing/lib/XmlRpcLucene.inc.php +++ b/search2/indexing/lib/XmlRpcLucene.inc.php @@ -416,7 +416,7 @@ class XmlRpcLucene if($result->faultCode()) { $this->error($result, 'convertDocument'); - return false; + return $result->faultString(); } return php_xmlrpc_decode($result->value()) == 0; } diff --git a/setup/migrate/config/config.xml b/setup/migrate/config/config.xml index 7e1c62a..d394269 100644 --- a/setup/migrate/config/config.xml +++ b/setup/migrate/config/config.xml @@ -7,7 +7,7 @@ Description: Migrateer steps --> - + installation services diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php index 3b7b5bd..0b099e7 100644 --- a/setup/migrate/migrateWizard.php +++ b/setup/migrate/migrateWizard.php @@ -261,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/steps/migrateDatabase.php b/setup/migrate/steps/migrateDatabase.php index 9eb236f..26fb90b 100644 --- a/setup/migrate/steps/migrateDatabase.php +++ b/setup/migrate/steps/migrateDatabase.php @@ -134,7 +134,7 @@ class migrateDatabase extends Step $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump } $date = date('Y-m-d-H-i-s'); - if(isset($database)) { + if(isset($database['manual_export'])) { $sqlFile = $database['manual_export']; if(file_exists($sqlFile)) { $manual = true; @@ -147,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; -// $response = $this->util->pexec($cmd); + $response = $this->util->pexec($cmd); } if(file_exists($sqlFile)) { $fileContents = file_get_contents($sqlFile); diff --git a/setup/upgrade/config/config.xml b/setup/upgrade/config/config.xml index aa11286..7acf4a2 100644 --- a/setup/upgrade/config/config.xml +++ b/setup/upgrade/config/config.xml @@ -7,7 +7,7 @@ Description: Upgrader steps --> - + welcome installation 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/wizard/installWizard.php b/setup/wizard/installWizard.php index c48aac0..72adbf1 100644 --- a/setup/wizard/installWizard.php +++ b/setup/wizard/installWizard.php @@ -296,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/lib/services/unixOpenOffice.php b/setup/wizard/lib/services/unixOpenOffice.php index 48aeba3..b4b9d1d 100644 --- a/setup/wizard/lib/services/unixOpenOffice.php +++ b/setup/wizard/lib/services/unixOpenOffice.php @@ -137,7 +137,7 @@ 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" '." > /dev/null 2>&1 & echo $!"; + $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 ; diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php index 082b921..4722c65 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 -\"accept=socket,host={$this->host},port={$this->port};urp;\"";; if(DEBUG) { echo "Command : $cmd
"; return ; diff --git a/setup/wizard/lib/system/config-path-mock b/setup/wizard/lib/system/config-path-mock index e404185..8fb204f 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 -/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/lib/knowledgetree-ce +/var/lib/knowledgetree-ce/Documents +/var/lib/knowledgetree-ce/indexes +/etc/knowledgetree-ce/config.ini +/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 b35c72d..34cb82a 100644 --- a/setup/wizard/lib/validation/luceneValidation.php +++ b/setup/wizard/lib/validation/luceneValidation.php @@ -274,7 +274,7 @@ class luceneValidation extends serviceValidation { if($auto) { return $auto; } else { - $auto = $this->useDetected(); // Check if auto detected java works + $auto = $this->detSettings(); // Check if auto detected java works if($auto) { $this->disableExtension = true; // Disable the use of the php bridge extension return $auto; @@ -372,7 +372,7 @@ class luceneValidation extends serviceValidation { $javaExecutable = $this->java; } if(WINDOWS_OS) { - $cmd .= "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; + $cmd = "\"$javaExecutable\" -cp \"".SYS_DIR.";\" javaVersion \"".$this->outputDir."outJV\""." \"".$this->outputDir."outJVHome\""; $func = OS."ReadJVFromFile"; if($this->$func($cmd)) return true; } else { @@ -454,18 +454,6 @@ class luceneValidation extends serviceValidation { } } - /** - * Attempt detection without logging errors - * - * @author KnowledgeTree Team - * @param none - * @access private - * @return boolean - */ - private function useDetected() { - return $this->detSettings(); - } - /** * Set all silent mode varibles * diff --git a/setup/wizard/steps/configuration.php b/setup/wizard/steps/configuration.php index 50c7142..7786742 100644 --- a/setup/wizard/steps/configuration.php +++ b/setup/wizard/steps/configuration.php @@ -53,6 +53,7 @@ if(isset($_GET['action'])) { class configuration extends Step { + private $allConfs; /** * Database host * @@ -282,16 +283,19 @@ class configuration extends Step } private function registerDirs() { // Adjust directories variables - $this->readConfigPath(); - $dirs = $this->getFromConfigPath(); - $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['varDirectory']['path']), 'setting'=>'varDirectory'); - $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['logDirectory']['path']), 'setting'=>'logDirectory'); - $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($dirs['documentRoot']['path']), 'setting'=>'documentRoot'); +// $this->readConfigPath(); +// $dirs = $this->getFromConfigPath(); +// print_r($dirs); + $directories['varDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['varDirectory']['path']), 'setting'=>'varDirectory'); + $directories['logDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['logDirectory']['path']), 'setting'=>'logDirectory'); + $directories['documentRoot'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['documentRoot']['path']), 'setting'=>'documentRoot'); $directories['uiDirectory'] = array('section'=>'urls', 'value'=>'${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree', 'setting'=>'uiDirectory'); - $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($dirs['tmpDirectory']['path']), 'setting'=>'tmpDirectory'); + $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>addslashes($this->allConfs['tmpDirectory']['path']), 'setting'=>'tmpDirectory'); + $directories['cacheDirectory'] = array('section'=>'cache', 'value'=>addslashes($this->allConfs['cacheDirectory']['path']), 'setting'=>'cacheDirectory'); return $directories; } + /** * Perform the installation associated with the step. * Variables required by the installation are stored within the session. @@ -306,22 +310,24 @@ class configuration extends Step $this->dbhandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); $server = $conf['server']; $paths = $conf['paths']; - // TODO if ($this->util->isMigration()) { // Check if its an upgrade + $this->confpaths['configIni'] = $this->readConfigPathIni(); $this->readInstallation(); + $configPath = $this->confpaths['configIni']; } else { $this->readConfigPath(); // initialise writing to config.ini + if(isset($this->confpaths['configIni'])) { // Check if theres a config path + $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File + if($configPath == '') { // Absolute path probably entered + $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path + } + } else { + $configPath = realpath('../../config/config.ini'); // Normal + } } - $dirs = $this->getFromConfigPath(); - if(isset($this->confpaths['configIni'])) { // Check if theres a config path - $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File - if($configPath == '') { // Absolute path probably entered - $configPath = realpath("{$this->confpaths['configIni']}"); // Get relative path - } - } else { - $configPath = realpath('../../config/config.ini'); - } + $this->getFromConfigPath(); $ini = false; +// print_r($configPath); if(file_exists($configPath)) { $ini = new iniUtilities($configPath); } @@ -333,7 +339,7 @@ class configuration extends Step } $this->dbhandler->close(); // close the database connection $this->writeCachePath(); // Write cache path file - $this->writeConfigPath(); // Write config file + $this->writeConfigPath($configPath); // Write config file } private function writeUrlSection($ini) { @@ -446,6 +452,7 @@ class configuration extends Step { if(isset($this->temp_variables['paths'])) { if ($this->util->isMigration()) { // Check if its an upgrade + $this->confpaths['configIni'] = $this->readConfigPathIni(); $this->readInstallation(); // Read values from config.ini of other installation $dirs = $this->getFromConfigPath(); // Store contents } else { @@ -453,6 +460,7 @@ class configuration extends Step } } else { if ($this->util->isMigration()) { // Check if its an upgrade + $this->confpaths['configIni'] = $this->readConfigPathIni(); $this->readInstallation(); // Read values from config.ini of other installation } else { $this->readConfigPath(); // Read contents of config-path file @@ -583,6 +591,7 @@ class configuration extends Step } $configs['varDirectory'] = array('name' => 'Var Directory', 'setting' => 'varDirectory', 'path' => $varPath, 'create' => false); + $this->allConfs = $configs; return $configs; } @@ -632,6 +641,21 @@ class configuration extends Step return true; } + private function readConfigPathIni() { + $configPath = $this->getContentPath(); + if(!$configPath) return false; + $ini = new iniUtilities($configPath); + $data = $ini->getFileByLine(); + $firstline = true; + foreach ($data as $k=>$v) { + if(preg_match('/config.ini/', $k)) { // Find config.ini + return $k; + } + } + + return false; + } + /** * Read contents of config path file * @@ -676,14 +700,14 @@ class configuration extends Step } /** - * Read contents of config path file + * Write location of config path file * * @author KnowledgeTree Team * @access private * @param none * @return boolean */ - private function writeConfigPath() { + private function writeConfigPath($configPath = '') { $configPath = $this->getContentPath(); if(!$configPath) return false; $ini = new iniUtilities($configPath); @@ -746,10 +770,6 @@ class configuration extends Step if(!$cachePath) return false; return $cachePath; } - - public function doReadConfig() { - - } } if(isset($_GET['action'])) { diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php index c829a8b..8089fd1 100644 --- a/setup/wizard/steps/database.php +++ b/setup/wizard/steps/database.php @@ -719,7 +719,14 @@ class database extends Step * @return boolean */ private function createDmsUser() { - return $this->parse_mysql_dump($this->util->sqlInstallDir()."user.sql"); + $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->query($user1) && $this->dbhandler->query($user2)) { + return true; + } else { + $this->error['con'] = "Could not create users for database: {$this->dname}"; + return false; + } } /** diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index 55dc1cf..dfe48f8 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -128,10 +128,13 @@ $pos = strpos($script, '/setup/wizard/'); $root_url = substr($script, 0, $pos); - $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; + if($port == '') + $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; + else + $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$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'); ?>