Commit 372449a1b022e43255d7a77a89e9852c6b1578e1
1 parent
7ad57dc9
Daily Commit.
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
49 changed files
with
3769 additions
and
4134 deletions
setup/firstlogin/config/commercial_config.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<!-- | ||
| 4 | + Document : config.xml | ||
| 5 | + Created on : 01 July 2009, 9:57 AM | ||
| 6 | + Author : KnowledgeTree Team | ||
| 7 | + Description: Commercial steps | ||
| 8 | +--> | ||
| 9 | + | ||
| 10 | +<firstlogin version="3.7" type="Commercial Edition"> | ||
| 11 | + <steps> | ||
| 12 | + <step name="Apply Folder Template">templates</step> | ||
| 13 | + <step name="Complete">complete</step> | ||
| 14 | + </steps> | ||
| 15 | + </firstlogin> | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
setup/firstlogin/config/community_config.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<!-- | ||
| 4 | + Document : config.xml | ||
| 5 | + Created on : 01 July 2009, 9:57 AM | ||
| 6 | + Author : KnowledgeTree Team | ||
| 7 | + Description: First login steps | ||
| 8 | +--> | ||
| 9 | + | ||
| 10 | +<migrate version="3.7" type="Commercial Edition"> | ||
| 11 | + <steps> | ||
| 12 | + <step name="Apply Folder Template">templates</step> | ||
| 13 | + <step name="Complete">complete</step> | ||
| 14 | + </steps> | ||
| 15 | + </migrate> | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
setup/firstlogin/config/config.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<!-- | ||
| 4 | + Document : config.xml | ||
| 5 | + Created on : 01 July 2009, 9:57 AM | ||
| 6 | + Author : KnowledgeTree Team | ||
| 7 | + Description: First login steps | ||
| 8 | +--> | ||
| 9 | + | ||
| 10 | +<migrate version="3.7" type="Commercial Edition"> | ||
| 11 | + <steps> | ||
| 12 | + <step name="Apply Folder Template">templates</step> | ||
| 13 | + <step name="Complete">complete</step> | ||
| 14 | + </steps> | ||
| 15 | + </migrate> | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
setup/firstlogin/firstlogin.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* Contributor( s): ______________________________________ | ||
| 36 | +*/ | ||
| 37 | + | ||
| 38 | +/** | ||
| 39 | +* | ||
| 40 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 41 | +* @license GNU General Public License version 3 | ||
| 42 | +* @author KnowledgeTree Team | ||
| 43 | +* @package Fist Start Wizard | ||
| 44 | +* @version Version 0.1 | ||
| 45 | +*/ | ||
| 46 | + | ||
| 47 | +class FirstLogin { | ||
| 48 | + /** | ||
| 49 | + * Reference to simple xml object | ||
| 50 | + * | ||
| 51 | + * @author KnowledgeTree Team | ||
| 52 | + * @access protected | ||
| 53 | + * @var object SimpleXMLElement | ||
| 54 | + */ | ||
| 55 | + protected $simpleXmlObj = null; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * Reference to step action object | ||
| 59 | + * | ||
| 60 | + * @author KnowledgeTree Team | ||
| 61 | + * @access protected | ||
| 62 | + * @var object StepAction | ||
| 63 | + */ | ||
| 64 | + protected $stepAction = null; | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Reference to session object | ||
| 68 | + * | ||
| 69 | + * @author KnowledgeTree Team | ||
| 70 | + * @access protected | ||
| 71 | + * @var object Session | ||
| 72 | + */ | ||
| 73 | + protected $session = null; | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * List of steps as strings | ||
| 77 | + * | ||
| 78 | + * @author KnowledgeTree Team | ||
| 79 | + * @access protected | ||
| 80 | + * @var array string | ||
| 81 | + */ | ||
| 82 | + protected $stepClassNames = array(); | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * List of steps as human readable strings | ||
| 86 | + * | ||
| 87 | + * @author KnowledgeTree Team | ||
| 88 | + * @access protected | ||
| 89 | + * @var array string | ||
| 90 | + */ | ||
| 91 | + protected $stepNames = array(); | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * List of steps as human readable strings | ||
| 95 | + * | ||
| 96 | + * @author KnowledgeTree Team | ||
| 97 | + * @access protected | ||
| 98 | + * @var array string | ||
| 99 | + */ | ||
| 100 | + protected $stepObjects = array(); | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Order in which steps have to be done | ||
| 104 | + * | ||
| 105 | + * @author KnowledgeTree Team | ||
| 106 | + * @access protected | ||
| 107 | + * @var array string | ||
| 108 | + */ | ||
| 109 | + protected $orders = array(); | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * List of properties | ||
| 113 | + * | ||
| 114 | + * @author KnowledgeTree Team | ||
| 115 | + * @access protected | ||
| 116 | + * @var array string | ||
| 117 | + */ | ||
| 118 | + protected $properties = array(); | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * Flag if a step object needs confirmation | ||
| 122 | + * | ||
| 123 | + * @author KnowledgeTree Team | ||
| 124 | + * @access protected | ||
| 125 | + * @var boolean | ||
| 126 | + */ | ||
| 127 | + protected $stepConfirmation = false; | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * Flag if a step object needs confirmation | ||
| 131 | + * | ||
| 132 | + * @author KnowledgeTree Team | ||
| 133 | + * @access protected | ||
| 134 | + * @var boolean | ||
| 135 | + */ | ||
| 136 | + protected $stepDisplayFirst = false; | ||
| 137 | + | ||
| 138 | + private $action = ''; | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * Constructs object | ||
| 142 | + * | ||
| 143 | + * @author KnowledgeTree Team | ||
| 144 | + * @access public | ||
| 145 | + * @param object Session $session Instance of the Session object | ||
| 146 | + */ | ||
| 147 | + public function __construct($session = null) { | ||
| 148 | + $this->session = $session; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * Read xml configuration file | ||
| 153 | + * | ||
| 154 | + * @author KnowledgeTree Team | ||
| 155 | + * @param string $name of config file | ||
| 156 | + * @access private | ||
| 157 | + * @return object | ||
| 158 | + */ | ||
| 159 | + private function _readXml($name = "config.xml") { | ||
| 160 | + try { | ||
| 161 | + $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name"); | ||
| 162 | + } catch (Exception $e) { | ||
| 163 | + $util = new FirstLoginUtil(); | ||
| 164 | + $util->error("Error reading configuration file: $e"); | ||
| 165 | + exit(); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * Checks if first step | ||
| 171 | + * | ||
| 172 | + * @author KnowledgeTree Team | ||
| 173 | + * @param none | ||
| 174 | + * @access private | ||
| 175 | + * @return boolean | ||
| 176 | + */ | ||
| 177 | + private function _firstStep() { | ||
| 178 | + if(isset($_GET['step_name'])) { | ||
| 179 | + return false; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + return true; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * Checks if first step | ||
| 187 | + * | ||
| 188 | + * @author KnowledgeTree Team | ||
| 189 | + * @param none | ||
| 190 | + * @access private | ||
| 191 | + * @return boolean | ||
| 192 | + */ | ||
| 193 | + private function _firstStepPeriod() { | ||
| 194 | + if(isset($_GET['step_name'])) { | ||
| 195 | + if($_GET['step_name'] != 'installation') | ||
| 196 | + return false; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + return true; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * Returns next step | ||
| 204 | + * | ||
| 205 | + * @author KnowledgeTree Team | ||
| 206 | + * @param none | ||
| 207 | + * @access private | ||
| 208 | + * @return string | ||
| 209 | + */ | ||
| 210 | + private function _getNextStep() { | ||
| 211 | + return $this->_getStepName(1); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + /** | ||
| 215 | + * Returns previous step | ||
| 216 | + * | ||
| 217 | + * @author KnowledgeTree Team | ||
| 218 | + * @param none | ||
| 219 | + * @access private | ||
| 220 | + * @return string | ||
| 221 | + */ | ||
| 222 | + private function _getPreviousStep() { | ||
| 223 | + return $this->_getStepName(-1); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + /** | ||
| 227 | + * Returns the step name, given a position | ||
| 228 | + * | ||
| 229 | + * @author KnowledgeTree Team | ||
| 230 | + * @param integer $pos current position | ||
| 231 | + * @access private | ||
| 232 | + * @return string $name | ||
| 233 | + */ | ||
| 234 | + private function _getStepName($pos = 0) { | ||
| 235 | + if($this->_firstStep()) { | ||
| 236 | + $step = (string) $this->simpleXmlObj->steps->step[0]; | ||
| 237 | + } else { | ||
| 238 | + $pos += $this->getStepPosition(); | ||
| 239 | + $step = (string) $this->simpleXmlObj->steps->step[$pos]; | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + return $step; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + /** | ||
| 246 | + * Executes next step | ||
| 247 | + * | ||
| 248 | + * @author KnowledgeTree Team | ||
| 249 | + * @param none | ||
| 250 | + * @access private | ||
| 251 | + * @return string | ||
| 252 | + */ | ||
| 253 | + private function _proceed() { | ||
| 254 | + $step_name = $this->_getNextStep(); | ||
| 255 | + | ||
| 256 | + return $this->_runStepAction($step_name); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + /** | ||
| 260 | + * Executes previous step | ||
| 261 | + * | ||
| 262 | + * @author KnowledgeTree Team | ||
| 263 | + * @param none | ||
| 264 | + * @access private | ||
| 265 | + * @return string | ||
| 266 | + */ | ||
| 267 | + private function _backward() { | ||
| 268 | + $step_name = $this->_getPreviousStep(); | ||
| 269 | + | ||
| 270 | + return $this->_runStepAction($step_name); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /** | ||
| 274 | + * Executes step landing | ||
| 275 | + * | ||
| 276 | + * @author KnowledgeTree Team | ||
| 277 | + * @param none | ||
| 278 | + * @access private | ||
| 279 | + * @return string | ||
| 280 | + */ | ||
| 281 | + private function _landing() { | ||
| 282 | + $step_name = $this->_getStepName(); | ||
| 283 | + | ||
| 284 | + return $this->_runStepAction($step_name); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + /** | ||
| 288 | + * Executes step based on step class name | ||
| 289 | + * | ||
| 290 | + * @author KnowledgeTree Team | ||
| 291 | + * @param string $step_name | ||
| 292 | + * @access private | ||
| 293 | + * @return string | ||
| 294 | + */ | ||
| 295 | + private function _runStepAction($stepName) { | ||
| 296 | + $this->stepAction = new stepAction($stepName); | ||
| 297 | + $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getProperties()); | ||
| 298 | + | ||
| 299 | + return $this->stepAction->doAction(); | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + private function stepDisplayFirst() { | ||
| 303 | + if($this->action == 'edit') | ||
| 304 | + return false; // | ||
| 305 | + $class = $this->stepAction->createStep(); // Get step class | ||
| 306 | + return $class->displayFirst(); // Check if class needs to display first | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + /** | ||
| 310 | + * Set steps class names in string format | ||
| 311 | + * | ||
| 312 | + * @author KnowledgeTree Team | ||
| 313 | + * @param none | ||
| 314 | + * @access private | ||
| 315 | + * @return array | ||
| 316 | + */ | ||
| 317 | + private function _getOrders() { | ||
| 318 | + return $this->orders; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + /** | ||
| 322 | + * Set steps as names | ||
| 323 | + * | ||
| 324 | + * @author KnowledgeTree Team | ||
| 325 | + * @param none | ||
| 326 | + * @access private | ||
| 327 | + * @return void | ||
| 328 | + */ | ||
| 329 | + private function _xmlStepsToArray() { | ||
| 330 | + if(isset($this->simpleXmlObj)) { | ||
| 331 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 332 | + $step_name = (string) $d_step[0]; | ||
| 333 | + $this->stepClassNames[] = $step_name; | ||
| 334 | + } | ||
| 335 | + $this->_loadToSession('stepClassNames', $this->stepClassNames); | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + /** | ||
| 340 | + * Set steps as human readable strings | ||
| 341 | + * | ||
| 342 | + * @author KnowledgeTree Team | ||
| 343 | + * @param none | ||
| 344 | + * @access private | ||
| 345 | + * @return void | ||
| 346 | + */ | ||
| 347 | + private function _xmlStepsNames() { | ||
| 348 | + if(isset($this->simpleXmlObj)) { | ||
| 349 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 350 | + $step_name = (string) $d_step[0]; | ||
| 351 | + $this->stepNames[$step_name] = (string) $d_step['name']; | ||
| 352 | + } | ||
| 353 | + $this->_loadToSession('stepNames', $this->stepNames); | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + /** | ||
| 358 | + * Set steps order | ||
| 359 | + * | ||
| 360 | + * @author KnowledgeTree Team | ||
| 361 | + * @param none | ||
| 362 | + * @access private | ||
| 363 | + * @return void | ||
| 364 | + */ | ||
| 365 | + private function _xmlStepsOrders() { | ||
| 366 | + if(isset($this->simpleXmlObj)) { | ||
| 367 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 368 | + if(isset($d_step['order'])) { | ||
| 369 | + $step_name = (string) $d_step[0]; | ||
| 370 | + $order = (string) $d_step['order']; | ||
| 371 | + $this->orders[$order] = $step_name; // Store step order | ||
| 372 | + } | ||
| 373 | + } | ||
| 374 | + $this->_loadToSession('orders', $this->orders); | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + /** | ||
| 379 | + * Set properties | ||
| 380 | + * | ||
| 381 | + * @author KnowledgeTree Team | ||
| 382 | + * @param none | ||
| 383 | + * @access private | ||
| 384 | + * @return void | ||
| 385 | + */ | ||
| 386 | + private function _xmlProperties() { | ||
| 387 | + if(isset($this->simpleXmlObj)) { | ||
| 388 | + $this->properties['fl_version'] = (string) $this->simpleXmlObj['version']; | ||
| 389 | + $this->properties['fl_type'] = (string) $this->simpleXmlObj['type']; | ||
| 390 | + $this->_loadToSession('properties', $this->properties); | ||
| 391 | + } | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + /** | ||
| 395 | + * Steps | ||
| 396 | + * | ||
| 397 | + * @author KnowledgeTree Team | ||
| 398 | + * @param none | ||
| 399 | + * @access private | ||
| 400 | + * @return void | ||
| 401 | + */ | ||
| 402 | + private function _runSteps() { | ||
| 403 | + $steps = $this->_getOrders(); | ||
| 404 | + for ($i=1; $i< count($steps)+1; $i++) { | ||
| 405 | + $this->_helper($steps[$i]); | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + $this->_complete(); | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + /** | ||
| 412 | + * Complete cleanup process | ||
| 413 | + * | ||
| 414 | + * @author KnowledgeTree Team | ||
| 415 | + * @param none | ||
| 416 | + * @access private | ||
| 417 | + * @return void | ||
| 418 | + */ | ||
| 419 | + private function _complete() { | ||
| 420 | + touch("firstlogin"); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + /** | ||
| 424 | + * Steps helper | ||
| 425 | + * | ||
| 426 | + * @author KnowledgeTree Team | ||
| 427 | + * @param none | ||
| 428 | + * @access private | ||
| 429 | + * @return void | ||
| 430 | + */ | ||
| 431 | + private function _helper($className) { | ||
| 432 | + $stepAction = new stepAction($className); // Instantiate a step action | ||
| 433 | + $class = $stepAction->createStep(); // Get step class | ||
| 434 | + if($class) { // Check if class Exists | ||
| 435 | + if($class->run()) { // Check if step needs to be run | ||
| 436 | + $class->setDataFromSession($className); // Set Session Information | ||
| 437 | + $class->setPostConfig(); // Set any posted variables | ||
| 438 | + $class->Step(); // Run step | ||
| 439 | + } | ||
| 440 | + } else { | ||
| 441 | + $util = new firstloginUtil(); | ||
| 442 | + $util->error("Class File Missing in Step Directory: $className"); | ||
| 443 | + exit(); | ||
| 444 | + } | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + /** | ||
| 448 | + * Reset all session information on welcome landing | ||
| 449 | + * | ||
| 450 | + * @author KnowledgeTree Team | ||
| 451 | + * @param none | ||
| 452 | + * @access private | ||
| 453 | + * @return void | ||
| 454 | + */ | ||
| 455 | + private function _resetSessions() { | ||
| 456 | + if($this->session) { | ||
| 457 | + if($this->_firstStepPeriod()) { | ||
| 458 | + foreach ($this->getSteps() as $class) { | ||
| 459 | + $this->session->un_setClass($class); | ||
| 460 | + } | ||
| 461 | + foreach ($this->getStepNames() as $class) { | ||
| 462 | + $this->session->un_setClass($class); | ||
| 463 | + } | ||
| 464 | + foreach ($this->_getOrders() as $class) { | ||
| 465 | + $this->session->un_setClass($class); | ||
| 466 | + } | ||
| 467 | + } | ||
| 468 | + } | ||
| 469 | + } | ||
| 470 | + | ||
| 471 | + function _loadFromSessions() { | ||
| 472 | + $this->stepClassNames = $this->session->get('stepClassNames'); | ||
| 473 | + if(!$this->stepClassNames) { | ||
| 474 | + $this->_xmlStepsToArray(); // String steps | ||
| 475 | + } | ||
| 476 | + $this->stepNames = $this->session->get('stepNames'); | ||
| 477 | + if(!$this->stepNames) { | ||
| 478 | + $this->_xmlStepsNames(); | ||
| 479 | + } | ||
| 480 | + $this->Orders = $this->session->get('Orders'); | ||
| 481 | + if(!$this->orders) { | ||
| 482 | + $this->_xmlStepsOrders(); | ||
| 483 | + } | ||
| 484 | + $this->properties = $this->session->get('properties'); | ||
| 485 | + if(!$this->properties) { | ||
| 486 | + $this->_xmlProperties(); | ||
| 487 | + } | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + private function loadNeeded() { | ||
| 491 | + $this->_readXml(); // Xml steps | ||
| 492 | + // Make sure session is cleared | ||
| 493 | + $this->_resetSessions(); | ||
| 494 | + $this->_loadFromSessions(); | ||
| 495 | + if(isset($_POST['Next'])) { | ||
| 496 | + $this->action = 'next'; | ||
| 497 | + $this->response = 'next'; | ||
| 498 | + } elseif (isset($_POST['Previous'])) { | ||
| 499 | + $this->action = 'previous'; | ||
| 500 | + $this->response = 'previous'; | ||
| 501 | + } elseif (isset($_POST['Confirm'])) { | ||
| 502 | + $this->action = 'confirm'; | ||
| 503 | + $this->response = 'next'; | ||
| 504 | + } elseif (isset($_POST['Edit'])) { | ||
| 505 | + $this->action = 'edit'; | ||
| 506 | + $this->response = 'next'; | ||
| 507 | + } else { | ||
| 508 | + $this->response = ''; | ||
| 509 | + $this->action = ''; | ||
| 510 | + } | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + /** | ||
| 514 | + * Main control to handle the flow | ||
| 515 | + * | ||
| 516 | + * @author KnowledgeTree Team | ||
| 517 | + * @param none | ||
| 518 | + * @access public | ||
| 519 | + * @return void | ||
| 520 | + */ | ||
| 521 | + public function step() { | ||
| 522 | + $this->loadNeeded(); | ||
| 523 | + switch($this->response) { | ||
| 524 | + case 'next': | ||
| 525 | + $step_name = $this->_getStepName(); | ||
| 526 | + $res = $this->_runStepAction($step_name); | ||
| 527 | + if($res == 'next') { | ||
| 528 | + $this->_proceed(); // Load next window | ||
| 529 | + } elseif ($res == 'confirm') { | ||
| 530 | + if(!$this->stepDisplayFirst()) | ||
| 531 | + $this->stepConfirmation = true; | ||
| 532 | + $this->_landing(); | ||
| 533 | + } elseif ($res == 'landing') { | ||
| 534 | + $this->_landing(); | ||
| 535 | + } else { | ||
| 536 | + } | ||
| 537 | + break; | ||
| 538 | + case 'previous': | ||
| 539 | + $this->_backward(); // Load previous page | ||
| 540 | + break; | ||
| 541 | + case 'install': | ||
| 542 | + $util = new firstloginUtil(); | ||
| 543 | + $util->redirect('../wizard/index.php?step_name=installtype'); | ||
| 544 | + break; | ||
| 545 | + default: | ||
| 546 | + $this->_landing(); | ||
| 547 | + break; | ||
| 548 | + } | ||
| 549 | + $this->stepAction->paintAction(); // Display step | ||
| 550 | + } | ||
| 551 | + | ||
| 552 | + /** | ||
| 553 | + * Returns the step number | ||
| 554 | + * | ||
| 555 | + * @author KnowledgeTree Team | ||
| 556 | + * @param none | ||
| 557 | + * @access public | ||
| 558 | + * @return integer $pos | ||
| 559 | + */ | ||
| 560 | + public function getStepPosition() { | ||
| 561 | + $pos = 0; | ||
| 562 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 563 | + $step = (string) $d_step; | ||
| 564 | + if ($step == $_GET['step_name']) { | ||
| 565 | + break; | ||
| 566 | + } | ||
| 567 | + $pos++; | ||
| 568 | + } | ||
| 569 | + if(isset($_GET['step'])) { | ||
| 570 | + if($_GET['step'] == "next") | ||
| 571 | + $pos = $pos+1; | ||
| 572 | + else | ||
| 573 | + $pos = $pos-1; | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + return $pos; | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + /** | ||
| 580 | + * Returns the step names for classes | ||
| 581 | + * | ||
| 582 | + * @author KnowledgeTree Team | ||
| 583 | + * @param none | ||
| 584 | + * @access public | ||
| 585 | + * @return array | ||
| 586 | + */ | ||
| 587 | + public function getSteps() { | ||
| 588 | + return $this->stepClassNames; | ||
| 589 | + } | ||
| 590 | + | ||
| 591 | + /** | ||
| 592 | + * Returns the steps as human readable string | ||
| 593 | + * | ||
| 594 | + * @author KnowledgeTree Team | ||
| 595 | + * @param none | ||
| 596 | + * @access public | ||
| 597 | + * @return array | ||
| 598 | + */ | ||
| 599 | + public function getStepNames() { | ||
| 600 | + return $this->stepNames; | ||
| 601 | + } | ||
| 602 | + | ||
| 603 | + /** | ||
| 604 | + * Returns whether or not a confirmation step is needed | ||
| 605 | + * | ||
| 606 | + * @author KnowledgeTree Team | ||
| 607 | + * @param none | ||
| 608 | + * @access public | ||
| 609 | + * @return boolean | ||
| 610 | + */ | ||
| 611 | + public function getStepConfirmation() { | ||
| 612 | + return $this->stepConfirmation; | ||
| 613 | + } | ||
| 614 | + | ||
| 615 | + /** | ||
| 616 | + * Return properties | ||
| 617 | + * | ||
| 618 | + * @author KnowledgeTree Team | ||
| 619 | + * @param string | ||
| 620 | + * @access public | ||
| 621 | + * @return string | ||
| 622 | + */ | ||
| 623 | + public function getProperties() { | ||
| 624 | + return $this->properties; | ||
| 625 | + } | ||
| 626 | + | ||
| 627 | + /** | ||
| 628 | + * Returns session | ||
| 629 | + * | ||
| 630 | + * @author KnowledgeTree Team | ||
| 631 | + * @param none | ||
| 632 | + * @access public | ||
| 633 | + * @return boolean | ||
| 634 | + */ | ||
| 635 | + public function getSession() { | ||
| 636 | + return $this->session; | ||
| 637 | + } | ||
| 638 | + | ||
| 639 | + /** | ||
| 640 | + * Dump of SESSION | ||
| 641 | + * | ||
| 642 | + * @author KnowledgeTree Team | ||
| 643 | + * @param none | ||
| 644 | + * @access public | ||
| 645 | + * @return array | ||
| 646 | + */ | ||
| 647 | + public function showSession() { | ||
| 648 | + echo '<pre>'; | ||
| 649 | + print_r($_SESSION); | ||
| 650 | + echo '</pre>'; | ||
| 651 | + } | ||
| 652 | + | ||
| 653 | + /** | ||
| 654 | + * Display errors that are not allowing the operation | ||
| 655 | + * | ||
| 656 | + * @author KnowledgeTree Team | ||
| 657 | + * @param none | ||
| 658 | + * @access public | ||
| 659 | + * @return void | ||
| 660 | + */ | ||
| 661 | + public function resolveErrors($errors) { | ||
| 662 | + echo $errors; | ||
| 663 | + exit(); | ||
| 664 | + } | ||
| 665 | + | ||
| 666 | + private function _loadToSession($type, $values) { | ||
| 667 | + if($values) { | ||
| 668 | + $this->session->set($type , $values); | ||
| 669 | + } | ||
| 670 | + } | ||
| 671 | +} | ||
| 672 | + | ||
| 673 | +?> |
setup/firstlogin/firstloginUtil.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Utilities Library | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* Contributor( s): ______________________________________ | ||
| 35 | +*/ | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | +* | ||
| 39 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 40 | +* @license GNU General Public License version 3 | ||
| 41 | +* @author KnowledgeTree Team | ||
| 42 | +* @package First Login | ||
| 43 | +* @version Version 0.1 | ||
| 44 | +*/ | ||
| 45 | +require_once("../wizard/installUtil.php"); | ||
| 46 | + | ||
| 47 | +class firstloginUtil extends InstallUtil { | ||
| 48 | + /** | ||
| 49 | + * Check system | ||
| 50 | + * | ||
| 51 | + * @author KnowledgeTree Team | ||
| 52 | + * @access public | ||
| 53 | + * @param none | ||
| 54 | + * @return boolean | ||
| 55 | + */ | ||
| 56 | + public function isSystem() { | ||
| 57 | + if (file_exists(dirname(__FILE__)."/firstlogin")) { | ||
| 58 | + | ||
| 59 | + return true; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + return false; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public function error($error) { | ||
| 66 | + $template_vars['fl_type'] = strtoupper(substr(INSTALL_TYPE,0,1)).substr(INSTALL_TYPE,1); | ||
| 67 | + $template_vars['fl_version'] = $this->readVersion(); | ||
| 68 | + $template_vars['error'] = $error; | ||
| 69 | + $file = "templates/error.tpl"; | ||
| 70 | + if (file_exists($file)) { | ||
| 71 | + extract($template_vars); // Extract the vars to local namespace | ||
| 72 | + ob_start(); | ||
| 73 | + include($file); | ||
| 74 | + $contents = ob_get_contents(); | ||
| 75 | + ob_end_clean(); | ||
| 76 | + echo $contents; | ||
| 77 | + } | ||
| 78 | + return false; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * Check if system needs | ||
| 83 | + * | ||
| 84 | + * @author KnowledgeTree Team | ||
| 85 | + * @access public | ||
| 86 | + * @param none | ||
| 87 | + * @return mixed | ||
| 88 | + */ | ||
| 89 | + public function checkStructurePermissions() { | ||
| 90 | + // Check if Wizard Directory is writable | ||
| 91 | + if(!$this->_checkPermission(WIZARD_DIR)) { | ||
| 92 | + return 'firstlogin'; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return true; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public function loadInstallServices() { | ||
| 99 | + require_once("../wizard/steps/services.php"); | ||
| 100 | + $s = new services(); | ||
| 101 | + return $s->getServices(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public function loadInstallService($serviceName) { | ||
| 105 | + require_once("../wizard/lib/services/service.php"); | ||
| 106 | + require_once("../wizard/lib/services/".OS."Service.php"); | ||
| 107 | + require_once("../wizard/lib/services/$serviceName.php"); | ||
| 108 | + return new $serviceName(); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * Return port of the old installation | ||
| 113 | + * | ||
| 114 | + * @param location | ||
| 115 | + * @return string | ||
| 116 | + */ | ||
| 117 | + public function getPort($location) { | ||
| 118 | + if(WINDOWS_OS) { | ||
| 119 | + $myIni = "my.ini"; | ||
| 120 | + } else { | ||
| 121 | + $myIni = "my.cnf"; | ||
| 122 | + } | ||
| 123 | + $dbConfigPath = $location.DS."mysql".DS."$myIni"; | ||
| 124 | + if(file_exists($dbConfigPath)) { | ||
| 125 | + $this->iniUtilities->load($dbConfigPath); | ||
| 126 | + $dbSettings = $this->iniUtilities->getSection('mysqladmin'); | ||
| 127 | + return $dbSettings['port']; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + return '3306'; | ||
| 131 | + } | ||
| 132 | +} | ||
| 133 | +?> | ||
| 0 | \ No newline at end of file | 134 | \ No newline at end of file |
setup/firstlogin/firstloginWizard.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Index. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* Contributor( s): ______________________________________ | ||
| 36 | +*/ | ||
| 37 | + | ||
| 38 | +/** | ||
| 39 | +* | ||
| 40 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 41 | +* @license GNU General Public License version 3 | ||
| 42 | +* @author KnowledgeTree Team | ||
| 43 | +* @package First Login | ||
| 44 | +* @version Version 0.1 | ||
| 45 | +*/ | ||
| 46 | + | ||
| 47 | +require_once("../wizard/share/wizardBase.php"); | ||
| 48 | + | ||
| 49 | +class firstloginWizard extends WizardBase { | ||
| 50 | + /** | ||
| 51 | + * Constructs wizard object | ||
| 52 | + * | ||
| 53 | + * @author KnowledgeTree Team | ||
| 54 | + * @access public | ||
| 55 | + */ | ||
| 56 | + public function __construct(){} | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Check if system | ||
| 60 | + * | ||
| 61 | + * @author KnowledgeTree Team | ||
| 62 | + * @access private | ||
| 63 | + * @param none | ||
| 64 | + * @return boolean | ||
| 65 | + */ | ||
| 66 | + private function isSystem() { | ||
| 67 | + return $this->util->isSystem(); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * Display the wizard | ||
| 72 | + * | ||
| 73 | + * @author KnowledgeTree Team | ||
| 74 | + * @access private | ||
| 75 | + * @param string | ||
| 76 | + * @return void | ||
| 77 | + */ | ||
| 78 | + public function display($response = null) { | ||
| 79 | + if($response) { | ||
| 80 | + $ins = new FirstLogin(); // Instantiate | ||
| 81 | + $ins->resolveErrors($response); // Run step | ||
| 82 | + } else { | ||
| 83 | + $ins = new FirstLogin(new Session()); // Instantiate and pass the session class | ||
| 84 | + $ins->step(); // Run step | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Create file | ||
| 90 | + * | ||
| 91 | + * @author KnowledgeTree Team | ||
| 92 | + * @access private | ||
| 93 | + * @param none | ||
| 94 | + * @return void | ||
| 95 | + */ | ||
| 96 | + private function createFile() { | ||
| 97 | + touch(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock"); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * Remove file | ||
| 102 | + * | ||
| 103 | + * @author KnowledgeTree Team | ||
| 104 | + * @access private | ||
| 105 | + * @param none | ||
| 106 | + * @return void | ||
| 107 | + */ | ||
| 108 | + private function removeFile() { | ||
| 109 | + unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock"); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * Load default values | ||
| 114 | + * | ||
| 115 | + * @author KnowledgeTree Team | ||
| 116 | + * @access private | ||
| 117 | + * @param none | ||
| 118 | + * @return void | ||
| 119 | + */ | ||
| 120 | + function load() { | ||
| 121 | + if(isset($_GET['bypass'])) { | ||
| 122 | + $this->setBypass($_GET['bypass']); | ||
| 123 | + } | ||
| 124 | + $this->setIUtil(new firstloginUtil()); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * Run pre system checks | ||
| 129 | + * | ||
| 130 | + * @author KnowledgeTree Team | ||
| 131 | + * @access public | ||
| 132 | + * @param none | ||
| 133 | + * @return mixed | ||
| 134 | + */ | ||
| 135 | + public function systemChecks() { | ||
| 136 | + $res = $this->util->checkStructurePermissions(); | ||
| 137 | + if($res === true) return $res; | ||
| 138 | + switch ($res) { | ||
| 139 | + case "wizard": | ||
| 140 | + $this->util->error("firstlogin directory is not writable (KT_Installation_Directory/setup/firstlogin/)"); | ||
| 141 | + return 'firstlogin directory is not writable (KT_Installation_Directory/setup/firstlogin/)'; | ||
| 142 | + break; | ||
| 143 | + case "/": | ||
| 144 | + $this->util->error("System root is not writable (KT_Installation_Directory/)"); | ||
| 145 | + return "System root is not writable (KT_Installation_Directory/)"; | ||
| 146 | + break; | ||
| 147 | + default: | ||
| 148 | + return true; | ||
| 149 | + break; | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * Control all requests to wizard | ||
| 155 | + * | ||
| 156 | + * @author KnowledgeTree Team | ||
| 157 | + * @access public | ||
| 158 | + * @param none | ||
| 159 | + * @return void | ||
| 160 | + */ | ||
| 161 | + public function dispatch() { | ||
| 162 | + $this->load(); | ||
| 163 | + if($this->getBypass() === "1") { | ||
| 164 | + $this->removeFile(); | ||
| 165 | + } elseif ($this->getBypass() === "0") { | ||
| 166 | + $this->createFile(); | ||
| 167 | + } | ||
| 168 | + if(!$this->isSystem()) { // Check if the systems | ||
| 169 | + $response = $this->systemChecks(); | ||
| 170 | + if($response === true) { | ||
| 171 | + $this->display(); | ||
| 172 | + } else { | ||
| 173 | + exit(); | ||
| 174 | + } | ||
| 175 | + } else { | ||
| 176 | + $this->util->error("System preferences run before. <a href='../../login.php' class='back' style='width:50px;float:none' back button_next>Finish</a>"); | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | +} | ||
| 180 | + | ||
| 181 | +$ic = new firstloginWizard(); | ||
| 182 | +$ic->dispatch(); | ||
| 183 | +?> | ||
| 0 | \ No newline at end of file | 184 | \ No newline at end of file |
setup/firstlogin/index.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Index. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* Contributor( s): ______________________________________ | ||
| 36 | +*/ | ||
| 37 | + | ||
| 38 | +/** | ||
| 39 | +* | ||
| 40 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 41 | +* @license GNU General Public License version 3 | ||
| 42 | +* @author KnowledgeTree Team | ||
| 43 | +* @package First Login | ||
| 44 | +* @version Version 0.1 | ||
| 45 | +*/ | ||
| 46 | +$_GET['type'] = 'firstlogin'; | ||
| 47 | +require_once("firstloginWizard.php"); | ||
| 48 | +?> | ||
| 0 | \ No newline at end of file | 49 | \ No newline at end of file |
setup/firstlogin/session.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Session Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* Contributor( s): ______________________________________ | ||
| 35 | +*/ | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | +* | ||
| 39 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 40 | +* @license GNU General Public License version 3 | ||
| 41 | +* @author KnowledgeTree Team | ||
| 42 | +* @package First Login | ||
| 43 | +* @version Version 0.1 | ||
| 44 | +*/ | ||
| 45 | +class Session extends SessionBase | ||
| 46 | +{ | ||
| 47 | + public $salt = 'firstlogin'; | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * Constructs session object | ||
| 51 | + * | ||
| 52 | + * @author KnowledgeTree Team | ||
| 53 | + * @access public | ||
| 54 | + * @param none | ||
| 55 | + */ | ||
| 56 | + public function __construct() { | ||
| 57 | + $this->setSalt($this->salt); | ||
| 58 | + $this->startSession(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | +} | ||
| 62 | +?> | ||
| 0 | \ No newline at end of file | 63 | \ No newline at end of file |
setup/firstlogin/step.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Step . | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* Contributor( s): ______________________________________ | ||
| 35 | +*/ | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | +* | ||
| 39 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 40 | +* @license GNU General Public License version 3 | ||
| 41 | +* @author KnowledgeTree Team | ||
| 42 | +* @package | ||
| 43 | +* @version Version 0.1 | ||
| 44 | +*/ | ||
| 45 | +class Step extends StepBase | ||
| 46 | +{ | ||
| 47 | + /** | ||
| 48 | + * Flag if step needs | ||
| 49 | + * | ||
| 50 | + * @author KnowledgeTree Team | ||
| 51 | + * @access public | ||
| 52 | + * @var array | ||
| 53 | + */ | ||
| 54 | + private $run = false; | ||
| 55 | + | ||
| 56 | + public function __construct() { | ||
| 57 | + $this->util = new firstloginUtil(); | ||
| 58 | + $this->salt = 'firstlogin'; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * Checks if Confirm button has been clicked | ||
| 63 | + * | ||
| 64 | + * @author KnowledgeTree Team | ||
| 65 | + * @param none | ||
| 66 | + * @access public | ||
| 67 | + * @return boolean | ||
| 68 | + */ | ||
| 69 | + function firstlogin() { | ||
| 70 | + if(isset($_POST['firstlogin'])) { | ||
| 71 | + return true; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + return false; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * Checks if Confirm button has been clicked | ||
| 79 | + * | ||
| 80 | + * @author KnowledgeTree Team | ||
| 81 | + * @param none | ||
| 82 | + * @access public | ||
| 83 | + * @return boolean | ||
| 84 | + */ | ||
| 85 | + function installer() { | ||
| 86 | + if(isset($_POST['Install'])) { | ||
| 87 | + return true; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return false; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Load session data to post | ||
| 95 | + * | ||
| 96 | + * @author KnowledgeTree Team | ||
| 97 | + * @params none | ||
| 98 | + * @access private | ||
| 99 | + * @return boolean | ||
| 100 | + */ | ||
| 101 | + public function setDataFromSession($class) { | ||
| 102 | + if(empty($_SESSION[$this->salt][$class])) { | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + $_POST = isset($_SESSION[$this->salt]['firstlogin'][$class]) ? $_SESSION[$this->salt]['firstlogin'][$class]: ''; | ||
| 106 | + | ||
| 107 | + return true; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * Get session data from post | ||
| 112 | + * | ||
| 113 | + * @author KnowledgeTree Team | ||
| 114 | + * @params none | ||
| 115 | + * @access private | ||
| 116 | + * @return boolean | ||
| 117 | + */ | ||
| 118 | + public function getDataFromSession($class) { | ||
| 119 | + if(empty($_SESSION[$this->salt][$class])) { | ||
| 120 | + return false; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + return $_SESSION[$this->salt][$class]; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * Runs step if required | ||
| 128 | + * | ||
| 129 | + * @author KnowledgeTree Team | ||
| 130 | + * @param none | ||
| 131 | + * @access public | ||
| 132 | + * @return void | ||
| 133 | + */ | ||
| 134 | + public function Step() { | ||
| 135 | + return ''; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * Return whether or not to a step | ||
| 140 | + * | ||
| 141 | + * @author KnowledgeTree Team | ||
| 142 | + * @param none | ||
| 143 | + * @access public | ||
| 144 | + * @return boolean | ||
| 145 | + */ | ||
| 146 | + public function run() { | ||
| 147 | + return $this->run; | ||
| 148 | + } | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | +?> | ||
| 0 | \ No newline at end of file | 152 | \ No newline at end of file |
setup/firstlogin/stepAction.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Steap Action Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* Contributor( s): ______________________________________ | ||
| 36 | +*/ | ||
| 37 | + | ||
| 38 | +/** | ||
| 39 | +* | ||
| 40 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 41 | +* @license GNU General Public License version 3 | ||
| 42 | +* @author KnowledgeTree Team | ||
| 43 | +* @package First Login | ||
| 44 | +* @version Version 0.1 | ||
| 45 | +*/ | ||
| 46 | + | ||
| 47 | +class stepAction extends stepActionBase { | ||
| 48 | + /** | ||
| 49 | + * Constructs step action object | ||
| 50 | + * | ||
| 51 | + * @author KnowledgeTree Team | ||
| 52 | + * @access public | ||
| 53 | + * @param string class name of the current step | ||
| 54 | + */ | ||
| 55 | + public function __construct($step) { | ||
| 56 | + $this->stepName = $step; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * Instantiate a step. | ||
| 61 | + * | ||
| 62 | + * @author KnowledgeTree Team | ||
| 63 | + * @param none | ||
| 64 | + * @access public | ||
| 65 | + * @return object Step | ||
| 66 | + */ | ||
| 67 | + public function createStep() { | ||
| 68 | + $step_class = "firstlogin".$this->makeCamelCase($this->stepName); | ||
| 69 | + | ||
| 70 | + return new $step_class(); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * Returns step tenplate content | ||
| 75 | + * | ||
| 76 | + * @author KnowledgeTree Team | ||
| 77 | + * @param none | ||
| 78 | + * @access public | ||
| 79 | + * @return string | ||
| 80 | + */ | ||
| 81 | + | ||
| 82 | + public function getVars() { | ||
| 83 | + $left = $this->getLeftMenu(); | ||
| 84 | + $vars['left'] = $left; // Set left menu | ||
| 85 | + $vars['fl_version'] = $this->properties['fl_version']; // Set version | ||
| 86 | + $vars['fl_type'] = $this->properties['fl_type']; // Set type | ||
| 87 | + return $vars; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +?> | ||
| 0 | \ No newline at end of file | 93 | \ No newline at end of file |
setup/firstlogin/steps/fsComplete.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Complete Step Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* Contributor( s): ______________________________________ | ||
| 35 | +*/ | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | +* | ||
| 39 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 40 | +* @license GNU General Public License version 3 | ||
| 41 | +* @author KnowledgeTree Team | ||
| 42 | +* @package First Login | ||
| 43 | +* @version Version 0.1 | ||
| 44 | +*/ | ||
| 45 | + | ||
| 46 | +class fsComplete extends Step { | ||
| 47 | + /** | ||
| 48 | + * Flag if step needs to run silently | ||
| 49 | + * | ||
| 50 | + * @access protected | ||
| 51 | + * @var boolean | ||
| 52 | + */ | ||
| 53 | + protected $silent = true; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Returns step state | ||
| 57 | + * | ||
| 58 | + * @author KnowledgeTree Team | ||
| 59 | + * @param none | ||
| 60 | + * @access public | ||
| 61 | + * @return string | ||
| 62 | + */ | ||
| 63 | + function doStep() { | ||
| 64 | + $this->temp_variables = array( | ||
| 65 | + "step_name"=>"complete", | ||
| 66 | + "silent"=>$this->silent); | ||
| 67 | + return $this->doRun(); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + function doRun() { | ||
| 71 | + | ||
| 72 | + return 'landing'; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + public function getErrors() { | ||
| 78 | + return $this->error; | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | +?> | ||
| 0 | \ No newline at end of file | 82 | \ No newline at end of file |
setup/firstlogin/steps/fsTemplates.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Template Step Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* Contributor( s): ______________________________________ | ||
| 35 | +*/ | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | +* | ||
| 39 | +* @copyright 2008-2010, KnowledgeTree Inc. | ||
| 40 | +* @license GNU General Public License version 3 | ||
| 41 | +* @author KnowledgeTree Team | ||
| 42 | +* @package First Login | ||
| 43 | +* @version Version 0.1 | ||
| 44 | +*/ | ||
| 45 | + | ||
| 46 | +class fsTemplates extends Step { | ||
| 47 | + /** | ||
| 48 | + * Flag if step needs to run silently | ||
| 49 | + * | ||
| 50 | + * @access protected | ||
| 51 | + * @var boolean | ||
| 52 | + */ | ||
| 53 | + protected $silent = true; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Returns step state | ||
| 57 | + * | ||
| 58 | + * @author KnowledgeTree Team | ||
| 59 | + * @param none | ||
| 60 | + * @access public | ||
| 61 | + * @return string | ||
| 62 | + */ | ||
| 63 | + function doStep() { | ||
| 64 | + $this->temp_variables = array( | ||
| 65 | + "step_name"=>"folderstructures", | ||
| 66 | + "silent"=>$this->silent); | ||
| 67 | + return $this->doRun(); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + function doRun() { | ||
| 71 | + | ||
| 72 | + return 'landing'; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public function getErrors() { | ||
| 76 | + return $this->error; | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | +?> | ||
| 0 | \ No newline at end of file | 80 | \ No newline at end of file |
setup/firstlogin/templates/complete.tpl
0 → 100644
| 1 | +<form action="index.php?step_name=<?php echo $step_name; ?>" method="post" id="<?php echo $step_name; ?>"> | ||
| 2 | + <p class="title">Preferences Completed</p> | ||
| 3 | + | ||
| 4 | + <p class="description">Your system preferences have been applied</p> | ||
| 5 | + <div id="step_content_<?php echo $step_name; ?>" class="step"> | ||
| 6 | + | ||
| 7 | + <input class="button_next" type="submit" value="Next" name="Next"/> | ||
| 8 | +</form> | ||
| 9 | +<?php if (AJAX) { echo $html->js('form.js'); } ?> | ||
| 0 | \ No newline at end of file | 10 | \ No newline at end of file |
setup/firstlogin/templates/error.tpl
0 → 100644
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
| 2 | +<html> | ||
| 3 | + <head> | ||
| 4 | + <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon"> | ||
| 5 | + <title>KnowledgeTree Installer</title> | ||
| 6 | + <script type="text/javascript" src="resources/jquery.js"></script> | ||
| 7 | + <script type="text/javascript" src="resources/wizard.js" ></script> | ||
| 8 | + <link rel="stylesheet" type="text/css" href="resources/wizard.css" /> | ||
| 9 | + </head> | ||
| 10 | + | ||
| 11 | + <body onload=""> | ||
| 12 | + <div id="outer-wrapper"> | ||
| 13 | + <div id="header"> | ||
| 14 | + <div id="logo"><img src="resources/graphics/dame/installer-header_logo.png"/></div> | ||
| 15 | + <div id="install_details"> | ||
| 16 | + <span style="font-size:120%;"> <?php echo $fl_version; ?> </span> | ||
| 17 | + <span style="font-size:80%;"> <?php echo $fl_type; ?> </span> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + <div id="wrapper"> | ||
| 21 | + <div id="container"> | ||
| 22 | + <div id="sidebar"> | ||
| 23 | + <span class="current">Welcome</span><br><span class="inactive">Current Installation</span><br><span class="inactive">Deactivate Services</span><br><span class="inactive">Database Migration</span><br><span class="inactive">Complete</span><br></div> | ||
| 24 | + | ||
| 25 | + <div id="content"> | ||
| 26 | + <div id="content_container"> | ||
| 27 | + <form action="index.php?step_name=isntallation" method="post"> | ||
| 28 | + <div id="step_content" class="step"> | ||
| 29 | + <p class="title">Welcome to the KnowledgeTree Migration Wizard</p> | ||
| 30 | + <?php if(isset($error)) { | ||
| 31 | + echo "<span class='error'>".$error."</span>"; | ||
| 32 | + ?> | ||
| 33 | + <?php | ||
| 34 | + } | ||
| 35 | + ?> | ||
| 36 | + <?php | ||
| 37 | + if(isset($errors)) { | ||
| 38 | + if($errors){ | ||
| 39 | + echo '<div class="error">'; | ||
| 40 | + foreach ($errors as $msg){ | ||
| 41 | + echo $msg . "<br />"; | ||
| 42 | + ?> | ||
| 43 | +<!-- <a href="javascript:this.location.reload();" class="refresh">Refresh</a>--> | ||
| 44 | + <?php | ||
| 45 | + } | ||
| 46 | + echo '</div>'; | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + ?> | ||
| 50 | + </div> | ||
| 51 | + </form> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + <div class="clearing"> </div> | ||
| 56 | + </div> | ||
| 57 | + | ||
| 58 | + <div id="footer"> | ||
| 59 | + | ||
| 60 | + <img width="105" height="23" align="right" src="resources/graphics/dame/powered-by-kt.png" style="padding: 5px;"/> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </body> | ||
| 64 | +</html> | ||
| 65 | +<script> | ||
| 66 | + var w = new wizard(); | ||
| 67 | +</script> | ||
| 0 | \ No newline at end of file | 68 | \ No newline at end of file |
setup/firstlogin/templates/errors.tpl
0 → 100644
| 1 | +<p class="title">Welcome to the KnowledgeTree Migration Wizard</p> | ||
| 2 | + | ||
| 3 | +<div style="width: 800px;"> | ||
| 4 | +<?php if(isset($error)) echo $error; ?> | ||
| 5 | +<?php | ||
| 6 | +if($errors){ | ||
| 7 | + echo '<div class="error">'; | ||
| 8 | + foreach ($errors as $msg){ | ||
| 9 | + echo $msg . "<br />\n"; | ||
| 10 | + } | ||
| 11 | + echo '</div>'; | ||
| 12 | +} | ||
| 13 | +?> | ||
| 14 | +</div> | ||
| 0 | \ No newline at end of file | 15 | \ No newline at end of file |
setup/firstlogin/templates/templates.tpl
0 → 100644
| 1 | +<form id="<?php echo $step_name; ?>" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> | ||
| 2 | + <p class="title">Apply A Folder Template to KnowledgeTree</p> | ||
| 3 | + | ||
| 4 | + <input type="submit" name="Previous" value="Previous" class="button_previous"/> | ||
| 5 | + <input type="submit" name="Next" value="Next" class="button_next"/> | ||
| 6 | +</form> | ||
| 7 | +<script type="text/javascript"> | ||
| 8 | + $("#duname").focus(); | ||
| 9 | +</script> | ||
| 10 | +<?php if (AJAX) { echo $html->js('form.js'); } ?> | ||
| 0 | \ No newline at end of file | 11 | \ No newline at end of file |
setup/firstlogin/templates/wizard.tpl
0 → 100644
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
| 2 | +<html> | ||
| 3 | + <head> | ||
| 4 | + <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon"> | ||
| 5 | + <title>KnowledgeTree Installer</title> | ||
| 6 | + <?php echo $html->js('jquery.js'); ?> | ||
| 7 | + <?php echo $html->js('jquery.form.js'); ?> | ||
| 8 | + <?php echo $html->js('jquery.blockUI.js'); ?> | ||
| 9 | + <?php echo $html->js('jquery.hotkeys.js'); ?> | ||
| 10 | + <?php echo $html->js('wizard.js'); ?> | ||
| 11 | + <?php echo $html->css('wizard.css'); ?> | ||
| 12 | + <?php echo $html->css('firstlogin.css'); ?> | ||
| 13 | + <?php if(AGENT == "IE6") echo $html->css('ie6.css'); ?> | ||
| 14 | + <?php if(AGENT == "IE7") echo $html->css('ie7.css'); ?> | ||
| 15 | + <?php if(AGENT == "IE8") echo $html->css('ie8.css'); ?> | ||
| 16 | + <?php if(INSTALL_TYPE == "community") echo $html->css('community.css'); ?> | ||
| 17 | + <meta http-equiv=Content-Type content="text/html; charset=utf-8"> | ||
| 18 | + </head> | ||
| 19 | + <body onload=""> | ||
| 20 | + <div id="outer-outer-wrapper" align="center"> | ||
| 21 | + <div id="outer-wrapper" align="left"> | ||
| 22 | + <div id="header"> | ||
| 23 | + <div id="logo"><?php echo $html->image('dame/installer-header_logo.png'); ?> </div> | ||
| 24 | + <div id="version_details"> | ||
| 25 | + <span style="font-size:120%;"> <?php if (isset($vars['fl_version'])) echo $vars['fl_version']; ?> </span> | ||
| 26 | + <span style="font-size:120%;"> <?php if (isset($vars['fl_version'])) echo $vars['fl_type']; ?></span> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + <div id="wrapper"> | ||
| 30 | + <div id="container"> | ||
| 31 | + <div id="sidebar"> | ||
| 32 | + <?php echo $vars['left']; ?> | ||
| 33 | + </div> | ||
| 34 | + <div id="content"> | ||
| 35 | + <div id="content_container"> | ||
| 36 | + <?php echo $content; ?> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + <div id="loading" style="display:none;"> <?php echo $html->image('loading.gif', array("height"=>"32px", "width"=>"32px")); ?> </div> | ||
| 40 | + </div> | ||
| 41 | + <div class="clearing"> </div> | ||
| 42 | + </div> | ||
| 43 | + | ||
| 44 | + <div id="footer"> | ||
| 45 | + <?php echo $html->image('dame/powered-by-kt.png', array("height"=>"23px", "width"=>"105px", "style"=>"padding: 5px;")); ?> | ||
| 46 | + </div> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + </body> | ||
| 50 | +</html> | ||
| 51 | +<script> | ||
| 52 | + var w = new wizard(); | ||
| 53 | +</script> | ||
| 0 | \ No newline at end of file | 54 | \ No newline at end of file |
setup/migrate/migrateWizard.php
| @@ -43,49 +43,10 @@ | @@ -43,49 +43,10 @@ | ||
| 43 | * @package Migrater | 43 | * @package Migrater |
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | -include("../wizard/path.php"); // Paths | ||
| 47 | 46 | ||
| 48 | -/** | ||
| 49 | - * Auto loader to bind migrater package | ||
| 50 | - * | ||
| 51 | - * @param string $class | ||
| 52 | - * @return void | ||
| 53 | - */ | ||
| 54 | -function __autoload($class) { // Attempt and autoload classes | ||
| 55 | - $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems. | ||
| 56 | - if ($class == "template") { // Load existing templating classes | ||
| 57 | - require_once("../wizard/template.php"); | ||
| 58 | - require_once("../wizard/lib/helpers/htmlHelper.php"); | ||
| 59 | - } else { | ||
| 60 | - if(file_exists(WIZARD_DIR."$class.php")) { | ||
| 61 | - require_once(WIZARD_DIR."$class.php"); | ||
| 62 | - } elseif (file_exists(STEP_DIR."$class.php")) { | ||
| 63 | - require_once(STEP_DIR."$class.php"); | ||
| 64 | - } elseif (file_exists(WIZARD_LIB."$class.php")) { | ||
| 65 | - require_once(WIZARD_LIB."$class.php"); | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | -} | ||
| 69 | - | ||
| 70 | -class MigrateWizard { | ||
| 71 | - /** | ||
| 72 | - * Migrate bypass flag | ||
| 73 | - * | ||
| 74 | - * @author KnowledgeTree Team | ||
| 75 | - * @access protected | ||
| 76 | - * @var mixed | ||
| 77 | - */ | ||
| 78 | - protected $bypass = null; | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * Reference to migrater utility object | ||
| 82 | - * | ||
| 83 | - * @author KnowledgeTree Team | ||
| 84 | - * @access protected | ||
| 85 | - * @var boolean | ||
| 86 | - */ | ||
| 87 | - protected $util = null; | 47 | +require_once("../wizard/share/wizardBase.php"); |
| 88 | 48 | ||
| 49 | +class MigrateWizard extends WizardBase { | ||
| 89 | /** | 50 | /** |
| 90 | * Constructs migrateation wizard object | 51 | * Constructs migrateation wizard object |
| 91 | * | 52 | * |
| @@ -114,7 +75,7 @@ class MigrateWizard { | @@ -114,7 +75,7 @@ class MigrateWizard { | ||
| 114 | * @param string | 75 | * @param string |
| 115 | * @return void | 76 | * @return void |
| 116 | */ | 77 | */ |
| 117 | - public function displayMigrater($response = null) { | 78 | + public function display($response = null) { |
| 118 | if($response) { | 79 | if($response) { |
| 119 | $ins = new Migrater(); // Instantiate the migrater | 80 | $ins = new Migrater(); // Instantiate the migrater |
| 120 | $ins->resolveErrors($response); // Run step | 81 | $ins->resolveErrors($response); // Run step |
| @@ -125,54 +86,6 @@ class MigrateWizard { | @@ -125,54 +86,6 @@ class MigrateWizard { | ||
| 125 | } | 86 | } |
| 126 | 87 | ||
| 127 | /** | 88 | /** |
| 128 | - * Set bypass flag | ||
| 129 | - * | ||
| 130 | - * @author KnowledgeTree Team | ||
| 131 | - * @access private | ||
| 132 | - * @param boolean | ||
| 133 | - * @return void | ||
| 134 | - */ | ||
| 135 | - private function setBypass($bypass) { | ||
| 136 | - $this->bypass = $bypass; | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * Set util reference | ||
| 141 | - * | ||
| 142 | - * @author KnowledgeTree Team | ||
| 143 | - * @access private | ||
| 144 | - * @param object migrater utility | ||
| 145 | - * @return void | ||
| 146 | - */ | ||
| 147 | - private function setIUtil($util) { | ||
| 148 | - $this->util = $util; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * Get bypass flag | ||
| 153 | - * | ||
| 154 | - * @author KnowledgeTree Team | ||
| 155 | - * @access public | ||
| 156 | - * @param none | ||
| 157 | - * @return boolean | ||
| 158 | - */ | ||
| 159 | - public function getBypass() { | ||
| 160 | - return $this->bypass; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * Bypass and force an migrate | ||
| 165 | - * | ||
| 166 | - * @author KnowledgeTree Team | ||
| 167 | - * @access private | ||
| 168 | - * @param none | ||
| 169 | - * @return boolean | ||
| 170 | - */ | ||
| 171 | - private function bypass() { | ||
| 172 | - | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | * Create migrate file | 89 | * Create migrate file |
| 177 | * | 90 | * |
| 178 | * @author KnowledgeTree Team | 91 | * @author KnowledgeTree Team |
| @@ -181,7 +94,7 @@ class MigrateWizard { | @@ -181,7 +94,7 @@ class MigrateWizard { | ||
| 181 | * @return void | 94 | * @return void |
| 182 | */ | 95 | */ |
| 183 | private function createMigrateFile() { | 96 | private function createMigrateFile() { |
| 184 | - touch("migrate"); | 97 | + touch(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock"); |
| 185 | } | 98 | } |
| 186 | 99 | ||
| 187 | /** | 100 | /** |
| @@ -193,7 +106,7 @@ class MigrateWizard { | @@ -193,7 +106,7 @@ class MigrateWizard { | ||
| 193 | * @return void | 106 | * @return void |
| 194 | */ | 107 | */ |
| 195 | private function removeMigrateFile() { | 108 | private function removeMigrateFile() { |
| 196 | - unlink("migrate"); | 109 | + unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock"); |
| 197 | } | 110 | } |
| 198 | 111 | ||
| 199 | /** | 112 | /** |
| @@ -255,7 +168,7 @@ class MigrateWizard { | @@ -255,7 +168,7 @@ class MigrateWizard { | ||
| 255 | if(!$this->isSystemMigrated()) { // Check if the systems not migrated | 168 | if(!$this->isSystemMigrated()) { // Check if the systems not migrated |
| 256 | $response = $this->systemChecks(); | 169 | $response = $this->systemChecks(); |
| 257 | if($response === true) { | 170 | if($response === true) { |
| 258 | - $this->displayMigrater(); | 171 | + $this->display(); |
| 259 | } else { | 172 | } else { |
| 260 | exit(); | 173 | exit(); |
| 261 | } | 174 | } |
setup/migrate/migrater.php
| @@ -557,12 +557,7 @@ class Migrater { | @@ -557,12 +557,7 @@ class Migrater { | ||
| 557 | $util = new MigrateUtil(); | 557 | $util = new MigrateUtil(); |
| 558 | $util->redirect('../wizard/index.php?step_name=installtype'); | 558 | $util->redirect('../wizard/index.php?step_name=installtype'); |
| 559 | break; | 559 | break; |
| 560 | -// case 'binstall': | ||
| 561 | -// $util = new MigrateUtil(); | ||
| 562 | -// $util->redirect('../wizard/index.php?step_name=dependencies'); | ||
| 563 | -// break; | ||
| 564 | default: | 560 | default: |
| 565 | - // TODO : handle silent | ||
| 566 | $this->_landing(); | 561 | $this->_landing(); |
| 567 | break; | 562 | break; |
| 568 | } | 563 | } |
setup/migrate/session.php
| @@ -42,9 +42,10 @@ | @@ -42,9 +42,10 @@ | ||
| 42 | * @package Migrater | 42 | * @package Migrater |
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | -class Session | 45 | +class Session extends SessionBase |
| 46 | { | 46 | { |
| 47 | - private $salt = 'migrate'; | 47 | + public $salt = 'migrate'; |
| 48 | + | ||
| 48 | /** | 49 | /** |
| 49 | * Constructs session object | 50 | * Constructs session object |
| 50 | * | 51 | * |
| @@ -53,175 +54,9 @@ class Session | @@ -53,175 +54,9 @@ class Session | ||
| 53 | * @param none | 54 | * @param none |
| 54 | */ | 55 | */ |
| 55 | public function __construct() { | 56 | public function __construct() { |
| 57 | + $this->setSalt($this->salt); | ||
| 56 | $this->startSession(); | 58 | $this->startSession(); |
| 57 | } | 59 | } |
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * Starts a session if one does not exist | ||
| 61 | - * | ||
| 62 | - * @author KnowledgeTree Team | ||
| 63 | - * @param none | ||
| 64 | - * @access public | ||
| 65 | - * @return void | ||
| 66 | - */ | ||
| 67 | - public function startSession() { | ||
| 68 | - if(!isset($_SESSION[$this->salt]['ready'])) { | ||
| 69 | - @session_start(); | ||
| 70 | - $_SESSION[$this->salt] ['ready'] = TRUE; | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | 60 | ||
| 74 | - /** | ||
| 75 | - * Sets a value key pair in session | ||
| 76 | - * | ||
| 77 | - * @author KnowledgeTree Team | ||
| 78 | - * @param string $fld | ||
| 79 | - * @param string $val | ||
| 80 | - * @access public | ||
| 81 | - * @return void | ||
| 82 | - */ | ||
| 83 | - public function set($fld, $val) { | ||
| 84 | - $this->startSession(); | ||
| 85 | - $_SESSION[$this->salt] [$fld] = $val; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - /** | ||
| 89 | - * Sets a value key pair in a class in session | ||
| 90 | - * | ||
| 91 | - * @author KnowledgeTree Team | ||
| 92 | - * @param string $class | ||
| 93 | - * @param string $fld | ||
| 94 | - * @param string $val | ||
| 95 | - * @access public | ||
| 96 | - * @return void | ||
| 97 | - */ | ||
| 98 | - public function setClass($class , $k, $v) { | ||
| 99 | - $this->startSession(); | ||
| 100 | - $classArray = $this->get($class); | ||
| 101 | - if(isset($classArray[$k])) { | ||
| 102 | - $classArray[$k] = $v; | ||
| 103 | - } else { | ||
| 104 | - $classArray[$k] = $v; | ||
| 105 | - } | ||
| 106 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - /** | ||
| 110 | - * Sets a error value key pair in a class in session | ||
| 111 | - * | ||
| 112 | - * @author KnowledgeTree Team | ||
| 113 | - * @param string $class | ||
| 114 | - * @param string $fld | ||
| 115 | - * @param string $val | ||
| 116 | - * @access public | ||
| 117 | - * @return void | ||
| 118 | - */ | ||
| 119 | - public function setClassError($class, $k, $v) { | ||
| 120 | - $this->startSession(); | ||
| 121 | - $classArray = $this->get($class); | ||
| 122 | - if(isset($classArray[$k])) { | ||
| 123 | - $classArray[$k] = $v; | ||
| 124 | - } else { | ||
| 125 | - $classArray[$k] = $v; | ||
| 126 | - } | ||
| 127 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * Clear error values in a class session | ||
| 132 | - * | ||
| 133 | - * @author KnowledgeTree Team | ||
| 134 | - * @param string $class | ||
| 135 | - * @param string $fld | ||
| 136 | - * @param string $val | ||
| 137 | - * @access public | ||
| 138 | - * @return void | ||
| 139 | - */ | ||
| 140 | - public function clearErrors($class) { | ||
| 141 | - $classArray = $this->get($class); | ||
| 142 | - unset($classArray['errors']); | ||
| 143 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - /** | ||
| 147 | - * Unset a value in session | ||
| 148 | - * | ||
| 149 | - * @author KnowledgeTree Team | ||
| 150 | - * @param string $fld | ||
| 151 | - * @access public | ||
| 152 | - * @return void | ||
| 153 | - */ | ||
| 154 | - public function un_set($fld) { | ||
| 155 | - $this->startSession(); | ||
| 156 | - unset($_SESSION[$this->salt] [$fld]); | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - /** | ||
| 160 | - * Unset a class value in session | ||
| 161 | - * | ||
| 162 | - * @author KnowledgeTree Team | ||
| 163 | - * @param string $class | ||
| 164 | - * @access public | ||
| 165 | - * @return void | ||
| 166 | - */ | ||
| 167 | - public function un_setClass($class) { | ||
| 168 | - $this->startSession(); | ||
| 169 | - if(isset($_SESSION[$this->salt] [$class])) | ||
| 170 | - unset($_SESSION[$this->salt] [$class]); | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - /** | ||
| 174 | - * Destroy the session | ||
| 175 | - * | ||
| 176 | - * @author KnowledgeTree Team | ||
| 177 | - * @param none | ||
| 178 | - * @access public | ||
| 179 | - * @return void | ||
| 180 | - */ | ||
| 181 | - public function destroyMigrate() { | ||
| 182 | - $this->startSession(); | ||
| 183 | - unset($_SESSION[$this->salt]); | ||
| 184 | - session_destroy(); | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * Get a session value | ||
| 189 | - * | ||
| 190 | - * @author KnowledgeTree Team | ||
| 191 | - * @param string $fld | ||
| 192 | - * @access public | ||
| 193 | - * @return string | ||
| 194 | - */ | ||
| 195 | - public function get($fld) { | ||
| 196 | - $this->startSession(); | ||
| 197 | - if(isset($_SESSION[$this->salt] [$fld])) | ||
| 198 | - return $_SESSION[$this->salt] [$fld]; | ||
| 199 | - return false; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - /** | ||
| 203 | - * Check if a field exists in session | ||
| 204 | - * | ||
| 205 | - * @author KnowledgeTree Team | ||
| 206 | - * @param string $fld | ||
| 207 | - * @access public | ||
| 208 | - * @return string | ||
| 209 | - */ | ||
| 210 | - public function is_set($fld) { | ||
| 211 | - $this->startSession(); | ||
| 212 | - return isset($_SESSION[$this->salt] [$fld]); | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - /** | ||
| 216 | - * Return a class from session | ||
| 217 | - * | ||
| 218 | - * @author KnowledgeTree Team | ||
| 219 | - * @param string $fld | ||
| 220 | - * @access public | ||
| 221 | - * @return string | ||
| 222 | - */ | ||
| 223 | - public function getClass($class) { | ||
| 224 | - return $_SESSION[$this->salt][$class]; | ||
| 225 | - } | ||
| 226 | } | 61 | } |
| 227 | ?> | 62 | ?> |
| 228 | \ No newline at end of file | 63 | \ No newline at end of file |
setup/migrate/step.php
| @@ -42,231 +42,23 @@ | @@ -42,231 +42,23 @@ | ||
| 42 | * @package Migrater | 42 | * @package Migrater |
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | -class Step | 45 | +class Step extends StepBase |
| 46 | { | 46 | { |
| 47 | /** | 47 | /** |
| 48 | - * List of variables to be loaded to template | ||
| 49 | - * | ||
| 50 | - * @author KnowledgeTree Team | ||
| 51 | - * @access protected | ||
| 52 | - * @var array | ||
| 53 | - */ | ||
| 54 | - protected $temp_variables = array(); | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * List of errors encountered by step | ||
| 58 | - * | ||
| 59 | - * @author KnowledgeTree Team | ||
| 60 | - * @access protected | ||
| 61 | - * @var array | ||
| 62 | - */ | ||
| 63 | - protected $error = array(); | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * List of warnings encountered by step | ||
| 67 | - * | ||
| 68 | - * @author KnowledgeTree Team | ||
| 69 | - * @access protected | ||
| 70 | - * @var array | ||
| 71 | - */ | ||
| 72 | - protected $warnings = array(); | ||
| 73 | - | ||
| 74 | - /** | ||
| 75 | - * Flag to store class information in session | ||
| 76 | - * | ||
| 77 | - * @author KnowledgeTree Team | ||
| 78 | - * @access public | ||
| 79 | - * @var array | ||
| 80 | - */ | ||
| 81 | - protected $storeInSession = false; | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | * Flag if step needs to be migrated | 48 | * Flag if step needs to be migrated |
| 85 | * | 49 | * |
| 86 | * @author KnowledgeTree Team | 50 | * @author KnowledgeTree Team |
| 87 | * @access public | 51 | * @access public |
| 88 | * @var array | 52 | * @var array |
| 89 | */ | 53 | */ |
| 90 | - protected $runMigrate = false; | ||
| 91 | - | ||
| 92 | - /** | ||
| 93 | - * Step order | ||
| 94 | - * | ||
| 95 | - * @author KnowledgeTree Team | ||
| 96 | - * @access public | ||
| 97 | - * @var string | ||
| 98 | - */ | ||
| 99 | - protected $order = false; | ||
| 100 | - | ||
| 101 | - /** | ||
| 102 | - * Flag if step needs to run silently | ||
| 103 | - * | ||
| 104 | - * @author KnowledgeTree Team | ||
| 105 | - * @access public | ||
| 106 | - * @var boolean | ||
| 107 | - */ | ||
| 108 | - protected $silent = false; | ||
| 109 | - | ||
| 110 | - public $displayFirst = false; | ||
| 111 | - | ||
| 112 | - private $salt = 'migrate'; | ||
| 113 | - | ||
| 114 | - /** | ||
| 115 | - * Reference to utility object | ||
| 116 | - * | ||
| 117 | - * @author KnowledgeTree Team | ||
| 118 | - * @access protected | ||
| 119 | - * @var object | ||
| 120 | - */ | ||
| 121 | - public $util; | 54 | + private $runMigrate = false; |
| 122 | 55 | ||
| 123 | public function __construct() { | 56 | public function __construct() { |
| 124 | $this->util = new MigrateUtil(); | 57 | $this->util = new MigrateUtil(); |
| 58 | + $this->salt = 'migrate'; | ||
| 125 | } | 59 | } |
| 126 | 60 | ||
| 127 | /** | 61 | /** |
| 128 | - * Returns step state | ||
| 129 | - * | ||
| 130 | - * @author KnowledgeTree Team | ||
| 131 | - * @param none | ||
| 132 | - * @access public | ||
| 133 | - * @return string | ||
| 134 | - */ | ||
| 135 | - public function doStep() | ||
| 136 | - { | ||
| 137 | - return ''; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - public function displayFirst() { | ||
| 141 | - return $this->displayFirst; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - /** | ||
| 145 | - * Returns step variables | ||
| 146 | - * | ||
| 147 | - * @author KnowledgeTree Team | ||
| 148 | - * @param none | ||
| 149 | - * @access public | ||
| 150 | - * @return array | ||
| 151 | - */ | ||
| 152 | - public function getStepVars() | ||
| 153 | - { | ||
| 154 | - return $this->temp_variables; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - /** | ||
| 158 | - * Returns step errors | ||
| 159 | - * | ||
| 160 | - * @author KnowledgeTree Team | ||
| 161 | - * @param none | ||
| 162 | - * @access public | ||
| 163 | - * @return array | ||
| 164 | - */ | ||
| 165 | - public function getErrors() { | ||
| 166 | - return $this->error; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - /** | ||
| 170 | - * Returns step errors | ||
| 171 | - * | ||
| 172 | - * @author KnowledgeTree Team | ||
| 173 | - * @param none | ||
| 174 | - * @access public | ||
| 175 | - * @return array | ||
| 176 | - */ | ||
| 177 | - public function getWarnings() { | ||
| 178 | - return $this->warnings; | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - /** | ||
| 182 | - * Load default step values | ||
| 183 | - * | ||
| 184 | - * @author KnowledgeTree Team | ||
| 185 | - * @param none | ||
| 186 | - * @access public | ||
| 187 | - * @return void | ||
| 188 | - */ | ||
| 189 | - public function loadDefaults() { | ||
| 190 | - | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * Return default step values | ||
| 195 | - * | ||
| 196 | - * @author KnowledgeTree Team | ||
| 197 | - * @param none | ||
| 198 | - * @access public | ||
| 199 | - * @return array | ||
| 200 | - */ | ||
| 201 | - public function getDefaults() { | ||
| 202 | - return array(); | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - /** | ||
| 206 | - * Checks if edit button has been clicked | ||
| 207 | - * | ||
| 208 | - * @author KnowledgeTree Team | ||
| 209 | - * @param none | ||
| 210 | - * @access public | ||
| 211 | - * @return boolean | ||
| 212 | - */ | ||
| 213 | - public function edit() { | ||
| 214 | - if(isset($_POST['Edit'])) { | ||
| 215 | - return true; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - return false; | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - /** | ||
| 222 | - * Checks if next button has been clicked | ||
| 223 | - * | ||
| 224 | - * @author KnowledgeTree Team | ||
| 225 | - * @param none | ||
| 226 | - * @access public | ||
| 227 | - * @return boolean | ||
| 228 | - */ | ||
| 229 | - public function next() { | ||
| 230 | - if(isset($_POST['Next'])) { | ||
| 231 | - return true; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - return false; | ||
| 235 | - } | ||
| 236 | - | ||
| 237 | - /** | ||
| 238 | - * Checks if previous button has been clicked | ||
| 239 | - * | ||
| 240 | - * @author KnowledgeTree Team | ||
| 241 | - * @param none | ||
| 242 | - * @access public | ||
| 243 | - * @return boolean | ||
| 244 | - */ | ||
| 245 | - public function previous() { | ||
| 246 | - if(isset($_POST['Previous'])) { | ||
| 247 | - return true; | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | - return false; | ||
| 251 | - } | ||
| 252 | - | ||
| 253 | - /** | ||
| 254 | - * Checks if Confirm button has been clicked | ||
| 255 | - * | ||
| 256 | - * @author KnowledgeTree Team | ||
| 257 | - * @param none | ||
| 258 | - * @access public | ||
| 259 | - * @return boolean | ||
| 260 | - */ | ||
| 261 | - function confirm() { | ||
| 262 | - if(isset($_POST['Confirm'])) { | ||
| 263 | - return true; | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - return false; | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - /** | ||
| 270 | * Checks if Confirm button has been clicked | 62 | * Checks if Confirm button has been clicked |
| 271 | * | 63 | * |
| 272 | * @author KnowledgeTree Team | 64 | * @author KnowledgeTree Team |
| @@ -297,20 +89,6 @@ class Step | @@ -297,20 +89,6 @@ class Step | ||
| 297 | 89 | ||
| 298 | return false; | 90 | return false; |
| 299 | } | 91 | } |
| 300 | - /** | ||
| 301 | - * Checks if we are currently in this class step | ||
| 302 | - * | ||
| 303 | - * @author KnowledgeTree Team | ||
| 304 | - * @param string | ||
| 305 | - * @access public | ||
| 306 | - * @return boolean | ||
| 307 | - */ | ||
| 308 | - public function inStep($name) { | ||
| 309 | - if(!isset($_GET['step_name'])) return false; | ||
| 310 | - if($_GET['step_name'] == $name) | ||
| 311 | - return true; | ||
| 312 | - return false; | ||
| 313 | - } | ||
| 314 | 92 | ||
| 315 | /** | 93 | /** |
| 316 | * Load session data to post | 94 | * Load session data to post |
| @@ -346,30 +124,6 @@ class Step | @@ -346,30 +124,6 @@ class Step | ||
| 346 | } | 124 | } |
| 347 | 125 | ||
| 348 | /** | 126 | /** |
| 349 | - * Safer way to return post data | ||
| 350 | - * | ||
| 351 | - * @author KnowledgeTree Team | ||
| 352 | - * @params SimpleXmlObject $simplexml | ||
| 353 | - * @access public | ||
| 354 | - * @return void | ||
| 355 | - */ | ||
| 356 | - public function getPostSafe($key) { | ||
| 357 | - return isset($_POST[$key]) ? $_POST[$key] : ""; | ||
| 358 | - } | ||
| 359 | - | ||
| 360 | - /** | ||
| 361 | - * Safer way to return post data | ||
| 362 | - * | ||
| 363 | - * @author KnowledgeTree Team | ||
| 364 | - * @params SimpleXmlObject $simplexml | ||
| 365 | - * @access public | ||
| 366 | - * @return void | ||
| 367 | - */ | ||
| 368 | - public function getPostBoolean($key) { | ||
| 369 | - return isset($_POST[$key]) ? $_POST[$key] : false; | ||
| 370 | - } | ||
| 371 | - | ||
| 372 | - /** | ||
| 373 | * Runs step migrate if required | 127 | * Runs step migrate if required |
| 374 | * | 128 | * |
| 375 | * @author KnowledgeTree Team | 129 | * @author KnowledgeTree Team |
| @@ -382,18 +136,6 @@ class Step | @@ -382,18 +136,6 @@ class Step | ||
| 382 | } | 136 | } |
| 383 | 137 | ||
| 384 | /** | 138 | /** |
| 385 | - * Return whether or not to store a step information in session | ||
| 386 | - * | ||
| 387 | - * @author KnowledgeTree Team | ||
| 388 | - * @param none | ||
| 389 | - * @access public | ||
| 390 | - * @return boolean | ||
| 391 | - */ | ||
| 392 | - public function storeInSession() { | ||
| 393 | - return $this->storeInSession; | ||
| 394 | - } | ||
| 395 | - | ||
| 396 | - /** | ||
| 397 | * Return whether or not to a step has to be migrated | 139 | * Return whether or not to a step has to be migrated |
| 398 | * | 140 | * |
| 399 | * @author KnowledgeTree Team | 141 | * @author KnowledgeTree Team |
| @@ -403,49 +145,7 @@ class Step | @@ -403,49 +145,7 @@ class Step | ||
| 403 | */ | 145 | */ |
| 404 | public function runMigrate() { | 146 | public function runMigrate() { |
| 405 | return $this->runMigrate; | 147 | return $this->runMigrate; |
| 406 | - } | ||
| 407 | - | ||
| 408 | - public function setPostConfig() { | ||
| 409 | - return ''; | ||
| 410 | - } | ||
| 411 | - | ||
| 412 | - /** | ||
| 413 | - * Return whether or not to a step has to be in silent mode | ||
| 414 | - * | ||
| 415 | - * @author KnowledgeTree Team | ||
| 416 | - * @param none | ||
| 417 | - * @access public | ||
| 418 | - * @return boolean | ||
| 419 | - */ | ||
| 420 | - public function silentMode() { | ||
| 421 | - return $this->silent; | ||
| 422 | - } | ||
| 423 | - | ||
| 424 | - /** | ||
| 425 | - * Set step errors | ||
| 426 | - * | ||
| 427 | - * @author KnowledgeTree Team | ||
| 428 | - * @param none | ||
| 429 | - * @access public | ||
| 430 | - * @return array | ||
| 431 | - */ | ||
| 432 | - public function setErrors($error) { | ||
| 433 | - $this->error = $error; | ||
| 434 | - } | ||
| 435 | - | ||
| 436 | - /** | ||
| 437 | - * Is the installation | ||
| 438 | - * | ||
| 439 | - * @author KnowledgeTree Team | ||
| 440 | - * @param none | ||
| 441 | - * @access public | ||
| 442 | - * @return string | ||
| 443 | - */ | ||
| 444 | - public function isCe() { | ||
| 445 | - if($this->util->getVersionType() == "community") | ||
| 446 | - return true; | ||
| 447 | - return false; | ||
| 448 | - } | 148 | + } |
| 449 | } | 149 | } |
| 450 | 150 | ||
| 451 | ?> | 151 | ?> |
| 452 | \ No newline at end of file | 152 | \ No newline at end of file |
setup/migrate/stepAction.php
| @@ -44,70 +44,7 @@ | @@ -44,70 +44,7 @@ | ||
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | -class stepAction { | ||
| 48 | - /** | ||
| 49 | - * Step class name | ||
| 50 | - * | ||
| 51 | - * @author KnowledgeTree Team | ||
| 52 | - * @access protected | ||
| 53 | - * @var string | ||
| 54 | - */ | ||
| 55 | - protected $stepName = ''; | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * Step names for classes | ||
| 59 | - * | ||
| 60 | - * @author KnowledgeTree Team | ||
| 61 | - * @access protected | ||
| 62 | - * @var array | ||
| 63 | - */ | ||
| 64 | - protected $stepClassNames = array(); | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * Flag if step needs confirmation | ||
| 68 | - * | ||
| 69 | - * @author KnowledgeTree Team | ||
| 70 | - * @access protected | ||
| 71 | - * @var boolean | ||
| 72 | - */ | ||
| 73 | - protected $displayConfirm = false; | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * Returns whether or not to display the confirmation page first | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var boolean | ||
| 81 | - */ | ||
| 82 | - protected $displayFirst = false; | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * List of migrate properties | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var boolean | ||
| 90 | - */ | ||
| 91 | - protected $migrateProperties = array(); | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * Reference to session object | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var object Session | ||
| 99 | - */ | ||
| 100 | - protected $session = null; | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | - * Reference to current step object | ||
| 104 | - * | ||
| 105 | - * @author KnowledgeTree Team | ||
| 106 | - * @access protected | ||
| 107 | - * @var object class Step | ||
| 108 | - */ | ||
| 109 | - protected $action = null; | ||
| 110 | - | 47 | +class stepAction extends stepActionBase { |
| 111 | /** | 48 | /** |
| 112 | * Constructs step action object | 49 | * Constructs step action object |
| 113 | * | 50 | * |
| @@ -120,129 +57,6 @@ class stepAction { | @@ -120,129 +57,6 @@ class stepAction { | ||
| 120 | } | 57 | } |
| 121 | 58 | ||
| 122 | /** | 59 | /** |
| 123 | - * Helper to initialize step actions | ||
| 124 | - * | ||
| 125 | - * @author KnowledgeTree Team | ||
| 126 | - * @param string | ||
| 127 | - * @access public | ||
| 128 | - * @return string | ||
| 129 | - */ | ||
| 130 | - public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $migrateProperties) { | ||
| 131 | - $this->setSteps($steps); | ||
| 132 | - $this->setStepNames($stepNames); | ||
| 133 | - $this->setDisplayConfirm($stepConfirmation); | ||
| 134 | - $this->setDisplayFirst($stepDisplayFirst); | ||
| 135 | - $this->loadSession($session); | ||
| 136 | - $this->setMigrateProperties($migrateProperties); | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * Sets steps class names in string format | ||
| 141 | - * | ||
| 142 | - * @author KnowledgeTree Team | ||
| 143 | - * @param array | ||
| 144 | - * @access public | ||
| 145 | - * @return void | ||
| 146 | - */ | ||
| 147 | - public function setSteps($stepClassNames) { | ||
| 148 | - $this->stepClassNames = $stepClassNames; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * Sets steps in human readable string format | ||
| 153 | - * | ||
| 154 | - * @author KnowledgeTree Team | ||
| 155 | - * @param array | ||
| 156 | - * @access public | ||
| 157 | - * @return void | ||
| 158 | - */ | ||
| 159 | - public function setStepNames($step_names) { | ||
| 160 | - $this->step_names = $step_names; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * Sets confirmation page flag | ||
| 165 | - * | ||
| 166 | - * @author KnowledgeTree Team | ||
| 167 | - * @param boolean | ||
| 168 | - * @access public | ||
| 169 | - * @return void | ||
| 170 | - */ | ||
| 171 | - public function setDisplayConfirm($displayConfirm) { | ||
| 172 | - $this->displayConfirm = $displayConfirm; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * Sets confirmation page first flag | ||
| 177 | - * | ||
| 178 | - * @author KnowledgeTree Team | ||
| 179 | - * @param boolean | ||
| 180 | - * @access public | ||
| 181 | - * @return void | ||
| 182 | - */ | ||
| 183 | - public function setDisplayFirst($displayFirst) { | ||
| 184 | - $this->displayFirst = $displayFirst; | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * Sets session object | ||
| 189 | - * | ||
| 190 | - * @author KnowledgeTree Team | ||
| 191 | - * @param object Session | ||
| 192 | - * @access public | ||
| 193 | - * @return void | ||
| 194 | - */ | ||
| 195 | - public function loadSession($ses) { | ||
| 196 | - $this->session = $ses; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - /** | ||
| 200 | - * Sets migrate properties | ||
| 201 | - * | ||
| 202 | - * @author KnowledgeTree Team | ||
| 203 | - * @param array | ||
| 204 | - * @access public | ||
| 205 | - * @return void | ||
| 206 | - */ | ||
| 207 | - public function setMigrateProperties($migrateProperties) { | ||
| 208 | - $this->migrateProperties = $migrateProperties; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - /** | ||
| 212 | - * Main control to handle the steps actions | ||
| 213 | - * | ||
| 214 | - * @author KnowledgeTree Team | ||
| 215 | - * @param none | ||
| 216 | - * @access public | ||
| 217 | - * @return string | ||
| 218 | - */ | ||
| 219 | - public function doAction() { | ||
| 220 | - if($this->stepName != '') { | ||
| 221 | - $this->action = $this->createStep(); | ||
| 222 | - if(!$this->action) { | ||
| 223 | - $this->stepName = 'errors'; | ||
| 224 | - $this->action = $this->createStep(); | ||
| 225 | - $this->action->error = array('Class Files Missing in Step Directory'); | ||
| 226 | - } | ||
| 227 | - $response = $this->action->doStep(); | ||
| 228 | - if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 229 | - $this->_loadStepToSession($this->stepName); // Send class to session | ||
| 230 | - } | ||
| 231 | - } else { | ||
| 232 | - $this->stepName = 'errors'; | ||
| 233 | - $this->action = $this->createStep(); | ||
| 234 | - $this->action->error = array('Class File Missing in Step Directory'); | ||
| 235 | - | ||
| 236 | - } | ||
| 237 | - if ($response == 'error') { | ||
| 238 | - $this->_handleErrors(); // Send Errors to session | ||
| 239 | - } else { | ||
| 240 | - $this->_clearErrors($this->stepName); // Send Errors to session | ||
| 241 | - } | ||
| 242 | - return $response; | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - /** | ||
| 246 | * Instantiate a step. | 60 | * Instantiate a step. |
| 247 | * | 61 | * |
| 248 | * @author KnowledgeTree Team | 62 | * @author KnowledgeTree Team |
| @@ -257,127 +71,6 @@ class stepAction { | @@ -257,127 +71,6 @@ class stepAction { | ||
| 257 | } | 71 | } |
| 258 | 72 | ||
| 259 | /** | 73 | /** |
| 260 | - * Converts string to camel case | ||
| 261 | - * | ||
| 262 | - * @author KnowledgeTree Team | ||
| 263 | - * @param string | ||
| 264 | - * @access public | ||
| 265 | - * @return string | ||
| 266 | - */ | ||
| 267 | - public function makeCamelCase($str) { | ||
| 268 | - $upper=ucwords($str); | ||
| 269 | - $str=str_replace('_', '', $upper); | ||
| 270 | - | ||
| 271 | - return $str; | ||
| 272 | - } | ||
| 273 | - | ||
| 274 | - /** | ||
| 275 | - * Converts string to human readable heading | ||
| 276 | - * | ||
| 277 | - * @author KnowledgeTree Team | ||
| 278 | - * @param string | ||
| 279 | - * @access public | ||
| 280 | - * @return string | ||
| 281 | - */ | ||
| 282 | - public function makeHeading($str) { | ||
| 283 | - $str = str_replace('_', ' ', $str); | ||
| 284 | - $str = ucwords($str); | ||
| 285 | - | ||
| 286 | - return $str; | ||
| 287 | - } | ||
| 288 | - | ||
| 289 | - /** | ||
| 290 | - * Returns current step name | ||
| 291 | - * | ||
| 292 | - * @author KnowledgeTree Team | ||
| 293 | - * @param none | ||
| 294 | - * @access public | ||
| 295 | - * @return string | ||
| 296 | - */ | ||
| 297 | - public function getCurrentStepName() { | ||
| 298 | - if($this->stepName != 'errors') | ||
| 299 | - return $this->step_names[$this->stepName]; | ||
| 300 | - return ''; | ||
| 301 | - } | ||
| 302 | - | ||
| 303 | - /** | ||
| 304 | - * Returns left menu | ||
| 305 | - * | ||
| 306 | - * @author KnowledgeTree Team | ||
| 307 | - * @param none | ||
| 308 | - * @access public | ||
| 309 | - * @return string | ||
| 310 | - */ | ||
| 311 | - public function getLeftMenu() | ||
| 312 | - { | ||
| 313 | - $sideMenuElements = array(); | ||
| 314 | - $active = false; | ||
| 315 | - if($this->stepClassNames) { | ||
| 316 | - $ele = array(); | ||
| 317 | - foreach ($this->stepClassNames as $k=>$step) { | ||
| 318 | - $ele['step'] = $step; | ||
| 319 | - if($this->step_names[$step] != '') { | ||
| 320 | - $ele['name'] = $this->step_names[$step]; | ||
| 321 | - } else { | ||
| 322 | - $ele['name'] = $this->makeHeading($step); | ||
| 323 | - } | ||
| 324 | - if($step == $this->stepName) { | ||
| 325 | - $ele['class'] = 'current'; | ||
| 326 | - $active = true; | ||
| 327 | - } else { | ||
| 328 | - if($active) { | ||
| 329 | - $ele['class'] = 'inactive'; | ||
| 330 | - } else { | ||
| 331 | - $ele['class'] = 'indicator'; | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | - $sideMenuElements[] = $ele; | ||
| 335 | - } | ||
| 336 | - } | ||
| 337 | - $step_tpl = new Template("..".DS."wizard".DS."templates".DS."sidemenu.tpl"); // Create template | ||
| 338 | - $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements | ||
| 339 | - $step_tpl->set("ajax", AJAX); // Set ajax state | ||
| 340 | - | ||
| 341 | - return $step_tpl->fetch(); | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - /** | ||
| 345 | - * Returns confirmation page flag | ||
| 346 | - * | ||
| 347 | - * @author KnowledgeTree Team | ||
| 348 | - * @param none | ||
| 349 | - * @access public | ||
| 350 | - * @return boolean | ||
| 351 | - */ | ||
| 352 | - public function displayConfirm() { | ||
| 353 | - return $this->displayConfirm; | ||
| 354 | - } | ||
| 355 | - | ||
| 356 | - /** | ||
| 357 | - * Returns whether or not to display the confirmation page first | ||
| 358 | - * | ||
| 359 | - * @author KnowledgeTree Team | ||
| 360 | - * @param none | ||
| 361 | - * @access public | ||
| 362 | - * @return boolean | ||
| 363 | - */ | ||
| 364 | - public function displayFirst() { | ||
| 365 | - return $this->displayFirst; | ||
| 366 | - } | ||
| 367 | - | ||
| 368 | - /** | ||
| 369 | - * Returns session object | ||
| 370 | - * | ||
| 371 | - * @author KnowledgeTree Team | ||
| 372 | - * @param object Session | ||
| 373 | - * @access public | ||
| 374 | - * @return object | ||
| 375 | - */ | ||
| 376 | - public function getSession() { | ||
| 377 | - return $this->session; | ||
| 378 | - } | ||
| 379 | - | ||
| 380 | - /** | ||
| 381 | * Returns step tenplate content | 74 | * Returns step tenplate content |
| 382 | * | 75 | * |
| 383 | * @author KnowledgeTree Team | 76 | * @author KnowledgeTree Team |
| @@ -385,154 +78,15 @@ class stepAction { | @@ -385,154 +78,15 @@ class stepAction { | ||
| 385 | * @access public | 78 | * @access public |
| 386 | * @return string | 79 | * @return string |
| 387 | */ | 80 | */ |
| 388 | - public function paintAction() { | ||
| 389 | - $step_errors = $this->action->getErrors(); // Get errors | ||
| 390 | - $step_warnings = $this->action->getWarnings(); // Get warnings | ||
| 391 | - if($this->displayConfirm()) { // Check if theres a confirm step | ||
| 392 | - $template = "templates/{$this->stepName}_confirm.tpl"; | ||
| 393 | - } else { | ||
| 394 | - if($this->displayFirst()) { | ||
| 395 | - $template = "templates/{$this->stepName}_confirm.tpl"; | ||
| 396 | - } else { | ||
| 397 | - $template = "templates/{$this->stepName}.tpl"; | ||
| 398 | - } | ||
| 399 | - } | ||
| 400 | - $step_tpl = new Template($template); | ||
| 401 | - $step_tpl->set("errors", $step_errors); // Set template errors | ||
| 402 | - $step_tpl->set("warnings", $step_warnings); // Set template warnings | ||
| 403 | - $step_vars = $this->action->getStepVars(); // Get template variables | ||
| 404 | - $step_tpl->set("step_vars", $step_vars); // Set template errors | ||
| 405 | - $this->loadToSes($step_vars); | ||
| 406 | - $this->loadToTpl($step_tpl, $step_vars); | ||
| 407 | - // TODO: Force because it does not always recognize ajax request | ||
| 408 | - if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { | ||
| 409 | - echo $step_tpl->fetch(); | ||
| 410 | - } else { | ||
| 411 | - $content = $step_tpl->fetch(); | ||
| 412 | - $tpl = new Template("templates/wizard.tpl"); | ||
| 413 | - $vars = $this->getVars(); // Get template variables | ||
| 414 | - $tpl->set("vars", $vars); // Set template errors | ||
| 415 | - $tpl->set('content', $content); | ||
| 416 | - echo $tpl->fetch(); | ||
| 417 | - } | ||
| 418 | - } | ||
| 419 | - | ||
| 420 | - public function loadToSes($step_vars) { | ||
| 421 | - if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 422 | - foreach ($step_vars as $key => $value) { // Set template variables | ||
| 423 | - $this->_loadValueToSession($this->stepName, $key, $value); | ||
| 424 | - } | ||
| 425 | - } | ||
| 426 | - } | ||
| 427 | - | ||
| 428 | - public function loadToTpl($step_tpl, $step_vars) { | ||
| 429 | - foreach ($step_vars as $key => $value) { // Set template variables | ||
| 430 | - $step_tpl->set($key, $value); // Load values to session | ||
| 431 | - } | ||
| 432 | - } | ||
| 433 | 81 | ||
| 434 | public function getVars() { | 82 | public function getVars() { |
| 435 | $left = $this->getLeftMenu(); | 83 | $left = $this->getLeftMenu(); |
| 436 | $vars['left'] = $left; // Set left menu | 84 | $vars['left'] = $left; // Set left menu |
| 437 | - $vars['migrate_version'] = $this->migrateProperties['migrate_version']; // Set version | ||
| 438 | - $vars['migrate_type'] = $this->migrateProperties['migrate_type']; // Set type | 85 | + $vars['migrate_version'] = $this->properties['migrate_version']; // Set version |
| 86 | + $vars['migrate_type'] = $this->properties['migrate_type']; // Set type | ||
| 439 | return $vars; | 87 | return $vars; |
| 440 | } | 88 | } |
| 441 | - /** | ||
| 442 | - * Load class to session | ||
| 443 | - * | ||
| 444 | - * @author KnowledgeTree Team | ||
| 445 | - * @param string $class name of class | ||
| 446 | - * @param array $v array of values | ||
| 447 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 448 | - * @access private | ||
| 449 | - * @return void | ||
| 450 | - */ | ||
| 451 | - private function _loadStepToSession($class, $v = array(), $overwrite = false) { | ||
| 452 | - if($this->session != null) { | ||
| 453 | - if($overwrite) { | ||
| 454 | - $this->session->set($class , $v); | ||
| 455 | - } else { | ||
| 456 | - if(!$this->session->is_set($class)) | ||
| 457 | - $this->session->set($class , $v); | ||
| 458 | - } | ||
| 459 | - } else { | ||
| 460 | - $this->stepName = 'errors'; | ||
| 461 | - $this->action = $this->createStep(); | ||
| 462 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 463 | - } | ||
| 464 | - } | ||
| 465 | - | ||
| 466 | - /** | ||
| 467 | - * Load class value to session | ||
| 468 | - * | ||
| 469 | - * @author KnowledgeTree Team | ||
| 470 | - * @param string $class name of class | ||
| 471 | - * @param string $k key value | ||
| 472 | - * @param string $v value to store | ||
| 473 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 474 | - * @access private | ||
| 475 | - * @return void | ||
| 476 | - */ | ||
| 477 | - private function _loadValueToSession($class, $k, $v) { | ||
| 478 | - if($this->session != null) { | ||
| 479 | - $this->session->setClass($class, $k, $v); | ||
| 480 | - } else { | ||
| 481 | - $this->stepName = 'errors'; | ||
| 482 | - $this->action = $this->createStep(); | ||
| 483 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 484 | - } | ||
| 485 | - } | ||
| 486 | - | ||
| 487 | - /** | ||
| 488 | - * Load all class errors value to session | ||
| 489 | - * | ||
| 490 | - * @author KnowledgeTree Team | ||
| 491 | - * @param none | ||
| 492 | - * @access private | ||
| 493 | - * @return void | ||
| 494 | - */ | ||
| 495 | - private function _handleErrors() {// TODO: handle multiple errors | ||
| 496 | - $step_errors = $this->action->getErrors(); // Get errors | ||
| 497 | - foreach ($step_errors as $key => $value) { | ||
| 498 | - $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session | ||
| 499 | - } | ||
| 500 | - } | ||
| 501 | - | ||
| 502 | - /** | ||
| 503 | - * Remove all class errors value to session | ||
| 504 | - * | ||
| 505 | - * @author KnowledgeTree Team | ||
| 506 | - * @param none | ||
| 507 | - * @access private | ||
| 508 | - * @return void | ||
| 509 | - */ | ||
| 510 | - private function _clearErrors($class) { | ||
| 511 | - if($this->session) { | ||
| 512 | - $this->session->clearErrors($class); | ||
| 513 | - } | ||
| 514 | - } | ||
| 515 | 89 | ||
| 516 | - /** | ||
| 517 | - * Load class error value to session | ||
| 518 | - * | ||
| 519 | - * @author KnowledgeTree Team | ||
| 520 | - * @param string $class name of class | ||
| 521 | - * @param string $k key value | ||
| 522 | - * @param string $v value to store | ||
| 523 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 524 | - * @access private | ||
| 525 | - * @return void | ||
| 526 | - */ | ||
| 527 | - private function _loadErrorToSession($class, $k = "errors", $v) { | ||
| 528 | - if($this->session != null) { | ||
| 529 | - $this->session->setClassError($class, $k, $v); | ||
| 530 | - } else { | ||
| 531 | - $this->stepName = 'errors'; | ||
| 532 | - $this->action = $this->createStep(); | ||
| 533 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 534 | - } | ||
| 535 | - } | ||
| 536 | } | 90 | } |
| 537 | 91 | ||
| 538 | ?> | 92 | ?> |
| 539 | \ No newline at end of file | 93 | \ No newline at end of file |
setup/upgrade/session.php
| @@ -42,9 +42,10 @@ | @@ -42,9 +42,10 @@ | ||
| 42 | * @package Upgrader | 42 | * @package Upgrader |
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | -class session | 45 | +class Session extends SessionBase |
| 46 | { | 46 | { |
| 47 | - private $salt = 'upgrade'; | 47 | + public $salt = 'upgrade'; |
| 48 | + | ||
| 48 | /** | 49 | /** |
| 49 | * Constructs session object | 50 | * Constructs session object |
| 50 | * | 51 | * |
| @@ -53,175 +54,9 @@ class session | @@ -53,175 +54,9 @@ class session | ||
| 53 | * @param none | 54 | * @param none |
| 54 | */ | 55 | */ |
| 55 | public function __construct() { | 56 | public function __construct() { |
| 57 | + $this->setSalt($this->salt); | ||
| 56 | $this->startSession(); | 58 | $this->startSession(); |
| 57 | } | 59 | } |
| 58 | 60 | ||
| 59 | - /** | ||
| 60 | - * Starts a session if one does not exist | ||
| 61 | - * | ||
| 62 | - * @author KnowledgeTree Team | ||
| 63 | - * @param none | ||
| 64 | - * @access public | ||
| 65 | - * @return void | ||
| 66 | - */ | ||
| 67 | - public function startSession() { | ||
| 68 | - if(!isset($_SESSION[$this->salt]['ready'])) { | ||
| 69 | - @session_start(); | ||
| 70 | - $_SESSION[$this->salt] ['ready'] = TRUE; | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - /** | ||
| 75 | - * Sets a value key pair in session | ||
| 76 | - * | ||
| 77 | - * @author KnowledgeTree Team | ||
| 78 | - * @param string $fld | ||
| 79 | - * @param string $val | ||
| 80 | - * @access public | ||
| 81 | - * @return void | ||
| 82 | - */ | ||
| 83 | - public function set($fld, $val) { | ||
| 84 | - $this->startSession(); | ||
| 85 | - $_SESSION[$this->salt] [$fld] = $val; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - /** | ||
| 89 | - * Sets a value key pair in a class in session | ||
| 90 | - * | ||
| 91 | - * @author KnowledgeTree Team | ||
| 92 | - * @param string $class | ||
| 93 | - * @param string $fld | ||
| 94 | - * @param string $val | ||
| 95 | - * @access public | ||
| 96 | - * @return void | ||
| 97 | - */ | ||
| 98 | - public function setClass($class , $k, $v) { | ||
| 99 | - $this->startSession(); | ||
| 100 | - $classArray = $this->get($class); | ||
| 101 | - if(isset($classArray[$k])) { | ||
| 102 | - $classArray[$k] = $v; | ||
| 103 | - } else { | ||
| 104 | - $classArray[$k] = $v; | ||
| 105 | - } | ||
| 106 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - /** | ||
| 110 | - * Sets a error value key pair in a class in session | ||
| 111 | - * | ||
| 112 | - * @author KnowledgeTree Team | ||
| 113 | - * @param string $class | ||
| 114 | - * @param string $fld | ||
| 115 | - * @param string $val | ||
| 116 | - * @access public | ||
| 117 | - * @return void | ||
| 118 | - */ | ||
| 119 | - public function setClassError($class, $k, $v) { | ||
| 120 | - $this->startSession(); | ||
| 121 | - $classArray = $this->get($class); | ||
| 122 | - if(isset($classArray[$k])) { | ||
| 123 | - $classArray[$k] = $v; | ||
| 124 | - } else { | ||
| 125 | - $classArray[$k] = $v; | ||
| 126 | - } | ||
| 127 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - /** | ||
| 131 | - * Clear error values in a class session | ||
| 132 | - * | ||
| 133 | - * @author KnowledgeTree Team | ||
| 134 | - * @param string $class | ||
| 135 | - * @param string $fld | ||
| 136 | - * @param string $val | ||
| 137 | - * @access public | ||
| 138 | - * @return void | ||
| 139 | - */ | ||
| 140 | - public function clearErrors($class) { | ||
| 141 | - $classArray = $this->get($class); | ||
| 142 | - unset($classArray['errors']); | ||
| 143 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - /** | ||
| 147 | - * Unset a value in session | ||
| 148 | - * | ||
| 149 | - * @author KnowledgeTree Team | ||
| 150 | - * @param string $fld | ||
| 151 | - * @access public | ||
| 152 | - * @return void | ||
| 153 | - */ | ||
| 154 | - public function un_set($fld) { | ||
| 155 | - $this->startSession(); | ||
| 156 | - unset($_SESSION[$this->salt] [$fld]); | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - /** | ||
| 160 | - * Unset a class value in session | ||
| 161 | - * | ||
| 162 | - * @author KnowledgeTree Team | ||
| 163 | - * @param string $class | ||
| 164 | - * @access public | ||
| 165 | - * @return void | ||
| 166 | - */ | ||
| 167 | - public function un_setClass($class) { | ||
| 168 | - $this->startSession(); | ||
| 169 | - if(isset($_SESSION[$this->salt] [$class])) | ||
| 170 | - unset($_SESSION[$this->salt] [$class]); | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - /** | ||
| 174 | - * Destroy the session | ||
| 175 | - * | ||
| 176 | - * @author KnowledgeTree Team | ||
| 177 | - * @param none | ||
| 178 | - * @access public | ||
| 179 | - * @return void | ||
| 180 | - */ | ||
| 181 | - public function destroy() { | ||
| 182 | - $this->startSession(); | ||
| 183 | - unset($_SESSION[$this->salt]); | ||
| 184 | - session_destroy(); | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * Get a session value | ||
| 189 | - * | ||
| 190 | - * @author KnowledgeTree Team | ||
| 191 | - * @param string $fld | ||
| 192 | - * @access public | ||
| 193 | - * @return string | ||
| 194 | - */ | ||
| 195 | - public function get($fld) { | ||
| 196 | - $this->startSession(); | ||
| 197 | - if(isset($_SESSION[$this->salt] [$fld])) | ||
| 198 | - return $_SESSION[$this->salt] [$fld]; | ||
| 199 | - return false; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - /** | ||
| 203 | - * Check if a field exists in session | ||
| 204 | - * | ||
| 205 | - * @author KnowledgeTree Team | ||
| 206 | - * @param string $fld | ||
| 207 | - * @access public | ||
| 208 | - * @return string | ||
| 209 | - */ | ||
| 210 | - public function is_set($fld) { | ||
| 211 | - $this->startSession(); | ||
| 212 | - return isset($_SESSION[$this->salt] [$fld]); | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - /** | ||
| 216 | - * Return a class from session | ||
| 217 | - * | ||
| 218 | - * @author KnowledgeTree Team | ||
| 219 | - * @param string $fld | ||
| 220 | - * @access public | ||
| 221 | - * @return string | ||
| 222 | - */ | ||
| 223 | - public function getClass($class) { | ||
| 224 | - return $_SESSION[$this->salt][$class]; | ||
| 225 | - } | ||
| 226 | } | 61 | } |
| 227 | ?> | 62 | ?> |
| 228 | \ No newline at end of file | 63 | \ No newline at end of file |
setup/upgrade/step.php
| @@ -43,79 +43,20 @@ | @@ -43,79 +43,20 @@ | ||
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | 45 | ||
| 46 | -require_once("../wizard/steps/configuration.php"); // configuration to read the ini path | ||
| 47 | - | ||
| 48 | -class Step | 46 | +class Step extends StepBase |
| 49 | { | 47 | { |
| 50 | /** | 48 | /** |
| 51 | - * List of variables to be loaded to template | ||
| 52 | - * | ||
| 53 | - * @author KnowledgeTree Team | ||
| 54 | - * @access protected | ||
| 55 | - * @var array | ||
| 56 | - */ | ||
| 57 | - protected $temp_variables = array(); | ||
| 58 | - | ||
| 59 | - /** | ||
| 60 | - * List of errors encountered by step | ||
| 61 | - * | ||
| 62 | - * @author KnowledgeTree Team | ||
| 63 | - * @access protected | ||
| 64 | - * @var array | ||
| 65 | - */ | ||
| 66 | - protected $error = array(); | ||
| 67 | - | ||
| 68 | - /** | ||
| 69 | - * List of warnings encountered by step | ||
| 70 | - * | ||
| 71 | - * @author KnowledgeTree Team | ||
| 72 | - * @access protected | ||
| 73 | - * @var array | ||
| 74 | - */ | ||
| 75 | - protected $warnings = array(); | ||
| 76 | - | ||
| 77 | - /** | ||
| 78 | - * Flag to store class information in session | ||
| 79 | - * | ||
| 80 | - * @author KnowledgeTree Team | ||
| 81 | - * @access public | ||
| 82 | - * @var array | ||
| 83 | - */ | ||
| 84 | - protected $storeInSession = false; | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | * Flag if step needs to be upgraded | 49 | * Flag if step needs to be upgraded |
| 88 | * | 50 | * |
| 89 | * @author KnowledgeTree Team | 51 | * @author KnowledgeTree Team |
| 90 | * @access public | 52 | * @access public |
| 91 | * @var array | 53 | * @var array |
| 92 | */ | 54 | */ |
| 93 | - protected $runUpgrade = false; | ||
| 94 | - | ||
| 95 | - /** | ||
| 96 | - * Step order | ||
| 97 | - * | ||
| 98 | - * @author KnowledgeTree Team | ||
| 99 | - * @access public | ||
| 100 | - * @var string | ||
| 101 | - */ | ||
| 102 | - protected $order = false; | ||
| 103 | - | ||
| 104 | - /** | ||
| 105 | - * Flag if step needs to run silently | ||
| 106 | - * | ||
| 107 | - * @author KnowledgeTree Team | ||
| 108 | - * @access public | ||
| 109 | - * @var boolean | ||
| 110 | - */ | ||
| 111 | - protected $silent = false; | ||
| 112 | - | ||
| 113 | - public $displayFirst = false; | ||
| 114 | - | ||
| 115 | - private $salt = 'upgrade'; | 55 | + private $runUpgrade = false; |
| 116 | 56 | ||
| 117 | public function __construct() { | 57 | public function __construct() { |
| 118 | $this->util = new UpgradeUtil(); | 58 | $this->util = new UpgradeUtil(); |
| 59 | + $this->salt = 'upgrade'; | ||
| 119 | } | 60 | } |
| 120 | 61 | ||
| 121 | /** | 62 | /** |
| @@ -137,134 +78,6 @@ class Step | @@ -137,134 +78,6 @@ class Step | ||
| 137 | return ''; | 78 | return ''; |
| 138 | } | 79 | } |
| 139 | 80 | ||
| 140 | - public function displayFirst() { | ||
| 141 | - return $this->displayFirst; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - /** | ||
| 145 | - * Returns step variables | ||
| 146 | - * | ||
| 147 | - * @author KnowledgeTree Team | ||
| 148 | - * @param none | ||
| 149 | - * @access public | ||
| 150 | - * @return array | ||
| 151 | - */ | ||
| 152 | - public function getStepVars() | ||
| 153 | - { | ||
| 154 | - return $this->temp_variables; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - /** | ||
| 158 | - * Returns step errors | ||
| 159 | - * | ||
| 160 | - * @author KnowledgeTree Team | ||
| 161 | - * @param none | ||
| 162 | - * @access public | ||
| 163 | - * @return array | ||
| 164 | - */ | ||
| 165 | - public function getErrors() { | ||
| 166 | - return $this->error; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - /** | ||
| 170 | - * Returns step errors | ||
| 171 | - * | ||
| 172 | - * @author KnowledgeTree Team | ||
| 173 | - * @param none | ||
| 174 | - * @access public | ||
| 175 | - * @return array | ||
| 176 | - */ | ||
| 177 | - public function getWarnings() { | ||
| 178 | - return $this->warnings; | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - /** | ||
| 182 | - * Load default step values | ||
| 183 | - * | ||
| 184 | - * @author KnowledgeTree Team | ||
| 185 | - * @param none | ||
| 186 | - * @access public | ||
| 187 | - * @return void | ||
| 188 | - */ | ||
| 189 | - public function loadDefaults() { | ||
| 190 | - | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * Return default step values | ||
| 195 | - * | ||
| 196 | - * @author KnowledgeTree Team | ||
| 197 | - * @param none | ||
| 198 | - * @access public | ||
| 199 | - * @return array | ||
| 200 | - */ | ||
| 201 | - public function getDefaults() { | ||
| 202 | - return array(); | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - /** | ||
| 206 | - * Checks if edit button has been clicked | ||
| 207 | - * | ||
| 208 | - * @author KnowledgeTree Team | ||
| 209 | - * @param none | ||
| 210 | - * @access public | ||
| 211 | - * @return boolean | ||
| 212 | - */ | ||
| 213 | - public function edit() { | ||
| 214 | - if(isset($_POST['Edit'])) { | ||
| 215 | - return true; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - return false; | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - /** | ||
| 222 | - * Checks if next button has been clicked | ||
| 223 | - * | ||
| 224 | - * @author KnowledgeTree Team | ||
| 225 | - * @param none | ||
| 226 | - * @access public | ||
| 227 | - * @return boolean | ||
| 228 | - */ | ||
| 229 | - public function next() { | ||
| 230 | - if(isset($_POST['Next'])) { | ||
| 231 | - return true; | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - return false; | ||
| 235 | - } | ||
| 236 | - | ||
| 237 | - /** | ||
| 238 | - * Checks if previous button has been clicked | ||
| 239 | - * | ||
| 240 | - * @author KnowledgeTree Team | ||
| 241 | - * @param none | ||
| 242 | - * @access public | ||
| 243 | - * @return boolean | ||
| 244 | - */ | ||
| 245 | - public function previous() { | ||
| 246 | - if(isset($_POST['Previous'])) { | ||
| 247 | - return true; | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | - return false; | ||
| 251 | - } | ||
| 252 | - | ||
| 253 | - /** | ||
| 254 | - * Checks if Confirm button has been clicked | ||
| 255 | - * | ||
| 256 | - * @author KnowledgeTree Team | ||
| 257 | - * @param none | ||
| 258 | - * @access public | ||
| 259 | - * @return boolean | ||
| 260 | - */ | ||
| 261 | - function confirm() { | ||
| 262 | - if(isset($_POST['Confirm'])) { | ||
| 263 | - return true; | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - return false; | ||
| 267 | - } | ||
| 268 | 81 | ||
| 269 | /** | 82 | /** |
| 270 | * Checks if Upgrade button has been clicked | 83 | * Checks if Upgrade button has been clicked |
| @@ -291,21 +104,6 @@ class Step | @@ -291,21 +104,6 @@ class Step | ||
| 291 | } | 104 | } |
| 292 | 105 | ||
| 293 | /** | 106 | /** |
| 294 | - * Checks if we are currently in this class step | ||
| 295 | - * | ||
| 296 | - * @author KnowledgeTree Team | ||
| 297 | - * @param string | ||
| 298 | - * @access public | ||
| 299 | - * @return boolean | ||
| 300 | - */ | ||
| 301 | - public function inStep($name) { | ||
| 302 | - if(!isset($_GET['step_name'])) return false; | ||
| 303 | - if($_GET['step_name'] == $name) | ||
| 304 | - return true; | ||
| 305 | - return false; | ||
| 306 | - } | ||
| 307 | - | ||
| 308 | - /** | ||
| 309 | * Load session data to post | 107 | * Load session data to post |
| 310 | * | 108 | * |
| 311 | * @author KnowledgeTree Team | 109 | * @author KnowledgeTree Team |
| @@ -339,30 +137,6 @@ class Step | @@ -339,30 +137,6 @@ class Step | ||
| 339 | } | 137 | } |
| 340 | 138 | ||
| 341 | /** | 139 | /** |
| 342 | - * Safer way to return post data | ||
| 343 | - * | ||
| 344 | - * @author KnowledgeTree Team | ||
| 345 | - * @params SimpleXmlObject $simplexml | ||
| 346 | - * @access public | ||
| 347 | - * @return void | ||
| 348 | - */ | ||
| 349 | - public function getPostSafe($key) { | ||
| 350 | - return isset($_POST[$key]) ? $_POST[$key] : ""; | ||
| 351 | - } | ||
| 352 | - | ||
| 353 | - /** | ||
| 354 | - * Safer way to return post data | ||
| 355 | - * | ||
| 356 | - * @author KnowledgeTree Team | ||
| 357 | - * @params SimpleXmlObject $simplexml | ||
| 358 | - * @access public | ||
| 359 | - * @return void | ||
| 360 | - */ | ||
| 361 | - public function getPostBoolean($key) { | ||
| 362 | - return isset($_POST[$key]) ? $_POST[$key] : false; | ||
| 363 | - } | ||
| 364 | - | ||
| 365 | - /** | ||
| 366 | * Runs step upgrade if required | 140 | * Runs step upgrade if required |
| 367 | * | 141 | * |
| 368 | * @author KnowledgeTree Team | 142 | * @author KnowledgeTree Team |
| @@ -375,18 +149,6 @@ class Step | @@ -375,18 +149,6 @@ class Step | ||
| 375 | } | 149 | } |
| 376 | 150 | ||
| 377 | /** | 151 | /** |
| 378 | - * Return whether or not to store a step information in session | ||
| 379 | - * | ||
| 380 | - * @author KnowledgeTree Team | ||
| 381 | - * @param none | ||
| 382 | - * @access public | ||
| 383 | - * @return boolean | ||
| 384 | - */ | ||
| 385 | - public function storeInSession() { | ||
| 386 | - return $this->storeInSession; | ||
| 387 | - } | ||
| 388 | - | ||
| 389 | - /** | ||
| 390 | * Return whether or not to a step has to be upgraded | 152 | * Return whether or not to a step has to be upgraded |
| 391 | * | 153 | * |
| 392 | * @author KnowledgeTree Team | 154 | * @author KnowledgeTree Team |
| @@ -398,51 +160,8 @@ class Step | @@ -398,51 +160,8 @@ class Step | ||
| 398 | return $this->runUpgrade; | 160 | return $this->runUpgrade; |
| 399 | } | 161 | } |
| 400 | 162 | ||
| 401 | - public function setPostConfig() { | ||
| 402 | - return ''; | ||
| 403 | - } | ||
| 404 | - | ||
| 405 | - /** | ||
| 406 | - * Return whether or not to a step has to be in silent mode | ||
| 407 | - * | ||
| 408 | - * @author KnowledgeTree Team | ||
| 409 | - * @param none | ||
| 410 | - * @access public | ||
| 411 | - * @return boolean | ||
| 412 | - */ | ||
| 413 | - public function silentMode() { | ||
| 414 | - return $this->silent; | ||
| 415 | - } | ||
| 416 | - | ||
| 417 | - /** | ||
| 418 | - * Set step errors | ||
| 419 | - * | ||
| 420 | - * @author KnowledgeTree Team | ||
| 421 | - * @param none | ||
| 422 | - * @access public | ||
| 423 | - * @return array | ||
| 424 | - */ | ||
| 425 | - public function setErrors($error) { | ||
| 426 | - $this->error = $error; | ||
| 427 | - } | ||
| 428 | - | ||
| 429 | - /** | ||
| 430 | - * Get session data from package | ||
| 431 | - * | ||
| 432 | - * @author KnowledgeTree Team | ||
| 433 | - * @params none | ||
| 434 | - * @access private | ||
| 435 | - * @return boolean | ||
| 436 | - */ | ||
| 437 | - public function getDataFromPackage($package, $class) { | ||
| 438 | - if(empty($_SESSION[$package][$class])) { | ||
| 439 | - return false; | ||
| 440 | - } | ||
| 441 | - | ||
| 442 | - return $_SESSION[$package][$class]; | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | protected function readConfig() { | 163 | protected function readConfig() { |
| 164 | + require_once("../wizard/steps/configuration.php"); // TODO | ||
| 446 | $wizConfigHandler = new configuration(); | 165 | $wizConfigHandler = new configuration(); |
| 447 | $path = $wizConfigHandler->readConfigPathIni(); | 166 | $path = $wizConfigHandler->readConfigPathIni(); |
| 448 | $this->util->iniUtilities->load($path); | 167 | $this->util->iniUtilities->load($path); |
| @@ -474,25 +193,7 @@ class Step | @@ -474,25 +193,7 @@ class Step | ||
| 474 | } | 193 | } |
| 475 | 194 | ||
| 476 | return false; | 195 | return false; |
| 477 | - } | ||
| 478 | - | ||
| 479 | - protected function storeSilent() { | ||
| 480 | - | ||
| 481 | - } | ||
| 482 | - | ||
| 483 | - /** | ||
| 484 | - * Is the installation | ||
| 485 | - * | ||
| 486 | - * @author KnowledgeTree Team | ||
| 487 | - * @param none | ||
| 488 | - * @access public | ||
| 489 | - * @return string | ||
| 490 | - */ | ||
| 491 | - public function isCe() { | ||
| 492 | - if($this->util->getVersionType() == "community") | ||
| 493 | - return true; | ||
| 494 | - return false; | ||
| 495 | - } | 196 | + } |
| 496 | } | 197 | } |
| 497 | 198 | ||
| 498 | ?> | 199 | ?> |
| 499 | \ No newline at end of file | 200 | \ No newline at end of file |
setup/upgrade/stepAction.php
| @@ -44,70 +44,7 @@ | @@ -44,70 +44,7 @@ | ||
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | -class stepAction { | ||
| 48 | - /** | ||
| 49 | - * Step class name | ||
| 50 | - * | ||
| 51 | - * @author KnowledgeTree Team | ||
| 52 | - * @access protected | ||
| 53 | - * @var string | ||
| 54 | - */ | ||
| 55 | - protected $stepName = ''; | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * Step names for classes | ||
| 59 | - * | ||
| 60 | - * @author KnowledgeTree Team | ||
| 61 | - * @access protected | ||
| 62 | - * @var array | ||
| 63 | - */ | ||
| 64 | - protected $stepClassNames = array(); | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * Flag if step needs confirmation | ||
| 68 | - * | ||
| 69 | - * @author KnowledgeTree Team | ||
| 70 | - * @access protected | ||
| 71 | - * @var boolean | ||
| 72 | - */ | ||
| 73 | - protected $displayConfirm = false; | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * Returns whether or not to display the confirmation page first | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var boolean | ||
| 81 | - */ | ||
| 82 | - protected $displayFirst = false; | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * List of upgrade properties | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var boolean | ||
| 90 | - */ | ||
| 91 | - protected $upgradeProperties = array(); | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * Reference to session object | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var object Session | ||
| 99 | - */ | ||
| 100 | - protected $session = null; | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | - * Reference to current step object | ||
| 104 | - * | ||
| 105 | - * @author KnowledgeTree Team | ||
| 106 | - * @access protected | ||
| 107 | - * @var object class Step | ||
| 108 | - */ | ||
| 109 | - protected $action = null; | ||
| 110 | - | 47 | +class stepAction extends stepActionBase { |
| 111 | /** | 48 | /** |
| 112 | * Constructs step action object | 49 | * Constructs step action object |
| 113 | * | 50 | * |
| @@ -118,130 +55,8 @@ class stepAction { | @@ -118,130 +55,8 @@ class stepAction { | ||
| 118 | public function __construct($step) { | 55 | public function __construct($step) { |
| 119 | $this->stepName = $step; | 56 | $this->stepName = $step; |
| 120 | } | 57 | } |
| 121 | - | ||
| 122 | - /** | ||
| 123 | - * Helper to initialize step actions | ||
| 124 | - * | ||
| 125 | - * @author KnowledgeTree Team | ||
| 126 | - * @param string | ||
| 127 | - * @access public | ||
| 128 | - * @return string | ||
| 129 | - */ | ||
| 130 | - public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $upgradeProperties) { | ||
| 131 | - $this->setSteps($steps); | ||
| 132 | - $this->setStepNames($stepNames); | ||
| 133 | - $this->setDisplayConfirm($stepConfirmation); | ||
| 134 | - $this->setDisplayFirst($stepDisplayFirst); | ||
| 135 | - $this->loadSession($session); | ||
| 136 | - $this->setUpgradeProperties($upgradeProperties); | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * Sets steps class names in string format | ||
| 141 | - * | ||
| 142 | - * @author KnowledgeTree Team | ||
| 143 | - * @param array | ||
| 144 | - * @access public | ||
| 145 | - * @return void | ||
| 146 | - */ | ||
| 147 | - public function setSteps($stepClassNames) { | ||
| 148 | - $this->stepClassNames = $stepClassNames; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * Sets steps in human readable string format | ||
| 153 | - * | ||
| 154 | - * @author KnowledgeTree Team | ||
| 155 | - * @param array | ||
| 156 | - * @access public | ||
| 157 | - * @return void | ||
| 158 | - */ | ||
| 159 | - public function setStepNames($step_names) { | ||
| 160 | - $this->step_names = $step_names; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * Sets confirmation page flag | ||
| 165 | - * | ||
| 166 | - * @author KnowledgeTree Team | ||
| 167 | - * @param boolean | ||
| 168 | - * @access public | ||
| 169 | - * @return void | ||
| 170 | - */ | ||
| 171 | - public function setDisplayConfirm($displayConfirm) { | ||
| 172 | - $this->displayConfirm = $displayConfirm; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * Sets confirmation page first flag | ||
| 177 | - * | ||
| 178 | - * @author KnowledgeTree Team | ||
| 179 | - * @param boolean | ||
| 180 | - * @access public | ||
| 181 | - * @return void | ||
| 182 | - */ | ||
| 183 | - public function setDisplayFirst($displayFirst) { | ||
| 184 | - $this->displayFirst = $displayFirst; | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * Sets session object | ||
| 189 | - * | ||
| 190 | - * @author KnowledgeTree Team | ||
| 191 | - * @param object Session | ||
| 192 | - * @access public | ||
| 193 | - * @return void | ||
| 194 | - */ | ||
| 195 | - public function loadSession($ses) { | ||
| 196 | - $this->session = $ses; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - /** | ||
| 200 | - * Sets upgrade properties | ||
| 201 | - * | ||
| 202 | - * @author KnowledgeTree Team | ||
| 203 | - * @param array | ||
| 204 | - * @access public | ||
| 205 | - * @return void | ||
| 206 | - */ | ||
| 207 | - public function setUpgradeProperties($upgradeProperties) { | ||
| 208 | - $this->upgradeProperties = $upgradeProperties; | ||
| 209 | - } | ||
| 210 | 58 | ||
| 211 | /** | 59 | /** |
| 212 | - * Main control to handle the steps actions | ||
| 213 | - * | ||
| 214 | - * @author KnowledgeTree Team | ||
| 215 | - * @param none | ||
| 216 | - * @access public | ||
| 217 | - * @return string | ||
| 218 | - */ | ||
| 219 | - public function doAction() { | ||
| 220 | - if($this->stepName != '') { | ||
| 221 | - $this->action = $this->createStep(); | ||
| 222 | - if(!$this->action) { | ||
| 223 | - $this->stepName = 'errors'; | ||
| 224 | - $this->action = $this->createStep(); | ||
| 225 | - $this->action->error = array('Class Files Missing in Step Directory'); | ||
| 226 | - } | ||
| 227 | - $response = $this->action->doStep(); | ||
| 228 | - if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 229 | - $this->_loadStepToSession($this->stepName); // Send class to session | ||
| 230 | - } | ||
| 231 | - if ($response == 'error') { | ||
| 232 | - $this->_handleErrors(); // Send Errors to session | ||
| 233 | - } else { | ||
| 234 | - $this->_clearErrors($this->stepName); // Send Errors to session | ||
| 235 | - } | ||
| 236 | - } else { | ||
| 237 | - $this->stepName = 'errors'; | ||
| 238 | - $this->action = $this->createStep(); | ||
| 239 | - $this->action->error = array('Class File Missing in Step Directory'); | ||
| 240 | - } | ||
| 241 | - return $response; | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - /** | ||
| 245 | * Instantiate a step. | 60 | * Instantiate a step. |
| 246 | * | 61 | * |
| 247 | * @author KnowledgeTree Team | 62 | * @author KnowledgeTree Team |
| @@ -256,124 +71,6 @@ class stepAction { | @@ -256,124 +71,6 @@ class stepAction { | ||
| 256 | } | 71 | } |
| 257 | 72 | ||
| 258 | /** | 73 | /** |
| 259 | - * Converts string to camel case | ||
| 260 | - * | ||
| 261 | - * @author KnowledgeTree Team | ||
| 262 | - * @param string | ||
| 263 | - * @access public | ||
| 264 | - * @return string | ||
| 265 | - */ | ||
| 266 | - public function makeCamelCase($str) { | ||
| 267 | - $upper=ucwords($str); | ||
| 268 | - $str=str_replace('_', '', $upper); | ||
| 269 | - | ||
| 270 | - return $str; | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - /** | ||
| 274 | - * Converts string to human readable heading | ||
| 275 | - * | ||
| 276 | - * @author KnowledgeTree Team | ||
| 277 | - * @param string | ||
| 278 | - * @access public | ||
| 279 | - * @return string | ||
| 280 | - */ | ||
| 281 | - public function makeHeading($str) { | ||
| 282 | - $str = str_replace('_', ' ', $str); | ||
| 283 | - $str = ucwords($str); | ||
| 284 | - | ||
| 285 | - return $str; | ||
| 286 | - } | ||
| 287 | - | ||
| 288 | - /** | ||
| 289 | - * Returns current step name | ||
| 290 | - * | ||
| 291 | - * @author KnowledgeTree Team | ||
| 292 | - * @param none | ||
| 293 | - * @access public | ||
| 294 | - * @return string | ||
| 295 | - */ | ||
| 296 | - public function getCurrentStepName() { | ||
| 297 | - if($this->stepName != 'errors') | ||
| 298 | - return $this->step_names[$this->stepName]; | ||
| 299 | - return ''; | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - /** | ||
| 303 | - * Returns left menu | ||
| 304 | - * | ||
| 305 | - * @author KnowledgeTree Team | ||
| 306 | - * @param none | ||
| 307 | - * @access public | ||
| 308 | - * @return string | ||
| 309 | - */ | ||
| 310 | - public function getLeftMenu() | ||
| 311 | - { | ||
| 312 | - $menu = ''; | ||
| 313 | - $active = false; | ||
| 314 | - if($this->stepClassNames) { | ||
| 315 | - foreach ($this->stepClassNames as $step) { | ||
| 316 | - if($this->step_names[$step] != '') { | ||
| 317 | - $item = $this->step_names[$step]; | ||
| 318 | - } else { | ||
| 319 | - $item = $this->makeHeading($step); | ||
| 320 | - } | ||
| 321 | - if($step == $this->stepName) { | ||
| 322 | - $class = 'current'; | ||
| 323 | - $active = true; | ||
| 324 | - } else { | ||
| 325 | - if($active){ | ||
| 326 | - $class = 'inactive'; | ||
| 327 | - }else{ | ||
| 328 | - $class = 'indicator'; | ||
| 329 | - $item = "<a href=\"index.php?step_name={$step}\">{$item}</a>"; | ||
| 330 | - } | ||
| 331 | - } | ||
| 332 | - | ||
| 333 | - $menu .= "<span class='{$class}'>$item</span><br />"; | ||
| 334 | - } | ||
| 335 | - } | ||
| 336 | -// $menu .= '</div>'; | ||
| 337 | - return $menu; | ||
| 338 | - } | ||
| 339 | - | ||
| 340 | - /** | ||
| 341 | - * Returns confirmation page flag | ||
| 342 | - * | ||
| 343 | - * @author KnowledgeTree Team | ||
| 344 | - * @param none | ||
| 345 | - * @access public | ||
| 346 | - * @return boolean | ||
| 347 | - */ | ||
| 348 | - public function displayConfirm() { | ||
| 349 | - return $this->displayConfirm; | ||
| 350 | - } | ||
| 351 | - | ||
| 352 | - /** | ||
| 353 | - * Returns whether or not to display the confirmation page first | ||
| 354 | - * | ||
| 355 | - * @author KnowledgeTree Team | ||
| 356 | - * @param none | ||
| 357 | - * @access public | ||
| 358 | - * @return boolean | ||
| 359 | - */ | ||
| 360 | - public function displayFirst() { | ||
| 361 | - return $this->displayFirst; | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - /** | ||
| 365 | - * Returns session object | ||
| 366 | - * | ||
| 367 | - * @author KnowledgeTree Team | ||
| 368 | - * @param object Session | ||
| 369 | - * @access public | ||
| 370 | - * @return object | ||
| 371 | - */ | ||
| 372 | - public function getSession() { | ||
| 373 | - return $this->session; | ||
| 374 | - } | ||
| 375 | - | ||
| 376 | - /** | ||
| 377 | * Returns step tenplate content | 74 | * Returns step tenplate content |
| 378 | * | 75 | * |
| 379 | * @author KnowledgeTree Team | 76 | * @author KnowledgeTree Team |
| @@ -381,8 +78,7 @@ class stepAction { | @@ -381,8 +78,7 @@ class stepAction { | ||
| 381 | * @access public | 78 | * @access public |
| 382 | * @return string | 79 | * @return string |
| 383 | */ | 80 | */ |
| 384 | - public function paintAction() { | ||
| 385 | - | 81 | + public function paintAction() { |
| 386 | $step_errors = $this->action->getErrors(); // Get errors | 82 | $step_errors = $this->action->getErrors(); // Get errors |
| 387 | $step_warnings = $this->action->getWarnings(); // Get warnings | 83 | $step_warnings = $this->action->getWarnings(); // Get warnings |
| 388 | if($this->displayConfirm()) { // Check if theres a confirm step | 84 | if($this->displayConfirm()) { // Check if theres a confirm step |
| @@ -416,105 +112,12 @@ class stepAction { | @@ -416,105 +112,12 @@ class stepAction { | ||
| 416 | public function getVars() { | 112 | public function getVars() { |
| 417 | $left = $this->getLeftMenu(); | 113 | $left = $this->getLeftMenu(); |
| 418 | $vars['left'] = $left; // Set left menu | 114 | $vars['left'] = $left; // Set left menu |
| 419 | - $vars['upgrade_version'] = $this->upgradeProperties['upgrade_version']; // Set version | ||
| 420 | - $vars['upgrade_type'] = $this->upgradeProperties['upgrade_type']; // Set type | 115 | + $vars['upgrade_version'] = $this->properties['upgrade_version']; // Set version |
| 116 | + $vars['upgrade_type'] = $this->properties['upgrade_type']; // Set type | ||
| 421 | return $vars; | 117 | return $vars; |
| 422 | } | 118 | } |
| 423 | - /** | ||
| 424 | - * Load class to session | ||
| 425 | - * | ||
| 426 | - * @author KnowledgeTree Team | ||
| 427 | - * @param string $class name of class | ||
| 428 | - * @param array $v array of values | ||
| 429 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 430 | - * @access private | ||
| 431 | - * @return void | ||
| 432 | - */ | ||
| 433 | - private function _loadStepToSession($class, $v = array(), $overwrite = false) { | ||
| 434 | - if($this->session != null) { | ||
| 435 | - if($overwrite) { | ||
| 436 | - $this->session->set($class , $v); | ||
| 437 | - } else { | ||
| 438 | - if(!$this->session->is_set($class)) | ||
| 439 | - $this->session->set($class , $v); | ||
| 440 | - } | ||
| 441 | - } else { | ||
| 442 | - $this->stepName = 'errors'; | ||
| 443 | - $this->action = $this->createStep(); | ||
| 444 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 445 | - } | ||
| 446 | - } | ||
| 447 | - | ||
| 448 | - /** | ||
| 449 | - * Load class value to session | ||
| 450 | - * | ||
| 451 | - * @author KnowledgeTree Team | ||
| 452 | - * @param string $class name of class | ||
| 453 | - * @param string $k key value | ||
| 454 | - * @param string $v value to store | ||
| 455 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 456 | - * @access private | ||
| 457 | - * @return void | ||
| 458 | - */ | ||
| 459 | - private function _loadValueToSession($class, $k, $v) { | ||
| 460 | - if($this->session != null) { | ||
| 461 | - $this->session->setClass($class, $k, $v); | ||
| 462 | - } else { | ||
| 463 | - $this->stepName = 'errors'; | ||
| 464 | - $this->action = $this->createStep(); | ||
| 465 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 466 | - } | ||
| 467 | - } | ||
| 468 | - | ||
| 469 | - /** | ||
| 470 | - * Load all class errors value to session | ||
| 471 | - * | ||
| 472 | - * @author KnowledgeTree Team | ||
| 473 | - * @param none | ||
| 474 | - * @access private | ||
| 475 | - * @return void | ||
| 476 | - */ | ||
| 477 | - private function _handleErrors() {// TODO: handle multiple errors | ||
| 478 | - $step_errors = $this->action->getErrors(); // Get errors | ||
| 479 | - foreach ($step_errors as $key => $value) { | ||
| 480 | - $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session | ||
| 481 | - } | ||
| 482 | - } | ||
| 483 | 119 | ||
| 484 | - /** | ||
| 485 | - * Remove all class errors value to session | ||
| 486 | - * | ||
| 487 | - * @author KnowledgeTree Team | ||
| 488 | - * @param none | ||
| 489 | - * @access private | ||
| 490 | - * @return void | ||
| 491 | - */ | ||
| 492 | - private function _clearErrors($class) { | ||
| 493 | - if($this->session) { | ||
| 494 | - $this->session->clearErrors($class); | ||
| 495 | - } | ||
| 496 | - } | ||
| 497 | 120 | ||
| 498 | - /** | ||
| 499 | - * Load class error value to session | ||
| 500 | - * | ||
| 501 | - * @author KnowledgeTree Team | ||
| 502 | - * @param string $class name of class | ||
| 503 | - * @param string $k key value | ||
| 504 | - * @param string $v value to store | ||
| 505 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 506 | - * @access private | ||
| 507 | - * @return void | ||
| 508 | - */ | ||
| 509 | - private function _loadErrorToSession($class, $k = "errors", $v) { | ||
| 510 | - if($this->session != null) { | ||
| 511 | - $this->session->setClassError($class, $k, $v); | ||
| 512 | - } else { | ||
| 513 | - $this->stepName = 'errors'; | ||
| 514 | - $this->action = $this->createStep(); | ||
| 515 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 516 | - } | ||
| 517 | - } | ||
| 518 | } | 121 | } |
| 519 | 122 | ||
| 520 | ?> | 123 | ?> |
| 521 | \ No newline at end of file | 124 | \ No newline at end of file |
setup/upgrade/upgradeWizard.php
| @@ -43,50 +43,10 @@ | @@ -43,50 +43,10 @@ | ||
| 43 | * @package Upgrader | 43 | * @package Upgrader |
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | -include("../wizard/path.php"); // Paths | ||
| 47 | 46 | ||
| 48 | -/** | ||
| 49 | - * Auto loader to bind upgrader package | ||
| 50 | - * | ||
| 51 | - * @param string $class | ||
| 52 | - * @return void | ||
| 53 | - */ | ||
| 54 | -function __autoload($class) { // Attempt and autoload classes | ||
| 55 | - $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems. | ||
| 56 | - if ($class == "template") { // Load existing templating classes | ||
| 57 | - require_once(WIZARD_DIR."../wizard/template.php"); | ||
| 58 | - require_once(WIZARD_DIR."../wizard/lib/helpers/htmlHelper.php"); | ||
| 59 | - } | ||
| 60 | - if(file_exists(WIZARD_DIR."$class.php")) { | ||
| 61 | - require_once(WIZARD_DIR."$class.php"); | ||
| 62 | - } elseif (file_exists(STEP_DIR."$class.php")) { | ||
| 63 | - require_once(STEP_DIR."$class.php"); | ||
| 64 | - } elseif (file_exists(WIZARD_LIB."$class.php")) { | ||
| 65 | - require_once(WIZARD_LIB."$class.php"); | ||
| 66 | - } else { | ||
| 67 | - return null; | ||
| 68 | - } | ||
| 69 | -} | ||
| 70 | - | ||
| 71 | -class UpgradeWizard { | ||
| 72 | - /** | ||
| 73 | - * Upgrade bypass flag | ||
| 74 | - * | ||
| 75 | - * @author KnowledgeTree Team | ||
| 76 | - * @access protected | ||
| 77 | - * @var mixed | ||
| 78 | - */ | ||
| 79 | - protected $bypass = null; | ||
| 80 | - | ||
| 81 | - /** | ||
| 82 | - * Reference to upgrader utility object | ||
| 83 | - * | ||
| 84 | - * @author KnowledgeTree Team | ||
| 85 | - * @access protected | ||
| 86 | - * @var boolean | ||
| 87 | - */ | ||
| 88 | - protected $util = null; | 47 | +require_once("../wizard/share/wizardBase.php"); |
| 89 | 48 | ||
| 49 | +class UpgradeWizard extends WizardBase { | ||
| 90 | /** | 50 | /** |
| 91 | * Constructs upgradeation wizard object | 51 | * Constructs upgradeation wizard object |
| 92 | * | 52 | * |
| @@ -96,18 +56,6 @@ class UpgradeWizard { | @@ -96,18 +56,6 @@ class UpgradeWizard { | ||
| 96 | public function __construct(){} | 56 | public function __construct(){} |
| 97 | 57 | ||
| 98 | /** | 58 | /** |
| 99 | - * Check if system has been upgrade | ||
| 100 | - * | ||
| 101 | - * @author KnowledgeTree Team | ||
| 102 | - * @access private | ||
| 103 | - * @param none | ||
| 104 | - * @return boolean | ||
| 105 | - */ | ||
| 106 | - private function isSystemUpgraded() { | ||
| 107 | - return $this->util->isSystemUpgraded(); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | * Display the wizard | 59 | * Display the wizard |
| 112 | * | 60 | * |
| 113 | * @author KnowledgeTree Team | 61 | * @author KnowledgeTree Team |
| @@ -115,7 +63,7 @@ class UpgradeWizard { | @@ -115,7 +63,7 @@ class UpgradeWizard { | ||
| 115 | * @param string | 63 | * @param string |
| 116 | * @return void | 64 | * @return void |
| 117 | */ | 65 | */ |
| 118 | - public function displayUpgrader($response = null) { | 66 | + public function display($response = null) { |
| 119 | if($response) { | 67 | if($response) { |
| 120 | $ins = new Upgrader(); // Instantiate the upgrader | 68 | $ins = new Upgrader(); // Instantiate the upgrader |
| 121 | $ins->resolveErrors($response); // Run step | 69 | $ins->resolveErrors($response); // Run step |
| @@ -126,30 +74,6 @@ class UpgradeWizard { | @@ -126,30 +74,6 @@ class UpgradeWizard { | ||
| 126 | } | 74 | } |
| 127 | 75 | ||
| 128 | /** | 76 | /** |
| 129 | - * Set bypass flag | ||
| 130 | - * | ||
| 131 | - * @author KnowledgeTree Team | ||
| 132 | - * @access private | ||
| 133 | - * @param boolean | ||
| 134 | - * @return void | ||
| 135 | - */ | ||
| 136 | - private function setBypass($bypass) { | ||
| 137 | - $this->bypass = $bypass; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - /** | ||
| 141 | - * Set util reference | ||
| 142 | - * | ||
| 143 | - * @author KnowledgeTree Team | ||
| 144 | - * @access private | ||
| 145 | - * @param object upgrader utility | ||
| 146 | - * @return void | ||
| 147 | - */ | ||
| 148 | - private function setIUtil($util) { | ||
| 149 | - $this->util = $util; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - /** | ||
| 153 | * Remove upgrade file | 77 | * Remove upgrade file |
| 154 | * | 78 | * |
| 155 | * @author KnowledgeTree Team | 79 | * @author KnowledgeTree Team |
| @@ -182,9 +106,6 @@ class UpgradeWizard { | @@ -182,9 +106,6 @@ class UpgradeWizard { | ||
| 182 | * @return mixed | 106 | * @return mixed |
| 183 | */ | 107 | */ |
| 184 | public function systemChecks() { | 108 | public function systemChecks() { |
| 185 | - // for now we don't write to any of these locations | ||
| 186 | - return true; | ||
| 187 | - | ||
| 188 | $res = $this->util->checkStructurePermissions(); | 109 | $res = $this->util->checkStructurePermissions(); |
| 189 | if($res === true) return $res; | 110 | if($res === true) return $res; |
| 190 | switch ($res) { | 111 | switch ($res) { |
| @@ -221,7 +142,7 @@ class UpgradeWizard { | @@ -221,7 +142,7 @@ class UpgradeWizard { | ||
| 221 | $this->util->redirect('../../login.php'); | 142 | $this->util->redirect('../../login.php'); |
| 222 | } | 143 | } |
| 223 | if($response === true) { | 144 | if($response === true) { |
| 224 | - $this->displayUpgrader(); | 145 | + $this->display(); |
| 225 | } else { | 146 | } else { |
| 226 | exit(); | 147 | exit(); |
| 227 | } | 148 | } |
setup/upgrade/upgradedbUtil.php
| @@ -105,7 +105,6 @@ class UpgradedbUtil { | @@ -105,7 +105,6 @@ class UpgradedbUtil { | ||
| 105 | * @access public | 105 | * @access public |
| 106 | */ | 106 | */ |
| 107 | public function __construct() { | 107 | public function __construct() { |
| 108 | - | ||
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | public function load($dhost = 'localhost', $duname, $dpassword, $dbname) { | 110 | public function load($dhost = 'localhost', $duname, $dpassword, $dbname) { |
setup/upgrade/upgrader.php
| @@ -44,99 +44,7 @@ | @@ -44,99 +44,7 @@ | ||
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | -class Upgrader { | ||
| 48 | - /** | ||
| 49 | - * Reference to simple xml object | ||
| 50 | - * | ||
| 51 | - * @author KnowledgeTree Team | ||
| 52 | - * @access protected | ||
| 53 | - * @var object SimpleXMLElement | ||
| 54 | - */ | ||
| 55 | - protected $simpleXmlObj = null; | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * Reference to step action object | ||
| 59 | - * | ||
| 60 | - * @author KnowledgeTree Team | ||
| 61 | - * @access protected | ||
| 62 | - * @var object StepAction | ||
| 63 | - */ | ||
| 64 | - protected $stepAction = null; | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * Reference to session object | ||
| 68 | - * | ||
| 69 | - * @author KnowledgeTree Team | ||
| 70 | - * @access protected | ||
| 71 | - * @var object Session | ||
| 72 | - */ | ||
| 73 | - protected $session = null; | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * List of upgradeation steps as strings | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var array string | ||
| 81 | - */ | ||
| 82 | - protected $stepClassNames = array(); | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * List of upgradeation steps as human readable strings | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var array string | ||
| 90 | - */ | ||
| 91 | - protected $stepNames = array(); | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * List of upgradeation steps as human readable strings | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var array string | ||
| 99 | - */ | ||
| 100 | - protected $stepObjects = array(); | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | - * Order in which steps have to be upgraded | ||
| 104 | - * | ||
| 105 | - * @author KnowledgeTree Team | ||
| 106 | - * @access protected | ||
| 107 | - * @var array string | ||
| 108 | - */ | ||
| 109 | - protected $upgradeOrders = array(); | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * List of upgradeation properties | ||
| 113 | - * | ||
| 114 | - * @author KnowledgeTree Team | ||
| 115 | - * @access protected | ||
| 116 | - * @var array string | ||
| 117 | - */ | ||
| 118 | - protected $upgradeProperties = array(); | ||
| 119 | - | ||
| 120 | - /** | ||
| 121 | - * Flag if a step object needs confirmation | ||
| 122 | - * | ||
| 123 | - * @author KnowledgeTree Team | ||
| 124 | - * @access protected | ||
| 125 | - * @var boolean | ||
| 126 | - */ | ||
| 127 | - protected $stepConfirmation = false; | ||
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * Flag if a step object needs confirmation | ||
| 131 | - * | ||
| 132 | - * @author KnowledgeTree Team | ||
| 133 | - * @access protected | ||
| 134 | - * @var boolean | ||
| 135 | - */ | ||
| 136 | - protected $stepDisplayFirst = false; | ||
| 137 | - | ||
| 138 | - private $upgraderAction = ''; | ||
| 139 | - | 47 | +class Upgrader extends NavBase { |
| 140 | /** | 48 | /** |
| 141 | * Constructs upgradeation object | 49 | * Constructs upgradeation object |
| 142 | * | 50 | * |
| @@ -156,7 +64,7 @@ class Upgrader { | @@ -156,7 +64,7 @@ class Upgrader { | ||
| 156 | * @access private | 64 | * @access private |
| 157 | * @return object | 65 | * @return object |
| 158 | */ | 66 | */ |
| 159 | - private function _readXml($name = "config.xml") { | 67 | + public function readXml($name = "config.xml") { |
| 160 | try { | 68 | try { |
| 161 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name"); | 69 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name"); |
| 162 | } catch (Exception $e) { | 70 | } catch (Exception $e) { |
| @@ -167,215 +75,6 @@ class Upgrader { | @@ -167,215 +75,6 @@ class Upgrader { | ||
| 167 | } | 75 | } |
| 168 | 76 | ||
| 169 | /** | 77 | /** |
| 170 | - * Checks if first step of upgrader | ||
| 171 | - * | ||
| 172 | - * @author KnowledgeTree Team | ||
| 173 | - * @param none | ||
| 174 | - * @access private | ||
| 175 | - * @return boolean | ||
| 176 | - */ | ||
| 177 | - private function _firstStep() { | ||
| 178 | - if(isset($_GET['step_name'])) { | ||
| 179 | - return false; | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - return true; | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - /** | ||
| 186 | - * Checks if first step of upgrader | ||
| 187 | - * | ||
| 188 | - * @author KnowledgeTree Team | ||
| 189 | - * @param none | ||
| 190 | - * @access private | ||
| 191 | - * @return boolean | ||
| 192 | - */ | ||
| 193 | - private function _firstStepPeriod() { | ||
| 194 | - if(isset($_GET['step_name'])) { | ||
| 195 | - if($_GET['step_name'] != 'welcome') | ||
| 196 | - return false; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - return true; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - /** | ||
| 203 | - * Returns next step | ||
| 204 | - * | ||
| 205 | - * @author KnowledgeTree Team | ||
| 206 | - * @param none | ||
| 207 | - * @access private | ||
| 208 | - * @return string | ||
| 209 | - */ | ||
| 210 | - private function _getNextStep() { | ||
| 211 | - return $this->_getStepName(1); | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - /** | ||
| 215 | - * Returns previous step | ||
| 216 | - * | ||
| 217 | - * @author KnowledgeTree Team | ||
| 218 | - * @param none | ||
| 219 | - * @access private | ||
| 220 | - * @return string | ||
| 221 | - */ | ||
| 222 | - private function _getPreviousStep() { | ||
| 223 | - return $this->_getStepName(-1); | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - /** | ||
| 227 | - * Returns the step name, given a position | ||
| 228 | - * | ||
| 229 | - * @author KnowledgeTree Team | ||
| 230 | - * @param integer $pos current position | ||
| 231 | - * @access private | ||
| 232 | - * @return string $name | ||
| 233 | - */ | ||
| 234 | - private function _getStepName($pos = 0) { | ||
| 235 | - if($this->_firstStep()) { | ||
| 236 | - $step = (string) $this->simpleXmlObj->steps->step[0]; | ||
| 237 | - } else { | ||
| 238 | - $pos += $this->getStepPosition(); | ||
| 239 | - $step = (string) $this->simpleXmlObj->steps->step[$pos]; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - return $step; | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - /** | ||
| 246 | - * Executes next step | ||
| 247 | - * | ||
| 248 | - * @author KnowledgeTree Team | ||
| 249 | - * @param none | ||
| 250 | - * @access private | ||
| 251 | - * @return string | ||
| 252 | - */ | ||
| 253 | - private function _proceed() { | ||
| 254 | - $step_name = $this->_getNextStep(); | ||
| 255 | - | ||
| 256 | - return $this->_runStepAction($step_name); | ||
| 257 | - } | ||
| 258 | - | ||
| 259 | - /** | ||
| 260 | - * Executes previous step | ||
| 261 | - * | ||
| 262 | - * @author KnowledgeTree Team | ||
| 263 | - * @param none | ||
| 264 | - * @access private | ||
| 265 | - * @return string | ||
| 266 | - */ | ||
| 267 | - private function _backward() { | ||
| 268 | - $step_name = $this->_getPreviousStep(); | ||
| 269 | - | ||
| 270 | - return $this->_runStepAction($step_name); | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - /** | ||
| 274 | - * Executes step landing | ||
| 275 | - * | ||
| 276 | - * @author KnowledgeTree Team | ||
| 277 | - * @param none | ||
| 278 | - * @access private | ||
| 279 | - * @return string | ||
| 280 | - */ | ||
| 281 | - private function _landing() { | ||
| 282 | - $step_name = $this->_getStepName(); | ||
| 283 | - | ||
| 284 | - return $this->_runStepAction($step_name); | ||
| 285 | - } | ||
| 286 | - | ||
| 287 | - /** | ||
| 288 | - * Executes step based on step class name | ||
| 289 | - * | ||
| 290 | - * @author KnowledgeTree Team | ||
| 291 | - * @param string $step_name | ||
| 292 | - * @access private | ||
| 293 | - * @return string | ||
| 294 | - */ | ||
| 295 | - private function _runStepAction($stepName) { | ||
| 296 | - $this->stepAction = new stepAction($stepName); | ||
| 297 | - $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getUpgradeProperties()); | ||
| 298 | - | ||
| 299 | - return $this->stepAction->doAction(); | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - private function stepDisplayFirst() { | ||
| 303 | - if($this->upgraderAction == 'edit') | ||
| 304 | - return false; // | ||
| 305 | - $class = $this->stepAction->createStep(); // Get step class | ||
| 306 | - return $class->displayFirst(); // Check if class needs to display first | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - /** | ||
| 310 | - * Set steps class names in string format | ||
| 311 | - * | ||
| 312 | - * @author KnowledgeTree Team | ||
| 313 | - * @param none | ||
| 314 | - * @access private | ||
| 315 | - * @return array | ||
| 316 | - */ | ||
| 317 | - private function _getUpgradeOrders() { | ||
| 318 | - return $this->upgradeOrders; | ||
| 319 | - } | ||
| 320 | - | ||
| 321 | - /** | ||
| 322 | - * Set steps as names | ||
| 323 | - * | ||
| 324 | - * @author KnowledgeTree Team | ||
| 325 | - * @param none | ||
| 326 | - * @access private | ||
| 327 | - * @return void | ||
| 328 | - */ | ||
| 329 | - private function _xmlStepsToArray() { | ||
| 330 | - if(isset($this->simpleXmlObj)) { | ||
| 331 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 332 | - $step_name = (string) $d_step[0]; | ||
| 333 | - $this->stepClassNames[] = $step_name; | ||
| 334 | - } | ||
| 335 | - $this->_loadToSession('stepClassNames', $this->stepClassNames); | ||
| 336 | - } | ||
| 337 | - } | ||
| 338 | - | ||
| 339 | - /** | ||
| 340 | - * Set steps as human readable strings | ||
| 341 | - * | ||
| 342 | - * @author KnowledgeTree Team | ||
| 343 | - * @param none | ||
| 344 | - * @access private | ||
| 345 | - * @return void | ||
| 346 | - */ | ||
| 347 | - private function _xmlStepsNames() { | ||
| 348 | - if(isset($this->simpleXmlObj)) { | ||
| 349 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 350 | - $step_name = (string) $d_step[0]; | ||
| 351 | - $this->stepNames[$step_name] = (string) $d_step['name']; | ||
| 352 | - } | ||
| 353 | - $this->_loadToSession('stepNames', $this->stepNames); | ||
| 354 | - } | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - /** | ||
| 358 | - * Set steps upgrade order | ||
| 359 | - * | ||
| 360 | - * @author KnowledgeTree Team | ||
| 361 | - * @param none | ||
| 362 | - * @access private | ||
| 363 | - * @return void | ||
| 364 | - */ | ||
| 365 | - private function _xmlStepsOrders() { | ||
| 366 | - if(isset($this->simpleXmlObj)) { | ||
| 367 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 368 | - if(isset($d_step['order'])) { | ||
| 369 | - $step_name = (string) $d_step[0]; | ||
| 370 | - $order = (string) $d_step['order']; | ||
| 371 | - $this->upgradeOrders[$order] = $step_name; // Store step upgrade order | ||
| 372 | - } | ||
| 373 | - } | ||
| 374 | - $this->_loadToSession('upgradeOrders', $this->upgradeOrders); | ||
| 375 | - } | ||
| 376 | - } | ||
| 377 | - | ||
| 378 | - /** | ||
| 379 | * Set upgrade properties | 78 | * Set upgrade properties |
| 380 | * | 79 | * |
| 381 | * @author KnowledgeTree Team | 80 | * @author KnowledgeTree Team |
| @@ -383,11 +82,11 @@ class Upgrader { | @@ -383,11 +82,11 @@ class Upgrader { | ||
| 383 | * @access private | 82 | * @access private |
| 384 | * @return void | 83 | * @return void |
| 385 | */ | 84 | */ |
| 386 | - private function _xmlUpgradeProperties() { | 85 | + public function xmlProperties() { |
| 387 | if(isset($this->simpleXmlObj)) { | 86 | if(isset($this->simpleXmlObj)) { |
| 388 | - $this->upgradeProperties['upgrade_version'] = (string) $this->simpleXmlObj['version']; | ||
| 389 | - $this->upgradeProperties['upgrade_type'] = (string) $this->simpleXmlObj['type']; | ||
| 390 | - $this->_loadToSession('upgradeProperties', $this->upgradeProperties); | 87 | + $this->properties['upgrade_version'] = (string) $this->simpleXmlObj['version']; |
| 88 | + $this->properties['upgrade_type'] = (string) $this->simpleXmlObj['type']; | ||
| 89 | + $this->loadToSession('upgradeProperties', $this->properties); | ||
| 391 | } | 90 | } |
| 392 | } | 91 | } |
| 393 | 92 | ||
| @@ -399,10 +98,10 @@ class Upgrader { | @@ -399,10 +98,10 @@ class Upgrader { | ||
| 399 | * @access private | 98 | * @access private |
| 400 | * @return void | 99 | * @return void |
| 401 | */ | 100 | */ |
| 402 | - private function _runStepsUpgrades() { | ||
| 403 | - $steps = $this->_getUpgradeOrders(); | 101 | + public function runStepsUpgrades() { |
| 102 | + $steps = $this->getOrders(); | ||
| 404 | for ($i=1; $i< count($steps)+1; $i++) { | 103 | for ($i=1; $i< count($steps)+1; $i++) { |
| 405 | - $this->_upgradeHelper($steps[$i]); | 104 | + $this->upgradeHelper($steps[$i]); |
| 406 | } | 105 | } |
| 407 | } | 106 | } |
| 408 | 107 | ||
| @@ -414,7 +113,7 @@ class Upgrader { | @@ -414,7 +113,7 @@ class Upgrader { | ||
| 414 | * @access private | 113 | * @access private |
| 415 | * @return void | 114 | * @return void |
| 416 | */ | 115 | */ |
| 417 | - private function _upgradeHelper($className) { | 116 | + public function upgradeHelper($className) { |
| 418 | $stepAction = new stepAction($className); // Instantiate a step action | 117 | $stepAction = new stepAction($className); // Instantiate a step action |
| 419 | $class = $stepAction->createStep(); // Get step class | 118 | $class = $stepAction->createStep(); // Get step class |
| 420 | if($class) { // Check if class Exists | 119 | if($class) { // Check if class Exists |
| @@ -430,75 +129,51 @@ class Upgrader { | @@ -430,75 +129,51 @@ class Upgrader { | ||
| 430 | } | 129 | } |
| 431 | } | 130 | } |
| 432 | 131 | ||
| 433 | - /** | ||
| 434 | - * Reset all session information on welcome landing | ||
| 435 | - * | ||
| 436 | - * @author KnowledgeTree Team | ||
| 437 | - * @param none | ||
| 438 | - * @access private | ||
| 439 | - * @return void | ||
| 440 | - */ | ||
| 441 | - private function _resetSessions() { | ||
| 442 | - if($this->session) { | ||
| 443 | - if($this->_firstStepPeriod()) { | ||
| 444 | - foreach ($this->getSteps() as $class) { | ||
| 445 | - $this->session->un_setClass($class); | ||
| 446 | - } | ||
| 447 | - foreach ($this->getStepNames() as $class) { | ||
| 448 | - $this->session->un_setClass($class); | ||
| 449 | - } | ||
| 450 | - foreach ($this->_getUpgradeOrders() as $class) { | ||
| 451 | - $this->session->un_setClass($class); | ||
| 452 | - } | ||
| 453 | - } | ||
| 454 | - } | ||
| 455 | - } | ||
| 456 | - | ||
| 457 | - function _loadFromSessions() { | 132 | + function loadFromSessions() { |
| 458 | $this->stepClassNames = $this->session->get('stepClassNames'); | 133 | $this->stepClassNames = $this->session->get('stepClassNames'); |
| 459 | if(!$this->stepClassNames) { | 134 | if(!$this->stepClassNames) { |
| 460 | - $this->_xmlStepsToArray(); // String steps | 135 | + $this->xmlStepsToArray(); // String steps |
| 461 | } | 136 | } |
| 462 | $this->stepNames = $this->session->get('stepNames'); | 137 | $this->stepNames = $this->session->get('stepNames'); |
| 463 | if(!$this->stepNames) { | 138 | if(!$this->stepNames) { |
| 464 | - $this->_xmlStepsNames(); | 139 | + $this->xmlStepsNames(); |
| 465 | } | 140 | } |
| 466 | - $this->upgradeOrders = $this->session->get('upgradeOrders'); | ||
| 467 | - if(!$this->upgradeOrders) { | ||
| 468 | - $this->_xmlStepsOrders(); | 141 | + $this->orders = $this->session->get('upgradeOrders'); |
| 142 | + if(!$this->orders) { | ||
| 143 | + $this->xmlStepsOrders(); | ||
| 469 | } | 144 | } |
| 470 | - $this->upgradeProperties = $this->session->get('upgradeProperties'); | ||
| 471 | - if(!$this->upgradeProperties) { | ||
| 472 | - $this->_xmlUpgradeProperties(); | 145 | + $this->properties = $this->session->get('upgradeProperties'); |
| 146 | + if(!$this->properties) { | ||
| 147 | + $this->xmlProperties(); | ||
| 473 | } | 148 | } |
| 474 | } | 149 | } |
| 475 | 150 | ||
| 476 | - private function loadNeeded() { | ||
| 477 | - $this->_readXml(); // Xml steps | 151 | + public function loadNeeded() { |
| 152 | + $this->readXml(); // Xml steps | ||
| 478 | // Make sure session is cleared | 153 | // Make sure session is cleared |
| 479 | - $this->_resetSessions(); | ||
| 480 | - $this->_loadFromSessions(); | 154 | + $this->resetSessions(); |
| 155 | + $this->loadFromSessions(); | ||
| 481 | if(isset($_POST['Next'])) { | 156 | if(isset($_POST['Next'])) { |
| 482 | - $this->upgraderAction = 'next'; | 157 | + $this->action = 'next'; |
| 483 | $this->response = 'next'; | 158 | $this->response = 'next'; |
| 484 | } elseif (isset($_POST['Previous'])) { | 159 | } elseif (isset($_POST['Previous'])) { |
| 485 | - $this->upgraderAction = 'previous'; | 160 | + $this->action = 'previous'; |
| 486 | $this->response = 'previous'; | 161 | $this->response = 'previous'; |
| 487 | } elseif (isset($_POST['Confirm'])) { | 162 | } elseif (isset($_POST['Confirm'])) { |
| 488 | - $this->upgraderAction = 'confirm'; | 163 | + $this->action = 'confirm'; |
| 489 | $this->response = 'next'; | 164 | $this->response = 'next'; |
| 490 | } elseif (isset($_POST['Upgrade'])) { | 165 | } elseif (isset($_POST['Upgrade'])) { |
| 491 | - $this->upgraderAction = 'upgrade'; | 166 | + $this->action = 'upgrade'; |
| 492 | $this->response = 'next'; | 167 | $this->response = 'next'; |
| 493 | } elseif (isset($_POST['Edit'])) { | 168 | } elseif (isset($_POST['Edit'])) { |
| 494 | - $this->upgraderAction = 'edit'; | 169 | + $this->action = 'edit'; |
| 495 | $this->response = 'next'; | 170 | $this->response = 'next'; |
| 496 | } elseif (isset($_POST['Install'])) { | 171 | } elseif (isset($_POST['Install'])) { |
| 497 | - $this->upgraderAction = 'install'; | 172 | + $this->action = 'install'; |
| 498 | $this->response = 'install'; | 173 | $this->response = 'install'; |
| 499 | } else { | 174 | } else { |
| 500 | $this->response = ''; | 175 | $this->response = ''; |
| 501 | - $this->upgraderAction = ''; | 176 | + $this->action = ''; |
| 502 | } | 177 | } |
| 503 | } | 178 | } |
| 504 | 179 | ||
| @@ -514,24 +189,24 @@ class Upgrader { | @@ -514,24 +189,24 @@ class Upgrader { | ||
| 514 | $this->loadNeeded(); | 189 | $this->loadNeeded(); |
| 515 | switch($this->response) { | 190 | switch($this->response) { |
| 516 | case 'next': | 191 | case 'next': |
| 517 | - $step_name = $this->_getStepName(); | ||
| 518 | - $res = $this->_runStepAction($step_name); | 192 | + $step_name = $this->getStepName(); |
| 193 | + $res = $this->runStepAction($step_name); | ||
| 519 | if($res == 'next') { | 194 | if($res == 'next') { |
| 520 | - $this->_proceed(); // Load next window | 195 | + $this->proceed(); // Load next window |
| 521 | } elseif ($res == 'upgrade') { | 196 | } elseif ($res == 'upgrade') { |
| 522 | - $this->_runStepsUpgraders(); // Load landing | ||
| 523 | - $this->_proceed(); // Load next window | 197 | + $this->runStepsUpgraders(); // Load landing |
| 198 | + $this->proceed(); // Load next window | ||
| 524 | } elseif ($res == 'confirm') { | 199 | } elseif ($res == 'confirm') { |
| 525 | if(!$this->stepDisplayFirst()) | 200 | if(!$this->stepDisplayFirst()) |
| 526 | $this->stepConfirmation = true; | 201 | $this->stepConfirmation = true; |
| 527 | - $this->_landing(); | 202 | + $this->landing(); |
| 528 | } elseif ($res == 'landing') { | 203 | } elseif ($res == 'landing') { |
| 529 | - $this->_landing(); | 204 | + $this->landing(); |
| 530 | } else { | 205 | } else { |
| 531 | } | 206 | } |
| 532 | break; | 207 | break; |
| 533 | case 'previous': | 208 | case 'previous': |
| 534 | - $this->_backward(); // Load previous page | 209 | + $this->backward(); // Load previous page |
| 535 | break; | 210 | break; |
| 536 | case 'install': | 211 | case 'install': |
| 537 | $util = new UpgradeUtil(); | 212 | $util = new UpgradeUtil(); |
| @@ -539,131 +214,11 @@ class Upgrader { | @@ -539,131 +214,11 @@ class Upgrader { | ||
| 539 | break; | 214 | break; |
| 540 | default: | 215 | default: |
| 541 | // TODO : handle silent | 216 | // TODO : handle silent |
| 542 | - $this->_landing(); | 217 | + $this->landing(); |
| 543 | break; | 218 | break; |
| 544 | } | 219 | } |
| 545 | $this->stepAction->paintAction(); // Display step | 220 | $this->stepAction->paintAction(); // Display step |
| 546 | } | 221 | } |
| 547 | - | ||
| 548 | - /** | ||
| 549 | - * Returns the step number | ||
| 550 | - * | ||
| 551 | - * @author KnowledgeTree Team | ||
| 552 | - * @param none | ||
| 553 | - * @access public | ||
| 554 | - * @return integer $pos | ||
| 555 | - */ | ||
| 556 | - public function getStepPosition() { | ||
| 557 | - $pos = 0; | ||
| 558 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 559 | - $step = (string) $d_step; | ||
| 560 | - if ($step == $_GET['step_name']) { | ||
| 561 | - break; | ||
| 562 | - } | ||
| 563 | - $pos++; | ||
| 564 | - } | ||
| 565 | - if(isset($_GET['step'])) { | ||
| 566 | - if($_GET['step'] == "next") | ||
| 567 | - $pos = $pos+1; | ||
| 568 | - else | ||
| 569 | - $pos = $pos-1; | ||
| 570 | - } | ||
| 571 | - | ||
| 572 | - return $pos; | ||
| 573 | - } | ||
| 574 | - | ||
| 575 | - /** | ||
| 576 | - * Returns the step names for classes | ||
| 577 | - * | ||
| 578 | - * @author KnowledgeTree Team | ||
| 579 | - * @param none | ||
| 580 | - * @access public | ||
| 581 | - * @return array | ||
| 582 | - */ | ||
| 583 | - public function getSteps() { | ||
| 584 | - return $this->stepClassNames; | ||
| 585 | - } | ||
| 586 | - | ||
| 587 | - /** | ||
| 588 | - * Returns the steps as human readable string | ||
| 589 | - * | ||
| 590 | - * @author KnowledgeTree Team | ||
| 591 | - * @param none | ||
| 592 | - * @access public | ||
| 593 | - * @return array | ||
| 594 | - */ | ||
| 595 | - public function getStepNames() { | ||
| 596 | - return $this->stepNames; | ||
| 597 | - } | ||
| 598 | - | ||
| 599 | - /** | ||
| 600 | - * Returns whether or not a confirmation step is needed | ||
| 601 | - * | ||
| 602 | - * @author KnowledgeTree Team | ||
| 603 | - * @param none | ||
| 604 | - * @access public | ||
| 605 | - * @return boolean | ||
| 606 | - */ | ||
| 607 | - public function getStepConfirmation() { | ||
| 608 | - return $this->stepConfirmation; | ||
| 609 | - } | ||
| 610 | - | ||
| 611 | - /** | ||
| 612 | - * Return upgrade properties | ||
| 613 | - * | ||
| 614 | - * @author KnowledgeTree Team | ||
| 615 | - * @param string | ||
| 616 | - * @access public | ||
| 617 | - * @return string | ||
| 618 | - */ | ||
| 619 | - public function getUpgradeProperties() { | ||
| 620 | - return $this->upgradeProperties; | ||
| 621 | - } | ||
| 622 | - | ||
| 623 | - /** | ||
| 624 | - * Returns session | ||
| 625 | - * | ||
| 626 | - * @author KnowledgeTree Team | ||
| 627 | - * @param none | ||
| 628 | - * @access public | ||
| 629 | - * @return boolean | ||
| 630 | - */ | ||
| 631 | - public function getSession() { | ||
| 632 | - return $this->session; | ||
| 633 | - } | ||
| 634 | - | ||
| 635 | - /** | ||
| 636 | - * Dump of SESSION | ||
| 637 | - * | ||
| 638 | - * @author KnowledgeTree Team | ||
| 639 | - * @param none | ||
| 640 | - * @access public | ||
| 641 | - * @return array | ||
| 642 | - */ | ||
| 643 | - public function showSession() { | ||
| 644 | - echo '<pre>'; | ||
| 645 | - print_r($_SESSION); | ||
| 646 | - echo '</pre>'; | ||
| 647 | - } | ||
| 648 | - | ||
| 649 | - /** | ||
| 650 | - * Display errors that are not allowing the upgrader to operate | ||
| 651 | - * | ||
| 652 | - * @author KnowledgeTree Team | ||
| 653 | - * @param none | ||
| 654 | - * @access public | ||
| 655 | - * @return void | ||
| 656 | - */ | ||
| 657 | - public function resolveErrors($errors) { | ||
| 658 | - echo $errors; | ||
| 659 | - exit(); | ||
| 660 | - } | ||
| 661 | - | ||
| 662 | - private function _loadToSession($type, $values) { | ||
| 663 | - if($values) { | ||
| 664 | - $this->session->set($type , $values); | ||
| 665 | - } | ||
| 666 | - } | ||
| 667 | } | 222 | } |
| 668 | 223 | ||
| 669 | ?> | 224 | ?> |
setup/wizard/config/databases.xml
| @@ -15,8 +15,8 @@ | @@ -15,8 +15,8 @@ | ||
| 15 | <dport>3306</dport> | 15 | <dport>3306</dport> |
| 16 | <dname>dms</dname> | 16 | <dname>dms</dname> |
| 17 | <duname>root</duname> | 17 | <duname>root</duname> |
| 18 | - <dmsadminuser>dmsadmin</dmsadminuser> | 18 | + <dmsadminuser>ktcomadmin</dmsadminuser> |
| 19 | <dmsaupass>js9281djw</dmsaupass> | 19 | <dmsaupass>js9281djw</dmsaupass> |
| 20 | - <dmsuser>dms</dmsuser> | 20 | + <dmsuser>ktcom-dms</dmsuser> |
| 21 | <dmsupass>djw9281js</dmsupass> | 21 | <dmsupass>djw9281js</dmsupass> |
| 22 | </database> | 22 | </database> |
setup/wizard/installWizard.php
| @@ -43,62 +43,9 @@ | @@ -43,62 +43,9 @@ | ||
| 43 | * @package Installer | 43 | * @package Installer |
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | -include("path.php"); // Paths | ||
| 47 | - | ||
| 48 | -/** | ||
| 49 | - * Auto loader to bind installer package | ||
| 50 | - * | ||
| 51 | - * @param string $class | ||
| 52 | - * @return void | ||
| 53 | - */ | ||
| 54 | -function __autoload($class) { // Attempt and autoload classes | ||
| 55 | - $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems. | ||
| 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 | - } elseif (file_exists(SERVICE_LIB."$class.php")) { | ||
| 63 | - require_once(SERVICE_LIB."$class.php"); | ||
| 64 | - } elseif (file_exists(VALID_DIR."$class.php")) { | ||
| 65 | - require_once(VALID_DIR."$class.php"); | ||
| 66 | - } else { | ||
| 67 | - if(preg_match('/Helper/', $class)) { | ||
| 68 | - require_once(HELPER_DIR."$class.php"); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | - return false; | ||
| 72 | -} | ||
| 73 | - | ||
| 74 | -class InstallWizard { | ||
| 75 | - /** | ||
| 76 | - * Install bypass flag | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var mixed | ||
| 81 | - */ | ||
| 82 | - protected $bypass = null; | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * Level of debugger | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var mixed | ||
| 90 | - */ | ||
| 91 | - protected $debugLevel = 0; | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * Reference to installer utility object | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var boolean | ||
| 99 | - */ | ||
| 100 | - protected $util = null; | 46 | +require_once("../wizard/share/wizardBase.php"); |
| 101 | 47 | ||
| 48 | +class InstallWizard extends WizardBase { | ||
| 102 | /** | 49 | /** |
| 103 | * Constructs installation wizard object | 50 | * Constructs installation wizard object |
| 104 | * | 51 | * |
| @@ -115,7 +62,7 @@ class InstallWizard { | @@ -115,7 +62,7 @@ class InstallWizard { | ||
| 115 | * @param string | 62 | * @param string |
| 116 | * @return void | 63 | * @return void |
| 117 | */ | 64 | */ |
| 118 | - public function displayInstaller($response = null) { | 65 | + public function display($response = null) { |
| 119 | if($response) { | 66 | if($response) { |
| 120 | $ins = new Installer(); // Instantiate the installer | 67 | $ins = new Installer(); // Instantiate the installer |
| 121 | $ins->resolveErrors($response); // Run step | 68 | $ins->resolveErrors($response); // Run step |
| @@ -126,67 +73,6 @@ class InstallWizard { | @@ -126,67 +73,6 @@ class InstallWizard { | ||
| 126 | } | 73 | } |
| 127 | 74 | ||
| 128 | /** | 75 | /** |
| 129 | - * Set bypass flag | ||
| 130 | - * | ||
| 131 | - * @author KnowledgeTree Team | ||
| 132 | - * @access private | ||
| 133 | - * @param boolean | ||
| 134 | - * @return void | ||
| 135 | - */ | ||
| 136 | - private function setBypass($bypass) { | ||
| 137 | - $this->bypass = $bypass; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - /** | ||
| 141 | - * Set debug level | ||
| 142 | - * | ||
| 143 | - * @author KnowledgeTree Team | ||
| 144 | - * @access private | ||
| 145 | - * @param boolean | ||
| 146 | - * @return void | ||
| 147 | - */ | ||
| 148 | - private function setDebugLevel($debug) { | ||
| 149 | - define('DEBUG', $debug); | ||
| 150 | - $this->debugLevel = $debug; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - /** | ||
| 154 | - * Set util reference | ||
| 155 | - * | ||
| 156 | - * @author KnowledgeTree Team | ||
| 157 | - * @access private | ||
| 158 | - * @param object installer utility | ||
| 159 | - * @return void | ||
| 160 | - */ | ||
| 161 | - private function setIUtil($util) { | ||
| 162 | - $this->util = $util; | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - /** | ||
| 166 | - * Get bypass flag | ||
| 167 | - * | ||
| 168 | - * @author KnowledgeTree Team | ||
| 169 | - * @access public | ||
| 170 | - * @param none | ||
| 171 | - * @return boolean | ||
| 172 | - */ | ||
| 173 | - public function getBypass() { | ||
| 174 | - return $this->bypass; | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - /** | ||
| 178 | - * Bypass and force an install | ||
| 179 | - * | ||
| 180 | - * @author KnowledgeTree Team | ||
| 181 | - * @access private | ||
| 182 | - * @param none | ||
| 183 | - * @return boolean | ||
| 184 | - */ | ||
| 185 | - private function bypass() { | ||
| 186 | - | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - /** | ||
| 190 | * Create install file | 76 | * Create install file |
| 191 | * | 77 | * |
| 192 | * @author KnowledgeTree Team | 78 | * @author KnowledgeTree Team |
| @@ -268,7 +154,7 @@ class InstallWizard { | @@ -268,7 +154,7 @@ class InstallWizard { | ||
| 268 | public function dispatch() { | 154 | public function dispatch() { |
| 269 | $this->load(); | 155 | $this->load(); |
| 270 | if($this->getBypass() === "1") { // Helper to force install | 156 | if($this->getBypass() === "1") { // Helper to force install |
| 271 | - $this->removeInstallFile(); // TODO: Remove | 157 | + $this->removeInstallFile(); |
| 272 | } elseif ($this->getBypass() === "0") { | 158 | } elseif ($this->getBypass() === "0") { |
| 273 | $this->createInstallFile(); | 159 | $this->createInstallFile(); |
| 274 | } | 160 | } |
| @@ -281,13 +167,13 @@ class InstallWizard { | @@ -281,13 +167,13 @@ class InstallWizard { | ||
| 281 | if($this->util->loginSpecified()) { // Back to wizard from upgrader | 167 | if($this->util->loginSpecified()) { // Back to wizard from upgrader |
| 282 | $this->util->redirect('../../control.php'); | 168 | $this->util->redirect('../../control.php'); |
| 283 | } elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed | 169 | } elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed |
| 284 | - $this->util->redirect('../migrate/index.php?'); | 170 | + $this->util->redirect('../migrate/index.php'); |
| 285 | } elseif ($this->util->upgradeSpecified()) { // Check if the upgrader needs to be accessed | 171 | } elseif ($this->util->upgradeSpecified()) { // Check if the upgrader needs to be accessed |
| 286 | $this->util->redirect('../upgrade/index.php?action=installer'); | 172 | $this->util->redirect('../upgrade/index.php?action=installer'); |
| 287 | } | 173 | } |
| 288 | $response = $this->systemChecks(); | 174 | $response = $this->systemChecks(); |
| 289 | if($response === true) { | 175 | if($response === true) { |
| 290 | - $this->displayInstaller(); | 176 | + $this->display(); |
| 291 | } else { | 177 | } else { |
| 292 | exit(); | 178 | exit(); |
| 293 | } | 179 | } |
setup/wizard/installer.php
| @@ -44,99 +44,7 @@ | @@ -44,99 +44,7 @@ | ||
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | -class Installer { | ||
| 48 | - /** | ||
| 49 | - * Reference to simple xml object | ||
| 50 | - * | ||
| 51 | - * @author KnowledgeTree Team | ||
| 52 | - * @access protected | ||
| 53 | - * @var object SimpleXMLElement | ||
| 54 | - */ | ||
| 55 | - protected $simpleXmlObj = null; | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * Reference to step action object | ||
| 59 | - * | ||
| 60 | - * @author KnowledgeTree Team | ||
| 61 | - * @access protected | ||
| 62 | - * @var object StepAction | ||
| 63 | - */ | ||
| 64 | - protected $stepAction = null; | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * Reference to session object | ||
| 68 | - * | ||
| 69 | - * @author KnowledgeTree Team | ||
| 70 | - * @access protected | ||
| 71 | - * @var object Session | ||
| 72 | - */ | ||
| 73 | - protected $session = null; | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * List of installation steps as strings | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var array string | ||
| 81 | - */ | ||
| 82 | - protected $stepClassNames = array(); | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * List of installation steps as human readable strings | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var array string | ||
| 90 | - */ | ||
| 91 | - protected $stepNames = array(); | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * List of installation steps as human readable strings | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var array string | ||
| 99 | - */ | ||
| 100 | - protected $stepObjects = array(); | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | - * Order in which steps have to be installed | ||
| 104 | - * | ||
| 105 | - * @author KnowledgeTree Team | ||
| 106 | - * @access protected | ||
| 107 | - * @var array string | ||
| 108 | - */ | ||
| 109 | - protected $installOrders = array(); | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * List of installation properties | ||
| 113 | - * | ||
| 114 | - * @author KnowledgeTree Team | ||
| 115 | - * @access protected | ||
| 116 | - * @var array string | ||
| 117 | - */ | ||
| 118 | - protected $installProperties = array(); | ||
| 119 | - | ||
| 120 | - /** | ||
| 121 | - * Flag if a step object needs confirmation | ||
| 122 | - * | ||
| 123 | - * @author KnowledgeTree Team | ||
| 124 | - * @access protected | ||
| 125 | - * @var boolean | ||
| 126 | - */ | ||
| 127 | - protected $stepConfirmation = false; | ||
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * Flag if a step object needs confirmation | ||
| 131 | - * | ||
| 132 | - * @author KnowledgeTree Team | ||
| 133 | - * @access protected | ||
| 134 | - * @var boolean | ||
| 135 | - */ | ||
| 136 | - protected $stepDisplayFirst = false; | ||
| 137 | - | ||
| 138 | - private $installerAction = ''; | ||
| 139 | - | 47 | +class Installer extends NavBase { |
| 140 | /** | 48 | /** |
| 141 | * Constructs installation object | 49 | * Constructs installation object |
| 142 | * | 50 | * |
| @@ -156,7 +64,7 @@ class Installer { | @@ -156,7 +64,7 @@ class Installer { | ||
| 156 | * @access private | 64 | * @access private |
| 157 | * @return object | 65 | * @return object |
| 158 | */ | 66 | */ |
| 159 | - private function _readXml($name = "config.xml") { | 67 | + public function readXml($name = "config.xml") { |
| 160 | try { | 68 | try { |
| 161 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name"); | 69 | $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name"); |
| 162 | } catch (Exception $e) { | 70 | } catch (Exception $e) { |
| @@ -166,214 +74,6 @@ class Installer { | @@ -166,214 +74,6 @@ class Installer { | ||
| 166 | } | 74 | } |
| 167 | } | 75 | } |
| 168 | 76 | ||
| 169 | - /** | ||
| 170 | - * Checks if first step of installer | ||
| 171 | - * | ||
| 172 | - * @author KnowledgeTree Team | ||
| 173 | - * @param none | ||
| 174 | - * @access private | ||
| 175 | - * @return boolean | ||
| 176 | - */ | ||
| 177 | - private function _firstStep() { | ||
| 178 | - if(isset($_GET['step_name'])) { | ||
| 179 | - return false; | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - return true; | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - /** | ||
| 186 | - * Checks if first step of installer | ||
| 187 | - * | ||
| 188 | - * @author KnowledgeTree Team | ||
| 189 | - * @param none | ||
| 190 | - * @access private | ||
| 191 | - * @return boolean | ||
| 192 | - */ | ||
| 193 | - private function _firstStepPeriod() { | ||
| 194 | - if(isset($_GET['step_name'])) { | ||
| 195 | - if($_GET['step_name'] != 'welcome') | ||
| 196 | - return false; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - return true; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - /** | ||
| 203 | - * Returns next step | ||
| 204 | - * | ||
| 205 | - * @author KnowledgeTree Team | ||
| 206 | - * @param none | ||
| 207 | - * @access private | ||
| 208 | - * @return string | ||
| 209 | - */ | ||
| 210 | - private function _getNextStep() { | ||
| 211 | - return $this->_getStepName(1); | ||
| 212 | - } | ||
| 213 | - | ||
| 214 | - /** | ||
| 215 | - * Returns previous step | ||
| 216 | - * | ||
| 217 | - * @author KnowledgeTree Team | ||
| 218 | - * @param none | ||
| 219 | - * @access private | ||
| 220 | - * @return string | ||
| 221 | - */ | ||
| 222 | - private function _getPreviousStep() { | ||
| 223 | - return $this->_getStepName(-1); | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - /** | ||
| 227 | - * Returns the step name, given a position | ||
| 228 | - * | ||
| 229 | - * @author KnowledgeTree Team | ||
| 230 | - * @param integer $pos current position | ||
| 231 | - * @access private | ||
| 232 | - * @return string $name | ||
| 233 | - */ | ||
| 234 | - private function _getStepName($pos = 0) { | ||
| 235 | - if($this->_firstStep()) { | ||
| 236 | - $step = (string) $this->simpleXmlObj->steps->step[0]; | ||
| 237 | - } else { | ||
| 238 | - $pos += $this->getStepPosition(); | ||
| 239 | - $step = (string) $this->simpleXmlObj->steps->step[$pos]; | ||
| 240 | - } | ||
| 241 | - | ||
| 242 | - return $step; | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - /** | ||
| 246 | - * Executes next step | ||
| 247 | - * | ||
| 248 | - * @author KnowledgeTree Team | ||
| 249 | - * @param none | ||
| 250 | - * @access private | ||
| 251 | - * @return string | ||
| 252 | - */ | ||
| 253 | - private function _proceed() { | ||
| 254 | - $step_name = $this->_getNextStep(); | ||
| 255 | - | ||
| 256 | - return $this->_runStepAction($step_name); | ||
| 257 | - } | ||
| 258 | - | ||
| 259 | - /** | ||
| 260 | - * Executes previous step | ||
| 261 | - * | ||
| 262 | - * @author KnowledgeTree Team | ||
| 263 | - * @param none | ||
| 264 | - * @access private | ||
| 265 | - * @return string | ||
| 266 | - */ | ||
| 267 | - private function _backward() { | ||
| 268 | - $step_name = $this->_getPreviousStep(); | ||
| 269 | - | ||
| 270 | - return $this->_runStepAction($step_name); | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - /** | ||
| 274 | - * Executes step landing | ||
| 275 | - * | ||
| 276 | - * @author KnowledgeTree Team | ||
| 277 | - * @param none | ||
| 278 | - * @access private | ||
| 279 | - * @return string | ||
| 280 | - */ | ||
| 281 | - private function _landing() { | ||
| 282 | - $step_name = $this->_getStepName(); | ||
| 283 | - | ||
| 284 | - return $this->_runStepAction($step_name); | ||
| 285 | - } | ||
| 286 | - | ||
| 287 | - /** | ||
| 288 | - * Executes step based on step class name | ||
| 289 | - * | ||
| 290 | - * @author KnowledgeTree Team | ||
| 291 | - * @param string $step_name | ||
| 292 | - * @access private | ||
| 293 | - * @return string | ||
| 294 | - */ | ||
| 295 | - private function _runStepAction($stepName) { | ||
| 296 | - $this->stepAction = new stepAction($stepName); | ||
| 297 | - $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getInstallProperties()); | ||
| 298 | - | ||
| 299 | - return $this->stepAction->doAction(); | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - private function stepDisplayFirst() { | ||
| 303 | - if($this->installerAction == 'edit') | ||
| 304 | - return false; // | ||
| 305 | - $class = $this->stepAction->createStep(); // Get step class | ||
| 306 | - return $class->displayFirst(); // Check if class needs to display first | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - /** | ||
| 310 | - * Set steps class names in string format | ||
| 311 | - * | ||
| 312 | - * @author KnowledgeTree Team | ||
| 313 | - * @param none | ||
| 314 | - * @access private | ||
| 315 | - * @return array | ||
| 316 | - */ | ||
| 317 | - private function _getInstallOrders() { | ||
| 318 | - return $this->installOrders; | ||
| 319 | - } | ||
| 320 | - | ||
| 321 | - /** | ||
| 322 | - * Set steps as names | ||
| 323 | - * | ||
| 324 | - * @author KnowledgeTree Team | ||
| 325 | - * @param none | ||
| 326 | - * @access private | ||
| 327 | - * @return void | ||
| 328 | - */ | ||
| 329 | - private function _xmlStepsToArray() { | ||
| 330 | - if(isset($this->simpleXmlObj)) { | ||
| 331 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 332 | - $step_name = (string) $d_step[0]; | ||
| 333 | - $this->stepClassNames[] = $step_name; | ||
| 334 | - } | ||
| 335 | - $this->_loadToSession('stepClassNames', $this->stepClassNames); | ||
| 336 | - } | ||
| 337 | - } | ||
| 338 | - | ||
| 339 | - /** | ||
| 340 | - * Set steps as human readable strings | ||
| 341 | - * | ||
| 342 | - * @author KnowledgeTree Team | ||
| 343 | - * @param none | ||
| 344 | - * @access private | ||
| 345 | - * @return void | ||
| 346 | - */ | ||
| 347 | - private function _xmlStepsNames() { | ||
| 348 | - if(isset($this->simpleXmlObj)) { | ||
| 349 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 350 | - $step_name = (string) $d_step[0]; | ||
| 351 | - $this->stepNames[$step_name] = (string) $d_step['name']; | ||
| 352 | - } | ||
| 353 | - $this->_loadToSession('stepNames', $this->stepNames); | ||
| 354 | - } | ||
| 355 | - } | ||
| 356 | - | ||
| 357 | - /** | ||
| 358 | - * Set steps install order | ||
| 359 | - * | ||
| 360 | - * @author KnowledgeTree Team | ||
| 361 | - * @param none | ||
| 362 | - * @access private | ||
| 363 | - * @return void | ||
| 364 | - */ | ||
| 365 | - private function _xmlStepsOrders() { | ||
| 366 | - if(isset($this->simpleXmlObj)) { | ||
| 367 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 368 | - if(isset($d_step['order'])) { | ||
| 369 | - $step_name = (string) $d_step[0]; | ||
| 370 | - $order = (string) $d_step['order']; | ||
| 371 | - $this->installOrders[$order] = $step_name; // Store step install order | ||
| 372 | - } | ||
| 373 | - } | ||
| 374 | - $this->_loadToSession('installOrders', $this->installOrders); | ||
| 375 | - } | ||
| 376 | - } | ||
| 377 | 77 | ||
| 378 | /** | 78 | /** |
| 379 | * Set install properties | 79 | * Set install properties |
| @@ -383,11 +83,11 @@ class Installer { | @@ -383,11 +83,11 @@ class Installer { | ||
| 383 | * @access private | 83 | * @access private |
| 384 | * @return void | 84 | * @return void |
| 385 | */ | 85 | */ |
| 386 | - private function _xmlInstallProperties() { | 86 | + public function xmlProperties() { |
| 387 | if(isset($this->simpleXmlObj)) { | 87 | if(isset($this->simpleXmlObj)) { |
| 388 | - $this->installProperties['install_version'] = (string) $this->simpleXmlObj['version']; | ||
| 389 | - $this->installProperties['install_type'] = (string) $this->simpleXmlObj['type']; | ||
| 390 | - $this->_loadToSession('installProperties', $this->installProperties); | 88 | + $this->properties['install_version'] = (string) $this->simpleXmlObj['version']; |
| 89 | + $this->properties['install_type'] = (string) $this->simpleXmlObj['type']; | ||
| 90 | + $this->loadToSession('installProperties', $this->properties); | ||
| 391 | } | 91 | } |
| 392 | } | 92 | } |
| 393 | 93 | ||
| @@ -399,25 +99,13 @@ class Installer { | @@ -399,25 +99,13 @@ class Installer { | ||
| 399 | * @access private | 99 | * @access private |
| 400 | * @return void | 100 | * @return void |
| 401 | */ | 101 | */ |
| 402 | - private function _runStepsInstallers() { | ||
| 403 | - $steps = $this->_getInstallOrders(); | 102 | + private function runStepsInstallers() { |
| 103 | + $steps = $this->getOrders(); | ||
| 404 | for ($i=1; $i< count($steps)+1; $i++) { | 104 | for ($i=1; $i< count($steps)+1; $i++) { |
| 405 | - $this->_installHelper($steps[$i]); | 105 | + $this->installHelper($steps[$i]); |
| 406 | } | 106 | } |
| 407 | 107 | ||
| 408 | - $this->_completeInstall(); | ||
| 409 | - } | ||
| 410 | - | ||
| 411 | - /** | ||
| 412 | - * Complete install cleanup process | ||
| 413 | - * | ||
| 414 | - * @author KnowledgeTree Team | ||
| 415 | - * @param none | ||
| 416 | - * @access private | ||
| 417 | - * @return void | ||
| 418 | - */ | ||
| 419 | - private function _completeInstall() { | ||
| 420 | - touch(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock"); | 108 | + $this->completeInstall(); |
| 421 | } | 109 | } |
| 422 | 110 | ||
| 423 | /** | 111 | /** |
| @@ -428,7 +116,7 @@ class Installer { | @@ -428,7 +116,7 @@ class Installer { | ||
| 428 | * @access private | 116 | * @access private |
| 429 | * @return void | 117 | * @return void |
| 430 | */ | 118 | */ |
| 431 | - private function _installHelper($className) { | 119 | + private function installHelper($className) { |
| 432 | $stepAction = new stepAction($className); // Instantiate a step action | 120 | $stepAction = new stepAction($className); // Instantiate a step action |
| 433 | $class = $stepAction->createStep(); // Get step class | 121 | $class = $stepAction->createStep(); // Get step class |
| 434 | if($class) { // Check if class Exists | 122 | if($class) { // Check if class Exists |
| @@ -443,76 +131,85 @@ class Installer { | @@ -443,76 +131,85 @@ class Installer { | ||
| 443 | exit(); | 131 | exit(); |
| 444 | } | 132 | } |
| 445 | } | 133 | } |
| 446 | - | 134 | + |
| 447 | /** | 135 | /** |
| 448 | - * Reset all session information on welcome landing | 136 | + * Complete install cleanup process |
| 449 | * | 137 | * |
| 450 | * @author KnowledgeTree Team | 138 | * @author KnowledgeTree Team |
| 451 | * @param none | 139 | * @param none |
| 452 | * @access private | 140 | * @access private |
| 453 | * @return void | 141 | * @return void |
| 454 | */ | 142 | */ |
| 455 | - private function _resetSessions() { | ||
| 456 | - if($this->session) { | ||
| 457 | - if($this->_firstStepPeriod()) { | ||
| 458 | - foreach ($this->getSteps() as $class) { | ||
| 459 | - $this->session->un_setClass($class); | ||
| 460 | - } | ||
| 461 | - foreach ($this->getStepNames() as $class) { | ||
| 462 | - $this->session->un_setClass($class); | ||
| 463 | - } | ||
| 464 | - foreach ($this->_getInstallOrders() as $class) { | ||
| 465 | - $this->session->un_setClass($class); | ||
| 466 | - } | ||
| 467 | - } | 143 | + private function completeInstall() { |
| 144 | + touch(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock"); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /** | ||
| 148 | + * Set steps install order | ||
| 149 | + * | ||
| 150 | + * @author KnowledgeTree Team | ||
| 151 | + * @param none | ||
| 152 | + * @access public | ||
| 153 | + * @return void | ||
| 154 | + */ | ||
| 155 | + public function xmlStepsOrders() { | ||
| 156 | + if(isset($this->simpleXmlObj)) { | ||
| 157 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 158 | + if(isset($d_step['order'])) { | ||
| 159 | + $step_name = (string) $d_step[0]; | ||
| 160 | + $order = (string) $d_step['order']; | ||
| 161 | + $this->orders[$order] = $step_name; // Store step install order | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + $this->loadToSession('installOrders', $this->orders); | ||
| 468 | } | 165 | } |
| 469 | } | 166 | } |
| 470 | - | ||
| 471 | - function _loadFromSessions() { | 167 | + |
| 168 | + public function loadFromSessions() { | ||
| 472 | $this->stepClassNames = $this->session->get('stepClassNames'); | 169 | $this->stepClassNames = $this->session->get('stepClassNames'); |
| 473 | if(!$this->stepClassNames) { | 170 | if(!$this->stepClassNames) { |
| 474 | - $this->_xmlStepsToArray(); // String steps | 171 | + $this->xmlStepsToArray(); // String steps |
| 475 | } | 172 | } |
| 476 | $this->stepNames = $this->session->get('stepNames'); | 173 | $this->stepNames = $this->session->get('stepNames'); |
| 477 | if(!$this->stepNames) { | 174 | if(!$this->stepNames) { |
| 478 | - $this->_xmlStepsNames(); | 175 | + $this->xmlStepsNames(); |
| 479 | } | 176 | } |
| 480 | - $this->installOrders = $this->session->get('installOrders'); | ||
| 481 | - if(!$this->installOrders) { | ||
| 482 | - $this->_xmlStepsOrders(); | 177 | + $this->orders = $this->session->get('installOrders'); |
| 178 | + if(!$this->orders) { | ||
| 179 | + $this->xmlStepsOrders(); | ||
| 483 | } | 180 | } |
| 484 | - $this->installProperties = $this->session->get('installProperties'); | ||
| 485 | - if(!$this->installProperties) { | ||
| 486 | - $this->_xmlInstallProperties(); | 181 | + $this->properties = $this->session->get('installProperties'); |
| 182 | + if(!$this->properties) { | ||
| 183 | + $this->xmlProperties(); | ||
| 487 | } | 184 | } |
| 488 | } | 185 | } |
| 489 | - | ||
| 490 | - private function loadNeeded() { | ||
| 491 | - $this->_readXml(); // Xml steps | 186 | + |
| 187 | + public function loadNeeded() { | ||
| 188 | + $this->readXml(); // Xml steps | ||
| 492 | // Make sure session is cleared | 189 | // Make sure session is cleared |
| 493 | - $this->_resetSessions(); | ||
| 494 | - $this->_loadFromSessions(); | 190 | + $this->resetSessions(); |
| 191 | + $this->loadFromSessions(); | ||
| 495 | if(isset($_POST['Next'])) { | 192 | if(isset($_POST['Next'])) { |
| 496 | - $this->installerAction = 'next'; | 193 | + $this->action = 'next'; |
| 497 | $this->response = 'next'; | 194 | $this->response = 'next'; |
| 498 | } elseif (isset($_POST['Previous'])) { | 195 | } elseif (isset($_POST['Previous'])) { |
| 499 | - $this->installerAction = 'previous'; | 196 | + $this->action = 'previous'; |
| 500 | $this->response = 'previous'; | 197 | $this->response = 'previous'; |
| 501 | } elseif (isset($_POST['Confirm'])) { | 198 | } elseif (isset($_POST['Confirm'])) { |
| 502 | - $this->installerAction = 'confirm'; | 199 | + $this->action = 'confirm'; |
| 503 | $this->response = 'next'; | 200 | $this->response = 'next'; |
| 504 | } elseif (isset($_POST['Install'])) { | 201 | } elseif (isset($_POST['Install'])) { |
| 505 | - $this->installerAction = 'install'; | 202 | + $this->action = 'install'; |
| 506 | $this->response = 'next'; | 203 | $this->response = 'next'; |
| 507 | } elseif (isset($_POST['Edit'])) { | 204 | } elseif (isset($_POST['Edit'])) { |
| 508 | - $this->installerAction = 'edit'; | 205 | + $this->action = 'edit'; |
| 509 | $this->response = 'next'; | 206 | $this->response = 'next'; |
| 510 | } else { | 207 | } else { |
| 511 | $this->response = ''; | 208 | $this->response = ''; |
| 512 | - $this->installerAction = ''; | 209 | + $this->action = ''; |
| 513 | } | 210 | } |
| 514 | } | 211 | } |
| 515 | - | 212 | + |
| 516 | /** | 213 | /** |
| 517 | * Main control to handle the flow of install | 214 | * Main control to handle the flow of install |
| 518 | * | 215 | * |
| @@ -525,155 +222,34 @@ class Installer { | @@ -525,155 +222,34 @@ class Installer { | ||
| 525 | $this->loadNeeded(); | 222 | $this->loadNeeded(); |
| 526 | switch($this->response) { | 223 | switch($this->response) { |
| 527 | case 'next': | 224 | case 'next': |
| 528 | - $step_name = $this->_getStepName(); | ||
| 529 | - $res = $this->_runStepAction($step_name); | 225 | + $step_name = $this->getStepName(); |
| 226 | + $res = $this->runStepAction($step_name); | ||
| 530 | if($res == 'next') | 227 | if($res == 'next') |
| 531 | - $this->_proceed(); // Load next window | 228 | + $this->proceed(); // Load next window |
| 532 | elseif ($res == 'install') { | 229 | elseif ($res == 'install') { |
| 533 | // Load the current steps vars into session | 230 | // Load the current steps vars into session |
| 534 | $vars = $this->stepAction->getStepVars(); | 231 | $vars = $this->stepAction->getStepVars(); |
| 535 | $this->stepAction->loadToSes($vars); | 232 | $this->stepAction->loadToSes($vars); |
| 536 | - $this->_runStepsInstallers(); // Load landing | ||
| 537 | - $this->_proceed(); // Load next window | 233 | + $this->runStepsInstallers(); // Load landing |
| 234 | + $this->proceed(); // Load next window | ||
| 538 | } elseif ($res == 'confirm') { | 235 | } elseif ($res == 'confirm') { |
| 539 | if(!$this->stepDisplayFirst()) | 236 | if(!$this->stepDisplayFirst()) |
| 540 | $this->stepConfirmation = true; | 237 | $this->stepConfirmation = true; |
| 541 | - $this->_landing(); | 238 | + $this->landing(); |
| 542 | } elseif ($res == 'landing') { | 239 | } elseif ($res == 'landing') { |
| 543 | - $this->_landing(); | 240 | + $this->landing(); |
| 544 | } else { | 241 | } else { |
| 545 | } | 242 | } |
| 546 | break; | 243 | break; |
| 547 | case 'previous': | 244 | case 'previous': |
| 548 | - $this->_backward(); // Load previous page | 245 | + $this->backward(); // Load previous page |
| 549 | break; | 246 | break; |
| 550 | default: | 247 | default: |
| 551 | - // TODO : handle silent | ||
| 552 | - $this->_landing(); | 248 | + $this->landing(); |
| 553 | break; | 249 | break; |
| 554 | } | 250 | } |
| 555 | $this->stepAction->paintAction(); // Display step | 251 | $this->stepAction->paintAction(); // Display step |
| 556 | } | 252 | } |
| 557 | - | ||
| 558 | - /** | ||
| 559 | - * Returns the step number | ||
| 560 | - * | ||
| 561 | - * @author KnowledgeTree Team | ||
| 562 | - * @param none | ||
| 563 | - * @access public | ||
| 564 | - * @return integer $pos | ||
| 565 | - */ | ||
| 566 | - public function getStepPosition() { | ||
| 567 | - $pos = 0; | ||
| 568 | - foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 569 | - $step = (string) $d_step; | ||
| 570 | - if ($step == $_GET['step_name']) { | ||
| 571 | - break; | ||
| 572 | - } | ||
| 573 | - $pos++; | ||
| 574 | - } | ||
| 575 | - if(isset($_GET['step'])) { | ||
| 576 | - if($_GET['step'] == "next") | ||
| 577 | - $pos = $pos+1; | ||
| 578 | - else | ||
| 579 | - $pos = $pos-1; | ||
| 580 | - } | ||
| 581 | - | ||
| 582 | - return $pos; | ||
| 583 | - } | ||
| 584 | - | ||
| 585 | - /** | ||
| 586 | - * Returns the step names for classes | ||
| 587 | - * | ||
| 588 | - * @author KnowledgeTree Team | ||
| 589 | - * @param none | ||
| 590 | - * @access public | ||
| 591 | - * @return array | ||
| 592 | - */ | ||
| 593 | - public function getSteps() { | ||
| 594 | - return $this->stepClassNames; | ||
| 595 | - } | ||
| 596 | - | ||
| 597 | - /** | ||
| 598 | - * Returns the steps as human readable string | ||
| 599 | - * | ||
| 600 | - * @author KnowledgeTree Team | ||
| 601 | - * @param none | ||
| 602 | - * @access public | ||
| 603 | - * @return array | ||
| 604 | - */ | ||
| 605 | - public function getStepNames() { | ||
| 606 | - return $this->stepNames; | ||
| 607 | - } | ||
| 608 | - | ||
| 609 | - /** | ||
| 610 | - * Returns whether or not a confirmation step is needed | ||
| 611 | - * | ||
| 612 | - * @author KnowledgeTree Team | ||
| 613 | - * @param none | ||
| 614 | - * @access public | ||
| 615 | - * @return boolean | ||
| 616 | - */ | ||
| 617 | - public function getStepConfirmation() { | ||
| 618 | - return $this->stepConfirmation; | ||
| 619 | - } | ||
| 620 | - | ||
| 621 | - /** | ||
| 622 | - * Return install properties | ||
| 623 | - * | ||
| 624 | - * @author KnowledgeTree Team | ||
| 625 | - * @param string | ||
| 626 | - * @access public | ||
| 627 | - * @return string | ||
| 628 | - */ | ||
| 629 | - public function getInstallProperties() { | ||
| 630 | - return $this->installProperties; | ||
| 631 | - } | ||
| 632 | - | ||
| 633 | - /** | ||
| 634 | - * Returns session | ||
| 635 | - * | ||
| 636 | - * @author KnowledgeTree Team | ||
| 637 | - * @param none | ||
| 638 | - * @access public | ||
| 639 | - * @return boolean | ||
| 640 | - */ | ||
| 641 | - public function getSession() { | ||
| 642 | - return $this->session; | ||
| 643 | - } | ||
| 644 | - | ||
| 645 | - /** | ||
| 646 | - * Dump of SESSION | ||
| 647 | - * | ||
| 648 | - * @author KnowledgeTree Team | ||
| 649 | - * @param none | ||
| 650 | - * @access public | ||
| 651 | - * @return array | ||
| 652 | - */ | ||
| 653 | - public function showSession() { | ||
| 654 | - echo '<pre>'; | ||
| 655 | - print_r($_SESSION['installers']); | ||
| 656 | - echo '</pre>'; | ||
| 657 | - } | ||
| 658 | - | ||
| 659 | - /** | ||
| 660 | - * Display errors that are not allowing the installer to operate | ||
| 661 | - * | ||
| 662 | - * @author KnowledgeTree Team | ||
| 663 | - * @param none | ||
| 664 | - * @access public | ||
| 665 | - * @return void | ||
| 666 | - */ | ||
| 667 | - public function resolveErrors($errors) { | ||
| 668 | - echo $errors; | ||
| 669 | - exit(); | ||
| 670 | - } | ||
| 671 | - | ||
| 672 | - private function _loadToSession($type, $values) { | ||
| 673 | - if($values) { | ||
| 674 | - $this->session->set($type , $values); | ||
| 675 | - } | ||
| 676 | - } | ||
| 677 | } | 253 | } |
| 678 | 254 | ||
| 679 | ?> | 255 | ?> |
setup/wizard/path.php
| @@ -109,7 +109,6 @@ | @@ -109,7 +109,6 @@ | ||
| 109 | define('IMG_DIR', RES_DIR."graphics".DS); | 109 | define('IMG_DIR', RES_DIR."graphics".DS); |
| 110 | define('STEP_DIR', WIZARD_DIR."steps".DS); | 110 | define('STEP_DIR', WIZARD_DIR."steps".DS); |
| 111 | define('TEMP_DIR', WIZARD_DIR."templates".DS); | 111 | define('TEMP_DIR', WIZARD_DIR."templates".DS); |
| 112 | - define('SYS_DIR', WIZARD_LIB."system".DS); | ||
| 113 | define('HELPER_DIR', WIZARD_LIB."helpers".DS); | 112 | define('HELPER_DIR', WIZARD_LIB."helpers".DS); |
| 114 | define('VALID_DIR', WIZARD_LIB."validation".DS); | 113 | define('VALID_DIR', WIZARD_LIB."validation".DS); |
| 115 | // Define paths to system webroot | 114 | // Define paths to system webroot |
setup/wizard/resources/css/firstlogin.css
0 → 100644
setup/wizard/resources/css/wizard.css
setup/wizard/session.php
| @@ -42,10 +42,10 @@ | @@ -42,10 +42,10 @@ | ||
| 42 | * @package Installer | 42 | * @package Installer |
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | -class Session | 45 | +class Session extends SessionBase |
| 46 | { | 46 | { |
| 47 | 47 | ||
| 48 | - private $salt = 'installers'; | 48 | + public $salt = 'installers'; |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * Constructs session object | 51 | * Constructs session object |
| @@ -55,189 +55,10 @@ class Session | @@ -55,189 +55,10 @@ class Session | ||
| 55 | * @param none | 55 | * @param none |
| 56 | */ | 56 | */ |
| 57 | public function __construct() { | 57 | public function __construct() { |
| 58 | + $this->setSalt($this->salt); | ||
| 58 | $this->startSession(); | 59 | $this->startSession(); |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | - public function setSalt($salt) { | ||
| 62 | - $this->salt = $salt; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * Starts a session if one does not exist | ||
| 67 | - * | ||
| 68 | - * @author KnowledgeTree Team | ||
| 69 | - * @param none | ||
| 70 | - * @access public | ||
| 71 | - * @return void | ||
| 72 | - */ | ||
| 73 | - public function startSession() { | ||
| 74 | - if(!isset($_SESSION[$this->salt]['ready'])) { | ||
| 75 | - @session_start(); | ||
| 76 | - $_SESSION[$this->salt] ['ready'] = TRUE; | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - /** | ||
| 81 | - * Sets a value key pair in session | ||
| 82 | - * | ||
| 83 | - * @author KnowledgeTree Team | ||
| 84 | - * @param string $fld | ||
| 85 | - * @param string $val | ||
| 86 | - * @access public | ||
| 87 | - * @return void | ||
| 88 | - */ | ||
| 89 | - public function set($fld, $val) { | ||
| 90 | - $this->startSession(); | ||
| 91 | - $_SESSION[$this->salt] [$fld] = $val; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - /** | ||
| 95 | - * Sets a value key pair in a class in session | ||
| 96 | - * | ||
| 97 | - * @author KnowledgeTree Team | ||
| 98 | - * @param string $class | ||
| 99 | - * @param string $fld | ||
| 100 | - * @param string $val | ||
| 101 | - * @access public | ||
| 102 | - * @return void | ||
| 103 | - */ | ||
| 104 | - public function setClass($class , $k, $v) { | ||
| 105 | - $this->startSession(); | ||
| 106 | - $classArray = $this->get($class); | ||
| 107 | - if(isset($classArray[$k])) { | ||
| 108 | - $classArray[$k] = $v; | ||
| 109 | - } else { | ||
| 110 | - $classArray[$k] = $v; | ||
| 111 | - } | ||
| 112 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - /** | ||
| 116 | - * Sets a error value key pair in a class in session | ||
| 117 | - * | ||
| 118 | - * @author KnowledgeTree Team | ||
| 119 | - * @param string $class | ||
| 120 | - * @param string $fld | ||
| 121 | - * @param string $val | ||
| 122 | - * @access public | ||
| 123 | - * @return void | ||
| 124 | - */ | ||
| 125 | - public function setClassError($class, $k, $v) { | ||
| 126 | - $this->startSession(); | ||
| 127 | - $classArray = $this->get($class); | ||
| 128 | - if(isset($classArray[$k])) { | ||
| 129 | - $classArray[$k] = $v; | ||
| 130 | - } else { | ||
| 131 | - $classArray[$k] = $v; | ||
| 132 | - } | ||
| 133 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - /** | ||
| 137 | - * Clear error values in a class session | ||
| 138 | - * | ||
| 139 | - * @author KnowledgeTree Team | ||
| 140 | - * @param string $class | ||
| 141 | - * @param string $fld | ||
| 142 | - * @param string $val | ||
| 143 | - * @access public | ||
| 144 | - * @return void | ||
| 145 | - */ | ||
| 146 | - public function clearErrors($class) { | ||
| 147 | - $classArray = $this->get($class); | ||
| 148 | - unset($classArray['errors']); | ||
| 149 | - $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - /** | ||
| 153 | - * Unset a value in session | ||
| 154 | - * | ||
| 155 | - * @author KnowledgeTree Team | ||
| 156 | - * @param string $fld | ||
| 157 | - * @access public | ||
| 158 | - * @return void | ||
| 159 | - */ | ||
| 160 | - public function un_set($fld) { | ||
| 161 | - $this->startSession(); | ||
| 162 | - unset($_SESSION[$this->salt] [$fld]); | ||
| 163 | - } | ||
| 164 | - | ||
| 165 | - /** | ||
| 166 | - * Unset a class value in session | ||
| 167 | - * | ||
| 168 | - * @author KnowledgeTree Team | ||
| 169 | - * @param string $class | ||
| 170 | - * @access public | ||
| 171 | - * @return void | ||
| 172 | - */ | ||
| 173 | - public function un_setClass($class) { | ||
| 174 | - $this->startSession(); | ||
| 175 | - if(isset($_SESSION[$this->salt] [$class])) | ||
| 176 | - unset($_SESSION[$this->salt] [$class]); | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - /** | ||
| 180 | - * Destroy the session | ||
| 181 | - * | ||
| 182 | - * @author KnowledgeTree Team | ||
| 183 | - * @param none | ||
| 184 | - * @access public | ||
| 185 | - * @return void | ||
| 186 | - */ | ||
| 187 | - public function destroy() { | ||
| 188 | - $this->startSession(); | ||
| 189 | - unset($_SESSION[$this->salt]); | ||
| 190 | - session_destroy(); | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * Get a session value | ||
| 195 | - * | ||
| 196 | - * @author KnowledgeTree Team | ||
| 197 | - * @param string $fld | ||
| 198 | - * @access public | ||
| 199 | - * @return string | ||
| 200 | - */ | ||
| 201 | - public function get($fld) { | ||
| 202 | - $this->startSession(); | ||
| 203 | - if(isset($_SESSION[$this->salt] [$fld])) | ||
| 204 | - return $_SESSION[$this->salt] [$fld]; | ||
| 205 | - return false; | ||
| 206 | - } | ||
| 207 | - | ||
| 208 | - /** | ||
| 209 | - * Check if a field exists in session | ||
| 210 | - * | ||
| 211 | - * @author KnowledgeTree Team | ||
| 212 | - * @param string $fld | ||
| 213 | - * @access public | ||
| 214 | - * @return string | ||
| 215 | - */ | ||
| 216 | - public function is_set($fld) { | ||
| 217 | - $this->startSession(); | ||
| 218 | - return isset($_SESSION[$this->salt] [$fld]); | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - /** | ||
| 222 | - * Return a class from session | ||
| 223 | - * | ||
| 224 | - * @author KnowledgeTree Team | ||
| 225 | - * @param string $fld | ||
| 226 | - * @access public | ||
| 227 | - * @return string | ||
| 228 | - */ | ||
| 229 | - public function getClass($class) { | ||
| 230 | - return $_SESSION[$this->salt][$class]; | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | -} | ||
| 234 | 62 | ||
| 235 | -if(isset($_GET['action'])) { | ||
| 236 | - $func = $_GET['action']; | ||
| 237 | - if($func != '') { | ||
| 238 | - $ses = new Session(); | ||
| 239 | - $method = "$func"; | ||
| 240 | - $ses->$method(); | ||
| 241 | - } | ||
| 242 | } | 63 | } |
| 243 | ?> | 64 | ?> |
| 244 | \ No newline at end of file | 65 | \ No newline at end of file |
setup/wizard/share/navBase.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Installer Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* | ||
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | ||
| 37 | +* @license GNU General Public License version 3 | ||
| 38 | +* @author KnowledgeTree Team | ||
| 39 | +* @package Installer | ||
| 40 | +* @version Version 0.1 | ||
| 41 | +*/ | ||
| 42 | + | ||
| 43 | +class NavBase { | ||
| 44 | + /** | ||
| 45 | + * Reference to simple xml object | ||
| 46 | + * | ||
| 47 | + * @author KnowledgeTree Team | ||
| 48 | + * @access protected | ||
| 49 | + * @var object SimpleXMLElement | ||
| 50 | + */ | ||
| 51 | + protected $simpleXmlObj = null; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Reference to step action object | ||
| 55 | + * | ||
| 56 | + * @author KnowledgeTree Team | ||
| 57 | + * @access protected | ||
| 58 | + * @var object StepAction | ||
| 59 | + */ | ||
| 60 | + protected $stepAction = null; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * Reference to session object | ||
| 64 | + * | ||
| 65 | + * @author KnowledgeTree Team | ||
| 66 | + * @access protected | ||
| 67 | + * @var object Session | ||
| 68 | + */ | ||
| 69 | + protected $session = null; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * List of installation steps as strings | ||
| 73 | + * | ||
| 74 | + * @author KnowledgeTree Team | ||
| 75 | + * @access protected | ||
| 76 | + * @var array string | ||
| 77 | + */ | ||
| 78 | + protected $stepClassNames = array(); | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * List of installation steps as human readable strings | ||
| 82 | + * | ||
| 83 | + * @author KnowledgeTree Team | ||
| 84 | + * @access protected | ||
| 85 | + * @var array string | ||
| 86 | + */ | ||
| 87 | + protected $stepNames = array(); | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * List of installation steps as human readable strings | ||
| 91 | + * | ||
| 92 | + * @author KnowledgeTree Team | ||
| 93 | + * @access protected | ||
| 94 | + * @var array string | ||
| 95 | + */ | ||
| 96 | + protected $stepObjects = array(); | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * Order in which steps have to be installed | ||
| 100 | + * | ||
| 101 | + * @author KnowledgeTree Team | ||
| 102 | + * @access protected | ||
| 103 | + * @var array string | ||
| 104 | + */ | ||
| 105 | + protected $orders = array(); | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * List of installation properties | ||
| 109 | + * | ||
| 110 | + * @author KnowledgeTree Team | ||
| 111 | + * @access protected | ||
| 112 | + * @var array string | ||
| 113 | + */ | ||
| 114 | + protected $properties = array(); | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * Flag if a step object needs confirmation | ||
| 118 | + * | ||
| 119 | + * @author KnowledgeTree Team | ||
| 120 | + * @access protected | ||
| 121 | + * @var boolean | ||
| 122 | + */ | ||
| 123 | + protected $stepConfirmation = false; | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * Flag if a step object needs confirmation | ||
| 127 | + * | ||
| 128 | + * @author KnowledgeTree Team | ||
| 129 | + * @access protected | ||
| 130 | + * @var boolean | ||
| 131 | + */ | ||
| 132 | + protected $stepDisplayFirst = false; | ||
| 133 | + | ||
| 134 | + protected $action = ''; | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Read xml configuration file | ||
| 138 | + * | ||
| 139 | + * @author KnowledgeTree Team | ||
| 140 | + * @param string $name of config file | ||
| 141 | + * @access public | ||
| 142 | + * @return object | ||
| 143 | + */ | ||
| 144 | + public function readXml() { | ||
| 145 | + | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * Checks if first step of installer | ||
| 150 | + * | ||
| 151 | + * @author KnowledgeTree Team | ||
| 152 | + * @param none | ||
| 153 | + * @access public | ||
| 154 | + * @return boolean | ||
| 155 | + */ | ||
| 156 | + public function firstStep() { | ||
| 157 | + if(isset($_GET['step_name'])) { | ||
| 158 | + return false; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + return true; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + /** | ||
| 165 | + * Checks if first step of installer | ||
| 166 | + * | ||
| 167 | + * @author KnowledgeTree Team | ||
| 168 | + * @param none | ||
| 169 | + * @access public | ||
| 170 | + * @return boolean | ||
| 171 | + */ | ||
| 172 | + public function firstStepPeriod() { | ||
| 173 | + if(isset($_GET['step_name'])) { | ||
| 174 | + if($_GET['step_name'] != 'welcome') | ||
| 175 | + return false; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + return true; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * Returns next step | ||
| 183 | + * | ||
| 184 | + * @author KnowledgeTree Team | ||
| 185 | + * @param none | ||
| 186 | + * @access public | ||
| 187 | + * @return string | ||
| 188 | + */ | ||
| 189 | + public function getNextStep() { | ||
| 190 | + return $this->getStepName(1); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * Returns previous step | ||
| 195 | + * | ||
| 196 | + * @author KnowledgeTree Team | ||
| 197 | + * @param none | ||
| 198 | + * @access public | ||
| 199 | + * @return string | ||
| 200 | + */ | ||
| 201 | + public function getPreviousStep() { | ||
| 202 | + return $this->getStepName(-1); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * Returns the step name, given a position | ||
| 207 | + * | ||
| 208 | + * @author KnowledgeTree Team | ||
| 209 | + * @param integer $pos current position | ||
| 210 | + * @access public | ||
| 211 | + * @return string $name | ||
| 212 | + */ | ||
| 213 | + public function getStepName($pos = 0) { | ||
| 214 | + if($this->firstStep()) { | ||
| 215 | + $step = (string) $this->simpleXmlObj->steps->step[0]; | ||
| 216 | + } else { | ||
| 217 | + $pos += $this->getStepPosition(); | ||
| 218 | + $step = (string) $this->simpleXmlObj->steps->step[$pos]; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + return $step; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + /** | ||
| 225 | + * Executes next step | ||
| 226 | + * | ||
| 227 | + * @author KnowledgeTree Team | ||
| 228 | + * @param none | ||
| 229 | + * @access public | ||
| 230 | + * @return string | ||
| 231 | + */ | ||
| 232 | + public function proceed() { | ||
| 233 | + $step_name = $this->getNextStep(); | ||
| 234 | + | ||
| 235 | + return $this->runStepAction($step_name); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + /** | ||
| 239 | + * Executes previous step | ||
| 240 | + * | ||
| 241 | + * @author KnowledgeTree Team | ||
| 242 | + * @param none | ||
| 243 | + * @access public | ||
| 244 | + * @return string | ||
| 245 | + */ | ||
| 246 | + public function backward() { | ||
| 247 | + $step_name = $this->getPreviousStep(); | ||
| 248 | + | ||
| 249 | + return $this->runStepAction($step_name); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * Executes step landing | ||
| 254 | + * | ||
| 255 | + * @author KnowledgeTree Team | ||
| 256 | + * @param none | ||
| 257 | + * @access public | ||
| 258 | + * @return string | ||
| 259 | + */ | ||
| 260 | + public function landing() { | ||
| 261 | + $step_name = $this->getStepName(); | ||
| 262 | + | ||
| 263 | + return $this->runStepAction($step_name); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + /** | ||
| 267 | + * Executes step based on step class name | ||
| 268 | + * | ||
| 269 | + * @author KnowledgeTree Team | ||
| 270 | + * @param string $step_name | ||
| 271 | + * @access public | ||
| 272 | + * @return string | ||
| 273 | + */ | ||
| 274 | + public function runStepAction($stepName) { | ||
| 275 | + $this->stepAction = new stepAction($stepName); | ||
| 276 | + $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getProperties()); | ||
| 277 | + | ||
| 278 | + return $this->stepAction->doAction(); | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + public function stepDisplayFirst() { | ||
| 282 | + if($this->action == 'edit') | ||
| 283 | + return false; // | ||
| 284 | + $class = $this->stepAction->createStep(); // Get step class | ||
| 285 | + return $class->displayFirst(); // Check if class needs to display first | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + /** | ||
| 289 | + * Set steps class names in string format | ||
| 290 | + * | ||
| 291 | + * @author KnowledgeTree Team | ||
| 292 | + * @param none | ||
| 293 | + * @access public | ||
| 294 | + * @return array | ||
| 295 | + */ | ||
| 296 | + public function getOrders() { | ||
| 297 | + return $this->orders; | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + /** | ||
| 301 | + * Set steps as names | ||
| 302 | + * | ||
| 303 | + * @author KnowledgeTree Team | ||
| 304 | + * @param none | ||
| 305 | + * @access public | ||
| 306 | + * @return void | ||
| 307 | + */ | ||
| 308 | + public function xmlStepsToArray() { | ||
| 309 | + if(isset($this->simpleXmlObj)) { | ||
| 310 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 311 | + $step_name = (string) $d_step[0]; | ||
| 312 | + $this->stepClassNames[] = $step_name; | ||
| 313 | + } | ||
| 314 | + $this->loadToSession('stepClassNames', $this->stepClassNames); | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + | ||
| 318 | + /** | ||
| 319 | + * Set steps as human readable strings | ||
| 320 | + * | ||
| 321 | + * @author KnowledgeTree Team | ||
| 322 | + * @param none | ||
| 323 | + * @access public | ||
| 324 | + * @return void | ||
| 325 | + */ | ||
| 326 | + public function xmlStepsNames() { | ||
| 327 | + if(isset($this->simpleXmlObj)) { | ||
| 328 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 329 | + $step_name = (string) $d_step[0]; | ||
| 330 | + $this->stepNames[$step_name] = (string) $d_step['name']; | ||
| 331 | + } | ||
| 332 | + $this->loadToSession('stepNames', $this->stepNames); | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + /** | ||
| 337 | + * Set steps install order | ||
| 338 | + * | ||
| 339 | + * @author KnowledgeTree Team | ||
| 340 | + * @param none | ||
| 341 | + * @access public | ||
| 342 | + * @return void | ||
| 343 | + */ | ||
| 344 | + public function xmlStepsOrders() { | ||
| 345 | + return false; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + /** | ||
| 349 | + * Set install properties | ||
| 350 | + * | ||
| 351 | + * @author KnowledgeTree Team | ||
| 352 | + * @param none | ||
| 353 | + * @access public | ||
| 354 | + * @return void | ||
| 355 | + */ | ||
| 356 | + public function xmlProperties() { | ||
| 357 | + return false; | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + /** | ||
| 361 | + * Reset all session information on welcome landing | ||
| 362 | + * | ||
| 363 | + * @author KnowledgeTree Team | ||
| 364 | + * @param none | ||
| 365 | + * @access public | ||
| 366 | + * @return void | ||
| 367 | + */ | ||
| 368 | + public function resetSessions() { | ||
| 369 | + if($this->session) { | ||
| 370 | + if($this->firstStepPeriod()) { | ||
| 371 | + foreach ($this->getSteps() as $class) { | ||
| 372 | + $this->session->un_setClass($class); | ||
| 373 | + } | ||
| 374 | + foreach ($this->getStepNames() as $class) { | ||
| 375 | + $this->session->un_setClass($class); | ||
| 376 | + } | ||
| 377 | + foreach ($this->getOrders() as $class) { | ||
| 378 | + $this->session->un_setClass($class); | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + public function loadFromSessions() { | ||
| 385 | + return false; | ||
| 386 | + } | ||
| 387 | + | ||
| 388 | + public function loadNeeded() { | ||
| 389 | + return false; | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + /** | ||
| 393 | + * Main control to handle the flow of install | ||
| 394 | + * | ||
| 395 | + * @author KnowledgeTree Team | ||
| 396 | + * @param none | ||
| 397 | + * @access public | ||
| 398 | + * @return void | ||
| 399 | + */ | ||
| 400 | + public function step() { | ||
| 401 | + return false; | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + /** | ||
| 405 | + * Returns the step number | ||
| 406 | + * | ||
| 407 | + * @author KnowledgeTree Team | ||
| 408 | + * @param none | ||
| 409 | + * @access public | ||
| 410 | + * @return integer $pos | ||
| 411 | + */ | ||
| 412 | + public function getStepPosition() { | ||
| 413 | + $pos = 0; | ||
| 414 | + foreach($this->simpleXmlObj->steps->step as $d_step) { | ||
| 415 | + $step = (string) $d_step; | ||
| 416 | + if ($step == $_GET['step_name']) { | ||
| 417 | + break; | ||
| 418 | + } | ||
| 419 | + $pos++; | ||
| 420 | + } | ||
| 421 | + if(isset($_GET['step'])) { | ||
| 422 | + if($_GET['step'] == "next") | ||
| 423 | + $pos = $pos+1; | ||
| 424 | + else | ||
| 425 | + $pos = $pos-1; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + return $pos; | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + /** | ||
| 432 | + * Returns the step names for classes | ||
| 433 | + * | ||
| 434 | + * @author KnowledgeTree Team | ||
| 435 | + * @param none | ||
| 436 | + * @access public | ||
| 437 | + * @return array | ||
| 438 | + */ | ||
| 439 | + public function getSteps() { | ||
| 440 | + return $this->stepClassNames; | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + /** | ||
| 444 | + * Returns the steps as human readable string | ||
| 445 | + * | ||
| 446 | + * @author KnowledgeTree Team | ||
| 447 | + * @param none | ||
| 448 | + * @access public | ||
| 449 | + * @return array | ||
| 450 | + */ | ||
| 451 | + public function getStepNames() { | ||
| 452 | + return $this->stepNames; | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + /** | ||
| 456 | + * Returns whether or not a confirmation step is needed | ||
| 457 | + * | ||
| 458 | + * @author KnowledgeTree Team | ||
| 459 | + * @param none | ||
| 460 | + * @access public | ||
| 461 | + * @return boolean | ||
| 462 | + */ | ||
| 463 | + public function getStepConfirmation() { | ||
| 464 | + return $this->stepConfirmation; | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + /** | ||
| 468 | + * Return install properties | ||
| 469 | + * | ||
| 470 | + * @author KnowledgeTree Team | ||
| 471 | + * @param string | ||
| 472 | + * @access public | ||
| 473 | + * @return string | ||
| 474 | + */ | ||
| 475 | + public function getProperties() { | ||
| 476 | + return $this->properties; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + /** | ||
| 480 | + * Returns session | ||
| 481 | + * | ||
| 482 | + * @author KnowledgeTree Team | ||
| 483 | + * @param none | ||
| 484 | + * @access public | ||
| 485 | + * @return boolean | ||
| 486 | + */ | ||
| 487 | + public function getSession() { | ||
| 488 | + return $this->session; | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + /** | ||
| 492 | + * Display errors that are not allowing the installer to operate | ||
| 493 | + * | ||
| 494 | + * @author KnowledgeTree Team | ||
| 495 | + * @param none | ||
| 496 | + * @access public | ||
| 497 | + * @return void | ||
| 498 | + */ | ||
| 499 | + public function resolveErrors($errors) { | ||
| 500 | + echo $errors; | ||
| 501 | + exit(); | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + public function loadToSession($type, $values) { | ||
| 505 | + if($values) { | ||
| 506 | + $this->session->set($type , $values); | ||
| 507 | + } | ||
| 508 | + } | ||
| 509 | +} | ||
| 510 | + | ||
| 511 | +?> |
setup/wizard/share/sessionBase.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Session Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright(C) 2008,2009 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* | ||
| 35 | +* @copyright 2008-2009, KnowledgeTree Inc. | ||
| 36 | +* @license GNU General Public License version 3 | ||
| 37 | +* @author KnowledgeTree Team | ||
| 38 | +* @package Installer | ||
| 39 | +* @version Version 0.1 | ||
| 40 | +*/ | ||
| 41 | +class SessionBase | ||
| 42 | +{ | ||
| 43 | + | ||
| 44 | + public $salt = ''; | ||
| 45 | + | ||
| 46 | + public function setSalt($salt) { | ||
| 47 | + $this->salt = $salt; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * Starts a session if one does not exist | ||
| 52 | + * | ||
| 53 | + * @author KnowledgeTree Team | ||
| 54 | + * @param none | ||
| 55 | + * @access public | ||
| 56 | + * @return void | ||
| 57 | + */ | ||
| 58 | + public function startSession() { | ||
| 59 | + if(!isset($_SESSION[$this->salt]['ready'])) { | ||
| 60 | + @session_start(); | ||
| 61 | + $_SESSION[$this->salt] ['ready'] = TRUE; | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * Sets a value key pair in session | ||
| 67 | + * | ||
| 68 | + * @author KnowledgeTree Team | ||
| 69 | + * @param string $fld | ||
| 70 | + * @param string $val | ||
| 71 | + * @access public | ||
| 72 | + * @return void | ||
| 73 | + */ | ||
| 74 | + public function set($fld, $val) { | ||
| 75 | + $this->startSession(); | ||
| 76 | + $_SESSION[$this->salt] [$fld] = $val; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * Sets a value key pair in a class in session | ||
| 81 | + * | ||
| 82 | + * @author KnowledgeTree Team | ||
| 83 | + * @param string $class | ||
| 84 | + * @param string $fld | ||
| 85 | + * @param string $val | ||
| 86 | + * @access public | ||
| 87 | + * @return void | ||
| 88 | + */ | ||
| 89 | + public function setClass($class , $k, $v) { | ||
| 90 | + $this->startSession(); | ||
| 91 | + $classArray = $this->get($class); | ||
| 92 | + if(isset($classArray[$k])) { | ||
| 93 | + $classArray[$k] = $v; | ||
| 94 | + } else { | ||
| 95 | + $classArray[$k] = $v; | ||
| 96 | + } | ||
| 97 | + $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * Sets a error value key pair in a class in session | ||
| 102 | + * | ||
| 103 | + * @author KnowledgeTree Team | ||
| 104 | + * @param string $class | ||
| 105 | + * @param string $fld | ||
| 106 | + * @param string $val | ||
| 107 | + * @access public | ||
| 108 | + * @return void | ||
| 109 | + */ | ||
| 110 | + public function setClassError($class, $k, $v) { | ||
| 111 | + $this->startSession(); | ||
| 112 | + $classArray = $this->get($class); | ||
| 113 | + if(isset($classArray[$k])) { | ||
| 114 | + $classArray[$k] = $v; | ||
| 115 | + } else { | ||
| 116 | + $classArray[$k] = $v; | ||
| 117 | + } | ||
| 118 | + $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * Clear error values in a class session | ||
| 123 | + * | ||
| 124 | + * @author KnowledgeTree Team | ||
| 125 | + * @param string $class | ||
| 126 | + * @param string $fld | ||
| 127 | + * @param string $val | ||
| 128 | + * @access public | ||
| 129 | + * @return void | ||
| 130 | + */ | ||
| 131 | + public function clearErrors($class) { | ||
| 132 | + $classArray = $this->get($class); | ||
| 133 | + unset($classArray['errors']); | ||
| 134 | + $_SESSION[$this->salt] [ $class] = $classArray; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * Unset a value in session | ||
| 139 | + * | ||
| 140 | + * @author KnowledgeTree Team | ||
| 141 | + * @param string $fld | ||
| 142 | + * @access public | ||
| 143 | + * @return void | ||
| 144 | + */ | ||
| 145 | + public function un_set($fld) { | ||
| 146 | + $this->startSession(); | ||
| 147 | + unset($_SESSION[$this->salt] [$fld]); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * Unset a class value in session | ||
| 152 | + * | ||
| 153 | + * @author KnowledgeTree Team | ||
| 154 | + * @param string $class | ||
| 155 | + * @access public | ||
| 156 | + * @return void | ||
| 157 | + */ | ||
| 158 | + public function un_setClass($class) { | ||
| 159 | + $this->startSession(); | ||
| 160 | + if(isset($_SESSION[$this->salt] [$class])) | ||
| 161 | + unset($_SESSION[$this->salt] [$class]); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + /** | ||
| 165 | + * Destroy the session | ||
| 166 | + * | ||
| 167 | + * @author KnowledgeTree Team | ||
| 168 | + * @param none | ||
| 169 | + * @access public | ||
| 170 | + * @return void | ||
| 171 | + */ | ||
| 172 | + public function destroy() { | ||
| 173 | + $this->startSession(); | ||
| 174 | + unset($_SESSION[$this->salt]); | ||
| 175 | + session_destroy(); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + /** | ||
| 179 | + * Get a session value | ||
| 180 | + * | ||
| 181 | + * @author KnowledgeTree Team | ||
| 182 | + * @param string $fld | ||
| 183 | + * @access public | ||
| 184 | + * @return string | ||
| 185 | + */ | ||
| 186 | + public function get($fld) { | ||
| 187 | + $this->startSession(); | ||
| 188 | + if(isset($_SESSION[$this->salt] [$fld])) | ||
| 189 | + return $_SESSION[$this->salt] [$fld]; | ||
| 190 | + return false; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * Check if a field exists in session | ||
| 195 | + * | ||
| 196 | + * @author KnowledgeTree Team | ||
| 197 | + * @param string $fld | ||
| 198 | + * @access public | ||
| 199 | + * @return string | ||
| 200 | + */ | ||
| 201 | + public function is_set($fld) { | ||
| 202 | + $this->startSession(); | ||
| 203 | + return isset($_SESSION[$this->salt] [$fld]); | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + /** | ||
| 207 | + * Return a class from session | ||
| 208 | + * | ||
| 209 | + * @author KnowledgeTree Team | ||
| 210 | + * @param string $fld | ||
| 211 | + * @access public | ||
| 212 | + * @return string | ||
| 213 | + */ | ||
| 214 | + public function getClass($class) { | ||
| 215 | + return $_SESSION[$this->salt][$class]; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | +} | ||
| 219 | +?> | ||
| 0 | \ No newline at end of file | 220 | \ No newline at end of file |
setup/wizard/share/stepActionBase.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Step Action Controller. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* | ||
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | ||
| 37 | +* @license GNU General Public License version 3 | ||
| 38 | +* @author KnowledgeTree Team | ||
| 39 | +* @package Installer | ||
| 40 | +* @version Version 0.1 | ||
| 41 | +*/ | ||
| 42 | + | ||
| 43 | +class StepActionBase { | ||
| 44 | + /** | ||
| 45 | + * Step class name | ||
| 46 | + * | ||
| 47 | + * @author KnowledgeTree Team | ||
| 48 | + * @access protected | ||
| 49 | + * @var string | ||
| 50 | + */ | ||
| 51 | + protected $stepName = ''; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Step names for classes | ||
| 55 | + * | ||
| 56 | + * @author KnowledgeTree Team | ||
| 57 | + * @access protected | ||
| 58 | + * @var array | ||
| 59 | + */ | ||
| 60 | + protected $stepClassNames = array(); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * Flag if step needs confirmation | ||
| 64 | + * | ||
| 65 | + * @author KnowledgeTree Team | ||
| 66 | + * @access protected | ||
| 67 | + * @var boolean | ||
| 68 | + */ | ||
| 69 | + protected $displayConfirm = false; | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Returns whether or not to display the confirmation page first | ||
| 73 | + * | ||
| 74 | + * @author KnowledgeTree Team | ||
| 75 | + * @access protected | ||
| 76 | + * @var boolean | ||
| 77 | + */ | ||
| 78 | + protected $displayFirst = false; | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * List of properties | ||
| 82 | + * | ||
| 83 | + * @author KnowledgeTree Team | ||
| 84 | + * @access protected | ||
| 85 | + * @var boolean | ||
| 86 | + */ | ||
| 87 | + protected $properties = array(); | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * Reference to session object | ||
| 91 | + * | ||
| 92 | + * @author KnowledgeTree Team | ||
| 93 | + * @access protected | ||
| 94 | + * @var object Session | ||
| 95 | + */ | ||
| 96 | + protected $session = null; | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * Reference to current step object | ||
| 100 | + * | ||
| 101 | + * @author KnowledgeTree Team | ||
| 102 | + * @access protected | ||
| 103 | + * @var object class Step | ||
| 104 | + */ | ||
| 105 | + protected $action = null; | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * Helper to initialize step actions | ||
| 109 | + * | ||
| 110 | + * @author KnowledgeTree Team | ||
| 111 | + * @param string | ||
| 112 | + * @access public | ||
| 113 | + * @return string | ||
| 114 | + */ | ||
| 115 | + public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $properties) { | ||
| 116 | + $this->setSteps($steps); | ||
| 117 | + $this->setStepNames($stepNames); | ||
| 118 | + $this->setDisplayConfirm($stepConfirmation); | ||
| 119 | + $this->setDisplayFirst($stepDisplayFirst); | ||
| 120 | + $this->loadSession($session); | ||
| 121 | + $this->setProperties($properties); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * Sets steps class names in string format | ||
| 126 | + * | ||
| 127 | + * @author KnowledgeTree Team | ||
| 128 | + * @param array | ||
| 129 | + * @access public | ||
| 130 | + * @return void | ||
| 131 | + */ | ||
| 132 | + public function setSteps($stepClassNames) { | ||
| 133 | + $this->stepClassNames = $stepClassNames; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + /** | ||
| 137 | + * Sets steps in human readable string format | ||
| 138 | + * | ||
| 139 | + * @author KnowledgeTree Team | ||
| 140 | + * @param array | ||
| 141 | + * @access public | ||
| 142 | + * @return void | ||
| 143 | + */ | ||
| 144 | + public function setStepNames($step_names) { | ||
| 145 | + $this->step_names = $step_names; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * Sets confirmation page flag | ||
| 150 | + * | ||
| 151 | + * @author KnowledgeTree Team | ||
| 152 | + * @param boolean | ||
| 153 | + * @access public | ||
| 154 | + * @return void | ||
| 155 | + */ | ||
| 156 | + public function setDisplayConfirm($displayConfirm) { | ||
| 157 | + $this->displayConfirm = $displayConfirm; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * Sets confirmation page first flag | ||
| 162 | + * | ||
| 163 | + * @author KnowledgeTree Team | ||
| 164 | + * @param boolean | ||
| 165 | + * @access public | ||
| 166 | + * @return void | ||
| 167 | + */ | ||
| 168 | + public function setDisplayFirst($displayFirst) { | ||
| 169 | + $this->displayFirst = $displayFirst; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + /** | ||
| 173 | + * Sets session object | ||
| 174 | + * | ||
| 175 | + * @author KnowledgeTree Team | ||
| 176 | + * @param object Session | ||
| 177 | + * @access public | ||
| 178 | + * @return void | ||
| 179 | + */ | ||
| 180 | + public function loadSession($ses) { | ||
| 181 | + $this->session = $ses; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + /** | ||
| 185 | + * Sets properties | ||
| 186 | + * | ||
| 187 | + * @author KnowledgeTree Team | ||
| 188 | + * @param array | ||
| 189 | + * @access public | ||
| 190 | + * @return void | ||
| 191 | + */ | ||
| 192 | + public function setProperties($properties) { | ||
| 193 | + $this->properties = $properties; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 197 | + * Main control to handle the steps actions | ||
| 198 | + * | ||
| 199 | + * @author KnowledgeTree Team | ||
| 200 | + * @param none | ||
| 201 | + * @access public | ||
| 202 | + * @return string | ||
| 203 | + */ | ||
| 204 | + public function doAction() { | ||
| 205 | + if($this->stepName != '') { | ||
| 206 | + $this->action = $this->createStep(); | ||
| 207 | + if(!$this->action) { | ||
| 208 | + $this->stepName = 'errors'; | ||
| 209 | + $this->action = $this->createStep(); | ||
| 210 | + $this->action->error = array('Class Files Missing in Step Directory'); | ||
| 211 | + } | ||
| 212 | + $response = $this->action->doStep(); | ||
| 213 | + if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 214 | + $this->_loadStepToSession($this->stepName); // Send class to session | ||
| 215 | + } | ||
| 216 | + if ($response == 'error') { | ||
| 217 | + $this->_handleErrors(); // Send Errors to session | ||
| 218 | + } else { | ||
| 219 | + $this->_clearErrors($this->stepName); // Send Errors to session | ||
| 220 | + } | ||
| 221 | + } else { | ||
| 222 | + $this->stepName = 'errors'; | ||
| 223 | + $this->action = $this->createStep(); | ||
| 224 | + $this->action->error = array('Class File Missing in Step Directory'); | ||
| 225 | + } | ||
| 226 | + return $response; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + /** | ||
| 230 | + * Instantiate a step. | ||
| 231 | + * | ||
| 232 | + * @author KnowledgeTree Team | ||
| 233 | + * @param none | ||
| 234 | + * @access public | ||
| 235 | + * @return object Step | ||
| 236 | + */ | ||
| 237 | + public function createStep() { | ||
| 238 | + $step_class = $this->makeCamelCase($this->stepName); | ||
| 239 | + return new $step_class(); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + /** | ||
| 243 | + * Converts string to camel case | ||
| 244 | + * | ||
| 245 | + * @author KnowledgeTree Team | ||
| 246 | + * @param string | ||
| 247 | + * @access public | ||
| 248 | + * @return string | ||
| 249 | + */ | ||
| 250 | + public function makeCamelCase($str) { | ||
| 251 | + $upper=ucwords($str); | ||
| 252 | + $str=str_replace('_', '', $upper); | ||
| 253 | + | ||
| 254 | + return $str; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + /** | ||
| 258 | + * Converts string to human readable heading | ||
| 259 | + * | ||
| 260 | + * @author KnowledgeTree Team | ||
| 261 | + * @param string | ||
| 262 | + * @access public | ||
| 263 | + * @return string | ||
| 264 | + */ | ||
| 265 | + public function makeHeading($str) { | ||
| 266 | + $str = str_replace('_', ' ', $str); | ||
| 267 | + $str = ucwords($str); | ||
| 268 | + | ||
| 269 | + return $str; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + /** | ||
| 273 | + * Returns current step name | ||
| 274 | + * | ||
| 275 | + * @author KnowledgeTree Team | ||
| 276 | + * @param none | ||
| 277 | + * @access public | ||
| 278 | + * @return string | ||
| 279 | + */ | ||
| 280 | + public function getCurrentStepName() { | ||
| 281 | + if($this->stepName != 'errors') | ||
| 282 | + return $this->step_names[$this->stepName]; | ||
| 283 | + return ''; | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + /** | ||
| 287 | + * Returns left menu | ||
| 288 | + * | ||
| 289 | + * @author KnowledgeTree Team | ||
| 290 | + * @param none | ||
| 291 | + * @access public | ||
| 292 | + * @return string | ||
| 293 | + */ | ||
| 294 | + public function getLeftMenu() | ||
| 295 | + { | ||
| 296 | + $sideMenuElements = array(); | ||
| 297 | + $active = false; | ||
| 298 | + if($this->stepClassNames) { | ||
| 299 | + $ele = array(); | ||
| 300 | + foreach ($this->stepClassNames as $k=>$step) { | ||
| 301 | + $ele['step'] = $step; | ||
| 302 | + if($this->step_names[$step] != '') { | ||
| 303 | + $ele['name'] = $this->step_names[$step]; | ||
| 304 | + } else { | ||
| 305 | + $ele['name'] = $this->makeHeading($step); | ||
| 306 | + } | ||
| 307 | + if($step == $this->stepName) { | ||
| 308 | + $ele['class'] = 'current'; | ||
| 309 | + $active = true; | ||
| 310 | + } else { | ||
| 311 | + if($active) { | ||
| 312 | + $ele['class'] = 'inactive'; | ||
| 313 | + } else { | ||
| 314 | + $ele['class'] = 'indicator'; | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + $sideMenuElements[] = $ele; | ||
| 318 | + } | ||
| 319 | + } | ||
| 320 | + $step_tpl = new Template("../wizard/templates/sidemenu.tpl"); // Create template | ||
| 321 | + $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements | ||
| 322 | + $step_tpl->set("ajax", AJAX); // Set ajax state | ||
| 323 | + | ||
| 324 | + return $step_tpl->fetch(); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + /** | ||
| 328 | + * Returns confirmation page flag | ||
| 329 | + * | ||
| 330 | + * @author KnowledgeTree Team | ||
| 331 | + * @param none | ||
| 332 | + * @access public | ||
| 333 | + * @return boolean | ||
| 334 | + */ | ||
| 335 | + public function displayConfirm() { | ||
| 336 | + return $this->displayConfirm; | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + /** | ||
| 340 | + * Returns whether or not to display the confirmation page first | ||
| 341 | + * | ||
| 342 | + * @author KnowledgeTree Team | ||
| 343 | + * @param none | ||
| 344 | + * @access public | ||
| 345 | + * @return boolean | ||
| 346 | + */ | ||
| 347 | + public function displayFirst() { | ||
| 348 | + return $this->displayFirst; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + /** | ||
| 352 | + * Returns session object | ||
| 353 | + * | ||
| 354 | + * @author KnowledgeTree Team | ||
| 355 | + * @param object Session | ||
| 356 | + * @access public | ||
| 357 | + * @return object | ||
| 358 | + */ | ||
| 359 | + public function getSession() { | ||
| 360 | + return $this->session; | ||
| 361 | + } | ||
| 362 | + | ||
| 363 | + /** | ||
| 364 | + * Returns step tenplate content | ||
| 365 | + * | ||
| 366 | + * @author KnowledgeTree Team | ||
| 367 | + * @param none | ||
| 368 | + * @access public | ||
| 369 | + * @return string | ||
| 370 | + */ | ||
| 371 | + public function paintAction() { | ||
| 372 | + $step_errors = $this->action->getErrors(); // Get errors | ||
| 373 | + $step_warnings = $this->action->getWarnings(); // Get warnings | ||
| 374 | + if($this->displayConfirm()) { // Check if theres a confirm step | ||
| 375 | + $template = "templates" . DS . "{$this->stepName}_confirm.tpl"; | ||
| 376 | + } else { | ||
| 377 | + if($this->displayFirst()) { | ||
| 378 | + $template = "templates" . DS . "{$this->stepName}_confirm.tpl"; | ||
| 379 | + } else { | ||
| 380 | + $template = "templates" . DS . "{$this->stepName}.tpl"; | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + $step_tpl = new Template($template); | ||
| 384 | + $step_tpl->set("errors", $step_errors); // Set template errors | ||
| 385 | + $step_tpl->set("warnings", $step_warnings); // Set template warnings | ||
| 386 | + $step_vars = $this->action->getStepVars(); // Get template variables | ||
| 387 | + $step_tpl->set("step_vars", $step_vars); // Set template errors | ||
| 388 | + $this->loadToSes($step_vars); | ||
| 389 | + $this->loadToTpl($step_tpl, $step_vars); | ||
| 390 | + if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { | ||
| 391 | + echo $step_tpl->fetch(); | ||
| 392 | + } else { | ||
| 393 | + $content = $step_tpl->fetch(); | ||
| 394 | + $tpl = new Template("templates/wizard.tpl"); | ||
| 395 | + $vars = $this->getVars(); // Get template variables | ||
| 396 | + $tpl->set("vars", $vars); // Set template errors | ||
| 397 | + $tpl->set('content', $content); | ||
| 398 | + echo $tpl->fetch(); | ||
| 399 | + } | ||
| 400 | + } | ||
| 401 | + | ||
| 402 | + public function loadToSes($step_vars) { | ||
| 403 | + if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 404 | + foreach ($step_vars as $key => $value) { // Set template variables | ||
| 405 | + $this->_loadValueToSession($this->stepName, $key, $value); | ||
| 406 | + } | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + public function loadToTpl($step_tpl, $step_vars) { | ||
| 411 | + foreach ($step_vars as $key => $value) { // Set template variables | ||
| 412 | + $step_tpl->set($key, $value); // Load values to session | ||
| 413 | + } | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + public function getStepVars() { | ||
| 417 | + return $this->action->getStepVars(); | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + public function getVars() { | ||
| 421 | + return array(); | ||
| 422 | + } | ||
| 423 | + | ||
| 424 | + /** | ||
| 425 | + * Load class to session | ||
| 426 | + * | ||
| 427 | + * @author KnowledgeTree Team | ||
| 428 | + * @param string $class name of class | ||
| 429 | + * @param array $v array of values | ||
| 430 | + * @param boolean $overwrite whether or not to overwrite existing | ||
| 431 | + * @access public | ||
| 432 | + * @return void | ||
| 433 | + */ | ||
| 434 | + public function _loadStepToSession($class, $v = array(), $overwrite = false) { | ||
| 435 | + if($this->session != null) { | ||
| 436 | + if($overwrite) { | ||
| 437 | + $this->session->set($class , $v); | ||
| 438 | + } else { | ||
| 439 | + if(!$this->session->is_set($class)) | ||
| 440 | + $this->session->set($class , $v); | ||
| 441 | + } | ||
| 442 | + } else { | ||
| 443 | + $this->stepName = 'errors'; | ||
| 444 | + $this->action = $this->createStep(); | ||
| 445 | + $this->action->error = array('Sessions Are Disabled'); | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + /** | ||
| 450 | + * Load class value to session | ||
| 451 | + * | ||
| 452 | + * @author KnowledgeTree Team | ||
| 453 | + * @param string $class name of class | ||
| 454 | + * @param string $k key value | ||
| 455 | + * @param string $v value to store | ||
| 456 | + * @param boolean $overwrite whether or not to overwrite existing | ||
| 457 | + * @access public | ||
| 458 | + * @return void | ||
| 459 | + */ | ||
| 460 | + public function _loadValueToSession($class, $k, $v, $overwrite = false) { | ||
| 461 | + if($this->session != null) { | ||
| 462 | + $this->session->setClass($class, $k, $v); | ||
| 463 | + } else { | ||
| 464 | + $this->stepName = 'errors'; | ||
| 465 | + $this->action = $this->createStep(); | ||
| 466 | + $this->action->error = array('Sessions Are Disabled'); | ||
| 467 | + } | ||
| 468 | + } | ||
| 469 | + | ||
| 470 | + /** | ||
| 471 | + * Load all class errors value to session | ||
| 472 | + * | ||
| 473 | + * @author KnowledgeTree Team | ||
| 474 | + * @param none | ||
| 475 | + * @access public | ||
| 476 | + * @return void | ||
| 477 | + */ | ||
| 478 | + public function _handleErrors() { | ||
| 479 | + $step_errors = $this->action->getErrors(); // Get errors | ||
| 480 | + foreach ($step_errors as $key => $value) { | ||
| 481 | + $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session | ||
| 482 | + } | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + /** | ||
| 486 | + * Remove all class errors value to session | ||
| 487 | + * | ||
| 488 | + * @author KnowledgeTree Team | ||
| 489 | + * @param none | ||
| 490 | + * @access public | ||
| 491 | + * @return void | ||
| 492 | + */ | ||
| 493 | + public function _clearErrors($class) { | ||
| 494 | + if($this->session) { | ||
| 495 | + $this->session->clearErrors($class); | ||
| 496 | + } | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + /** | ||
| 500 | + * Load class error value to session | ||
| 501 | + * | ||
| 502 | + * @author KnowledgeTree Team | ||
| 503 | + * @param string $class name of class | ||
| 504 | + * @param string $k key value | ||
| 505 | + * @param string $v value to store | ||
| 506 | + * @param boolean $overwrite whether or not to overwrite existing | ||
| 507 | + * @access public | ||
| 508 | + * @return void | ||
| 509 | + */ | ||
| 510 | + public function _loadErrorToSession($class, $k, $v, $overwrite = false) { | ||
| 511 | + $k = "errors"; | ||
| 512 | + if($this->session != null) { | ||
| 513 | + $this->session->setClassError($class, $k, $v); | ||
| 514 | + } else { | ||
| 515 | + $this->stepName = 'errors'; | ||
| 516 | + $this->action = $this->createStep(); | ||
| 517 | + $this->action->error = array('Sessions Are Disabled'); | ||
| 518 | + } | ||
| 519 | + } | ||
| 520 | +} | ||
| 521 | + | ||
| 522 | +?> | ||
| 0 | \ No newline at end of file | 523 | \ No newline at end of file |
setup/wizard/share/stepBase.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Step Base Class. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright(C) 2008,2009 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 10 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 11 | +* Free Software Foundation. | ||
| 12 | +* | ||
| 13 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 14 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 15 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 16 | +* details. | ||
| 17 | +* | ||
| 18 | +* You should have received a copy of the GNU General Public License | ||
| 19 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | +* | ||
| 21 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 22 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 23 | +* | ||
| 24 | +* The interactive user interfaces in modified source and object code versions | ||
| 25 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 26 | +* Section 5 of the GNU General Public License version 3. | ||
| 27 | +* | ||
| 28 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 29 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 30 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 31 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 32 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 33 | +* copyright notice. | ||
| 34 | +* | ||
| 35 | +* @copyright 2008-2009, KnowledgeTree Inc. | ||
| 36 | +* @license GNU General Public License version 3 | ||
| 37 | +* @author KnowledgeTree Team | ||
| 38 | +* @package Installer | ||
| 39 | +* @version Version 0.1 | ||
| 40 | +*/ | ||
| 41 | + | ||
| 42 | +class StepBase { | ||
| 43 | + /** | ||
| 44 | + * Session salt | ||
| 45 | + * | ||
| 46 | + * @author KnowledgeTree Team | ||
| 47 | + * @access public | ||
| 48 | + * @var string | ||
| 49 | + */ | ||
| 50 | + protected $salt = ''; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * List of variables to be loaded to template | ||
| 54 | + * | ||
| 55 | + * @author KnowledgeTree Team | ||
| 56 | + * @access protected | ||
| 57 | + * @var array | ||
| 58 | + */ | ||
| 59 | + protected $temp_variables = array(); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * List of errors encountered by step | ||
| 63 | + * | ||
| 64 | + * @author KnowledgeTree Team | ||
| 65 | + * @access protected | ||
| 66 | + * @var array | ||
| 67 | + */ | ||
| 68 | + protected $error = array(); | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * List of warnings encountered by step | ||
| 72 | + * | ||
| 73 | + * @author KnowledgeTree Team | ||
| 74 | + * @access protected | ||
| 75 | + * @var array | ||
| 76 | + */ | ||
| 77 | + protected $warnings = array(); | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * Flag to store class information in session | ||
| 81 | + * | ||
| 82 | + * @author KnowledgeTree Team | ||
| 83 | + * @access public | ||
| 84 | + * @var boolean | ||
| 85 | + */ | ||
| 86 | + protected $storeInSession = false; | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * Step order | ||
| 90 | + * | ||
| 91 | + * @author KnowledgeTree Team | ||
| 92 | + * @access public | ||
| 93 | + * @var boolean | ||
| 94 | + */ | ||
| 95 | + protected $order = false; | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * Flag if step needs to run silently | ||
| 99 | + * | ||
| 100 | + * @author KnowledgeTree Team | ||
| 101 | + * @access public | ||
| 102 | + * @var boolean | ||
| 103 | + */ | ||
| 104 | + protected $silent = false; | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * Flag if step needs to show confirm page first | ||
| 108 | + * | ||
| 109 | + * @author KnowledgeTree Team | ||
| 110 | + * @access public | ||
| 111 | + * @var boolean | ||
| 112 | + */ | ||
| 113 | + public $displayFirst = false; | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * Reference to utility object | ||
| 117 | + * | ||
| 118 | + * @author KnowledgeTree Team | ||
| 119 | + * @access protected | ||
| 120 | + * @var object | ||
| 121 | + */ | ||
| 122 | + public $util; | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * Returns step state | ||
| 126 | + * | ||
| 127 | + * @author KnowledgeTree Team | ||
| 128 | + * @param none | ||
| 129 | + * @access public | ||
| 130 | + * @return string | ||
| 131 | + */ | ||
| 132 | + public function doStep() { | ||
| 133 | + return ''; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public function displayFirst() { | ||
| 137 | + return $this->displayFirst; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * Returns step variables | ||
| 142 | + * | ||
| 143 | + * @author KnowledgeTree Team | ||
| 144 | + * @param none | ||
| 145 | + * @access public | ||
| 146 | + * @return array | ||
| 147 | + */ | ||
| 148 | + public function getStepVars() { | ||
| 149 | + return $this->temp_variables; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + /** | ||
| 153 | + * Returns step errors | ||
| 154 | + * | ||
| 155 | + * @author KnowledgeTree Team | ||
| 156 | + * @param none | ||
| 157 | + * @access public | ||
| 158 | + * @return array | ||
| 159 | + */ | ||
| 160 | + public function getErrors() { | ||
| 161 | + return $this->error; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + /** | ||
| 165 | + * Returns step errors | ||
| 166 | + * | ||
| 167 | + * @author KnowledgeTree Team | ||
| 168 | + * @param none | ||
| 169 | + * @access public | ||
| 170 | + * @return array | ||
| 171 | + */ | ||
| 172 | + public function getWarnings() { | ||
| 173 | + return $this->warnings; | ||
| 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 | + } | ||
| 199 | + | ||
| 200 | + /** | ||
| 201 | + * Checks if edit button has been clicked | ||
| 202 | + * | ||
| 203 | + * @author KnowledgeTree Team | ||
| 204 | + * @param none | ||
| 205 | + * @access public | ||
| 206 | + * @return boolean | ||
| 207 | + */ | ||
| 208 | + public function edit() { | ||
| 209 | + if(isset($_POST['Edit'])) { | ||
| 210 | + return true; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + return false; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + /** | ||
| 217 | + * Checks if next button has been clicked | ||
| 218 | + * | ||
| 219 | + * @author KnowledgeTree Team | ||
| 220 | + * @param none | ||
| 221 | + * @access public | ||
| 222 | + * @return boolean | ||
| 223 | + */ | ||
| 224 | + public function next() { | ||
| 225 | + if(isset($_POST['Next'])) { | ||
| 226 | + return true; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + return false; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + /** | ||
| 233 | + * Checks if previous button has been clicked | ||
| 234 | + * | ||
| 235 | + * @author KnowledgeTree Team | ||
| 236 | + * @param none | ||
| 237 | + * @access public | ||
| 238 | + * @return boolean | ||
| 239 | + */ | ||
| 240 | + public function previous() { | ||
| 241 | + if(isset($_POST['Previous'])) { | ||
| 242 | + return true; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + return false; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + /** | ||
| 249 | + * Checks if Confirm button has been clicked | ||
| 250 | + * | ||
| 251 | + * @author KnowledgeTree Team | ||
| 252 | + * @param none | ||
| 253 | + * @access public | ||
| 254 | + * @return boolean | ||
| 255 | + */ | ||
| 256 | + function confirm() { | ||
| 257 | + if(isset($_POST['Confirm'])) { | ||
| 258 | + return true; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + return false; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * Checks if Install button has been clicked | ||
| 266 | + * | ||
| 267 | + * @author KnowledgeTree Team | ||
| 268 | + * @param none | ||
| 269 | + * @access public | ||
| 270 | + * @return boolean | ||
| 271 | + */ | ||
| 272 | + function install() { | ||
| 273 | + if(isset($_POST['Install'])) { | ||
| 274 | + return true; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + return false; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + /** | ||
| 281 | + * Checks if Clean install button has been clicked | ||
| 282 | + * | ||
| 283 | + * @author KnowledgeTree Team | ||
| 284 | + * @param none | ||
| 285 | + * @access public | ||
| 286 | + * @return boolean | ||
| 287 | + */ | ||
| 288 | + function migrate() { | ||
| 289 | + if(isset($_POST['installtype'])) { | ||
| 290 | + if($_POST['installtype'] == "Upgrade Installation") { | ||
| 291 | + return true; | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + return false; | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + /** | ||
| 299 | + * Checks if we are currently in this class step | ||
| 300 | + * | ||
| 301 | + * @author KnowledgeTree Team | ||
| 302 | + * @param string | ||
| 303 | + * @access public | ||
| 304 | + * @return boolean | ||
| 305 | + */ | ||
| 306 | + public function inStep($name) { | ||
| 307 | + if(!isset($_GET['step_name'])) return false; | ||
| 308 | + if($_GET['step_name'] == $name) | ||
| 309 | + return true; | ||
| 310 | + return false; | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + /** | ||
| 314 | + * Get session data from package | ||
| 315 | + * | ||
| 316 | + * @author KnowledgeTree Team | ||
| 317 | + * @params none | ||
| 318 | + * @access private | ||
| 319 | + * @return boolean | ||
| 320 | + */ | ||
| 321 | + public function getDataFromPackage($package, $class) { | ||
| 322 | + if(empty($_SESSION[$package][$class])) { | ||
| 323 | + return false; | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + return $_SESSION[$package][$class]; | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + /** | ||
| 330 | + * Safer way to return post data | ||
| 331 | + * | ||
| 332 | + * @author KnowledgeTree Team | ||
| 333 | + * @params SimpleXmlObject $simplexml | ||
| 334 | + * @access public | ||
| 335 | + * @return void | ||
| 336 | + */ | ||
| 337 | + public function getPostSafe($key) { | ||
| 338 | + return isset($_POST[$key]) ? $_POST[$key] : ""; | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + /** | ||
| 342 | + * Safer way to return post data | ||
| 343 | + * | ||
| 344 | + * @author KnowledgeTree Team | ||
| 345 | + * @params SimpleXmlObject $simplexml | ||
| 346 | + * @access public | ||
| 347 | + * @return void | ||
| 348 | + */ | ||
| 349 | + public function getPostBoolean($key) { | ||
| 350 | + return isset($_POST[$key]) ? $_POST[$key] : false; | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + /** | ||
| 354 | + * Runs step install if required | ||
| 355 | + * | ||
| 356 | + * @author KnowledgeTree Team | ||
| 357 | + * @param none | ||
| 358 | + * @access public | ||
| 359 | + * @return void | ||
| 360 | + */ | ||
| 361 | + public function installStep() { | ||
| 362 | + return ''; | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + /** | ||
| 366 | + * Return whether or not to store a step information in session | ||
| 367 | + * | ||
| 368 | + * @author KnowledgeTree Team | ||
| 369 | + * @param none | ||
| 370 | + * @access public | ||
| 371 | + * @return boolean | ||
| 372 | + */ | ||
| 373 | + public function storeInSession() { | ||
| 374 | + return $this->storeInSession; | ||
| 375 | + } | ||
| 376 | + | ||
| 377 | + public function setPostConfig() { | ||
| 378 | + return ''; | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + /** | ||
| 382 | + * Return whether or not to a step has to be in silent mode | ||
| 383 | + * | ||
| 384 | + * @author KnowledgeTree Team | ||
| 385 | + * @param none | ||
| 386 | + * @access public | ||
| 387 | + * @return boolean | ||
| 388 | + */ | ||
| 389 | + public function silentMode() { | ||
| 390 | + return $this->silent; | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + /** | ||
| 394 | + * Set step errors | ||
| 395 | + * | ||
| 396 | + * @author KnowledgeTree Team | ||
| 397 | + * @param none | ||
| 398 | + * @access public | ||
| 399 | + * @return array | ||
| 400 | + */ | ||
| 401 | + public function setErrors($error) { | ||
| 402 | + $this->error = $error; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * Is the installation | ||
| 407 | + * | ||
| 408 | + * @author KnowledgeTree Team | ||
| 409 | + * @param none | ||
| 410 | + * @access public | ||
| 411 | + * @return string | ||
| 412 | + */ | ||
| 413 | + public function isCe() { | ||
| 414 | + if($this->util->getVersionType() == "community") | ||
| 415 | + return true; | ||
| 416 | + return false; | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + public function storeSilent() { | ||
| 420 | + return true; | ||
| 421 | + } | ||
| 422 | +} | ||
| 423 | + | ||
| 424 | +?> | ||
| 0 | \ No newline at end of file | 425 | \ No newline at end of file |
setup/wizard/share/wizardBase.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | +* Installer Index. | ||
| 4 | +* | ||
| 5 | +* KnowledgeTree Community Edition | ||
| 6 | +* Document Management Made Simple | ||
| 7 | +* Copyright (C) 2008,2009 KnowledgeTree Inc. | ||
| 8 | +* | ||
| 9 | +* | ||
| 10 | +* This program is free software; you can redistribute it and/or modify it under | ||
| 11 | +* the terms of the GNU General Public License version 3 as published by the | ||
| 12 | +* Free Software Foundation. | ||
| 13 | +* | ||
| 14 | +* This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 15 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 16 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
| 17 | +* details. | ||
| 18 | +* | ||
| 19 | +* You should have received a copy of the GNU General Public License | ||
| 20 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | +* | ||
| 22 | +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | ||
| 23 | +* California 94120-7775, or email info@knowledgetree.com. | ||
| 24 | +* | ||
| 25 | +* The interactive user interfaces in modified source and object code versions | ||
| 26 | +* of this program must display Appropriate Legal Notices, as required under | ||
| 27 | +* Section 5 of the GNU General Public License version 3. | ||
| 28 | +* | ||
| 29 | +* In accordance with Section 7(b) of the GNU General Public License version 3, | ||
| 30 | +* these Appropriate Legal Notices must retain the display of the "Powered by | ||
| 31 | +* KnowledgeTree" logo and retain the original copyright notice. If the display of the | ||
| 32 | +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | ||
| 33 | +* must display the words "Powered by KnowledgeTree" and retain the original | ||
| 34 | +* copyright notice. | ||
| 35 | +* | ||
| 36 | +* @copyright 2008-2009, KnowledgeTree Inc. | ||
| 37 | +* @license GNU General Public License version 3 | ||
| 38 | +* @author KnowledgeTree Team | ||
| 39 | +* @package Installer | ||
| 40 | +* @version Version 0.1 | ||
| 41 | +*/ | ||
| 42 | +include("../wizard/path.php"); // Paths | ||
| 43 | + | ||
| 44 | +/** | ||
| 45 | + * Auto loader to bind installer package | ||
| 46 | + * | ||
| 47 | + * @param string $class | ||
| 48 | + * @return void | ||
| 49 | + */ | ||
| 50 | +function __autoload($class) { // Attempt and autoload classes | ||
| 51 | + $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems. | ||
| 52 | + if(file_exists(WIZARD_DIR."$class.php")) { | ||
| 53 | + require_once(WIZARD_DIR."$class.php"); | ||
| 54 | + } elseif (file_exists(STEP_DIR."$class.php")) { | ||
| 55 | + require_once(STEP_DIR."$class.php"); | ||
| 56 | + } elseif (file_exists(WIZARD_LIB."$class.php")) { | ||
| 57 | + require_once(WIZARD_LIB."$class.php"); | ||
| 58 | + } elseif (file_exists(SERVICE_LIB."$class.php")) { | ||
| 59 | + require_once(SERVICE_LIB."$class.php"); | ||
| 60 | + } elseif (file_exists(VALID_DIR."$class.php")) { | ||
| 61 | + require_once(VALID_DIR."$class.php"); | ||
| 62 | + } else { | ||
| 63 | + if(preg_match('/Helper/', $class)) { | ||
| 64 | + require_once(HELPER_DIR."$class.php"); | ||
| 65 | + } | ||
| 66 | + $base = preg_match("/Base/", $class, $matches); | ||
| 67 | + if($base) { | ||
| 68 | + $tmpClass = $class; | ||
| 69 | + $class = "base"; | ||
| 70 | + } | ||
| 71 | + switch ($class) { // Could Need a class in another package | ||
| 72 | + case "template": // Load existing templating classes | ||
| 73 | + loadTemplate(); | ||
| 74 | + break; | ||
| 75 | + case "base": | ||
| 76 | + loadBase($tmpClass); | ||
| 77 | + break; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +function loadBase($class) { | ||
| 84 | + require_once("$class.php"); | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +function loadTemplate() { | ||
| 88 | + require_once("../wizard/template.php"); | ||
| 89 | + require_once("../wizard/lib".DS."helpers".DS."htmlHelper.php"); | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +class WizardBase { | ||
| 93 | + /** | ||
| 94 | + * Bypass flag | ||
| 95 | + * | ||
| 96 | + * @author KnowledgeTree Team | ||
| 97 | + * @access protected | ||
| 98 | + * @var mixed | ||
| 99 | + */ | ||
| 100 | + protected $bypass = null; | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * Level of debugger | ||
| 104 | + * | ||
| 105 | + * @author KnowledgeTree Team | ||
| 106 | + * @access protected | ||
| 107 | + * @var mixed | ||
| 108 | + */ | ||
| 109 | + protected $debugLevel = 0; | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * Reference to utility object | ||
| 113 | + * | ||
| 114 | + * @author KnowledgeTree Team | ||
| 115 | + * @access protected | ||
| 116 | + * @var boolean | ||
| 117 | + */ | ||
| 118 | + protected $util = null; | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * Display the wizard | ||
| 122 | + * | ||
| 123 | + * @author KnowledgeTree Team | ||
| 124 | + * @access public | ||
| 125 | + * @param string | ||
| 126 | + * @return void | ||
| 127 | + */ | ||
| 128 | + public function display() { | ||
| 129 | + | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + /** | ||
| 133 | + * Set bypass flag | ||
| 134 | + * | ||
| 135 | + * @author KnowledgeTree Team | ||
| 136 | + * @access public | ||
| 137 | + * @param boolean | ||
| 138 | + * @return void | ||
| 139 | + */ | ||
| 140 | + public function setBypass($bypass) { | ||
| 141 | + $this->bypass = $bypass; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * Set debug level | ||
| 146 | + * | ||
| 147 | + * @author KnowledgeTree Team | ||
| 148 | + * @access public | ||
| 149 | + * @param boolean | ||
| 150 | + * @return void | ||
| 151 | + */ | ||
| 152 | + public function setDebugLevel($debug) { | ||
| 153 | + define('DEBUG', $debug); | ||
| 154 | + $this->debugLevel = $debug; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * Set util reference | ||
| 159 | + * | ||
| 160 | + * @author KnowledgeTree Team | ||
| 161 | + * @access public | ||
| 162 | + * @param object installer utility | ||
| 163 | + * @return void | ||
| 164 | + */ | ||
| 165 | + public function setIUtil($util) { | ||
| 166 | + $this->util = $util; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * Get bypass flag | ||
| 171 | + * | ||
| 172 | + * @author KnowledgeTree Team | ||
| 173 | + * @access public | ||
| 174 | + * @param none | ||
| 175 | + * @return boolean | ||
| 176 | + */ | ||
| 177 | + public function getBypass() { | ||
| 178 | + return $this->bypass; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + /** | ||
| 182 | + * Load default values | ||
| 183 | + * | ||
| 184 | + * @author KnowledgeTree Team | ||
| 185 | + * @access public | ||
| 186 | + * @param none | ||
| 187 | + * @return void | ||
| 188 | + */ | ||
| 189 | + public function load() { | ||
| 190 | + return false; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * Run pre-installation system checks | ||
| 195 | + * | ||
| 196 | + * @author KnowledgeTree Team | ||
| 197 | + * @access public | ||
| 198 | + * @param none | ||
| 199 | + * @return mixed | ||
| 200 | + */ | ||
| 201 | + public function systemChecks() { | ||
| 202 | + return false; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * Control all requests to wizard | ||
| 207 | + * | ||
| 208 | + * @author KnowledgeTree Team | ||
| 209 | + * @access public | ||
| 210 | + * @param none | ||
| 211 | + * @return void | ||
| 212 | + */ | ||
| 213 | + public function dispatch() { | ||
| 214 | + return false; | ||
| 215 | + } | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | +?> | ||
| 0 | \ No newline at end of file | 219 | \ No newline at end of file |
setup/wizard/step.php
| @@ -42,289 +42,32 @@ | @@ -42,289 +42,32 @@ | ||
| 42 | * @package Installer | 42 | * @package Installer |
| 43 | * @version Version 0.1 | 43 | * @version Version 0.1 |
| 44 | */ | 44 | */ |
| 45 | -class Step | 45 | +class Step extends StepBase |
| 46 | { | 46 | { |
| 47 | /** | 47 | /** |
| 48 | - * List of variables to be loaded to template | ||
| 49 | - * | ||
| 50 | - * @author KnowledgeTree Team | ||
| 51 | - * @access protected | ||
| 52 | - * @var array | ||
| 53 | - */ | ||
| 54 | - protected $temp_variables = array(); | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * List of errors encountered by step | ||
| 58 | - * | ||
| 59 | - * @author KnowledgeTree Team | ||
| 60 | - * @access protected | ||
| 61 | - * @var array | ||
| 62 | - */ | ||
| 63 | - protected $error = array(); | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * List of warnings encountered by step | ||
| 67 | - * | ||
| 68 | - * @author KnowledgeTree Team | ||
| 69 | - * @access protected | ||
| 70 | - * @var array | ||
| 71 | - */ | ||
| 72 | - protected $warnings = array(); | ||
| 73 | - | ||
| 74 | - /** | ||
| 75 | - * Flag to store class information in session | ||
| 76 | - * | ||
| 77 | - * @author KnowledgeTree Team | ||
| 78 | - * @access public | ||
| 79 | - * @var array | ||
| 80 | - */ | ||
| 81 | - protected $storeInSession = false; | ||
| 82 | - | ||
| 83 | - /** | ||
| 84 | * Flag if step needs to be installed | 48 | * Flag if step needs to be installed |
| 85 | * | 49 | * |
| 86 | * @author KnowledgeTree Team | 50 | * @author KnowledgeTree Team |
| 87 | - * @access public | ||
| 88 | - * @var array | ||
| 89 | - */ | ||
| 90 | - protected $runInstall = false; | ||
| 91 | - | ||
| 92 | - /** | ||
| 93 | - * Step order | ||
| 94 | - * | ||
| 95 | - * @author KnowledgeTree Team | ||
| 96 | - * @access public | ||
| 97 | - * @var string | ||
| 98 | - */ | ||
| 99 | - protected $order = false; | ||
| 100 | - | ||
| 101 | - /** | ||
| 102 | - * Flag if step needs to run silently | ||
| 103 | - * | ||
| 104 | - * @author KnowledgeTree Team | ||
| 105 | - * @access public | ||
| 106 | - * @var boolean | ||
| 107 | - */ | ||
| 108 | - protected $silent = false; | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | - * Flag if step needs to show confirm page first | ||
| 112 | - * | ||
| 113 | - * @author KnowledgeTree Team | ||
| 114 | - * @access public | ||
| 115 | - * @var boolean | ||
| 116 | - */ | ||
| 117 | - public $displayFirst = false; | ||
| 118 | - | ||
| 119 | - /** | ||
| 120 | - * Reference to utility object | ||
| 121 | - * | ||
| 122 | - * @author KnowledgeTree Team | ||
| 123 | - * @access protected | ||
| 124 | - * @var object | ||
| 125 | - */ | ||
| 126 | - public $util; | ||
| 127 | - | ||
| 128 | - /** | ||
| 129 | - * Session salt | ||
| 130 | - * | ||
| 131 | - * @author KnowledgeTree Team | ||
| 132 | - * @access public | ||
| 133 | - * @var boolean | 51 | + * @access private |
| 52 | + * @var booelean | ||
| 134 | */ | 53 | */ |
| 135 | - private $salt = 'installers'; | 54 | + public $runInstall = false; |
| 136 | 55 | ||
| 137 | public function __construct() { | 56 | public function __construct() { |
| 138 | $this->util = new InstallUtil(); | 57 | $this->util = new InstallUtil(); |
| 139 | - } | ||
| 140 | - | ||
| 141 | - /** | ||
| 142 | - * Returns step state | ||
| 143 | - * | ||
| 144 | - * @author KnowledgeTree Team | ||
| 145 | - * @param none | ||
| 146 | - * @access public | ||
| 147 | - * @return string | ||
| 148 | - */ | ||
| 149 | - public function doStep() { | ||
| 150 | - return ''; | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - public function displayFirst() { | ||
| 154 | - return $this->displayFirst; | 58 | + $this->salt = 'installers'; |
| 155 | } | 59 | } |
| 156 | 60 | ||
| 157 | /** | 61 | /** |
| 158 | - * Returns step variables | ||
| 159 | - * | ||
| 160 | - * @author KnowledgeTree Team | ||
| 161 | - * @param none | ||
| 162 | - * @access public | ||
| 163 | - * @return array | ||
| 164 | - */ | ||
| 165 | - public function getStepVars() { | ||
| 166 | - return $this->temp_variables; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - /** | ||
| 170 | - * Returns step errors | ||
| 171 | - * | ||
| 172 | - * @author KnowledgeTree Team | ||
| 173 | - * @param none | ||
| 174 | - * @access public | ||
| 175 | - * @return array | ||
| 176 | - */ | ||
| 177 | - public function getErrors() { | ||
| 178 | - return $this->error; | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - /** | ||
| 182 | - * Returns step errors | ||
| 183 | - * | ||
| 184 | - * @author KnowledgeTree Team | ||
| 185 | - * @param none | ||
| 186 | - * @access public | ||
| 187 | - * @return array | ||
| 188 | - */ | ||
| 189 | - public function getWarnings() { | ||
| 190 | - return $this->warnings; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * Load default step values | ||
| 195 | - * | ||
| 196 | - * @author KnowledgeTree Team | ||
| 197 | - * @param none | ||
| 198 | - * @access public | ||
| 199 | - * @return void | ||
| 200 | - */ | ||
| 201 | - public function loadDefaults() { | ||
| 202 | - | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - /** | ||
| 206 | - * Return default step values | ||
| 207 | - * | ||
| 208 | - * @author KnowledgeTree Team | ||
| 209 | - * @param none | ||
| 210 | - * @access public | ||
| 211 | - * @return array | ||
| 212 | - */ | ||
| 213 | - public function getDefaults() { | ||
| 214 | - return array(); | ||
| 215 | - } | ||
| 216 | - | ||
| 217 | - /** | ||
| 218 | - * Checks if edit button has been clicked | ||
| 219 | - * | ||
| 220 | - * @author KnowledgeTree Team | ||
| 221 | - * @param none | ||
| 222 | - * @access public | ||
| 223 | - * @return boolean | ||
| 224 | - */ | ||
| 225 | - public function edit() { | ||
| 226 | - if(isset($_POST['Edit'])) { | ||
| 227 | - return true; | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - return false; | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - /** | ||
| 234 | - * Checks if next button has been clicked | ||
| 235 | - * | ||
| 236 | - * @author KnowledgeTree Team | ||
| 237 | - * @param none | ||
| 238 | - * @access public | ||
| 239 | - * @return boolean | ||
| 240 | - */ | ||
| 241 | - public function next() { | ||
| 242 | - if(isset($_POST['Next'])) { | ||
| 243 | - return true; | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - return false; | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | - /** | ||
| 250 | - * Checks if previous button has been clicked | ||
| 251 | - * | ||
| 252 | - * @author KnowledgeTree Team | ||
| 253 | - * @param none | ||
| 254 | - * @access public | ||
| 255 | - * @return boolean | ||
| 256 | - */ | ||
| 257 | - public function previous() { | ||
| 258 | - if(isset($_POST['Previous'])) { | ||
| 259 | - return true; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - return false; | ||
| 263 | - } | ||
| 264 | - | ||
| 265 | - /** | ||
| 266 | - * Checks if Confirm button has been clicked | ||
| 267 | - * | ||
| 268 | - * @author KnowledgeTree Team | ||
| 269 | - * @param none | ||
| 270 | - * @access public | ||
| 271 | - * @return boolean | ||
| 272 | - */ | ||
| 273 | - function confirm() { | ||
| 274 | - if(isset($_POST['Confirm'])) { | ||
| 275 | - return true; | ||
| 276 | - } | ||
| 277 | - | ||
| 278 | - return false; | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - /** | ||
| 282 | - * Checks if Install button has been clicked | ||
| 283 | - * | ||
| 284 | - * @author KnowledgeTree Team | ||
| 285 | - * @param none | ||
| 286 | - * @access public | ||
| 287 | - * @return boolean | ||
| 288 | - */ | ||
| 289 | - function install() { | ||
| 290 | - if(isset($_POST['Install'])) { | ||
| 291 | - return true; | ||
| 292 | - } | ||
| 293 | - | ||
| 294 | - return false; | ||
| 295 | - } | ||
| 296 | - | ||
| 297 | - /** | ||
| 298 | - * Checks if Clean install button has been clicked | ||
| 299 | - * | ||
| 300 | - * @author KnowledgeTree Team | ||
| 301 | - * @param none | ||
| 302 | - * @access public | ||
| 303 | - * @return boolean | ||
| 304 | - */ | ||
| 305 | - function migrate() { | ||
| 306 | - if(isset($_POST['installtype'])) { | ||
| 307 | - if($_POST['installtype'] == "Upgrade Installation") { | ||
| 308 | - return true; | ||
| 309 | - } | ||
| 310 | - } | ||
| 311 | - | ||
| 312 | - return false; | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - /** | ||
| 316 | - * Checks if we are currently in this class step | ||
| 317 | - * | ||
| 318 | - * @author KnowledgeTree Team | ||
| 319 | - * @param string | ||
| 320 | - * @access public | ||
| 321 | - * @return boolean | ||
| 322 | - */ | ||
| 323 | - public function inStep($name) { | ||
| 324 | - if(!isset($_GET['step_name'])) return false; | ||
| 325 | - if($_GET['step_name'] == $name) | ||
| 326 | - return true; | ||
| 327 | - return false; | 62 | + * Return whether or not to a step has to be installed |
| 63 | + * | ||
| 64 | + * @author KnowledgeTree Team | ||
| 65 | + * @param none | ||
| 66 | + * @access public | ||
| 67 | + * @return boolean | ||
| 68 | + */ | ||
| 69 | + public function runInstall() { | ||
| 70 | + return $this->runInstall; | ||
| 328 | } | 71 | } |
| 329 | 72 | ||
| 330 | /** | 73 | /** |
| @@ -345,22 +88,6 @@ class Step | @@ -345,22 +88,6 @@ class Step | ||
| 345 | } | 88 | } |
| 346 | 89 | ||
| 347 | /** | 90 | /** |
| 348 | - * Get session data from package | ||
| 349 | - * | ||
| 350 | - * @author KnowledgeTree Team | ||
| 351 | - * @params none | ||
| 352 | - * @access private | ||
| 353 | - * @return boolean | ||
| 354 | - */ | ||
| 355 | - public function getDataFromPackage($package, $class) { | ||
| 356 | - if(empty($_SESSION[$package][$class])) { | ||
| 357 | - return false; | ||
| 358 | - } | ||
| 359 | - | ||
| 360 | - return $_SESSION[$package][$class]; | ||
| 361 | - } | ||
| 362 | - | ||
| 363 | - /** | ||
| 364 | * Get session data from class | 91 | * Get session data from class |
| 365 | * | 92 | * |
| 366 | * @author KnowledgeTree Team | 93 | * @author KnowledgeTree Team |
| @@ -375,109 +102,6 @@ class Step | @@ -375,109 +102,6 @@ class Step | ||
| 375 | 102 | ||
| 376 | return $_SESSION[$this->salt][$class]; | 103 | return $_SESSION[$this->salt][$class]; |
| 377 | } | 104 | } |
| 378 | - | ||
| 379 | - /** | ||
| 380 | - * Safer way to return post data | ||
| 381 | - * | ||
| 382 | - * @author KnowledgeTree Team | ||
| 383 | - * @params SimpleXmlObject $simplexml | ||
| 384 | - * @access public | ||
| 385 | - * @return void | ||
| 386 | - */ | ||
| 387 | - public function getPostSafe($key) { | ||
| 388 | - return isset($_POST[$key]) ? $_POST[$key] : ""; | ||
| 389 | - } | ||
| 390 | - | ||
| 391 | - /** | ||
| 392 | - * Safer way to return post data | ||
| 393 | - * | ||
| 394 | - * @author KnowledgeTree Team | ||
| 395 | - * @params SimpleXmlObject $simplexml | ||
| 396 | - * @access public | ||
| 397 | - * @return void | ||
| 398 | - */ | ||
| 399 | - public function getPostBoolean($key) { | ||
| 400 | - return isset($_POST[$key]) ? $_POST[$key] : false; | ||
| 401 | - } | ||
| 402 | - | ||
| 403 | - /** | ||
| 404 | - * Runs step install if required | ||
| 405 | - * | ||
| 406 | - * @author KnowledgeTree Team | ||
| 407 | - * @param none | ||
| 408 | - * @access public | ||
| 409 | - * @return void | ||
| 410 | - */ | ||
| 411 | - public function installStep() { | ||
| 412 | - return ''; | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - /** | ||
| 416 | - * Return whether or not to store a step information in session | ||
| 417 | - * | ||
| 418 | - * @author KnowledgeTree Team | ||
| 419 | - * @param none | ||
| 420 | - * @access public | ||
| 421 | - * @return boolean | ||
| 422 | - */ | ||
| 423 | - public function storeInSession() { | ||
| 424 | - return $this->storeInSession; | ||
| 425 | - } | ||
| 426 | - | ||
| 427 | - /** | ||
| 428 | - * Return whether or not to a step has to be installed | ||
| 429 | - * | ||
| 430 | - * @author KnowledgeTree Team | ||
| 431 | - * @param none | ||
| 432 | - * @access public | ||
| 433 | - * @return boolean | ||
| 434 | - */ | ||
| 435 | - public function runInstall() { | ||
| 436 | - return $this->runInstall; | ||
| 437 | - } | ||
| 438 | - | ||
| 439 | - public function setPostConfig() { | ||
| 440 | - return ''; | ||
| 441 | - } | ||
| 442 | - | ||
| 443 | - /** | ||
| 444 | - * Return whether or not to a step has to be in silent mode | ||
| 445 | - * | ||
| 446 | - * @author KnowledgeTree Team | ||
| 447 | - * @param none | ||
| 448 | - * @access public | ||
| 449 | - * @return boolean | ||
| 450 | - */ | ||
| 451 | - public function silentMode() { | ||
| 452 | - return $this->silent; | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - /** | ||
| 456 | - * Set step errors | ||
| 457 | - * | ||
| 458 | - * @author KnowledgeTree Team | ||
| 459 | - * @param none | ||
| 460 | - * @access public | ||
| 461 | - * @return array | ||
| 462 | - */ | ||
| 463 | - public function setErrors($error) { | ||
| 464 | - $this->error = $error; | ||
| 465 | - } | ||
| 466 | - | ||
| 467 | - /** | ||
| 468 | - * Is the installation | ||
| 469 | - * | ||
| 470 | - * @author KnowledgeTree Team | ||
| 471 | - * @param none | ||
| 472 | - * @access public | ||
| 473 | - * @return string | ||
| 474 | - */ | ||
| 475 | - public function isCe() { | ||
| 476 | - if($this->util->getVersionType() == "community") | ||
| 477 | - return true; | ||
| 478 | - return false; | ||
| 479 | - } | ||
| 480 | - | ||
| 481 | } | 105 | } |
| 482 | 106 | ||
| 483 | ?> | 107 | ?> |
| 484 | \ No newline at end of file | 108 | \ No newline at end of file |
setup/wizard/stepAction.php
| @@ -44,70 +44,7 @@ | @@ -44,70 +44,7 @@ | ||
| 44 | * @version Version 0.1 | 44 | * @version Version 0.1 |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | -class stepAction { | ||
| 48 | - /** | ||
| 49 | - * Step class name | ||
| 50 | - * | ||
| 51 | - * @author KnowledgeTree Team | ||
| 52 | - * @access protected | ||
| 53 | - * @var string | ||
| 54 | - */ | ||
| 55 | - protected $stepName = ''; | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * Step names for classes | ||
| 59 | - * | ||
| 60 | - * @author KnowledgeTree Team | ||
| 61 | - * @access protected | ||
| 62 | - * @var array | ||
| 63 | - */ | ||
| 64 | - protected $stepClassNames = array(); | ||
| 65 | - | ||
| 66 | - /** | ||
| 67 | - * Flag if step needs confirmation | ||
| 68 | - * | ||
| 69 | - * @author KnowledgeTree Team | ||
| 70 | - * @access protected | ||
| 71 | - * @var boolean | ||
| 72 | - */ | ||
| 73 | - protected $displayConfirm = false; | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * Returns whether or not to display the confirmation page first | ||
| 77 | - * | ||
| 78 | - * @author KnowledgeTree Team | ||
| 79 | - * @access protected | ||
| 80 | - * @var boolean | ||
| 81 | - */ | ||
| 82 | - protected $displayFirst = false; | ||
| 83 | - | ||
| 84 | - /** | ||
| 85 | - * List of install properties | ||
| 86 | - * | ||
| 87 | - * @author KnowledgeTree Team | ||
| 88 | - * @access protected | ||
| 89 | - * @var boolean | ||
| 90 | - */ | ||
| 91 | - protected $installProperties = array(); | ||
| 92 | - | ||
| 93 | - /** | ||
| 94 | - * Reference to session object | ||
| 95 | - * | ||
| 96 | - * @author KnowledgeTree Team | ||
| 97 | - * @access protected | ||
| 98 | - * @var object Session | ||
| 99 | - */ | ||
| 100 | - protected $session = null; | ||
| 101 | - | ||
| 102 | - /** | ||
| 103 | - * Reference to current step object | ||
| 104 | - * | ||
| 105 | - * @author KnowledgeTree Team | ||
| 106 | - * @access protected | ||
| 107 | - * @var object class Step | ||
| 108 | - */ | ||
| 109 | - protected $action = null; | ||
| 110 | - | 47 | +class stepAction extends stepActionBase { |
| 111 | /** | 48 | /** |
| 112 | * Constructs step action object | 49 | * Constructs step action object |
| 113 | * | 50 | * |
| @@ -119,424 +56,13 @@ class stepAction { | @@ -119,424 +56,13 @@ class stepAction { | ||
| 119 | $this->stepName = $step; | 56 | $this->stepName = $step; |
| 120 | } | 57 | } |
| 121 | 58 | ||
| 122 | - /** | ||
| 123 | - * Helper to initialize step actions | ||
| 124 | - * | ||
| 125 | - * @author KnowledgeTree Team | ||
| 126 | - * @param string | ||
| 127 | - * @access public | ||
| 128 | - * @return string | ||
| 129 | - */ | ||
| 130 | - public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $installProperties) { | ||
| 131 | - $this->setSteps($steps); | ||
| 132 | - $this->setStepNames($stepNames); | ||
| 133 | - $this->setDisplayConfirm($stepConfirmation); | ||
| 134 | - $this->setDisplayFirst($stepDisplayFirst); | ||
| 135 | - $this->loadSession($session); | ||
| 136 | - $this->setInstallProperties($installProperties); | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * Sets steps class names in string format | ||
| 141 | - * | ||
| 142 | - * @author KnowledgeTree Team | ||
| 143 | - * @param array | ||
| 144 | - * @access public | ||
| 145 | - * @return void | ||
| 146 | - */ | ||
| 147 | - public function setSteps($stepClassNames) { | ||
| 148 | - $this->stepClassNames = $stepClassNames; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * Sets steps in human readable string format | ||
| 153 | - * | ||
| 154 | - * @author KnowledgeTree Team | ||
| 155 | - * @param array | ||
| 156 | - * @access public | ||
| 157 | - * @return void | ||
| 158 | - */ | ||
| 159 | - public function setStepNames($step_names) { | ||
| 160 | - $this->step_names = $step_names; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - /** | ||
| 164 | - * Sets confirmation page flag | ||
| 165 | - * | ||
| 166 | - * @author KnowledgeTree Team | ||
| 167 | - * @param boolean | ||
| 168 | - * @access public | ||
| 169 | - * @return void | ||
| 170 | - */ | ||
| 171 | - public function setDisplayConfirm($displayConfirm) { | ||
| 172 | - $this->displayConfirm = $displayConfirm; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * Sets confirmation page first flag | ||
| 177 | - * | ||
| 178 | - * @author KnowledgeTree Team | ||
| 179 | - * @param boolean | ||
| 180 | - * @access public | ||
| 181 | - * @return void | ||
| 182 | - */ | ||
| 183 | - public function setDisplayFirst($displayFirst) { | ||
| 184 | - $this->displayFirst = $displayFirst; | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * Sets session object | ||
| 189 | - * | ||
| 190 | - * @author KnowledgeTree Team | ||
| 191 | - * @param object Session | ||
| 192 | - * @access public | ||
| 193 | - * @return void | ||
| 194 | - */ | ||
| 195 | - public function loadSession($ses) { | ||
| 196 | - $this->session = $ses; | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - /** | ||
| 200 | - * Sets install properties | ||
| 201 | - * | ||
| 202 | - * @author KnowledgeTree Team | ||
| 203 | - * @param array | ||
| 204 | - * @access public | ||
| 205 | - * @return void | ||
| 206 | - */ | ||
| 207 | - public function setInstallProperties($installProperties) { | ||
| 208 | - $this->installProperties = $installProperties; | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - /** | ||
| 212 | - * Main control to handle the steps actions | ||
| 213 | - * | ||
| 214 | - * @author KnowledgeTree Team | ||
| 215 | - * @param none | ||
| 216 | - * @access public | ||
| 217 | - * @return string | ||
| 218 | - */ | ||
| 219 | - public function doAction() { | ||
| 220 | - if($this->stepName != '') { | ||
| 221 | - $this->action = $this->createStep(); | ||
| 222 | - if(!$this->action) { | ||
| 223 | - $this->stepName = 'errors'; | ||
| 224 | - $this->action = $this->createStep(); | ||
| 225 | - $this->action->error = array('Class Files Missing in Step Directory'); | ||
| 226 | - } | ||
| 227 | - $response = $this->action->doStep(); | ||
| 228 | - if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 229 | - $this->_loadStepToSession($this->stepName); // Send class to session | ||
| 230 | - } | ||
| 231 | - if ($response == 'error') { | ||
| 232 | - $this->_handleErrors(); // Send Errors to session | ||
| 233 | - } else { | ||
| 234 | - $this->_clearErrors($this->stepName); // Send Errors to session | ||
| 235 | - } | ||
| 236 | - return $response; | ||
| 237 | - } else { | ||
| 238 | - $this->stepName = 'errors'; | ||
| 239 | - $this->action = $this->createStep(); | ||
| 240 | - $this->action->error = array('Class File Missing in Step Directory'); | ||
| 241 | - } | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - /** | ||
| 245 | - * Instantiate a step. | ||
| 246 | - * | ||
| 247 | - * @author KnowledgeTree Team | ||
| 248 | - * @param none | ||
| 249 | - * @access public | ||
| 250 | - * @return object Step | ||
| 251 | - */ | ||
| 252 | - public function createStep() { | ||
| 253 | - $step_class = $this->makeCamelCase($this->stepName); | ||
| 254 | - return new $step_class(); | ||
| 255 | - } | ||
| 256 | - | ||
| 257 | - /** | ||
| 258 | - * Converts string to camel case | ||
| 259 | - * | ||
| 260 | - * @author KnowledgeTree Team | ||
| 261 | - * @param string | ||
| 262 | - * @access public | ||
| 263 | - * @return string | ||
| 264 | - */ | ||
| 265 | - public function makeCamelCase($str) { | ||
| 266 | - $upper=ucwords($str); | ||
| 267 | - $str=str_replace('_', '', $upper); | ||
| 268 | - | ||
| 269 | - return $str; | ||
| 270 | - } | ||
| 271 | - | ||
| 272 | - /** | ||
| 273 | - * Converts string to human readable heading | ||
| 274 | - * | ||
| 275 | - * @author KnowledgeTree Team | ||
| 276 | - * @param string | ||
| 277 | - * @access public | ||
| 278 | - * @return string | ||
| 279 | - */ | ||
| 280 | - public function makeHeading($str) { | ||
| 281 | - $str = str_replace('_', ' ', $str); | ||
| 282 | - $str = ucwords($str); | ||
| 283 | - | ||
| 284 | - return $str; | ||
| 285 | - } | ||
| 286 | - | ||
| 287 | - /** | ||
| 288 | - * Returns current step name | ||
| 289 | - * | ||
| 290 | - * @author KnowledgeTree Team | ||
| 291 | - * @param none | ||
| 292 | - * @access public | ||
| 293 | - * @return string | ||
| 294 | - */ | ||
| 295 | - public function getCurrentStepName() { | ||
| 296 | - if($this->stepName != 'errors') | ||
| 297 | - return $this->step_names[$this->stepName]; | ||
| 298 | - return ''; | ||
| 299 | - } | ||
| 300 | - | ||
| 301 | - /** | ||
| 302 | - * Returns left menu | ||
| 303 | - * | ||
| 304 | - * @author KnowledgeTree Team | ||
| 305 | - * @param none | ||
| 306 | - * @access public | ||
| 307 | - * @return string | ||
| 308 | - */ | ||
| 309 | - public function getLeftMenu() | ||
| 310 | - { | ||
| 311 | - $sideMenuElements = array(); | ||
| 312 | - $active = false; | ||
| 313 | - if($this->stepClassNames) { | ||
| 314 | - $ele = array(); | ||
| 315 | - foreach ($this->stepClassNames as $k=>$step) { | ||
| 316 | - $ele['step'] = $step; | ||
| 317 | - if($this->step_names[$step] != '') { | ||
| 318 | - $ele['name'] = $this->step_names[$step]; | ||
| 319 | - } else { | ||
| 320 | - $ele['name'] = $this->makeHeading($step); | ||
| 321 | - } | ||
| 322 | - if($step == $this->stepName) { | ||
| 323 | - $ele['class'] = 'current'; | ||
| 324 | - $active = true; | ||
| 325 | - } else { | ||
| 326 | - if($active) { | ||
| 327 | - $ele['class'] = 'inactive'; | ||
| 328 | - } else { | ||
| 329 | - $ele['class'] = 'indicator'; | ||
| 330 | - } | ||
| 331 | - } | ||
| 332 | - $sideMenuElements[] = $ele; | ||
| 333 | - } | ||
| 334 | - } | ||
| 335 | - $step_tpl = new Template("templates/sidemenu.tpl"); // Create template | ||
| 336 | - $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements | ||
| 337 | - $step_tpl->set("ajax", AJAX); // Set ajax state | ||
| 338 | - | ||
| 339 | - return $step_tpl->fetch(); | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - /** | ||
| 343 | - * Returns confirmation page flag | ||
| 344 | - * | ||
| 345 | - * @author KnowledgeTree Team | ||
| 346 | - * @param none | ||
| 347 | - * @access public | ||
| 348 | - * @return boolean | ||
| 349 | - */ | ||
| 350 | - public function displayConfirm() { | ||
| 351 | - return $this->displayConfirm; | ||
| 352 | - } | ||
| 353 | - | ||
| 354 | - /** | ||
| 355 | - * Returns whether or not to display the confirmation page first | ||
| 356 | - * | ||
| 357 | - * @author KnowledgeTree Team | ||
| 358 | - * @param none | ||
| 359 | - * @access public | ||
| 360 | - * @return boolean | ||
| 361 | - */ | ||
| 362 | - public function displayFirst() { | ||
| 363 | - return $this->displayFirst; | ||
| 364 | - } | ||
| 365 | - | ||
| 366 | - /** | ||
| 367 | - * Returns session object | ||
| 368 | - * | ||
| 369 | - * @author KnowledgeTree Team | ||
| 370 | - * @param object Session | ||
| 371 | - * @access public | ||
| 372 | - * @return object | ||
| 373 | - */ | ||
| 374 | - public function getSession() { | ||
| 375 | - return $this->session; | ||
| 376 | - } | ||
| 377 | - | ||
| 378 | - /** | ||
| 379 | - * Returns step tenplate content | ||
| 380 | - * | ||
| 381 | - * @author KnowledgeTree Team | ||
| 382 | - * @param none | ||
| 383 | - * @access public | ||
| 384 | - * @return string | ||
| 385 | - */ | ||
| 386 | - public function paintAction() { | ||
| 387 | - $step_errors = $this->action->getErrors(); // Get errors | ||
| 388 | - $step_warnings = $this->action->getWarnings(); // Get warnings | ||
| 389 | - if($this->displayConfirm()) { // Check if theres a confirm step | ||
| 390 | - $template = "templates/{$this->stepName}_confirm.tpl"; | ||
| 391 | - } else { | ||
| 392 | - if($this->displayFirst()) { | ||
| 393 | - $template = "templates/{$this->stepName}_confirm.tpl"; | ||
| 394 | - } else { | ||
| 395 | - $template = "templates/{$this->stepName}.tpl"; | ||
| 396 | - } | ||
| 397 | - } | ||
| 398 | - $step_tpl = new Template($template); | ||
| 399 | - $step_tpl->set("errors", $step_errors); // Set template errors | ||
| 400 | - $step_tpl->set("warnings", $step_warnings); // Set template warnings | ||
| 401 | - $step_vars = $this->action->getStepVars(); // Get template variables | ||
| 402 | - $step_tpl->set("step_vars", $step_vars); // Set template errors | ||
| 403 | - $this->loadToSes($step_vars); | ||
| 404 | - $this->loadToTpl($step_tpl, $step_vars); | ||
| 405 | - // TODO: Force because it does not always recognize ajax request | ||
| 406 | - if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { | ||
| 407 | - echo $step_tpl->fetch(); | ||
| 408 | - } else { | ||
| 409 | - $content = $step_tpl->fetch(); | ||
| 410 | - $tpl = new Template("templates/wizard.tpl"); | ||
| 411 | - $vars = $this->getVars(); // Get template variables | ||
| 412 | - $tpl->set("vars", $vars); // Set template errors | ||
| 413 | - $tpl->set('content', $content); | ||
| 414 | - echo $tpl->fetch(); | ||
| 415 | - } | ||
| 416 | - } | ||
| 417 | - | ||
| 418 | - public function loadToSes($step_vars) { | ||
| 419 | - if($this->action->storeInSession()) { // Check if class values need to be stored in session | ||
| 420 | - foreach ($step_vars as $key => $value) { // Set template variables | ||
| 421 | - $this->_loadValueToSession($this->stepName, $key, $value); | ||
| 422 | - } | ||
| 423 | - } | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | - public function loadToTpl($step_tpl, $step_vars) { | ||
| 427 | - foreach ($step_vars as $key => $value) { // Set template variables | ||
| 428 | - $step_tpl->set($key, $value); // Load values to session | ||
| 429 | - } | ||
| 430 | - } | ||
| 431 | - | ||
| 432 | - public function getStepVars() { | ||
| 433 | - return $this->action->getStepVars(); | ||
| 434 | - } | ||
| 435 | - | ||
| 436 | public function getVars() { | 59 | public function getVars() { |
| 437 | $left = $this->getLeftMenu(); | 60 | $left = $this->getLeftMenu(); |
| 438 | $vars['left'] = $left; // Set left menu | 61 | $vars['left'] = $left; // Set left menu |
| 439 | - $vars['install_version'] = $this->installProperties['install_version']; // Set version | ||
| 440 | - $vars['install_type'] = $this->installProperties['install_type']; // Set type | 62 | + $vars['install_version'] = $this->properties['install_version']; // Set version |
| 63 | + $vars['install_type'] = $this->properties['install_type']; // Set type | ||
| 441 | return $vars; | 64 | return $vars; |
| 442 | } | 65 | } |
| 443 | - | ||
| 444 | - /** | ||
| 445 | - * Load class to session | ||
| 446 | - * | ||
| 447 | - * @author KnowledgeTree Team | ||
| 448 | - * @param string $class name of class | ||
| 449 | - * @param array $v array of values | ||
| 450 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 451 | - * @access private | ||
| 452 | - * @return void | ||
| 453 | - */ | ||
| 454 | - private function _loadStepToSession($class, $v = array(), $overwrite = false) { | ||
| 455 | - if($this->session != null) { | ||
| 456 | - if($overwrite) { | ||
| 457 | - $this->session->set($class , $v); | ||
| 458 | - } else { | ||
| 459 | - if(!$this->session->is_set($class)) | ||
| 460 | - $this->session->set($class , $v); | ||
| 461 | - } | ||
| 462 | - } else { | ||
| 463 | - $this->stepName = 'errors'; | ||
| 464 | - $this->action = $this->createStep(); | ||
| 465 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 466 | - } | ||
| 467 | - } | ||
| 468 | - | ||
| 469 | - /** | ||
| 470 | - * Load class value to session | ||
| 471 | - * | ||
| 472 | - * @author KnowledgeTree Team | ||
| 473 | - * @param string $class name of class | ||
| 474 | - * @param string $k key value | ||
| 475 | - * @param string $v value to store | ||
| 476 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 477 | - * @access private | ||
| 478 | - * @return void | ||
| 479 | - */ | ||
| 480 | - private function _loadValueToSession($class, $k, $v, $overwrite = false) { | ||
| 481 | - if($this->session != null) { | ||
| 482 | - $this->session->setClass($class, $k, $v); | ||
| 483 | - } else { | ||
| 484 | - $this->stepName = 'errors'; | ||
| 485 | - $this->action = $this->createStep(); | ||
| 486 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 487 | - } | ||
| 488 | - } | ||
| 489 | - | ||
| 490 | - /** | ||
| 491 | - * Load all class errors value to session | ||
| 492 | - * | ||
| 493 | - * @author KnowledgeTree Team | ||
| 494 | - * @param none | ||
| 495 | - * @access private | ||
| 496 | - * @return void | ||
| 497 | - */ | ||
| 498 | - private function _handleErrors() {// TODO: handle multiple errors | ||
| 499 | - $step_errors = $this->action->getErrors(); // Get errors | ||
| 500 | - foreach ($step_errors as $key => $value) { | ||
| 501 | - $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session | ||
| 502 | - } | ||
| 503 | - } | ||
| 504 | - | ||
| 505 | - /** | ||
| 506 | - * Remove all class errors value to session | ||
| 507 | - * | ||
| 508 | - * @author KnowledgeTree Team | ||
| 509 | - * @param none | ||
| 510 | - * @access private | ||
| 511 | - * @return void | ||
| 512 | - */ | ||
| 513 | - private function _clearErrors($class) { | ||
| 514 | - if($this->session) { | ||
| 515 | - $this->session->clearErrors($class); | ||
| 516 | - } | ||
| 517 | - } | ||
| 518 | - | ||
| 519 | - /** | ||
| 520 | - * Load class error value to session | ||
| 521 | - * | ||
| 522 | - * @author KnowledgeTree Team | ||
| 523 | - * @param string $class name of class | ||
| 524 | - * @param string $k key value | ||
| 525 | - * @param string $v value to store | ||
| 526 | - * @param boolean $overwrite whether or not to overwrite existing | ||
| 527 | - * @access private | ||
| 528 | - * @return void | ||
| 529 | - */ | ||
| 530 | - private function _loadErrorToSession($class, $k, $v, $overwrite = false) { | ||
| 531 | - $k = "errors"; | ||
| 532 | - if($this->session != null) { | ||
| 533 | - $this->session->setClassError($class, $k, $v); | ||
| 534 | - } else { | ||
| 535 | - $this->stepName = 'errors'; | ||
| 536 | - $this->action = $this->createStep(); | ||
| 537 | - $this->action->error = array('Sessions Are Disabled'); | ||
| 538 | - } | ||
| 539 | - } | ||
| 540 | } | 66 | } |
| 541 | 67 | ||
| 542 | ?> | 68 | ?> |
| 543 | \ No newline at end of file | 69 | \ No newline at end of file |
setup/wizard/steps/configuration.php
| @@ -126,7 +126,7 @@ class configuration extends Step | @@ -126,7 +126,7 @@ class configuration extends Step | ||
| 126 | * @access public | 126 | * @access public |
| 127 | * @var array | 127 | * @var array |
| 128 | */ | 128 | */ |
| 129 | - protected $runInstall = true; | 129 | + public $runInstall = true; |
| 130 | 130 | ||
| 131 | /** | 131 | /** |
| 132 | * Flag if step needs to run silently | 132 | * Flag if step needs to run silently |
setup/wizard/steps/database.php
| @@ -214,7 +214,7 @@ class database extends Step | @@ -214,7 +214,7 @@ class database extends Step | ||
| 214 | * @access public | 214 | * @access public |
| 215 | * @var array | 215 | * @var array |
| 216 | */ | 216 | */ |
| 217 | - protected $runInstall = true; | 217 | + public $runInstall = true; |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| 220 | * Flag if step needs to run silently | 220 | * Flag if step needs to run silently |
setup/wizard/steps/install.php
| @@ -62,7 +62,7 @@ class install extends step | @@ -62,7 +62,7 @@ class install extends step | ||
| 62 | * @access public | 62 | * @access public |
| 63 | * @var array | 63 | * @var array |
| 64 | */ | 64 | */ |
| 65 | - protected $runInstall = true; | 65 | + public $runInstall = true; |
| 66 | private $ce_check = false; | 66 | private $ce_check = false; |
| 67 | 67 | ||
| 68 | public function doStep() { | 68 | public function doStep() { |
setup/wizard/steps/registration.php
| @@ -145,7 +145,7 @@ class registration extends Step | @@ -145,7 +145,7 @@ class registration extends Step | ||
| 145 | $formPost = $_POST; | 145 | $formPost = $_POST; |
| 146 | $formPost['submitted']['installation_guid'] = $this->temp_variables['installation_guid']; | 146 | $formPost['submitted']['installation_guid'] = $this->temp_variables['installation_guid']; |
| 147 | // TODO set correctly using auto set mechanism | 147 | // TODO set correctly using auto set mechanism |
| 148 | - $_SESSION['installers']['registration']['installation_guid'] = $this->temp_variables['installation_guid']; | 148 | + // $_SESSION['installers']['registration']['installation_guid'] = $this->temp_variables['installation_guid']; |
| 149 | $this->curlForm($formPost); | 149 | $this->curlForm($formPost); |
| 150 | 150 | ||
| 151 | // Prevent the form being reposted. | 151 | // Prevent the form being reposted. |
| @@ -483,7 +483,7 @@ class registration extends Step | @@ -483,7 +483,7 @@ class registration extends Step | ||
| 483 | 'RO' => 'ROMANIA', | 483 | 'RO' => 'ROMANIA', |
| 484 | 'RU' => 'RUSSIAN FEDERATION', | 484 | 'RU' => 'RUSSIAN FEDERATION', |
| 485 | 'RW' => 'RWANDA', | 485 | 'RW' => 'RWANDA', |
| 486 | -// TODO: Special Character for the e | 486 | +// TODO: Special Character for the É |
| 487 | 'BL' => 'SAINT BARTHELEMY', | 487 | 'BL' => 'SAINT BARTHELEMY', |
| 488 | 'SH' => 'SAINT HELENA', | 488 | 'SH' => 'SAINT HELENA', |
| 489 | 'KN' => 'SAINT KITTS AND NEVIS', | 489 | 'KN' => 'SAINT KITTS AND NEVIS', |
setup/wizard/steps/services.php
| @@ -61,7 +61,7 @@ class services extends Step | @@ -61,7 +61,7 @@ class services extends Step | ||
| 61 | * @access protected | 61 | * @access protected |
| 62 | * @var array | 62 | * @var array |
| 63 | */ | 63 | */ |
| 64 | - protected $runInstall = true; | 64 | + public $runInstall = true; |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * List of services to be installed | 67 | * List of services to be installed |
setup/wizard/templates/complete.tpl
| @@ -13,7 +13,6 @@ | @@ -13,7 +13,6 @@ | ||
| 13 | </div> | 13 | </div> |
| 14 | <br/> | 14 | <br/> |
| 15 | <div id="step_content_<?php echo $step_name; ?>" class="step"> | 15 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 16 | - | ||
| 17 | <?php if(!$servicesValidation) { ?> | 16 | <?php if(!$servicesValidation) { ?> |
| 18 | <?php if(!$migrate_check) { ?> | 17 | <?php if(!$migrate_check) { ?> |
| 19 | <h3>Services</h3> | 18 | <h3>Services</h3> |
| @@ -24,7 +23,6 @@ | @@ -24,7 +23,6 @@ | ||
| 24 | <br/> | 23 | <br/> |
| 25 | <?php } else { ?> | 24 | <?php } else { ?> |
| 26 | To start the services, using the instructions below: | 25 | To start the services, using the instructions below: |
| 27 | -<!-- execute the dmsctl.bat batch file in the KnowledgeTree directory from a command prompt, run as administrator.--> | ||
| 28 | <br/> | 26 | <br/> |
| 29 | <br/> | 27 | <br/> |
| 30 | <?php } ?> | 28 | <?php } ?> |
| @@ -159,7 +157,6 @@ | @@ -159,7 +157,6 @@ | ||
| 159 | <?php } ?> | 157 | <?php } ?> |
| 160 | <!-- Services --> | 158 | <!-- Services --> |
| 161 | <br/> | 159 | <br/> |
| 162 | -<!-- <br/>--> | ||
| 163 | <?php if($servicesValidation) { ?> | 160 | <?php if($servicesValidation) { ?> |
| 164 | <?php if(!$migrate_check) { ?> | 161 | <?php if(!$migrate_check) { ?> |
| 165 | <div> | 162 | <div> |
tests/env/testPhpVersion.php
| 1 | <?php | 1 | <?php |
| 2 | require_once (KT_DIR . '/tests/test.php'); | 2 | require_once (KT_DIR . '/tests/test.php'); |
| 3 | +require_once (KT_DIR . '/setup//wizard/share/wizardBase.php'); | ||
| 3 | require_once (KT_DIR . '/setup/wizard/installUtil.php'); | 4 | require_once (KT_DIR . '/setup/wizard/installUtil.php'); |
| 4 | require_once (KT_DIR . '/setup/wizard/step.php'); | 5 | require_once (KT_DIR . '/setup/wizard/step.php'); |
| 5 | require_once (KT_DIR . '/setup/wizard/steps/dependencies.php'); | 6 | require_once (KT_DIR . '/setup/wizard/steps/dependencies.php'); |