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 49  
50 50 global $default;
51 51 $default->log->debug('System information collection script starting...');
52   -$cache_file = $default->cacheDirectory . '/system_info';
53 52  
54 53 // Get installation guid
55 54 function getGuid()
... ... @@ -167,44 +166,11 @@ function sendForm($data)
167 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 169 $post_str = getGuid() .'|'. getUserCnt() .'|'. getDocCnt() .'|'. getKTVersion() .'|'. getKTEdition() .'|'. getOSInfo();
203 170 $data['system_info'] = $post_str;
204 171  
205 172 sendForm($data);
206   -updateRunTime($cache_file);
207 173  
208 174 $default->log->debug('System information collection script finishing.');
209 175 exit(0);
210   -?>
211 176 \ No newline at end of file
  177 +?>
... ...
plugins/MyDropDocumentsPlugin/MyDropDocumentsPage.php
... ... @@ -265,7 +265,6 @@ class MyDropDocumentsPage extends KTStandardDispatcher {
265 265 function getUsersDocument($sUserName, $iDropDocsFolderID)
266 266 {
267 267 $oUser = $this->oUser;
268   -
269 268 $oDropDocsFolder = Folder::get($iDropDocsFolderID);
270 269  
271 270 $fullPath = $oDropDocsFolder->getFullPath() . '/' . $sUserName;
... ... @@ -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 341 $sReturnTable .= '</tbody>'.
356 342 '</table>'.
357 343 '<br>'.
... ...
plugins/ktcore/KTWidgets.php
... ... @@ -967,6 +967,7 @@ class KTCoreTextAreaWidget extends KTWidget {
967 967 $oTemplating =& KTTemplating::getSingleton();
968 968 $oTemplate = $oTemplating->loadTemplate('ktcore/forms/widgets/base');
969 969  
  970 + $this->aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
970 971 $this->aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
971 972 $this->aJavascript[] = 'resources/js/kt_tinymce_init.js';
972 973  
... ...
setup/migrate/migrateUtil.php
... ... @@ -62,15 +62,15 @@ class MigrateUtil extends InstallUtil {
62 62 public function error($error) {
63 63 $template_vars['error'] = $error;
64 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 52 if ($class == "template") { // Load existing templating classes
53 53 require_once("../wizard/template.php");
54 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 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 68 class MigrateWizard {
... ... @@ -233,6 +233,8 @@ class MigrateWizard {
233 233 return true;
234 234 break;
235 235 }
  236 +
  237 + return $res;
236 238 }
237 239  
238 240 /**
... ... @@ -259,7 +261,7 @@ class MigrateWizard {
259 261 }
260 262 } else {
261 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 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 158 } catch (Exception $e) {
159 159 $util = new MigrateUtil();
160   - $util->error("Error reading configuration file: $e");
  160 + $util->error("Error reading configuration file: $name");
161 161 exit();
162 162 }
163 163 }
... ... @@ -431,7 +431,8 @@ class Migrater {
431 431 if($class->runMigrate()) { // Check if step needs to be migrated
432 432 $class->setDataFromSession($className); // Set Session Information
433 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 437 } else {
437 438 $util = new MigrateUtil();
... ...
setup/migrate/step.php
... ... @@ -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 213 * Checks if edit button has been clicked
190 214 *
191 215 * @author KnowledgeTree Team
... ...
setup/migrate/stepAction.php
... ... @@ -229,14 +229,12 @@ class stepAction {
229 229 } else {
230 230 $this->_clearErrors($this->stepName); // Send Errors to session
231 231 }
  232 + return $response;
232 233 } else {
233 234 $this->stepName = 'errors';
234 235 $this->action = $this->createStep();
235 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 308 $menu = '';
311 309 $active = false;
312 310 if($this->stepClassNames) {
313   - foreach ($this->stepClassNames as $step) {
  311 + foreach ($this->stepClassNames as $k=>$step) {
314 312 if($this->step_names[$step] != '') {
315 313 $item = $this->step_names[$step];
316 314 } else {
... ... @@ -454,7 +452,7 @@ class stepAction {
454 452 * @access private
455 453 * @return void
456 454 */
457   - private function _loadValueToSession($class, $k, $v) {
  455 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
458 456 if($this->session != null) {
459 457 $this->session->setClass($class, $k, $v);
460 458 } else {
... ... @@ -504,7 +502,8 @@ class stepAction {
504 502 * @access private
505 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 507 if($this->session != null) {
509 508 $this->session->setClassError($class, $k, $v);
510 509 } else {
... ...
setup/migrate/steps/migrateDatabase.php
... ... @@ -122,11 +122,13 @@ class migrateDatabase extends Step
122 122 $manual = false; // If file was exported manually
123 123 $dbSettings = $installation['dbSettings'];
124 124 $location = $installation['location'];
  125 + $uname = $this->temp_variables['duname'];
  126 + $pwrd = $this->temp_variables['dpassword'];
125 127 $port = $this->util->getPort($location);
126 128 $tmpFolder = $this->resolveTempDir();
127 129 if(WINDOWS_OS) {
128 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 132 } else {
131 133 $termOrBash = "terminal window";
132 134 $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump
... ... @@ -145,7 +147,7 @@ class migrateDatabase extends Step
145 147 if(!$manual) { // Try to export database
146 148 $sqlFile = $tmpFolder."/kt-backup-$date.sql";
147 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 152 if(file_exists($sqlFile)) {
151 153 $fileContents = file_get_contents($sqlFile);
... ... @@ -155,14 +157,10 @@ class migrateDatabase extends Step
155 157 }
156 158 }
157 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 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 164 $this->error[]['cmd'] = $cmd;
167 165 $this->temp_variables['manual_export'] = $sqlFile;
168 166  
... ...
setup/migrate/steps/migrateInstallation.php
... ... @@ -162,7 +162,6 @@ class migrateInstallation extends step
162 162 if($this->foundVersion < $this->supportedVersion) {
163 163 $this->versionError = true;
164 164 $this->error[] = "KT installation needs to be 3.6.1 or higher";
165   - return false;
166 165 } else {
167 166 return true;
168 167 }
... ... @@ -223,8 +222,6 @@ class migrateInstallation extends step
223 222 } else {
224 223 $this->error[] = "Please Enter a Location";
225 224 }
226   -
227   - return false;
228 225 }
229 226  
230 227 private function loadConfig($path) {
... ... @@ -245,6 +242,7 @@ class migrateInstallation extends step
245 242 }
246 243 $this->ktSettings = array('fileSystemRoot'=> $froot,
247 244 );
  245 + $urlPaths = $ini->getSection('urls');
248 246 $varDir = $froot.DS.'var';
249 247 $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir),
250 248 array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
... ...
setup/migrate/steps/migrateServices.php
... ... @@ -202,11 +202,11 @@ class migrateServices extends Step
202 202 */
203 203 public function unixStop() {
204 204 $cmd = $this->conf['location']."/dmsctl.sh stop lucene";
205   - $this->util->pexec($cmd);
  205 + $res = $this->util->pexec($cmd);
206 206 $cmd = $this->conf['location']."/dmsctl.sh stop scheduler";
207   - $this->util->pexec($cmd);
  207 + $res = $this->util->pexec($cmd);
208 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 215 */
216 216 public function windowsStop() {
217 217 $cmd = "sc delete KTLucene";
218   - $this->util->pexec($cmd);
  218 + $res = $this->util->pexec($cmd);
219 219 $cmd = "sc delete KTScheduler";
220   - $this->util->pexec($cmd);
  220 + $res = $this->util->pexec($cmd);
221 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 233 $serv->load();
234 234 $sStatus = $serv->status();
235 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 172 public function getWarnings() {
173 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 201 * Checks if edit button has been clicked
... ...
setup/upgrade/stepAction.php
... ... @@ -229,14 +229,12 @@ class stepAction {
229 229 } else {
230 230 $this->_clearErrors($this->stepName); // Send Errors to session
231 231 }
  232 + return $response;
232 233 } else {
233 234 $this->stepName = 'errors';
234 235 $this->action = $this->createStep();
235 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 308 $menu = '';
311 309 $active = false;
312 310 if($this->stepClassNames) {
313   - foreach ($this->stepClassNames as $step) {
  311 + foreach ($this->stepClassNames as $k=>$step) {
314 312 if($this->step_names[$step] != '') {
315 313 $item = $this->step_names[$step];
316 314 } else {
... ... @@ -454,7 +452,7 @@ class stepAction {
454 452 * @access private
455 453 * @return void
456 454 */
457   - private function _loadValueToSession($class, $k, $v) {
  455 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
458 456 if($this->session != null) {
459 457 $this->session->setClass($class, $k, $v);
460 458 } else {
... ... @@ -504,7 +502,8 @@ class stepAction {
504 502 * @access private
505 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 507 if($this->session != null) {
509 508 $this->session->setClassError($class, $k, $v);
510 509 } else {
... ...
setup/upgrade/steps/upgradeBackup.php
... ... @@ -120,7 +120,7 @@ class upgradeBackup extends Step {
120 120  
121 121 if (is_file($dir . '/mysqladmin') || is_file($dir . '/mysqladmin.exe'))
122 122 {
123   -// $curdir=getcwd();
  123 + $curdir=getcwd();
124 124 chdir($dir);
125 125  
126 126 $handle = popen($stmt['cmd'], 'r');
... ... @@ -198,7 +198,7 @@ class upgradeBackup extends Step {
198 198  
199 199 $adminUser = $oKTConfig->get('db/dbAdminUser');
200 200 $adminPwd = $oKTConfig->get('db/dbAdminPass');
201   -// $dbHost = $oKTConfig->get('db/dbHost');
  201 + $dbHost = $oKTConfig->get('db/dbHost');
202 202 $dbName = $oKTConfig->get('db/dbName');
203 203  
204 204 $dbPort = trim($oKTConfig->get('db/dbPort'));
... ...
setup/upgrade/steps/upgradeDatabase.php
... ... @@ -144,10 +144,10 @@ class upgradeDatabase extends Step
144 144 $this->readConfig(KTConfig::getConfigFilename());
145 145  
146 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 148 $this->dbSettings['dbPass'], $this->dbSettings['dbName']);
149 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 151 $this->dbSettings['dbPass'], $this->dbSettings['dbName']);
152 152 }
153 153  
... ... @@ -285,8 +285,7 @@ class upgradeDatabase extends Step
285 285 }
286 286  
287 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 289 $errors = true;
291 290 // TODO instantiate error details hideable section?
292 291 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font>
... ... @@ -301,8 +300,7 @@ class upgradeDatabase extends Step
301 300 }
302 301  
303 302 $post_pres = $this->performPostUpgradeActions();
304   -// if (PEAR::isError($post_res)) {
305   - if (PEAR::isError($post_pres)) {
  303 + if (PEAR::isError($post_res)) {
306 304 $errors = true;
307 305 $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>';
308 306 }
... ... @@ -336,7 +334,7 @@ class upgradeDatabase extends Step
336 334  
337 335 // Ensure all plugins are re-registered.
338 336 $sql = "TRUNCATE plugin_helper";
339   - DBUtil::runQuery($sql);
  337 + $res = DBUtil::runQuery($sql);
340 338  
341 339 // Clear out all caches and proxies - they need to be regenerated with the new code
342 340 $proxyDir = $default->proxyCacheDirectory;
... ...
setup/upgrade/steps/upgradeRestore.php
... ... @@ -111,14 +111,14 @@ class upgradeRestore extends Step {
111 111 private function restoreDatabase()
112 112 {
113 113 $this->temp_variables['restore'] = true;
114   -// $status = $_SESSION['backupStatus'];
  114 + $status = $_SESSION['backupStatus'];
115 115 $filename = $_SESSION['backupFile'];
116 116 $stmt = $this->util->create_restore_stmt($filename);
117 117 $dir = $stmt['dir'];
118 118  
119 119 if (is_file($dir . '/mysql') || is_file($dir . '/mysql.exe'))
120 120 {
121   -// $curdir=getcwd();
  121 + $curdir=getcwd();
122 122 chdir($dir);
123 123  
124 124 $ok=true;
... ... @@ -181,11 +181,9 @@ class upgradeRestore extends Step {
181 181 $dir = $this->util->resolveTempDir();
182 182  
183 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 188 if (!preg_match('/kt-backup.+\.sql/',$file)) {
191 189 continue;
... ... @@ -219,7 +217,7 @@ class upgradeRestore extends Step {
219 217 return;
220 218 }
221 219  
222   -// $status = $_SESSION['backupStatus'];
  220 + $status = $_SESSION['backupStatus'];
223 221 $filename = $_SESSION['backupFile'];
224 222 $stmt = $this->util->create_restore_stmt($filename);
225 223  
... ...
setup/upgrade/steps/upgradeWelcome.php
... ... @@ -81,7 +81,7 @@ class upgradeWelcome extends step {
81 81 }
82 82  
83 83 private function checkPassword($username, $password) {
84   -// global $default;
  84 + global $default;
85 85  
86 86 $sTable = KTUtil::getTableName('users');
87 87 $sQuery = "SELECT count(*) AS match_count FROM $sTable WHERE username = ? AND password = ?";
... ...
setup/upgrade/templates/complete.tpl
... ... @@ -9,5 +9,5 @@
9 9 Your database has been upgraded to <?php echo $default->systemVersion; ?>
10 10 </div>
11 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 13 </form>
14 14 \ No newline at end of file
... ...
setup/upgrade/upgradeUtil.php
... ... @@ -64,16 +64,15 @@ class UpgradeUtil extends InstallUtil {
64 64 public function error($error) {
65 65 $template_vars['error'] = $error;
66 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 78 public function loadInstallIni($path) {
... ... @@ -100,16 +99,15 @@ class UpgradeUtil extends InstallUtil {
100 99 }
101 100 }
102 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 133  
136 134 $adminUser = $oKTConfig->get('db/dbAdminUser');
137 135 $adminPwd = $oKTConfig->get('db/dbAdminPass');
138   -// $dbHost = $oKTConfig->get('db/dbHost');
  136 + $dbHost = $oKTConfig->get('db/dbHost');
139 137 $dbName = $oKTConfig->get('db/dbName');
140 138 $dbPort = trim($oKTConfig->get('db/dbPort'));
141 139 if ($dbPort=='' || $dbPort=='default')$dbPort = get_cfg_var('mysql.default_port');
... ... @@ -160,7 +158,7 @@ class UpgradeUtil extends InstallUtil {
160 158 $mechanism="--port=\"$dbPort\"";
161 159 }
162 160  
163   -// $tmpdir = $this->resolveTempDir();
  161 + $tmpdir = $this->resolveTempDir();
164 162  
165 163 $stmt = $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism drop \"$dbName\"<br/>";
166 164 $stmt .= $prefix ."mysqladmin --user=\"$adminUser\" -p $mechanism create \"$dbName\"<br/>";
... ... @@ -195,13 +193,11 @@ class UpgradeUtil extends InstallUtil {
195 193 }
196 194  
197 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 197 $dirs[] = $mysqldir;
201 198  
202 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 203 foreach($dirs as $dir)
... ...
setup/upgrade/upgradeWizard.php
... ... @@ -52,17 +52,17 @@ function __autoload($class) { // Attempt and autoload classes
52 52 if ($class == "template") { // Load existing templating classes
53 53 require_once("../wizard/template.php");
54 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 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 68 class UpgradeWizard {
... ... @@ -191,7 +191,26 @@ class UpgradeWizard {
191 191 * @return mixed
192 192 */
193 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 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 158 } catch (Exception $e) {
159 159 $util = new UpgradeUtil();
160   - $util->error("Error reading configuration file: $e");
  160 + $util->error("Error reading configuration file: $name");
161 161 exit();
162 162 }
163 163 }
... ... @@ -431,7 +431,8 @@ class Upgrader {
431 431 if($class->runUpgrade()) { // Check if step needs to be upgraded
432 432 $class->setDataFromSession($className); // Set Session Information
433 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 437 } else {
437 438 $util = new UpgradeUtil();
... ...
setup/wizard/iniUtilities.php
... ... @@ -63,12 +63,11 @@ class iniUtilities {
63 63 return false;
64 64 }
65 65 $date = date('YmdHis');
  66 +
66 67 $backupFile = $iniFile . '.' .$date;
67 68 if (is_writeable($backupFile)) {
68 69 file_put_contents($backupFile, $content);
69 70 }
70   -
71   - return true;
72 71 }
73 72  
74 73 function read($iniFile) {
... ... @@ -154,20 +153,13 @@ class iniUtilities {
154 153 }
155 154  
156 155 function itemExists($checkSection, $checkItem) {
157   -/*
158   - foreach ($items as $key => $value) {
159   - if($key == $checkItem) {
160   - return true;
161   - }
162   - }
163   -*/
  156 +
164 157 $this->exists = '';
165 158 foreach($this->cleanArray as $section => $items) {
166 159 if($section == $checkSection) {
167 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 163 return true;
172 164 }
173 165 }
... ...
setup/wizard/installUtil.php
... ... @@ -70,16 +70,15 @@ class InstallUtil {
70 70 public function error($error) {
71 71 $template_vars['error'] = $error;
72 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 84 * Check if system needs to be installed
... ... @@ -166,8 +165,7 @@ class InstallUtil {
166 165 return $url;
167 166 }
168 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 170 if (!empty($port)) {
173 171 $url = preg_replace('!^(([a-z0-9]+)://[^/:]+)(:[\d]+)?!i',
... ... @@ -323,15 +321,13 @@ class InstallUtil {
323 321 while (($file = readdir($dh)) !== false) {
324 322 if($file != '.' && $file != '..') {
325 323 $fullpath = $path.'/'.$file;
326   - if(is_link($fullpath)) {
  324 + if(is_link($fullpath))
327 325 return false;
328   - } elseif(!is_dir($fullpath)) {
  326 + elseif(!is_dir($fullpath)) {
329 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 330 return false;
333   - }
334   - }
335 331 } elseif(!$this->chmodRecursive($fullpath, $filemode))
336 332 return false;
337 333 }
... ... @@ -358,8 +354,7 @@ class InstallUtil {
358 354 */
359 355 public function canWriteFile($filename) {
360 356 $fh = fopen($filename, "w+");
361   - $fr = fwrite($fh, 'test');
362   - if($fr === false) {
  357 + if($fr = fwrite($fh, 'test') === false) {
363 358 return false;
364 359 }
365 360  
... ... @@ -377,9 +372,9 @@ class InstallUtil {
377 372 */
378 373 public function javaBridge() {
379 374 try {
380   - new Java('java.lang.System');
  375 + $javaSystem = new Java('java.lang.System');
381 376 } catch (JavaException $e) {
382   - return $e;
  377 + return false;
383 378 }
384 379 return true;
385 380 }
... ... @@ -768,7 +763,6 @@ class InstallUtil {
768 763 * @return string
769 764 */
770 765 public function installEnvironment() {
771   - $matches = false;
772 766 preg_match('/Zend/', SYSTEM_DIR, $matches); // Install Type
773 767 if($matches) {
774 768 return 'Zend';
... ... @@ -798,7 +792,7 @@ class InstallUtil {
798 792 array_pop($sysdir);
799 793 array_pop($sysdir);
800 794 $zendsys = '';
801   - foreach ($sysdir as $v) {
  795 + foreach ($sysdir as $k=>$v) {
802 796 $zendsys .= $v.DS;
803 797 }
804 798 return $zendsys."ZendServer".DS."bin".DS;
... ... @@ -821,16 +815,15 @@ class InstallUtil {
821 815 if(WINDOWS_OS) { // Mysql bin [Windows]
822 816 $serverPaths = explode(';',$_SERVER['PATH']);
823 817 foreach ($serverPaths as $apath) {
824   - $matches = false;
825 818 preg_match('/mysql/i', $apath, $matches);
826 819 if($matches) {
827 820 return $apath.DS;
828 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 829 public function sqlInstallDir() {
... ...
setup/wizard/installWizard.php
... ... @@ -62,13 +62,9 @@ function __autoload($class) { // Attempt and autoload classes
62 62 } else {
63 63 if(preg_match('/Helper/', $class)) {
64 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 70 class InstallWizard {
... ... @@ -100,15 +96,6 @@ class InstallWizard {
100 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 99 * Constructs installation wizard object
113 100 *
114 101 * @author KnowledgeTree Team
... ... @@ -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 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 190 * @param none
216 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 231 if(isset($_GET['bypass'])) {
257 232 $this->setBypass($_GET['bypass']);
258 233 }
259   - if(isset($_GET['step'])) {
260   - $this->setStep($_GET['step']);
261   - }
262 234 if(isset($_GET['debug'])) {
263 235 $this->setDebugLevel($_GET['debug']);
264 236 } else {
... ... @@ -291,6 +263,8 @@ class InstallWizard {
291 263 return true;
292 264 break;
293 265 }
  266 +
  267 + return $res;
294 268 }
295 269  
296 270 /**
... ... @@ -304,14 +278,10 @@ class InstallWizard {
304 278 public function dispatch() {
305 279 $this->load();
306 280 if($this->getBypass() === "1") { // Helper to force install
307   - $this->removeInstallFile();
  281 + $this->removeInstallFile(); // TODO: Remove
308 282 } elseif ($this->getBypass() === "0") {
309 283 $this->createInstallFile();
310 284 }
311   - if($this->isActionOnStep()) { // Testing purposes
312   - $testStepClass = $this->stepName."Test";
313   - new $testStepClass();
314   - }
315 285 if(!$this->isSystemInstalled()) { // Check if the systems not installed
316 286 if($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed
317 287 $this->util->redirect('../migrate');
... ... @@ -326,7 +296,7 @@ class InstallWizard {
326 296 }
327 297 } else {
328 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 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 158 } catch (Exception $e) {
159 159 $util = new InstallUtil();
160   - $util->error("Error reading configuration file: $e");
  160 + $util->error("Error reading configuration file: $name");
161 161 exit();
162 162 }
163 163 }
... ... @@ -431,7 +431,8 @@ class Installer {
431 431 if($class->runInstall()) { // Check if step needs to be installed
432 432 $class->setDataFromSession($className); // Set Session Information
433 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 437 } else {
437 438 $util = new InstallUtil();
... ...
setup/wizard/lib/helpers/htmlHelper.php
... ... @@ -41,7 +41,7 @@
41 41 */
42 42 class htmlHelper {
43 43  
44   - private $tags = array(
  44 + var $tags = array(
45 45 'meta' => '<meta%s/>',
46 46 'metalink' => '<link href="%s"%s/>',
47 47 'link' => '<a href="%s"%s>%s</a>',
... ... @@ -96,76 +96,76 @@ class htmlHelper {
96 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 140 $attribute = '';
141 141 $attributeFormat = '%s="%s"';
142 142 $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');
143 143 if (is_array($value)) {
144   - $value = '';
  144 + $value = '';
145 145 }
146   -
  146 +
147 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 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 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 158 if (!empty($condition)) {
159   - return $val1;
  159 + return $val1;
160 160 }
161 161 return $val2;
162 162 }
163 163  
164   - public function h($text, $charset = 'UTF-8') {
  164 + function h($text, $charset = 'UTF-8') {
165 165 if (is_array($text)) {
166   - return array_map('h', $text);
  166 + return array_map('h', $text);
167 167 }
168 168 return htmlspecialchars($text, ENT_QUOTES, $charset);
169   - }
  169 +}
170 170 }
171 171 ?>
172 172 \ No newline at end of file
... ...
setup/wizard/lib/services/unixLucene.php
... ... @@ -59,7 +59,7 @@ class unixLucene extends unixService {
59 59 * @param string
60 60 * @return void
61 61 */
62   - public function load() {
  62 + public function load($options = null) {
63 63 $this->setLuceneSource("ktlucene.jar");
64 64 $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS);
65 65 $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS);
... ... @@ -155,8 +155,7 @@ class unixLucene extends unixService {
155 155 $response = $this->util->pexec($cmd);
156 156 return $response;
157 157 }
158   -
159   - return $state;
  158 +
160 159 }
161 160  
162 161 public function install() {
... ... @@ -174,7 +173,6 @@ class unixLucene extends unixService {
174 173 if(is_array($response['out'])) {
175 174 if(count($response['out']) > 1) {
176 175 foreach ($response['out'] as $r) {
177   - $matches = false;
178 176 preg_match('/grep/', $r, $matches); // Ignore grep
179 177 if(!$matches) {
180 178 return 'STARTED';
... ... @@ -209,14 +207,20 @@ class unixLucene extends unixService {
209 207 $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$logFile." 2>&1 & echo $!";
210 208 if(DEBUG) {
211 209 echo "Command : $cmd<br/>";
212   - return true;
  210 + return ;
213 211 }
214 212 $response = $this->util->pexec($cmd);
215 213  
216 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 226 public function getName() {
... ...
setup/wizard/lib/services/unixOpenOffice.php
... ... @@ -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 110 sleep(1);
111 111 $cmd = "ps ax | grep soffice";
112 112 $response = $this->util->pexec($cmd);
113 113 if(is_array($response['out'])) {
114 114 if(count($response['out']) > 1) {
115 115 foreach ($response['out'] as $r) {
116   - $matches = false;
117 116 preg_match('/grep/', $r, $matches); // Ignore grep
118 117 if(!$matches) {
119 118 return 'STARTED';
... ... @@ -138,17 +137,23 @@ class unixOpenOffice extends unixService {
138 137 public function start() {
139 138 $state = $this->status();
140 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 141 if(DEBUG) {
143 142 echo "Command : $cmd<br/>";
144   - return true;
  143 + return ;
145 144 }
146 145 $response = $this->util->pexec($cmd);
147 146  
148 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 57 * @param string
58 58 * @return void
59 59 */
60   - public function load() {
  60 + public function load($options = null) {
61 61 $this->setPhpCli();
62 62 $this->scheduler = 'scheduler';
63 63 $this->setSchedulerSource('schedulerTask.sh');
... ... @@ -155,7 +155,6 @@ class unixScheduler extends unixService {
155 155 if(is_array($response['out'])) {
156 156 if(count($response['out']) > 1) {
157 157 foreach ($response['out'] as $r) {
158   - $matches = false;
159 158 preg_match('/grep/', $r, $matches); // Ignore grep
160 159 if(!$matches) {
161 160 return 'STARTED';
... ... @@ -191,7 +190,7 @@ class unixScheduler extends unixService {
191 190 }
192 191 if(DEBUG) {
193 192 echo "Command : $cmd<br/>";
194   - return true;
  193 + return ;
195 194 }
196 195 $response = $this->util->pexec($cmd);
197 196  
... ...
setup/wizard/lib/services/windowsLucene.php
... ... @@ -140,8 +140,8 @@ class windowsLucene extends windowsService {
140 140 * @param string
141 141 * @return void
142 142 */
143   - public function load() {
144   - $this->findJavaBin();
  143 + public function load($options = null) {
  144 + $this->setJavaBin();
145 145 $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver");
146 146 $this->setLuceneExe("KTLuceneService.exe");
147 147 $this->setJavaJVM();
... ... @@ -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 177 * @author KnowledgeTree Team
178 178 * @access private
179 179 * @param string
180 180 * @return void
181 181 */
182   - private function findJavaBin() {
  182 + private function setJavaBin($javaBin = '') {
183 183 if($this->util->zendBridge()) {
184 184 if($this->util->javaBridge()) {
185 185 $this->javaSystem = new Java('java.lang.System');
... ... @@ -379,8 +379,6 @@ class windowsLucene extends windowsService {
379 379 } else {
380 380 return false;
381 381 }
382   -
383   - return true;
384 382 }
385 383  
386 384 /**
... ... @@ -409,11 +407,12 @@ class windowsLucene extends windowsService {
409 407 $luceneExe = $this->getLuceneExe();
410 408 $luceneSource = $this->getLuceneSource();
411 409 $luceneDir = $this->getluceneDir();
  410 + $javaJVM = $this->getJavaJVM();
412 411 if($luceneExe && $luceneSource && $luceneDir) {
413 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 413 if(DEBUG) {
415 414 echo "Command : $cmd<br/>";
416   - return true;
  415 + return ;
417 416 }
418 417 $response = $this->util->pexec($cmd);
419 418 return $response;
... ...
setup/wizard/lib/services/windowsOpenOffice.php
... ... @@ -183,11 +183,10 @@ class windowsOpenOffice extends windowsService {
183 183 }
184 184  
185 185 private function setWinservice($winservice = "winserv.exe") {
186   - if(file_exists(SYS_BIN_DIR . $winservice)) {
  186 + if(file_exists(SYS_BIN_DIR . $winservice))
187 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 189 $this->winservice = SYS_BIN_DIR . "win32" . DS. $winservice;
190   - }
191 190 }
192 191  
193 192 public function getWinservice() {
... ... @@ -204,10 +203,10 @@ class windowsOpenOffice extends windowsService {
204 203 //$binary = $this->util->openOfficeSpecified();
205 204 $binary = $this->getBin();
206 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 207 if(DEBUG) {
209 208 echo "Command : $cmd<br/>";
210   - return true;
  209 + return ;
211 210 }
212 211 $response = $this->util->pexec($cmd);
213 212 return $response;
... ...
setup/wizard/lib/services/windowsScheduler.php
... ... @@ -85,7 +85,7 @@ class windowsScheduler extends windowsService {
85 85 * @param string
86 86 * @return void
87 87 */
88   - function load() {
  88 + function load($options = null) {
89 89 $this->setSchedulerDIR($this->varDir."bin");
90 90 $this->setSchedulerScriptPath("taskrunner.bat");
91 91 $this->setSchedulerSource("schedulerService.php");
... ... @@ -209,7 +209,7 @@ class windowsScheduler extends windowsService {
209 209 echo '<pre>';
210 210 print_r(array('service' => $this->name, 'display' => $this->name, 'path' => $this->getSchedulerScriptPath()));
211 211 echo '</pre>';
212   - return true;
  212 + return ;
213 213 }
214 214 $response = win32_create_service(array(
215 215 'service' => $this->name,
... ... @@ -224,7 +224,7 @@ class windowsScheduler extends windowsService {
224 224 $cmd = "\"{$this->winservice}\" install $this->name $this->options";
225 225 if(DEBUG) {
226 226 echo "Command : $cmd<br/>";
227   - return true;
  227 + return ;
228 228 }
229 229 $response = $this->util->pexec($cmd);
230 230 return $response;
... ...
setup/wizard/lib/services/windowsService.php
... ... @@ -163,7 +163,7 @@ class windowsService extends Service {
163 163 * @return array
164 164 */
165 165 public function restart() {
166   - $this->stop();
  166 + $response = $this->stop();
167 167 sleep(1);
168 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 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 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 11 \ No newline at end of file
... ...
setup/wizard/lib/validation/luceneValidation.php
... ... @@ -264,7 +264,7 @@ class luceneValidation extends serviceValidation {
264 264 public function binaryChecks() {
265 265 if($this->util->javaSpecified()) {
266 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 268 return true;
269 269 } else {
270 270 $this->specifyJava(); // Ask for settings
... ... @@ -274,16 +274,16 @@ class luceneValidation extends serviceValidation {
274 274 if($auto) {
275 275 return $auto;
276 276 } else {
277   - $auto = $this->detSettings(); // Check if auto detected java works
  277 + $auto = $this->useDetected(); // Check if auto detected java works
278 278 if($auto) {
279 279 $this->disableExtension = true; // Disable the use of the php bridge extension
  280 + return $auto;
280 281 } else {
281 282 $this->specifyJava(); // Ask for settings
282 283 }
283 284 }
284 285 return $auto;
285 286 }
286   - return false;
287 287 }
288 288  
289 289 /**
... ... @@ -363,7 +363,7 @@ class luceneValidation extends serviceValidation {
363 363 * @access private
364 364 * @return boolean
365 365 */
366   - private function detSettings() {
  366 + private function detSettings($attempt = false) {
367 367 $javaExecutable = $this->util->javaSpecified();// Retrieve java bin
368 368 if($javaExecutable == '') {
369 369 if($this->java == '') {
... ... @@ -388,7 +388,7 @@ class luceneValidation extends serviceValidation {
388 388 }
389 389  
390 390 function windowsReadJVFromFile($cmd) {
391   - $this->util->pexec($cmd);
  391 + $response = $this->util->pexec($cmd);
392 392 if(file_exists($this->outputDir.'outJV')) {
393 393 $version = file_get_contents($this->outputDir.'outJV');
394 394 if($version != '') {
... ... @@ -409,23 +409,21 @@ class luceneValidation extends serviceValidation {
409 409 } else {
410 410 $this->javaVersionWarning();
411 411 $this->javaCheck = 'cross_orange';
412   -// if($attempt) {
  412 + if($attempt) {
413 413 $this->javaExeMessage = "Incorrect java path specified";
414 414 $this->javaExeError = true;
415 415 $this->error[] = "Requires Java 1.5+ to be installed";
416   -// }
  416 + }
417 417  
418 418 return false;
419 419 }
420 420 }
421   - return false;
422 421 }
423 422  
424 423 function unixReadJVFromFile($cmd) {
425   - $this->util->pexec($cmd);
  424 + $response = $this->util->pexec($cmd);
426 425 if(file_exists($this->outputDir.'outJV')) {
427 426 $tmp = file_get_contents($this->outputDir.'outJV');
428   - $matches = false;
429 427 preg_match('/"(.*)"/',$tmp, $matches);
430 428 if($matches) {
431 429 if($matches[1] < $this->javaVersion) { // Check Version of java
... ... @@ -445,17 +443,27 @@ class luceneValidation extends serviceValidation {
445 443 } else {
446 444 $this->javaVersionWarning();
447 445 $this->javaCheck = 'cross_orange';
448   -// if($attempt) {
  446 + if($attempt) {
449 447 $this->javaExeMessage = "Incorrect java path specified";
450 448 $this->javaExeError = true;
451 449 $this->error[] = "Requires Java 1.5+ to be installed";
452   -// }
  450 + }
453 451  
454 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 92 * @access private
93 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 98 * Open Office unix locations
... ... @@ -103,7 +103,7 @@ class openofficeValidation extends serviceValidation {
103 103 */
104 104 private $unixLocations = array("/usr/bin/");
105 105  
106   - public function preset() {
  106 + public function preset($options = null) {
107 107 $this->specifyOpenOffice();
108 108 }
109 109  
... ...
setup/wizard/lib/validation/schedulerValidation.php
... ... @@ -92,37 +92,36 @@ class schedulerValidation extends serviceValidation {
92 92 public function binaryChecks() {
93 93 // TODO: Better detection
94 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 104 function detPhpSettings() {
105 105 // TODO: Better php handling
106 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 137 }
139 138  
140 139 private function setPhp() {
141   - $phpDir = $this->util->useZendPhp();
142 140 if($this->php != '') { // PHP Found
143 141 $this->phpCheck = 'tick';
144   - } elseif ($phpDir) { // Use System Defined Settings
  142 + } elseif ($phpDir = $this->util->useZendPhp()) { // Use System Defined Settings
145 143 $this->php = $phpDir;
  144 + } else {
  145 +
146 146 }
147   -
148 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 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 0 \ No newline at end of file
setup/wizard/path.php
... ... @@ -114,7 +114,6 @@
114 114 define('SYS_DIR', WIZARD_LIB."system".DS);
115 115 define('HELPER_DIR', WIZARD_LIB."helpers".DS);
116 116 define('VALID_DIR', WIZARD_LIB."validation".DS);
117   - define('TEST_DIR', VALID_DIR."steps".DS);
118 117 // Define paths to system webroot
119 118 define('SYSTEM_DIR', $sys);
120 119 define('SYS_VAR_DIR', SYSTEM_DIR."var".DS);
... ...
setup/wizard/resources/js/wizard.js
... ... @@ -4,8 +4,7 @@ function wizard() {
4 4  
5 5 // Toggle Advance Database options
6 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 8 $('.'+ele).attr('style', 'display: block;');
10 9 if($('#'+option).attr('innerHTML') != '&nbsp;&nbsp;Advanced Options')
11 10 $('#'+option).attr('innerHTML', 'Hide Details');
... ... @@ -15,7 +14,7 @@ wizard.prototype.toggleClass = function(ele, option) { //adv_options|php_details
15 14 $('#'+option).attr('innerHTML', 'Show Details');
16 15 }
17 16 }
18   - //alert($('.'+ele) + " " + $('.'+ele).attr('style'));
  17 +
19 18 // Focus on element
20 19 wizard.prototype.focusElement = function(el) {
21 20 el.focus();
... ...
setup/wizard/session.php
... ... @@ -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 241 \ No newline at end of file
... ...
setup/wizard/step.php
... ... @@ -42,15 +42,6 @@
42 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 45 * List of variables to be loaded to template
55 46 *
56 47 * @author KnowledgeTree Team
... ... @@ -82,7 +73,7 @@ class Step
82 73 *
83 74 * @author KnowledgeTree Team
84 75 * @access public
85   - * @var boolean
  76 + * @var array
86 77 */
87 78 protected $storeInSession = false;
88 79  
... ... @@ -91,7 +82,7 @@ class Step
91 82 *
92 83 * @author KnowledgeTree Team
93 84 * @access public
94   - * @var boolean
  85 + * @var array
95 86 */
96 87 protected $runInstall = false;
97 88  
... ... @@ -100,7 +91,7 @@ class Step
100 91 *
101 92 * @author KnowledgeTree Team
102 93 * @access public
103   - * @var boolean
  94 + * @var string
104 95 */
105 96 protected $order = false;
106 97  
... ... @@ -113,15 +104,10 @@ class Step
113 104 */
114 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 107 public $displayFirst = false;
124 108  
  109 + private $salt = 'installers';
  110 +
125 111 /**
126 112 * Reference to utility object
127 113 *
... ... @@ -129,7 +115,7 @@ class Step
129 115 * @access protected
130 116 * @var object
131 117 */
132   - public $util = null;
  118 + public $util;
133 119  
134 120 /**
135 121 * Reference to utility object
... ... @@ -138,20 +124,12 @@ class Step
138 124 * @access protected
139 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 129 public function __construct() {
151 130 $this->dbhandler = new dbUtilities();
152 131 $this->util = new InstallUtil();
153 132 }
154   -
155 133 /**
156 134 * Returns step state
157 135 *
... ... @@ -164,13 +142,6 @@ class Step
164 142 return '';
165 143 }
166 144  
167   - /**
168   - * Returns display flag
169   - *
170   - * @author KnowledgeTree Team
171   - * @access public
172   - * @var boolean
173   - */
174 145 public function displayFirst() {
175 146 return $this->displayFirst;
176 147 }
... ... @@ -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 210 * Checks if edit button has been clicked
216 211 *
217 212 * @author KnowledgeTree Team
... ...
setup/wizard/stepAction.php
... ... @@ -472,7 +472,7 @@ class stepAction {
472 472 * @access private
473 473 * @return void
474 474 */
475   - private function _loadValueToSession($class, $k, $v) {
  475 + private function _loadValueToSession($class, $k, $v, $overwrite = false) {
476 476 if($this->session != null) {
477 477 $this->session->setClass($class, $k, $v);
478 478 } else {
... ...
setup/wizard/steps/database.php
... ... @@ -40,6 +40,16 @@
40 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 53 class database extends Step
44 54 {
45 55 /**
... ... @@ -710,15 +720,15 @@ class database extends Step
710 720 */
711 721 private function createDmsUser() {
712 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 733 * Create schema
724 734 *
... ... @@ -800,7 +810,17 @@ class database extends Step
800 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 826 * Initialize errors to false
... ... @@ -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 861 \ No newline at end of file
... ...
setup/wizard/templates/complete.tpl
... ... @@ -131,7 +131,7 @@
131 131 $redirect = "http://".$_SERVER['SERVER_NAME'].$root_url."/admin.php";
132 132 ?>
133 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 135 <?php } else { ?>
136 136 <a href="../../login.php?redirect=<?php echo $redirect; ?>" class="back button_next" style="width:80px;" onclick="javascript:{w.clearSessions();}">Goto Login</a>
137 137 <?php } ?>
... ...
setup/wizard/templates/welcome.tpl
... ... @@ -4,6 +4,7 @@
4 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 5 <p class="empty_space">
6 6 Press <b>Next</b> to continue.</p>
  7 + <div class="demo"><?php echo $html->image('kt_browse.png'); ?> </div>
7 8 </div>
8 9 <input type="submit" name="Next" value="Next" class="button_next"/>
9 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 1377 (9,'Refresh Index Statistics','search2/bin/cronIndexStats.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
1378 1378 (10,'Refresh Resource Dependancies','search2/bin/cronResources.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
1379 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 1382 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
1383 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 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 4 \ No newline at end of file
... ...
templates/ktcore/principals/about.smarty
... ... @@ -10,15 +10,15 @@
10 10 <br>
11 11 {if ($smallVersion == 'Community Edition')}
12 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 15 and <a href="http://www.knowledgetree.com/commercial_support" target="_blank">no warranty</a>.{/i18n}<br>
16 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 17 {else}
18 18 <br>
19 19 {i18n}This is a professionally supported edition of KnowledgeTree.{/i18n} <br>
20 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 22 {/if}
23 23 </p>
24 24 <br>
... ... @@ -28,7 +28,7 @@
28 28 <li><a href="http://forums.knowledgetree.com/">Forums</a>: Discuss KnowledgeTree with expert community users and developers</li>
29 29 <li><a href="http://wiki.knowledgetree.com/">Wiki</a>: Search the knowledge base of user and developer topics</li>
30 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 32 </ul>
33 33 </p>
34 34 <p>
... ... @@ -63,12 +63,12 @@
63 63 </li>
64 64 <li>
65 65 Kenny Horan
66   - </li>
  66 + </li>
67 67 <li>
68 68 Artur Kiwa
69 69 </li>
70 70 <li>
71   - Michael Knight
  71 + Michael Knight
72 72 </li>
73 73 <li>
74 74 Jeongkyu Kim
... ... @@ -77,7 +77,7 @@
77 77 Rogerio Kohler
78 78 </li>
79 79 <li>
80   - Piotr Krawiecki
  80 + Piotr Krawiecki
81 81 </li>
82 82 <li>
83 83 Ola Larsson
... ... @@ -86,7 +86,7 @@
86 86 Pavel Lastovicka
87 87 </li>
88 88 <li>
89   - Michel Loiseleur
  89 + Michel Loiseleur
90 90 </li>
91 91 <li>
92 92 Renat Lumpau
... ... @@ -143,13 +143,13 @@
143 143 Phillip Steinbachs
144 144 </li>
145 145 <li>
146   - Tahir Tahang
  146 + Tahir Tahang
147 147 </li>
148 148 <li>
149 149 Paul Trgina
150 150 </li>
151 151 <li>
152   - Harry Tsio
  152 + Harry Tsio
153 153 </li>
154 154 <li>
155 155 Bjarte Kalstveit Vebj&oslash;rnsen
... ... @@ -161,19 +161,13 @@
161 161 Jaime Zarate
162 162 </li>
163 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 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 165 </li>
172   -
  166 +
173 167 </ul>
174 168  
175 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 +
... ...