diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php
index 1779615..97f69cb 100644
--- a/ktwebservice/KTDownloadManager.inc.php
+++ b/ktwebservice/KTDownloadManager.inc.php
@@ -105,6 +105,8 @@ class KTDownloadManager
'document_id'=>$doc_id,
'session'=>$this->session,
'download_date'=>date('Y-m-d H:i:s'),
+ 'content_version'=>$document->document->getContentVersionId(),
+ 'filesize'=>$document->document->getFileSize(),
'hash'=>$hash
),
array('noid'=>true)
diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc
index 7b37ede..c22fa3b 100644
--- a/lib/documentmanagement/Document.inc
+++ b/lib/documentmanagement/Document.inc
@@ -169,7 +169,7 @@ class Document {
function getStoragePath() { return $this->_oDocumentContentVersion->getStoragePath(); }
function setStoragePath($sNewValue) { $this->_oDocumentContentVersion->setStoragePath($sNewValue); }
-
+
/**
diff --git a/setup/wizard/lib/services/windowsOpenOffice.php b/setup/wizard/lib/services/windowsOpenOffice.php
index 5aad864..7501714 100644
--- a/setup/wizard/lib/services/windowsOpenOffice.php
+++ b/setup/wizard/lib/services/windowsOpenOffice.php
@@ -1,244 +1,244 @@
-.
-*
-* 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 Installer
-* @version Version 0.1
-*/
-
-class windowsOpenOffice extends windowsService {
-
- /**
- * Reference to utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- public $util;
-
- /**
- * Path to office executable
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $path;
-
- /**
- * Web server
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $host;
-
- /**
- * Path to temp pid file
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $pidFile;
-
- /**
- * Web server Port
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $port;
-
- /**
- * Web server
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $bin;
-
- /**
- * Office executable name
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $soffice;
-
- /**
- * Log file
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $log;
-
- /**
- * Open office options
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $options;
-
- /**
- * Path to win service
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $winservice;
-
- /**
- * Service name
- *
- * @author KnowledgeTree Team
- * @access public
- * @param none
- * @return string
- */
- public $name = "KTOpenOfficeTest";
-
- public function load() {
- // hack for testing
- $this->setPort("8100");
- $this->setHost("127.0.0.1");
- $this->setLog("openoffice.log");
- $this->setWinservice("winserv.exe");
- $this->setOption();
- }
-
- private function setPort($port = "8100") {
- $this->port = $port;
- }
-
- public function getPort() {
- return $this->port;
- }
-
- private function setHost($host = "127.0.0.1") {
- $this->host = $host;
- }
-
- public function getHost() {
- return $this->host;
- }
-
- private function setLog($log = "openoffice.log") {
- $this->log = $log;
- }
-
- public function getLog() {
- return $this->log;
- }
-
- private function setBin($bin) {
- $this->bin = "\"".$bin."\"";
- }
-
- public function getBin() {
- return $this->bin;
- }
-
- private function setWinservice($winservice = "winserv.exe") {
- if(file_exists(SYS_BIN_DIR . $winservice))
- $this->winservice = SYS_BIN_DIR . $winservice;
- else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice))
- $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
- }
-
- public function getWinservice() {
- return $this->winservice;
- }
-
- private function setOption() {
- $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -nofirststartwizard "
- . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\"";
- }
-
- public function getOption() {
- return $this->options;
- }
-
- public function install() {
- $status = $this->status();
- if($status == '') {
- $services = $this->util->getDataFromSession('services');
- $this->setBin("{$services['openOfficeExe']}");
- $this->setOption();
- $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
- if(DEBUG) {
- echo "$cmd
";
- return ;
- }
- $response = $this->util->pexec($cmd);
- return $response;
- }
- else {
- return $status;
- }
- }
-
- /**
- * Retrieve Status Service
- *
- * @author KnowledgeTree Team
- * @access public
- * @param none
- * @return string
- */
- public function status() {
- $cmd = "sc query {$this->name}";
- $response = $this->util->pexec($cmd);
- if($response['out']) {
- $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
- return $state;
- }
-
- return '';
- }
-}
+.
+*
+* 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 Installer
+* @version Version 0.1
+*/
+
+class windowsOpenOffice extends windowsService {
+
+ /**
+ * Reference to utility object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ public $util;
+
+ /**
+ * Path to office executable
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $path;
+
+ /**
+ * Web server
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $host;
+
+ /**
+ * Path to temp pid file
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $pidFile;
+
+ /**
+ * Web server Port
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $port;
+
+ /**
+ * Web server
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $bin;
+
+ /**
+ * Office executable name
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $soffice;
+
+ /**
+ * Log file
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $log;
+
+ /**
+ * Open office options
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $options;
+
+ /**
+ * Path to win service
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $winservice;
+
+ /**
+ * Service name
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return string
+ */
+ public $name = "KTOpenOfficeTest";
+
+ public function load() {
+ // hack for testing
+ $this->setPort("8100");
+ $this->setHost("127.0.0.1");
+ $this->setLog("openoffice.log");
+ $this->setWinservice("winserv.exe");
+ $this->setOption();
+ }
+
+ private function setPort($port = "8100") {
+ $this->port = $port;
+ }
+
+ public function getPort() {
+ return $this->port;
+ }
+
+ private function setHost($host = "127.0.0.1") {
+ $this->host = $host;
+ }
+
+ public function getHost() {
+ return $this->host;
+ }
+
+ private function setLog($log = "openoffice.log") {
+ $this->log = $log;
+ }
+
+ public function getLog() {
+ return $this->log;
+ }
+
+ private function setBin($bin) {
+ $this->bin = "\"".$bin."\"";
+ }
+
+ public function getBin() {
+ return $this->bin;
+ }
+
+ private function setWinservice($winservice = "winserv.exe") {
+ if(file_exists(SYS_BIN_DIR . $winservice))
+ $this->winservice = SYS_BIN_DIR . $winservice;
+ else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice))
+ $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
+ }
+
+ public function getWinservice() {
+ return $this->winservice;
+ }
+
+ private function setOption() {
+ $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -nofirststartwizard "
+ . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\"";
+ }
+
+ public function getOption() {
+ return $this->options;
+ }
+
+ public function install() {
+ $status = $this->status();
+ if($status == '') {
+ $services = $this->util->getDataFromSession('services');
+ $this->setBin("{$services['openOfficeExe']}");
+ $this->setOption();
+ $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
+ if(DEBUG) {
+ echo "$cmd
";
+ return ;
+ }
+ $response = $this->util->pexec($cmd);
+ return $response;
+ }
+ else {
+ return $status;
+ }
+ }
+
+ /**
+ * Retrieve Status Service
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return string
+ */
+ public function status() {
+ $cmd = "sc query {$this->name}";
+ $response = $this->util->pexec($cmd);
+ if($response['out']) {
+ $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
+ return $state;
+ }
+
+ return '';
+ }
+}
?>
\ No newline at end of file
diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php
index 9812859..1a4952e 100644
--- a/setup/wizard/steps/services.php
+++ b/setup/wizard/steps/services.php
@@ -1,1190 +1,1190 @@
-.
-*
-* 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 Installer
-* @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");
- }
-}
-
-class services extends Step
-{
- /**
- * List of errors encountered
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $error = array();
-
- /**
- * Flag if step needs to be installed
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $runInstall = true;
-
- /**
- * List of services to be installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var array
- */
- private $services = array('Lucene', 'Scheduler', 'OpenOffice');
-
- /**
- * Path to php executable
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $php;
-
- /**
- * Flag if php already provided
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- public $providedPhp = false;
-
- /**
- * PHP Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $phpCheck = 'cross_orange';
-
- /**
- * Flag, if php is specified and an error has been encountered
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- private $phpExeError = false;
-
- /**
- * Holds path error, if php is specified
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- private $phpExeMessage = '';
-
- /**
- * Path to open office executable
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $soffice;
-
- /**
- * Flag if open office already provided
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- public $providedOpenOffice = false;
-
- /**
- * Flag, if open office is specified and an error has been encountered
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- private $openOfficeExeError = false;
-
- /**
- * Holds path error, if open office is specified
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- private $openOfficeExeMessage = '';
-
- /**
- * Path to java executable
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $java = "";
-
- /**
- * Minumum Java Version
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $javaVersion = '1.5';
-
- /**
- * Java Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $javaCheck = 'cross';
-
- /**
- * Open Office Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $openOfficeCheck = 'cross';
-
- /**
- * Flag if java already provided
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- public $providedJava = false;
-
- /**
- * Java Bridge Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $javaExtCheck = 'cross_orange';
-
- /**
- * Flag if bridge extension needs to be disabled
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- private $disableExtension = false;
-
- /**
- * Flag, if java is specified and an error has been encountered
- *
- * @author KnowledgeTree Team
- * @access public
- * @var booelean
- */
- private $javaExeError = false;
-
- /**
- * Holds path error, if java is specified
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- private $javaExeMessage = '';
-
- /**
- * Flag if services are already Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $alreadyInstalled = false;
-
- /**
- * Flag if services are already Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $luceneInstalled = false;
-
- /**
- * Flag if services are already Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var mixed
- */
- private $schedulerInstalled = false;
-
- /**
- * Path to php executable
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- private $openOfficeInstalled;
-
- /**
- * Service Installed
- *
- * @author KnowledgeTree Team
- * @access private
- * @var array
- */
- private $serviceCheck = 'tick';
-
- /**
- * Flag to store class information in session
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- protected $storeInSession = true;
-
- /**
- * List of variables to be loaded to template
- *
- * @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $temp_variables;
-
- /**
- * Flag if step needs to run silently
- *
- * @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $silent = true;
-
- /**
- * Reference to utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $util;
- private $salt = 'installers';
-
- /**
- * Constructs services object
- *
- * @author KnowledgeTree Team
- * @access public
- * @param none
- */
- public function __construct() {
- $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
- $this->util = new InstallUtil();
- }
-
- /**
- * Main control of services setup
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doStep()
- {
- if(!$this->inStep("services")) {
- $this->doRun();
- return 'landing';
- }
- if($this->next()) {
- // Check dependencies
- $passed = $this->doRun();
- $serv = $this->getDataFromSession("services");
- if($passed || $serv['providedJava'])
- return 'next';
- else
- return 'error';
- } else if($this->previous()) {
- return 'previous';
- }
- $passed = $this->doRun();
- return 'landing';
- }
-
- /**
- * Get service names
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getServices() {
- return $this->services;
- }
-
- /**
- * Check if java executable was found
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return array
- */
- private function setJava() {
- if($this->java != '') { // Java JRE Found
- $this->javaCheck = 'tick';
- $this->javaInstalled();
- $this->temp_variables['java']['location'] = $this->java;
- return ;
- }
-
- $this->temp_variables['java']['location'] = $this->java;
- }
-
- /**
- * Run step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function doRun() {
- if($this->alreadyInstalled()) {
- $this->alreadyInstalled = true;
- $this->serviceCheck = 'tick';
- } else {
- $this->presetJava();
- $this->presetOpenOffice();
- if(!$this->schedulerInstalled) {
- if(!WINDOWS_OS) $this->php = $this->util->getPhp(); // Get java, if it exists
- $passedPhp = $this->phpChecks(); // Run Java Pre Checks
- if ($passedPhp) { // Install Scheduler
- $this->installService('Scheduler');
- }
- } else {
- $this->schedulerInstalled();
- }
- if(!$this->luceneInstalled) {
- if(!WINDOWS_OS) $this->java = $this->util->getJava(); // Get java, if it exists
- $passedJava = $this->javaChecks(); // Run Java Pre Checks
- if ($passedJava) { // Install Lucene
- $this->installService('Lucene');
- }
- } else {
- $this->luceneInstalled();
- }
- if(!$this->openOfficeInstalled) {
- if(!WINDOWS_OS) $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
- $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
- if ($passedOpenOffice) { //Install OpenOffice
-// $this->temp_variables['openOfficeExe'] = $this->soffice;
- // TODO : Why, O, why?
- $this->openOfficeExeError = false;
- $_SESSION[$this->salt]['services']['openOfficeExe'] = $this->soffice;
- $this->installService('OpenOffice');
- }
- } else {
- $this->openOfficeInstalled();
- }
- }
- $this->checkServiceStatus();
- $this->storeSilent(); // Store info needed for silent mode
- if(!empty($errors))
- return false;
- return true;
- }
-
- private function openOfficeInstalled() {
- $this->openOfficeExeError = false;
- }
-
- private function schedulerInstalled() {
-
- }
-
- private function luceneInstalled() {
- $this->disableExtension = true; // Disable the use of the php bridge extension
- $this->javaVersionCorrect();
- $this->javaInstalled();
- $this->javaCheck = 'tick';
- }
-
- /**
- * A final check to see if services are still running,
- * incase they switched on and turned off.
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function checkServiceStatus() {
- $serverDetails = $this->getServices();
- foreach ($serverDetails as $serviceName) {
- $className = OS.$serviceName;
- $service = new $className();
- $service->load();
- $status = $this->serviceInstalled($service);
- if($status != 'STARTED') {
- $msg = $service->getName()." Could not be added as a Service";
- $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
- $this->serviceCheck = 'cross_orange';
- $this->warnings[] = $msg;
- } else {
- if(WINDOWS_OS) {
- $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
- else {
- $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
- }
- }
- }
- }
-
- /**
- * Checks if all services have been started already,
- * incase the user lands on service page multiple times
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function alreadyInstalled() {
- $allInstalled = true;
- $serverDetails = $this->getServices();
- foreach ($serverDetails as $serviceName) {
- $className = OS.$serviceName;
- $service = new $className();
- $status = $this->serviceInstalled($service);
- $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed";
- if(!$status) {
- $allInstalled = false;
- $this->$flag = false;
- } else {
- $this->$flag = true;
- }
- }
-
- return $allInstalled;
- }
-
- private function presetJava() {
- $this->zendBridgeNotInstalled(); // Set bridge not installed
- $this->javaVersionInCorrect(); // Set version to incorrect
- $this->javaNotInstalled(); // Set java to not installed
- $this->setJava(); // Check if java has been auto detected
- }
-
- private function presetOpenOffice() {
- $this->specifyOpenOffice();
- }
-
- private function setOpenOffice() {
-
- }
- /**
- * Do some basic checks to help the user overcome java problems
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function javaChecks() {
- if($this->util->javaSpecified()) {
- $this->disableExtension = true; // Disable the use of the php bridge extension
- if($this->detSettings(true)) { // AutoDetect java settings
- return true;
- } else {
- $this->specifyJava(); // Ask for settings
- }
- } else {
- $auto = $this->useBridge(); // Use Bridge to get java settings
- if($auto) {
- return $auto;
- } else {
- $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;
- }
- }
-
- private function openOfficeChecks() {
- if($this->util->openOfficeSpecified()) {
- $this->soffice = $this->util->openOfficeSpecified();
- if(file_exists($this->soffice))
- return true;
- else
- return false;
- } else {
- return false;
- }
- }
-
- /**
- * Attempt detection without logging errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function useDetected() {
- return $this->detSettings();
- }
-
- /**
- * Set template view to specify java
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function specifyJava() {
- $this->javaExeError = true;
- }
-
- /**
- * Set template view to specify php
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function specifyPhp() {
- $this->phpExeError = true;
- }
-
- /**
- * Set template view to specify open office
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function specifyOpenOffice() {
- $this->openOfficeExeError = true;
- }
-
- private function phpChecks() {
- // TODO: Better detection
- return true;
- $this->setPhp();
- if($this->util->phpSpecified()) {
- return $this->detPhpSettings();
- } else {
- $this->specifyPhp();// Ask for settings
- return false;
- }
- }
-
-
-
- /**
- * Attempts to use user input and configure java settings
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function detSettings($attempt = false) {
- $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
- if($javaExecutable == '') {
- if($this->java == '') {
- return false;
- }
- $javaExecutable = $this->java;
- }
- $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!";
- $response = $this->util->pexec($cmd);
- if(file_exists(OUTPUT_DIR.'outJV')) {
- $tmp = file_get_contents(OUTPUT_DIR.'outJV');
- preg_match('/"(.*)"/',$tmp, $matches);
- if($matches) {
- if($matches[1] < $this->javaVersion) { // Check Version of java
- $this->javaVersionInCorrect();
- $this->javaCheck = 'cross';
- $this->error[] = "Requires Java 1.5+ to be installed";
-
- return false;
- } else {
- $this->javaVersionCorrect();
- $this->javaInstalled();
- $this->javaCheck = 'tick';
- $this->providedJava = true;
-
- return true;
- }
- } else {
- $this->javaVersionWarning();
- $this->javaCheck = 'cross_orange';
- if($attempt) {
- $this->javaExeMessage = "Incorrect java path specified";
- $this->javaExeError = true;
- $this->error[] = "Requires Java 1.5+ to be installed";
- }
-
-
- return false;
- }
- }
-
- $this->javaVersionInCorrect();
- $this->javaCheck = 'cross';
- $this->error[] = "Requires Java 1.5+ to be installed";
- return false;
- }
-
- function detPhpSettings() {
- // TODO: Better php handling
- return true;
- $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
- $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
- $response = $this->util->pexec($cmd);
- if(file_exists(OUTPUT_DIR.'outPHP')) {
- $tmp = file_get_contents(OUTPUT_DIR.'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;
- }
- }
- }
- /**
- * Attempts to use bridge and configure java settings
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function useBridge() {
- $zendBridge = $this->util->zendBridge(); // Find Zend Bridge
- if($zendBridge) { // Bridge installed implies java exists
- $this->zendBridgeInstalled();
- if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
- $this->javaExtCheck = 'tick'; // Set bridge to functional
- $this->javaInstalled(); // Set java to installed
- $javaSystem = new Java('java.lang.System');
- $version = $javaSystem->getProperty('java.version');
- $ver = substr($version, 0, 3);
- if($ver < $this->javaVersion) {
- $this->javaVersionInCorrect();
- $this->error[] = "Requires Java 1.5+ to be installed";
- return false;
- } else {
- $this->javaVersionCorrect(); // Set version to correct
- $this->javaCheck = 'tick';
- return true;
- }
- } else {
- $this->javaCheck = 'cross_orange';
- $this->javaVersionWarning();
- $this->zendBridgeWarning();
- $this->warnings[] = "Zend Java Bridge Not Functional";
- $this->javaExtCheck = 'cross_orange';
- return false;
- }
- } else {
- $this->warnings[] = "Zend Java Bridge Not Found";
- return false;
- }
- }
-
- /**
- * Check if Zend Bridge is functional
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function checkZendBridge() {
- if($this->util->javaBridge()) { // Check if java bridge is functional
- return true;
- } else {
- return false;
- }
- }
-
-
- /**
- * Installs services
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function installServices() {
- foreach ($this->getServices() as $serviceName) {
- $this->installService($serviceName);
- }
-
- return true;
- }
-
- /**
- * Installs services helper
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function installService($serviceName) {
- $className = OS.$serviceName;
- $service = new $className();
- $status = $this->serviceHelper($service);
- if (!$status) {
- $this->serviceCheck = 'cross_orange';
- }
- }
-
- /**
- * Installs services
- *
- * @author KnowledgeTree Team
- * @param object
- * @access private
- * @return string
- */
- private function serviceHelper($service) {
- $service->load(); // Load Defaults
- $response = $service->install(); // Install service
- $statusCheck = OS."ServiceInstalled";
- return $this->$statusCheck($service);
- }
-
- /**
- * Helper to check if service is installed
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return string
- */
- public function serviceInstalled($service) {
- $statusCheck = OS."ServiceInstalled";
- return $this->$statusCheck($service);
- }
-
- /**
- * Helper to check if service is started
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return string
- */
- public function serviceStarted($service) {
- $statusCheck = OS."ServiceStarted";
- return $this->$statusCheck($service);
- }
-
- /**
- * Check if windows service installed
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return boolean
- */
- public function windowsServiceStarted($service) {
- $status = $service->status(); // Check if service has been installed
- if($status != 'RUNNING') { // Check service status
- return false;
- }
- return true;
- }
-
- /**
- * Check if unix service installed
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return boolean
- */
- public function unixServiceStarted($service) {
- $status = $service->status(); // Check if service has been installed
- if($status != 'STARTED') { // Check service status
- return false;
- }
- return true;
- }
-
- /**
- * Check if windows service installed
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return boolean
- */
- public function windowsServiceInstalled($service) {
- $status = $service->status(); // Check if service has been installed
- if($status == '') { // Check service status
- return false;
- }
- return true;
- }
-
- /**
- * Check if unix service installed
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return boolean
- */
- public function unixServiceInstalled($service) {
- $status = $service->status(); // Check if service has been installed
- if($status != 'STARTED') { // Check service status
- return false;
- }
- return true;
- }
-
- /**
- * Starts all services
- *
- * @author KnowledgeTree Team
- * @param object
- * @access public
- * @return mixed
- */
- public function installStep() {
- foreach ($this->getServices() as $serviceName) {
- $className = OS.$serviceName;
- $service = new $className();
- $status = $this->serviceStart($service);
- }
- return true;
- }
-
- /**
- * Starts service
- *
- * @author KnowledgeTree Team
- * @param object
- * @access private
- * @return string
- */
- private function serviceStart($service) {
- if(OS == 'windows') {
- $service->load(); // Load Defaults
- $service->start(); // Start Service
- return $service->status(); // Get service status
- }
- }
-
- /**
- * Returns services errors
- *
- * @author KnowledgeTree Team
- * @access public
- * @params none
- * @return array
- */
- public function getErrors() {
- return $this->error;
- }
-
- /**
- * Returns services warnings
- *
- * @author KnowledgeTree Team
- * @access public
- * @params none
- * @return array
- */
- public function getWarnings() {
- return $this->warnings;
- }
-
- /**
- * Get the variables to be passed to the template
- *
- * @author KnowledgeTree Team
- * @access public
- * @return array
- */
- public function getStepVars()
- {
- return $this->temp_variables;
- }
-
- /**
- * Store Java state as installed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function javaInstalled() {
- $this->temp_variables['java']['class'] = 'tick';
- $this->temp_variables['java']['found'] = "Java Runtime Installed";
- }
-
- /**
- * Store Java state as not installed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function javaNotInstalled() {
- $this->temp_variables['java']['class'] = 'cross';
- $this->temp_variables['java']['found'] = "Java runtime environment required";
- }
-
- /**
- * Store Java version state as correct
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function javaVersionCorrect() {
- $this->temp_variables['version']['class'] = 'tick';
- $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
- }
-
- /**
- * Store Java version state as warning
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function javaVersionWarning() {
- $this->temp_variables['version']['class'] = 'cross_orange';
- $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
- }
-
- /**
- * Store Java version as state incorrect
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function javaVersionInCorrect() {
- $this->temp_variables['version']['class'] = 'cross';
- $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
- }
-
- /**
- * Store Zend Bridge state as installed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function zendBridgeInstalled() {
- $this->temp_variables['extensions']['class'] = 'tick';
- $this->temp_variables['extensions']['found'] = "Java Bridge Installed";
- }
-
- /**
- * Store Zend Bridge state as not installed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function zendBridgeNotInstalled() {
- $this->temp_variables['extensions']['class'] = 'cross_orange';
- $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
- }
-
- /**
- * Store Zend Bridge state as warning
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function zendBridgeWarning() {
- $this->temp_variables['extensions']['class'] = 'cross_orange';
- $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
- }
-
- /**
- * Set all silent mode varibles
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function storeSilent() {
- // Servics
- $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
- $this->temp_variables['luceneInstalled'] = $this->luceneInstalled;
- $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled;
- $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled;
- // Java
- $this->temp_variables['javaExeError'] = $this->javaExeError;
- $this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
- $this->temp_variables['javaCheck'] = $this->javaCheck;
- $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
- // Open Office
- $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError;
- $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage;
- // TODO : PHP detection
- $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
- $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
- $this->temp_variables['serviceCheck'] = $this->serviceCheck;
- $this->temp_variables['disableExtension'] = $this->disableExtension;
- // TODO: Java checks are gettign intense
- $this->temp_variables['providedJava'] = $this->providedJava;
- }
-
- private function setPhp() {
- if($this->php != '') { // PHP Found
- $this->phpCheck = 'tick';
- } elseif (PHP_DIR != '') { // Use System Defined Settings
- $this->php = PHP_DIR;
- } else {
-
- }
- $this->temp_variables['php']['location'] = $this->php;
- }
-
- public function getPhpDir() {
- return $this->php;
- }
-
- public function doDeleteAll() {
- $serverDetails = $this->getServices();
- foreach ($serverDetails as $serviceName) {
- $className = OS.$serviceName;
- require_once("../lib/services/service.php");
- require_once("../lib/services/".OS."Service.php");
- require_once("../lib/services/$className.php");
- $service = new $className();
- $service->uninstall();
- echo "Delete Service {$service->getName()}
";
- echo "Status of service ".$service->status()."
";
- }
- }
-
- public function doInstallAll() {
- $serverDetails = $this->getServices();
- foreach ($serverDetails as $serviceName) {
- $className = OS.$serviceName;
- require_once("../lib/services/service.php");
- require_once("../lib/services/".OS."Service.php");
- require_once("../lib/services/$className.php");
- $service = new $className();
- $service->load();
- $service->install();
- echo "Install Service {$service->getName()}
";
- echo "Status of service ".$service->status()."
";
- }
- }
-
- public function doStatusAll() {
- $serverDetails = $this->getServices();
- foreach ($serverDetails as $serviceName) {
- $className = OS.$serviceName;
- require_once("../lib/services/service.php");
- require_once("../lib/services/".OS."Service.php");
- require_once("../lib/services/$className.php");
- $service = new $className();
- $service->load();
- echo "{$service->getName()} : Status of service = ".$service->status()."
";
- }
- }
-}
-
-if(isset($_GET['action'])) {
- $func = $_GET['action'];
- if($func != '') {
- $serv = new services();
- $func_call = strtoupper(substr($func,0,1)).substr($func,1);
- $method = "do$func";
- $serv->$method();
- }
-}
-?>
+.
+*
+* 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 Installer
+* @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");
+ }
+}
+
+class services extends Step
+{
+ /**
+ * List of errors encountered
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $error = array();
+
+ /**
+ * Flag if step needs to be installed
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $runInstall = true;
+
+ /**
+ * List of services to be installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var array
+ */
+ private $services = array('Lucene', 'Scheduler', 'OpenOffice');
+
+ /**
+ * Path to php executable
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ protected $php;
+
+ /**
+ * Flag if php already provided
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ public $providedPhp = false;
+
+ /**
+ * PHP Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $phpCheck = 'cross_orange';
+
+ /**
+ * Flag, if php is specified and an error has been encountered
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ private $phpExeError = false;
+
+ /**
+ * Holds path error, if php is specified
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var string
+ */
+ private $phpExeMessage = '';
+
+ /**
+ * Path to open office executable
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ protected $soffice;
+
+ /**
+ * Flag if open office already provided
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ public $providedOpenOffice = false;
+
+ /**
+ * Flag, if open office is specified and an error has been encountered
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ private $openOfficeExeError = false;
+
+ /**
+ * Holds path error, if open office is specified
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var string
+ */
+ private $openOfficeExeMessage = '';
+
+ /**
+ * Path to java executable
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ protected $java = "";
+
+ /**
+ * Minumum Java Version
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $javaVersion = '1.5';
+
+ /**
+ * Java Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $javaCheck = 'cross';
+
+ /**
+ * Open Office Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $openOfficeCheck = 'cross';
+
+ /**
+ * Flag if java already provided
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ public $providedJava = false;
+
+ /**
+ * Java Bridge Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $javaExtCheck = 'cross_orange';
+
+ /**
+ * Flag if bridge extension needs to be disabled
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ private $disableExtension = false;
+
+ /**
+ * Flag, if java is specified and an error has been encountered
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var booelean
+ */
+ private $javaExeError = false;
+
+ /**
+ * Holds path error, if java is specified
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var string
+ */
+ private $javaExeMessage = '';
+
+ /**
+ * Flag if services are already Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $alreadyInstalled = false;
+
+ /**
+ * Flag if services are already Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $luceneInstalled = false;
+
+ /**
+ * Flag if services are already Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var mixed
+ */
+ private $schedulerInstalled = false;
+
+ /**
+ * Path to php executable
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ private $openOfficeInstalled;
+
+ /**
+ * Service Installed
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @var array
+ */
+ private $serviceCheck = 'tick';
+
+ /**
+ * Flag to store class information in session
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ protected $storeInSession = true;
+
+ /**
+ * List of variables to be loaded to template
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var array
+ */
+ protected $temp_variables;
+
+ /**
+ * Flag if step needs to run silently
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var array
+ */
+ protected $silent = true;
+
+ /**
+ * Reference to utility object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ protected $util;
+ private $salt = 'installers';
+
+ /**
+ * Constructs services object
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ */
+ public function __construct() {
+ $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
+ $this->util = new InstallUtil();
+ }
+
+ /**
+ * Main control of services setup
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function doStep()
+ {
+ if(!$this->inStep("services")) {
+ $this->doRun();
+ return 'landing';
+ }
+ if($this->next()) {
+ // Check dependencies
+ $passed = $this->doRun();
+ $serv = $this->getDataFromSession("services");
+ if($passed || $serv['providedJava'])
+ return 'next';
+ else
+ return 'error';
+ } else if($this->previous()) {
+ return 'previous';
+ }
+ $passed = $this->doRun();
+ return 'landing';
+ }
+
+ /**
+ * Get service names
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getServices() {
+ return $this->services;
+ }
+
+ /**
+ * Check if java executable was found
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return array
+ */
+ private function setJava() {
+ if($this->java != '') { // Java JRE Found
+ $this->javaCheck = 'tick';
+ $this->javaInstalled();
+ $this->temp_variables['java']['location'] = $this->java;
+ return ;
+ }
+
+ $this->temp_variables['java']['location'] = $this->java;
+ }
+
+ /**
+ * Run step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function doRun() {
+ if($this->alreadyInstalled()) {
+ $this->alreadyInstalled = true;
+ $this->serviceCheck = 'tick';
+ } else {
+ $this->presetJava();
+ $this->presetOpenOffice();
+ if(!$this->schedulerInstalled) {
+ if(!WINDOWS_OS) $this->php = $this->util->getPhp(); // Get java, if it exists
+ $passedPhp = $this->phpChecks(); // Run Java Pre Checks
+ if ($passedPhp) { // Install Scheduler
+ $this->installService('Scheduler');
+ }
+ } else {
+ $this->schedulerInstalled();
+ }
+ if(!$this->luceneInstalled) {
+ if(!WINDOWS_OS) $this->java = $this->util->getJava(); // Get java, if it exists
+ $passedJava = $this->javaChecks(); // Run Java Pre Checks
+ if ($passedJava) { // Install Lucene
+ $this->installService('Lucene');
+ }
+ } else {
+ $this->luceneInstalled();
+ }
+ if(!$this->openOfficeInstalled) {
+ if(!WINDOWS_OS) $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
+ $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
+ if ($passedOpenOffice) { //Install OpenOffice
+// $this->temp_variables['openOfficeExe'] = $this->soffice;
+ // TODO : Why, O, why?
+ $this->openOfficeExeError = false;
+ $_SESSION[$this->salt]['services']['openOfficeExe'] = $this->soffice;
+ $this->installService('OpenOffice');
+ }
+ } else {
+ $this->openOfficeInstalled();
+ }
+ }
+ $this->checkServiceStatus();
+ $this->storeSilent(); // Store info needed for silent mode
+ if(!empty($errors))
+ return false;
+ return true;
+ }
+
+ private function openOfficeInstalled() {
+ $this->openOfficeExeError = false;
+ }
+
+ private function schedulerInstalled() {
+
+ }
+
+ private function luceneInstalled() {
+ $this->disableExtension = true; // Disable the use of the php bridge extension
+ $this->javaVersionCorrect();
+ $this->javaInstalled();
+ $this->javaCheck = 'tick';
+ }
+
+ /**
+ * A final check to see if services are still running,
+ * incase they switched on and turned off.
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function checkServiceStatus() {
+ $serverDetails = $this->getServices();
+ foreach ($serverDetails as $serviceName) {
+ $className = OS.$serviceName;
+ $service = new $className();
+ $service->load();
+ $status = $this->serviceInstalled($service);
+ if($status != 'STARTED') {
+ $msg = $service->getName()." Could not be added as a Service";
+ $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
+ $this->serviceCheck = 'cross_orange';
+ $this->warnings[] = $msg;
+ } else {
+ if(WINDOWS_OS) {
+ $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
+ else {
+ $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if all services have been started already,
+ * incase the user lands on service page multiple times
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function alreadyInstalled() {
+ $allInstalled = true;
+ $serverDetails = $this->getServices();
+ foreach ($serverDetails as $serviceName) {
+ $className = OS.$serviceName;
+ $service = new $className();
+ $status = $this->serviceInstalled($service);
+ $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed";
+ if(!$status) {
+ $allInstalled = false;
+ $this->$flag = false;
+ } else {
+ $this->$flag = true;
+ }
+ }
+
+ return $allInstalled;
+ }
+
+ private function presetJava() {
+ $this->zendBridgeNotInstalled(); // Set bridge not installed
+ $this->javaVersionInCorrect(); // Set version to incorrect
+ $this->javaNotInstalled(); // Set java to not installed
+ $this->setJava(); // Check if java has been auto detected
+ }
+
+ private function presetOpenOffice() {
+ $this->specifyOpenOffice();
+ }
+
+ private function setOpenOffice() {
+
+ }
+ /**
+ * Do some basic checks to help the user overcome java problems
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function javaChecks() {
+ if($this->util->javaSpecified()) {
+ $this->disableExtension = true; // Disable the use of the php bridge extension
+ if($this->detSettings(true)) { // AutoDetect java settings
+ return true;
+ } else {
+ $this->specifyJava(); // Ask for settings
+ }
+ } else {
+ $auto = $this->useBridge(); // Use Bridge to get java settings
+ if($auto) {
+ return $auto;
+ } else {
+ $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;
+ }
+ }
+
+ private function openOfficeChecks() {
+ if($this->util->openOfficeSpecified()) {
+ $this->soffice = $this->util->openOfficeSpecified();
+ if(file_exists($this->soffice))
+ return true;
+ else
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Attempt detection without logging errors
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function useDetected() {
+ return $this->detSettings();
+ }
+
+ /**
+ * Set template view to specify java
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function specifyJava() {
+ $this->javaExeError = true;
+ }
+
+ /**
+ * Set template view to specify php
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function specifyPhp() {
+ $this->phpExeError = true;
+ }
+
+ /**
+ * Set template view to specify open office
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function specifyOpenOffice() {
+ $this->openOfficeExeError = true;
+ }
+
+ private function phpChecks() {
+ // TODO: Better detection
+ return true;
+ $this->setPhp();
+ if($this->util->phpSpecified()) {
+ return $this->detPhpSettings();
+ } else {
+ $this->specifyPhp();// Ask for settings
+ return false;
+ }
+ }
+
+
+
+ /**
+ * Attempts to use user input and configure java settings
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function detSettings($attempt = false) {
+ $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
+ if($javaExecutable == '') {
+ if($this->java == '') {
+ return false;
+ }
+ $javaExecutable = $this->java;
+ }
+ $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!";
+ $response = $this->util->pexec($cmd);
+ if(file_exists(OUTPUT_DIR.'outJV')) {
+ $tmp = file_get_contents(OUTPUT_DIR.'outJV');
+ preg_match('/"(.*)"/',$tmp, $matches);
+ if($matches) {
+ if($matches[1] < $this->javaVersion) { // Check Version of java
+ $this->javaVersionInCorrect();
+ $this->javaCheck = 'cross';
+ $this->error[] = "Requires Java 1.5+ to be installed";
+
+ return false;
+ } else {
+ $this->javaVersionCorrect();
+ $this->javaInstalled();
+ $this->javaCheck = 'tick';
+ $this->providedJava = true;
+
+ return true;
+ }
+ } else {
+ $this->javaVersionWarning();
+ $this->javaCheck = 'cross_orange';
+ if($attempt) {
+ $this->javaExeMessage = "Incorrect java path specified";
+ $this->javaExeError = true;
+ $this->error[] = "Requires Java 1.5+ to be installed";
+ }
+
+
+ return false;
+ }
+ }
+
+ $this->javaVersionInCorrect();
+ $this->javaCheck = 'cross';
+ $this->error[] = "Requires Java 1.5+ to be installed";
+ return false;
+ }
+
+ function detPhpSettings() {
+ // TODO: Better php handling
+ return true;
+ $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
+ $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
+ $response = $this->util->pexec($cmd);
+ if(file_exists(OUTPUT_DIR.'outPHP')) {
+ $tmp = file_get_contents(OUTPUT_DIR.'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;
+ }
+ }
+ }
+ /**
+ * Attempts to use bridge and configure java settings
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function useBridge() {
+ $zendBridge = $this->util->zendBridge(); // Find Zend Bridge
+ if($zendBridge) { // Bridge installed implies java exists
+ $this->zendBridgeInstalled();
+ if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
+ $this->javaExtCheck = 'tick'; // Set bridge to functional
+ $this->javaInstalled(); // Set java to installed
+ $javaSystem = new Java('java.lang.System');
+ $version = $javaSystem->getProperty('java.version');
+ $ver = substr($version, 0, 3);
+ if($ver < $this->javaVersion) {
+ $this->javaVersionInCorrect();
+ $this->error[] = "Requires Java 1.5+ to be installed";
+ return false;
+ } else {
+ $this->javaVersionCorrect(); // Set version to correct
+ $this->javaCheck = 'tick';
+ return true;
+ }
+ } else {
+ $this->javaCheck = 'cross_orange';
+ $this->javaVersionWarning();
+ $this->zendBridgeWarning();
+ $this->warnings[] = "Zend Java Bridge Not Functional";
+ $this->javaExtCheck = 'cross_orange';
+ return false;
+ }
+ } else {
+ $this->warnings[] = "Zend Java Bridge Not Found";
+ return false;
+ }
+ }
+
+ /**
+ * Check if Zend Bridge is functional
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function checkZendBridge() {
+ if($this->util->javaBridge()) { // Check if java bridge is functional
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ /**
+ * Installs services
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function installServices() {
+ foreach ($this->getServices() as $serviceName) {
+ $this->installService($serviceName);
+ }
+
+ return true;
+ }
+
+ /**
+ * Installs services helper
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function installService($serviceName) {
+ $className = OS.$serviceName;
+ $service = new $className();
+ $status = $this->serviceHelper($service);
+ if (!$status) {
+ $this->serviceCheck = 'cross_orange';
+ }
+ }
+
+ /**
+ * Installs services
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access private
+ * @return string
+ */
+ private function serviceHelper($service) {
+ $service->load(); // Load Defaults
+ $response = $service->install(); // Install service
+ $statusCheck = OS."ServiceInstalled";
+ return $this->$statusCheck($service);
+ }
+
+ /**
+ * Helper to check if service is installed
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return string
+ */
+ public function serviceInstalled($service) {
+ $statusCheck = OS."ServiceInstalled";
+ return $this->$statusCheck($service);
+ }
+
+ /**
+ * Helper to check if service is started
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return string
+ */
+ public function serviceStarted($service) {
+ $statusCheck = OS."ServiceStarted";
+ return $this->$statusCheck($service);
+ }
+
+ /**
+ * Check if windows service installed
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return boolean
+ */
+ public function windowsServiceStarted($service) {
+ $status = $service->status(); // Check if service has been installed
+ if($status != 'RUNNING') { // Check service status
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Check if unix service installed
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return boolean
+ */
+ public function unixServiceStarted($service) {
+ $status = $service->status(); // Check if service has been installed
+ if($status != 'STARTED') { // Check service status
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Check if windows service installed
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return boolean
+ */
+ public function windowsServiceInstalled($service) {
+ $status = $service->status(); // Check if service has been installed
+ if($status == '') { // Check service status
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Check if unix service installed
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return boolean
+ */
+ public function unixServiceInstalled($service) {
+ $status = $service->status(); // Check if service has been installed
+ if($status != 'STARTED') { // Check service status
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Starts all services
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access public
+ * @return mixed
+ */
+ public function installStep() {
+ foreach ($this->getServices() as $serviceName) {
+ $className = OS.$serviceName;
+ $service = new $className();
+ $status = $this->serviceStart($service);
+ }
+ return true;
+ }
+
+ /**
+ * Starts service
+ *
+ * @author KnowledgeTree Team
+ * @param object
+ * @access private
+ * @return string
+ */
+ private function serviceStart($service) {
+ if(OS == 'windows') {
+ $service->load(); // Load Defaults
+ $service->start(); // Start Service
+ return $service->status(); // Get service status
+ }
+ }
+
+ /**
+ * Returns services errors
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @params none
+ * @return array
+ */
+ public function getErrors() {
+ return $this->error;
+ }
+
+ /**
+ * Returns services warnings
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @params none
+ * @return array
+ */
+ public function getWarnings() {
+ return $this->warnings;
+ }
+
+ /**
+ * Get the variables to be passed to the template
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @return array
+ */
+ public function getStepVars()
+ {
+ return $this->temp_variables;
+ }
+
+ /**
+ * Store Java state as installed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function javaInstalled() {
+ $this->temp_variables['java']['class'] = 'tick';
+ $this->temp_variables['java']['found'] = "Java Runtime Installed";
+ }
+
+ /**
+ * Store Java state as not installed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function javaNotInstalled() {
+ $this->temp_variables['java']['class'] = 'cross';
+ $this->temp_variables['java']['found'] = "Java runtime environment required";
+ }
+
+ /**
+ * Store Java version state as correct
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function javaVersionCorrect() {
+ $this->temp_variables['version']['class'] = 'tick';
+ $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
+ }
+
+ /**
+ * Store Java version state as warning
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function javaVersionWarning() {
+ $this->temp_variables['version']['class'] = 'cross_orange';
+ $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
+ }
+
+ /**
+ * Store Java version as state incorrect
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function javaVersionInCorrect() {
+ $this->temp_variables['version']['class'] = 'cross';
+ $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
+ }
+
+ /**
+ * Store Zend Bridge state as installed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function zendBridgeInstalled() {
+ $this->temp_variables['extensions']['class'] = 'tick';
+ $this->temp_variables['extensions']['found'] = "Java Bridge Installed";
+ }
+
+ /**
+ * Store Zend Bridge state as not installed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function zendBridgeNotInstalled() {
+ $this->temp_variables['extensions']['class'] = 'cross_orange';
+ $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
+ }
+
+ /**
+ * Store Zend Bridge state as warning
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function zendBridgeWarning() {
+ $this->temp_variables['extensions']['class'] = 'cross_orange';
+ $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
+ }
+
+ /**
+ * Set all silent mode varibles
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function storeSilent() {
+ // Servics
+ $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
+ $this->temp_variables['luceneInstalled'] = $this->luceneInstalled;
+ $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled;
+ $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled;
+ // Java
+ $this->temp_variables['javaExeError'] = $this->javaExeError;
+ $this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
+ $this->temp_variables['javaCheck'] = $this->javaCheck;
+ $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
+ // Open Office
+ $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError;
+ $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage;
+ // TODO : PHP detection
+ $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
+ $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
+ $this->temp_variables['serviceCheck'] = $this->serviceCheck;
+ $this->temp_variables['disableExtension'] = $this->disableExtension;
+ // TODO: Java checks are gettign intense
+ $this->temp_variables['providedJava'] = $this->providedJava;
+ }
+
+ private function setPhp() {
+ if($this->php != '') { // PHP Found
+ $this->phpCheck = 'tick';
+ } elseif (PHP_DIR != '') { // Use System Defined Settings
+ $this->php = PHP_DIR;
+ } else {
+
+ }
+ $this->temp_variables['php']['location'] = $this->php;
+ }
+
+ public function getPhpDir() {
+ return $this->php;
+ }
+
+ public function doDeleteAll() {
+ $serverDetails = $this->getServices();
+ foreach ($serverDetails as $serviceName) {
+ $className = OS.$serviceName;
+ require_once("../lib/services/service.php");
+ require_once("../lib/services/".OS."Service.php");
+ require_once("../lib/services/$className.php");
+ $service = new $className();
+ $service->uninstall();
+ echo "Delete Service {$service->getName()}
";
+ echo "Status of service ".$service->status()."
";
+ }
+ }
+
+ public function doInstallAll() {
+ $serverDetails = $this->getServices();
+ foreach ($serverDetails as $serviceName) {
+ $className = OS.$serviceName;
+ require_once("../lib/services/service.php");
+ require_once("../lib/services/".OS."Service.php");
+ require_once("../lib/services/$className.php");
+ $service = new $className();
+ $service->load();
+ $service->install();
+ echo "Install Service {$service->getName()}
";
+ echo "Status of service ".$service->status()."
";
+ }
+ }
+
+ public function doStatusAll() {
+ $serverDetails = $this->getServices();
+ foreach ($serverDetails as $serviceName) {
+ $className = OS.$serviceName;
+ require_once("../lib/services/service.php");
+ require_once("../lib/services/".OS."Service.php");
+ require_once("../lib/services/$className.php");
+ $service = new $className();
+ $service->load();
+ echo "{$service->getName()} : Status of service = ".$service->status()."
";
+ }
+ }
+}
+
+if(isset($_GET['action'])) {
+ $func = $_GET['action'];
+ if($func != '') {
+ $serv = new services();
+ $func_call = strtoupper(substr($func,0,1)).substr($func,1);
+ $method = "do$func";
+ $serv->$method();
+ }
+}
+?>
diff --git a/var/proxies/.empty b/var/proxies/.empty
deleted file mode 100644
index 93169e4..0000000
--- a/var/proxies/.empty
+++ /dev/null
@@ -1,2 +0,0 @@
-Order deny,allow
-Deny from all
diff --git a/webservice/clienttools/services/3.6.1/kt.php b/webservice/clienttools/services/3.6.1/kt.php
index e4106fc..b93f28b 100644
--- a/webservice/clienttools/services/3.6.1/kt.php
+++ b/webservice/clienttools/services/3.6.1/kt.php
@@ -482,7 +482,7 @@ class kt extends client_service {
*/
$response['status_code']=0;
- $response['message']=$url;
+ $response['message']=$url.'&apptype='.$params['app_type'];
$response['filename']=$docname;
$this->addDebug('effective params',$params);
$this->setResponse($response);
@@ -651,8 +651,7 @@ class kt extends client_service {
$this->response= array('status_code'=>0, 'document_id'=>$document_id, 'content_id'=>$content_id);
}
-
- function get_all_client_policies(){
+ function get_all_client_policies(){
$config=KTConfig::getSingleton();
$this->addDebug('KTConfig Singleton',$config);