Commit b3f83c3d4b17133725c5ef1cb19f18ea0c6660b8

Authored by Mark Holtzhausen
2 parents eacf3639 fcfcd2e3

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

.gitignore
... ... @@ -12,3 +12,4 @@ clienttools/Karoo
12 12 clienttools/Office
13 13 .gitmodules
14 14 *.out
  15 +baobab/
... ...
bin/win32/winserv.exe 0 → 100644
No preview for this file type
plugins/thumbnails/templates/shadow.gif 0 → 100644

4.26 KB

plugins/thumbnails/templates/shadowAlpha.png 0 → 100644

3.32 KB

plugins/thumbnails/templates/thumbnail_viewlet.smarty
1   -<div>
2   - <div><img src="{$thumbnail}" height="200px"/></div>
3   -</div>
4 1 \ No newline at end of file
  2 +{literal}
  3 +<style>
  4 +.thumb-shadow {
  5 + float:left;
  6 + background: url(plugins/thumbnails/templates/shadowAlpha.png) no-repeat bottom right !important;
  7 + background: url(plugins/thumbnails/templates/shadow.gif) no-repeat bottom right;
  8 + margin: 10px 0 0 10px !important;
  9 + margin: 10px 0 0 5px;
  10 + }
  11 +
  12 +.thumb-shadow img {
  13 + display: block;
  14 + position: relative;
  15 + background-color: #fff;
  16 + border: 1px solid #a9a9a9;
  17 + margin: -6px 6px 6px -6px;
  18 + padding: 4px;
  19 + }
  20 +</style>
  21 +{/literal}
  22 +<div class="thumb-shadow">
  23 + <div><img src="{$thumbnail}" height="200px"/></div>
  24 +</div>
... ...
scripts/diagnoseIndexing.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq diagnose.php
  4 +../../../scripts/php.sh -Cq diagnose.php
... ...
scripts/indexMigrationTask.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronMigration.php
  4 +../../../scripts/php.sh -Cq cronMigration.php
... ...
scripts/indexingTask.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronIndexer.php
  4 +../../../scripts/php.sh -Cq cronIndexer.php
... ...
scripts/optimizeIndexes.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq optimise.php
  4 +../../../scripts/php.sh -Cq optimise.php
... ...
scripts/php.sh 0 → 100755
  1 +#!/bin/sh
  2 +PHPRC=/usr/local/zend/etc
  3 +export PHPRC
  4 +PHP_PEAR_SYSCONF_DIR=/usr/local/zend/etc
  5 +export PHP_PEAR_SYSCONF_DIR
  6 +LD_LIBRARY_PATH="/usr/lib32:/usr/local/zend/lib:/usr/local/zend/lib/php_extensions:$LD_LIBRARY_PATH"
  7 +export LD_LIBRARY_PATH
  8 +exec /usr/local/zend/bin/php "$@"
... ...
scripts/registerExtractorTypes.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq registerTypes.php
  4 +../../../scripts/php.sh -Cq registerTypes.php
... ...
scripts/savedSearchTask.sh
1 1 #!/bin/sh
2 2  
3 3 cd ../search2/indexing/bin
4   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq cronSavedSearch.php
  4 +../../../scripts/php.sh -Cq cronSavedSearch.php
... ...
scripts/schedulerTask.sh
... ... @@ -2,6 +2,6 @@
2 2  
3 3 cd ../bin
4 4 while true; do
5   -/usr/local/zend/bin/php -c /use/local/zend/etc -Cq scheduler.php
  5 +../scripts/php.sh -Cq scheduler.php
6 6 sleep 30
7 7 done
... ...
setup/migrate/templates/complete.tpl
... ... @@ -24,21 +24,21 @@
24 24 <table style="width:755px;">
25 25 <tr>
26 26 <td style="width:15px;"> <?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
27   - <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  27 + <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be stopped <?php } else { ?> Stopped <?php } ?></td>
28 28 <?php if ($LuceneStatus != 'tick') { ?>
29 29 <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
30 30 <?php } ?>
31 31 </tr>
32 32 <tr>
33 33 <td> <?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
34   - <td> Scheduler Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  34 + <td> Scheduler Service <?php if ($LuceneStatus != 'tick') { ?> Could not be stopped <?php } else { ?> Stopped <?php } ?></td>
35 35 <?php if ($SchedulerStatus != 'tick') { ?>
36 36 <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
37 37 <?php } ?>
38 38 </tr>
39 39 <tr>
40 40 <td> <?php echo "<span class='{$OpenOfficeStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
41   - <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  41 + <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be stopped <?php } else { ?> Stopped <?php } ?></td>
42 42 <?php if ($OpenOfficeStatus != 'tick') { ?>
43 43 <td><a href="javascript:this.location.reload();" class="refresh">Refresh</a></td>
44 44 <?php } ?>
... ...
setup/wizard/installUtil.php
... ... @@ -40,6 +40,8 @@
40 40 * @version Version 0.1
41 41 */
42 42 class InstallUtil {
  43 +
  44 + private $salt = 'installers';
43 45 /**
44 46 * Constructs installation object
45 47 *
... ... @@ -508,11 +510,11 @@ class InstallUtil {
508 510 * @return boolean
509 511 */
510 512 public function getDataFromSession($class) {
511   - if(empty($_SESSION[$class])) {
  513 + if(empty($_SESSION[$this->salt][$class])) {
512 514 return false;
513 515 }
514 516  
515   - return $_SESSION[$class];
  517 + return $_SESSION[$this->salt][$class];
516 518 }
517 519  
518 520 /**
... ...
setup/wizard/installer.php
... ... @@ -646,7 +646,7 @@ class Installer {
646 646 */
647 647 public function showSession() {
648 648 echo '<pre>';
649   - print_r($_SESSION);
  649 + print_r($_SESSION['installers']);
650 650 echo '</pre>';
651 651 }
652 652  
... ...
setup/wizard/lib/services/unixScheduler.php
... ... @@ -51,12 +51,12 @@ class unixScheduler extends unixService {
51 51 $this->name = "KTSchedulerTest";
52 52 $this->util = new InstallUtil();
53 53 $this->scheduler = 'scheduler';
  54 + $this->setSchedulerSource('schedulerTask.sh');
54 55 }
55 56  
56 57 public function load() {
57 58 $this->setSystemDir(SYSTEM_ROOT."bin".DS);
58 59 $this->setSchedulerDir(SYSTEM_DIR."bin".DS);
59   - $this->setSchedulerSource('schedulerTask.sh');
60 60 $this->setSchedulerSourceLoc('schedulerTask.sh');
61 61 }
62 62  
... ... @@ -171,4 +171,4 @@ class unixScheduler extends unixService {
171 171  
172 172  
173 173 }
174   -?>
175 174 \ No newline at end of file
  175 +?>
... ...
setup/wizard/lib/services/windowsOpenOffice.php
1   -<?php
2   -/**
3   -* Windows Agent Service Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Installer
40   -* @version Version 0.1
41   -*/
42   -
43   -class windowsOpenOffice extends windowsService {
44   -
45   - /**
46   - * Reference to utility object
47   - *
48   - * @author KnowledgeTree Team
49   - * @access protected
50   - * @var string
51   - */
52   - public $util;
53   -
54   - /**
55   - * Path to office executable
56   - *
57   - * @author KnowledgeTree Team
58   - * @access protected
59   - * @var string
60   - */
61   - private $path;
62   -
63   - /**
64   - * Web server
65   - *
66   - * @author KnowledgeTree Team
67   - * @access protected
68   - * @var string
69   - */
70   - private $host;
71   -
72   - /**
73   - * Path to temp pid file
74   - *
75   - * @author KnowledgeTree Team
76   - * @access protected
77   - * @var string
78   - */
79   - private $pidFile;
80   -
81   - /**
82   - * Web server Port
83   - *
84   - * @author KnowledgeTree Team
85   - * @access protected
86   - * @var string
87   - */
88   - private $port;
89   -
90   - /**
91   - * Web server
92   - *
93   - * @author KnowledgeTree Team
94   - * @access protected
95   - * @var string
96   - */
97   - private $bin;
98   -
99   - /**
100   - * Office executable name
101   - *
102   - * @author KnowledgeTree Team
103   - * @access protected
104   - * @var string
105   - */
106   - private $soffice;
107   -
108   - /**
109   - * Log file
110   - *
111   - * @author KnowledgeTree Team
112   - * @access protected
113   - * @var string
114   - */
115   - private $log;
116   -
117   - /**
118   - * Open office options
119   - *
120   - * @author KnowledgeTree Team
121   - * @access protected
122   - * @var string
123   - */
124   - private $options;
125   -
126   - /**
127   - * Path to win service
128   - *
129   - * @author KnowledgeTree Team
130   - * @access protected
131   - * @var string
132   - */
133   - private $winservice;
134   -
135   - /**
136   - * Service name
137   - *
138   - * @author KnowledgeTree Team
139   - * @access public
140   - * @param none
141   - * @return string
142   - */
143   - public $name = "KTOpenOfficeTest";
144   -
145   - public function load() {
146   - // hack for testing
147   - $this->setPort("8100");
148   - $this->setHost("127.0.0.1");
149   - $this->setLog("openoffice.log");
150   - $this->setWinservice("winserv.exe");
151   - $this->setOption();
152   - }
153   -
154   - private function setPort($port = "8100") {
155   - $this->port = $port;
156   - }
157   -
158   - public function getPort() {
159   - return $this->port;
160   - }
161   -
162   - private function setHost($host = "127.0.0.1") {
163   - $this->host = $host;
164   - }
165   -
166   - public function getHost() {
167   - return $this->host;
168   - }
169   -
170   - private function setLog($log = "openoffice.log") {
171   - $this->log = $log;
172   - }
173   -
174   - public function getLog() {
175   - return $this->log;
176   - }
177   -
178   - private function setBin($bin) {
179   - $this->bin = "\"".$bin."\"";
180   - }
181   -
182   - public function getBin() {
183   - return $this->bin;
184   - }
185   -
186   - private function setWinservice($winservice = "winserv.exe") {
187   - $this->winservice = SYS_BIN_DIR . $winservice;
188   - }
189   -
190   - public function getWinservice() {
191   - return $this->winservice;
192   - }
193   -
194   - private function setOption() {
195   - $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -invisible -nofirststartwizard"
196   - . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\"";
197   - }
198   -
199   - public function getOption() {
200   - return $this->options;
201   - }
202   -
203   - public function install() {
204   - $status = $this->status();
205   - if($status == '') {
206   - $services = $this->util->getDataFromSession('services');
207   - $this->setBin("{$services['openOfficeExe']}");
208   - $this->setOption();
209   - $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
210   - if(DEBUG) {
211   - echo "$cmd<br/>";
212   - return ;
213   - }
214   - $response = $this->util->pexec($cmd);
215   - return $response;
216   - }
217   - else {
218   - return $status;
219   - }
220   - }
221   -
222   - /**
223   - * Retrieve Status Service
224   - *
225   - * @author KnowledgeTree Team
226   - * @access public
227   - * @param none
228   - * @return string
229   - */
230   - public function status() {
231   - $cmd = "sc query {$this->name}";
232   - $response = $this->util->pexec($cmd);
233   - if($response['out']) {
234   - $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
235   - return $state;
236   - }
237   -
238   - return '';
239   - }
240   -}
  1 +<?php
  2 +/**
  3 +* Windows Agent Service Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  8 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  9 +*
  10 +* This program is free software; you can redistribute it and/or modify it under
  11 +* the terms of the GNU General Public License version 3 as published by the
  12 +* Free Software Foundation.
  13 +*
  14 +* This program is distributed in the hope that it will be useful, but WITHOUT
  15 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17 +* details.
  18 +*
  19 +* You should have received a copy of the GNU General Public License
  20 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +*
  22 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  23 +* California 94120-7775, or email info@knowledgetree.com.
  24 +*
  25 +* The interactive user interfaces in modified source and object code versions
  26 +* of this program must display Appropriate Legal Notices, as required under
  27 +* Section 5 of the GNU General Public License version 3.
  28 +*
  29 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  30 +* these Appropriate Legal Notices must retain the display of the "Powered by
  31 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  33 +* must display the words "Powered by KnowledgeTree" and retain the original
  34 +* copyright notice.
  35 +*
  36 +* @copyright 2008-2009, KnowledgeTree Inc.
  37 +* @license GNU General Public License version 3
  38 +* @author KnowledgeTree Team
  39 +* @package Installer
  40 +* @version Version 0.1
  41 +*/
  42 +
  43 +class windowsOpenOffice extends windowsService {
  44 +
  45 + /**
  46 + * Reference to utility object
  47 + *
  48 + * @author KnowledgeTree Team
  49 + * @access protected
  50 + * @var string
  51 + */
  52 + public $util;
  53 +
  54 + /**
  55 + * Path to office executable
  56 + *
  57 + * @author KnowledgeTree Team
  58 + * @access protected
  59 + * @var string
  60 + */
  61 + private $path;
  62 +
  63 + /**
  64 + * Web server
  65 + *
  66 + * @author KnowledgeTree Team
  67 + * @access protected
  68 + * @var string
  69 + */
  70 + private $host;
  71 +
  72 + /**
  73 + * Path to temp pid file
  74 + *
  75 + * @author KnowledgeTree Team
  76 + * @access protected
  77 + * @var string
  78 + */
  79 + private $pidFile;
  80 +
  81 + /**
  82 + * Web server Port
  83 + *
  84 + * @author KnowledgeTree Team
  85 + * @access protected
  86 + * @var string
  87 + */
  88 + private $port;
  89 +
  90 + /**
  91 + * Web server
  92 + *
  93 + * @author KnowledgeTree Team
  94 + * @access protected
  95 + * @var string
  96 + */
  97 + private $bin;
  98 +
  99 + /**
  100 + * Office executable name
  101 + *
  102 + * @author KnowledgeTree Team
  103 + * @access protected
  104 + * @var string
  105 + */
  106 + private $soffice;
  107 +
  108 + /**
  109 + * Log file
  110 + *
  111 + * @author KnowledgeTree Team
  112 + * @access protected
  113 + * @var string
  114 + */
  115 + private $log;
  116 +
  117 + /**
  118 + * Open office options
  119 + *
  120 + * @author KnowledgeTree Team
  121 + * @access protected
  122 + * @var string
  123 + */
  124 + private $options;
  125 +
  126 + /**
  127 + * Path to win service
  128 + *
  129 + * @author KnowledgeTree Team
  130 + * @access protected
  131 + * @var string
  132 + */
  133 + private $winservice;
  134 +
  135 + /**
  136 + * Service name
  137 + *
  138 + * @author KnowledgeTree Team
  139 + * @access public
  140 + * @param none
  141 + * @return string
  142 + */
  143 + public $name = "KTOpenOfficeTest";
  144 +
  145 + public function load() {
  146 + // hack for testing
  147 + $this->setPort("8100");
  148 + $this->setHost("127.0.0.1");
  149 + $this->setLog("openoffice.log");
  150 + $this->setWinservice("winserv.exe");
  151 + $this->setOption();
  152 + }
  153 +
  154 + private function setPort($port = "8100") {
  155 + $this->port = $port;
  156 + }
  157 +
  158 + public function getPort() {
  159 + return $this->port;
  160 + }
  161 +
  162 + private function setHost($host = "127.0.0.1") {
  163 + $this->host = $host;
  164 + }
  165 +
  166 + public function getHost() {
  167 + return $this->host;
  168 + }
  169 +
  170 + private function setLog($log = "openoffice.log") {
  171 + $this->log = $log;
  172 + }
  173 +
  174 + public function getLog() {
  175 + return $this->log;
  176 + }
  177 +
  178 + private function setBin($bin) {
  179 + $this->bin = "\"".$bin."\"";
  180 + }
  181 +
  182 + public function getBin() {
  183 + return $this->bin;
  184 + }
  185 +
  186 + private function setWinservice($winservice = "winserv.exe") {
  187 + if(file_exists(SYS_BIN_DIR . $winservice))
  188 + $this->winservice = SYS_BIN_DIR . $winservice;
  189 + else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice))
  190 + $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
  191 + }
  192 +
  193 + public function getWinservice() {
  194 + return $this->winservice;
  195 + }
  196 +
  197 + private function setOption() {
  198 + $this->options = "-displayname {$this->name} -start auto {$this->getBin()} -headless -nofirststartwizard "
  199 + . "-accept=\"socket,host={$this->host},port={$this->port};urp;StarOffice.ServiceManager\"";
  200 + }
  201 +
  202 + public function getOption() {
  203 + return $this->options;
  204 + }
  205 +
  206 + public function install() {
  207 + $status = $this->status();
  208 + if($status == '') {
  209 + $services = $this->util->getDataFromSession('services');
  210 + $this->setBin("{$services['openOfficeExe']}");
  211 + $this->setOption();
  212 + $cmd = "\"{$this->winservice}\" install $this->name {$this->getOption()}";
  213 + if(DEBUG) {
  214 + echo "$cmd<br/>";
  215 + return ;
  216 + }
  217 + $response = $this->util->pexec($cmd);
  218 + return $response;
  219 + }
  220 + else {
  221 + return $status;
  222 + }
  223 + }
  224 +
  225 + /**
  226 + * Retrieve Status Service
  227 + *
  228 + * @author KnowledgeTree Team
  229 + * @access public
  230 + * @param none
  231 + * @return string
  232 + */
  233 + public function status() {
  234 + $cmd = "sc query {$this->name}";
  235 + $response = $this->util->pexec($cmd);
  236 + if($response['out']) {
  237 + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
  238 + return $state;
  239 + }
  240 +
  241 + return '';
  242 + }
  243 +}
241 244 ?>
242 245 \ No newline at end of file
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -227,7 +227,7 @@ class windowsScheduler extends windowsService {
227 227 }
228 228  
229 229 private function setWinservice($winservice = "winserv.exe") {
230   - $this->winservice = SYS_BIN_DIR . $winservice;
  230 + $this->winservice = SYS_BIN_DIR . "win32" . DS . $winservice;
231 231 }
232 232  
233 233 private function setOptions() {
... ...
setup/wizard/output/dummy.txt 0 → 100644
setup/wizard/path.php
... ... @@ -40,7 +40,7 @@
40 40 * @version Version 0.1
41 41 */
42 42 // Define installer environment
43   - define('DEBUG', 1);
  43 + define('DEBUG', 0);
44 44 define('AJAX', 0);
45 45 if (substr(php_uname(), 0, 7) == "Windows"){
46 46 define('WINDOWS_OS', true);
... ...
setup/wizard/resources/form.js
... ... @@ -9,5 +9,4 @@ $(document).ready(function() {
9 9 var options = {target: '#content_container', beforeSubmit: w.validateRegistration, success: w.adjustMenu($('form').attr('id'))};
10 10 $('form').ajaxForm(options);
11 11 }
12   -});
13   -
  12 +});
14 13 \ No newline at end of file
... ...
setup/wizard/resources/wizard.css
... ... @@ -82,7 +82,7 @@ select {
82 82 }
83 83  
84 84 #wrapper {
85   - background: white url("graphics/background.gif") repeat-y left;
  85 + /*background: white url("graphics/background.gif") repeat-y left;*/
86 86 }
87 87  
88 88 #container {
... ...
setup/wizard/resources/wizard.js
... ... @@ -215,4 +215,14 @@ wizard.prototype.sendJavaLocation = function () {
215 215  
216 216 wizard.prototype.sendRegistration = function () {
217 217 $('form').submit();
  218 +}
  219 +
  220 +wizard.prototype.clearSessions = function () {
  221 + var address = 'session.php?action=destroyInstall';
  222 + $.ajax({
  223 + url: address,
  224 + dataType: "html",
  225 + type: "POST",
  226 + cache: false,
  227 + });
218 228 }
219 229 \ No newline at end of file
... ...
setup/wizard/session.php
... ... @@ -36,11 +36,12 @@
36 36 * @copyright 2008-2009, KnowledgeTree Inc.
37 37 * @license GNU General Public License version 3
38 38 * @author KnowledgeTree Team
39   -* @package Installer
  39 +* @package Migrater
40 40 * @version Version 0.1
41 41 */
42 42 class Session
43 43 {
  44 + private $salt = 'installers';
44 45 /**
45 46 * Constructs session object
46 47 *
... ... @@ -61,9 +62,9 @@ class Session
61 62 * @return void
62 63 */
63 64 public function startSession() {
64   - if(!isset($_SESSION['ready'])) {
  65 + if(!isset($_SESSION[$this->salt]['ready'])) {
65 66 session_start();
66   - $_SESSION ['ready'] = TRUE;
  67 + $_SESSION[$this->salt] ['ready'] = TRUE;
67 68 }
68 69 }
69 70  
... ... @@ -78,7 +79,7 @@ class Session
78 79 */
79 80 public function set($fld, $val) {
80 81 $this->startSession();
81   - $_SESSION [$fld] = $val;
  82 + $_SESSION[$this->salt] [$fld] = $val;
82 83 }
83 84  
84 85 /**
... ... @@ -99,7 +100,7 @@ class Session
99 100 } else {
100 101 $classArray[$k] = $v;
101 102 }
102   - $_SESSION [ $class] = $classArray;
  103 + $_SESSION[$this->salt] [ $class] = $classArray;
103 104 }
104 105  
105 106 /**
... ... @@ -120,7 +121,7 @@ class Session
120 121 } else {
121 122 $classArray[$k] = $v;
122 123 }
123   - $_SESSION [ $class] = $classArray;
  124 + $_SESSION[$this->salt] [ $class] = $classArray;
124 125 }
125 126  
126 127 /**
... ... @@ -136,7 +137,7 @@ class Session
136 137 public function clearErrors($class) {
137 138 $classArray = $this->get($class);
138 139 unset($classArray['errors']);
139   - $_SESSION [ $class] = $classArray;
  140 + $_SESSION[$this->salt] [ $class] = $classArray;
140 141 }
141 142  
142 143 /**
... ... @@ -149,7 +150,7 @@ class Session
149 150 */
150 151 public function un_set($fld) {
151 152 $this->startSession();
152   - unset($_SESSION [$fld]);
  153 + unset($_SESSION[$this->salt] [$fld]);
153 154 }
154 155  
155 156 /**
... ... @@ -162,8 +163,8 @@ class Session
162 163 */
163 164 public function un_setClass($class) {
164 165 $this->startSession();
165   - if(isset($_SESSION [$class]))
166   - unset($_SESSION [$class]);
  166 + if(isset($_SESSION[$this->salt] [$class]))
  167 + unset($_SESSION[$this->salt] [$class]);
167 168 }
168 169  
169 170 /**
... ... @@ -176,7 +177,7 @@ class Session
176 177 */
177 178 public function destroy() {
178 179 $this->startSession();
179   - unset($_SESSION);
  180 + unset($_SESSION[$this->salt]);
180 181 session_destroy();
181 182 }
182 183  
... ... @@ -190,8 +191,8 @@ class Session
190 191 */
191 192 public function get($fld) {
192 193 $this->startSession();
193   - if(isset($_SESSION [$fld]))
194   - return $_SESSION [$fld];
  194 + if(isset($_SESSION[$this->salt] [$fld]))
  195 + return $_SESSION[$this->salt] [$fld];
195 196 return false;
196 197 }
197 198  
... ... @@ -205,7 +206,7 @@ class Session
205 206 */
206 207 public function is_set($fld) {
207 208 $this->startSession();
208   - return isset($_SESSION [$fld]);
  209 + return isset($_SESSION[$this->salt] [$fld]);
209 210 }
210 211  
211 212 /**
... ... @@ -217,7 +218,21 @@ class Session
217 218 * @return string
218 219 */
219 220 public function getClass($class) {
220   - return $_SESSION[$class];
  221 + return $_SESSION[$this->salt][$class];
  222 + }
  223 +
  224 + public function destroyInstall() {
  225 + $_SESSION[$this->salt] = '';
  226 + $this->destroy();
  227 + }
  228 +}
  229 +
  230 +if(isset($_GET['action'])) {
  231 + $func = $_GET['action'];
  232 + if($func != '') {
  233 + $ses = new Session();
  234 + $method = "$func";
  235 + $ses->$method();
221 236 }
222 237 }
223 238 ?>
224 239 \ No newline at end of file
... ...
setup/wizard/step.php
... ... @@ -105,6 +105,8 @@ class Step
105 105 protected $silent = false;
106 106  
107 107 public $displayFirst = false;
  108 +
  109 + private $salt = 'installers';
108 110 /**
109 111 * Returns step state
110 112 *
... ... @@ -286,10 +288,10 @@ class Step
286 288 * @return boolean
287 289 */
288 290 public function setDataFromSession($class) {
289   - if(empty($_SESSION[$class])) {
  291 + if(empty($_SESSION[$this->salt][$class])) {
290 292 return false;
291 293 }
292   - $_POST = $_SESSION[$class];
  294 + $_POST = $_SESSION[$this->salt][$class];
293 295  
294 296 return true;
295 297 }
... ... @@ -303,11 +305,11 @@ class Step
303 305 * @return boolean
304 306 */
305 307 public function getDataFromSession($class) {
306   - if(empty($_SESSION[$class])) {
  308 + if(empty($_SESSION[$this->salt][$class])) {
307 309 return false;
308 310 }
309 311  
310   - return $_SESSION[$class];
  312 + return $_SESSION[$this->salt][$class];
311 313 }
312 314  
313 315 /**
... ...
setup/wizard/steps/database.php
... ... @@ -240,6 +240,8 @@ class database extends Step
240 240 */
241 241 protected $silent = true;
242 242  
  243 + private $salt = 'installers';
  244 +
243 245 /**
244 246 * Constructs database object
245 247 *
... ... @@ -389,8 +391,8 @@ class database extends Step
389 391 * @return boolean
390 392 */
391 393 private function setErrorsFromSession() {
392   - if(isset($_SESSION['database']['errors'])) {
393   - $this->error[] = $_SESSION['database']['errors'];
  394 + if(isset($_SESSION[$this->salt]['database']['errors'])) {
  395 + $this->error[] = $_SESSION[$this->salt]['database']['errors'];
394 396  
395 397 return true;
396 398 }
... ...
setup/wizard/steps/registration.php
... ... @@ -137,7 +137,7 @@ class registration extends Step
137 137 return true;
138 138 }
139 139 $this->setInSession();
140   - return true;
  140 +// return true;
141 141 //$this->postForm($_POST);
142 142 //$this->sendToHost($_POST);
143 143  
... ...
setup/wizard/steps/services.php
1   -<?php
2   -/**
3   -* Services Step Controller.
4   -*
5   -* KnowledgeTree Community Edition
6   -* Document Management Made Simple
7   -* Copyright(C) 2008,2009 KnowledgeTree Inc.
8   -* Portions copyright The Jam Warehouse Software(Pty) Limited
9   -*
10   -* This program is free software; you can redistribute it and/or modify it under
11   -* the terms of the GNU General Public License version 3 as published by the
12   -* Free Software Foundation.
13   -*
14   -* This program is distributed in the hope that it will be useful, but WITHOUT
15   -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   -* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   -* details.
18   -*
19   -* You should have received a copy of the GNU General Public License
20   -* along with this program. If not, see <http://www.gnu.org/licenses/>.
21   -*
22   -* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   -* California 94120-7775, or email info@knowledgetree.com.
24   -*
25   -* The interactive user interfaces in modified source and object code versions
26   -* of this program must display Appropriate Legal Notices, as required under
27   -* Section 5 of the GNU General Public License version 3.
28   -*
29   -* In accordance with Section 7(b) of the GNU General Public License version 3,
30   -* these Appropriate Legal Notices must retain the display of the "Powered by
31   -* KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   -* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   -* must display the words "Powered by KnowledgeTree" and retain the original
34   -* copyright notice.
35   -*
36   -* @copyright 2008-2009, KnowledgeTree Inc.
37   -* @license GNU General Public License version 3
38   -* @author KnowledgeTree Team
39   -* @package Installer
40   -* @version Version 0.1
41   -*/
42   -
43   -if(isset($_GET['action'])) {
44   - $func = $_GET['action'];
45   - if($func != '') {
46   - require_once("../step.php");
47   - require_once("../installUtil.php");
48   - require_once("../path.php");
49   - }
50   -}
51   -
52   -class services extends Step
53   -{
54   - /**
55   - * List of errors encountered
56   - *
57   - * @author KnowledgeTree Team
58   - * @access protected
59   - * @var array
60   - */
61   - protected $error = array();
62   -
63   - /**
64   - * Flag if step needs to be installed
65   - *
66   - * @author KnowledgeTree Team
67   - * @access protected
68   - * @var array
69   - */
70   - protected $runInstall = true;
71   -
72   - /**
73   - * List of services to be installed
74   - *
75   - * @author KnowledgeTree Team
76   - * @access private
77   - * @var array
78   - */
79   - private $services = array('Lucene', 'Scheduler', 'OpenOffice');
80   -
81   - /**
82   - * Path to php executable
83   - *
84   - * @author KnowledgeTree Team
85   - * @access protected
86   - * @var string
87   - */
88   - protected $php;
89   -
90   - /**
91   - * Flag if php already provided
92   - *
93   - * @author KnowledgeTree Team
94   - * @access private
95   - * @var mixed
96   - */
97   - public $providedPhp = false;
98   -
99   - /**
100   - * PHP Installed
101   - *
102   - * @author KnowledgeTree Team
103   - * @access private
104   - * @var mixed
105   - */
106   - private $phpCheck = 'cross_orange';
107   -
108   - /**
109   - * Flag, if php is specified and an error has been encountered
110   - *
111   - * @author KnowledgeTree Team
112   - * @access public
113   - * @var boolean
114   - */
115   - private $phpExeError = false;
116   -
117   - /**
118   - * Holds path error, if php is specified
119   - *
120   - * @author KnowledgeTree Team
121   - * @access public
122   - * @var string
123   - */
124   - private $phpExeMessage = '';
125   -
126   - /**
127   - * Path to open office executable
128   - *
129   - * @author KnowledgeTree Team
130   - * @access protected
131   - * @var string
132   - */
133   - protected $soffice;
134   -
135   - /**
136   - * Flag if open office already provided
137   - *
138   - * @author KnowledgeTree Team
139   - * @access private
140   - * @var mixed
141   - */
142   - public $providedOpenOffice = false;
143   -
144   - /**
145   - * Flag, if open office is specified and an error has been encountered
146   - *
147   - * @author KnowledgeTree Team
148   - * @access public
149   - * @var boolean
150   - */
151   - private $openOfficeExeError = false;
152   -
153   - /**
154   - * Holds path error, if open office is specified
155   - *
156   - * @author KnowledgeTree Team
157   - * @access public
158   - * @var string
159   - */
160   - private $openOfficeExeMessage = '';
161   -
162   - /**
163   - * Path to java executable
164   - *
165   - * @author KnowledgeTree Team
166   - * @access protected
167   - * @var string
168   - */
169   - protected $java = "";
170   -
171   - /**
172   - * Minumum Java Version
173   - *
174   - * @author KnowledgeTree Team
175   - * @access protected
176   - * @var string
177   - */
178   - private $javaVersion = '1.5';
179   -
180   - /**
181   - * Java Installed
182   - *
183   - * @author KnowledgeTree Team
184   - * @access private
185   - * @var mixed
186   - */
187   - private $javaCheck = 'cross';
188   -
189   - /**
190   - * Open Office Installed
191   - *
192   - * @author KnowledgeTree Team
193   - * @access private
194   - * @var mixed
195   - */
196   - private $openOfficeCheck = 'cross';
197   -
198   - /**
199   - * Flag if java already provided
200   - *
201   - * @author KnowledgeTree Team
202   - * @access private
203   - * @var mixed
204   - */
205   - public $providedJava = false;
206   -
207   - /**
208   - * Java Bridge Installed
209   - *
210   - * @author KnowledgeTree Team
211   - * @access private
212   - * @var mixed
213   - */
214   - private $javaExtCheck = 'cross_orange';
215   -
216   - /**
217   - * Flag if bridge extension needs to be disabled
218   - *
219   - * @author KnowledgeTree Team
220   - * @access public
221   - * @var boolean
222   - */
223   - private $disableExtension = false;
224   -
225   - /**
226   - * Flag, if java is specified and an error has been encountered
227   - *
228   - * @author KnowledgeTree Team
229   - * @access public
230   - * @var booelean
231   - */
232   - private $javaExeError = false;
233   -
234   - /**
235   - * Holds path error, if java is specified
236   - *
237   - * @author KnowledgeTree Team
238   - * @access public
239   - * @var string
240   - */
241   - private $javaExeMessage = '';
242   -
243   - /**
244   - * Flag if services are already Installed
245   - *
246   - * @author KnowledgeTree Team
247   - * @access private
248   - * @var mixed
249   - */
250   - private $alreadyInstalled = false;
251   -
252   - /**
253   - * Flag if services are already Installed
254   - *
255   - * @author KnowledgeTree Team
256   - * @access private
257   - * @var mixed
258   - */
259   - private $luceneInstalled = false;
260   -
261   - /**
262   - * Flag if services are already Installed
263   - *
264   - * @author KnowledgeTree Team
265   - * @access private
266   - * @var mixed
267   - */
268   - private $schedulerInstalled = false;
269   -
270   - /**
271   - * Path to php executable
272   - *
273   - * @author KnowledgeTree Team
274   - * @access protected
275   - * @var string
276   - */
277   - private $openOfficeInstalled;
278   -
279   - /**
280   - * Service Installed
281   - *
282   - * @author KnowledgeTree Team
283   - * @access private
284   - * @var array
285   - */
286   - private $serviceCheck = 'tick';
287   -
288   - /**
289   - * Flag to store class information in session
290   - *
291   - * @author KnowledgeTree Team
292   - * @access public
293   - * @var boolean
294   - */
295   - protected $storeInSession = true;
296   -
297   - /**
298   - * List of variables to be loaded to template
299   - *
300   - * @author KnowledgeTree Team
301   - * @access public
302   - * @var array
303   - */
304   - protected $temp_variables;
305   -
306   - /**
307   - * Flag if step needs to run silently
308   - *
309   - * @author KnowledgeTree Team
310   - * @access public
311   - * @var array
312   - */
313   - protected $silent = true;
314   -
315   - /**
316   - * Reference to utility object
317   - *
318   - * @author KnowledgeTree Team
319   - * @access protected
320   - * @var string
321   - */
322   - protected $util;
323   -
324   - /**
325   - * Constructs services object
326   - *
327   - * @author KnowledgeTree Team
328   - * @access public
329   - * @param none
330   - */
331   - public function __construct() {
332   - $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
333   - $this->util = new InstallUtil();
334   - }
335   -
336   - /**
337   - * Main control of services setup
338   - *
339   - * @author KnowledgeTree Team
340   - * @param none
341   - * @access public
342   - * @return string
343   - */
344   - public function doStep()
345   - {
346   - if(!$this->inStep("services")) {
347   - $this->doRun();
348   - return 'landing';
349   - }
350   - if($this->next()) {
351   - // Check dependencies
352   - $passed = $this->doRun();
353   - $serv = $this->getDataFromSession("services");
354   - if($passed || $serv['providedJava'])
355   - return 'next';
356   - else
357   - return 'error';
358   - } else if($this->previous()) {
359   - return 'previous';
360   - }
361   - $passed = $this->doRun();
362   - return 'landing';
363   - }
364   -
365   - /**
366   - * Get service names
367   - *
368   - * @author KnowledgeTree Team
369   - * @param none
370   - * @access public
371   - * @return array
372   - */
373   - public function getServices() {
374   - return $this->services;
375   - }
376   -
377   - /**
378   - * Check if java executable was found
379   - *
380   - * @author KnowledgeTree Team
381   - * @param none
382   - * @access private
383   - * @return array
384   - */
385   - private function setJava() {
386   - if($this->java != '') { // Java JRE Found
387   - $this->javaCheck = 'tick';
388   - $this->javaInstalled();
389   - $this->temp_variables['java']['location'] = $this->java;
390   - }
391   - }
392   -
393   - /**
394   - * Run step
395   - *
396   - * @author KnowledgeTree Team
397   - * @param none
398   - * @access private
399   - * @return boolean
400   - */
401   - private function doRun() {
402   - if($this->alreadyInstalled()) {
403   - $this->alreadyInstalled = true;
404   - $this->serviceCheck = 'tick';
405   - } else {
406   - $this->presetJava();
407   - $this->presetOpenOffice();
408   - if(!$this->schedulerInstalled) {
409   - $this->php = $this->util->getPhp(); // Get java, if it exists
410   - $passedPhp = $this->phpChecks(); // Run Java Pre Checks
411   - if ($passedPhp) { // Install Scheduler
412   - $this->installService('Scheduler');
413   - }
414   - } else {
415   - $this->schedulerInstalled();
416   - }
417   - if(!$this->luceneInstalled) {
418   - $this->java = $this->util->getJava(); // Get java, if it exists
419   - $passedJava = $this->javaChecks(); // Run Java Pre Checks
420   - if ($passedJava) { // Install Lucene
421   - $this->installService('Lucene');
422   - }
423   - } else {
424   - $this->luceneInstalled();
425   - }
426   - if(!$this->openOfficeInstalled) {
427   - $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
428   - $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
429   - if ($passedOpenOffice) { //Install OpenOffice
430   -// $this->temp_variables['openOfficeExe'] = $this->soffice;
431   - // TODO : Why, O, why?
432   - $this->openOfficeExeError = false;
433   - $_SESSION['services']['openOfficeExe'] = $this->soffice;
434   - $this->installService('OpenOffice');
435   - }
436   - } else {
437   - $this->openOfficeInstalled();
438   - }
439   - }
440   - $this->checkServiceStatus();
441   - $this->storeSilent(); // Store info needed for silent mode
442   - if(!empty($errors))
443   - return false;
444   - return true;
445   - }
446   -
447   - private function openOfficeInstalled() {
448   -
449   - }
450   -
451   - private function schedulerInstalled() {
452   -
453   - }
454   -
455   - private function luceneInstalled() {
456   - $this->disableExtension = true; // Disable the use of the php bridge extension
457   - $this->javaVersionCorrect();
458   - $this->javaInstalled();
459   - $this->javaCheck = 'tick';
460   - }
461   -
462   - /**
463   - * A final check to see if services are still running,
464   - * incase they switched on and turned off.
465   - *
466   - * @author KnowledgeTree Team
467   - * @param none
468   - * @access private
469   - * @return void
470   - */
471   - private function checkServiceStatus() {
472   - $serverDetails = $this->getServices();
473   - foreach ($serverDetails as $serviceName) {
474   - $className = OS.$serviceName;
475   - $service = new $className();
476   - $service->load();
477   - $status = $this->serviceInstalled($service);
478   - if($status != 'STARTED') {
479   - $msg = $service->getName()." Could not be added as a Service";
480   - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
481   - $this->serviceCheck = 'cross_orange';
482   - $this->warnings[] = $msg;
483   - } else {
484   - if(WINDOWS_OS) {
485   - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
486   - else {
487   - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
488   - }
489   - }
490   - }
491   - }
492   -
493   - /**
494   - * Checks if all services have been started already,
495   - * incase the user lands on service page multiple times
496   - *
497   - * @author KnowledgeTree Team
498   - * @param none
499   - * @access public
500   - * @return boolean
501   - */
502   - public function alreadyInstalled() {
503   - $allInstalled = true;
504   - $serverDetails = $this->getServices();
505   - foreach ($serverDetails as $serviceName) {
506   - $className = OS.$serviceName;
507   - $service = new $className();
508   - $status = $this->serviceInstalled($service);
509   - $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed";
510   - if(!$status) {
511   - $allInstalled = false;
512   - $this->$flag = false;
513   - } else {
514   - $this->$flag = true;
515   - }
516   - }
517   -
518   - return $allInstalled;
519   - }
520   -
521   - private function presetJava() {
522   - $this->zendBridgeNotInstalled(); // Set bridge not installed
523   - $this->javaVersionInCorrect(); // Set version to incorrect
524   - $this->javaNotInstalled(); // Set java to not installed
525   - $this->setJava(); // Check if java has been auto detected
526   - }
527   -
528   - private function presetOpenOffice() {
529   - $this->specifyOpenOffice();
530   - }
531   -
532   - private function setOpenOffice() {
533   -
534   - }
535   - /**
536   - * Do some basic checks to help the user overcome java problems
537   - *
538   - * @author KnowledgeTree Team
539   - * @param none
540   - * @access private
541   - * @return boolean
542   - */
543   - private function javaChecks() {
544   - if($this->util->javaSpecified()) {
545   - $this->disableExtension = true; // Disable the use of the php bridge extension
546   - if($this->detSettings(true)) { // AutoDetect java settings
547   - return true;
548   - } else {
549   - $this->specifyJava(); // Ask for settings
550   - }
551   - } else {
552   - $auto = $this->useBridge(); // Use Bridge to get java settings
553   - if($auto) {
554   - return $auto;
555   - } else {
556   - $auto = $this->useDetected(); // Check if auto detected java works
557   - if($auto) {
558   - $this->disableExtension = true; // Disable the use of the php bridge extension
559   - return $auto;
560   - } else {
561   - $this->specifyJava(); // Ask for settings
562   - }
563   - }
564   - return $auto;
565   - }
566   - }
567   -
568   - private function openOfficeChecks() {
569   - if($this->util->openOfficeSpecified()) {
570   - $this->soffice = $this->util->openOfficeSpecified();
571   -
572   - return true;
573   - } else {
574   - return false;
575   - }
576   - }
577   -
578   - /**
579   - * Attempt detection without logging errors
580   - *
581   - * @author KnowledgeTree Team
582   - * @param none
583   - * @access private
584   - * @return boolean
585   - */
586   - private function useDetected() {
587   - return $this->detSettings();
588   - }
589   -
590   - /**
591   - * Set template view to specify java
592   - *
593   - * @author KnowledgeTree Team
594   - * @param none
595   - * @access private
596   - * @return boolean
597   - */
598   - private function specifyJava() {
599   - $this->javaExeError = true;
600   - }
601   -
602   - /**
603   - * Set template view to specify php
604   - *
605   - * @author KnowledgeTree Team
606   - * @param none
607   - * @access private
608   - * @return boolean
609   - */
610   - private function specifyPhp() {
611   - $this->phpExeError = true;
612   - }
613   -
614   - /**
615   - * Set template view to specify open office
616   - *
617   - * @author KnowledgeTree Team
618   - * @param none
619   - * @access private
620   - * @return boolean
621   - */
622   - private function specifyOpenOffice() {
623   - $this->openOfficeExeError = true;
624   - }
625   -
626   - private function phpChecks() {
627   - // TODO: Better detection
628   - return true;
629   - $this->setPhp();
630   - if($this->util->phpSpecified()) {
631   - return $this->detPhpSettings();
632   - } else {
633   - $this->specifyPhp();// Ask for settings
634   - return false;
635   - }
636   - }
637   -
638   -
639   -
640   - /**
641   - * Attempts to use user input and configure java settings
642   - *
643   - * @author KnowledgeTree Team
644   - * @param none
645   - * @access private
646   - * @return boolean
647   - */
648   - private function detSettings($attempt = false) {
649   - $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
650   - if($javaExecutable == '') {
651   - if($this->java == '') {
652   - return false;
653   - }
654   - $javaExecutable = $this->java;
655   - }
656   - $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!";
657   - $response = $this->util->pexec($cmd);
658   - if(file_exists(OUTPUT_DIR.'outJV')) {
659   - $tmp = file_get_contents(OUTPUT_DIR.'outJV');
660   - preg_match('/"(.*)"/',$tmp, $matches);
661   - if($matches) {
662   - if($matches[1] < $this->javaVersion) { // Check Version of java
663   - $this->javaVersionInCorrect();
664   - $this->javaCheck = 'cross';
665   - $this->error[] = "Requires Java 1.5+ to be installed";
666   -
667   - return false;
668   - } else {
669   - $this->javaVersionCorrect();
670   - $this->javaInstalled();
671   - $this->javaCheck = 'tick';
672   - $this->providedJava = true;
673   -
674   - return true;
675   - }
676   - } else {
677   - $this->javaVersionWarning();
678   - $this->javaCheck = 'cross_orange';
679   - if($attempt) {
680   - $this->javaExeMessage = "Incorrect java path specified";
681   - $this->javaExeError = true;
682   - $this->error[] = "Requires Java 1.5+ to be installed";
683   - }
684   -
685   -
686   - return false;
687   - }
688   - }
689   -
690   - $this->javaVersionInCorrect();
691   - $this->javaCheck = 'cross';
692   - $this->error[] = "Requires Java 1.5+ to be installed";
693   - return false;
694   - }
695   -
696   - function detPhpSettings() {
697   - // TODO: Better php handling
698   - return true;
699   - $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
700   - $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
701   - $response = $this->util->pexec($cmd);
702   - if(file_exists(OUTPUT_DIR.'outPHP')) {
703   - $tmp = file_get_contents(OUTPUT_DIR.'outPHP');
704   - preg_match('/PHP/',$tmp, $matches);
705   - if($matches) {
706   - $this->phpCheck = 'tick';
707   -
708   - return true;
709   - } else {
710   - $this->phpCheck = 'cross_orange';
711   - $this->phpExeError = "PHP : Incorrect path specified";
712   - $this->error[] = "PHP executable required";
713   -
714   - return false;
715   - }
716   - }
717   - }
718   - /**
719   - * Attempts to use bridge and configure java settings
720   - *
721   - * @author KnowledgeTree Team
722   - * @param none
723   - * @access private
724   - * @return boolean
725   - */
726   - private function useBridge() {
727   - $zendBridge = $this->util->zendBridge(); // Find Zend Bridge
728   - if($zendBridge) { // Bridge installed implies java exists
729   - $this->zendBridgeInstalled();
730   - if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
731   - $this->javaExtCheck = 'tick'; // Set bridge to functional
732   - $this->javaInstalled(); // Set java to installed
733   - $javaSystem = new Java('java.lang.System');
734   - $version = $javaSystem->getProperty('java.version');
735   - $ver = substr($version, 0, 3);
736   - if($ver < $this->javaVersion) {
737   - $this->javaVersionInCorrect();
738   - $this->error[] = "Requires Java 1.5+ to be installed";
739   - return false;
740   - } else {
741   - $this->javaVersionCorrect(); // Set version to correct
742   - $this->javaCheck = 'tick';
743   - return true;
744   - }
745   - } else {
746   - $this->javaCheck = 'cross_orange';
747   - $this->javaVersionWarning();
748   - $this->zendBridgeWarning();
749   - $this->warnings[] = "Zend Java Bridge Not Functional";
750   - $this->javaExtCheck = 'cross_orange';
751   - return false;
752   - }
753   - } else {
754   - $this->warnings[] = "Zend Java Bridge Not Found";
755   - return false;
756   - }
757   - }
758   -
759   - /**
760   - * Check if Zend Bridge is functional
761   - *
762   - * @author KnowledgeTree Team
763   - * @param none
764   - * @access public
765   - * @return boolean
766   - */
767   - public function checkZendBridge() {
768   - if($this->util->javaBridge()) { // Check if java bridge is functional
769   - return true;
770   - } else {
771   - return false;
772   - }
773   - }
774   -
775   -
776   - /**
777   - * Installs services
778   - *
779   - * @author KnowledgeTree Team
780   - * @param none
781   - * @access private
782   - * @return boolean
783   - */
784   - private function installServices() {
785   - foreach ($this->getServices() as $serviceName) {
786   - $this->installService($serviceName);
787   - }
788   -
789   - return true;
790   - }
791   -
792   - /**
793   - * Installs services helper
794   - *
795   - * @author KnowledgeTree Team
796   - * @param none
797   - * @access private
798   - * @return boolean
799   - */
800   - private function installService($serviceName) {
801   - $className = OS.$serviceName;
802   - $service = new $className();
803   - $status = $this->serviceHelper($service);
804   - if (!$status) {
805   - $this->serviceCheck = 'cross_orange';
806   - }
807   - }
808   -
809   - /**
810   - * Installs services
811   - *
812   - * @author KnowledgeTree Team
813   - * @param object
814   - * @access private
815   - * @return string
816   - */
817   - private function serviceHelper($service) {
818   - $service->load(); // Load Defaults
819   - $response = $service->install(); // Install service
820   - $statusCheck = OS."ServiceInstalled";
821   - return $this->$statusCheck($service);
822   - }
823   -
824   - /**
825   - * Helper to check if service is installed
826   - *
827   - * @author KnowledgeTree Team
828   - * @param object
829   - * @access public
830   - * @return string
831   - */
832   - public function serviceInstalled($service) {
833   - $statusCheck = OS."ServiceInstalled";
834   - return $this->$statusCheck($service);
835   - }
836   -
837   - /**
838   - * Helper to check if service is started
839   - *
840   - * @author KnowledgeTree Team
841   - * @param object
842   - * @access public
843   - * @return string
844   - */
845   - public function serviceStarted($service) {
846   - $statusCheck = OS."ServiceStarted";
847   - return $this->$statusCheck($service);
848   - }
849   -
850   - /**
851   - * Check if windows service installed
852   - *
853   - * @author KnowledgeTree Team
854   - * @param object
855   - * @access public
856   - * @return boolean
857   - */
858   - public function windowsServiceStarted($service) {
859   - $status = $service->status(); // Check if service has been installed
860   - if($status != 'RUNNING') { // Check service status
861   - return false;
862   - }
863   - return true;
864   - }
865   -
866   - /**
867   - * Check if unix service installed
868   - *
869   - * @author KnowledgeTree Team
870   - * @param object
871   - * @access public
872   - * @return boolean
873   - */
874   - public function unixServiceStarted($service) {
875   - $status = $service->status(); // Check if service has been installed
876   - if($status != 'STARTED') { // Check service status
877   - return false;
878   - }
879   - return true;
880   - }
881   -
882   - /**
883   - * Check if windows service installed
884   - *
885   - * @author KnowledgeTree Team
886   - * @param object
887   - * @access public
888   - * @return boolean
889   - */
890   - public function windowsServiceInstalled($service) {
891   - $status = $service->status(); // Check if service has been installed
892   - if($status == '') { // Check service status
893   - return false;
894   - }
895   - return true;
896   - }
897   -
898   - /**
899   - * Check if unix service installed
900   - *
901   - * @author KnowledgeTree Team
902   - * @param object
903   - * @access public
904   - * @return boolean
905   - */
906   - public function unixServiceInstalled($service) {
907   - $status = $service->status(); // Check if service has been installed
908   - if($status != 'STARTED') { // Check service status
909   - return false;
910   - }
911   - return true;
912   - }
913   -
914   - /**
915   - * Starts all services
916   - *
917   - * @author KnowledgeTree Team
918   - * @param object
919   - * @access public
920   - * @return mixed
921   - */
922   - public function installStep() {
923   - foreach ($this->getServices() as $serviceName) {
924   - $className = OS.$serviceName;
925   - $service = new $className();
926   - $status = $this->serviceStart($service);
927   - }
928   - return true;
929   - }
930   -
931   - /**
932   - * Starts service
933   - *
934   - * @author KnowledgeTree Team
935   - * @param object
936   - * @access private
937   - * @return string
938   - */
939   - private function serviceStart($service) {
940   - if(OS == 'windows') {
941   - $service->load(); // Load Defaults
942   - $service->start(); // Start Service
943   - return $service->status(); // Get service status
944   - }
945   - }
946   -
947   - /**
948   - * Returns services errors
949   - *
950   - * @author KnowledgeTree Team
951   - * @access public
952   - * @params none
953   - * @return array
954   - */
955   - public function getErrors() {
956   - return $this->error;
957   - }
958   -
959   - /**
960   - * Returns services warnings
961   - *
962   - * @author KnowledgeTree Team
963   - * @access public
964   - * @params none
965   - * @return array
966   - */
967   - public function getWarnings() {
968   - return $this->warnings;
969   - }
970   -
971   - /**
972   - * Get the variables to be passed to the template
973   - *
974   - * @author KnowledgeTree Team
975   - * @access public
976   - * @return array
977   - */
978   - public function getStepVars()
979   - {
980   - return $this->temp_variables;
981   - }
982   -
983   - /**
984   - * Store Java state as installed
985   - *
986   - * @author KnowledgeTree Team
987   - * @param none
988   - * @access private
989   - * @return void
990   - */
991   - private function javaInstalled() {
992   - $this->temp_variables['java']['class'] = 'tick';
993   - $this->temp_variables['java']['found'] = "Java Runtime Installed";
994   - }
995   -
996   - /**
997   - * Store Java state as not installed
998   - *
999   - * @author KnowledgeTree Team
1000   - * @param none
1001   - * @access private
1002   - * @return void
1003   - */
1004   - private function javaNotInstalled() {
1005   - $this->temp_variables['java']['class'] = 'cross';
1006   - $this->temp_variables['java']['found'] = "Java runtime environment required";
1007   - }
1008   -
1009   - /**
1010   - * Store Java version state as correct
1011   - *
1012   - * @author KnowledgeTree Team
1013   - * @param none
1014   - * @access private
1015   - * @return void
1016   - */
1017   - private function javaVersionCorrect() {
1018   - $this->temp_variables['version']['class'] = 'tick';
1019   - $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
1020   - }
1021   -
1022   - /**
1023   - * Store Java version state as warning
1024   - * @author KnowledgeTree Team
1025   - * @param none
1026   - * @access private
1027   - * @return void
1028   - */
1029   - private function javaVersionWarning() {
1030   - $this->temp_variables['version']['class'] = 'cross_orange';
1031   - $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
1032   - }
1033   -
1034   - /**
1035   - * Store Java version as state incorrect
1036   - *
1037   - * @author KnowledgeTree Team
1038   - * @param none
1039   - * @access private
1040   - * @return void
1041   - */
1042   - private function javaVersionInCorrect() {
1043   - $this->temp_variables['version']['class'] = 'cross';
1044   - $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
1045   - }
1046   -
1047   - /**
1048   - * Store Zend Bridge state as installed
1049   - *
1050   - * @author KnowledgeTree Team
1051   - * @param none
1052   - * @access private
1053   - * @return void
1054   - */
1055   - private function zendBridgeInstalled() {
1056   - $this->temp_variables['extensions']['class'] = 'tick';
1057   - $this->temp_variables['extensions']['found'] = "Java Bridge Installed";
1058   - }
1059   -
1060   - /**
1061   - * Store Zend Bridge state as not installed
1062   - *
1063   - * @author KnowledgeTree Team
1064   - * @param none
1065   - * @access private
1066   - * @return void
1067   - */
1068   - private function zendBridgeNotInstalled() {
1069   - $this->temp_variables['extensions']['class'] = 'cross_orange';
1070   - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
1071   - }
1072   -
1073   - /**
1074   - * Store Zend Bridge state as warning
1075   - *
1076   - * @author KnowledgeTree Team
1077   - * @param none
1078   - * @access private
1079   - * @return void
1080   - */
1081   - private function zendBridgeWarning() {
1082   - $this->temp_variables['extensions']['class'] = 'cross_orange';
1083   - $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
1084   - }
1085   -
1086   - /**
1087   - * Set all silent mode varibles
1088   - *
1089   - * @author KnowledgeTree Team
1090   - * @param none
1091   - * @access private
1092   - * @return void
1093   - */
1094   - private function storeSilent() {
1095   - // Servics
1096   - $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
1097   - $this->temp_variables['luceneInstalled'] = $this->luceneInstalled;
1098   - $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled;
1099   - $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled;
1100   - // Java
1101   - $this->temp_variables['javaExeError'] = $this->javaExeError;
1102   - $this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
1103   - $this->temp_variables['javaCheck'] = $this->javaCheck;
1104   - $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
1105   - // Open Office
1106   - $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError;
1107   - $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage;
1108   - // TODO : PHP detection
1109   - $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
1110   - $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
1111   - $this->temp_variables['serviceCheck'] = $this->serviceCheck;
1112   - $this->temp_variables['disableExtension'] = $this->disableExtension;
1113   - // TODO: Java checks are gettign intense
1114   - $this->temp_variables['providedJava'] = $this->providedJava;
1115   - }
1116   -
1117   - private function setPhp() {
1118   - if($this->php != '') { // PHP Found
1119   - $this->phpCheck = 'tick';
1120   - } elseif (PHP_DIR != '') { // Use System Defined Settings
1121   - $this->php = PHP_DIR;
1122   - } else {
1123   -
1124   - }
1125   - $this->temp_variables['php']['location'] = $this->php;
1126   - }
1127   -
1128   - public function getPhpDir() {
1129   - return $this->php;
1130   - }
1131   -
1132   - public function doDeleteAll() {
1133   - $serverDetails = $this->getServices();
1134   - foreach ($serverDetails as $serviceName) {
1135   - $className = OS.$serviceName;
1136   - require_once("../lib/services/service.php");
1137   - require_once("../lib/services/".OS."Service.php");
1138   - require_once("../lib/services/$className.php");
1139   - $service = new $className();
1140   - $service->uninstall();
1141   - echo "Delete Service {$service->getName()}<br/>";
1142   - echo "Status of service ".$service->status()."<br/>";
1143   - }
1144   - }
1145   -
1146   - public function doInstallAll() {
1147   - $serverDetails = $this->getServices();
1148   - foreach ($serverDetails as $serviceName) {
1149   - $className = OS.$serviceName;
1150   - require_once("../lib/services/service.php");
1151   - require_once("../lib/services/".OS."Service.php");
1152   - require_once("../lib/services/$className.php");
1153   - $service = new $className();
1154   - $service->load();
1155   - $service->install();
1156   - echo "Install Service {$service->getName()}<br/>";
1157   - echo "Status of service ".$service->status()."<br/>";
1158   - }
1159   - }
1160   -
1161   - public function doStatusAll() {
1162   - $serverDetails = $this->getServices();
1163   - foreach ($serverDetails as $serviceName) {
1164   - $className = OS.$serviceName;
1165   - require_once("../lib/services/service.php");
1166   - require_once("../lib/services/".OS."Service.php");
1167   - require_once("../lib/services/$className.php");
1168   - $service = new $className();
1169   - $service->load();
1170   - echo "{$service->getName()} : Status of service = ".$service->status()."<br/>";
1171   - }
1172   - }
1173   -}
1174   -
1175   -if(isset($_GET['action'])) {
1176   - $func = $_GET['action'];
1177   - if($func != '') {
1178   - $serv = new services();
1179   - $func_call = strtoupper(substr($func,0,1)).substr($func,1);
1180   - $method = "do$func";
1181   - $serv->$method();
1182   - }
1183   -}
1184   -?>
1185 1 \ No newline at end of file
  2 +<?php
  3 +/**
  4 +* Services Step Controller.
  5 +*
  6 +* KnowledgeTree Community Edition
  7 +* Document Management Made Simple
  8 +* Copyright(C) 2008,2009 KnowledgeTree Inc.
  9 +* Portions copyright The Jam Warehouse Software(Pty) Limited
  10 +*
  11 +* This program is free software; you can redistribute it and/or modify it under
  12 +* the terms of the GNU General Public License version 3 as published by the
  13 +* Free Software Foundation.
  14 +*
  15 +* This program is distributed in the hope that it will be useful, but WITHOUT
  16 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 +* details.
  19 +*
  20 +* You should have received a copy of the GNU General Public License
  21 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 +*
  23 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 +* California 94120-7775, or email info@knowledgetree.com.
  25 +*
  26 +* The interactive user interfaces in modified source and object code versions
  27 +* of this program must display Appropriate Legal Notices, as required under
  28 +* Section 5 of the GNU General Public License version 3.
  29 +*
  30 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  31 +* these Appropriate Legal Notices must retain the display of the "Powered by
  32 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 +* must display the words "Powered by KnowledgeTree" and retain the original
  35 +* copyright notice.
  36 +*
  37 +* @copyright 2008-2009, KnowledgeTree Inc.
  38 +* @license GNU General Public License version 3
  39 +* @author KnowledgeTree Team
  40 +* @package Installer
  41 +* @version Version 0.1
  42 +*/
  43 +
  44 +if(isset($_GET['action'])) {
  45 + $func = $_GET['action'];
  46 + if($func != '') {
  47 + require_once("../step.php");
  48 + require_once("../installUtil.php");
  49 + require_once("../path.php");
  50 + }
  51 +}
  52 +
  53 +class services extends Step
  54 +{
  55 + /**
  56 + * List of errors encountered
  57 + *
  58 + * @author KnowledgeTree Team
  59 + * @access protected
  60 + * @var array
  61 + */
  62 + protected $error = array();
  63 +
  64 + /**
  65 + * Flag if step needs to be installed
  66 + *
  67 + * @author KnowledgeTree Team
  68 + * @access protected
  69 + * @var array
  70 + */
  71 + protected $runInstall = true;
  72 +
  73 + /**
  74 + * List of services to be installed
  75 + *
  76 + * @author KnowledgeTree Team
  77 + * @access private
  78 + * @var array
  79 + */
  80 + private $services = array('Lucene', 'Scheduler', 'OpenOffice');
  81 +
  82 + /**
  83 + * Path to php executable
  84 + *
  85 + * @author KnowledgeTree Team
  86 + * @access protected
  87 + * @var string
  88 + */
  89 + protected $php;
  90 +
  91 + /**
  92 + * Flag if php already provided
  93 + *
  94 + * @author KnowledgeTree Team
  95 + * @access private
  96 + * @var mixed
  97 + */
  98 + public $providedPhp = false;
  99 +
  100 + /**
  101 + * PHP Installed
  102 + *
  103 + * @author KnowledgeTree Team
  104 + * @access private
  105 + * @var mixed
  106 + */
  107 + private $phpCheck = 'cross_orange';
  108 +
  109 + /**
  110 + * Flag, if php is specified and an error has been encountered
  111 + *
  112 + * @author KnowledgeTree Team
  113 + * @access public
  114 + * @var boolean
  115 + */
  116 + private $phpExeError = false;
  117 +
  118 + /**
  119 + * Holds path error, if php is specified
  120 + *
  121 + * @author KnowledgeTree Team
  122 + * @access public
  123 + * @var string
  124 + */
  125 + private $phpExeMessage = '';
  126 +
  127 + /**
  128 + * Path to open office executable
  129 + *
  130 + * @author KnowledgeTree Team
  131 + * @access protected
  132 + * @var string
  133 + */
  134 + protected $soffice;
  135 +
  136 + /**
  137 + * Flag if open office already provided
  138 + *
  139 + * @author KnowledgeTree Team
  140 + * @access private
  141 + * @var mixed
  142 + */
  143 + public $providedOpenOffice = false;
  144 +
  145 + /**
  146 + * Flag, if open office is specified and an error has been encountered
  147 + *
  148 + * @author KnowledgeTree Team
  149 + * @access public
  150 + * @var boolean
  151 + */
  152 + private $openOfficeExeError = false;
  153 +
  154 + /**
  155 + * Holds path error, if open office is specified
  156 + *
  157 + * @author KnowledgeTree Team
  158 + * @access public
  159 + * @var string
  160 + */
  161 + private $openOfficeExeMessage = '';
  162 +
  163 + /**
  164 + * Path to java executable
  165 + *
  166 + * @author KnowledgeTree Team
  167 + * @access protected
  168 + * @var string
  169 + */
  170 + protected $java = "";
  171 +
  172 + /**
  173 + * Minumum Java Version
  174 + *
  175 + * @author KnowledgeTree Team
  176 + * @access protected
  177 + * @var string
  178 + */
  179 + private $javaVersion = '1.5';
  180 +
  181 + /**
  182 + * Java Installed
  183 + *
  184 + * @author KnowledgeTree Team
  185 + * @access private
  186 + * @var mixed
  187 + */
  188 + private $javaCheck = 'cross';
  189 +
  190 + /**
  191 + * Open Office Installed
  192 + *
  193 + * @author KnowledgeTree Team
  194 + * @access private
  195 + * @var mixed
  196 + */
  197 + private $openOfficeCheck = 'cross';
  198 +
  199 + /**
  200 + * Flag if java already provided
  201 + *
  202 + * @author KnowledgeTree Team
  203 + * @access private
  204 + * @var mixed
  205 + */
  206 + public $providedJava = false;
  207 +
  208 + /**
  209 + * Java Bridge Installed
  210 + *
  211 + * @author KnowledgeTree Team
  212 + * @access private
  213 + * @var mixed
  214 + */
  215 + private $javaExtCheck = 'cross_orange';
  216 +
  217 + /**
  218 + * Flag if bridge extension needs to be disabled
  219 + *
  220 + * @author KnowledgeTree Team
  221 + * @access public
  222 + * @var boolean
  223 + */
  224 + private $disableExtension = false;
  225 +
  226 + /**
  227 + * Flag, if java is specified and an error has been encountered
  228 + *
  229 + * @author KnowledgeTree Team
  230 + * @access public
  231 + * @var booelean
  232 + */
  233 + private $javaExeError = false;
  234 +
  235 + /**
  236 + * Holds path error, if java is specified
  237 + *
  238 + * @author KnowledgeTree Team
  239 + * @access public
  240 + * @var string
  241 + */
  242 + private $javaExeMessage = '';
  243 +
  244 + /**
  245 + * Flag if services are already Installed
  246 + *
  247 + * @author KnowledgeTree Team
  248 + * @access private
  249 + * @var mixed
  250 + */
  251 + private $alreadyInstalled = false;
  252 +
  253 + /**
  254 + * Flag if services are already Installed
  255 + *
  256 + * @author KnowledgeTree Team
  257 + * @access private
  258 + * @var mixed
  259 + */
  260 + private $luceneInstalled = false;
  261 +
  262 + /**
  263 + * Flag if services are already Installed
  264 + *
  265 + * @author KnowledgeTree Team
  266 + * @access private
  267 + * @var mixed
  268 + */
  269 + private $schedulerInstalled = false;
  270 +
  271 + /**
  272 + * Path to php executable
  273 + *
  274 + * @author KnowledgeTree Team
  275 + * @access protected
  276 + * @var string
  277 + */
  278 + private $openOfficeInstalled;
  279 +
  280 + /**
  281 + * Service Installed
  282 + *
  283 + * @author KnowledgeTree Team
  284 + * @access private
  285 + * @var array
  286 + */
  287 + private $serviceCheck = 'tick';
  288 +
  289 + /**
  290 + * Flag to store class information in session
  291 + *
  292 + * @author KnowledgeTree Team
  293 + * @access public
  294 + * @var boolean
  295 + */
  296 + protected $storeInSession = true;
  297 +
  298 + /**
  299 + * List of variables to be loaded to template
  300 + *
  301 + * @author KnowledgeTree Team
  302 + * @access public
  303 + * @var array
  304 + */
  305 + protected $temp_variables;
  306 +
  307 + /**
  308 + * Flag if step needs to run silently
  309 + *
  310 + * @author KnowledgeTree Team
  311 + * @access public
  312 + * @var array
  313 + */
  314 + protected $silent = true;
  315 +
  316 + /**
  317 + * Reference to utility object
  318 + *
  319 + * @author KnowledgeTree Team
  320 + * @access protected
  321 + * @var string
  322 + */
  323 + protected $util;
  324 + private $salt = 'installers';
  325 +
  326 + /**
  327 + * Constructs services object
  328 + *
  329 + * @author KnowledgeTree Team
  330 + * @access public
  331 + * @param none
  332 + */
  333 + public function __construct() {
  334 + $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
  335 + $this->util = new InstallUtil();
  336 + }
  337 +
  338 + /**
  339 + * Main control of services setup
  340 + *
  341 + * @author KnowledgeTree Team
  342 + * @param none
  343 + * @access public
  344 + * @return string
  345 + */
  346 + public function doStep()
  347 + {
  348 + if(!$this->inStep("services")) {
  349 + $this->doRun();
  350 + return 'landing';
  351 + }
  352 + if($this->next()) {
  353 + // Check dependencies
  354 + $passed = $this->doRun();
  355 + $serv = $this->getDataFromSession("services");
  356 + if($passed || $serv['providedJava'])
  357 + return 'next';
  358 + else
  359 + return 'error';
  360 + } else if($this->previous()) {
  361 + return 'previous';
  362 + }
  363 + $passed = $this->doRun();
  364 + return 'landing';
  365 + }
  366 +
  367 + /**
  368 + * Get service names
  369 + *
  370 + * @author KnowledgeTree Team
  371 + * @param none
  372 + * @access public
  373 + * @return array
  374 + */
  375 + public function getServices() {
  376 + return $this->services;
  377 + }
  378 +
  379 + /**
  380 + * Check if java executable was found
  381 + *
  382 + * @author KnowledgeTree Team
  383 + * @param none
  384 + * @access private
  385 + * @return array
  386 + */
  387 + private function setJava() {
  388 + if($this->java != '') { // Java JRE Found
  389 + $this->javaCheck = 'tick';
  390 + $this->javaInstalled();
  391 + $this->temp_variables['java']['location'] = $this->java;
  392 + return ;
  393 + }
  394 +
  395 + $this->temp_variables['java']['location'] = $this->java;
  396 + }
  397 +
  398 + /**
  399 + * Run step
  400 + *
  401 + * @author KnowledgeTree Team
  402 + * @param none
  403 + * @access private
  404 + * @return boolean
  405 + */
  406 + private function doRun() {
  407 + if($this->alreadyInstalled()) {
  408 + $this->alreadyInstalled = true;
  409 + $this->serviceCheck = 'tick';
  410 + } else {
  411 + $this->presetJava();
  412 + $this->presetOpenOffice();
  413 + if(!$this->schedulerInstalled) {
  414 + if(!WINDOWS_OS) $this->php = $this->util->getPhp(); // Get java, if it exists
  415 + $passedPhp = $this->phpChecks(); // Run Java Pre Checks
  416 + if ($passedPhp) { // Install Scheduler
  417 + $this->installService('Scheduler');
  418 + }
  419 + } else {
  420 + $this->schedulerInstalled();
  421 + }
  422 + if(!$this->luceneInstalled) {
  423 + if(!WINDOWS_OS) $this->java = $this->util->getJava(); // Get java, if it exists
  424 + $passedJava = $this->javaChecks(); // Run Java Pre Checks
  425 + if ($passedJava) { // Install Lucene
  426 + $this->installService('Lucene');
  427 + }
  428 + } else {
  429 + $this->luceneInstalled();
  430 + }
  431 + if(!$this->openOfficeInstalled) {
  432 + if(!WINDOWS_OS) $this->soffice = $this->util->getOpenOffice(); // Get java, if it exists
  433 + $passedOpenOffice = $this->openOfficeChecks(); // Run Java Pre Checks
  434 + if ($passedOpenOffice) { //Install OpenOffice
  435 +// $this->temp_variables['openOfficeExe'] = $this->soffice;
  436 + // TODO : Why, O, why?
  437 + $this->openOfficeExeError = false;
  438 + $_SESSION[$this->salt]['services']['openOfficeExe'] = $this->soffice;
  439 + $this->installService('OpenOffice');
  440 + }
  441 + } else {
  442 + $this->openOfficeInstalled();
  443 + }
  444 + }
  445 + $this->checkServiceStatus();
  446 + $this->storeSilent(); // Store info needed for silent mode
  447 + if(!empty($errors))
  448 + return false;
  449 + return true;
  450 + }
  451 +
  452 + private function openOfficeInstalled() {
  453 + $this->openOfficeExeError = false;
  454 + }
  455 +
  456 + private function schedulerInstalled() {
  457 +
  458 + }
  459 +
  460 + private function luceneInstalled() {
  461 + $this->disableExtension = true; // Disable the use of the php bridge extension
  462 + $this->javaVersionCorrect();
  463 + $this->javaInstalled();
  464 + $this->javaCheck = 'tick';
  465 + }
  466 +
  467 + /**
  468 + * A final check to see if services are still running,
  469 + * incase they switched on and turned off.
  470 + *
  471 + * @author KnowledgeTree Team
  472 + * @param none
  473 + * @access private
  474 + * @return void
  475 + */
  476 + private function checkServiceStatus() {
  477 + $serverDetails = $this->getServices();
  478 + foreach ($serverDetails as $serviceName) {
  479 + $className = OS.$serviceName;
  480 + $service = new $className();
  481 + $service->load();
  482 + $status = $this->serviceInstalled($service);
  483 + if($status != 'STARTED') {
  484 + $msg = $service->getName()." Could not be added as a Service";
  485 + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$msg);
  486 + $this->serviceCheck = 'cross_orange';
  487 + $this->warnings[] = $msg;
  488 + } else {
  489 + if(WINDOWS_OS) {
  490 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
  491 + else {
  492 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
  493 + }
  494 + }
  495 + }
  496 + }
  497 +
  498 + /**
  499 + * Checks if all services have been started already,
  500 + * incase the user lands on service page multiple times
  501 + *
  502 + * @author KnowledgeTree Team
  503 + * @param none
  504 + * @access public
  505 + * @return boolean
  506 + */
  507 + public function alreadyInstalled() {
  508 + $allInstalled = true;
  509 + $serverDetails = $this->getServices();
  510 + foreach ($serverDetails as $serviceName) {
  511 + $className = OS.$serviceName;
  512 + $service = new $className();
  513 + $status = $this->serviceInstalled($service);
  514 + $flag = strtolower(substr($serviceName,0,1)).substr($serviceName,1)."Installed";
  515 + if(!$status) {
  516 + $allInstalled = false;
  517 + $this->$flag = false;
  518 + } else {
  519 + $this->$flag = true;
  520 + }
  521 + }
  522 +
  523 + return $allInstalled;
  524 + }
  525 +
  526 + private function presetJava() {
  527 + $this->zendBridgeNotInstalled(); // Set bridge not installed
  528 + $this->javaVersionInCorrect(); // Set version to incorrect
  529 + $this->javaNotInstalled(); // Set java to not installed
  530 + $this->setJava(); // Check if java has been auto detected
  531 + }
  532 +
  533 + private function presetOpenOffice() {
  534 + $this->specifyOpenOffice();
  535 + }
  536 +
  537 + private function setOpenOffice() {
  538 +
  539 + }
  540 + /**
  541 + * Do some basic checks to help the user overcome java problems
  542 + *
  543 + * @author KnowledgeTree Team
  544 + * @param none
  545 + * @access private
  546 + * @return boolean
  547 + */
  548 + private function javaChecks() {
  549 + if($this->util->javaSpecified()) {
  550 + $this->disableExtension = true; // Disable the use of the php bridge extension
  551 + if($this->detSettings(true)) { // AutoDetect java settings
  552 + return true;
  553 + } else {
  554 + $this->specifyJava(); // Ask for settings
  555 + }
  556 + } else {
  557 + $auto = $this->useBridge(); // Use Bridge to get java settings
  558 + if($auto) {
  559 + return $auto;
  560 + } else {
  561 + $auto = $this->useDetected(); // Check if auto detected java works
  562 + if($auto) {
  563 + $this->disableExtension = true; // Disable the use of the php bridge extension
  564 + return $auto;
  565 + } else {
  566 + $this->specifyJava(); // Ask for settings
  567 + }
  568 + }
  569 + return $auto;
  570 + }
  571 + }
  572 +
  573 + private function openOfficeChecks() {
  574 + if($this->util->openOfficeSpecified()) {
  575 + $this->soffice = $this->util->openOfficeSpecified();
  576 + if(file_exists($this->soffice))
  577 + return true;
  578 + else
  579 + return false;
  580 + } else {
  581 + return false;
  582 + }
  583 + }
  584 +
  585 + /**
  586 + * Attempt detection without logging errors
  587 + *
  588 + * @author KnowledgeTree Team
  589 + * @param none
  590 + * @access private
  591 + * @return boolean
  592 + */
  593 + private function useDetected() {
  594 + return $this->detSettings();
  595 + }
  596 +
  597 + /**
  598 + * Set template view to specify java
  599 + *
  600 + * @author KnowledgeTree Team
  601 + * @param none
  602 + * @access private
  603 + * @return boolean
  604 + */
  605 + private function specifyJava() {
  606 + $this->javaExeError = true;
  607 + }
  608 +
  609 + /**
  610 + * Set template view to specify php
  611 + *
  612 + * @author KnowledgeTree Team
  613 + * @param none
  614 + * @access private
  615 + * @return boolean
  616 + */
  617 + private function specifyPhp() {
  618 + $this->phpExeError = true;
  619 + }
  620 +
  621 + /**
  622 + * Set template view to specify open office
  623 + *
  624 + * @author KnowledgeTree Team
  625 + * @param none
  626 + * @access private
  627 + * @return boolean
  628 + */
  629 + private function specifyOpenOffice() {
  630 + $this->openOfficeExeError = true;
  631 + }
  632 +
  633 + private function phpChecks() {
  634 + // TODO: Better detection
  635 + return true;
  636 + $this->setPhp();
  637 + if($this->util->phpSpecified()) {
  638 + return $this->detPhpSettings();
  639 + } else {
  640 + $this->specifyPhp();// Ask for settings
  641 + return false;
  642 + }
  643 + }
  644 +
  645 +
  646 +
  647 + /**
  648 + * Attempts to use user input and configure java settings
  649 + *
  650 + * @author KnowledgeTree Team
  651 + * @param none
  652 + * @access private
  653 + * @return boolean
  654 + */
  655 + private function detSettings($attempt = false) {
  656 + $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
  657 + if($javaExecutable == '') {
  658 + if($this->java == '') {
  659 + return false;
  660 + }
  661 + $javaExecutable = $this->java;
  662 + }
  663 + $cmd = "\"$javaExecutable\" -version > output/outJV 2>&1 echo $!";
  664 + $response = $this->util->pexec($cmd);
  665 + if(file_exists(OUTPUT_DIR.'outJV')) {
  666 + $tmp = file_get_contents(OUTPUT_DIR.'outJV');
  667 + preg_match('/"(.*)"/',$tmp, $matches);
  668 + if($matches) {
  669 + if($matches[1] < $this->javaVersion) { // Check Version of java
  670 + $this->javaVersionInCorrect();
  671 + $this->javaCheck = 'cross';
  672 + $this->error[] = "Requires Java 1.5+ to be installed";
  673 +
  674 + return false;
  675 + } else {
  676 + $this->javaVersionCorrect();
  677 + $this->javaInstalled();
  678 + $this->javaCheck = 'tick';
  679 + $this->providedJava = true;
  680 +
  681 + return true;
  682 + }
  683 + } else {
  684 + $this->javaVersionWarning();
  685 + $this->javaCheck = 'cross_orange';
  686 + if($attempt) {
  687 + $this->javaExeMessage = "Incorrect java path specified";
  688 + $this->javaExeError = true;
  689 + $this->error[] = "Requires Java 1.5+ to be installed";
  690 + }
  691 +
  692 +
  693 + return false;
  694 + }
  695 + }
  696 +
  697 + $this->javaVersionInCorrect();
  698 + $this->javaCheck = 'cross';
  699 + $this->error[] = "Requires Java 1.5+ to be installed";
  700 + return false;
  701 + }
  702 +
  703 + function detPhpSettings() {
  704 + // TODO: Better php handling
  705 + return true;
  706 + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
  707 + $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
  708 + $response = $this->util->pexec($cmd);
  709 + if(file_exists(OUTPUT_DIR.'outPHP')) {
  710 + $tmp = file_get_contents(OUTPUT_DIR.'outPHP');
  711 + preg_match('/PHP/',$tmp, $matches);
  712 + if($matches) {
  713 + $this->phpCheck = 'tick';
  714 +
  715 + return true;
  716 + } else {
  717 + $this->phpCheck = 'cross_orange';
  718 + $this->phpExeError = "PHP : Incorrect path specified";
  719 + $this->error[] = "PHP executable required";
  720 +
  721 + return false;
  722 + }
  723 + }
  724 + }
  725 + /**
  726 + * Attempts to use bridge and configure java settings
  727 + *
  728 + * @author KnowledgeTree Team
  729 + * @param none
  730 + * @access private
  731 + * @return boolean
  732 + */
  733 + private function useBridge() {
  734 + $zendBridge = $this->util->zendBridge(); // Find Zend Bridge
  735 + if($zendBridge) { // Bridge installed implies java exists
  736 + $this->zendBridgeInstalled();
  737 + if($this->checkZendBridge()) { // Make sure the Zend Bridge is functional
  738 + $this->javaExtCheck = 'tick'; // Set bridge to functional
  739 + $this->javaInstalled(); // Set java to installed
  740 + $javaSystem = new Java('java.lang.System');
  741 + $version = $javaSystem->getProperty('java.version');
  742 + $ver = substr($version, 0, 3);
  743 + if($ver < $this->javaVersion) {
  744 + $this->javaVersionInCorrect();
  745 + $this->error[] = "Requires Java 1.5+ to be installed";
  746 + return false;
  747 + } else {
  748 + $this->javaVersionCorrect(); // Set version to correct
  749 + $this->javaCheck = 'tick';
  750 + return true;
  751 + }
  752 + } else {
  753 + $this->javaCheck = 'cross_orange';
  754 + $this->javaVersionWarning();
  755 + $this->zendBridgeWarning();
  756 + $this->warnings[] = "Zend Java Bridge Not Functional";
  757 + $this->javaExtCheck = 'cross_orange';
  758 + return false;
  759 + }
  760 + } else {
  761 + $this->warnings[] = "Zend Java Bridge Not Found";
  762 + return false;
  763 + }
  764 + }
  765 +
  766 + /**
  767 + * Check if Zend Bridge is functional
  768 + *
  769 + * @author KnowledgeTree Team
  770 + * @param none
  771 + * @access public
  772 + * @return boolean
  773 + */
  774 + public function checkZendBridge() {
  775 + if($this->util->javaBridge()) { // Check if java bridge is functional
  776 + return true;
  777 + } else {
  778 + return false;
  779 + }
  780 + }
  781 +
  782 +
  783 + /**
  784 + * Installs services
  785 + *
  786 + * @author KnowledgeTree Team
  787 + * @param none
  788 + * @access private
  789 + * @return boolean
  790 + */
  791 + private function installServices() {
  792 + foreach ($this->getServices() as $serviceName) {
  793 + $this->installService($serviceName);
  794 + }
  795 +
  796 + return true;
  797 + }
  798 +
  799 + /**
  800 + * Installs services helper
  801 + *
  802 + * @author KnowledgeTree Team
  803 + * @param none
  804 + * @access private
  805 + * @return boolean
  806 + */
  807 + private function installService($serviceName) {
  808 + $className = OS.$serviceName;
  809 + $service = new $className();
  810 + $status = $this->serviceHelper($service);
  811 + if (!$status) {
  812 + $this->serviceCheck = 'cross_orange';
  813 + }
  814 + }
  815 +
  816 + /**
  817 + * Installs services
  818 + *
  819 + * @author KnowledgeTree Team
  820 + * @param object
  821 + * @access private
  822 + * @return string
  823 + */
  824 + private function serviceHelper($service) {
  825 + $service->load(); // Load Defaults
  826 + $response = $service->install(); // Install service
  827 + $statusCheck = OS."ServiceInstalled";
  828 + return $this->$statusCheck($service);
  829 + }
  830 +
  831 + /**
  832 + * Helper to check if service is installed
  833 + *
  834 + * @author KnowledgeTree Team
  835 + * @param object
  836 + * @access public
  837 + * @return string
  838 + */
  839 + public function serviceInstalled($service) {
  840 + $statusCheck = OS."ServiceInstalled";
  841 + return $this->$statusCheck($service);
  842 + }
  843 +
  844 + /**
  845 + * Helper to check if service is started
  846 + *
  847 + * @author KnowledgeTree Team
  848 + * @param object
  849 + * @access public
  850 + * @return string
  851 + */
  852 + public function serviceStarted($service) {
  853 + $statusCheck = OS."ServiceStarted";
  854 + return $this->$statusCheck($service);
  855 + }
  856 +
  857 + /**
  858 + * Check if windows service installed
  859 + *
  860 + * @author KnowledgeTree Team
  861 + * @param object
  862 + * @access public
  863 + * @return boolean
  864 + */
  865 + public function windowsServiceStarted($service) {
  866 + $status = $service->status(); // Check if service has been installed
  867 + if($status != 'RUNNING') { // Check service status
  868 + return false;
  869 + }
  870 + return true;
  871 + }
  872 +
  873 + /**
  874 + * Check if unix service installed
  875 + *
  876 + * @author KnowledgeTree Team
  877 + * @param object
  878 + * @access public
  879 + * @return boolean
  880 + */
  881 + public function unixServiceStarted($service) {
  882 + $status = $service->status(); // Check if service has been installed
  883 + if($status != 'STARTED') { // Check service status
  884 + return false;
  885 + }
  886 + return true;
  887 + }
  888 +
  889 + /**
  890 + * Check if windows service installed
  891 + *
  892 + * @author KnowledgeTree Team
  893 + * @param object
  894 + * @access public
  895 + * @return boolean
  896 + */
  897 + public function windowsServiceInstalled($service) {
  898 + $status = $service->status(); // Check if service has been installed
  899 + if($status == '') { // Check service status
  900 + return false;
  901 + }
  902 + return true;
  903 + }
  904 +
  905 + /**
  906 + * Check if unix service installed
  907 + *
  908 + * @author KnowledgeTree Team
  909 + * @param object
  910 + * @access public
  911 + * @return boolean
  912 + */
  913 + public function unixServiceInstalled($service) {
  914 + $status = $service->status(); // Check if service has been installed
  915 + if($status != 'STARTED') { // Check service status
  916 + return false;
  917 + }
  918 + return true;
  919 + }
  920 +
  921 + /**
  922 + * Starts all services
  923 + *
  924 + * @author KnowledgeTree Team
  925 + * @param object
  926 + * @access public
  927 + * @return mixed
  928 + */
  929 + public function installStep() {
  930 + foreach ($this->getServices() as $serviceName) {
  931 + $className = OS.$serviceName;
  932 + $service = new $className();
  933 + $status = $this->serviceStart($service);
  934 + }
  935 + return true;
  936 + }
  937 +
  938 + /**
  939 + * Starts service
  940 + *
  941 + * @author KnowledgeTree Team
  942 + * @param object
  943 + * @access private
  944 + * @return string
  945 + */
  946 + private function serviceStart($service) {
  947 + if(OS == 'windows') {
  948 + $service->load(); // Load Defaults
  949 + $service->start(); // Start Service
  950 + return $service->status(); // Get service status
  951 + }
  952 + }
  953 +
  954 + /**
  955 + * Returns services errors
  956 + *
  957 + * @author KnowledgeTree Team
  958 + * @access public
  959 + * @params none
  960 + * @return array
  961 + */
  962 + public function getErrors() {
  963 + return $this->error;
  964 + }
  965 +
  966 + /**
  967 + * Returns services warnings
  968 + *
  969 + * @author KnowledgeTree Team
  970 + * @access public
  971 + * @params none
  972 + * @return array
  973 + */
  974 + public function getWarnings() {
  975 + return $this->warnings;
  976 + }
  977 +
  978 + /**
  979 + * Get the variables to be passed to the template
  980 + *
  981 + * @author KnowledgeTree Team
  982 + * @access public
  983 + * @return array
  984 + */
  985 + public function getStepVars()
  986 + {
  987 + return $this->temp_variables;
  988 + }
  989 +
  990 + /**
  991 + * Store Java state as installed
  992 + *
  993 + * @author KnowledgeTree Team
  994 + * @param none
  995 + * @access private
  996 + * @return void
  997 + */
  998 + private function javaInstalled() {
  999 + $this->temp_variables['java']['class'] = 'tick';
  1000 + $this->temp_variables['java']['found'] = "Java Runtime Installed";
  1001 + }
  1002 +
  1003 + /**
  1004 + * Store Java state as not installed
  1005 + *
  1006 + * @author KnowledgeTree Team
  1007 + * @param none
  1008 + * @access private
  1009 + * @return void
  1010 + */
  1011 + private function javaNotInstalled() {
  1012 + $this->temp_variables['java']['class'] = 'cross';
  1013 + $this->temp_variables['java']['found'] = "Java runtime environment required";
  1014 + }
  1015 +
  1016 + /**
  1017 + * Store Java version state as correct
  1018 + *
  1019 + * @author KnowledgeTree Team
  1020 + * @param none
  1021 + * @access private
  1022 + * @return void
  1023 + */
  1024 + private function javaVersionCorrect() {
  1025 + $this->temp_variables['version']['class'] = 'tick';
  1026 + $this->temp_variables['version']['found'] = "Java Version 1.5+ Installed";
  1027 + }
  1028 +
  1029 + /**
  1030 + * Store Java version state as warning
  1031 + * @author KnowledgeTree Team
  1032 + * @param none
  1033 + * @access private
  1034 + * @return void
  1035 + */
  1036 + private function javaVersionWarning() {
  1037 + $this->temp_variables['version']['class'] = 'cross_orange';
  1038 + $this->temp_variables['version']['found'] = "Java Runtime Version Cannot be detected";
  1039 + }
  1040 +
  1041 + /**
  1042 + * Store Java version as state incorrect
  1043 + *
  1044 + * @author KnowledgeTree Team
  1045 + * @param none
  1046 + * @access private
  1047 + * @return void
  1048 + */
  1049 + private function javaVersionInCorrect() {
  1050 + $this->temp_variables['version']['class'] = 'cross';
  1051 + $this->temp_variables['version']['found'] = "Requires Java 1.5+ to be installed";
  1052 + }
  1053 +
  1054 + /**
  1055 + * Store Zend Bridge state as installed
  1056 + *
  1057 + * @author KnowledgeTree Team
  1058 + * @param none
  1059 + * @access private
  1060 + * @return void
  1061 + */
  1062 + private function zendBridgeInstalled() {
  1063 + $this->temp_variables['extensions']['class'] = 'tick';
  1064 + $this->temp_variables['extensions']['found'] = "Java Bridge Installed";
  1065 + }
  1066 +
  1067 + /**
  1068 + * Store Zend Bridge state as not installed
  1069 + *
  1070 + * @author KnowledgeTree Team
  1071 + * @param none
  1072 + * @access private
  1073 + * @return void
  1074 + */
  1075 + private function zendBridgeNotInstalled() {
  1076 + $this->temp_variables['extensions']['class'] = 'cross_orange';
  1077 + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Installed";
  1078 + }
  1079 +
  1080 + /**
  1081 + * Store Zend Bridge state as warning
  1082 + *
  1083 + * @author KnowledgeTree Team
  1084 + * @param none
  1085 + * @access private
  1086 + * @return void
  1087 + */
  1088 + private function zendBridgeWarning() {
  1089 + $this->temp_variables['extensions']['class'] = 'cross_orange';
  1090 + $this->temp_variables['extensions']['found'] = "Zend Java Bridge Not Functional";
  1091 + }
  1092 +
  1093 + /**
  1094 + * Set all silent mode varibles
  1095 + *
  1096 + * @author KnowledgeTree Team
  1097 + * @param none
  1098 + * @access private
  1099 + * @return void
  1100 + */
  1101 + private function storeSilent() {
  1102 + // Servics
  1103 + $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
  1104 + $this->temp_variables['luceneInstalled'] = $this->luceneInstalled;
  1105 + $this->temp_variables['schedulerInstalled'] = $this->schedulerInstalled;
  1106 + $this->temp_variables['openOfficeInstalled'] = $this->openOfficeInstalled;
  1107 + // Java
  1108 + $this->temp_variables['javaExeError'] = $this->javaExeError;
  1109 + $this->temp_variables['javaExeMessage'] = $this->javaExeMessage;
  1110 + $this->temp_variables['javaCheck'] = $this->javaCheck;
  1111 + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
  1112 + // Open Office
  1113 + $this->temp_variables['openOfficeExeError'] = $this->openOfficeExeError;
  1114 + $this->temp_variables['openOfficeExeMessage'] = $this->openOfficeExeMessage;
  1115 + // TODO : PHP detection
  1116 + $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
  1117 + $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
  1118 + $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  1119 + $this->temp_variables['disableExtension'] = $this->disableExtension;
  1120 + // TODO: Java checks are gettign intense
  1121 + $this->temp_variables['providedJava'] = $this->providedJava;
  1122 + }
  1123 +
  1124 + private function setPhp() {
  1125 + if($this->php != '') { // PHP Found
  1126 + $this->phpCheck = 'tick';
  1127 + } elseif (PHP_DIR != '') { // Use System Defined Settings
  1128 + $this->php = PHP_DIR;
  1129 + } else {
  1130 +
  1131 + }
  1132 + $this->temp_variables['php']['location'] = $this->php;
  1133 + }
  1134 +
  1135 + public function getPhpDir() {
  1136 + return $this->php;
  1137 + }
  1138 +
  1139 + public function doDeleteAll() {
  1140 + $serverDetails = $this->getServices();
  1141 + foreach ($serverDetails as $serviceName) {
  1142 + $className = OS.$serviceName;
  1143 + require_once("../lib/services/service.php");
  1144 + require_once("../lib/services/".OS."Service.php");
  1145 + require_once("../lib/services/$className.php");
  1146 + $service = new $className();
  1147 + $service->uninstall();
  1148 + echo "Delete Service {$service->getName()}<br/>";
  1149 + echo "Status of service ".$service->status()."<br/>";
  1150 + }
  1151 + }
  1152 +
  1153 + public function doInstallAll() {
  1154 + $serverDetails = $this->getServices();
  1155 + foreach ($serverDetails as $serviceName) {
  1156 + $className = OS.$serviceName;
  1157 + require_once("../lib/services/service.php");
  1158 + require_once("../lib/services/".OS."Service.php");
  1159 + require_once("../lib/services/$className.php");
  1160 + $service = new $className();
  1161 + $service->load();
  1162 + $service->install();
  1163 + echo "Install Service {$service->getName()}<br/>";
  1164 + echo "Status of service ".$service->status()."<br/>";
  1165 + }
  1166 + }
  1167 +
  1168 + public function doStatusAll() {
  1169 + $serverDetails = $this->getServices();
  1170 + foreach ($serverDetails as $serviceName) {
  1171 + $className = OS.$serviceName;
  1172 + require_once("../lib/services/service.php");
  1173 + require_once("../lib/services/".OS."Service.php");
  1174 + require_once("../lib/services/$className.php");
  1175 + $service = new $className();
  1176 + $service->load();
  1177 + echo "{$service->getName()} : Status of service = ".$service->status()."<br/>";
  1178 + }
  1179 + }
  1180 +}
  1181 +
  1182 +if(isset($_GET['action'])) {
  1183 + $func = $_GET['action'];
  1184 + if($func != '') {
  1185 + $serv = new services();
  1186 + $func_call = strtoupper(substr($func,0,1)).substr($func,1);
  1187 + $method = "do$func";
  1188 + $serv->$method();
  1189 + }
  1190 +}
  1191 +?>
... ...
setup/wizard/templates/complete.tpl
... ... @@ -13,115 +13,115 @@
13 13 }
14 14 ?>
15 15 <div id="step_content_complete" class="step">
16   -<!-- Paths and Permissions -->
17   - <div>
18   - <h3><?php echo "<span class='{$paths_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Paths and Permissions</h3>
19   - <?php if($silent) { ?>
20   - <div id="option8" class="onclick" onclick="javascript:{w.toggleClass('paths_check', 'option8');}">Show Details</div>
21   - <div class="paths_check" style="display:none">
22   - <?php } ?>
23   - <table>
24   - <tr><?php echo $varDirectory; ?></tr>
25   - <tr><?php echo $documentRoot; ?></tr>
26   - <tr><?php echo $logDirectory; ?></tr>
27   - <tr><?php echo $tmpDirectory; ?></tr>
28   - <tr><?php echo $uploadDirectory; ?></tr>
29   - <tr><?php echo $config; ?></tr>
30   - <tr><?php echo $docLocation; ?></tr>
31   - </table>
32   - <?php if($silent) { ?>
  16 + <!-- Paths and Permissions -->
  17 + <div>
  18 + <h3><?php echo "<span class='{$paths_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Paths and Permissions</h3>
  19 + <?php if($silent) { ?>
  20 + <div id="option8" class="onclick" onclick="javascript:{w.toggleClass('paths_check', 'option8');}">Show Details</div>
  21 + <div class="paths_check" style="display:none">
  22 + <?php } ?>
  23 + <table>
  24 + <tr><?php echo $varDirectory; ?></tr>
  25 + <tr><?php echo $documentRoot; ?></tr>
  26 + <tr><?php echo $logDirectory; ?></tr>
  27 + <tr><?php echo $tmpDirectory; ?></tr>
  28 + <tr><?php echo $uploadDirectory; ?></tr>
  29 + <tr><?php echo $config; ?></tr>
  30 + <tr><?php echo $docLocation; ?></tr>
  31 + </table>
  32 + <?php if($silent) { ?>
  33 + </div>
  34 + <?php } ?>
33 35 </div>
34   - <?php } ?>
35   - </div>
36   - <br/><br/>
37   - <div>
38   -<!-- Database connectivity -->
39   - <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3>
40   - <?php if($silent) { ?>
41   - <div id="option9" class="onclick" onclick="javascript:{w.toggleClass('database_check', 'option9');}">Show Details</div>
42   - <div class="database_check" style="display:none">
43   - <?php } ?>
44   - <table>
45   - <tr><?php echo $dbConnectAdmin; ?></tr>
46   - <tr><?php echo $dbConnectUser; ?></tr>
47   - </table>
48   - <?php if($silent) { ?>
49   - </div>
50   -<!-- Privileges -->
51   - <br/><br/>
52   - <?php } ?>
53   - <h3><?php echo "<span class='{$privileges_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Privileges</h3>
54   - <?php if($silent) { ?>
55   - <div id="option1" class="onclick" onclick="javascript:{w.toggleClass('privileges_check', 'option1');}">Show Details</div>
56   - <div class="privileges_check" style="display:none">
57   - <?php } ?>
58   - <table style="width:265px;">
59   - <tr><?php echo $dbPrivileges; ?></tr>
60   - <tr><?php echo $dbTransaction; ?></tr>
61   - </table>
62   - <?php if($silent) { ?>
  36 + <br/><br/>
  37 + <div>
  38 + <!-- Database connectivity -->
  39 + <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3>
  40 + <?php if($silent) { ?>
  41 + <div id="option9" class="onclick" onclick="javascript:{w.toggleClass('database_check', 'option9');}">Show Details</div>
  42 + <div class="database_check" style="display:none">
  43 + <?php } ?>
  44 + <table>
  45 + <tr><?php echo $dbConnectAdmin; ?></tr>
  46 + <tr><?php echo $dbConnectUser; ?></tr>
  47 + </table>
  48 + <?php if($silent) { ?>
63 49 </div>
64   - <?php } ?>
65   - </div>
66   -<!-- Services -->
67   - <br/><br/>
68   - <div>
69   - <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
70   - <?php if($silent) { ?>
71   - <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('services_check', 'option2');}">Show Details</div>
72   - <div class="services_check" style="display:none">
73   - <?php } ?>
74   - <table style="width:755px;">
75   - <tr>
76   - <td style="width:15px;"> <?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
77   - <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
78   - <?php if ($LuceneStatus != 'tick') { ?>
79   - <td>
80   - <?php if (AJAX) { ?>
81   - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
82   - <?php } else { ?>
83   - <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
84   - <?php } ?>
85   - </td>
86   - <?php } ?>
87   - </tr>
88   - <tr>
89   - <td> <?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
90   - <td> Scheduler Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
91   - <?php if ($SchedulerStatus != 'tick') { ?>
92   - <td>
93   - <?php if (AJAX) { ?>
94   - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
95   - <?php } else { ?>
96   - <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
97   - <?php } ?>
98   - </td>
99   - <?php } ?>
100   - </tr>
101   - <tr>
102   - <td> <?php echo "<span class='{$OpenOfficeStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
103   - <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
104   - <?php if ($OpenOfficeStatus != 'tick') { ?>
105   - <td>
106   - <?php if (AJAX) { ?>
107   - <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
108   - <?php } else { ?>
109   - <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
110   - <?php } ?>
111   - </td>
112   - <?php } ?>
113   - </tr>
114   - </table>
115   - <?php if($silent) { ?>
  50 + <!-- Privileges -->
  51 + <br/><br/>
  52 + <?php } ?>
  53 + <h3><?php echo "<span class='{$privileges_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Privileges</h3>
  54 + <?php if($silent) { ?>
  55 + <div id="option1" class="onclick" onclick="javascript:{w.toggleClass('privileges_check', 'option1');}">Show Details</div>
  56 + <div class="privileges_check" style="display:none">
  57 + <?php } ?>
  58 + <table style="width:265px;">
  59 + <tr><?php echo $dbPrivileges; ?></tr>
  60 + <tr><?php echo $dbTransaction; ?></tr>
  61 + </table>
  62 + <?php if($silent) { ?>
  63 + </div>
  64 + <?php } ?>
  65 + </div>
  66 + <!-- Services -->
  67 + <br/><br/>
  68 + <div>
  69 + <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
  70 + <?php if($silent) { ?>
  71 + <div id="option2" class="onclick" onclick="javascript:{w.toggleClass('services_check', 'option2');}">Show Details</div>
  72 + <div class="services_check" style="display:none">
  73 + <?php } ?>
  74 + <table style="width:755px;">
  75 + <tr>
  76 + <td style="width:15px;"> <?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  77 + <td style="width:640px;"> Lucene Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  78 + <?php if ($LuceneStatus != 'tick') { ?>
  79 + <td>
  80 + <?php if (AJAX) { ?>
  81 + <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
  82 + <?php } else { ?>
  83 + <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
  84 + <?php } ?>
  85 + </td>
  86 + <?php } ?>
  87 + </tr>
  88 + <tr>
  89 + <td> <?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  90 + <td> Scheduler Service <?php if ($LuceneStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  91 + <?php if ($SchedulerStatus != 'tick') { ?>
  92 + <td>
  93 + <?php if (AJAX) { ?>
  94 + <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
  95 + <?php } else { ?>
  96 + <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
  97 + <?php } ?>
  98 + </td>
  99 + <?php } ?>
  100 + </tr>
  101 + <tr>
  102 + <td> <?php echo "<span class='{$OpenOfficeStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?> </td>
  103 + <td> OpenOffice Service <?php if ($OpenOfficeStatus != 'tick') { ?> Could not be started <?php } else { ?> Started <?php } ?></td>
  104 + <?php if ($OpenOfficeStatus != 'tick') { ?>
  105 + <td>
  106 + <?php if (AJAX) { ?>
  107 + <a href="#" class="refresh" onclick="w.refresh('complete')">Refresh</a>
  108 + <?php } else { ?>
  109 + <a href="javascript:this.location.reload();" class="refresh">Refresh</a>
  110 + <?php } ?>
  111 + </td>
  112 + <?php } ?>
  113 + </tr>
  114 + </table>
  115 + <?php if($silent) { ?>
  116 + </div>
  117 + <?php } ?>
116 118 </div>
117   - <?php } ?>
118   - </div>
119 119 </div>
120   - <a href="../../" class="buttons back" style="width:80px;">Goto Login</a>
  120 + <a href="../../" class="buttons back" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
121 121 <?php
122 122 if (INSTALL_TYPE == 'Zend') {
123 123 ?>
124   - <a href="<?php echo "http://".$_SERVER['HTTP_HOST'].":10081/ZendServer/Index"; ?>" class="back" target="_blank">Zend Server Configuration</a>
  124 + <a href="<?php echo "http://".$_SERVER['HTTP_HOST'].":10081/ZendServer/Index"; ?>" class="back" target="_blank" onclick="javascript:{w.clearSessions();}">Zend Server Configuration</a>
125 125 <?php
126 126 }
127 127 ?>
... ...
setup/wizard/templates/configuration.tpl
... ... @@ -118,4 +118,4 @@
118 118 <input type="submit" name="Previous" value="Previous" class="button_previous"/>
119 119 <input type="submit" name="Next" value="Next" class="button_next"/>
120 120 </form>
121   -<?php if (AJAX) { ?> <script type="text/javascript" src="resources/form.js"></script> <?php } ?>
122 121 \ No newline at end of file
  122 +<?php if (AJAX) { ?> <script type="text/javascript" src="resources/form.js"></script> <?php } ?>
... ...
setup/wizard/templates/configuration_confirm.tpl
... ... @@ -94,4 +94,4 @@
94 94 <input type="submit" name="Edit" value="Edit" class="button_previous"/>
95 95 <input type="submit" name="Confirm" value="Confirm" class="button_next"/>
96 96 </form>
97   -<?php if (AJAX) { ?> <script type="text/javascript" src="resources/form.js"></script> <?php } ?>
98 97 \ No newline at end of file
  98 +<?php if (AJAX) { ?> <script type="text/javascript" src="resources/form.js"></script> <?php } ?>
... ...
setup/wizard/templates/registration.tpl
... ... @@ -3,6 +3,7 @@
3 3 <?php } else { ?>
4 4 <form id="registration" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="javascript:{ if(w.validateRegistration()) { w.sendRegistration() };return false;}">
5 5 <?php } ?>
  6 +
6 7 <p class="title">Registering KnowledgeTree</p>
7 8 <?php
8 9 //echo $sel_country;
... ...