Commit c9ab6dcdb85e39440c1f2fef8da0a241dd44c8db

Authored by Paul Barrett
2 parents a1fdda0f 4aa0fc46

Merge branch 'edge' into cmis_checkout

setup/wizard/config/databases.xml
@@ -15,4 +15,8 @@ @@ -15,4 +15,8 @@
15 <dport>3306</dport> 15 <dport>3306</dport>
16 <dname>dms</dname> 16 <dname>dms</dname>
17 <duname>root</duname> 17 <duname>root</duname>
  18 + <dmsadminuser>dmsadminuser</dmsadminuser>
  19 + <dmsaupass>js9281djw</dmsaupass>
  20 + <dmsuser>dmsuser</dmsuser>
  21 + <dmsupass>djw9281js</dmsupass>
18 </database> 22 </database>
setup/wizard/dbUtil.php
@@ -108,7 +108,7 @@ class dbUtil { @@ -108,7 +108,7 @@ class dbUtil {
108 $this->dbhost = $dhost; 108 $this->dbhost = $dhost;
109 $this->dbuname = $duname; 109 $this->dbuname = $duname;
110 $this->dbpassword = $dpassword; 110 $this->dbpassword = $dpassword;
111 - $this->dbconnection = mysql_connect($dhost, $duname, $dpassword); 111 + $this->dbconnection = @mysql_connect($dhost, $duname, $dpassword);
112 if($dbname != '') { 112 if($dbname != '') {
113 $this->setDb($dbname); 113 $this->setDb($dbname);
114 $this->useDb($dbname); 114 $this->useDb($dbname);
@@ -116,7 +116,7 @@ class dbUtil { @@ -116,7 +116,7 @@ class dbUtil {
116 if($this->dbconnection) 116 if($this->dbconnection)
117 return $this->dbconnection; 117 return $this->dbconnection;
118 else { 118 else {
119 - $this->error[] = mysql_error($this->dbconnection); 119 + $this->error[] = @mysql_error($this->dbconnection);
120 return false; 120 return false;
121 } 121 }
122 } 122 }
@@ -128,15 +128,15 @@ class dbUtil { @@ -128,15 +128,15 @@ class dbUtil {
128 * @access public 128 * @access public
129 * @return boolean 129 * @return boolean
130 */ 130 */
131 - public function useDb($dbname) { 131 + public function useDb($dbname = '') {
132 if($dbname != '') { 132 if($dbname != '') {
133 $this->setDb($dbname); 133 $this->setDb($dbname);
134 } 134 }
135 135
136 - if(mysql_select_db($this->dbname, $this->dbconnection)) 136 + if(@mysql_select_db($this->dbname, $this->dbconnection))
137 return true; 137 return true;
138 else { 138 else {
139 - $this->error[] = mysql_error($this->dbconnection); 139 + $this->error[] = @mysql_error($this->dbconnection);
140 return false; 140 return false;
141 } 141 }
142 } 142 }
@@ -153,11 +153,11 @@ class dbUtil { @@ -153,11 +153,11 @@ class dbUtil {
153 * @return object The result of the query. 153 * @return object The result of the query.
154 */ 154 */
155 public function query($query) { 155 public function query($query) {
156 - $result = mysql_query($query, $this->dbconnection); 156 + $result = @mysql_query($query, $this->dbconnection);
157 if($result) { 157 if($result) {
158 return $result; 158 return $result;
159 } else { 159 } else {
160 - $this->error[] = mysql_error($this->dbconnection); 160 + $this->error[] = @mysql_error($this->dbconnection);
161 return false; 161 return false;
162 } 162 }
163 } 163 }
@@ -170,11 +170,11 @@ class dbUtil { @@ -170,11 +170,11 @@ class dbUtil {
170 * @return boolean 170 * @return boolean
171 */ 171 */
172 public function execute($query) { 172 public function execute($query) {
173 - $result = mysql_query($query, $this->dbconnection); 173 + $result = @mysql_query($query, $this->dbconnection);
174 if($result) { 174 if($result) {
175 return true; 175 return true;
176 } else { 176 } else {
177 - $this->error[] = mysql_error($this->dbconnection); 177 + $this->error[] = @mysql_error($this->dbconnection);
178 return false; 178 return false;
179 } 179 }
180 } 180 }
@@ -187,10 +187,10 @@ class dbUtil { @@ -187,10 +187,10 @@ class dbUtil {
187 * @return object An object representing a data row. 187 * @return object An object representing a data row.
188 */ 188 */
189 public function fetchNextObject($result = NULL) { 189 public function fetchNextObject($result = NULL) {
190 - if ($result == NULL || mysql_num_rows($result) < 1) 190 + if ($result == NULL || @mysql_num_rows($result) < 1)
191 return NULL; 191 return NULL;
192 else 192 else
193 - return mysql_fetch_object($result); 193 + return @mysql_fetch_object($result);
194 } 194 }
195 195
196 /** 196 /**
@@ -202,10 +202,10 @@ class dbUtil { @@ -202,10 +202,10 @@ class dbUtil {
202 */ 202 */
203 public function fetchAssoc($result = NULL) { 203 public function fetchAssoc($result = NULL) {
204 $r = array(); 204 $r = array();
205 - if ($result == NULL || mysql_num_rows($result) < 1) 205 + if ($result == NULL || @mysql_num_rows($result) < 1)
206 return NULL; 206 return NULL;
207 else { 207 else {
208 - $row = mysql_fetch_assoc($result); 208 + $row = @mysql_fetch_assoc($result);
209 while ($row) { 209 while ($row) {
210 $r[] = $row; 210 $r[] = $row;
211 } 211 }
@@ -221,7 +221,7 @@ class dbUtil { @@ -221,7 +221,7 @@ class dbUtil {
221 * @return void. 221 * @return void.
222 */ 222 */
223 public function close() { 223 public function close() {
224 - mysql_close($this->dbconnection); 224 + @mysql_close($this->dbconnection);
225 } 225 }
226 226
227 /** 227 /**
setup/wizard/installUtil.php
@@ -373,7 +373,6 @@ class InstallUtil { @@ -373,7 +373,6 @@ class InstallUtil {
373 } 373 }
374 374
375 return 'java'; 375 return 'java';
376 -// return array('response'=>$response, 'java'=>'java');  
377 } 376 }
378 377
379 function tryJava2() { 378 function tryJava2() {
@@ -383,7 +382,6 @@ class InstallUtil { @@ -383,7 +382,6 @@ class InstallUtil {
383 } 382 }
384 383
385 return 'java'; 384 return 'java';
386 -// return array('response'=>$response, 'java'=>'java');  
387 } 385 }
388 386
389 function tryJava3() { 387 function tryJava3() {
@@ -396,7 +394,6 @@ class InstallUtil { @@ -396,7 +394,6 @@ class InstallUtil {
396 $match = preg_match('/bin/', $r); 394 $match = preg_match('/bin/', $r);
397 if($match) { 395 if($match) {
398 return preg_replace('/java:/', '', $r); 396 return preg_replace('/java:/', '', $r);
399 -// return array('response'=>$response, 'java'=>preg_replace('/java:/', '', $r));  
400 } 397 }
401 } 398 }
402 } 399 }
@@ -422,6 +419,26 @@ class InstallUtil { @@ -422,6 +419,26 @@ class InstallUtil {
422 } 419 }
423 420
424 /** 421 /**
  422 + * Check if user entered location of PHP
  423 + *
  424 + * @author KnowledgeTree Team
  425 + * @param none
  426 + * @access private
  427 + * @return mixed
  428 + */
  429 + public function phpSpecified() {
  430 + if(isset($_POST['php'])) {
  431 + if($_POST['php'] != '') {
  432 + return $_POST['php'];
  433 + } else {
  434 + return false;
  435 + }
  436 + } else {
  437 + return false;
  438 + }
  439 + }
  440 +
  441 + /**
425 * Determine the location of JAVA_HOME 442 * Determine the location of JAVA_HOME
426 * 443 *
427 * @author KnowledgeTree Team 444 * @author KnowledgeTree Team
@@ -441,6 +458,32 @@ class InstallUtil { @@ -441,6 +458,32 @@ class InstallUtil {
441 return $response; 458 return $response;
442 } 459 }
443 460
  461 + /**
  462 + * Determine the location of PHP
  463 + *
  464 + * @author KnowledgeTree Team
  465 + * @param none
  466 + * @access private
  467 + * @return mixed
  468 + */
  469 + function getPhp() {
  470 + $cmd = "whereis php";
  471 + $response = $this->pexec($cmd);
  472 + if(is_array($response['out'])) {
  473 + if (isset($response['out'][0])) {
  474 + $broke = explode(' ', $response['out'][0]);
  475 + foreach ($broke as $r) {
  476 + $match = preg_match('/bin/', $r);
  477 + if($match) {
  478 + return preg_replace('/php:/', '', $r);
  479 + }
  480 + }
  481 + }
  482 + }
  483 +
  484 + return '';
  485 + }
  486 +
444 /** 487 /**
445 * Portably execute a command on any of the supported platforms. 488 * Portably execute a command on any of the supported platforms.
446 * 489 *
setup/wizard/installWizard.php
@@ -176,7 +176,7 @@ class InstallWizard { @@ -176,7 +176,7 @@ class InstallWizard {
176 * @return void 176 * @return void
177 */ 177 */
178 private function createInstallFile() { 178 private function createInstallFile() {
179 - touch("install"); 179 + @touch("install");
180 } 180 }
181 181
182 /** 182 /**
@@ -188,7 +188,7 @@ class InstallWizard { @@ -188,7 +188,7 @@ class InstallWizard {
188 * @return void 188 * @return void
189 */ 189 */
190 private function removeInstallFile() { 190 private function removeInstallFile() {
191 - unlink("install"); 191 + @unlink("install");
192 } 192 }
193 193
194 /** 194 /**
setup/wizard/installer.php
@@ -114,6 +114,17 @@ class Installer { @@ -114,6 +114,17 @@ class Installer {
114 protected $stepConfirmation = false; 114 protected $stepConfirmation = false;
115 115
116 /** 116 /**
  117 + * Flag if a step object needs confirmation
  118 + *
  119 + * @author KnowledgeTree Team
  120 + * @access protected
  121 + * @var boolean
  122 + */
  123 + protected $stepDisplayFirst = false;
  124 +
  125 + private $installerAction = '';
  126 +
  127 + /**
117 * Constructs installation object 128 * Constructs installation object
118 * 129 *
119 * @author KnowledgeTree Team 130 * @author KnowledgeTree Team
@@ -273,11 +284,19 @@ class Installer { @@ -273,11 +284,19 @@ class Installer {
273 $this->stepAction->setSteps($this->getSteps()); 284 $this->stepAction->setSteps($this->getSteps());
274 $this->stepAction->setStepNames($this->getStepNames()); 285 $this->stepAction->setStepNames($this->getStepNames());
275 $this->stepAction->setDisplayConfirm($this->stepConfirmation); 286 $this->stepAction->setDisplayConfirm($this->stepConfirmation);
  287 + $this->stepAction->setDisplayFirst($this->stepDisplayFirst());
276 $this->stepAction->loadSession($this->session); 288 $this->stepAction->loadSession($this->session);
277 289
278 return $this->stepAction->doAction(); 290 return $this->stepAction->doAction();
279 } 291 }
280 292
  293 + private function stepDisplayFirst() {
  294 + if($this->installerAction == 'edit')
  295 + return false; //
  296 + $class = $this->stepAction->createStep(); // Get step class
  297 + return $class->displayFirst(); // Check if class needs to display first
  298 + }
  299 +
281 /** 300 /**
282 * Set steps class names in string format 301 * Set steps class names in string format
283 * 302 *
@@ -373,7 +392,7 @@ class Installer { @@ -373,7 +392,7 @@ class Installer {
373 * @return void 392 * @return void
374 */ 393 */
375 private function _completeInstall() { 394 private function _completeInstall() {
376 - touch("install"); 395 + @touch("install");
377 } 396 }
378 397
379 /** 398 /**
@@ -443,20 +462,26 @@ class Installer { @@ -443,20 +462,26 @@ class Installer {
443 private function loadNeeded() { 462 private function loadNeeded() {
444 $this->_readXml(); // Xml steps 463 $this->_readXml(); // Xml steps
445 // Make sure session is cleared 464 // Make sure session is cleared
446 - $this->_resetSessions(); 465 + $this->_resetSessions();
447 $this->_loadFromSessions(); 466 $this->_loadFromSessions();
448 if(isset($_POST['Next'])) { 467 if(isset($_POST['Next'])) {
  468 + $this->installerAction = 'next';
449 $this->response = 'next'; 469 $this->response = 'next';
450 } elseif (isset($_POST['Previous'])) { 470 } elseif (isset($_POST['Previous'])) {
  471 + $this->installerAction = 'previous';
451 $this->response = 'previous'; 472 $this->response = 'previous';
452 } elseif (isset($_POST['Confirm'])) { 473 } elseif (isset($_POST['Confirm'])) {
  474 + $this->installerAction = 'confirm';
453 $this->response = 'next'; 475 $this->response = 'next';
454 } elseif (isset($_POST['Install'])) { 476 } elseif (isset($_POST['Install'])) {
  477 + $this->installerAction = 'install';
455 $this->response = 'next'; 478 $this->response = 'next';
456 } elseif (isset($_POST['Edit'])) { 479 } elseif (isset($_POST['Edit'])) {
  480 + $this->installerAction = 'edit';
457 $this->response = 'next'; 481 $this->response = 'next';
458 } else { 482 } else {
459 $this->response = ''; 483 $this->response = '';
  484 + $this->installerAction = '';
460 } 485 }
461 } 486 }
462 487
@@ -480,7 +505,8 @@ class Installer { @@ -480,7 +505,8 @@ class Installer {
480 $this->_runStepsInstallers(); // Load landing 505 $this->_runStepsInstallers(); // Load landing
481 $this->_proceed(); // Load next window 506 $this->_proceed(); // Load next window
482 } elseif ($res == 'confirm') { 507 } elseif ($res == 'confirm') {
483 - $this->stepConfirmation = true; 508 + if(!$this->stepDisplayFirst())
  509 + $this->stepConfirmation = true;
484 $this->_landing(); 510 $this->_landing();
485 } elseif ($res == 'landing') { 511 } elseif ($res == 'landing') {
486 $this->_landing(); 512 $this->_landing();
setup/wizard/lib/services/unixLucene.php
@@ -42,7 +42,6 @@ @@ -42,7 +42,6 @@
42 42
43 class unixLucene extends unixService { 43 class unixLucene extends unixService {
44 public $util; 44 public $util;
45 - private $phpDir;  
46 private $shutdownScript; 45 private $shutdownScript;
47 private $indexerDir; 46 private $indexerDir;
48 private $lucenePidFile; 47 private $lucenePidFile;
@@ -65,7 +64,6 @@ class unixLucene extends unixService { @@ -65,7 +64,6 @@ class unixLucene extends unixService {
65 $this->setJavaXmx(512); 64 $this->setJavaXmx(512);
66 $this->setLuceneSource("ktlucene.jar"); 65 $this->setLuceneSource("ktlucene.jar");
67 $this->setLuceneSourceLoc("ktlucene.jar"); 66 $this->setLuceneSourceLoc("ktlucene.jar");
68 -// $this->setPhpDir();  
69 $this->setShutdownScript("shutdown.php"); 67 $this->setShutdownScript("shutdown.php");
70 } 68 }
71 69
@@ -85,29 +83,6 @@ class unixLucene extends unixService { @@ -85,29 +83,6 @@ class unixLucene extends unixService {
85 return $this->shutdownScript; 83 return $this->shutdownScript;
86 } 84 }
87 85
88 - private function setPhpDir($phpdir = '') {  
89 - if($phpdir == '') {  
90 - $cmd = "whereis php";  
91 - $response = $this->util->pexec($cmd);  
92 - if(is_array($response['out'])) {  
93 - $broke = explode(' ', $response['out'][0]);  
94 - foreach ($broke as $r) {  
95 - $match = preg_match('/bin/', $r);  
96 - if($match) {  
97 - $this->phpDir = preg_replace('/php:/', '', $r);  
98 - }  
99 - }  
100 - }  
101 - return ;  
102 - } else {  
103 - $this->phpDir = $phpdir;  
104 - }  
105 - }  
106 -  
107 - public function getPhpDir() {  
108 - return $this->phpDir;  
109 - }  
110 -  
111 private function setLucenePidFile($lucenePidFile) { 86 private function setLucenePidFile($lucenePidFile) {
112 $this->lucenePidFile = $lucenePidFile; 87 $this->lucenePidFile = $lucenePidFile;
113 } 88 }
@@ -172,7 +147,12 @@ class unixLucene extends unixService { @@ -172,7 +147,12 @@ class unixLucene extends unixService {
172 } 147 }
173 148
174 public function install() { 149 public function install() {
175 - $this->start(); 150 + $status = $this->status();
  151 + if($status == '') {
  152 + return $this->start();
  153 + } else {
  154 + return $status;
  155 + }
176 } 156 }
177 157
178 public function status() { 158 public function status() {
@@ -187,11 +167,11 @@ class unixLucene extends unixService { @@ -187,11 +167,11 @@ class unixLucene extends unixService {
187 } 167 }
188 } 168 }
189 } else { 169 } else {
190 - return 'STOPPED'; 170 + return '';
191 } 171 }
192 } 172 }
193 173
194 - return 'STOPPED'; 174 + return '';
195 } 175 }
196 176
197 public function uninstall() { 177 public function uninstall() {
setup/wizard/lib/services/unixScheduler.php
@@ -41,7 +41,6 @@ @@ -41,7 +41,6 @@
41 */ 41 */
42 42
43 class unixScheduler extends unixService { 43 class unixScheduler extends unixService {
44 - private $phpDir;  
45 private $schedulerDir; 44 private $schedulerDir;
46 private $schedulerSource; 45 private $schedulerSource;
47 private $schedulerSourceLoc; 46 private $schedulerSourceLoc;
@@ -109,7 +108,12 @@ class unixScheduler extends unixService { @@ -109,7 +108,12 @@ class unixScheduler extends unixService {
109 } 108 }
110 109
111 function install() { 110 function install() {
112 - $this->start(); 111 + $status = $this->status();
  112 + if($status == '') {
  113 + return $this->start();
  114 + } else {
  115 + return $status;
  116 + }
113 } 117 }
114 118
115 function uninstall() { 119 function uninstall() {
@@ -134,7 +138,7 @@ class unixScheduler extends unixService { @@ -134,7 +138,7 @@ class unixScheduler extends unixService {
134 } 138 }
135 } 139 }
136 } else { 140 } else {
137 - return 'STOPPED'; 141 + return '';
138 } 142 }
139 } 143 }
140 144
@@ -162,6 +166,7 @@ class unixScheduler extends unixService { @@ -162,6 +166,7 @@ class unixScheduler extends unixService {
162 return false; 166 return false;
163 } 167 }
164 168
  169 +
165 170
166 } 171 }
167 ?> 172 ?>
168 \ No newline at end of file 173 \ No newline at end of file
setup/wizard/lib/services/unixService.php
@@ -140,5 +140,7 @@ class unixService extends Service { @@ -140,5 +140,7 @@ class unixService extends Service {
140 public function cont() { 140 public function cont() {
141 141
142 } 142 }
  143 +
  144 +
143 } 145 }
144 ?> 146 ?>
145 \ No newline at end of file 147 \ No newline at end of file
setup/wizard/lib/services/windowsScheduler.php
@@ -78,7 +78,8 @@ class windowsScheduler extends windowsService { @@ -78,7 +78,8 @@ class windowsScheduler extends windowsService {
78 function load() { 78 function load() {
79 $this->name = "KTSchedulerTest"; 79 $this->name = "KTSchedulerTest";
80 $this->setSchedulerDIR(SYSTEM_DIR."bin".DS."win32"); 80 $this->setSchedulerDIR(SYSTEM_DIR."bin".DS."win32");
81 - $this->setSchedulerScriptPath("taskrunner_test.bat"); 81 +// $this->setSchedulerScriptPath("taskrunner_test.bat");
  82 + $this->setSchedulerScriptPath("taskrunner.bat");
82 $this->setSchedulerSource("schedulerService.php"); 83 $this->setSchedulerSource("schedulerService.php");
83 } 84 }
84 85
@@ -171,11 +172,15 @@ class windowsScheduler extends windowsService { @@ -171,11 +172,15 @@ class windowsScheduler extends windowsService {
171 public function install() { 172 public function install() {
172 $state = $this->status(); 173 $state = $this->status();
173 if($state == '') { 174 if($state == '') {
174 - $fp = fopen($this->getSchedulerScriptPath(), "w+");  
175 - $content = "@echo off\n";  
176 - $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";  
177 - fwrite($fp, $content);  
178 - fclose($fp); 175 + if(is_readable(SYS_BIN_DIR)) {
  176 + if(!file_exists($this->getSchedulerScriptPath())) {
  177 + $fp = fopen($this->getSchedulerScriptPath(), "w+");
  178 + $content = "@echo off\n";
  179 + $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\"";
  180 + fwrite($fp, $content);
  181 + fclose($fp);
  182 + }
  183 + }
179 $response = win32_create_service(array( 184 $response = win32_create_service(array(
180 'service' => $this->name, 185 'service' => $this->name,
181 'display' => $this->name, 186 'display' => $this->name,
setup/wizard/lib/services/windowsService.php
@@ -69,10 +69,13 @@ class windowsService extends Service { @@ -69,10 +69,13 @@ class windowsService extends Service {
69 * @return array 69 * @return array
70 */ 70 */
71 public function start() { 71 public function start() {
72 - $cmd = "sc start {$this->name}";  
73 - $response = $this->util->pexec($cmd);  
74 -  
75 - return $response; 72 + $status = $this->status();
  73 + if ($status != 'RUNNING') {
  74 + $cmd = "sc start {$this->name}";
  75 + $response = $this->util->pexec($cmd);
  76 + return $response;
  77 + }
  78 + return $status;
76 } 79 }
77 80
78 /** 81 /**
@@ -84,9 +87,13 @@ class windowsService extends Service { @@ -84,9 +87,13 @@ class windowsService extends Service {
84 * @return array 87 * @return array
85 */ 88 */
86 public function stop() { 89 public function stop() {
87 - $cmd = "sc stop {$this->name}";  
88 - $response = $this->util->pexec($cmd);  
89 - return $response; 90 + $status = $this->status();
  91 + if ($status != 'STOPPED') {
  92 + $cmd = "sc stop {$this->name}";
  93 + $response = $this->util->pexec($cmd);
  94 + return $response;
  95 + }
  96 + return $status;
90 } 97 }
91 98
92 public function install() {} 99 public function install() {}
@@ -101,7 +108,7 @@ class windowsService extends Service { @@ -101,7 +108,7 @@ class windowsService extends Service {
101 */ 108 */
102 public function restart() { 109 public function restart() {
103 $response = $this->stop(); 110 $response = $this->stop();
104 - sleep(1); 111 + sleep(10);
105 $this->start(); 112 $this->start();
106 } 113 }
107 114
@@ -114,10 +121,14 @@ class windowsService extends Service { @@ -114,10 +121,14 @@ class windowsService extends Service {
114 * @return array 121 * @return array
115 */ 122 */
116 public function uninstall() { 123 public function uninstall() {
117 - $cmd = "sc delete {$this->name}";  
118 - $response = $this->util->pexec($cmd);  
119 - sleep(1);  
120 - return $response; 124 + $status = $this->status();
  125 + if ($status != '') {
  126 + $cmd = "sc delete {$this->name}";
  127 + $response = $this->util->pexec($cmd);
  128 + sleep(10);
  129 + return $response;
  130 + }
  131 + return $status;
121 } 132 }
122 133
123 /** 134 /**
setup/wizard/path.php
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 } 87 }
88 define('SYSTEM_ROOT', $asys); 88 define('SYSTEM_ROOT', $asys);
89 // Install Type 89 // Install Type
90 - preg_match('/Zend/', $sys, $matches); 90 + preg_match('/Zend/', $sys, $matches); // TODO: Dirty
91 if($matches) { 91 if($matches) {
92 $sysdir = explode(DS, $sys); 92 $sysdir = explode(DS, $sys);
93 array_pop($sysdir); 93 array_pop($sysdir);
@@ -101,12 +101,18 @@ @@ -101,12 +101,18 @@
101 define('INSTALL_TYPE', 'Zend'); 101 define('INSTALL_TYPE', 'Zend');
102 define('PHP_DIR', $zendsys."ZendServer".DS."bin".DS); 102 define('PHP_DIR', $zendsys."ZendServer".DS."bin".DS);
103 } else { 103 } else {
104 - // TODO: Other types 104 + $modules = get_loaded_extensions();
  105 + if(in_array('Zend Monitor', $modules)) { // TODO: Dirty
  106 + define('INSTALL_TYPE', 'Zend');
  107 + define('PHP_DIR', '');
  108 + } else {
  109 + define('INSTALL_TYPE', '');
  110 + define('PHP_DIR', '');
  111 + }
105 } 112 }
106 // Other 113 // Other
107 date_default_timezone_set('Africa/Johannesburg'); 114 date_default_timezone_set('Africa/Johannesburg');
108 - // Mysql bin [Windows]  
109 - if(WINDOWS_OS) { 115 + if(WINDOWS_OS) { // Mysql bin [Windows]
110 $serverPaths = explode(';',$_SERVER['PATH']); 116 $serverPaths = explode(';',$_SERVER['PATH']);
111 foreach ($serverPaths as $apath) { 117 foreach ($serverPaths as $apath) {
112 preg_match('/mysql/i', $apath, $matches); 118 preg_match('/mysql/i', $apath, $matches);
@@ -115,6 +121,8 @@ @@ -115,6 +121,8 @@
115 break; 121 break;
116 } 122 }
117 } 123 }
  124 + } else {
  125 + define('MYSQL_BIN', ''); // Assume its linux and can be executed from command line
118 } 126 }
119 127
120 ?> 128 ?>
setup/wizard/resources/wizard.js
@@ -133,9 +133,9 @@ wizard.prototype.focusElement = function(el) { @@ -133,9 +133,9 @@ wizard.prototype.focusElement = function(el) {
133 } 133 }
134 134
135 // Catch form submit and validate 135 // Catch form submit and validate
136 -wizard.prototype.onSubmitValidate = function() { 136 +wizard.prototype.onSubmitValidate = function(silent) {
137 var response = w.showStep(3, 'n'); 137 var response = w.showStep(3, 'n');
138 - if(response == true) { 138 + if(response == true || silent == true) {
139 document.getElementById('sendAll').name = 'Next'; // Force the next step 139 document.getElementById('sendAll').name = 'Next'; // Force the next step
140 document.getElementById('sendAll').value = 'next'; 140 document.getElementById('sendAll').value = 'next';
141 document.getElementById('dbsettings').submit(); 141 document.getElementById('dbsettings').submit();
setup/wizard/step.php
@@ -104,6 +104,7 @@ class Step @@ -104,6 +104,7 @@ class Step
104 */ 104 */
105 protected $silent = false; 105 protected $silent = false;
106 106
  107 + public $displayFirst = false;
107 /** 108 /**
108 * Returns step state 109 * Returns step state
109 * 110 *
@@ -117,6 +118,9 @@ class Step @@ -117,6 +118,9 @@ class Step
117 return ''; 118 return '';
118 } 119 }
119 120
  121 + public function displayFirst() {
  122 + return $this->displayFirst;
  123 + }
120 124
121 /** 125 /**
122 * Returns step variables 126 * Returns step variables
setup/wizard/stepAction.php
@@ -69,6 +69,15 @@ class stepAction { @@ -69,6 +69,15 @@ class stepAction {
69 protected $displayConfirm = false; 69 protected $displayConfirm = false;
70 70
71 /** 71 /**
  72 + * Returns whether or not to display the confirmation page first
  73 + *
  74 + * @author KnowledgeTree Team
  75 + * @access protected
  76 + * @var boolean
  77 + */
  78 + protected $displayFirst = false;
  79 +
  80 + /**
72 * Reference to session object 81 * Reference to session object
73 * 82 *
74 * @author KnowledgeTree Team 83 * @author KnowledgeTree Team
@@ -122,9 +131,6 @@ class stepAction { @@ -122,9 +131,6 @@ class stepAction {
122 } else { 131 } else {
123 $this->_clearErrors($this->stepName); // Send Errors to session 132 $this->_clearErrors($this->stepName); // Send Errors to session
124 } 133 }
125 -// if($this->action->silentMode()) {  
126 -// return 'silent';  
127 -// }  
128 return $response; 134 return $response;
129 } else { 135 } else {
130 $this->stepName = 'errors'; 136 $this->stepName = 'errors';
@@ -278,6 +284,18 @@ class stepAction { @@ -278,6 +284,18 @@ class stepAction {
278 } 284 }
279 285
280 /** 286 /**
  287 + * Returns whether or not to display the confirmation page first
  288 + *
  289 + * @author KnowledgeTree Team
  290 + * @param none
  291 + * @access public
  292 + * @return boolean
  293 + */
  294 + public function displayFirst() {
  295 + return $this->displayFirst;
  296 + }
  297 +
  298 + /**
281 * Sets confirmation page flag 299 * Sets confirmation page flag
282 * 300 *
283 * @author KnowledgeTree Team 301 * @author KnowledgeTree Team
@@ -290,6 +308,18 @@ class stepAction { @@ -290,6 +308,18 @@ class stepAction {
290 } 308 }
291 309
292 /** 310 /**
  311 + * Sets confirmation page first flag
  312 + *
  313 + * @author KnowledgeTree Team
  314 + * @param boolean
  315 + * @access public
  316 + * @return void
  317 + */
  318 + public function setDisplayFirst($displayFirst) {
  319 + $this->displayFirst = $displayFirst;
  320 + }
  321 +
  322 + /**
293 * Sets session object 323 * Sets session object
294 * 324 *
295 * @author KnowledgeTree Team 325 * @author KnowledgeTree Team
@@ -326,10 +356,15 @@ class stepAction { @@ -326,10 +356,15 @@ class stepAction {
326 $top = $this->getTop(); 356 $top = $this->getTop();
327 $step_errors = $this->action->getErrors(); // Get errors 357 $step_errors = $this->action->getErrors(); // Get errors
328 $step_warnings = $this->action->getWarnings(); // Get warnings 358 $step_warnings = $this->action->getWarnings(); // Get warnings
329 - if($this->displayConfirm()) // Check if theres a confirm step 359 + if($this->displayConfirm()) { // Check if theres a confirm step
330 $template = "templates/{$this->stepName}_confirm.tpl"; 360 $template = "templates/{$this->stepName}_confirm.tpl";
331 - else  
332 - $template = "templates/{$this->stepName}.tpl"; 361 + } else {
  362 + if($this->displayFirst()) {
  363 + $template = "templates/{$this->stepName}_confirm.tpl";
  364 + } else {
  365 + $template = "templates/{$this->stepName}.tpl";
  366 + }
  367 + }
333 $step_tpl = new Template($template); 368 $step_tpl = new Template($template);
334 $step_tpl->set("errors", $step_errors); // Set template errors 369 $step_tpl->set("errors", $step_errors); // Set template errors
335 $step_tpl->set("warnings", $step_warnings); // Set template warnings 370 $step_tpl->set("warnings", $step_warnings); // Set template warnings
setup/wizard/steps/complete.php
@@ -50,10 +50,16 @@ class complete extends Step { @@ -50,10 +50,16 @@ class complete extends Step {
50 * @var object 50 * @var object
51 */ 51 */
52 private $_dbhandler = null; 52 private $_dbhandler = null;
53 -  
54 - private $services_check = 'cross_orange'; 53 +
  54 + /**
  55 + * List of services to check
  56 + *
  57 + * @access private
  58 + * @var array
  59 + */
  60 + private $services_check = 'tick';
55 private $paths_check = 'tick'; 61 private $paths_check = 'tick';
56 - private $privileges_check = 'cross'; 62 + private $privileges_check = 'tick';
57 private $database_check = 'tick'; 63 private $database_check = 'tick';
58 protected $silent = true; 64 protected $silent = true;
59 65
@@ -108,18 +114,15 @@ class complete extends Step { @@ -108,18 +114,15 @@ class complete extends Step {
108 $pathhtml = '<td><div class="%s"></div></td>' 114 $pathhtml = '<td><div class="%s"></div></td>'
109 . '<td>%s</td>' 115 . '<td>%s</td>'
110 . '<td %s>%s</td>'; 116 . '<td %s>%s</td>';
111 -  
112 // check paths are writeable 117 // check paths are writeable
113 if(is_array($paths)) { 118 if(is_array($paths)) {
114 foreach ($paths as $path) 119 foreach ($paths as $path)
115 { 120 {
116 $output = ''; 121 $output = '';
117 $result = $this->util->checkPermission($path['path']); 122 $result = $this->util->checkPermission($path['path']);
118 - $output = sprintf($html, $result['class'],  
119 - $path['path'],  
120 - (($result['class'] == 'tick') ? '' : 'error' ),  
121 - (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));  
122 - 123 + $output = sprintf($pathhtml, $result['class'], $path['path'],
  124 + (($result['class'] == 'tick') ? 'class="green"' : 'class="error"' ),
  125 + (($result['class'] == 'tick') ? 'Writeable' : 'Not Writeable' ));
123 $this->temp_variables[($path['setting'] != '') ? $path['setting'] : 'config'] = $output; 126 $this->temp_variables[($path['setting'] != '') ? $path['setting'] : 'config'] = $output;
124 if($result['class'] != 'tick') { 127 if($result['class'] != 'tick') {
125 $this->paths_check = $result['class']; 128 $this->paths_check = $result['class'];
@@ -129,7 +132,6 @@ class complete extends Step { @@ -129,7 +132,6 @@ class complete extends Step {
129 $docRoot = $path['path']; 132 $docRoot = $path['path'];
130 } 133 }
131 } 134 }
132 -  
133 } 135 }
134 136
135 // check document path internal/external to web root 137 // check document path internal/external to web root
@@ -198,10 +200,12 @@ class complete extends Step { @@ -198,10 +200,12 @@ class complete extends Step {
198 $this->database_check = 'cross'; 200 $this->database_check = 'cross';
199 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'cross', 'class="error"', 'Unable to do a basic database query<br/>Error: ' 201 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'cross', 'class="error"', 'Unable to do a basic database query<br/>Error: '
200 . $this->_dbhandler->getLastError()); 202 . $this->_dbhandler->getLastError());
  203 + $this->privileges_check = 'cross';
201 } 204 }
202 else 205 else
203 { 206 {
204 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'tick', '', 'Basic database query successful'); 207 $this->temp_variables['dbPrivileges'] .= sprintf($html, 'tick', '', 'Basic database query successful');
  208 +
205 } 209 }
206 210
207 // check transaction support 211 // check transaction support
@@ -228,19 +232,15 @@ class complete extends Step { @@ -228,19 +232,15 @@ class complete extends Step {
228 232
229 private function checkServices() 233 private function checkServices()
230 { 234 {
231 -  
232 - // defaults  
233 -// $this->temp_variables['LuceneServiceStatus'] = 'cross';  
234 -// $this->temp_variables['SchedulerServiceStatus'] = 'cross';  
235 $services = new services(); 235 $services = new services();
236 foreach ($services->getServices() as $serviceName) { 236 foreach ($services->getServices() as $serviceName) {
237 $className = OS.$serviceName; 237 $className = OS.$serviceName;
238 $service = new $className(); 238 $service = new $className();
239 $service->load(); 239 $service->load();
240 - if($service->status() != 'RUNNING') {  
241 - $this->temp_variables[$serviceName."ServiceStatus"] = 'tick'; 240 + if($service->status() == 'RUNNING' || $service->status() == 'STARTED') {
  241 + $this->temp_variables[$serviceName."Status"] = 'tick';
242 } else { 242 } else {
243 - $this->temp_variables[$serviceName."ServiceStatus"] = 'cross_orange'; 243 + $this->temp_variables[$serviceName."Status"] = 'cross_orange';
244 $this->services_check = 'cross_orange'; 244 $this->services_check = 'cross_orange';
245 } 245 }
246 } 246 }
setup/wizard/steps/configuration.php
@@ -57,6 +57,7 @@ class configuration extends Step @@ -57,6 +57,7 @@ class configuration extends Step
57 private $ssl_enabled; 57 private $ssl_enabled;
58 private $done; 58 private $done;
59 public $temp_variables = array("step_name"=>"configuration"); 59 public $temp_variables = array("step_name"=>"configuration");
  60 + public $displayFirst = true;
60 /** 61 /**
61 * Flag to store class information in session 62 * Flag to store class information in session
62 * 63 *
@@ -125,6 +126,7 @@ class configuration extends Step @@ -125,6 +126,7 @@ class configuration extends Step
125 $this->doRun(); 126 $this->doRun();
126 return 'landing'; 127 return 'landing';
127 } 128 }
  129 + $this->loadTemplateDefaults();
128 if($this->next()) { 130 if($this->next()) {
129 if($this->doRun()) { 131 if($this->doRun()) {
130 return 'confirm'; 132 return 'confirm';
@@ -134,9 +136,15 @@ class configuration extends Step @@ -134,9 +136,15 @@ class configuration extends Step
134 $this->setDetails(); 136 $this->setDetails();
135 return 'previous'; 137 return 'previous';
136 } else if($this->confirm()) { 138 } else if($this->confirm()) {
137 - return 'next'; 139 + if($this->doRun()) {
  140 + return 'next';
  141 + }
  142 + return 'error';
138 } else if($this->edit()) { 143 } else if($this->edit()) {
139 $this->setDetails(); 144 $this->setDetails();
  145 + if($this->doRun()) {
  146 +
  147 + }
140 return 'landing'; 148 return 'landing';
141 } 149 }
142 150
@@ -144,6 +152,10 @@ class configuration extends Step @@ -144,6 +152,10 @@ class configuration extends Step
144 return 'landing'; 152 return 'landing';
145 } 153 }
146 154
  155 + public function loadTemplateDefaults() {
  156 + $this->temp_variables['paths_perms'] = 'tick';
  157 + }
  158 +
147 /** 159 /**
148 * Execute the step 160 * Execute the step
149 * 161 *
@@ -326,19 +338,22 @@ class configuration extends Step @@ -326,19 +338,22 @@ class configuration extends Step
326 private function getPathInfo($fileSystemRoot) 338 private function getPathInfo($fileSystemRoot)
327 { 339 {
328 $dirs = $this->getDirectories(); 340 $dirs = $this->getDirectories();
329 - $varDirectory = $fileSystemRoot . DIRECTORY_SEPARATOR . 'var';  
330 - $this->temp_variables['paths_perms'] = 'tick'; 341 + $varDirectory = $fileSystemRoot . DS . 'var';
331 foreach ($dirs as $key => $dir){ 342 foreach ($dirs as $key => $dir){
332 $path = (isset($_POST[$dir['setting']])) ? $_POST[$dir['setting']] : $dir['path']; 343 $path = (isset($_POST[$dir['setting']])) ? $_POST[$dir['setting']] : $dir['path'];
333 344
334 while(preg_match('/\$\{([^}]+)\}/', $path, $matches)){ 345 while(preg_match('/\$\{([^}]+)\}/', $path, $matches)){
335 $path = str_replace($matches[0], $$matches[1], $path); 346 $path = str_replace($matches[0], $$matches[1], $path);
336 } 347 }
  348 + if(WINDOWS_OS)
  349 + $path = preg_replace('/\//', '\\',$path);
337 350
338 - $dirs[$key]['path'] = $path; 351 + $dirs[$key]['path'] = $path;
339 $class = $this->util->checkPermission($path, $dir['create']); 352 $class = $this->util->checkPermission($path, $dir['create']);
  353 +
340 if($class['class'] != 'tick') { 354 if($class['class'] != 'tick') {
341 $this->temp_variables['paths_perms'] = $class['class']; 355 $this->temp_variables['paths_perms'] = $class['class'];
  356 + $this->done = false;
342 } 357 }
343 $dirs[$key] = array_merge($dirs[$key], $class); 358 $dirs[$key] = array_merge($dirs[$key], $class);
344 } 359 }
@@ -363,8 +378,9 @@ class configuration extends Step @@ -363,8 +378,9 @@ class configuration extends Step
363 array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => '${varDirectory}/log', 'create' => true), 378 array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => '${varDirectory}/log', 'create' => true),
364 array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => '${varDirectory}/tmp', 'create' => true), 379 array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => '${varDirectory}/tmp', 'create' => true),
365 array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => '${varDirectory}/uploads', 'create' => true), 380 array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => '${varDirectory}/uploads', 'create' => true),
  381 + array('name' => 'Executables Directory', 'setting' => 'binDirectory', 'path' => '${fileSystemRoot}/bin', 'create' => false),
366 array('name' => 'Configuration File', 'setting' => '', 'path' => '${fileSystemRoot}/config/config.ini', 'create' => false), 382 array('name' => 'Configuration File', 'setting' => '', 'path' => '${fileSystemRoot}/config/config.ini', 'create' => false),
367 - ); 383 + );
368 } 384 }
369 } 385 }
370 ?> 386 ?>
371 \ No newline at end of file 387 \ No newline at end of file
setup/wizard/steps/database.php
@@ -214,6 +214,15 @@ class database extends Step @@ -214,6 +214,15 @@ class database extends Step
214 public $error = array(); 214 public $error = array();
215 215
216 /** 216 /**
  217 + * List of errors used in template
  218 + *
  219 + * @author KnowledgeTree Team
  220 + * @access public
  221 + * @var array
  222 + */
  223 + public $templateErrors = array('dmspassword', 'dmsuserpassword', 'con', 'dname', 'dtype', 'duname', 'dpassword');
  224 +
  225 + /**
217 * Flag to store class information in session 226 * Flag to store class information in session
218 * 227 *
219 * @author KnowledgeTree Team 228 * @author KnowledgeTree Team
@@ -232,6 +241,15 @@ class database extends Step @@ -232,6 +241,15 @@ class database extends Step
232 protected $runInstall = true; 241 protected $runInstall = true;
233 242
234 /** 243 /**
  244 + * Flag if step needs to run silently
  245 + *
  246 + * @author KnowledgeTree Team
  247 + * @access public
  248 + * @var array
  249 + */
  250 + protected $silent = true;
  251 +
  252 + /**
235 * Constructs database object 253 * Constructs database object
236 * 254 *
237 * @author KnowledgeTree Team 255 * @author KnowledgeTree Team
@@ -239,6 +257,7 @@ class database extends Step @@ -239,6 +257,7 @@ class database extends Step
239 * @param none 257 * @param none
240 */ 258 */
241 public function __construct() { 259 public function __construct() {
  260 + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent);
242 $this->_dbhandler = new dbUtil(); 261 $this->_dbhandler = new dbUtil();
243 $this->_util = new InstallUtil(); 262 $this->_util = new InstallUtil();
244 if(WINDOWS_OS) 263 if(WINDOWS_OS)
@@ -255,6 +274,7 @@ class database extends Step @@ -255,6 +274,7 @@ class database extends Step
255 */ 274 */
256 public function doStep() { 275 public function doStep() {
257 $this->setErrorsFromSession(); 276 $this->setErrorsFromSession();
  277 + $this->initErrors(); // Load template errors
258 if($this->inStep("database")) { 278 if($this->inStep("database")) {
259 $res = $this->doProcess(); 279 $res = $this->doProcess();
260 if($res) { // If theres a response, return it 280 if($res) { // If theres a response, return it
@@ -262,10 +282,8 @@ class database extends Step @@ -262,10 +282,8 @@ class database extends Step
262 } 282 }
263 } 283 }
264 if($this->setDataFromSession("database")) { // Attempt to set values from session 284 if($this->setDataFromSession("database")) { // Attempt to set values from session
265 -  
266 $this->setDetails(); // Set any posted variables 285 $this->setDetails(); // Set any posted variables
267 } else { 286 } else {
268 -  
269 $this->loadDefaults($this->readXml()); // Load default variables from file 287 $this->loadDefaults($this->readXml()); // Load default variables from file
270 } 288 }
271 289
@@ -311,26 +329,36 @@ class database extends Step @@ -311,26 +329,36 @@ class database extends Step
311 */ 329 */
312 public function doTest() { 330 public function doTest() {
313 if($this->match($this->dmspassword, $this->getPassword1()) != 0) { 331 if($this->match($this->dmspassword, $this->getPassword1()) != 0) {
314 - $this->error[] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1(); 332 + $this->error['dmspassword'] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1();
315 return false; 333 return false;
316 } 334 }
317 if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) { 335 if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) {
318 - $this->error[] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2(); 336 + $this->error['dmsuserpassword'] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2();
319 return false; 337 return false;
320 } 338 }
321 - if($this->dport == '') 339 + if($this->dport == '') {
322 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); 340 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
323 - else 341 + } else {
324 $con = $this->_dbhandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); 342 $con = $this->_dbhandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
  343 + }
325 if (!$con) { 344 if (!$con) {
326 - $this->error[] = "Could not connect"; 345 + $this->error['con'] = "Could not connect, please check username and password";
327 return false; 346 return false;
328 } else { 347 } else {
329 - $this->error = array(); // Reset usage errors  
330 - return true; 348 + if ($this->dbExists()) { // Check if database Exists
  349 + $this->error['dname'] = 'Database Already Exists, please specify a different name'; // Reset usage errors
  350 + return false;
  351 + } else {
  352 + $this->error = array(); // Reset usage errors
  353 + return true;
  354 + }
331 } 355 }
332 } 356 }
333 357
  358 + public function dbExists() {
  359 + return $this->_dbhandler->useDb();
  360 + }
  361 +
334 public function match($str1, $str2) { 362 public function match($str1, $str2) {
335 return strcmp($str1, $str2); 363 return strcmp($str1, $str2);
336 } 364 }
@@ -418,10 +446,10 @@ class database extends Step @@ -418,10 +446,10 @@ class database extends Step
418 $this->temp_variables['dhost'] = (string) $simplexml->dhost; 446 $this->temp_variables['dhost'] = (string) $simplexml->dhost;
419 $this->temp_variables['dport'] = (string) $simplexml->dport; 447 $this->temp_variables['dport'] = (string) $simplexml->dport;
420 $this->temp_variables['dpassword'] = ''; 448 $this->temp_variables['dpassword'] = '';
421 - $this->temp_variables['dmsname'] = '';  
422 - $this->temp_variables['dmsusername'] = '';  
423 - $this->temp_variables['dmspassword'] = '';  
424 - $this->temp_variables['dmsuserpassword'] = ''; 449 + $this->temp_variables['dmsname'] = (string) $simplexml->dmsadminuser;
  450 + $this->temp_variables['dmsusername'] = (string) $simplexml->dmsuser;
  451 + $this->temp_variables['dmspassword'] = (string) $simplexml->dmsaupass;
  452 + $this->temp_variables['dmsuserpassword'] = (string) $simplexml->dmsupass;
425 if(WINDOWS_OS) { 453 if(WINDOWS_OS) {
426 $this->temp_variables['dbbinary'] = 'mysql.exe'; 454 $this->temp_variables['dbbinary'] = 'mysql.exe';
427 } else { 455 } else {
@@ -521,7 +549,7 @@ class database extends Step @@ -521,7 +549,7 @@ class database extends Step
521 */ 549 */
522 private function installDatabase() { 550 private function installDatabase() {
523 if($this->dtype == '') { 551 if($this->dtype == '') {
524 - $this->error[] = 'No database type selected'; 552 + $this->error['dtype'] = 'No database type selected';
525 return 'error'; 553 return 'error';
526 } 554 }
527 if(!$this->{$this->dtype}()) { 555 if(!$this->{$this->dtype}()) {
@@ -541,7 +569,7 @@ class database extends Step @@ -541,7 +569,7 @@ class database extends Step
541 $con = $this->connectMysql(); 569 $con = $this->connectMysql();
542 if($con) { 570 if($con) {
543 if(!$this->createDB($con)) { 571 if(!$this->createDB($con)) {
544 - $this->error[] = "Could not Create Database: "; 572 + $this->error['con'] = "Could not Create Database: ";
545 return false; 573 return false;
546 } 574 }
547 $this->closeMysql($con); 575 $this->closeMysql($con);
@@ -559,7 +587,7 @@ class database extends Step @@ -559,7 +587,7 @@ class database extends Step
559 private function connectMysql() { 587 private function connectMysql() {
560 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); 588 $con = $this->_dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
561 if (!$con) { 589 if (!$con) {
562 - $this->error[] = "Could not connect: "; 590 + $this->error['con'] = "Could not connect: ";
563 591
564 return false; 592 return false;
565 } 593 }
@@ -579,16 +607,16 @@ class database extends Step @@ -579,16 +607,16 @@ class database extends Step
579 if($this->usedb($con)) { // attempt to use the db 607 if($this->usedb($con)) { // attempt to use the db
580 if($this->dropdb($con)) { // attempt to drop the db 608 if($this->dropdb($con)) { // attempt to drop the db
581 if(!$this->create($con)) { // attempt to create the db 609 if(!$this->create($con)) { // attempt to create the db
582 - $this->error[] = "Could create database: "; 610 + $this->error['con'] = "Could not create database: ";
583 return false;// cannot overwrite database 611 return false;// cannot overwrite database
584 } 612 }
585 } else { 613 } else {
586 - $this->error[] = "Could not drop database: "; 614 + $this->error['con'] = "Could not drop database: ";
587 return false;// cannot overwrite database 615 return false;// cannot overwrite database
588 } 616 }
589 } else { 617 } else {
590 if(!$this->create($con)) { // attempt to create the db 618 if(!$this->create($con)) { // attempt to create the db
591 - $this->error[] = "Could not create database: "; 619 + $this->error['con'] = "Could not create database: ";
592 return false;// cannot overwrite database 620 return false;// cannot overwrite database
593 } 621 }
594 } 622 }
@@ -596,13 +624,13 @@ class database extends Step @@ -596,13 +624,13 @@ class database extends Step
596 624
597 } 625 }
598 if(!$this->createSchema($con)) { 626 if(!$this->createSchema($con)) {
599 - $this->error[] = "Could not create schema "; 627 + $this->error['con'] = "Could not create schema ";
600 } 628 }
601 if(!$this->populateSchema($con)) { 629 if(!$this->populateSchema($con)) {
602 - $this->error[] = "Could not populate schema "; 630 + $this->error['con'] = "Could not populate schema ";
603 } 631 }
604 if(!$this->applyUpgrades($con)) { 632 if(!$this->applyUpgrades($con)) {
605 - $this->error[] = "Could not apply updates "; 633 + $this->error['con'] = "Could not apply updates ";
606 } 634 }
607 635
608 return true; 636 return true;
@@ -638,7 +666,7 @@ class database extends Step @@ -638,7 +666,7 @@ class database extends Step
638 if($this->_dbhandler->useDb($this->dname)) { 666 if($this->_dbhandler->useDb($this->dname)) {
639 return true; 667 return true;
640 } else { 668 } else {
641 - $this->error[] = "Error using database: "; 669 + $this->error['con'] = "Error using database: {$this->dname}";
642 return false; 670 return false;
643 } 671 }
644 } 672 }
@@ -655,11 +683,11 @@ class database extends Step @@ -655,11 +683,11 @@ class database extends Step
655 if($this->ddrop) { 683 if($this->ddrop) {
656 $sql = "DROP DATABASE {$this->dname};"; 684 $sql = "DROP DATABASE {$this->dname};";
657 if(!$this->_dbhandler->query($sql)) { 685 if(!$this->_dbhandler->query($sql)) {
658 - $this->error[] = "Cannot drop database: "; 686 + $this->error['con'] = "Cannot drop database: {$this->dname}";
659 return false; 687 return false;
660 } 688 }
661 } else { 689 } else {
662 - $this->error[] = "Cannot drop database: "; 690 + $this->error['con'] = "Cannot drop database: {$this->dname}";
663 return false; 691 return false;
664 } 692 }
665 return true; 693 return true;
@@ -688,7 +716,7 @@ class database extends Step @@ -688,7 +716,7 @@ class database extends Step
688 if ($this->_dbhandler->execute($user1) && $this->_dbhandler->execute($user2)) { 716 if ($this->_dbhandler->execute($user1) && $this->_dbhandler->execute($user2)) {
689 return true; 717 return true;
690 } else { 718 } else {
691 - $this->error[] = "Could not create users in database: "; 719 + $this->error['con'] = "Could not create users for database: {$this->dname}";
692 return false; 720 return false;
693 } 721 }
694 } 722 }
@@ -756,7 +784,7 @@ class database extends Step @@ -756,7 +784,7 @@ class database extends Step
756 try { 784 try {
757 $this->_dbhandler->close(); 785 $this->_dbhandler->close();
758 } catch (Exeption $e) { 786 } catch (Exeption $e) {
759 - $this->error[] = "Could not close: " . $e; 787 + $this->error['con'] = "Could not close: " . $e;
760 } 788 }
761 } 789 }
762 790
@@ -784,5 +812,19 @@ class database extends Step @@ -784,5 +812,19 @@ class database extends Step
784 public function doAjaxTest($host, $uname, $dname) { 812 public function doAjaxTest($host, $uname, $dname) {
785 813
786 } 814 }
  815 +
  816 + /**
  817 + * Initialize errors to false
  818 + *
  819 + * @author KnowledgeTree Team
  820 + * @param none
  821 + * @access private
  822 + * @return boolean
  823 + */
  824 + private function initErrors() {
  825 + foreach ($this->templateErrors as $e) {
  826 + $this->error[$e] = false;
  827 + }
  828 + }
787 } 829 }
788 ?> 830 ?>
789 \ No newline at end of file 831 \ No newline at end of file
setup/wizard/steps/registration.php
@@ -430,7 +430,7 @@ class registration extends Step @@ -430,7 +430,7 @@ class registration extends Step
430 'RO' => 'ROMANIA', 430 'RO' => 'ROMANIA',
431 'RU' => 'RUSSIAN FEDERATION', 431 'RU' => 'RUSSIAN FEDERATION',
432 'RW' => 'RWANDA', 432 'RW' => 'RWANDA',
433 - 'BL' => 'SAINT BARTHฦ’LEMY', 433 + 'BL' => 'SAINT BARTHรฏยฟยฝLEMY',
434 'SH' => 'SAINT HELENA', 434 'SH' => 'SAINT HELENA',
435 'KN' => 'SAINT KITTS AND NEVIS', 435 'KN' => 'SAINT KITTS AND NEVIS',
436 'LC' => 'SAINT LUCIA', 436 'LC' => 'SAINT LUCIA',
setup/wizard/steps/services.php
@@ -80,6 +80,24 @@ class services extends Step @@ -80,6 +80,24 @@ class services extends Step
80 private $javaCheck = 'cross'; 80 private $javaCheck = 'cross';
81 81
82 /** 82 /**
  83 + * Flag if services are already Installed
  84 + *
  85 + * @author KnowledgeTree Team
  86 + * @access private
  87 + * @var mixed
  88 + */
  89 + private $alreadyInstalled = false;
  90 +
  91 + /**
  92 + * PHP Installed
  93 + *
  94 + * @author KnowledgeTree Team
  95 + * @access private
  96 + * @var mixed
  97 + */
  98 + private $phpCheck = 'cross_orange';
  99 +
  100 + /**
83 * Java Bridge Installed 101 * Java Bridge Installed
84 * 102 *
85 * @author KnowledgeTree Team 103 * @author KnowledgeTree Team
@@ -104,7 +122,7 @@ class services extends Step @@ -104,7 +122,7 @@ class services extends Step
104 * @access public 122 * @access public
105 * @var boolean 123 * @var boolean
106 */ 124 */
107 - protected $storeInSession = false; 125 + protected $storeInSession = true;
108 126
109 /** 127 /**
110 * List of variables to be loaded to template 128 * List of variables to be loaded to template
@@ -140,9 +158,17 @@ class services extends Step @@ -140,9 +158,17 @@ class services extends Step
140 * @access public 158 * @access public
141 * @var mixed 159 * @var mixed
142 */ 160 */
143 - private $javaExeError = false; 161 + private $javaExeError = '';
144 162
145 /** 163 /**
  164 + * Holds path error, if php is specified
  165 + *
  166 + * @author KnowledgeTree Team
  167 + * @access public
  168 + * @var mixed
  169 + */
  170 + private $phpExeError = '';
  171 + /**
146 * Constructs services object 172 * Constructs services object
147 * 173 *
148 * @author KnowledgeTree Team 174 * @author KnowledgeTree Team
@@ -205,6 +231,7 @@ class services extends Step @@ -205,6 +231,7 @@ class services extends Step
205 if($this->java != '') { // Java JRE Found 231 if($this->java != '') { // Java JRE Found
206 $this->javaCheck = 'tick'; 232 $this->javaCheck = 'tick';
207 $this->javaInstalled(); 233 $this->javaInstalled();
  234 + $this->temp_variables['java']['location'] = $this->java;
208 } 235 }
209 } 236 }
210 237
@@ -217,23 +244,64 @@ class services extends Step @@ -217,23 +244,64 @@ class services extends Step
217 * @return boolean 244 * @return boolean
218 */ 245 */
219 private function doRun() { 246 private function doRun() {
220 - $this->java = $this->util->getJava(); // Get java, if it exists  
221 - $this->javaChecks(); // Run Pre Checks  
222 - $errors = $this->getErrors(); // Get errors  
223 - if(empty($errors)) { // Install Service if there is no errors  
224 - $this->installService();  
225 - } else { // Services not installed  
226 - foreach ($this->getServices() as $serviceName) {  
227 - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$serviceName." Could not be added as a Service"); 247 + if($this->alreadyInstalled()) {
  248 + $this->alreadyInstalled = true;
  249 + $this->serviceCheck = 'tick';
  250 + } else {
  251 + $this->php = $this->util->getPhp(); // Get java, if it exists
  252 + $this->java = $this->util->getJava(); // Get java, if it exists
  253 + $passedPhp = $this->phpChecks(); // Run Java Pre Checks
  254 + $passedJava = $this->javaChecks(); // Run Java Pre Checks
  255 + $errors = $this->getErrors(); // Get errors
  256 + if(empty($errors) && $passedJava && $passedPhp) { // Install Service if there is no errors
  257 + $this->installServices();
  258 + } elseif ($passedPhp) { // Install Scheduler
  259 + $this->installService('Scheduler');
  260 + } elseif ($passedJava) { // Install Lucene
  261 + $this->installService('Lucene');
  262 + } else { // All Services not installed
228 } 263 }
229 - $this->serviceCheck = 'cross_orange';  
230 - } 264 + }
  265 + $this->checkServiceStatus();
231 $this->storeSilent(); // Store info needed for silent mode 266 $this->storeSilent(); // Store info needed for silent mode
232 if(!empty($errors)) 267 if(!empty($errors))
233 return false; 268 return false;
234 return true; 269 return true;
235 } 270 }
236 271
  272 + function checkServiceStatus() {
  273 + $serverDetails = $this->getServices();
  274 + foreach ($serverDetails as $serviceName) {
  275 + $className = OS.$serviceName;
  276 + $service = new $className();
  277 + $status = $this->serviceStatus($service);
  278 + if($status != 'STARTED') {
  279 + $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service");
  280 + $this->serviceCheck = 'cross_orange';
  281 + } else {
  282 + if(WINDOWS_OS) {
  283 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service"); }
  284 + else {
  285 + $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added and Started as a Service");
  286 + }
  287 + }
  288 + }
  289 + }
  290 +
  291 + function alreadyInstalled() {
  292 + $installed = true;
  293 + $serverDetails = $this->getServices();
  294 + foreach ($serverDetails as $serviceName) {
  295 + $className = OS.$serviceName;
  296 + $service = new $className();
  297 + $status = $this->serviceStatus($service);
  298 + if($status != 'STARTED') {
  299 + return false;
  300 + }
  301 + }
  302 + return true;
  303 + }
  304 +
237 /** 305 /**
238 * Do some basic checks to help the user overcome java problems 306 * Do some basic checks to help the user overcome java problems
239 * 307 *
@@ -251,10 +319,36 @@ class services extends Step @@ -251,10 +319,36 @@ class services extends Step
251 $this->disableExtension = true; // Disable the use of the php bridge extension 319 $this->disableExtension = true; // Disable the use of the php bridge extension
252 return $this->detSettings(); // AutoDetect java settings 320 return $this->detSettings(); // AutoDetect java settings
253 } else { 321 } else {
254 - return $this->useBridge(); // Use Bridge to get java settings 322 + $auto = $this->useBridge(); // Use Bridge to get java settings
  323 + if($auto) {
  324 + return $auto;
  325 + } else {
  326 + $this->specifyJava(); // Ask for settings
  327 + }
  328 + return $auto;
255 } 329 }
256 } 330 }
257 - 331 +
  332 + private function specifyJava() {
  333 + $this->javaExeError = true;
  334 + }
  335 +
  336 + private function specifyPhp() {
  337 + $this->phpExeError = true;
  338 + }
  339 +
  340 + private function phpChecks() {
  341 + // TODO: Better detection
  342 + return true;
  343 + $this->setPhp();
  344 + if($this->util->phpSpecified()) {
  345 + return $this->detPhpSettings();
  346 + } else {
  347 + $this->specifyPhp();// Ask for settings
  348 + return false;
  349 + }
  350 + }
  351 +
258 /** 352 /**
259 * Attempts to use user input and configure java settings 353 * Attempts to use user input and configure java settings
260 * 354 *
@@ -280,18 +374,41 @@ class services extends Step @@ -280,18 +374,41 @@ class services extends Step
280 $this->javaVersionCorrect(); 374 $this->javaVersionCorrect();
281 $this->javaInstalled(); 375 $this->javaInstalled();
282 $this->javaCheck = 'tick'; 376 $this->javaCheck = 'tick';
  377 +
283 return true; 378 return true;
284 } 379 }
285 } else { 380 } else {
286 $this->javaVersionWarning(); 381 $this->javaVersionWarning();
287 $this->javaCheck = 'cross_orange'; 382 $this->javaCheck = 'cross_orange';
288 - $this->javaExeError = "Incorrect path specified"; 383 + $this->javaExeError = "Java : Incorrect path specified";
289 $this->error[] = "Requires Java 1.5+ to be installed"; 384 $this->error[] = "Requires Java 1.5+ to be installed";
290 return false; 385 return false;
291 } 386 }
292 } 387 }
293 } 388 }
294 389
  390 + function detPhpSettings() {
  391 + // TODO: Better php handling
  392 + return true;
  393 + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
  394 + $cmd = "$phpExecutable -version > output/outPHP 2>&1 echo $!";
  395 + $response = $this->util->pexec($cmd);
  396 + if(file_exists(OUTPUT_DIR.'outPHP')) {
  397 + $tmp = file_get_contents(OUTPUT_DIR.'outPHP');
  398 + preg_match('/PHP/',$tmp, $matches);
  399 + if($matches) {
  400 + $this->phpCheck = 'tick';
  401 +
  402 + return true;
  403 + } else {
  404 + $this->phpCheck = 'cross_orange';
  405 + $this->phpExeError = "PHP : Incorrect path specified";
  406 + $this->error[] = "PHP executable required";
  407 +
  408 + return false;
  409 + }
  410 + }
  411 + }
295 /** 412 /**
296 * Attempts to use bridge and configure java settings 413 * Attempts to use bridge and configure java settings
297 * 414 *
@@ -320,6 +437,7 @@ class services extends Step @@ -320,6 +437,7 @@ class services extends Step
320 return true; 437 return true;
321 } 438 }
322 } else { 439 } else {
  440 + $this->javaCheck = 'cross_orange';
323 $this->javaVersionWarning(); 441 $this->javaVersionWarning();
324 $this->zendBridgeWarning(); 442 $this->zendBridgeWarning();
325 $this->warnings[] = "Zend Java Bridge Not Functional"; 443 $this->warnings[] = "Zend Java Bridge Not Functional";
@@ -370,27 +488,36 @@ class services extends Step @@ -370,27 +488,36 @@ class services extends Step
370 * 488 *
371 * @author KnowledgeTree Team 489 * @author KnowledgeTree Team
372 * @param none 490 * @param none
373 - * @access public 491 + * @access private
374 * @return boolean 492 * @return boolean
375 */ 493 */
376 - public function installService() { 494 + private function installServices() {
377 foreach ($this->getServices() as $serviceName) { 495 foreach ($this->getServices() as $serviceName) {
378 - $className = OS.$serviceName;  
379 - $service = new $className();  
380 - $status = $this->serviceHelper($service);  
381 - if ($status) {  
382 - $this->temp_variables['services'][] = array('class'=>'tick', 'msg'=>$service->getName()." has been added as a Service");  
383 - } else {  
384 - $this->temp_variables['services'][] = array('class'=>'cross_orange', 'msg'=>$service->getName()." Could not be added as a Service");  
385 - $this->serviceCheck = 'cross_orange';  
386 - } 496 + $this->installService($serviceName);
387 } 497 }
388 498
389 return true; 499 return true;
390 } 500 }
391 501
  502 + /**
  503 + * Installs services helper
  504 + *
  505 + * @author KnowledgeTree Team
  506 + * @param none
  507 + * @access private
  508 + * @return boolean
  509 + */
  510 + private function installService($serviceName) {
  511 + $className = OS.$serviceName;
  512 + $service = new $className();
  513 + $status = $this->serviceHelper($service);
  514 + if (!$status) {
  515 + $this->serviceCheck = 'cross_orange';
  516 + }
  517 + }
  518 +
392 /** 519 /**
393 - * Executes services 520 + * Installs services
394 * 521 *
395 * @author KnowledgeTree Team 522 * @author KnowledgeTree Team
396 * @param object 523 * @param object
@@ -405,6 +532,20 @@ class services extends Step @@ -405,6 +532,20 @@ class services extends Step
405 } 532 }
406 533
407 /** 534 /**
  535 + * Returns service status
  536 + *
  537 + * @author KnowledgeTree Team
  538 + * @param object
  539 + * @access private
  540 + * @return string
  541 + */
  542 + private function serviceStatus($service) {
  543 + $service->load(); // Load Defaults
  544 + $statusCheck = OS."ServiceInstalled";
  545 + return $this->$statusCheck($service);
  546 + }
  547 +
  548 + /**
408 * Check if windows service installed 549 * Check if windows service installed
409 * 550 *
410 * @author KnowledgeTree Team 551 * @author KnowledgeTree Team
@@ -414,8 +555,7 @@ class services extends Step @@ -414,8 +555,7 @@ class services extends Step
414 */ 555 */
415 public function windowsServiceInstalled($service) { 556 public function windowsServiceInstalled($service) {
416 $status = $service->status(); // Check if service has been installed 557 $status = $service->status(); // Check if service has been installed
417 - if($status != 'STOPPED') { // Check service status  
418 - $this->error[] = $service->getName()." Could not be added as a Service"; 558 + if($status == '') { // Check service status
419 return false; 559 return false;
420 } 560 }
421 return true; 561 return true;
@@ -432,7 +572,6 @@ class services extends Step @@ -432,7 +572,6 @@ class services extends Step
432 public function unixServiceInstalled($service) { 572 public function unixServiceInstalled($service) {
433 $status = $service->status(); // Check if service has been installed 573 $status = $service->status(); // Check if service has been installed
434 if($status != 'STARTED') { // Check service status 574 if($status != 'STARTED') { // Check service status
435 - $this->error[] = $service->getName()." Could not be added as a Service";  
436 return false; 575 return false;
437 } 576 }
438 return true; 577 return true;
@@ -451,9 +590,7 @@ class services extends Step @@ -451,9 +590,7 @@ class services extends Step
451 $className = OS.$serviceName; 590 $className = OS.$serviceName;
452 $service = new $className(); 591 $service = new $className();
453 $status = $this->serviceStart($service); 592 $status = $this->serviceStart($service);
454 -  
455 } 593 }
456 -  
457 return true; 594 return true;
458 } 595 }
459 596
@@ -621,11 +758,29 @@ class services extends Step @@ -621,11 +758,29 @@ class services extends Step
621 * @return void 758 * @return void
622 */ 759 */
623 private function storeSilent() { 760 private function storeSilent() {
624 - $this->temp_variables['javaExeError'] = $this->javaExeError;  
625 - $this->temp_variables['javaCheck'] = $this->javaCheck;  
626 - $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;  
627 - $this->temp_variables['serviceCheck'] = $this->serviceCheck;  
628 - $this->temp_variables['disableExtension'] = $this->disableExtension; 761 + $this->temp_variables['alreadyInstalled'] = $this->alreadyInstalled;
  762 + $this->temp_variables['javaExeError'] = $this->javaExeError;
  763 + $this->temp_variables['javaCheck'] = $this->javaCheck;
  764 + $this->temp_variables['javaExtCheck'] = $this->javaExtCheck;
  765 + $this->temp_variables['phpCheck'] = 'tick';//$this->phpCheck;
  766 + $this->temp_variables['phpExeError'] = '';//$this->phpExeError;
  767 + $this->temp_variables['serviceCheck'] = $this->serviceCheck;
  768 + $this->temp_variables['disableExtension'] = $this->disableExtension;
  769 + }
  770 +
  771 + private function setPhp() {
  772 + if($this->php != '') { // PHP Found
  773 + $this->phpCheck = 'tick';
  774 + } elseif (PHP_DIR != '') { // Use System Defined Settings
  775 + $this->php = PHP_DIR;
  776 + } else {
  777 +
  778 + }
  779 + $this->temp_variables['php']['location'] = $this->php;
629 } 780 }
  781 +
  782 + public function getPhpDir() {
  783 + return $this->php;
  784 + }
630 } 785 }
631 ?> 786 ?>
632 \ No newline at end of file 787 \ No newline at end of file
setup/wizard/templates/complete.tpl
@@ -33,7 +33,6 @@ if($errors || $warnings){ @@ -33,7 +33,6 @@ if($errors || $warnings){
33 </div> 33 </div>
34 <?php } ?> 34 <?php } ?>
35 </div> 35 </div>
36 -<br/>  
37 <div> 36 <div>
38 <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3> 37 <h3><?php echo "<span class='{$database_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Database connectivity</h3>
39 <?php if($silent) { ?> 38 <?php if($silent) { ?>
@@ -60,7 +59,6 @@ if($errors || $warnings){ @@ -60,7 +59,6 @@ if($errors || $warnings){
60 </div> 59 </div>
61 <?php } ?> 60 <?php } ?>
62 </div> 61 </div>
63 -<br/>  
64 <div> 62 <div>
65 <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3> 63 <h3><?php echo "<span class='{$services_check}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services</h3>
66 <?php if($silent) { ?> 64 <?php if($silent) { ?>
@@ -68,8 +66,12 @@ if($errors || $warnings){ @@ -68,8 +66,12 @@ if($errors || $warnings){
68 <div class="services_check" style="display:none"> 66 <div class="services_check" style="display:none">
69 <?php } ?> 67 <?php } ?>
70 <table> 68 <table>
71 - <tr><?php echo $LuceneServiceStatus; ?></tr>  
72 - <tr><?php echo $SchedulerServiceStatus; ?></tr> 69 + <tr>
  70 + <td><?php echo "<span class='{$LuceneStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Lucene Service</td>
  71 + </tr>
  72 + <tr>
  73 + <td><?php echo "<span class='{$SchedulerStatus}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Scheduler Service</td>
  74 + </tr>
73 </table> 75 </table>
74 <?php if($silent) { ?> 76 <?php if($silent) { ?>
75 </div> 77 </div>
setup/wizard/templates/configuration.tpl
@@ -55,7 +55,7 @@ The settings below have been drawn from the system information. The host and por @@ -55,7 +55,7 @@ The settings below have been drawn from the system information. The host and por
55 <div class="paths_perms" style="display:none"> 55 <div class="paths_perms" style="display:none">
56 <?php } ?> 56 <?php } ?>
57 <p class="description"> 57 <p class="description">
58 -The following folders must be writable for KnowledgeTree to be able to run. The permissions on the configuration file can be reset to read-only once the installation has completed. 58 +The following folders must be writable for KnowledgeTree to be able to run. The permissions on the configuration file may be reset to read-only once the installation has completed.
59 </p> 59 </p>
60 <table> 60 <table>
61 <?php 61 <?php
setup/wizard/templates/database.tpl
1 <h1>Database Configuration</h1> 1 <h1>Database Configuration</h1>
2 -  
3 -<div class="errors">  
4 - <?php if(isset($errors)) {  
5 - foreach($errors as $k=>$e) {  
6 - echo $e;  
7 - }  
8 - }?>  
9 -</div>  
10 -  
11 -<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate();return false;">  
12 -<!--Hidden Fields--> 2 +<!-- Check For immediate Errors -->
  3 +<span class="error"> <?php if($errors['con']) { echo $errors['con']; } ?> </span>
  4 +<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate(<?php if ($silent) echo 'true'; else echo 'false'; ?>);return false;">
  5 +<!-- Hidden Fields -->
13 <input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/> 6 <input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/>
14 <input type="hidden" id="sendAll" name="" value="" /> 7 <input type="hidden" id="sendAll" name="" value="" />
15 <!-- STEP 1 of the database configuration - server settings --> 8 <!-- STEP 1 of the database configuration - server settings -->
@@ -30,16 +23,18 @@ @@ -30,16 +23,18 @@
30 <tr> 23 <tr>
31 <td><label for='dname'>Enter a name for the database: </label></td> 24 <td><label for='dname'>Enter a name for the database: </label></td>
32 <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40'/></td> 25 <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40'/></td>
  26 + <td id="error" class="error"><?php if($errors['dname']) echo $errors['dname']; ?></td>
33 </tr> 27 </tr>
34 <tr> 28 <tr>
35 - <td><label for='duname'>Enter the username for the Root or Administrative User: </label></td> 29 + <td><label for='duname'>Enter Database Administrative username: </label></td>
36 <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td> 30 <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td>
  31 + <td id="error" class="error"><?php if($errors['duname']) echo $errors['duname']; ?></td>
37 </tr> 32 </tr>
38 <tr> 33 <tr>
39 <td><label for='dpassword'>Enter the password for the user: </label></td> 34 <td><label for='dpassword'>Enter the password for the user: </label></td>
40 <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td> 35 <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td>
  36 + <td id="error" class="error"><?php if($errors['dpassword']) echo $errors['dpassword']; ?></td>
41 </tr> 37 </tr>
42 -  
43 </table> 38 </table>
44 39
45 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('adv_options');}">Advanced Options</div> 40 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('adv_options');}">Advanced Options</div>
@@ -68,7 +63,11 @@ @@ -68,7 +63,11 @@
68 </div> 63 </div>
69 <div class="buttons"> 64 <div class="buttons">
70 <input type="submit" name="Previous" value="previous" /> 65 <input type="submit" name="Previous" value="previous" />
  66 + <?php if ($silent) { ?>
  67 + <input type="submit" name="Next" value="next" />
  68 + <?php } else { ?>
71 <input type="button" name="Next" value="next" onclick="javascript:{w.showStep(1, 'n');}"/> 69 <input type="button" name="Next" value="next" onclick="javascript:{w.showStep(1, 'n');}"/>
  70 + <?php } ?>
72 </div> 71 </div>
73 </div> 72 </div>
74 73
@@ -78,19 +77,19 @@ @@ -78,19 +77,19 @@
78 An administrative user is required for creating tables within the database. 77 An administrative user is required for creating tables within the database.
79 </div> 78 </div>
80 <table class="dbconf"> 79 <table class="dbconf">
81 - <tr> 80 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
82 <td><label for='dmsname'>Enter the name of the Database Administrative User: </label></td> 81 <td><label for='dmsname'>Enter the name of the Database Administrative User: </label></td>
83 <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td> 82 <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td>
84 <td id="error_1_2" class="error" style="display:none">Please Enter A Username</td> 83 <td id="error_1_2" class="error" style="display:none">Please Enter A Username</td>
85 </tr> 84 </tr>
86 <tr> 85 <tr>
87 - <td><label for='dmspassword'>Enter a password for the Database Administrative User: </label></td> 86 + <td><label for='dmspassword'>Enter a password for the Administrative User: </label></td>
88 <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td> 87 <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td>
89 <td id="error_2_2" class="error" style="display:none">Please Enter A Password</td> 88 <td id="error_2_2" class="error" style="display:none">Please Enter A Password</td>
90 </tr> 89 </tr>
91 <tr> 90 <tr>
92 <td><label for='dmspassword2'>Please confirm the password: </label></td> 91 <td><label for='dmspassword2'>Please confirm the password: </label></td>
93 - <td><input type='password' value="" id='dmspassword2' name='dmspassword2' size='40' /></td> 92 + <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword2' name='dmspassword2' size='40' /></td>
94 <td id="error_3_2" class="error" style="display:none">Please Confirm Password</td> 93 <td id="error_3_2" class="error" style="display:none">Please Confirm Password</td>
95 <td id="error_4_2" class="error" style="display:none">Passwords Do Not Match</td> 94 <td id="error_4_2" class="error" style="display:none">Passwords Do Not Match</td>
96 </tr> 95 </tr>
@@ -103,13 +102,13 @@ An administrative user is required for creating tables within the database. @@ -103,13 +102,13 @@ An administrative user is required for creating tables within the database.
103 </div> 102 </div>
104 103
105 <!-- STEP 3 of the database configuration - default user password settings --> 104 <!-- STEP 3 of the database configuration - default user password settings -->
106 -<div id="database" class="step3" style="display:none;":> 105 +<div id="database" class="step3" style="display:none;">
107 <div class="description"> 106 <div class="description">
108 An second user is required for normal database interaction, the reading and writing of data. 107 An second user is required for normal database interaction, the reading and writing of data.
109 </div> 108 </div>
110 109
111 <table class="dbconf"> 110 <table class="dbconf">
112 - <tr> 111 + <tr style="<?php if ($silent) echo 'display:none' ;?>">
113 <td><label for='dmsusername'>Enter a name for the User: </label></td> 112 <td><label for='dmsusername'>Enter a name for the User: </label></td>
114 <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td> 113 <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td>
115 <td id="error_1_3" class="error" style="display:none">Please Enter A Username</td> 114 <td id="error_1_3" class="error" style="display:none">Please Enter A Username</td>
@@ -121,7 +120,7 @@ An second user is required for normal database interaction, the reading and writ @@ -121,7 +120,7 @@ An second user is required for normal database interaction, the reading and writ
121 </tr> 120 </tr>
122 <tr> 121 <tr>
123 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td> 122 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td>
124 - <td><input type='password' value="" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td> 123 + <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td>
125 <td id="error_3_3" class="error" style="display:none">Please Confirm Password</td> 124 <td id="error_3_3" class="error" style="display:none">Please Confirm Password</td>
126 <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td> 125 <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td>
127 </tr> 126 </tr>
setup/wizard/templates/database_confirm.tpl
@@ -20,9 +20,7 @@ if($dtypes) { @@ -20,9 +20,7 @@ if($dtypes) {
20 <td><b>Database type: </b></td> 20 <td><b>Database type: </b></td>
21 <td><?php echo $type; ?></td> 21 <td><?php echo $type; ?></td>
22 </tr> 22 </tr>
23 - <?php  
24 -}  
25 -?> 23 +<?php } ?>
26 <tr> 24 <tr>
27 <td><b>Name: </b></td> 25 <td><b>Name: </b></td>
28 <td><?php echo $dname; ?></td> 26 <td><?php echo $dname; ?></td>
@@ -61,27 +59,33 @@ if($dtypes) { @@ -61,27 +59,33 @@ if($dtypes) {
61 <td><b>Mysql Binary: </b></td> 59 <td><b>Mysql Binary: </b></td>
62 <td><?php echo $dbbinary; ?></td> 60 <td><?php echo $dbbinary; ?></td>
63 </tr> 61 </tr>
  62 + <?php if (!$silent) { ?>
64 <tr> 63 <tr>
65 <td><b>Table Prefix: </b></td> 64 <td><b>Table Prefix: </b></td>
66 <td><?php echo $tprefix; ?></td> 65 <td><?php echo $tprefix; ?></td>
67 </tr> 66 </tr>
  67 +<?php } ?>
68 </table> 68 </table>
69 69
70 <h3>Database Users</h3> 70 <h3>Database Users</h3>
71 71
72 -<table width="16%" class="dbconf"> 72 +<table width="46%" class="dbconf">
  73 + <?php //if (!$silent) { ?>
73 <tr> 74 <tr>
74 <td><b>DMS Admin Username: </b></td> 75 <td><b>DMS Admin Username: </b></td>
75 <td><?php echo $dmsname; ?></td> 76 <td><?php echo $dmsname; ?></td>
76 </tr> 77 </tr>
  78 + <?php //} ?>
77 <tr> 79 <tr>
78 <td><b>DMS Admin Password: </b></td> 80 <td><b>DMS Admin Password: </b></td>
79 <td><?php echo $dmspassword; ?></td> 81 <td><?php echo $dmspassword; ?></td>
80 </tr> 82 </tr>
  83 + <?php //if (!$silent) { ?>
81 <tr> 84 <tr>
82 <td><b>DMS User Username: </b></td> 85 <td><b>DMS User Username: </b></td>
83 <td><?php echo $dmsusername; ?></td> 86 <td><?php echo $dmsusername; ?></td>
84 </tr> 87 </tr>
  88 + <?php //} ?>
85 <tr> 89 <tr>
86 <td><b>DMS User Password: </b></td> 90 <td><b>DMS User Password: </b></td>
87 <td><?php echo $dmsuserpassword; ?></td> 91 <td><?php echo $dmsuserpassword; ?></td>
setup/wizard/templates/services.tpl
@@ -11,15 +11,29 @@ if($errors || $warnings){ @@ -11,15 +11,29 @@ if($errors || $warnings){
11 . 'Click Here for help on overcoming service issues</a></div><br/>'; 11 . 'Click Here for help on overcoming service issues</a></div><br/>';
12 } 12 }
13 ?> 13 ?>
14 -<?php if($javaExtCheck != 'tick') { ?> 14 +<?php if(!$alreadyInstalled) { ?>
  15 +<?php if($javaExeError != '') { ?>
15 Specify the location of your Java executable 16 Specify the location of your Java executable
16 <br /> 17 <br />
17 -<input name='java' id='port' size='25' value=''/>&nbsp;&nbsp;&nbsp;<input type="submit" name="Refresh" value="Submit"/> 18 +<input name='java' id='port' size='25' value='<?php echo $java['location']; ?>'/>
  19 +&nbsp;&nbsp;&nbsp;
  20 +<?php if($javaExeError != true) { ?><span class="error"><?php echo $javaExeError; ?></span><?php } ?>
  21 +<?php } ?>
  22 +<?php if($phpExeError != '') { ?>
  23 +<br />
  24 +Specify the location of your PHP executable
18 <br /> 25 <br />
19 -<?php if($javaExeError) { ?>  
20 - <span class="error"><?php echo $javaExeError; ?></span> 26 +<?php if($php['location'] == '') { ?>
  27 + <input name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
  28 +<?php } else {?>
  29 + <input type="hidden" name='php' id='port' size='25' value='<?php echo $php['location']; ?>'/>
21 <?php } ?> 30 <?php } ?>
22 - 31 +&nbsp;&nbsp;&nbsp;
  32 +<?php if($phpExeError != true) { ?><span class="error"><?php echo $phpExeError; ?></span><?php } ?>
  33 +<?php } ?>
  34 +<?php if($javaExeError != '' || $phpExeError != '') { ?>
  35 +<br />
  36 +<input type="submit" name="Refresh" value="Submit"/>
23 <?php } ?> 37 <?php } ?>
24 <h3><?php echo "<span class='{$javaCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Java Check</h3> 38 <h3><?php echo "<span class='{$javaCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Java Check</h3>
25 <?php if($silent) { ?> 39 <?php if($silent) { ?>
@@ -50,6 +64,11 @@ A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level. @@ -50,6 +64,11 @@ A PHP Java Bridge is required for KnowledgeTree to perform at an optimal level.
50 </div> 64 </div>
51 <?php } ?> 65 <?php } ?>
52 <?php } ?> 66 <?php } ?>
  67 +<?php } else { ?>
  68 +<p class="description">
  69 +All services are already installed.
  70 +</p>
  71 +<?php } ?>
53 <h3><?php echo "<span class='{$serviceCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services Check</h3> 72 <h3><?php echo "<span class='{$serviceCheck}'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>"; ?>Services Check</h3>
54 <?php if($silent) { ?> 73 <?php if($silent) { ?>
55 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div> 74 <div id="options" class="onclick" onclick="javascript:{w.toggleClass('service_details');}">Show Details</div>