Commit 93e91f992aefdc34d244d4d04de6e14bcab62d28

Authored by Megan Watson
2 parents 1f59fde3 e5942d35

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

Showing 50 changed files with 453 additions and 514 deletions
bin/system_info.php
@@ -49,7 +49,6 @@ require_once('../config/dmsDefaults.php'); @@ -49,7 +49,6 @@ require_once('../config/dmsDefaults.php');
49 49
50 global $default; 50 global $default;
51 $default->log->debug('System information collection script starting...'); 51 $default->log->debug('System information collection script starting...');
52 -$cache_file = $default->cacheDirectory . '/system_info';  
53 52
54 // Get installation guid 53 // Get installation guid
55 function getGuid() 54 function getGuid()
@@ -167,44 +166,11 @@ function sendForm($data) @@ -167,44 +166,11 @@ function sendForm($data)
167 curl_close($ch); 166 curl_close($ch);
168 } 167 }
169 168
170 -// Check the last time the call home executed  
171 -function checkRunTime($cache_file)  
172 -{  
173 - if(!file_exists($cache_file)){  
174 - return true;  
175 - }  
176 -  
177 - $run_time = trim(file_get_contents($cache_file));  
178 - $now = time();  
179 -  
180 - if($run_time < $now){  
181 - return true;  
182 - }  
183 -  
184 - return false;  
185 -}  
186 -  
187 -// update the time of the last call home execution  
188 -function updateRunTime($cache_file)  
189 -{  
190 - // Generate the time for the next call  
191 - $now = time();  
192 - $period = rand(12, 36);  
193 - $next = $now + (60*60*$period);  
194 -  
195 - file_put_contents($cache_file, $next);  
196 -}  
197 -  
198 -if(!checkRunTime($cache_file)){  
199 - exit(0);  
200 -}  
201 -  
202 $post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo(); 169 $post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo();
203 $data['system_info'] = $post_str; 170 $data['system_info'] = $post_str;
204 171
205 sendForm($data); 172 sendForm($data);
206 -updateRunTime($cache_file);  
207 173
208 $default->log->debug('System information collection script finishing.'); 174 $default->log->debug('System information collection script finishing.');
209 exit(0); 175 exit(0);
210 -?>  
211 \ No newline at end of file 176 \ No newline at end of file
  177 +?>
plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
@@ -265,7 +265,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher { @@ -265,7 +265,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
265 function getUsersDocument($sUserName, $iDropDocsFolderID) 265 function getUsersDocument($sUserName, $iDropDocsFolderID)
266 { 266 {
267 $oUser = $this->oUser; 267 $oUser = $this->oUser;
268 -  
269 $oDropDocsFolder = Folder::get($iDropDocsFolderID); 268 $oDropDocsFolder = Folder::get($iDropDocsFolderID);
270 269
271 $fullPath = $oDropDocsFolder->getFullPath() . '/' . $sUserName; 270 $fullPath = $oDropDocsFolder->getFullPath() . '/' . $sUserName;
@@ -338,20 +337,7 @@ class MyDropDocumentsPage extends KTStandardDispatcher { @@ -338,20 +337,7 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
338 } 337 }
339 } 338 }
340 339
341 - $sUserName = (string)$this->oUser->getUserName();  
342 - $subFolders = Folder::getByParentId($iDropDocsFolderID);  
343 -  
344 - $myDropFolder = false;  
345 - foreach ($subFolders as $sub){  
346 - if($sub->getName() == $sUserName){  
347 - $myDropFolder = $sub;  
348 - break;  
349 - }  
350 - }  
351 -  
352 - $iMyDropDocsFolderID = $myDropFolder->getID();  
353 -  
354 - $location = 'browse.php?fFolderId='.$iMyDropDocsFolderID; 340 + $location = 'browse.php?fFolderId='.$iMyDocsFolderID;
355 $sReturnTable .= '</tbody>'. 341 $sReturnTable .= '</tbody>'.
356 '</table>'. 342 '</table>'.
357 '<br>'. 343 '<br>'.
plugins/ktcore/KTWidgets.php
@@ -967,6 +967,7 @@ class KTCoreTextAreaWidget extends KTWidget { @@ -967,6 +967,7 @@ class KTCoreTextAreaWidget extends KTWidget {
967 $oTemplating =& KTTemplating::getSingleton(); 967 $oTemplating =& KTTemplating::getSingleton();
968 $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base'); 968 $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base');
969 969
  970 + $this->aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
970 $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js'; 971 $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
971 $this->aJavascript[] = 'resources/js/kt_tinymce_init.js'; 972 $this->aJavascript[] = 'resources/js/kt_tinymce_init.js';
972 973
setup/migrate/migrateUtil.php
@@ -62,15 +62,15 @@ class MigrateUtil extends InstallUtil { @@ -62,15 +62,15 @@ class MigrateUtil extends InstallUtil {
62 public function error($error) { 62 public function error($error) {
63 $template_vars['error'] = $error; 63 $template_vars['error'] = $error;
64 $file = "templates/error.tpl"; 64 $file = "templates/error.tpl";
65 - if (file_exists($file)) {  
66 - extract($template_vars); // Extract the vars to local namespace  
67 - ob_start();  
68 - include($file);  
69 - $contents = ob_get_contents();  
70 - ob_end_clean();  
71 - echo $contents; 65 + if (!file_exists($file)) {
  66 + return false;
72 } 67 }
73 - return false; 68 + extract($template_vars); // Extract the vars to local namespace
  69 + ob_start();
  70 + include($file);
  71 + $contents = ob_get_contents();
  72 + ob_end_clean();
  73 + echo $contents;
74 } 74 }
75 75
76 /** 76 /**
setup/migrate/migrateWizard.php
@@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes @@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes
52 if ($class == "template") { // Load existing templating classes 52 if ($class == "template") { // Load existing templating classes
53 require_once("../wizard/template.php"); 53 require_once("../wizard/template.php");
54 require_once("../wizard/lib/helpers/htmlHelper.php"); 54 require_once("../wizard/lib/helpers/htmlHelper.php");
55 - 55 + return ;
  56 + }
  57 + if(file_exists(WIZARD_DIR."$class.php")) {
  58 + require_once(WIZARD_DIR."$class.php");
  59 + } elseif (file_exists(STEP_DIR."$class.php")) {
  60 + require_once(STEP_DIR."$class.php");
  61 + } elseif (file_exists(WIZARD_LIB."$class.php")) {
  62 + require_once(WIZARD_LIB."$class.php");
56 } else { 63 } else {
57 - if(file_exists(WIZARD_DIR."$class.php")) {  
58 - require_once(WIZARD_DIR."$class.php");  
59 - } elseif (file_exists(STEP_DIR."$class.php")) {  
60 - require_once(STEP_DIR."$class.php");  
61 - } elseif (file_exists(WIZARD_LIB."$class.php")) {  
62 - require_once(WIZARD_LIB."$class.php");  
63 - } 64 + return null;
64 } 65 }
65 - return true;  
66 } 66 }
67 67
68 class MigrateWizard { 68 class MigrateWizard {
@@ -233,6 +233,8 @@ class MigrateWizard { @@ -233,6 +233,8 @@ class MigrateWizard {
233 return true; 233 return true;
234 break; 234 break;
235 } 235 }
  236 +
  237 + return $res;
236 } 238 }
237 239
238 /** 240 /**
@@ -259,7 +261,7 @@ class MigrateWizard { @@ -259,7 +261,7 @@ class MigrateWizard {
259 } 261 }
260 } else { 262 } else {
261 // TODO: Die gracefully 263 // TODO: Die gracefully
262 - $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:80px;float:none'>Goto Login</a>"); 264 + $this->util->error("System has been migrated <a href='../../login.php' class='back' style='width:80px;float:none' back button_next>Goto Login</a>");
263 } 265 }
264 } 266 }
265 } 267 }
setup/migrate/migrater.php
@@ -157,7 +157,7 @@ class Migrater { @@ -157,7 +157,7 @@ class Migrater {
157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 } catch (Exception $e) { 158 } catch (Exception $e) {
159 $util = new MigrateUtil(); 159 $util = new MigrateUtil();
160 - $util->error("Error reading configuration file: $e"); 160 + $util->error("Error reading configuration file: $name");
161 exit(); 161 exit();
162 } 162 }
163 } 163 }
@@ -431,7 +431,8 @@ class Migrater { @@ -431,7 +431,8 @@ class Migrater {
431 if($class->runMigrate()) { // Check if step needs to be migrated 431 if($class->runMigrate()) { // Check if step needs to be migrated
432 $class->setDataFromSession($className); // Set Session Information 432 $class->setDataFromSession($className); // Set Session Information
433 $class->setPostConfig(); // Set any posted variables 433 $class->setPostConfig(); // Set any posted variables
434 - $class->migrateStep(); // Run migrate step 434 + $response = $class->migrateStep(); // Run migrate step
  435 + // TODO : Break on error response
435 } 436 }
436 } else { 437 } else {
437 $util = new MigrateUtil(); 438 $util = new MigrateUtil();
setup/migrate/step.php
@@ -186,6 +186,30 @@ class Step @@ -186,6 +186,30 @@ class Step
186 } 186 }
187 187
188 /** 188 /**
  189 + * Load default step values
  190 + *
  191 + * @author KnowledgeTree Team
  192 + * @param none
  193 + * @access public
  194 + * @return void
  195 + */
  196 + public function loadDefaults() {
  197 +
  198 + }
  199 +
  200 + /**
  201 + * Return default step values
  202 + *
  203 + * @author KnowledgeTree Team
  204 + * @param none
  205 + * @access public
  206 + * @return array
  207 + */
  208 + public function getDefaults() {
  209 + return array();
  210 + }
  211 +
  212 + /**
189 * Checks if edit button has been clicked 213 * Checks if edit button has been clicked
190 * 214 *
191 * @author KnowledgeTree Team 215 * @author KnowledgeTree Team
setup/migrate/stepAction.php
@@ -229,14 +229,12 @@ class stepAction { @@ -229,14 +229,12 @@ class stepAction {
229 } else { 229 } else {
230 $this->_clearErrors($this->stepName); // Send Errors to session 230 $this->_clearErrors($this->stepName); // Send Errors to session
231 } 231 }
  232 + return $response;
232 } else { 233 } else {
233 $this->stepName = 'errors'; 234 $this->stepName = 'errors';
234 $this->action = $this->createStep(); 235 $this->action = $this->createStep();
235 $this->action->error = array('Class File Missing in Step Directory'); 236 $this->action->error = array('Class File Missing in Step Directory');
236 - $response = '';  
237 } 237 }
238 -  
239 - return $response;  
240 } 238 }
241 239
242 /** 240 /**
@@ -310,7 +308,7 @@ class stepAction { @@ -310,7 +308,7 @@ class stepAction {
310 $menu = ''; 308 $menu = '';
311 $active = false; 309 $active = false;
312 if($this->stepClassNames) { 310 if($this->stepClassNames) {
313 - foreach ($this->stepClassNames as $step) { 311 + foreach ($this->stepClassNames as $k=>$step) {
314 if($this->step_names[$step] != '') { 312 if($this->step_names[$step] != '') {
315 $item = $this->step_names[$step]; 313 $item = $this->step_names[$step];
316 } else { 314 } else {
@@ -454,7 +452,7 @@ class stepAction { @@ -454,7 +452,7 @@ class stepAction {
454 * @access private 452 * @access private
455 * @return void 453 * @return void
456 */ 454 */
457 - private function _loadValueToSession($class, $k, $v) { 455 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
458 if($this->session != null) { 456 if($this->session != null) {
459 $this->session->setClass($class, $k, $v); 457 $this->session->setClass($class, $k, $v);
460 } else { 458 } else {
@@ -504,7 +502,8 @@ class stepAction { @@ -504,7 +502,8 @@ class stepAction {
504 * @access private 502 * @access private
505 * @return void 503 * @return void
506 */ 504 */
507 - private function _loadErrorToSession($class, $k = "errors", $v) { 505 + private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
  506 + $k = "errors";
508 if($this->session != null) { 507 if($this->session != null) {
509 $this->session->setClassError($class, $k, $v); 508 $this->session->setClassError($class, $k, $v);
510 } else { 509 } else {
setup/migrate/steps/migrateDatabase.php
@@ -122,11 +122,13 @@ class migrateDatabase extends Step @@ -122,11 +122,13 @@ class migrateDatabase extends Step
122 $manual = false; // If file was exported manually 122 $manual = false; // If file was exported manually
123 $dbSettings = $installation['dbSettings']; 123 $dbSettings = $installation['dbSettings'];
124 $location = $installation['location']; 124 $location = $installation['location'];
  125 + $uname = $this->temp_variables['duname'];
  126 + $pwrd = $this->temp_variables['dpassword'];
125 $port = $this->util->getPort($location); 127 $port = $this->util->getPort($location);
126 $tmpFolder = $this->resolveTempDir(); 128 $tmpFolder = $this->resolveTempDir();
127 if(WINDOWS_OS) { 129 if(WINDOWS_OS) {
128 $termOrBash = "command prompt window"; 130 $termOrBash = "command prompt window";
129 - $exe = "\"$location".DS."mysql".DS."bin".DS."mysqldump.exe\""; // Location of dump 131 + $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump
130 } else { 132 } else {
131 $termOrBash = "terminal window"; 133 $termOrBash = "terminal window";
132 $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump 134 $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump
@@ -145,7 +147,7 @@ class migrateDatabase extends Step @@ -145,7 +147,7 @@ class migrateDatabase extends Step
145 if(!$manual) { // Try to export database 147 if(!$manual) { // Try to export database
146 $sqlFile = $tmpFolder."/kt-backup-$date.sql"; 148 $sqlFile = $tmpFolder."/kt-backup-$date.sql";
147 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; 149 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile;
148 - $this->util->pexec($cmd); 150 + $response = $this->util->pexec($cmd);
149 } 151 }
150 if(file_exists($sqlFile)) { 152 if(file_exists($sqlFile)) {
151 $fileContents = file_get_contents($sqlFile); 153 $fileContents = file_get_contents($sqlFile);
@@ -155,14 +157,10 @@ class migrateDatabase extends Step @@ -155,14 +157,10 @@ class migrateDatabase extends Step
155 } 157 }
156 } 158 }
157 // Handle failed dump 159 // Handle failed dump
158 - if(WINDOWS_OS) {  
159 - $sqlFile = "\"C:\kt-backup-$date.sql\""; // Use tmp instead due to permissions  
160 - } else {  
161 - $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions  
162 - } 160 + $sqlFile = "/tmp/kt-backup-$date.sql"; // Use tmp instead due to permissions
163 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile; 161 $cmd = $exe.' -u"'.$dbAdminUser.'" -p"'.$dbAdminPass.'" --port="'.$port.'" '.$dbName.' > '.$sqlFile;
164 - $this->error[]['error'] = "Could not export database";  
165 - $this->error[]['msg'] = "Execute the following command in a $termOrBash:"; 162 + $this->error[]['error'] = "Could not export database:";
  163 + $this->error[]['msg'] = "Execute the following command in a $termOrBash.";
166 $this->error[]['cmd'] = $cmd; 164 $this->error[]['cmd'] = $cmd;
167 $this->temp_variables['manual_export'] = $sqlFile; 165 $this->temp_variables['manual_export'] = $sqlFile;
168 166
setup/migrate/steps/migrateInstallation.php
@@ -162,7 +162,6 @@ class migrateInstallation extends step @@ -162,7 +162,6 @@ class migrateInstallation extends step
162 if($this->foundVersion < $this->supportedVersion) { 162 if($this->foundVersion < $this->supportedVersion) {
163 $this->versionError = true; 163 $this->versionError = true;
164 $this->error[] = "KT installation needs to be 3.6.1 or higher"; 164 $this->error[] = "KT installation needs to be 3.6.1 or higher";
165 - return false;  
166 } else { 165 } else {
167 return true; 166 return true;
168 } 167 }
@@ -223,8 +222,6 @@ class migrateInstallation extends step @@ -223,8 +222,6 @@ class migrateInstallation extends step
223 } else { 222 } else {
224 $this->error[] = "Please Enter a Location"; 223 $this->error[] = "Please Enter a Location";
225 } 224 }
226 -  
227 - return false;  
228 } 225 }
229 226
230 private function loadConfig($path) { 227 private function loadConfig($path) {
@@ -245,6 +242,7 @@ class migrateInstallation extends step @@ -245,6 +242,7 @@ class migrateInstallation extends step
245 } 242 }
246 $this->ktSettings = array('fileSystemRoot'=> $froot, 243 $this->ktSettings = array('fileSystemRoot'=> $froot,
247 ); 244 );
  245 + $urlPaths = $ini->getSection('urls');
248 $varDir = $froot.DS.'var'; 246 $varDir = $froot.DS.'var';
249 $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), 247 $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir),
250 array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), 248 array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
setup/migrate/steps/migrateServices.php
@@ -202,11 +202,11 @@ class migrateServices extends Step @@ -202,11 +202,11 @@ class migrateServices extends Step
202 */ 202 */
203 public function unixStop() { 203 public function unixStop() {
204 $cmd = $this->conf['location']."/dmsctl.sh stop lucene"; 204 $cmd = $this->conf['location']."/dmsctl.sh stop lucene";
205 - $this->util->pexec($cmd); 205 + $res = $this->util->pexec($cmd);
206 $cmd = $this->conf['location']."/dmsctl.sh stop scheduler"; 206 $cmd = $this->conf['location']."/dmsctl.sh stop scheduler";
207 - $this->util->pexec($cmd); 207 + $res = $this->util->pexec($cmd);
208 $cmd = $this->conf['location']."/dmsctl.sh stop soffice"; 208 $cmd = $this->conf['location']."/dmsctl.sh stop soffice";
209 - $this->util->pexec($cmd); 209 + $res = $this->util->pexec($cmd);
210 } 210 }
211 211
212 /** 212 /**
@@ -215,11 +215,11 @@ class migrateServices extends Step @@ -215,11 +215,11 @@ class migrateServices extends Step
215 */ 215 */
216 public function windowsStop() { 216 public function windowsStop() {
217 $cmd = "sc delete KTLucene"; 217 $cmd = "sc delete KTLucene";
218 - $this->util->pexec($cmd); 218 + $res = $this->util->pexec($cmd);
219 $cmd = "sc delete KTScheduler"; 219 $cmd = "sc delete KTScheduler";
220 - $this->util->pexec($cmd); 220 + $res = $this->util->pexec($cmd);
221 $cmd = "sc delete KTOpenoffice"; 221 $cmd = "sc delete KTOpenoffice";
222 - $this->util->pexec($cmd); 222 + $res = $this->util->pexec($cmd);
223 } 223 }
224 224
225 /** 225 /**
@@ -233,7 +233,7 @@ class migrateServices extends Step @@ -233,7 +233,7 @@ class migrateServices extends Step
233 $serv->load(); 233 $serv->load();
234 $sStatus = $serv->status(); 234 $sStatus = $serv->status();
235 if($sStatus != '') { 235 if($sStatus != '') {
236 - $serv->uninstall(); 236 + $res = $serv->uninstall();
237 } 237 }
238 } 238 }
239 } 239 }
setup/upgrade/step.php
@@ -172,6 +172,30 @@ class Step @@ -172,6 +172,30 @@ class Step
172 public function getWarnings() { 172 public function getWarnings() {
173 return $this->warnings; 173 return $this->warnings;
174 } 174 }
  175 +
  176 + /**
  177 + * Load default step values
  178 + *
  179 + * @author KnowledgeTree Team
  180 + * @param none
  181 + * @access public
  182 + * @return void
  183 + */
  184 + public function loadDefaults() {
  185 +
  186 + }
  187 +
  188 + /**
  189 + * Return default step values
  190 + *
  191 + * @author KnowledgeTree Team
  192 + * @param none
  193 + * @access public
  194 + * @return array
  195 + */
  196 + public function getDefaults() {
  197 + return array();
  198 + }
175 199
176 /** 200 /**
177 * Checks if edit button has been clicked 201 * Checks if edit button has been clicked
setup/upgrade/stepAction.php
@@ -229,14 +229,12 @@ class stepAction { @@ -229,14 +229,12 @@ class stepAction {
229 } else { 229 } else {
230 $this->_clearErrors($this->stepName); // Send Errors to session 230 $this->_clearErrors($this->stepName); // Send Errors to session
231 } 231 }
  232 + return $response;
232 } else { 233 } else {
233 $this->stepName = 'errors'; 234 $this->stepName = 'errors';
234 $this->action = $this->createStep(); 235 $this->action = $this->createStep();
235 $this->action->error = array('Class File Missing in Step Directory'); 236 $this->action->error = array('Class File Missing in Step Directory');
236 - $response = '';  
237 } 237 }
238 -  
239 - return $response;  
240 } 238 }
241 239
242 /** 240 /**
@@ -310,7 +308,7 @@ class stepAction { @@ -310,7 +308,7 @@ class stepAction {
310 $menu = ''; 308 $menu = '';
311 $active = false; 309 $active = false;
312 if($this->stepClassNames) { 310 if($this->stepClassNames) {
313 - foreach ($this->stepClassNames as $step) { 311 + foreach ($this->stepClassNames as $k=>$step) {
314 if($this->step_names[$step] != '') { 312 if($this->step_names[$step] != '') {
315 $item = $this->step_names[$step]; 313 $item = $this->step_names[$step];
316 } else { 314 } else {
@@ -454,7 +452,7 @@ class stepAction { @@ -454,7 +452,7 @@ class stepAction {
454 * @access private 452 * @access private
455 * @return void 453 * @return void
456 */ 454 */
457 - private function _loadValueToSession($class, $k, $v) { 455 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
458 if($this->session != null) { 456 if($this->session != null) {
459 $this->session->setClass($class, $k, $v); 457 $this->session->setClass($class, $k, $v);
460 } else { 458 } else {
@@ -504,7 +502,8 @@ class stepAction { @@ -504,7 +502,8 @@ class stepAction {
504 * @access private 502 * @access private
505 * @return void 503 * @return void
506 */ 504 */
507 - private function _loadErrorToSession($class, $k = "errors", $v) { 505 + private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
  506 + $k = "errors";
508 if($this->session != null) { 507 if($this->session != null) {
509 $this->session->setClassError($class, $k, $v); 508 $this->session->setClassError($class, $k, $v);
510 } else { 509 } else {
setup/upgrade/steps/upgradeBackup.php
@@ -120,7 +120,7 @@ class upgradeBackup extends Step { @@ -120,7 +120,7 @@ class upgradeBackup extends Step {
120 120
121 if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe')) 121 if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe'))
122 { 122 {
123 -// $curdir=getcwd(); 123 + $curdir=getcwd();
124 chdir($dir); 124 chdir($dir);
125 125
126 $handle = popen($stmt['cmd'], 'r'); 126 $handle = popen($stmt['cmd'], 'r');
@@ -198,7 +198,7 @@ class upgradeBackup extends Step { @@ -198,7 +198,7 @@ class upgradeBackup extends Step {
198 198
199 $adminUser = $oKTConfig->get('db/dbAdminUser'); 199 $adminUser = $oKTConfig->get('db/dbAdminUser');
200 $adminPwd = $oKTConfig->get('db/dbAdminPass'); 200 $adminPwd = $oKTConfig->get('db/dbAdminPass');
201 -// $dbHost = $oKTConfig->get('db/dbHost'); 201 + $dbHost = $oKTConfig->get('db/dbHost');
202 $dbName = $oKTConfig->get('db/dbName'); 202 $dbName = $oKTConfig->get('db/dbName');
203 203
204 $dbPort = trim($oKTConfig->get('db/dbPort')); 204 $dbPort = trim($oKTConfig->get('db/dbPort'));
setup/upgrade/steps/upgradeDatabase.php
@@ -144,10 +144,10 @@ class upgradeDatabase extends Step @@ -144,10 +144,10 @@ class upgradeDatabase extends Step
144 $this->readConfig(KTConfig::getConfigFilename()); 144 $this->readConfig(KTConfig::getConfigFilename());
145 145
146 if($this->dbSettings['dbPort'] == '') { 146 if($this->dbSettings['dbPort'] == '') {
147 - $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'], 147 + $con = $this->dbhandler->load($this->dbSettings['dbHost'], $this->dbSettings['dbUser'],
148 $this->dbSettings['dbPass'], $this->dbSettings['dbName']); 148 $this->dbSettings['dbPass'], $this->dbSettings['dbName']);
149 } else { 149 } else {
150 - $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'], 150 + $con = $this->dbhandler->load($this->dbSettings['dbHost'].":".$this->dbSettings['dbPort'], $this->dbSettings['dbUser'],
151 $this->dbSettings['dbPass'], $this->dbSettings['dbName']); 151 $this->dbSettings['dbPass'], $this->dbSettings['dbName']);
152 } 152 }
153 153
@@ -285,8 +285,7 @@ class upgradeDatabase extends Step @@ -285,8 +285,7 @@ class upgradeDatabase extends Step
285 } 285 }
286 286
287 $res = $this->performAllUpgrades(); 287 $res = $this->performAllUpgrades();
288 -// if (PEAR::isError($res) || PEAR::isError($pres)) {  
289 - if (PEAR::isError($res)) { 288 + if (PEAR::isError($res) || PEAR::isError($pres)) {
290 $errors = true; 289 $errors = true;
291 // TODO instantiate error details hideable section? 290 // TODO instantiate error details hideable section?
292 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font> 291 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font>
@@ -301,8 +300,7 @@ class upgradeDatabase extends Step @@ -301,8 +300,7 @@ class upgradeDatabase extends Step
301 } 300 }
302 301
303 $post_pres = $this->performPostUpgradeActions(); 302 $post_pres = $this->performPostUpgradeActions();
304 -// if (PEAR::isError($post_res)) {  
305 - if (PEAR::isError($post_pres)) { 303 + if (PEAR::isError($post_res)) {
306 $errors = true; 304 $errors = true;
307 $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>'; 305 $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>';
308 } 306 }
@@ -336,7 +334,7 @@ class upgradeDatabase extends Step @@ -336,7 +334,7 @@ class upgradeDatabase extends Step
336 334
337 // Ensure all plugins are re-registered. 335 // Ensure all plugins are re-registered.
338 $sql = "TRUNCATE plugin_helper"; 336 $sql = "TRUNCATE plugin_helper";
339 - DBUtil::runQuery($sql); 337 + $res = DBUtil::runQuery($sql);
340 338
341 // Clear out all caches and proxies - they need to be regenerated with the new code 339 // Clear out all caches and proxies - they need to be regenerated with the new code
342 $proxyDir = $default->proxyCacheDirectory; 340 $proxyDir = $default->proxyCacheDirectory;
setup/upgrade/steps/upgradeRestore.php
@@ -111,14 +111,14 @@ class upgradeRestore extends Step { @@ -111,14 +111,14 @@ class upgradeRestore extends Step {
111 private function restoreDatabase() 111 private function restoreDatabase()
112 { 112 {
113 $this->temp_variables['restore'] = true; 113 $this->temp_variables['restore'] = true;
114 -// $status = $_SESSION['backupStatus']; 114 + $status = $_SESSION['backupStatus'];
115 $filename = $_SESSION['backupFile']; 115 $filename = $_SESSION['backupFile'];
116 $stmt = $this->util->create_restore_stmt($filename); 116 $stmt = $this->util->create_restore_stmt($filename);
117 $dir = $stmt['dir']; 117 $dir = $stmt['dir'];
118 118
119 if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe')) 119 if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe'))
120 { 120 {
121 -// $curdir=getcwd(); 121 + $curdir=getcwd();
122 chdir($dir); 122 chdir($dir);
123 123
124 $ok=true; 124 $ok=true;
@@ -181,11 +181,9 @@ class upgradeRestore extends Step { @@ -181,11 +181,9 @@ class upgradeRestore extends Step {
181 $dir = $this->util->resolveTempDir(); 181 $dir = $this->util->resolveTempDir();
182 182
183 $files = array(); 183 $files = array();
184 - $dh = opendir($dir);  
185 - if ($dh) 184 + if ($dh = opendir($dir))
186 { 185 {
187 - $file = readdir($dh);  
188 - while ($file !== false) 186 + while (($file = readdir($dh)) !== false)
189 { 187 {
190 if (!preg_match('/kt-backup.+\.sql/',$file)) { 188 if (!preg_match('/kt-backup.+\.sql/',$file)) {
191 continue; 189 continue;
@@ -219,7 +217,7 @@ class upgradeRestore extends Step { @@ -219,7 +217,7 @@ class upgradeRestore extends Step {
219 return; 217 return;
220 } 218 }
221 219
222 -// $status = $_SESSION['backupStatus']; 220 + $status = $_SESSION['backupStatus'];
223 $filename = $_SESSION['backupFile']; 221 $filename = $_SESSION['backupFile'];
224 $stmt = $this->util->create_restore_stmt($filename); 222 $stmt = $this->util->create_restore_stmt($filename);
225 223
setup/upgrade/steps/upgradeWelcome.php
@@ -81,7 +81,7 @@ class upgradeWelcome extends step { @@ -81,7 +81,7 @@ class upgradeWelcome extends step {
81 } 81 }
82 82
83 private function checkPassword($username, $password) { 83 private function checkPassword($username, $password) {
84 -// global $default; 84 + global $default;
85 85
86 $sTable = KTUtil::getTableName('users'); 86 $sTable = KTUtil::getTableName('users');
87 $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?"; 87 $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?";
setup/upgrade/templates/complete.tpl
@@ -9,5 +9,5 @@ @@ -9,5 +9,5 @@
9 Your database has been upgraded to <?php echo $default->systemVersion; ?> 9 Your database has been upgraded to <?php echo $default->systemVersion; ?>
10 </div> 10 </div>
11 </div> 11 </div>
12 - <a href="../../" class="buttons back" style="width:100px;">Goto Login</a> 12 + <a href="../../" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
13 </form> 13 </form>
14 \ No newline at end of file 14 \ No newline at end of file
setup/upgrade/upgradeUtil.php
@@ -64,16 +64,15 @@ class UpgradeUtil extends InstallUtil { @@ -64,16 +64,15 @@ class UpgradeUtil extends InstallUtil {
64 public function error($error) { 64 public function error($error) {
65 $template_vars['error'] = $error; 65 $template_vars['error'] = $error;
66 $file = "templates/error.tpl"; 66 $file = "templates/error.tpl";
67 - if (file_exists($file)) {  
68 - extract($template_vars); // Extract the vars to local namespace  
69 - ob_start();  
70 - include($file);  
71 - $contents = ob_get_contents();  
72 - ob_end_clean();  
73 - echo $contents; 67 + if (!file_exists($file)) {
  68 + return false;
74 } 69 }
75 -  
76 - return false; 70 + extract($template_vars); // Extract the vars to local namespace
  71 + ob_start();
  72 + include($file);
  73 + $contents = ob_get_contents();
  74 + ob_end_clean();
  75 + echo $contents;
77 } 76 }
78 77
79 public function loadInstallIni($path) { 78 public function loadInstallIni($path) {
@@ -100,16 +99,15 @@ class UpgradeUtil extends InstallUtil { @@ -100,16 +99,15 @@ class UpgradeUtil extends InstallUtil {
100 } 99 }
101 } 100 }
102 $file = "templates/" . $template; 101 $file = "templates/" . $template;
103 - if (file_exists($file)) {  
104 - extract($template_vars); // Extract the vars to local namespace  
105 - ob_start();  
106 - include($file);  
107 - $contents = ob_get_contents();  
108 - ob_end_clean();  
109 - echo $contents; 102 + if (!file_exists($file)) {
  103 + return false;
110 } 104 }
111 -  
112 - return false; 105 + extract($template_vars); // Extract the vars to local namespace
  106 + ob_start();
  107 + include($file);
  108 + $contents = ob_get_contents();
  109 + ob_end_clean();
  110 + echo $contents;
113 } 111 }
114 112
115 /** 113 /**
@@ -135,7 +133,7 @@ class UpgradeUtil extends InstallUtil { @@ -135,7 +133,7 @@ class UpgradeUtil extends InstallUtil {
135 133
136 $adminUser = $oKTConfig->get('db/dbAdminUser'); 134 $adminUser = $oKTConfig->get('db/dbAdminUser');
137 $adminPwd = $oKTConfig->get('db/dbAdminPass'); 135 $adminPwd = $oKTConfig->get('db/dbAdminPass');
138 -// $dbHost = $oKTConfig->get('db/dbHost'); 136 + $dbHost = $oKTConfig->get('db/dbHost');
139 $dbName = $oKTConfig->get('db/dbName'); 137 $dbName = $oKTConfig->get('db/dbName');
140 $dbPort = trim($oKTConfig->get('db/dbPort')); 138 $dbPort = trim($oKTConfig->get('db/dbPort'));
141 if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port'); 139 if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port');
@@ -160,7 +158,7 @@ class UpgradeUtil extends InstallUtil { @@ -160,7 +158,7 @@ class UpgradeUtil extends InstallUtil {
160 $mechanism="--port=\"$dbPort\""; 158 $mechanism="--port=\"$dbPort\"";
161 } 159 }
162 160
163 -// $tmpdir = $this->resolveTempDir(); 161 + $tmpdir = $this->resolveTempDir();
164 162
165 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>"; 163 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>";
166 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>"; 164 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>";
@@ -195,13 +193,11 @@ class UpgradeUtil extends InstallUtil { @@ -195,13 +193,11 @@ class UpgradeUtil extends InstallUtil {
195 } 193 }
196 194
197 $oKTConfig =& KTConfig::getSingleton(); 195 $oKTConfig =& KTConfig::getSingleton();
198 -// $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir);  
199 - $mysqldir = $oKTConfig->get('backup/mysqlDirectory'); 196 + $mysqldir = $oKTConfig->get('backup/mysqlDirectory',$mysqldir);
200 $dirs[] = $mysqldir; 197 $dirs[] = $mysqldir;
201 198
202 if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false) { 199 if (strpos(__FILE__,'knowledgeTree') !== false && strpos(__FILE__,'ktdms') != false) {
203 -// $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');  
204 - $dirs [] = realpath('/../../mysql/bin'); 200 + $dirs [] = realpath(dirname($FILE) . '/../../mysql/bin');
205 } 201 }
206 202
207 foreach($dirs as $dir) 203 foreach($dirs as $dir)
setup/upgrade/upgradeWizard.php
@@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes @@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes
52 if ($class == "template") { // Load existing templating classes 52 if ($class == "template") { // Load existing templating classes
53 require_once("../wizard/template.php"); 53 require_once("../wizard/template.php");
54 require_once("../wizard/lib/helpers/htmlHelper.php"); 54 require_once("../wizard/lib/helpers/htmlHelper.php");
  55 + return ;
  56 + }
  57 + if(file_exists(WIZARD_DIR."$class.php")) {
  58 + require_once(WIZARD_DIR."$class.php");
  59 + } elseif (file_exists(STEP_DIR."$class.php")) {
  60 + require_once(STEP_DIR."$class.php");
  61 + } elseif (file_exists(WIZARD_LIB."$class.php")) {
  62 + require_once(WIZARD_LIB."$class.php");
55 } else { 63 } else {
56 - if(file_exists(WIZARD_DIR."$class.php")) {  
57 - require_once(WIZARD_DIR."$class.php");  
58 - } elseif (file_exists(STEP_DIR."$class.php")) {  
59 - require_once(STEP_DIR."$class.php");  
60 - } elseif (file_exists(WIZARD_LIB."$class.php")) {  
61 - require_once(WIZARD_LIB."$class.php");  
62 - } 64 + return null;
63 } 65 }
64 -  
65 - return true;  
66 } 66 }
67 67
68 class UpgradeWizard { 68 class UpgradeWizard {
@@ -191,7 +191,26 @@ class UpgradeWizard { @@ -191,7 +191,26 @@ class UpgradeWizard {
191 * @return mixed 191 * @return mixed
192 */ 192 */
193 public function systemChecks() { 193 public function systemChecks() {
194 - return true; // for now we don't write to any locations 194 + // for now we don't write to any of these locations
  195 + return true;
  196 +
  197 + $res = $this->util->checkStructurePermissions();
  198 + if($res === true) return $res;
  199 + switch ($res) {
  200 + case "wizard":
  201 + $this->util->error("Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)");
  202 + return 'Upgrader directory is not writable (KT_Installation_Directory/setup/upgrade/)';
  203 + break;
  204 + case "/":
  205 + $this->util->error("System root is not writable (KT_Installation_Directory/)");
  206 + return "System root is not writable (KT_Installation_Directory/)";
  207 + break;
  208 + default:
  209 + return true;
  210 + break;
  211 + }
  212 +
  213 + return $res;
195 } 214 }
196 215
197 /** 216 /**
setup/upgrade/upgrader.php
@@ -157,7 +157,7 @@ class Upgrader { @@ -157,7 +157,7 @@ class Upgrader {
157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 } catch (Exception $e) { 158 } catch (Exception $e) {
159 $util = new UpgradeUtil(); 159 $util = new UpgradeUtil();
160 - $util->error("Error reading configuration file: $e"); 160 + $util->error("Error reading configuration file: $name");
161 exit(); 161 exit();
162 } 162 }
163 } 163 }
@@ -431,7 +431,8 @@ class Upgrader { @@ -431,7 +431,8 @@ class Upgrader {
431 if($class->runUpgrade()) { // Check if step needs to be upgraded 431 if($class->runUpgrade()) { // Check if step needs to be upgraded
432 $class->setDataFromSession($className); // Set Session Information 432 $class->setDataFromSession($className); // Set Session Information
433 $class->setPostConfig(); // Set any posted variables 433 $class->setPostConfig(); // Set any posted variables
434 - $class->upgradeStep(); // Run upgrade step 434 + $response = $class->upgradeStep(); // Run upgrade step
  435 + // TODO : Break on error response
435 } 436 }
436 } else { 437 } else {
437 $util = new UpgradeUtil(); 438 $util = new UpgradeUtil();
setup/wizard/iniUtilities.php
@@ -63,12 +63,11 @@ class iniUtilities { @@ -63,12 +63,11 @@ class iniUtilities {
63 return false; 63 return false;
64 } 64 }
65 $date = date('YmdHis'); 65 $date = date('YmdHis');
  66 +
66 $backupFile = $iniFile . '.' .$date; 67 $backupFile = $iniFile . '.' .$date;
67 if (is_writeable($backupFile)) { 68 if (is_writeable($backupFile)) {
68 file_put_contents($backupFile, $content); 69 file_put_contents($backupFile, $content);
69 } 70 }
70 -  
71 - return true;  
72 } 71 }
73 72
74 function read($iniFile) { 73 function read($iniFile) {
@@ -154,20 +153,13 @@ class iniUtilities { @@ -154,20 +153,13 @@ class iniUtilities {
154 } 153 }
155 154
156 function itemExists($checkSection, $checkItem) { 155 function itemExists($checkSection, $checkItem) {
157 -/*  
158 - foreach ($items as $key => $value) {  
159 - if($key == $checkItem) {  
160 - return true;  
161 - }  
162 - }  
163 -*/ 156 +
164 $this->exists = ''; 157 $this->exists = '';
165 foreach($this->cleanArray as $section => $items) { 158 foreach($this->cleanArray as $section => $items) {
166 if($section == $checkSection) { 159 if($section == $checkSection) {
167 $this->exists = 'section'; 160 $this->exists = 'section';
168 - $items = array_flip($items);  
169 - foreach ($items as $value) {  
170 - if($value == $checkItem) { 161 + foreach ($items as $key => $value) {
  162 + if($key == $checkItem) {
171 return true; 163 return true;
172 } 164 }
173 } 165 }
setup/wizard/installUtil.php
@@ -70,16 +70,15 @@ class InstallUtil { @@ -70,16 +70,15 @@ class InstallUtil {
70 public function error($error) { 70 public function error($error) {
71 $template_vars['error'] = $error; 71 $template_vars['error'] = $error;
72 $file = "templates/error.tpl"; 72 $file = "templates/error.tpl";
73 - if (file_exists($file)) {  
74 - extract($template_vars); // Extract the vars to local namespace  
75 - ob_start();  
76 - include($file);  
77 - $contents = ob_get_contents();  
78 - ob_end_clean();  
79 - echo $contents; 73 + if (!file_exists($file)) {
  74 + return false;
80 } 75 }
81 -  
82 - return false; 76 + extract($template_vars); // Extract the vars to local namespace
  77 + ob_start();
  78 + include($file);
  79 + $contents = ob_get_contents();
  80 + ob_end_clean();
  81 + echo $contents;
83 } 82 }
84 /** 83 /**
85 * Check if system needs to be installed 84 * Check if system needs to be installed
@@ -166,8 +165,7 @@ class InstallUtil { @@ -166,8 +165,7 @@ class InstallUtil {
166 return $url; 165 return $url;
167 } 166 }
168 if (!empty($protocol)) { 167 if (!empty($protocol)) {
169 - $array = explode(':', $url, 2);  
170 - $url = $protocol .':'. end($array); 168 + $url = $protocol .':'. end($array = explode(':', $url, 2));
171 } 169 }
172 if (!empty($port)) { 170 if (!empty($port)) {
173 $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i', 171 $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
@@ -323,15 +321,13 @@ class InstallUtil { @@ -323,15 +321,13 @@ class InstallUtil {
323 while (($file = readdir($dh)) !== false) { 321 while (($file = readdir($dh)) !== false) {
324 if($file != '.' && $file != '..') { 322 if($file != '.' && $file != '..') {
325 $fullpath = $path.'/'.$file; 323 $fullpath = $path.'/'.$file;
326 - if(is_link($fullpath)) { 324 + if(is_link($fullpath))
327 return false; 325 return false;
328 - } elseif(!is_dir($fullpath)) { 326 + elseif(!is_dir($fullpath)) {
329 $perms = substr(sprintf('%o', fileperms($fullpath)), -4); 327 $perms = substr(sprintf('%o', fileperms($fullpath)), -4);
330 - if($perms != $filemode) {  
331 - if (!chmod($fullpath, $filemode)) { 328 + if($perms != $filemode)
  329 + if (!chmod($fullpath, $filemode))
332 return false; 330 return false;
333 - }  
334 - }  
335 } elseif(!$this->chmodRecursive($fullpath, $filemode)) 331 } elseif(!$this->chmodRecursive($fullpath, $filemode))
336 return false; 332 return false;
337 } 333 }
@@ -358,8 +354,7 @@ class InstallUtil { @@ -358,8 +354,7 @@ class InstallUtil {
358 */ 354 */
359 public function canWriteFile($filename) { 355 public function canWriteFile($filename) {
360 $fh = fopen($filename, "w+"); 356 $fh = fopen($filename, "w+");
361 - $fr = fwrite($fh, 'test');  
362 - if($fr === false) { 357 + if($fr = fwrite($fh, 'test') === false) {
363 return false; 358 return false;
364 } 359 }
365 360
@@ -377,9 +372,9 @@ class InstallUtil { @@ -377,9 +372,9 @@ class InstallUtil {
377 */ 372 */
378 public function javaBridge() { 373 public function javaBridge() {
379 try { 374 try {
380 - new Java('java.lang.System'); 375 + $javaSystem = new Java('java.lang.System');
381 } catch (JavaException $e) { 376 } catch (JavaException $e) {
382 - return $e; 377 + return false;
383 } 378 }
384 return true; 379 return true;
385 } 380 }
@@ -768,7 +763,6 @@ class InstallUtil { @@ -768,7 +763,6 @@ class InstallUtil {
768 * @return string 763 * @return string
769 */ 764 */
770 public function installEnvironment() { 765 public function installEnvironment() {
771 - $matches = false;  
772 preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type 766 preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type
773 if($matches) { 767 if($matches) {
774 return 'Zend'; 768 return 'Zend';
@@ -798,7 +792,7 @@ class InstallUtil { @@ -798,7 +792,7 @@ class InstallUtil {
798 array_pop($sysdir); 792 array_pop($sysdir);
799 array_pop($sysdir); 793 array_pop($sysdir);
800 $zendsys = ''; 794 $zendsys = '';
801 - foreach ($sysdir as $v) { 795 + foreach ($sysdir as $k=>$v) {
802 $zendsys .= $v.DS; 796 $zendsys .= $v.DS;
803 } 797 }
804 return $zendsys."ZendServer".DS."bin".DS; 798 return $zendsys."ZendServer".DS."bin".DS;
@@ -821,16 +815,15 @@ class InstallUtil { @@ -821,16 +815,15 @@ class InstallUtil {
821 if(WINDOWS_OS) { // Mysql bin [Windows] 815 if(WINDOWS_OS) { // Mysql bin [Windows]
822 $serverPaths = explode(';',$_SERVER['PATH']); 816 $serverPaths = explode(';',$_SERVER['PATH']);
823 foreach ($serverPaths as $apath) { 817 foreach ($serverPaths as $apath) {
824 - $matches = false;  
825 preg_match('/mysql/i', $apath, $matches); 818 preg_match('/mysql/i', $apath, $matches);
826 if($matches) { 819 if($matches) {
827 return $apath.DS; 820 return $apath.DS;
828 break; 821 break;
829 } 822 }
830 } 823 }
  824 + } else {
  825 + return "mysql"; // Assume its linux and can be executed from command line
831 } 826 }
832 -  
833 - return "mysql"; // Assume its linux and can be executed from command line  
834 } 827 }
835 828
836 public function sqlInstallDir() { 829 public function sqlInstallDir() {
setup/wizard/installWizard.php
@@ -62,13 +62,9 @@ function __autoload($class) { // Attempt and autoload classes @@ -62,13 +62,9 @@ function __autoload($class) { // Attempt and autoload classes
62 } else { 62 } else {
63 if(preg_match('/Helper/', $class)) { 63 if(preg_match('/Helper/', $class)) {
64 require_once(HELPER_DIR."$class.php"); 64 require_once(HELPER_DIR."$class.php");
65 - } else if(preg_match('/Test/i', $class)) {  
66 - if($_GET['step'] != '') {  
67 - require_once(TEST_DIR."$class.php");  
68 - }  
69 } 65 }
  66 + return null;
70 } 67 }
71 - return true;  
72 } 68 }
73 69
74 class InstallWizard { 70 class InstallWizard {
@@ -100,15 +96,6 @@ class InstallWizard { @@ -100,15 +96,6 @@ class InstallWizard {
100 protected $util = null; 96 protected $util = null;
101 97
102 /** 98 /**
103 - * Step name  
104 - *  
105 - * @author KnowledgeTree Team  
106 - * @access protected  
107 - * @var mixed  
108 - */  
109 - protected $stepName = '';  
110 -  
111 - /**  
112 * Constructs installation wizard object 99 * Constructs installation wizard object
113 * 100 *
114 * @author KnowledgeTree Team 101 * @author KnowledgeTree Team
@@ -196,27 +183,15 @@ class InstallWizard { @@ -196,27 +183,15 @@ class InstallWizard {
196 } 183 }
197 184
198 /** 185 /**
199 - * Is the step being accessed directly 186 + * Bypass and force an install
200 * 187 *
201 * @author KnowledgeTree Team 188 * @author KnowledgeTree Team
202 - * @access public  
203 - * @param none  
204 - * @return boolean  
205 - */  
206 - public function isActionOnStep() {  
207 - return $this->stepName;  
208 - }  
209 -  
210 - /**  
211 - * Set step being accessed directly  
212 - *  
213 - * @author KnowledgeTree Team  
214 - * @access public 189 + * @access private
215 * @param none 190 * @param none
216 * @return boolean 191 * @return boolean
217 */ 192 */
218 - private function setStep($stepName) {  
219 - $this->stepName = $stepName; 193 + private function bypass() {
  194 +
220 } 195 }
221 196
222 /** 197 /**
@@ -256,9 +231,6 @@ class InstallWizard { @@ -256,9 +231,6 @@ class InstallWizard {
256 if(isset($_GET['bypass'])) { 231 if(isset($_GET['bypass'])) {
257 $this->setBypass($_GET['bypass']); 232 $this->setBypass($_GET['bypass']);
258 } 233 }
259 - if(isset($_GET['step'])) {  
260 - $this->setStep($_GET['step']);  
261 - }  
262 if(isset($_GET['debug'])) { 234 if(isset($_GET['debug'])) {
263 $this->setDebugLevel($_GET['debug']); 235 $this->setDebugLevel($_GET['debug']);
264 } else { 236 } else {
@@ -291,6 +263,8 @@ class InstallWizard { @@ -291,6 +263,8 @@ class InstallWizard {
291 return true; 263 return true;
292 break; 264 break;
293 } 265 }
  266 +
  267 + return $res;
294 } 268 }
295 269
296 /** 270 /**
@@ -304,14 +278,10 @@ class InstallWizard { @@ -304,14 +278,10 @@ class InstallWizard {
304 public function dispatch() { 278 public function dispatch() {
305 $this->load(); 279 $this->load();
306 if($this->getBypass() === "1") { // Helper to force install 280 if($this->getBypass() === "1") { // Helper to force install
307 - $this->removeInstallFile(); 281 + $this->removeInstallFile(); // TODO: Remove
308 } elseif ($this->getBypass() === "0") { 282 } elseif ($this->getBypass() === "0") {
309 $this->createInstallFile(); 283 $this->createInstallFile();
310 } 284 }
311 - if($this->isActionOnStep()) { // Testing purposes  
312 - $testStepClass = $this->stepName."Test";  
313 - new $testStepClass();  
314 - }  
315 if(!$this->isSystemInstalled()) { // Check if the systems not installed 285 if(!$this->isSystemInstalled()) { // Check if the systems not installed
316 if($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed 286 if($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed
317 $this->util->redirect('../migrate'); 287 $this->util->redirect('../migrate');
@@ -326,7 +296,7 @@ class InstallWizard { @@ -326,7 +296,7 @@ class InstallWizard {
326 } 296 }
327 } else { 297 } else {
328 // TODO: Die gracefully 298 // TODO: Die gracefully
329 - $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:80px;float:none'>Goto Login</a>"); 299 + $this->util->error("System has been installed <a href='../../login.php' class='back' style='width:80px;float:none' class='back button_next'>Goto Login</a>");
330 } 300 }
331 } 301 }
332 } 302 }
setup/wizard/installer.php
@@ -157,7 +157,7 @@ class Installer { @@ -157,7 +157,7 @@ class Installer {
157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 } catch (Exception $e) { 158 } catch (Exception $e) {
159 $util = new InstallUtil(); 159 $util = new InstallUtil();
160 - $util->error("Error reading configuration file: $e"); 160 + $util->error("Error reading configuration file: $name");
161 exit(); 161 exit();
162 } 162 }
163 } 163 }
@@ -431,7 +431,8 @@ class Installer { @@ -431,7 +431,8 @@ class Installer {
431 if($class->runInstall()) { // Check if step needs to be installed 431 if($class->runInstall()) { // Check if step needs to be installed
432 $class->setDataFromSession($className); // Set Session Information 432 $class->setDataFromSession($className); // Set Session Information
433 $class->setPostConfig(); // Set any posted variables 433 $class->setPostConfig(); // Set any posted variables
434 - $class->installStep(); // Run install step 434 + $response = $class->installStep(); // Run install step
  435 + // TODO : Break on error response
435 } 436 }
436 } else { 437 } else {
437 $util = new InstallUtil(); 438 $util = new InstallUtil();
setup/wizard/lib/helpers/htmlHelper.php
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 */ 41 */
42 class htmlHelper { 42 class htmlHelper {
43 43
44 - private $tags = array( 44 + var $tags = array(
45 'meta' => '<meta%s/>', 45 'meta' => '<meta%s/>',
46 'metalink' => '<link href="%s"%s/>', 46 'metalink' => '<link href="%s"%s/>',
47 'link' => '<a href="%s"%s>%s</a>', 47 'link' => '<a href="%s"%s>%s</a>',
@@ -96,76 +96,76 @@ class htmlHelper { @@ -96,76 +96,76 @@ class htmlHelper {
96 'error' => '<div%s>%s</div>' 96 'error' => '<div%s>%s</div>'
97 ); 97 );
98 98
99 - public function __construct() {  
100 - }  
101 -  
102 - public function js($name) {  
103 - return "<script type=\"text/javascript\" src=\"../wizard/resources/js/$name\"></script>";  
104 - }  
105 -  
106 - public function css($name) {  
107 - return "<link rel=\"stylesheet\" type=\"text/css\" href=\"../wizard/resources/css/$name\" />";  
108 - }  
109 -  
110 - public function image($name, $options = array()) {  
111 - $path = "../wizard/resources/graphics/$name";  
112 - $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' '));  
113 -  
114 - return $image;  
115 - }  
116 -  
117 - public function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {  
118 - if (is_array($options)) {  
119 - $options = array_merge(array('escape' => true), $options); 99 + function __construct() {
  100 + }
120 101
121 - if (!is_array($exclude)) {  
122 - $exclude = array(); 102 + function js($name) {
  103 + return "<script type=\"text/javascript\" src=\"../wizard/resources/js/$name\"></script>";
123 } 104 }
124 - $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape')));  
125 - $values = array_intersect_key(array_values($options), $keys);  
126 - $escape = $options['escape'];  
127 - $attributes = array();  
128 105
129 - foreach ($keys as $index => $key) {  
130 - $attributes[] = $this->__formatAttribute($key, $values[$index], $escape); 106 + function css($name) {
  107 + return "<link rel=\"stylesheet\" type=\"text/css\" href=\"../wizard/resources/css/$name\" />";
131 } 108 }
132 - $out = implode(' ', $attributes);  
133 - } else {  
134 - $out = $options; 109 +
  110 + function image($name, $options = array()) {
  111 + $path = "../wizard/resources/graphics/$name";
  112 + $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' '));
  113 +
  114 + return $image;
135 } 115 }
136 - return $out ? $insertBefore . $out . $insertAfter : '';  
137 - } 116 +
  117 + function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
  118 + if (is_array($options)) {
  119 + $options = array_merge(array('escape' => true), $options);
138 120
139 - public function __formatAttribute($key, $value, $escape = true) { 121 + if (!is_array($exclude)) {
  122 + $exclude = array();
  123 + }
  124 + $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape')));
  125 + $values = array_intersect_key(array_values($options), $keys);
  126 + $escape = $options['escape'];
  127 + $attributes = array();
  128 +
  129 + foreach ($keys as $index => $key) {
  130 + $attributes[] = $this->__formatAttribute($key, $values[$index], $escape);
  131 + }
  132 + $out = implode(' ', $attributes);
  133 + } else {
  134 + $out = $options;
  135 + }
  136 + return $out ? $insertBefore . $out . $insertAfter : '';
  137 + }
  138 +
  139 + function __formatAttribute($key, $value, $escape = true) {
140 $attribute = ''; 140 $attribute = '';
141 $attributeFormat = '%s="%s"'; 141 $attributeFormat = '%s="%s"';
142 $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize'); 142 $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');
143 if (is_array($value)) { 143 if (is_array($value)) {
144 - $value = ''; 144 + $value = '';
145 } 145 }
146 - 146 +
147 if (in_array($key, $minimizedAttributes)) { 147 if (in_array($key, $minimizedAttributes)) {
148 - if ($value === 1 || $value === true || $value === 'true' || $value == $key) {  
149 - $attribute = sprintf($attributeFormat, $key, $key);  
150 - } 148 + if ($value === 1 || $value === true || $value === 'true' || $value == $key) {
  149 + $attribute = sprintf($attributeFormat, $key, $key);
  150 + }
151 } else { 151 } else {
152 - $attribute = sprintf($attributeFormat, $key, $this->ife($escape, $this->h($value), $value)); 152 + $attribute = sprintf($attributeFormat, $key, $this->ife($escape, $this->h($value), $value));
153 } 153 }
154 return $attribute; 154 return $attribute;
155 } 155 }
156 156
157 - public function ife($condition, $val1 = null, $val2 = null) { 157 + function ife($condition, $val1 = null, $val2 = null) {
158 if (!empty($condition)) { 158 if (!empty($condition)) {
159 - return $val1; 159 + return $val1;
160 } 160 }
161 return $val2; 161 return $val2;
162 } 162 }
163 163
164 - public function h($text, $charset = 'UTF-8') { 164 + function h($text, $charset = 'UTF-8') {
165 if (is_array($text)) { 165 if (is_array($text)) {
166 - return array_map('h', $text); 166 + return array_map('h', $text);
167 } 167 }
168 return htmlspecialchars($text, ENT_QUOTES, $charset); 168 return htmlspecialchars($text, ENT_QUOTES, $charset);
169 - } 169 +}
170 } 170 }
171 ?> 171 ?>
172 \ No newline at end of file 172 \ No newline at end of file
setup/wizard/lib/services/unixLucene.php
@@ -59,7 +59,7 @@ class unixLucene extends unixService { @@ -59,7 +59,7 @@ class unixLucene extends unixService {
59 * @param string 59 * @param string
60 * @return void 60 * @return void
61 */ 61 */
62 - public function load() { 62 + public function load($options = null) {
63 $this->setLuceneSource("ktlucene.jar"); 63 $this->setLuceneSource("ktlucene.jar");
64 $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); 64 $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS);
65 $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); 65 $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS);
@@ -155,8 +155,7 @@ class unixLucene extends unixService { @@ -155,8 +155,7 @@ class unixLucene extends unixService {
155 $response = $this->util->pexec($cmd); 155 $response = $this->util->pexec($cmd);
156 return $response; 156 return $response;
157 } 157 }
158 -  
159 - return $state; 158 +
160 } 159 }
161 160
162 public function install() { 161 public function install() {
@@ -174,7 +173,6 @@ class unixLucene extends unixService { @@ -174,7 +173,6 @@ class unixLucene extends unixService {
174 if(is_array($response['out'])) { 173 if(is_array($response['out'])) {
175 if(count($response['out']) > 1) { 174 if(count($response['out']) > 1) {
176 foreach ($response['out'] as $r) { 175 foreach ($response['out'] as $r) {
177 - $matches = false;  
178 preg_match('/grep/', $r, $matches); // Ignore grep 176 preg_match('/grep/', $r, $matches); // Ignore grep
179 if(!$matches) { 177 if(!$matches) {
180 return 'STARTED'; 178 return 'STARTED';
@@ -209,14 +207,20 @@ class unixLucene extends unixService { @@ -209,14 +207,20 @@ class unixLucene extends unixService {
209 $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!"; 207 $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!";
210 if(DEBUG) { 208 if(DEBUG) {
211 echo "Command : $cmd<br/>"; 209 echo "Command : $cmd<br/>";
212 - return true; 210 + return ;
213 } 211 }
214 $response = $this->util->pexec($cmd); 212 $response = $this->util->pexec($cmd);
215 213
216 return $response; 214 return $response;
  215 + } elseif ($state == '') {
  216 + // Start Service
  217 + return true;
  218 + } else {
  219 + // Service Running Already
  220 + return true;
217 } 221 }
218 222
219 - return true; 223 + return false;
220 } 224 }
221 225
222 public function getName() { 226 public function getName() {
setup/wizard/lib/services/unixOpenOffice.php
@@ -106,14 +106,13 @@ class unixOpenOffice extends unixService { @@ -106,14 +106,13 @@ class unixOpenOffice extends unixService {
106 } 106 }
107 } 107 }
108 108
109 - public function status() { 109 + public function status($updrade = false) {
110 sleep(1); 110 sleep(1);
111 $cmd = "ps ax | grep soffice"; 111 $cmd = "ps ax | grep soffice";
112 $response = $this->util->pexec($cmd); 112 $response = $this->util->pexec($cmd);
113 if(is_array($response['out'])) { 113 if(is_array($response['out'])) {
114 if(count($response['out']) > 1) { 114 if(count($response['out']) > 1) {
115 foreach ($response['out'] as $r) { 115 foreach ($response['out'] as $r) {
116 - $matches = false;  
117 preg_match('/grep/', $r, $matches); // Ignore grep 116 preg_match('/grep/', $r, $matches); // Ignore grep
118 if(!$matches) { 117 if(!$matches) {
119 return 'STARTED'; 118 return 'STARTED';
@@ -138,17 +137,23 @@ class unixOpenOffice extends unixService { @@ -138,17 +137,23 @@ class unixOpenOffice extends unixService {
138 public function start() { 137 public function start() {
139 $state = $this->status(); 138 $state = $this->status();
140 if($state != 'STARTED') { 139 if($state != 'STARTED') {
141 - $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -accept="socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." &1> /dev/null &"; 140 + $cmd = "nohup ".$this->getBin().' -nofirststartwizard -nologo -headless -"accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" '." > /dev/null 2>&1 & echo $!";
142 if(DEBUG) { 141 if(DEBUG) {
143 echo "Command : $cmd<br/>"; 142 echo "Command : $cmd<br/>";
144 - return true; 143 + return ;
145 } 144 }
146 $response = $this->util->pexec($cmd); 145 $response = $this->util->pexec($cmd);
147 146
148 return $response; 147 return $response;
  148 + } elseif ($state == '') {
  149 + // Start Service
  150 + return true;
  151 + } else {
  152 + // Service Running Already
  153 + return true;
149 } 154 }
150 155
151 - return true; 156 + return false;
152 } 157 }
153 158
154 /** 159 /**
setup/wizard/lib/services/unixScheduler.php
@@ -57,7 +57,7 @@ class unixScheduler extends unixService { @@ -57,7 +57,7 @@ class unixScheduler extends unixService {
57 * @param string 57 * @param string
58 * @return void 58 * @return void
59 */ 59 */
60 - public function load() { 60 + public function load($options = null) {
61 $this->setPhpCli(); 61 $this->setPhpCli();
62 $this->scheduler = 'scheduler'; 62 $this->scheduler = 'scheduler';
63 $this->setSchedulerSource('schedulerTask.sh'); 63 $this->setSchedulerSource('schedulerTask.sh');
@@ -155,7 +155,6 @@ class unixScheduler extends unixService { @@ -155,7 +155,6 @@ class unixScheduler extends unixService {
155 if(is_array($response['out'])) { 155 if(is_array($response['out'])) {
156 if(count($response['out']) > 1) { 156 if(count($response['out']) > 1) {
157 foreach ($response['out'] as $r) { 157 foreach ($response['out'] as $r) {
158 - $matches = false;  
159 preg_match('/grep/', $r, $matches); // Ignore grep 158 preg_match('/grep/', $r, $matches); // Ignore grep
160 if(!$matches) { 159 if(!$matches) {
161 return 'STARTED'; 160 return 'STARTED';
@@ -191,7 +190,7 @@ class unixScheduler extends unixService { @@ -191,7 +190,7 @@ class unixScheduler extends unixService {
191 } 190 }
192 if(DEBUG) { 191 if(DEBUG) {
193 echo "Command : $cmd<br/>"; 192 echo "Command : $cmd<br/>";
194 - return true; 193 + return ;
195 } 194 }
196 $response = $this->util->pexec($cmd); 195 $response = $this->util->pexec($cmd);
197 196
setup/wizard/lib/services/windowsLucene.php
@@ -140,8 +140,8 @@ class windowsLucene extends windowsService { @@ -140,8 +140,8 @@ class windowsLucene extends windowsService {
140 * @param string 140 * @param string
141 * @return void 141 * @return void
142 */ 142 */
143 - public function load() {  
144 - $this->findJavaBin(); 143 + public function load($options = null) {
  144 + $this->setJavaBin();
145 $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); 145 $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver");
146 $this->setLuceneExe("KTLuceneService.exe"); 146 $this->setLuceneExe("KTLuceneService.exe");
147 $this->setJavaJVM(); 147 $this->setJavaJVM();
@@ -172,14 +172,14 @@ class windowsLucene extends windowsService { @@ -172,14 +172,14 @@ class windowsLucene extends windowsService {
172 } 172 }
173 173
174 /** 174 /**
175 - * Dind Java Directory path 175 + * Set Java Directory path
176 * 176 *
177 * @author KnowledgeTree Team 177 * @author KnowledgeTree Team
178 * @access private 178 * @access private
179 * @param string 179 * @param string
180 * @return void 180 * @return void
181 */ 181 */
182 - private function findJavaBin() { 182 + private function setJavaBin($javaBin = '') {
183 if($this->util->zendBridge()) { 183 if($this->util->zendBridge()) {
184 if($this->util->javaBridge()) { 184 if($this->util->javaBridge()) {
185 $this->javaSystem = new Java('java.lang.System'); 185 $this->javaSystem = new Java('java.lang.System');
@@ -379,8 +379,6 @@ class windowsLucene extends windowsService { @@ -379,8 +379,6 @@ class windowsLucene extends windowsService {
379 } else { 379 } else {
380 return false; 380 return false;
381 } 381 }
382 -  
383 - return true;  
384 } 382 }
385 383
386 /** 384 /**
@@ -409,11 +407,12 @@ class windowsLucene extends windowsService { @@ -409,11 +407,12 @@ class windowsLucene extends windowsService {
409 $luceneExe = $this->getLuceneExe(); 407 $luceneExe = $this->getLuceneExe();
410 $luceneSource = $this->getLuceneSource(); 408 $luceneSource = $this->getLuceneSource();
411 $luceneDir = $this->getluceneDir(); 409 $luceneDir = $this->getluceneDir();
  410 + $javaJVM = $this->getJavaJVM();
412 if($luceneExe && $luceneSource && $luceneDir) { 411 if($luceneExe && $luceneSource && $luceneDir) {
413 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto"; 412 $cmd = "\"{$luceneExe}\""." -install \"".$this->getName()."\" \"".$this->getJavaJVM(). "\" -Djava.class.path=\"".$luceneSource."\"". " -start ".$this->getLuceneServer(). " -out \"".$this->getLuceneOut()."\" -err \"".$this->getLuceneError()."\" -current \"".$luceneDir."\" -auto";
414 if(DEBUG) { 413 if(DEBUG) {
415 echo "Command : $cmd<br/>"; 414 echo "Command : $cmd<br/>";
416 - return true; 415 + return ;
417 } 416 }
418 $response = $this->util->pexec($cmd); 417 $response = $this->util->pexec($cmd);
419 return $response; 418 return $response;
setup/wizard/lib/services/windowsOpenOffice.php
@@ -183,11 +183,10 @@ class windowsOpenOffice extends windowsService { @@ -183,11 +183,10 @@ class windowsOpenOffice extends windowsService {
183 } 183 }
184 184
185 private function setWinservice($winservice = "winserv.exe") { 185 private function setWinservice($winservice = "winserv.exe") {
186 - if(file_exists(SYS_BIN_DIR . $winservice)) { 186 + if(file_exists(SYS_BIN_DIR . $winservice))
187 $this->winservice = SYS_BIN_DIR . $winservice; 187 $this->winservice = SYS_BIN_DIR . $winservice;
188 - } else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice)) { 188 + else if(file_exists(SYS_BIN_DIR . "win32" . DS. $winservice))
189 $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice; 189 $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
190 - }  
191 } 190 }
192 191
193 public function getWinservice() { 192 public function getWinservice() {
@@ -204,10 +203,10 @@ class windowsOpenOffice extends windowsService { @@ -204,10 +203,10 @@ class windowsOpenOffice extends windowsService {
204 //$binary = $this->util->openOfficeSpecified(); 203 //$binary = $this->util->openOfficeSpecified();
205 $binary = $this->getBin(); 204 $binary = $this->getBin();
206 if($binary != '') { 205 if($binary != '') {
207 - $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -accept=socket,host={$this->host},port={$this->port};urp;";; 206 + $cmd = "\"{$this->winservice}\" install $this->name "."-displayname {$this->name} -start auto \"".$binary."\" -headless -invisible -\"accept=socket,host={$this->host},port={$this->port};urp;\"";;
208 if(DEBUG) { 207 if(DEBUG) {
209 echo "Command : $cmd<br/>"; 208 echo "Command : $cmd<br/>";
210 - return true; 209 + return ;
211 } 210 }
212 $response = $this->util->pexec($cmd); 211 $response = $this->util->pexec($cmd);
213 return $response; 212 return $response;
setup/wizard/lib/services/windowsScheduler.php
@@ -85,7 +85,7 @@ class windowsScheduler extends windowsService { @@ -85,7 +85,7 @@ class windowsScheduler extends windowsService {
85 * @param string 85 * @param string
86 * @return void 86 * @return void
87 */ 87 */
88 - function load() { 88 + function load($options = null) {
89 $this->setSchedulerDIR($this->varDir."bin"); 89 $this->setSchedulerDIR($this->varDir."bin");
90 $this->setSchedulerScriptPath("taskrunner.bat"); 90 $this->setSchedulerScriptPath("taskrunner.bat");
91 $this->setSchedulerSource("schedulerService.php"); 91 $this->setSchedulerSource("schedulerService.php");
@@ -209,7 +209,7 @@ class windowsScheduler extends windowsService { @@ -209,7 +209,7 @@ class windowsScheduler extends windowsService {
209 echo '<pre>'; 209 echo '<pre>';
210 print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath())); 210 print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
211 echo '</pre>'; 211 echo '</pre>';
212 - return true; 212 + return ;
213 } 213 }
214 $response = win32_create_service(array( 214 $response = win32_create_service(array(
215 'service' => $this->name, 215 'service' => $this->name,
@@ -224,7 +224,7 @@ class windowsScheduler extends windowsService { @@ -224,7 +224,7 @@ class windowsScheduler extends windowsService {
224 $cmd = "\"{$this->winservice}\" install $this->name $this->options"; 224 $cmd = "\"{$this->winservice}\" install $this->name $this->options";
225 if(DEBUG) { 225 if(DEBUG) {
226 echo "Command : $cmd<br/>"; 226 echo "Command : $cmd<br/>";
227 - return true; 227 + return ;
228 } 228 }
229 $response = $this->util->pexec($cmd); 229 $response = $this->util->pexec($cmd);
230 return $response; 230 return $response;
setup/wizard/lib/services/windowsService.php
@@ -163,7 +163,7 @@ class windowsService extends Service { @@ -163,7 +163,7 @@ class windowsService extends Service {
163 * @return array 163 * @return array
164 */ 164 */
165 public function restart() { 165 public function restart() {
166 - $this->stop(); 166 + $response = $this->stop();
167 sleep(1); 167 sleep(1);
168 $this->start(); 168 $this->start();
169 } 169 }
setup/wizard/lib/system/config-path-mock
1 -/var/lib/knowledgetree  
2 -/var/lib/knowledgetree/Documents  
3 -/var/lib/knowledgetree/indexes 1 +/var/lib/knowledgetree-ce
  2 +/var/lib/knowledgetree-ce/Documents
  3 +/var/lib/knowledgetree-ce/indexes
4 /etc/knowledgetree/config.ini 4 /etc/knowledgetree/config.ini
5 -/var/log/knowledgetree  
6 -/var/tmp/knowledgetree  
7 -/var/tmp/knowledgetree/proxies  
8 -/var/tmp/knowledgetree/uploads  
9 -/var/tmp/knowledgetree/cache  
10 \ No newline at end of file 5 \ No newline at end of file
  6 +/var/log/knowledgetree-ce
  7 +/var/tmp/knowledgetree-ce
  8 +/var/tmp/knowledgetree-ce/proxies
  9 +/var/tmp/knowledgetree-ce/uploads
  10 +/var/tmp/knowledgetree-ce/cache
11 \ No newline at end of file 11 \ No newline at end of file
setup/wizard/lib/validation/luceneValidation.php
@@ -264,7 +264,7 @@ class luceneValidation extends serviceValidation { @@ -264,7 +264,7 @@ class luceneValidation extends serviceValidation {
264 public function binaryChecks() { 264 public function binaryChecks() {
265 if($this->util->javaSpecified()) { 265 if($this->util->javaSpecified()) {
266 $this->disableExtension = true; // Disable the use of the php bridge extension 266 $this->disableExtension = true; // Disable the use of the php bridge extension
267 - if($this->detSettings()) { // AutoDetect java settings 267 + if($this->detSettings(true)) { // AutoDetect java settings
268 return true; 268 return true;
269 } else { 269 } else {
270 $this->specifyJava(); // Ask for settings 270 $this->specifyJava(); // Ask for settings
@@ -274,16 +274,16 @@ class luceneValidation extends serviceValidation { @@ -274,16 +274,16 @@ class luceneValidation extends serviceValidation {
274 if($auto) { 274 if($auto) {
275 return $auto; 275 return $auto;
276 } else { 276 } else {
277 - $auto = $this->detSettings(); // Check if auto detected java works 277 + $auto = $this->useDetected(); // Check if auto detected java works
278 if($auto) { 278 if($auto) {
279 $this->disableExtension = true; // Disable the use of the php bridge extension 279 $this->disableExtension = true; // Disable the use of the php bridge extension
  280 + return $auto;
280 } else { 281 } else {
281 $this->specifyJava(); // Ask for settings 282 $this->specifyJava(); // Ask for settings
282 } 283 }
283 } 284 }
284 return $auto; 285 return $auto;
285 } 286 }
286 - return false;  
287 } 287 }
288 288
289 /** 289 /**
@@ -363,7 +363,7 @@ class luceneValidation extends serviceValidation { @@ -363,7 +363,7 @@ class luceneValidation extends serviceValidation {
363 * @access private 363 * @access private
364 * @return boolean 364 * @return boolean
365 */ 365 */
366 - private function detSettings() { 366 + private function detSettings($attempt = false) {
367 $javaExecutable = $this->util->javaSpecified();// Retrieve java bin 367 $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
368 if($javaExecutable == '') { 368 if($javaExecutable == '') {
369 if($this->java == '') { 369 if($this->java == '') {
@@ -388,7 +388,7 @@ class luceneValidation extends serviceValidation { @@ -388,7 +388,7 @@ class luceneValidation extends serviceValidation {
388 } 388 }
389 389
390 function windowsReadJVFromFile($cmd) { 390 function windowsReadJVFromFile($cmd) {
391 - $this->util->pexec($cmd); 391 + $response = $this->util->pexec($cmd);
392 if(file_exists($this->outputDir.'outJV')) { 392 if(file_exists($this->outputDir.'outJV')) {
393 $version = file_get_contents($this->outputDir.'outJV'); 393 $version = file_get_contents($this->outputDir.'outJV');
394 if($version != '') { 394 if($version != '') {
@@ -409,23 +409,21 @@ class luceneValidation extends serviceValidation { @@ -409,23 +409,21 @@ class luceneValidation extends serviceValidation {
409 } else { 409 } else {
410 $this->javaVersionWarning(); 410 $this->javaVersionWarning();
411 $this->javaCheck = 'cross_orange'; 411 $this->javaCheck = 'cross_orange';
412 -// if($attempt) { 412 + if($attempt) {
413 $this->javaExeMessage = "Incorrect java path specified"; 413 $this->javaExeMessage = "Incorrect java path specified";
414 $this->javaExeError = true; 414 $this->javaExeError = true;
415 $this->error[] = "Requires Java 1.5+ to be installed"; 415 $this->error[] = "Requires Java 1.5+ to be installed";
416 -// } 416 + }
417 417
418 return false; 418 return false;
419 } 419 }
420 } 420 }
421 - return false;  
422 } 421 }
423 422
424 function unixReadJVFromFile($cmd) { 423 function unixReadJVFromFile($cmd) {
425 - $this->util->pexec($cmd); 424 + $response = $this->util->pexec($cmd);
426 if(file_exists($this->outputDir.'outJV')) { 425 if(file_exists($this->outputDir.'outJV')) {
427 $tmp = file_get_contents($this->outputDir.'outJV'); 426 $tmp = file_get_contents($this->outputDir.'outJV');
428 - $matches = false;  
429 preg_match('/"(.*)"/',$tmp, $matches); 427 preg_match('/"(.*)"/',$tmp, $matches);
430 if($matches) { 428 if($matches) {
431 if($matches[1] < $this->javaVersion) { // Check Version of java 429 if($matches[1] < $this->javaVersion) { // Check Version of java
@@ -445,17 +443,27 @@ class luceneValidation extends serviceValidation { @@ -445,17 +443,27 @@ class luceneValidation extends serviceValidation {
445 } else { 443 } else {
446 $this->javaVersionWarning(); 444 $this->javaVersionWarning();
447 $this->javaCheck = 'cross_orange'; 445 $this->javaCheck = 'cross_orange';
448 -// if($attempt) { 446 + if($attempt) {
449 $this->javaExeMessage = "Incorrect java path specified"; 447 $this->javaExeMessage = "Incorrect java path specified";
450 $this->javaExeError = true; 448 $this->javaExeError = true;
451 $this->error[] = "Requires Java 1.5+ to be installed"; 449 $this->error[] = "Requires Java 1.5+ to be installed";
452 -// } 450 + }
453 451
454 return false; 452 return false;
455 } 453 }
456 } 454 }
457 -  
458 - return false; 455 + }
  456 +
  457 + /**
  458 + * Attempt detection without logging errors
  459 + *
  460 + * @author KnowledgeTree Team
  461 + * @param none
  462 + * @access private
  463 + * @return boolean
  464 + */
  465 + private function useDetected() {
  466 + return $this->detSettings();
459 } 467 }
460 468
461 /** 469 /**
setup/wizard/lib/validation/openofficeValidation.php
@@ -92,7 +92,7 @@ class openofficeValidation extends serviceValidation { @@ -92,7 +92,7 @@ class openofficeValidation extends serviceValidation {
92 * @access private 92 * @access private
93 * @var mixed 93 * @var mixed
94 */ 94 */
95 - private $windowsLocations = array("\"C:\Program Files\OpenOffice.org 3\program\"", "\"C:\OpenOffice.org 3\program\""); 95 + private $windowsLocations = array("C:\Program Files\OpenOffice.org 3\program", "C:\OpenOffice.org 3\program");
96 96
97 /** 97 /**
98 * Open Office unix locations 98 * Open Office unix locations
@@ -103,7 +103,7 @@ class openofficeValidation extends serviceValidation { @@ -103,7 +103,7 @@ class openofficeValidation extends serviceValidation {
103 */ 103 */
104 private $unixLocations = array("/usr/bin/"); 104 private $unixLocations = array("/usr/bin/");
105 105
106 - public function preset() { 106 + public function preset($options = null) {
107 $this->specifyOpenOffice(); 107 $this->specifyOpenOffice();
108 } 108 }
109 109
setup/wizard/lib/validation/schedulerValidation.php
@@ -92,37 +92,36 @@ class schedulerValidation extends serviceValidation { @@ -92,37 +92,36 @@ class schedulerValidation extends serviceValidation {
92 public function binaryChecks() { 92 public function binaryChecks() {
93 // TODO: Better detection 93 // TODO: Better detection
94 return true; 94 return true;
95 -// $this->setPhp();  
96 -// if($this->util->phpSpecified()) {  
97 -// return $this->detPhpSettings();  
98 -// } else {  
99 -// $this->specifyPhp();// Ask for settings  
100 -// return false;  
101 -// } 95 + $this->setPhp();
  96 + if($this->util->phpSpecified()) {
  97 + return $this->detPhpSettings();
  98 + } else {
  99 + $this->specifyPhp();// Ask for settings
  100 + return false;
  101 + }
102 } 102 }
103 103
104 function detPhpSettings() { 104 function detPhpSettings() {
105 // TODO: Better php handling 105 // TODO: Better php handling
106 return true; 106 return true;
107 -// $phpExecutable = $this->util->phpSpecified();// Retrieve java bin  
108 -// $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!";  
109 -// $this->util->pexec($cmd);  
110 -// if(file_exists($this->outputDir.'outPHP')) {  
111 -// $tmp = file_get_contents($this->outputDir.'outPHP');  
112 -// $matches = false;  
113 -// preg_match('/PHP/',$tmp, $matches);  
114 -// if($matches) {  
115 -// $this->phpCheck = 'tick';  
116 -//  
117 -// return true;  
118 -// } else {  
119 -// $this->phpCheck = 'cross_orange';  
120 -// $this->phpExeError = "PHP : Incorrect path specified";  
121 -// $this->error[] = "PHP executable required";  
122 -//  
123 -// return false;  
124 -// }  
125 -// } 107 + $phpExecutable = $this->util->phpSpecified();// Retrieve java bin
  108 + $cmd = "$phpExecutable -version > ".$this->outputDir."/outPHP 2>&1 echo $!";
  109 + $response = $this->util->pexec($cmd);
  110 + if(file_exists($this->outputDir.'outPHP')) {
  111 + $tmp = file_get_contents($this->outputDir.'outPHP');
  112 + preg_match('/PHP/',$tmp, $matches);
  113 + if($matches) {
  114 + $this->phpCheck = 'tick';
  115 +
  116 + return true;
  117 + } else {
  118 + $this->phpCheck = 'cross_orange';
  119 + $this->phpExeError = "PHP : Incorrect path specified";
  120 + $this->error[] = "PHP executable required";
  121 +
  122 + return false;
  123 + }
  124 + }
126 } 125 }
127 126
128 /** 127 /**
@@ -138,13 +137,13 @@ class schedulerValidation extends serviceValidation { @@ -138,13 +137,13 @@ class schedulerValidation extends serviceValidation {
138 } 137 }
139 138
140 private function setPhp() { 139 private function setPhp() {
141 - $phpDir = $this->util->useZendPhp();  
142 if($this->php != '') { // PHP Found 140 if($this->php != '') { // PHP Found
143 $this->phpCheck = 'tick'; 141 $this->phpCheck = 'tick';
144 - } elseif ($phpDir) { // Use System Defined Settings 142 + } elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings
145 $this->php = $phpDir; 143 $this->php = $phpDir;
  144 + } else {
  145 +
146 } 146 }
147 -  
148 $this->temp_variables['php']['location'] = $this->php; 147 $this->temp_variables['php']['location'] = $this->php;
149 } 148 }
150 149
setup/wizard/lib/validation/steps/databaseTest.php deleted
1 -<?php  
2 -  
3 -class databaseTest extends Test {  
4 - private $stepName = "database";  
5 - private $params = array();  
6 -  
7 - public function __construct() {  
8 - require_once(WIZARD_DIR."step.php");  
9 - require_once(WIZARD_DIR."installUtil.php");  
10 - require_once(WIZARD_DIR."path.php");  
11 - require_once(WIZARD_DIR."dbUtilities.php");  
12 - require_once(STEP_DIR."$this->stepName.php");  
13 - }  
14 -  
15 - /**  
16 - * Test database connectivity  
17 - *  
18 - * @author KnowledgeTree Team  
19 - * @param none  
20 - * @access public  
21 - * @return boolean  
22 - */  
23 - public function doAjaxTest($host, $uname, $dname) {  
24 - echo "$host, $uname, $dname";  
25 - die;  
26 - }  
27 -  
28 - public function doCreateSchema() {  
29 - $this->dhost = '127.0.0.1';  
30 - $this->duname = 'root';  
31 - $this->dpassword = 'root';  
32 - $this->dname = 'dms_install';  
33 - $this->dbbinary = 'mysql';  
34 - $this->dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);  
35 - $this->createSchema();  
36 - echo 'Schema loaded<br>';  
37 - }  
38 -}  
39 -  
40 -  
41 -?>  
42 \ No newline at end of file 0 \ No newline at end of file
setup/wizard/lib/validation/steps/test.php deleted
1 -<?php  
2 -class Test {  
3 - private $ignore = array('action', 'step', 'type');  
4 -  
5 - function __construct() {  
6 -  
7 - }  
8 -  
9 -// function dispatch() {  
10 - /*  
11 - if(isset($_GET['action'])) {  
12 - $class = $_GET['step']."Test";  
13 - $func = $_GET['action'];  
14 - if($func != '') {  
15 - foreach ($_GET as $k=>$v) {  
16 - if(in_array($k, $this->ignore)) {  
17 - $temp[] = $_GET[$k];  
18 - unset($_GET[$k]);  
19 - }  
20 - }  
21 - $funcargs = array_slice($_GET,0);  
22 - require_once("$class.php");  
23 - $Test = new $class();  
24 - $func_call = strtoupper(substr($func,0,1)).substr($func,1);  
25 - $method = "do$func_call";  
26 - call_user_func_array(array($Test, $method), $funcargs);  
27 - }  
28 - }  
29 - */  
30 -// }  
31 -}  
32 -  
33 -?>  
34 \ No newline at end of file 0 \ No newline at end of file
setup/wizard/path.php
@@ -114,7 +114,6 @@ @@ -114,7 +114,6 @@
114 define('SYS_DIR', WIZARD_LIB."system".DS); 114 define('SYS_DIR', WIZARD_LIB."system".DS);
115 define('HELPER_DIR', WIZARD_LIB."helpers".DS); 115 define('HELPER_DIR', WIZARD_LIB."helpers".DS);
116 define('VALID_DIR', WIZARD_LIB."validation".DS); 116 define('VALID_DIR', WIZARD_LIB."validation".DS);
117 - define('TEST_DIR', VALID_DIR."steps".DS);  
118 // Define paths to system webroot 117 // Define paths to system webroot
119 define('SYSTEM_DIR', $sys); 118 define('SYSTEM_DIR', $sys);
120 define('SYS_VAR_DIR', SYSTEM_DIR."var".DS); 119 define('SYS_VAR_DIR', SYSTEM_DIR."var".DS);
setup/wizard/resources/js/wizard.js
@@ -4,8 +4,7 @@ function wizard() { @@ -4,8 +4,7 @@ function wizard() {
4 4
5 // Toggle Advance Database options 5 // Toggle Advance Database options
6 wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details|php_ext_details|php_con_details 6 wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details|php_ext_details|php_con_details
7 - var state = $('.'+ele).attr('style');  
8 - if(state.match(/none/g) == 'none') { 7 + if($('.'+ele).attr('style') == 'display: none;') {
9 $('.'+ele).attr('style', 'display: block;'); 8 $('.'+ele).attr('style', 'display: block;');
10 if($('#'+option).attr('innerHTML') != '&nbsp;&nbsp;Advanced Options') 9 if($('#'+option).attr('innerHTML') != '&nbsp;&nbsp;Advanced Options')
11 $('#'+option).attr('innerHTML', 'Hide Details'); 10 $('#'+option).attr('innerHTML', 'Hide Details');
@@ -15,7 +14,7 @@ wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details @@ -15,7 +14,7 @@ wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details
15 $('#'+option).attr('innerHTML', 'Show Details'); 14 $('#'+option).attr('innerHTML', 'Show Details');
16 } 15 }
17 } 16 }
18 - //alert($('.'+ele) + " " + $('.'+ele).attr('style')); 17 +
19 // Focus on element 18 // Focus on element
20 wizard.prototype.focusElement = function(el) { 19 wizard.prototype.focusElement = function(el) {
21 el.focus(); 20 el.focus();
setup/wizard/session.php
@@ -228,4 +228,13 @@ class Session @@ -228,4 +228,13 @@ class Session
228 } 228 }
229 229
230 } 230 }
  231 +
  232 +if(isset($_GET['action'])) {
  233 + $func = $_GET['action'];
  234 + if($func != '') {
  235 + $ses = new Session();
  236 + $method = "$func";
  237 + $ses->$method();
  238 + }
  239 +}
231 ?> 240 ?>
232 \ No newline at end of file 241 \ No newline at end of file
setup/wizard/step.php
@@ -42,15 +42,6 @@ @@ -42,15 +42,6 @@
42 class Step 42 class Step
43 { 43 {
44 /** 44 /**
45 - * Salt to use in session  
46 - *  
47 - * @author KnowledgeTree Team  
48 - * @access private  
49 - * @var string  
50 - */  
51 - private $salt = 'installers';  
52 -  
53 - /**  
54 * List of variables to be loaded to template 45 * List of variables to be loaded to template
55 * 46 *
56 * @author KnowledgeTree Team 47 * @author KnowledgeTree Team
@@ -82,7 +73,7 @@ class Step @@ -82,7 +73,7 @@ class Step
82 * 73 *
83 * @author KnowledgeTree Team 74 * @author KnowledgeTree Team
84 * @access public 75 * @access public
85 - * @var boolean 76 + * @var array
86 */ 77 */
87 protected $storeInSession = false; 78 protected $storeInSession = false;
88 79
@@ -91,7 +82,7 @@ class Step @@ -91,7 +82,7 @@ class Step
91 * 82 *
92 * @author KnowledgeTree Team 83 * @author KnowledgeTree Team
93 * @access public 84 * @access public
94 - * @var boolean 85 + * @var array
95 */ 86 */
96 protected $runInstall = false; 87 protected $runInstall = false;
97 88
@@ -100,7 +91,7 @@ class Step @@ -100,7 +91,7 @@ class Step
100 * 91 *
101 * @author KnowledgeTree Team 92 * @author KnowledgeTree Team
102 * @access public 93 * @access public
103 - * @var boolean 94 + * @var string
104 */ 95 */
105 protected $order = false; 96 protected $order = false;
106 97
@@ -113,15 +104,10 @@ class Step @@ -113,15 +104,10 @@ class Step
113 */ 104 */
114 protected $silent = false; 105 protected $silent = false;
115 106
116 - /**  
117 - * Display the confirmation page first  
118 - *  
119 - * @author KnowledgeTree Team  
120 - * @access public  
121 - * @var boolean  
122 - */  
123 public $displayFirst = false; 107 public $displayFirst = false;
124 108
  109 + private $salt = 'installers';
  110 +
125 /** 111 /**
126 * Reference to utility object 112 * Reference to utility object
127 * 113 *
@@ -129,7 +115,7 @@ class Step @@ -129,7 +115,7 @@ class Step
129 * @access protected 115 * @access protected
130 * @var object 116 * @var object
131 */ 117 */
132 - public $util = null; 118 + public $util;
133 119
134 /** 120 /**
135 * Reference to utility object 121 * Reference to utility object
@@ -138,20 +124,12 @@ class Step @@ -138,20 +124,12 @@ class Step
138 * @access protected 124 * @access protected
139 * @var object 125 * @var object
140 */ 126 */
141 - public $dbhandler = null; 127 + public $dbhandler;
142 128
143 - /**  
144 - * Constructs step object  
145 - *  
146 - * @author KnowledgeTree Team  
147 - * @access public  
148 - * @param none  
149 - */  
150 public function __construct() { 129 public function __construct() {
151 $this->dbhandler = new dbUtilities(); 130 $this->dbhandler = new dbUtilities();
152 $this->util = new InstallUtil(); 131 $this->util = new InstallUtil();
153 } 132 }
154 -  
155 /** 133 /**
156 * Returns step state 134 * Returns step state
157 * 135 *
@@ -164,13 +142,6 @@ class Step @@ -164,13 +142,6 @@ class Step
164 return ''; 142 return '';
165 } 143 }
166 144
167 - /**  
168 - * Returns display flag  
169 - *  
170 - * @author KnowledgeTree Team  
171 - * @access public  
172 - * @var boolean  
173 - */  
174 public function displayFirst() { 145 public function displayFirst() {
175 return $this->displayFirst; 146 return $this->displayFirst;
176 } 147 }
@@ -212,6 +183,30 @@ class Step @@ -212,6 +183,30 @@ class Step
212 } 183 }
213 184
214 /** 185 /**
  186 + * Load default step values
  187 + *
  188 + * @author KnowledgeTree Team
  189 + * @param none
  190 + * @access public
  191 + * @return void
  192 + */
  193 + public function loadDefaults() {
  194 +
  195 + }
  196 +
  197 + /**
  198 + * Return default step values
  199 + *
  200 + * @author KnowledgeTree Team
  201 + * @param none
  202 + * @access public
  203 + * @return array
  204 + */
  205 + public function getDefaults() {
  206 + return array();
  207 + }
  208 +
  209 + /**
215 * Checks if edit button has been clicked 210 * Checks if edit button has been clicked
216 * 211 *
217 * @author KnowledgeTree Team 212 * @author KnowledgeTree Team
setup/wizard/stepAction.php
@@ -472,7 +472,7 @@ class stepAction { @@ -472,7 +472,7 @@ class stepAction {
472 * @access private 472 * @access private
473 * @return void 473 * @return void
474 */ 474 */
475 - private function _loadValueToSession($class, $k, $v) { 475 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
476 if($this->session != null) { 476 if($this->session != null) {
477 $this->session->setClass($class, $k, $v); 477 $this->session->setClass($class, $k, $v);
478 } else { 478 } else {
setup/wizard/steps/database.php
@@ -40,6 +40,16 @@ @@ -40,6 +40,16 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 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 + require_once("../dbUtilities.php");
  50 + }
  51 +}
  52 +
43 class database extends Step 53 class database extends Step
44 { 54 {
45 /** 55 /**
@@ -710,15 +720,15 @@ class database extends Step @@ -710,15 +720,15 @@ class database extends Step
710 */ 720 */
711 private function createDmsUser() { 721 private function createDmsUser() {
712 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; 722 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";";
713 - $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";  
714 - if ($this->dbhandler->execute($user1) && $this->dbhandler->execute($user2)) {  
715 - return true;  
716 - } else {  
717 - $this->error['con'] = "Could not create users for database: {$this->dname}";  
718 - return false;  
719 - }  
720 - }  
721 - 723 + $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";
  724 + if ($this->dbhandler->query($user1) && $this->dbhandler->query($user2)) {
  725 + return true;
  726 + } else {
  727 + $this->error['con'] = "Could not create users for database: {$this->dname}";
  728 + return false;
  729 + }
  730 + }
  731 +
722 /** 732 /**
723 * Create schema 733 * Create schema
724 * 734 *
@@ -800,7 +810,17 @@ class database extends Step @@ -800,7 +810,17 @@ class database extends Step
800 return $this->error; 810 return $this->error;
801 } 811 }
802 812
803 - 813 + /**
  814 + * Test database connectivity
  815 + *
  816 + * @author KnowledgeTree Team
  817 + * @param none
  818 + * @access public
  819 + * @return boolean
  820 + */
  821 + public function doAjaxTest($host, $uname, $dname) {
  822 +
  823 + }
804 824
805 /** 825 /**
806 * Initialize errors to false 826 * Initialize errors to false
@@ -816,8 +836,25 @@ class database extends Step @@ -816,8 +836,25 @@ class database extends Step
816 } 836 }
817 } 837 }
818 838
819 - 839 + public function doCreateSchema() {
  840 + $this->dhost = '127.0.0.1';
  841 + $this->duname = 'root';
  842 + $this->dpassword = 'root';
  843 + $this->dname = 'dms_install';
  844 + $this->dbbinary = 'mysql';
  845 + $this->dbhandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
  846 + $this->createSchema();
  847 + echo 'Schema loaded<br>';
  848 + }
820 } 849 }
821 850
822 - 851 +if(isset($_GET['action'])) {
  852 + $func = $_GET['action'];
  853 + if($func != '') {
  854 + $serv = new database();
  855 + $func_call = strtoupper(substr($func,0,1)).substr($func,1);
  856 + $method = "do$func_call";
  857 + $serv->$method();
  858 + }
  859 +}
823 ?> 860 ?>
824 \ No newline at end of file 861 \ No newline at end of file
setup/wizard/templates/complete.tpl
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php"; 131 $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php";
132 ?> 132 ?>
133 <?php if($migrate_check) { ?> 133 <?php if($migrate_check) { ?>
134 - <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> 134 + <a href="../upgrade" class="back button_next" style="width:190px;" onclick="javascript:{w.clearSessions();}">Goto Database Upgrade</a>
135 <?php } else { ?> 135 <?php } else { ?>
136 <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a> 136 <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
137 <?php } ?> 137 <?php } ?>
setup/wizard/templates/welcome.tpl
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 <p class="empty_space"> This wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.</p> 4 <p class="empty_space"> This wizard will lead you through all the steps required to install and configure KnowledgeTree on your server.</p>
5 <p class="empty_space"> 5 <p class="empty_space">
6 Press <b>Next</b> to continue.</p> 6 Press <b>Next</b> to continue.</p>
  7 + <div class="demo"><?php echo $html->image('kt_browse.png'); ?> </div>
7 </div> 8 </div>
8 <input type="submit" name="Next" value="Next" class="button_next"/> 9 <input type="submit" name="Next" value="Next" class="button_next"/>
9 <!-- <input type="submit" name="Migrate" value="Migrate" class="button_next"/>--> 10 <!-- <input type="submit" name="Migrate" value="Migrate" class="button_next"/>-->
sql/mysql/install/data.sql
@@ -1377,7 +1377,7 @@ INSERT INTO `scheduler_tasks` VALUES @@ -1377,7 +1377,7 @@ INSERT INTO `scheduler_tasks` VALUES
1377 (9,'Refresh Index Statistics','search2/bin/cronIndexStats.php','',0,'1min','2007-10-01',NULL,0,'enabled'), 1377 (9,'Refresh Index Statistics','search2/bin/cronIndexStats.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
1378 (10,'Refresh Resource Dependancies','search2/bin/cronResources.php','',0,'1min','2007-10-01',NULL,0,'enabled'), 1378 (10,'Refresh Resource Dependancies','search2/bin/cronResources.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
1379 (11,'Bulk Download Queue','bin/ajaxtasks/downloadTask.php','',0,'1min','2007-10-01',NULL,0,'system'), 1379 (11,'Bulk Download Queue','bin/ajaxtasks/downloadTask.php','',0,'1min','2007-10-01',NULL,0,'system'),
1380 -(12,'Call Home','bin/system_info.php','',1,'half_hourly','2009-10-01',NULL,0,'system'); 1380 +(12,'Call Home','bin/system_info.php','',0,'daily','2009-10-01',NULL,0,'system');
1381 1381
1382 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */; 1382 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
1383 UNLOCK TABLES; 1383 UNLOCK TABLES;
sql/mysql/upgrade/3.7.0/call_home_task.sql
1 -INSERT INTO `scheduler_tasks` (task, script_url, is_complete, frequency, run_time, status)  
2 -VALUES ('Call Home','bin/system_info.php', 1, 'half_hourly','2009-10-01','system');  
3 \ No newline at end of file 1 \ No newline at end of file
  2 +INSERT INTO `scheduler_tasks` (task, script_url, frequency, run_time, status)
  3 +VALUES ('Call Home','bin/system_info.php','daily','2009-10-01','system');
4 \ No newline at end of file 4 \ No newline at end of file
templates/ktcore/principals/about.smarty
@@ -10,15 +10,15 @@ @@ -10,15 +10,15 @@
10 <br> 10 <br>
11 {if ($smallVersion == 'Community Edition')} 11 {if ($smallVersion == 'Community Edition')}
12 {i18n}This program is free software and published under the <a href=" http://www.gnu.org/licenses/">GNU General Public License version 3</a>{/i18n}<br><br> 12 {i18n}This program is free software and published under the <a href=" http://www.gnu.org/licenses/">GNU General Public License version 3</a>{/i18n}<br><br>
13 - {i18n}KnowledgeTree Community Edition is supplied with <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no support</a>,  
14 - <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no maintenance</a>, 13 + {i18n}KnowledgeTree Community Edition is supplied with <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no support</a>,
  14 + <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no maintenance</a>,
15 and <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no warranty</a>.{/i18n}<br> 15 and <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no warranty</a>.{/i18n}<br>
16 {i18n}Please contact the <a href="mailto:sales@knowledgetree.com">KnowledgeTree Sales team</a> should you wish to learn more about commercially supported editions of KnowledgeTree.{/i18n}<br> 16 {i18n}Please contact the <a href="mailto:sales@knowledgetree.com">KnowledgeTree Sales team</a> should you wish to learn more about commercially supported editions of KnowledgeTree.{/i18n}<br>
17 {else} 17 {else}
18 <br> 18 <br>
19 {i18n}This is a professionally supported edition of KnowledgeTree.{/i18n} <br> 19 {i18n}This is a professionally supported edition of KnowledgeTree.{/i18n} <br>
20 {i18n}Please refer to the documentation provided to you at subscription to learn more about how to access KnowledgeTree's professional support team.{/i18n}<br> 20 {i18n}Please refer to the documentation provided to you at subscription to learn more about how to access KnowledgeTree's professional support team.{/i18n}<br>
21 - 21 +
22 {/if} 22 {/if}
23 </p> 23 </p>
24 <br> 24 <br>
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <li><a href="http://forums.knowledgetree.com/">Forums</a>: Discuss KnowledgeTree with expert community users and developers</li> 28 <li><a href="http://forums.knowledgetree.com/">Forums</a>: Discuss KnowledgeTree with expert community users and developers</li>
29 <li><a href="http://wiki.knowledgetree.com/">Wiki</a>: Search the knowledge base of user and developer topics</li> 29 <li><a href="http://wiki.knowledgetree.com/">Wiki</a>: Search the knowledge base of user and developer topics</li>
30 <li><a href="http://issues.knowledgetree.com/">Issues</a>: Log a bug or suggest a new feature</li> 30 <li><a href="http://issues.knowledgetree.com/">Issues</a>: Log a bug or suggest a new feature</li>
31 - <li><a href="http://www.knowledgetree.com/blog">Blogs</a>: See what the KnowledgeTree team have to say</li> 31 + <li><a href="http://people.knowledgetree.com/">Blogs</a>: See what the KnowledgeTree team have to say</li>
32 </ul> 32 </ul>
33 </p> 33 </p>
34 <p> 34 <p>
@@ -63,12 +63,12 @@ @@ -63,12 +63,12 @@
63 </li> 63 </li>
64 <li> 64 <li>
65 Kenny Horan 65 Kenny Horan
66 - </li> 66 + </li>
67 <li> 67 <li>
68 Artur Kiwa 68 Artur Kiwa
69 </li> 69 </li>
70 <li> 70 <li>
71 - Michael Knight 71 + Michael Knight
72 </li> 72 </li>
73 <li> 73 <li>
74 Jeongkyu Kim 74 Jeongkyu Kim
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 Rogerio Kohler 77 Rogerio Kohler
78 </li> 78 </li>
79 <li> 79 <li>
80 - Piotr Krawiecki 80 + Piotr Krawiecki
81 </li> 81 </li>
82 <li> 82 <li>
83 Ola Larsson 83 Ola Larsson
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 Pavel Lastovicka 86 Pavel Lastovicka
87 </li> 87 </li>
88 <li> 88 <li>
89 - Michel Loiseleur 89 + Michel Loiseleur
90 </li> 90 </li>
91 <li> 91 <li>
92 Renat Lumpau 92 Renat Lumpau
@@ -143,13 +143,13 @@ @@ -143,13 +143,13 @@
143 Phillip Steinbachs 143 Phillip Steinbachs
144 </li> 144 </li>
145 <li> 145 <li>
146 - Tahir Tahang 146 + Tahir Tahang
147 </li> 147 </li>
148 <li> 148 <li>
149 Paul Trgina 149 Paul Trgina
150 </li> 150 </li>
151 <li> 151 <li>
152 - Harry Tsio 152 + Harry Tsio
153 </li> 153 </li>
154 <li> 154 <li>
155 Bjarte Kalstveit Vebj&oslash;rnsen 155 Bjarte Kalstveit Vebj&oslash;rnsen
@@ -161,19 +161,13 @@ @@ -161,19 +161,13 @@
161 Jaime Zarate 161 Jaime Zarate
162 </li> 162 </li>
163 <li> 163 <li>
164 - <a href='http://www.ratp.com'>RATP</a>  
165 - </li>  
166 - <li>  
167 - <a href='http://nxc.no'>NXC</a>  
168 - </li>  
169 - <li>  
170 And all the KnowledgeTree staff that <a href="http://en.wikipedia.org/wiki/Eat_one's_own_dog_food">"dogfood"</a> KnowledgeTree every day. 164 And all the KnowledgeTree staff that <a href="http://en.wikipedia.org/wiki/Eat_one's_own_dog_food">"dogfood"</a> KnowledgeTree every day.
171 </li> 165 </li>
172 - 166 +
173 </ul> 167 </ul>
174 168
175 <p><small>[If you feel you should be here too, please let us know at <a href="mailto:contributions@knowledgetree.com">contributions@knowledgetree.com</a>]</small></p> 169 <p><small>[If you feel you should be here too, please let us know at <a href="mailto:contributions@knowledgetree.com">contributions@knowledgetree.com</a>]</small></p>
176 170
177 171
178 -<p>This software utilizes third-party software from <a set="yes" linkindex="11" href="http://pear.php.net/">Pear</a>, <a set="yes" linkindex="12" href="http://phpmailer.sourceforge.net/">PHPMailer</a>, <a set="yes" linkindex="13" href="http://smarty.php.net/">Smarty Template Engine</a>, <a set="yes" linkindex="17" href="http://lucene.apache.org/tika/">Apache Tika</a>, <a set="yes" linkindex="15" href="http://mochikit.com/">Mochikit</a>, <a set="yes" linkindex="16" href="http://tinymce.moxiecode.com/">Moxiecode Systems</a>, <a set="yes" linkindex="17" href="http://extjs.com">ExtJS</a>, <a set="yes" linkindex="17" href="http://developer.yahoo.com/yui/">Yahoo Developer Network</a>.</p>  
179 - 172 +<p>This software utilizes third-party software from <a set="yes" linkindex="11" href="http://pear.php.net/">Pear</a>, <a set="yes" linkindex="12" href="http://phpmailer.sourceforge.net/">PHPMailer</a>, <a set="yes" linkindex="13" href="http://smarty.php.net/">Smarty Template Engine</a>, <a set="yes" linkindex="14" href="http://sourceforge.net/projects/jscalendar">JSCalendar</a>, <a set="yes" linkindex="15" href="http://mochikit.com/">Mochikit</a>, <a set="yes" linkindex="16" href="http://tinymce.moxiecode.com/">Moxiecode Systems</a>, <a set="yes" linkindex="17" href="http://developer.yahoo.com/yui/">Yahoo Developer Network</a>.</p>
  173 +