diff --git a/setup/firstlogin/config/commercial_config.xml b/setup/firstlogin/config/commercial_config.xml
new file mode 100644
index 0000000..1b91e4c
--- /dev/null
+++ b/setup/firstlogin/config/commercial_config.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ templates
+ complete
+
+
\ No newline at end of file
diff --git a/setup/firstlogin/config/community_config.xml b/setup/firstlogin/config/community_config.xml
new file mode 100644
index 0000000..1197f86
--- /dev/null
+++ b/setup/firstlogin/config/community_config.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ templates
+ complete
+
+
\ No newline at end of file
diff --git a/setup/firstlogin/config/config.xml b/setup/firstlogin/config/config.xml
new file mode 100644
index 0000000..1197f86
--- /dev/null
+++ b/setup/firstlogin/config/config.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ templates
+ complete
+
+
\ No newline at end of file
diff --git a/setup/firstlogin/firstlogin.php b/setup/firstlogin/firstlogin.php
new file mode 100644
index 0000000..5ea00fe
--- /dev/null
+++ b/setup/firstlogin/firstlogin.php
@@ -0,0 +1,673 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Fist Start Wizard
+* @version Version 0.1
+*/
+
+class FirstLogin {
+ /**
+ * Reference to simple xml object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object SimpleXMLElement
+ */
+ protected $simpleXmlObj = null;
+
+ /**
+ * Reference to step action object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object StepAction
+ */
+ protected $stepAction = null;
+
+ /**
+ * Reference to session object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object Session
+ */
+ protected $session = null;
+
+ /**
+ * List of steps as strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepClassNames = array();
+
+ /**
+ * List of steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepNames = array();
+
+ /**
+ * List of steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepObjects = array();
+
+ /**
+ * Order in which steps have to be done
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $orders = array();
+
+ /**
+ * List of properties
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $properties = array();
+
+ /**
+ * Flag if a step object needs confirmation
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $stepConfirmation = false;
+
+ /**
+ * Flag if a step object needs confirmation
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $stepDisplayFirst = false;
+
+ private $action = '';
+
+ /**
+ * Constructs object
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param object Session $session Instance of the Session object
+ */
+ public function __construct($session = null) {
+ $this->session = $session;
+ }
+
+ /**
+ * Read xml configuration file
+ *
+ * @author KnowledgeTree Team
+ * @param string $name of config file
+ * @access private
+ * @return object
+ */
+ private function _readXml($name = "config.xml") {
+ try {
+ $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name");
+ } catch (Exception $e) {
+ $util = new FirstLoginUtil();
+ $util->error("Error reading configuration file: $e");
+ exit();
+ }
+ }
+
+ /**
+ * Checks if first step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function _firstStep() {
+ if(isset($_GET['step_name'])) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks if first step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return boolean
+ */
+ private function _firstStepPeriod() {
+ if(isset($_GET['step_name'])) {
+ if($_GET['step_name'] != 'installation')
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns next step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return string
+ */
+ private function _getNextStep() {
+ return $this->_getStepName(1);
+ }
+
+ /**
+ * Returns previous step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return string
+ */
+ private function _getPreviousStep() {
+ return $this->_getStepName(-1);
+ }
+
+ /**
+ * Returns the step name, given a position
+ *
+ * @author KnowledgeTree Team
+ * @param integer $pos current position
+ * @access private
+ * @return string $name
+ */
+ private function _getStepName($pos = 0) {
+ if($this->_firstStep()) {
+ $step = (string) $this->simpleXmlObj->steps->step[0];
+ } else {
+ $pos += $this->getStepPosition();
+ $step = (string) $this->simpleXmlObj->steps->step[$pos];
+ }
+
+ return $step;
+ }
+
+ /**
+ * Executes next step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return string
+ */
+ private function _proceed() {
+ $step_name = $this->_getNextStep();
+
+ return $this->_runStepAction($step_name);
+ }
+
+ /**
+ * Executes previous step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return string
+ */
+ private function _backward() {
+ $step_name = $this->_getPreviousStep();
+
+ return $this->_runStepAction($step_name);
+ }
+
+ /**
+ * Executes step landing
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return string
+ */
+ private function _landing() {
+ $step_name = $this->_getStepName();
+
+ return $this->_runStepAction($step_name);
+ }
+
+ /**
+ * Executes step based on step class name
+ *
+ * @author KnowledgeTree Team
+ * @param string $step_name
+ * @access private
+ * @return string
+ */
+ private function _runStepAction($stepName) {
+ $this->stepAction = new stepAction($stepName);
+ $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getProperties());
+
+ return $this->stepAction->doAction();
+ }
+
+ private function stepDisplayFirst() {
+ if($this->action == 'edit')
+ return false; //
+ $class = $this->stepAction->createStep(); // Get step class
+ return $class->displayFirst(); // Check if class needs to display first
+ }
+
+ /**
+ * Set steps class names in string format
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return array
+ */
+ private function _getOrders() {
+ return $this->orders;
+ }
+
+ /**
+ * Set steps as names
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _xmlStepsToArray() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step_name = (string) $d_step[0];
+ $this->stepClassNames[] = $step_name;
+ }
+ $this->_loadToSession('stepClassNames', $this->stepClassNames);
+ }
+ }
+
+ /**
+ * Set steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _xmlStepsNames() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step_name = (string) $d_step[0];
+ $this->stepNames[$step_name] = (string) $d_step['name'];
+ }
+ $this->_loadToSession('stepNames', $this->stepNames);
+ }
+ }
+
+ /**
+ * Set steps order
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _xmlStepsOrders() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ if(isset($d_step['order'])) {
+ $step_name = (string) $d_step[0];
+ $order = (string) $d_step['order'];
+ $this->orders[$order] = $step_name; // Store step order
+ }
+ }
+ $this->_loadToSession('orders', $this->orders);
+ }
+ }
+
+ /**
+ * Set properties
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _xmlProperties() {
+ if(isset($this->simpleXmlObj)) {
+ $this->properties['fl_version'] = (string) $this->simpleXmlObj['version'];
+ $this->properties['fl_type'] = (string) $this->simpleXmlObj['type'];
+ $this->_loadToSession('properties', $this->properties);
+ }
+ }
+
+ /**
+ * Steps
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _runSteps() {
+ $steps = $this->_getOrders();
+ for ($i=1; $i< count($steps)+1; $i++) {
+ $this->_helper($steps[$i]);
+ }
+
+ $this->_complete();
+ }
+
+ /**
+ * Complete cleanup process
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _complete() {
+ touch("firstlogin");
+ }
+
+ /**
+ * Steps helper
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _helper($className) {
+ $stepAction = new stepAction($className); // Instantiate a step action
+ $class = $stepAction->createStep(); // Get step class
+ if($class) { // Check if class Exists
+ if($class->run()) { // Check if step needs to be run
+ $class->setDataFromSession($className); // Set Session Information
+ $class->setPostConfig(); // Set any posted variables
+ $class->Step(); // Run step
+ }
+ } else {
+ $util = new firstloginUtil();
+ $util->error("Class File Missing in Step Directory: $className");
+ exit();
+ }
+ }
+
+ /**
+ * Reset all session information on welcome landing
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access private
+ * @return void
+ */
+ private function _resetSessions() {
+ if($this->session) {
+ if($this->_firstStepPeriod()) {
+ foreach ($this->getSteps() as $class) {
+ $this->session->un_setClass($class);
+ }
+ foreach ($this->getStepNames() as $class) {
+ $this->session->un_setClass($class);
+ }
+ foreach ($this->_getOrders() as $class) {
+ $this->session->un_setClass($class);
+ }
+ }
+ }
+ }
+
+ function _loadFromSessions() {
+ $this->stepClassNames = $this->session->get('stepClassNames');
+ if(!$this->stepClassNames) {
+ $this->_xmlStepsToArray(); // String steps
+ }
+ $this->stepNames = $this->session->get('stepNames');
+ if(!$this->stepNames) {
+ $this->_xmlStepsNames();
+ }
+ $this->Orders = $this->session->get('Orders');
+ if(!$this->orders) {
+ $this->_xmlStepsOrders();
+ }
+ $this->properties = $this->session->get('properties');
+ if(!$this->properties) {
+ $this->_xmlProperties();
+ }
+ }
+
+ private function loadNeeded() {
+ $this->_readXml(); // Xml steps
+ // Make sure session is cleared
+ $this->_resetSessions();
+ $this->_loadFromSessions();
+ if(isset($_POST['Next'])) {
+ $this->action = 'next';
+ $this->response = 'next';
+ } elseif (isset($_POST['Previous'])) {
+ $this->action = 'previous';
+ $this->response = 'previous';
+ } elseif (isset($_POST['Confirm'])) {
+ $this->action = 'confirm';
+ $this->response = 'next';
+ } elseif (isset($_POST['Edit'])) {
+ $this->action = 'edit';
+ $this->response = 'next';
+ } else {
+ $this->response = '';
+ $this->action = '';
+ }
+ }
+
+ /**
+ * Main control to handle the flow
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function step() {
+ $this->loadNeeded();
+ switch($this->response) {
+ case 'next':
+ $step_name = $this->_getStepName();
+ $res = $this->_runStepAction($step_name);
+ if($res == 'next') {
+ $this->_proceed(); // Load next window
+ } elseif ($res == 'confirm') {
+ if(!$this->stepDisplayFirst())
+ $this->stepConfirmation = true;
+ $this->_landing();
+ } elseif ($res == 'landing') {
+ $this->_landing();
+ } else {
+ }
+ break;
+ case 'previous':
+ $this->_backward(); // Load previous page
+ break;
+ case 'install':
+ $util = new firstloginUtil();
+ $util->redirect('../wizard/index.php?step_name=installtype');
+ break;
+ default:
+ $this->_landing();
+ break;
+ }
+ $this->stepAction->paintAction(); // Display step
+ }
+
+ /**
+ * Returns the step number
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return integer $pos
+ */
+ public function getStepPosition() {
+ $pos = 0;
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step = (string) $d_step;
+ if ($step == $_GET['step_name']) {
+ break;
+ }
+ $pos++;
+ }
+ if(isset($_GET['step'])) {
+ if($_GET['step'] == "next")
+ $pos = $pos+1;
+ else
+ $pos = $pos-1;
+ }
+
+ return $pos;
+ }
+
+ /**
+ * Returns the step names for classes
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getSteps() {
+ return $this->stepClassNames;
+ }
+
+ /**
+ * Returns the steps as human readable string
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getStepNames() {
+ return $this->stepNames;
+ }
+
+ /**
+ * Returns whether or not a confirmation step is needed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function getStepConfirmation() {
+ return $this->stepConfirmation;
+ }
+
+ /**
+ * Return properties
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return string
+ */
+ public function getProperties() {
+ return $this->properties;
+ }
+
+ /**
+ * Returns session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function getSession() {
+ return $this->session;
+ }
+
+ /**
+ * Dump of SESSION
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function showSession() {
+ echo '
';
+ print_r($_SESSION);
+ echo ' ';
+ }
+
+ /**
+ * Display errors that are not allowing the operation
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function resolveErrors($errors) {
+ echo $errors;
+ exit();
+ }
+
+ private function _loadToSession($type, $values) {
+ if($values) {
+ $this->session->set($type , $values);
+ }
+ }
+}
+
+?>
diff --git a/setup/firstlogin/firstloginUtil.php b/setup/firstlogin/firstloginUtil.php
new file mode 100644
index 0000000..9d1d895
--- /dev/null
+++ b/setup/firstlogin/firstloginUtil.php
@@ -0,0 +1,133 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+require_once("../wizard/installUtil.php");
+
+class firstloginUtil extends InstallUtil {
+ /**
+ * Check system
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return boolean
+ */
+ public function isSystem() {
+ if (file_exists(dirname(__FILE__)."/firstlogin")) {
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public function error($error) {
+ $template_vars['fl_type'] = strtoupper(substr(INSTALL_TYPE,0,1)).substr(INSTALL_TYPE,1);
+ $template_vars['fl_version'] = $this->readVersion();
+ $template_vars['error'] = $error;
+ $file = "templates/error.tpl";
+ if (file_exists($file)) {
+ extract($template_vars); // Extract the vars to local namespace
+ ob_start();
+ include($file);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo $contents;
+ }
+ return false;
+ }
+
+ /**
+ * Check if system needs
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return mixed
+ */
+ public function checkStructurePermissions() {
+ // Check if Wizard Directory is writable
+ if(!$this->_checkPermission(WIZARD_DIR)) {
+ return 'firstlogin';
+ }
+
+ return true;
+ }
+
+ public function loadInstallServices() {
+ require_once("../wizard/steps/services.php");
+ $s = new services();
+ return $s->getServices();
+ }
+
+ public function loadInstallService($serviceName) {
+ require_once("../wizard/lib/services/service.php");
+ require_once("../wizard/lib/services/".OS."Service.php");
+ require_once("../wizard/lib/services/$serviceName.php");
+ return new $serviceName();
+ }
+
+ /**
+ * Return port of the old installation
+ *
+ * @param location
+ * @return string
+ */
+ public function getPort($location) {
+ if(WINDOWS_OS) {
+ $myIni = "my.ini";
+ } else {
+ $myIni = "my.cnf";
+ }
+ $dbConfigPath = $location.DS."mysql".DS."$myIni";
+ if(file_exists($dbConfigPath)) {
+ $this->iniUtilities->load($dbConfigPath);
+ $dbSettings = $this->iniUtilities->getSection('mysqladmin');
+ return $dbSettings['port'];
+ }
+
+ return '3306';
+ }
+}
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/firstloginWizard.php b/setup/firstlogin/firstloginWizard.php
new file mode 100644
index 0000000..99eb47b
--- /dev/null
+++ b/setup/firstlogin/firstloginWizard.php
@@ -0,0 +1,183 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+
+require_once("../wizard/share/wizardBase.php");
+
+class firstloginWizard extends WizardBase {
+ /**
+ * Constructs wizard object
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ */
+ public function __construct(){}
+
+ /**
+ * Check if system
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @param none
+ * @return boolean
+ */
+ private function isSystem() {
+ return $this->util->isSystem();
+ }
+
+ /**
+ * Display the wizard
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @param string
+ * @return void
+ */
+ public function display($response = null) {
+ if($response) {
+ $ins = new FirstLogin(); // Instantiate
+ $ins->resolveErrors($response); // Run step
+ } else {
+ $ins = new FirstLogin(new Session()); // Instantiate and pass the session class
+ $ins->step(); // Run step
+ }
+ }
+
+ /**
+ * Create file
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @param none
+ * @return void
+ */
+ private function createFile() {
+ touch(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock");
+ }
+
+ /**
+ * Remove file
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @param none
+ * @return void
+ */
+ private function removeFile() {
+ unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock");
+ }
+
+ /**
+ * Load default values
+ *
+ * @author KnowledgeTree Team
+ * @access private
+ * @param none
+ * @return void
+ */
+ function load() {
+ if(isset($_GET['bypass'])) {
+ $this->setBypass($_GET['bypass']);
+ }
+ $this->setIUtil(new firstloginUtil());
+ }
+
+ /**
+ * Run pre system checks
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return mixed
+ */
+ public function systemChecks() {
+ $res = $this->util->checkStructurePermissions();
+ if($res === true) return $res;
+ switch ($res) {
+ case "wizard":
+ $this->util->error("firstlogin directory is not writable (KT_Installation_Directory/setup/firstlogin/)");
+ return 'firstlogin directory is not writable (KT_Installation_Directory/setup/firstlogin/)';
+ break;
+ case "/":
+ $this->util->error("System root is not writable (KT_Installation_Directory/)");
+ return "System root is not writable (KT_Installation_Directory/)";
+ break;
+ default:
+ return true;
+ break;
+ }
+ }
+
+ /**
+ * Control all requests to wizard
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return void
+ */
+ public function dispatch() {
+ $this->load();
+ if($this->getBypass() === "1") {
+ $this->removeFile();
+ } elseif ($this->getBypass() === "0") {
+ $this->createFile();
+ }
+ if(!$this->isSystem()) { // Check if the systems
+ $response = $this->systemChecks();
+ if($response === true) {
+ $this->display();
+ } else {
+ exit();
+ }
+ } else {
+ $this->util->error("System preferences run before. Finish ");
+ }
+ }
+}
+
+$ic = new firstloginWizard();
+$ic->dispatch();
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/index.php b/setup/firstlogin/index.php
new file mode 100644
index 0000000..73737ae
--- /dev/null
+++ b/setup/firstlogin/index.php
@@ -0,0 +1,48 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+$_GET['type'] = 'firstlogin';
+require_once("firstloginWizard.php");
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/session.php b/setup/firstlogin/session.php
new file mode 100644
index 0000000..b47f206
--- /dev/null
+++ b/setup/firstlogin/session.php
@@ -0,0 +1,62 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+class Session extends SessionBase
+{
+ public $salt = 'firstlogin';
+
+ /**
+ * Constructs session object
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ */
+ public function __construct() {
+ $this->setSalt($this->salt);
+ $this->startSession();
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/step.php b/setup/firstlogin/step.php
new file mode 100644
index 0000000..11010e4
--- /dev/null
+++ b/setup/firstlogin/step.php
@@ -0,0 +1,151 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package
+* @version Version 0.1
+*/
+class Step extends StepBase
+{
+ /**
+ * Flag if step needs
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var array
+ */
+ private $run = false;
+
+ public function __construct() {
+ $this->util = new firstloginUtil();
+ $this->salt = 'firstlogin';
+ }
+
+ /**
+ * Checks if Confirm button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ function firstlogin() {
+ if(isset($_POST['firstlogin'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if Confirm button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ function installer() {
+ if(isset($_POST['Install'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Load session data to post
+ *
+ * @author KnowledgeTree Team
+ * @params none
+ * @access private
+ * @return boolean
+ */
+ public function setDataFromSession($class) {
+ if(empty($_SESSION[$this->salt][$class])) {
+ return false;
+ }
+ $_POST = isset($_SESSION[$this->salt]['firstlogin'][$class]) ? $_SESSION[$this->salt]['firstlogin'][$class]: '';
+
+ return true;
+ }
+
+ /**
+ * Get session data from post
+ *
+ * @author KnowledgeTree Team
+ * @params none
+ * @access private
+ * @return boolean
+ */
+ public function getDataFromSession($class) {
+ if(empty($_SESSION[$this->salt][$class])) {
+ return false;
+ }
+
+ return $_SESSION[$this->salt][$class];
+ }
+
+ /**
+ * Runs step if required
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function Step() {
+ return '';
+ }
+
+ /**
+ * Return whether or not to a step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function run() {
+ return $this->run;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/stepAction.php b/setup/firstlogin/stepAction.php
new file mode 100644
index 0000000..47b0445
--- /dev/null
+++ b/setup/firstlogin/stepAction.php
@@ -0,0 +1,92 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+
+class stepAction extends stepActionBase {
+ /**
+ * Constructs step action object
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param string class name of the current step
+ */
+ public function __construct($step) {
+ $this->stepName = $step;
+ }
+
+ /**
+ * Instantiate a step.
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return object Step
+ */
+ public function createStep() {
+ $step_class = "firstlogin".$this->makeCamelCase($this->stepName);
+
+ return new $step_class();
+ }
+
+ /**
+ * Returns step tenplate content
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+
+ public function getVars() {
+ $left = $this->getLeftMenu();
+ $vars['left'] = $left; // Set left menu
+ $vars['fl_version'] = $this->properties['fl_version']; // Set version
+ $vars['fl_type'] = $this->properties['fl_type']; // Set type
+ return $vars;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/steps/fsComplete.php b/setup/firstlogin/steps/fsComplete.php
new file mode 100644
index 0000000..8976547
--- /dev/null
+++ b/setup/firstlogin/steps/fsComplete.php
@@ -0,0 +1,81 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+
+class fsComplete extends Step {
+ /**
+ * Flag if step needs to run silently
+ *
+ * @access protected
+ * @var boolean
+ */
+ protected $silent = true;
+
+ /**
+ * Returns step state
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ function doStep() {
+ $this->temp_variables = array(
+ "step_name"=>"complete",
+ "silent"=>$this->silent);
+ return $this->doRun();
+ }
+
+ function doRun() {
+
+ return 'landing';
+ }
+
+
+
+ public function getErrors() {
+ return $this->error;
+ }
+}
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/steps/fsTemplates.php b/setup/firstlogin/steps/fsTemplates.php
new file mode 100644
index 0000000..a04edc7
--- /dev/null
+++ b/setup/firstlogin/steps/fsTemplates.php
@@ -0,0 +1,79 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+* Contributor( s): ______________________________________
+*/
+
+/**
+*
+* @copyright 2008-2010, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package First Login
+* @version Version 0.1
+*/
+
+class fsTemplates extends Step {
+ /**
+ * Flag if step needs to run silently
+ *
+ * @access protected
+ * @var boolean
+ */
+ protected $silent = true;
+
+ /**
+ * Returns step state
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ function doStep() {
+ $this->temp_variables = array(
+ "step_name"=>"folderstructures",
+ "silent"=>$this->silent);
+ return $this->doRun();
+ }
+
+ function doRun() {
+
+ return 'landing';
+ }
+
+ public function getErrors() {
+ return $this->error;
+ }
+}
+?>
\ No newline at end of file
diff --git a/setup/firstlogin/templates/complete.tpl b/setup/firstlogin/templates/complete.tpl
new file mode 100644
index 0000000..6fb0cd6
--- /dev/null
+++ b/setup/firstlogin/templates/complete.tpl
@@ -0,0 +1,9 @@
+
+ Apply A Folder Template to KnowledgeTree
+
+
+
+
+
+js('form.js'); } ?>
\ No newline at end of file
diff --git a/setup/firstlogin/templates/wizard.tpl b/setup/firstlogin/templates/wizard.tpl
new file mode 100644
index 0000000..8b8a071
--- /dev/null
+++ b/setup/firstlogin/templates/wizard.tpl
@@ -0,0 +1,53 @@
+
+
+
+
+ KnowledgeTree Installer
+ js('jquery.js'); ?>
+ js('jquery.form.js'); ?>
+ js('jquery.blockUI.js'); ?>
+ js('jquery.hotkeys.js'); ?>
+ js('wizard.js'); ?>
+ css('wizard.css'); ?>
+ css('firstlogin.css'); ?>
+ css('ie6.css'); ?>
+ css('ie7.css'); ?>
+ css('ie8.css'); ?>
+ css('community.css'); ?>
+
+
+
+
+
+
+
+
+
+
+
image('loading.gif', array("height"=>"32px", "width"=>"32px")); ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/setup/migrate/migrateWizard.php b/setup/migrate/migrateWizard.php
index 7efa205..d695513 100644
--- a/setup/migrate/migrateWizard.php
+++ b/setup/migrate/migrateWizard.php
@@ -43,49 +43,10 @@
* @package Migrater
* @version Version 0.1
*/
-include("../wizard/path.php"); // Paths
-/**
- * Auto loader to bind migrater package
- *
- * @param string $class
- * @return void
- */
-function __autoload($class) { // Attempt and autoload classes
- $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
- if ($class == "template") { // Load existing templating classes
- require_once("../wizard/template.php");
- require_once("../wizard/lib/helpers/htmlHelper.php");
- } else {
- if(file_exists(WIZARD_DIR."$class.php")) {
- require_once(WIZARD_DIR."$class.php");
- } elseif (file_exists(STEP_DIR."$class.php")) {
- require_once(STEP_DIR."$class.php");
- } elseif (file_exists(WIZARD_LIB."$class.php")) {
- require_once(WIZARD_LIB."$class.php");
- }
- }
-}
-
-class MigrateWizard {
- /**
- * Migrate bypass flag
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var mixed
- */
- protected $bypass = null;
-
- /**
- * Reference to migrater utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $util = null;
+require_once("../wizard/share/wizardBase.php");
+class MigrateWizard extends WizardBase {
/**
* Constructs migrateation wizard object
*
@@ -114,7 +75,7 @@ class MigrateWizard {
* @param string
* @return void
*/
- public function displayMigrater($response = null) {
+ public function display($response = null) {
if($response) {
$ins = new Migrater(); // Instantiate the migrater
$ins->resolveErrors($response); // Run step
@@ -125,54 +86,6 @@ class MigrateWizard {
}
/**
- * Set bypass flag
- *
- * @author KnowledgeTree Team
- * @access private
- * @param boolean
- * @return void
- */
- private function setBypass($bypass) {
- $this->bypass = $bypass;
- }
-
- /**
- * Set util reference
- *
- * @author KnowledgeTree Team
- * @access private
- * @param object migrater utility
- * @return void
- */
- private function setIUtil($util) {
- $this->util = $util;
- }
-
- /**
- * Get bypass flag
- *
- * @author KnowledgeTree Team
- * @access public
- * @param none
- * @return boolean
- */
- public function getBypass() {
- return $this->bypass;
- }
-
- /**
- * Bypass and force an migrate
- *
- * @author KnowledgeTree Team
- * @access private
- * @param none
- * @return boolean
- */
- private function bypass() {
-
- }
-
- /**
* Create migrate file
*
* @author KnowledgeTree Team
@@ -181,7 +94,7 @@ class MigrateWizard {
* @return void
*/
private function createMigrateFile() {
- touch("migrate");
+ touch(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock");
}
/**
@@ -193,7 +106,7 @@ class MigrateWizard {
* @return void
*/
private function removeMigrateFile() {
- unlink("migrate");
+ unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."migrate.lock");
}
/**
@@ -255,7 +168,7 @@ class MigrateWizard {
if(!$this->isSystemMigrated()) { // Check if the systems not migrated
$response = $this->systemChecks();
if($response === true) {
- $this->displayMigrater();
+ $this->display();
} else {
exit();
}
diff --git a/setup/migrate/migrater.php b/setup/migrate/migrater.php
index 5a3cdc6..ece441c 100644
--- a/setup/migrate/migrater.php
+++ b/setup/migrate/migrater.php
@@ -557,12 +557,7 @@ class Migrater {
$util = new MigrateUtil();
$util->redirect('../wizard/index.php?step_name=installtype');
break;
-// case 'binstall':
-// $util = new MigrateUtil();
-// $util->redirect('../wizard/index.php?step_name=dependencies');
-// break;
default:
- // TODO : handle silent
$this->_landing();
break;
}
diff --git a/setup/migrate/session.php b/setup/migrate/session.php
index d6ad6d2..7486e85 100644
--- a/setup/migrate/session.php
+++ b/setup/migrate/session.php
@@ -42,9 +42,10 @@
* @package Migrater
* @version Version 0.1
*/
-class Session
+class Session extends SessionBase
{
- private $salt = 'migrate';
+ public $salt = 'migrate';
+
/**
* Constructs session object
*
@@ -53,175 +54,9 @@ class Session
* @param none
*/
public function __construct() {
+ $this->setSalt($this->salt);
$this->startSession();
}
-
- /**
- * Starts a session if one does not exist
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function startSession() {
- if(!isset($_SESSION[$this->salt]['ready'])) {
- @session_start();
- $_SESSION[$this->salt] ['ready'] = TRUE;
- }
- }
- /**
- * Sets a value key pair in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function set($fld, $val) {
- $this->startSession();
- $_SESSION[$this->salt] [$fld] = $val;
- }
-
- /**
- * Sets a value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClass($class , $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Sets a error value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClassError($class, $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Clear error values in a class session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function clearErrors($class) {
- $classArray = $this->get($class);
- unset($classArray['errors']);
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Unset a value in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return void
- */
- public function un_set($fld) {
- $this->startSession();
- unset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Unset a class value in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @access public
- * @return void
- */
- public function un_setClass($class) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$class]))
- unset($_SESSION[$this->salt] [$class]);
- }
-
- /**
- * Destroy the session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function destroyMigrate() {
- $this->startSession();
- unset($_SESSION[$this->salt]);
- session_destroy();
- }
-
- /**
- * Get a session value
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function get($fld) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$fld]))
- return $_SESSION[$this->salt] [$fld];
- return false;
- }
-
- /**
- * Check if a field exists in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function is_set($fld) {
- $this->startSession();
- return isset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Return a class from session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function getClass($class) {
- return $_SESSION[$this->salt][$class];
- }
}
?>
\ No newline at end of file
diff --git a/setup/migrate/step.php b/setup/migrate/step.php
index bc22695..ef01406 100644
--- a/setup/migrate/step.php
+++ b/setup/migrate/step.php
@@ -42,231 +42,23 @@
* @package Migrater
* @version Version 0.1
*/
-class Step
+class Step extends StepBase
{
/**
- * List of variables to be loaded to template
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $temp_variables = array();
-
- /**
- * List of errors encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $error = array();
-
- /**
- * List of warnings encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $warnings = array();
-
- /**
- * Flag to store class information in session
- *
- * @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $storeInSession = false;
-
- /**
* Flag if step needs to be migrated
*
* @author KnowledgeTree Team
* @access public
* @var array
*/
- protected $runMigrate = false;
-
- /**
- * Step order
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- protected $order = false;
-
- /**
- * Flag if step needs to run silently
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- protected $silent = false;
-
- public $displayFirst = false;
-
- private $salt = 'migrate';
-
- /**
- * Reference to utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object
- */
- public $util;
+ private $runMigrate = false;
public function __construct() {
$this->util = new MigrateUtil();
+ $this->salt = 'migrate';
}
/**
- * Returns step state
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doStep()
- {
- return '';
- }
-
- public function displayFirst() {
- return $this->displayFirst;
- }
-
- /**
- * Returns step variables
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getStepVars()
- {
- return $this->temp_variables;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getErrors() {
- return $this->error;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getWarnings() {
- return $this->warnings;
- }
-
- /**
- * Load default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function loadDefaults() {
-
- }
-
- /**
- * Return default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getDefaults() {
- return array();
- }
-
- /**
- * Checks if edit button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function edit() {
- if(isset($_POST['Edit'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if next button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function next() {
- if(isset($_POST['Next'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if previous button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function previous() {
- if(isset($_POST['Previous'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if Confirm button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- function confirm() {
- if(isset($_POST['Confirm'])) {
- return true;
- }
-
- return false;
- }
-
- /**
* Checks if Confirm button has been clicked
*
* @author KnowledgeTree Team
@@ -297,20 +89,6 @@ class Step
return false;
}
- /**
- * Checks if we are currently in this class step
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return boolean
- */
- public function inStep($name) {
- if(!isset($_GET['step_name'])) return false;
- if($_GET['step_name'] == $name)
- return true;
- return false;
- }
/**
* Load session data to post
@@ -346,30 +124,6 @@ class Step
}
/**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostSafe($key) {
- return isset($_POST[$key]) ? $_POST[$key] : "";
- }
-
- /**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostBoolean($key) {
- return isset($_POST[$key]) ? $_POST[$key] : false;
- }
-
- /**
* Runs step migrate if required
*
* @author KnowledgeTree Team
@@ -382,18 +136,6 @@ class Step
}
/**
- * Return whether or not to store a step information in session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function storeInSession() {
- return $this->storeInSession;
- }
-
- /**
* Return whether or not to a step has to be migrated
*
* @author KnowledgeTree Team
@@ -403,49 +145,7 @@ class Step
*/
public function runMigrate() {
return $this->runMigrate;
- }
-
- public function setPostConfig() {
- return '';
- }
-
- /**
- * Return whether or not to a step has to be in silent mode
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function silentMode() {
- return $this->silent;
- }
-
- /**
- * Set step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function setErrors($error) {
- $this->error = $error;
- }
-
- /**
- * Is the installation
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function isCe() {
- if($this->util->getVersionType() == "community")
- return true;
- return false;
- }
+ }
}
?>
\ No newline at end of file
diff --git a/setup/migrate/stepAction.php b/setup/migrate/stepAction.php
index 36ee00e..bc4ba5e 100644
--- a/setup/migrate/stepAction.php
+++ b/setup/migrate/stepAction.php
@@ -44,70 +44,7 @@
* @version Version 0.1
*/
-class stepAction {
- /**
- * Step class name
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $stepName = '';
-
- /**
- * Step names for classes
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $stepClassNames = array();
-
- /**
- * Flag if step needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayConfirm = false;
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayFirst = false;
-
- /**
- * List of migrate properties
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $migrateProperties = array();
-
- /**
- * Reference to session object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object Session
- */
- protected $session = null;
-
- /**
- * Reference to current step object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object class Step
- */
- protected $action = null;
-
+class stepAction extends stepActionBase {
/**
* Constructs step action object
*
@@ -120,129 +57,6 @@ class stepAction {
}
/**
- * Helper to initialize step actions
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $migrateProperties) {
- $this->setSteps($steps);
- $this->setStepNames($stepNames);
- $this->setDisplayConfirm($stepConfirmation);
- $this->setDisplayFirst($stepDisplayFirst);
- $this->loadSession($session);
- $this->setMigrateProperties($migrateProperties);
- }
-
- /**
- * Sets steps class names in string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setSteps($stepClassNames) {
- $this->stepClassNames = $stepClassNames;
- }
-
- /**
- * Sets steps in human readable string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setStepNames($step_names) {
- $this->step_names = $step_names;
- }
-
- /**
- * Sets confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayConfirm($displayConfirm) {
- $this->displayConfirm = $displayConfirm;
- }
-
- /**
- * Sets confirmation page first flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayFirst($displayFirst) {
- $this->displayFirst = $displayFirst;
- }
-
- /**
- * Sets session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return void
- */
- public function loadSession($ses) {
- $this->session = $ses;
- }
-
- /**
- * Sets migrate properties
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setMigrateProperties($migrateProperties) {
- $this->migrateProperties = $migrateProperties;
- }
-
- /**
- * Main control to handle the steps actions
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doAction() {
- if($this->stepName != '') {
- $this->action = $this->createStep();
- if(!$this->action) {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class Files Missing in Step Directory');
- }
- $response = $this->action->doStep();
- if($this->action->storeInSession()) { // Check if class values need to be stored in session
- $this->_loadStepToSession($this->stepName); // Send class to session
- }
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class File Missing in Step Directory');
-
- }
- if ($response == 'error') {
- $this->_handleErrors(); // Send Errors to session
- } else {
- $this->_clearErrors($this->stepName); // Send Errors to session
- }
- return $response;
- }
-
- /**
* Instantiate a step.
*
* @author KnowledgeTree Team
@@ -257,127 +71,6 @@ class stepAction {
}
/**
- * Converts string to camel case
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeCamelCase($str) {
- $upper=ucwords($str);
- $str=str_replace('_', '', $upper);
-
- return $str;
- }
-
- /**
- * Converts string to human readable heading
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeHeading($str) {
- $str = str_replace('_', ' ', $str);
- $str = ucwords($str);
-
- return $str;
- }
-
- /**
- * Returns current step name
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getCurrentStepName() {
- if($this->stepName != 'errors')
- return $this->step_names[$this->stepName];
- return '';
- }
-
- /**
- * Returns left menu
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getLeftMenu()
- {
- $sideMenuElements = array();
- $active = false;
- if($this->stepClassNames) {
- $ele = array();
- foreach ($this->stepClassNames as $k=>$step) {
- $ele['step'] = $step;
- if($this->step_names[$step] != '') {
- $ele['name'] = $this->step_names[$step];
- } else {
- $ele['name'] = $this->makeHeading($step);
- }
- if($step == $this->stepName) {
- $ele['class'] = 'current';
- $active = true;
- } else {
- if($active) {
- $ele['class'] = 'inactive';
- } else {
- $ele['class'] = 'indicator';
- }
- }
- $sideMenuElements[] = $ele;
- }
- }
- $step_tpl = new Template("..".DS."wizard".DS."templates".DS."sidemenu.tpl"); // Create template
- $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements
- $step_tpl->set("ajax", AJAX); // Set ajax state
-
- return $step_tpl->fetch();
- }
-
- /**
- * Returns confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayConfirm() {
- return $this->displayConfirm;
- }
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayFirst() {
- return $this->displayFirst;
- }
-
- /**
- * Returns session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return object
- */
- public function getSession() {
- return $this->session;
- }
-
- /**
* Returns step tenplate content
*
* @author KnowledgeTree Team
@@ -385,154 +78,15 @@ class stepAction {
* @access public
* @return string
*/
- public function paintAction() {
- $step_errors = $this->action->getErrors(); // Get errors
- $step_warnings = $this->action->getWarnings(); // Get warnings
- if($this->displayConfirm()) { // Check if theres a confirm step
- $template = "templates/{$this->stepName}_confirm.tpl";
- } else {
- if($this->displayFirst()) {
- $template = "templates/{$this->stepName}_confirm.tpl";
- } else {
- $template = "templates/{$this->stepName}.tpl";
- }
- }
- $step_tpl = new Template($template);
- $step_tpl->set("errors", $step_errors); // Set template errors
- $step_tpl->set("warnings", $step_warnings); // Set template warnings
- $step_vars = $this->action->getStepVars(); // Get template variables
- $step_tpl->set("step_vars", $step_vars); // Set template errors
- $this->loadToSes($step_vars);
- $this->loadToTpl($step_tpl, $step_vars);
- // TODO: Force because it does not always recognize ajax request
- if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
- echo $step_tpl->fetch();
- } else {
- $content = $step_tpl->fetch();
- $tpl = new Template("templates/wizard.tpl");
- $vars = $this->getVars(); // Get template variables
- $tpl->set("vars", $vars); // Set template errors
- $tpl->set('content', $content);
- echo $tpl->fetch();
- }
- }
-
- public function loadToSes($step_vars) {
- if($this->action->storeInSession()) { // Check if class values need to be stored in session
- foreach ($step_vars as $key => $value) { // Set template variables
- $this->_loadValueToSession($this->stepName, $key, $value);
- }
- }
- }
-
- public function loadToTpl($step_tpl, $step_vars) {
- foreach ($step_vars as $key => $value) { // Set template variables
- $step_tpl->set($key, $value); // Load values to session
- }
- }
public function getVars() {
$left = $this->getLeftMenu();
$vars['left'] = $left; // Set left menu
- $vars['migrate_version'] = $this->migrateProperties['migrate_version']; // Set version
- $vars['migrate_type'] = $this->migrateProperties['migrate_type']; // Set type
+ $vars['migrate_version'] = $this->properties['migrate_version']; // Set version
+ $vars['migrate_type'] = $this->properties['migrate_type']; // Set type
return $vars;
}
- /**
- * Load class to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param array $v array of values
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadStepToSession($class, $v = array(), $overwrite = false) {
- if($this->session != null) {
- if($overwrite) {
- $this->session->set($class , $v);
- } else {
- if(!$this->session->is_set($class))
- $this->session->set($class , $v);
- }
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load class value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadValueToSession($class, $k, $v) {
- if($this->session != null) {
- $this->session->setClass($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _handleErrors() {// TODO: handle multiple errors
- $step_errors = $this->action->getErrors(); // Get errors
- foreach ($step_errors as $key => $value) {
- $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session
- }
- }
-
- /**
- * Remove all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _clearErrors($class) {
- if($this->session) {
- $this->session->clearErrors($class);
- }
- }
- /**
- * Load class error value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadErrorToSession($class, $k = "errors", $v) {
- if($this->session != null) {
- $this->session->setClassError($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
}
?>
\ No newline at end of file
diff --git a/setup/upgrade/session.php b/setup/upgrade/session.php
index 2ceba20..f407140 100644
--- a/setup/upgrade/session.php
+++ b/setup/upgrade/session.php
@@ -42,9 +42,10 @@
* @package Upgrader
* @version Version 0.1
*/
-class session
+class Session extends SessionBase
{
- private $salt = 'upgrade';
+ public $salt = 'upgrade';
+
/**
* Constructs session object
*
@@ -53,175 +54,9 @@ class session
* @param none
*/
public function __construct() {
+ $this->setSalt($this->salt);
$this->startSession();
}
- /**
- * Starts a session if one does not exist
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function startSession() {
- if(!isset($_SESSION[$this->salt]['ready'])) {
- @session_start();
- $_SESSION[$this->salt] ['ready'] = TRUE;
- }
- }
-
- /**
- * Sets a value key pair in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function set($fld, $val) {
- $this->startSession();
- $_SESSION[$this->salt] [$fld] = $val;
- }
-
- /**
- * Sets a value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClass($class , $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Sets a error value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClassError($class, $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Clear error values in a class session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function clearErrors($class) {
- $classArray = $this->get($class);
- unset($classArray['errors']);
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Unset a value in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return void
- */
- public function un_set($fld) {
- $this->startSession();
- unset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Unset a class value in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @access public
- * @return void
- */
- public function un_setClass($class) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$class]))
- unset($_SESSION[$this->salt] [$class]);
- }
-
- /**
- * Destroy the session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function destroy() {
- $this->startSession();
- unset($_SESSION[$this->salt]);
- session_destroy();
- }
-
- /**
- * Get a session value
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function get($fld) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$fld]))
- return $_SESSION[$this->salt] [$fld];
- return false;
- }
-
- /**
- * Check if a field exists in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function is_set($fld) {
- $this->startSession();
- return isset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Return a class from session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function getClass($class) {
- return $_SESSION[$this->salt][$class];
- }
}
?>
\ No newline at end of file
diff --git a/setup/upgrade/step.php b/setup/upgrade/step.php
index 46674c3..22ddbe5 100644
--- a/setup/upgrade/step.php
+++ b/setup/upgrade/step.php
@@ -43,79 +43,20 @@
* @version Version 0.1
*/
-require_once("../wizard/steps/configuration.php"); // configuration to read the ini path
-
-class Step
+class Step extends StepBase
{
/**
- * List of variables to be loaded to template
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $temp_variables = array();
-
- /**
- * List of errors encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $error = array();
-
- /**
- * List of warnings encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $warnings = array();
-
- /**
- * Flag to store class information in session
- *
- * @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $storeInSession = false;
-
- /**
* Flag if step needs to be upgraded
*
* @author KnowledgeTree Team
* @access public
* @var array
*/
- protected $runUpgrade = false;
-
- /**
- * Step order
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- protected $order = false;
-
- /**
- * Flag if step needs to run silently
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- protected $silent = false;
-
- public $displayFirst = false;
-
- private $salt = 'upgrade';
+ private $runUpgrade = false;
public function __construct() {
$this->util = new UpgradeUtil();
+ $this->salt = 'upgrade';
}
/**
@@ -137,134 +78,6 @@ class Step
return '';
}
- public function displayFirst() {
- return $this->displayFirst;
- }
-
- /**
- * Returns step variables
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getStepVars()
- {
- return $this->temp_variables;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getErrors() {
- return $this->error;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getWarnings() {
- return $this->warnings;
- }
-
- /**
- * Load default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function loadDefaults() {
-
- }
-
- /**
- * Return default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getDefaults() {
- return array();
- }
-
- /**
- * Checks if edit button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function edit() {
- if(isset($_POST['Edit'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if next button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function next() {
- if(isset($_POST['Next'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if previous button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function previous() {
- if(isset($_POST['Previous'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if Confirm button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- function confirm() {
- if(isset($_POST['Confirm'])) {
- return true;
- }
-
- return false;
- }
/**
* Checks if Upgrade button has been clicked
@@ -291,21 +104,6 @@ class Step
}
/**
- * Checks if we are currently in this class step
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return boolean
- */
- public function inStep($name) {
- if(!isset($_GET['step_name'])) return false;
- if($_GET['step_name'] == $name)
- return true;
- return false;
- }
-
- /**
* Load session data to post
*
* @author KnowledgeTree Team
@@ -339,30 +137,6 @@ class Step
}
/**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostSafe($key) {
- return isset($_POST[$key]) ? $_POST[$key] : "";
- }
-
- /**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostBoolean($key) {
- return isset($_POST[$key]) ? $_POST[$key] : false;
- }
-
- /**
* Runs step upgrade if required
*
* @author KnowledgeTree Team
@@ -375,18 +149,6 @@ class Step
}
/**
- * Return whether or not to store a step information in session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function storeInSession() {
- return $this->storeInSession;
- }
-
- /**
* Return whether or not to a step has to be upgraded
*
* @author KnowledgeTree Team
@@ -398,51 +160,8 @@ class Step
return $this->runUpgrade;
}
- public function setPostConfig() {
- return '';
- }
-
- /**
- * Return whether or not to a step has to be in silent mode
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function silentMode() {
- return $this->silent;
- }
-
- /**
- * Set step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function setErrors($error) {
- $this->error = $error;
- }
-
- /**
- * Get session data from package
- *
- * @author KnowledgeTree Team
- * @params none
- * @access private
- * @return boolean
- */
- public function getDataFromPackage($package, $class) {
- if(empty($_SESSION[$package][$class])) {
- return false;
- }
-
- return $_SESSION[$package][$class];
- }
-
protected function readConfig() {
+ require_once("../wizard/steps/configuration.php"); // TODO
$wizConfigHandler = new configuration();
$path = $wizConfigHandler->readConfigPathIni();
$this->util->iniUtilities->load($path);
@@ -474,25 +193,7 @@ class Step
}
return false;
- }
-
- protected function storeSilent() {
-
- }
-
- /**
- * Is the installation
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function isCe() {
- if($this->util->getVersionType() == "community")
- return true;
- return false;
- }
+ }
}
?>
\ No newline at end of file
diff --git a/setup/upgrade/stepAction.php b/setup/upgrade/stepAction.php
index facab2c..98e263f 100644
--- a/setup/upgrade/stepAction.php
+++ b/setup/upgrade/stepAction.php
@@ -44,70 +44,7 @@
* @version Version 0.1
*/
-class stepAction {
- /**
- * Step class name
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $stepName = '';
-
- /**
- * Step names for classes
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $stepClassNames = array();
-
- /**
- * Flag if step needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayConfirm = false;
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayFirst = false;
-
- /**
- * List of upgrade properties
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $upgradeProperties = array();
-
- /**
- * Reference to session object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object Session
- */
- protected $session = null;
-
- /**
- * Reference to current step object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object class Step
- */
- protected $action = null;
-
+class stepAction extends stepActionBase {
/**
* Constructs step action object
*
@@ -118,130 +55,8 @@ class stepAction {
public function __construct($step) {
$this->stepName = $step;
}
-
- /**
- * Helper to initialize step actions
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $upgradeProperties) {
- $this->setSteps($steps);
- $this->setStepNames($stepNames);
- $this->setDisplayConfirm($stepConfirmation);
- $this->setDisplayFirst($stepDisplayFirst);
- $this->loadSession($session);
- $this->setUpgradeProperties($upgradeProperties);
- }
-
- /**
- * Sets steps class names in string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setSteps($stepClassNames) {
- $this->stepClassNames = $stepClassNames;
- }
-
- /**
- * Sets steps in human readable string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setStepNames($step_names) {
- $this->step_names = $step_names;
- }
-
- /**
- * Sets confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayConfirm($displayConfirm) {
- $this->displayConfirm = $displayConfirm;
- }
-
- /**
- * Sets confirmation page first flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayFirst($displayFirst) {
- $this->displayFirst = $displayFirst;
- }
-
- /**
- * Sets session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return void
- */
- public function loadSession($ses) {
- $this->session = $ses;
- }
-
- /**
- * Sets upgrade properties
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setUpgradeProperties($upgradeProperties) {
- $this->upgradeProperties = $upgradeProperties;
- }
/**
- * Main control to handle the steps actions
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doAction() {
- if($this->stepName != '') {
- $this->action = $this->createStep();
- if(!$this->action) {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class Files Missing in Step Directory');
- }
- $response = $this->action->doStep();
- if($this->action->storeInSession()) { // Check if class values need to be stored in session
- $this->_loadStepToSession($this->stepName); // Send class to session
- }
- if ($response == 'error') {
- $this->_handleErrors(); // Send Errors to session
- } else {
- $this->_clearErrors($this->stepName); // Send Errors to session
- }
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class File Missing in Step Directory');
- }
- return $response;
- }
-
- /**
* Instantiate a step.
*
* @author KnowledgeTree Team
@@ -256,124 +71,6 @@ class stepAction {
}
/**
- * Converts string to camel case
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeCamelCase($str) {
- $upper=ucwords($str);
- $str=str_replace('_', '', $upper);
-
- return $str;
- }
-
- /**
- * Converts string to human readable heading
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeHeading($str) {
- $str = str_replace('_', ' ', $str);
- $str = ucwords($str);
-
- return $str;
- }
-
- /**
- * Returns current step name
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getCurrentStepName() {
- if($this->stepName != 'errors')
- return $this->step_names[$this->stepName];
- return '';
- }
-
- /**
- * Returns left menu
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getLeftMenu()
- {
- $menu = '';
- $active = false;
- if($this->stepClassNames) {
- foreach ($this->stepClassNames as $step) {
- if($this->step_names[$step] != '') {
- $item = $this->step_names[$step];
- } else {
- $item = $this->makeHeading($step);
- }
- if($step == $this->stepName) {
- $class = 'current';
- $active = true;
- } else {
- if($active){
- $class = 'inactive';
- }else{
- $class = 'indicator';
- $item = "{$item} ";
- }
- }
-
- $menu .= "$item ";
- }
- }
-// $menu .= '';
- return $menu;
- }
-
- /**
- * Returns confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayConfirm() {
- return $this->displayConfirm;
- }
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayFirst() {
- return $this->displayFirst;
- }
-
- /**
- * Returns session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return object
- */
- public function getSession() {
- return $this->session;
- }
-
- /**
* Returns step tenplate content
*
* @author KnowledgeTree Team
@@ -381,8 +78,7 @@ class stepAction {
* @access public
* @return string
*/
- public function paintAction() {
-
+ public function paintAction() {
$step_errors = $this->action->getErrors(); // Get errors
$step_warnings = $this->action->getWarnings(); // Get warnings
if($this->displayConfirm()) { // Check if theres a confirm step
@@ -416,105 +112,12 @@ class stepAction {
public function getVars() {
$left = $this->getLeftMenu();
$vars['left'] = $left; // Set left menu
- $vars['upgrade_version'] = $this->upgradeProperties['upgrade_version']; // Set version
- $vars['upgrade_type'] = $this->upgradeProperties['upgrade_type']; // Set type
+ $vars['upgrade_version'] = $this->properties['upgrade_version']; // Set version
+ $vars['upgrade_type'] = $this->properties['upgrade_type']; // Set type
return $vars;
}
- /**
- * Load class to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param array $v array of values
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadStepToSession($class, $v = array(), $overwrite = false) {
- if($this->session != null) {
- if($overwrite) {
- $this->session->set($class , $v);
- } else {
- if(!$this->session->is_set($class))
- $this->session->set($class , $v);
- }
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load class value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadValueToSession($class, $k, $v) {
- if($this->session != null) {
- $this->session->setClass($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _handleErrors() {// TODO: handle multiple errors
- $step_errors = $this->action->getErrors(); // Get errors
- foreach ($step_errors as $key => $value) {
- $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session
- }
- }
- /**
- * Remove all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _clearErrors($class) {
- if($this->session) {
- $this->session->clearErrors($class);
- }
- }
- /**
- * Load class error value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadErrorToSession($class, $k = "errors", $v) {
- if($this->session != null) {
- $this->session->setClassError($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
}
?>
\ No newline at end of file
diff --git a/setup/upgrade/upgradeWizard.php b/setup/upgrade/upgradeWizard.php
index d4f5bf4..e309dd4 100644
--- a/setup/upgrade/upgradeWizard.php
+++ b/setup/upgrade/upgradeWizard.php
@@ -43,50 +43,10 @@
* @package Upgrader
* @version Version 0.1
*/
-include("../wizard/path.php"); // Paths
-/**
- * Auto loader to bind upgrader package
- *
- * @param string $class
- * @return void
- */
-function __autoload($class) { // Attempt and autoload classes
- $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
- if ($class == "template") { // Load existing templating classes
- require_once(WIZARD_DIR."../wizard/template.php");
- require_once(WIZARD_DIR."../wizard/lib/helpers/htmlHelper.php");
- }
- if(file_exists(WIZARD_DIR."$class.php")) {
- require_once(WIZARD_DIR."$class.php");
- } elseif (file_exists(STEP_DIR."$class.php")) {
- require_once(STEP_DIR."$class.php");
- } elseif (file_exists(WIZARD_LIB."$class.php")) {
- require_once(WIZARD_LIB."$class.php");
- } else {
- return null;
- }
-}
-
-class UpgradeWizard {
- /**
- * Upgrade bypass flag
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var mixed
- */
- protected $bypass = null;
-
- /**
- * Reference to upgrader utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $util = null;
+require_once("../wizard/share/wizardBase.php");
+class UpgradeWizard extends WizardBase {
/**
* Constructs upgradeation wizard object
*
@@ -96,18 +56,6 @@ class UpgradeWizard {
public function __construct(){}
/**
- * Check if system has been upgrade
- *
- * @author KnowledgeTree Team
- * @access private
- * @param none
- * @return boolean
- */
- private function isSystemUpgraded() {
- return $this->util->isSystemUpgraded();
- }
-
- /**
* Display the wizard
*
* @author KnowledgeTree Team
@@ -115,7 +63,7 @@ class UpgradeWizard {
* @param string
* @return void
*/
- public function displayUpgrader($response = null) {
+ public function display($response = null) {
if($response) {
$ins = new Upgrader(); // Instantiate the upgrader
$ins->resolveErrors($response); // Run step
@@ -126,30 +74,6 @@ class UpgradeWizard {
}
/**
- * Set bypass flag
- *
- * @author KnowledgeTree Team
- * @access private
- * @param boolean
- * @return void
- */
- private function setBypass($bypass) {
- $this->bypass = $bypass;
- }
-
- /**
- * Set util reference
- *
- * @author KnowledgeTree Team
- * @access private
- * @param object upgrader utility
- * @return void
- */
- private function setIUtil($util) {
- $this->util = $util;
- }
-
- /**
* Remove upgrade file
*
* @author KnowledgeTree Team
@@ -182,9 +106,6 @@ class UpgradeWizard {
* @return mixed
*/
public function systemChecks() {
- // for now we don't write to any of these locations
- return true;
-
$res = $this->util->checkStructurePermissions();
if($res === true) return $res;
switch ($res) {
@@ -221,7 +142,7 @@ class UpgradeWizard {
$this->util->redirect('../../login.php');
}
if($response === true) {
- $this->displayUpgrader();
+ $this->display();
} else {
exit();
}
diff --git a/setup/upgrade/upgradedbUtil.php b/setup/upgrade/upgradedbUtil.php
index 723870a..1c74625 100644
--- a/setup/upgrade/upgradedbUtil.php
+++ b/setup/upgrade/upgradedbUtil.php
@@ -105,7 +105,6 @@ class UpgradedbUtil {
* @access public
*/
public function __construct() {
-
}
public function load($dhost = 'localhost', $duname, $dpassword, $dbname) {
diff --git a/setup/upgrade/upgrader.php b/setup/upgrade/upgrader.php
index f5c34cb..fa265d7 100644
--- a/setup/upgrade/upgrader.php
+++ b/setup/upgrade/upgrader.php
@@ -44,99 +44,7 @@
* @version Version 0.1
*/
-class Upgrader {
- /**
- * Reference to simple xml object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object SimpleXMLElement
- */
- protected $simpleXmlObj = null;
-
- /**
- * Reference to step action object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object StepAction
- */
- protected $stepAction = null;
-
- /**
- * Reference to session object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object Session
- */
- protected $session = null;
-
- /**
- * List of upgradeation steps as strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepClassNames = array();
-
- /**
- * List of upgradeation steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepNames = array();
-
- /**
- * List of upgradeation steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepObjects = array();
-
- /**
- * Order in which steps have to be upgraded
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $upgradeOrders = array();
-
- /**
- * List of upgradeation properties
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $upgradeProperties = array();
-
- /**
- * Flag if a step object needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $stepConfirmation = false;
-
- /**
- * Flag if a step object needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $stepDisplayFirst = false;
-
- private $upgraderAction = '';
-
+class Upgrader extends NavBase {
/**
* Constructs upgradeation object
*
@@ -156,7 +64,7 @@ class Upgrader {
* @access private
* @return object
*/
- private function _readXml($name = "config.xml") {
+ public function readXml($name = "config.xml") {
try {
$this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name");
} catch (Exception $e) {
@@ -167,215 +75,6 @@ class Upgrader {
}
/**
- * Checks if first step of upgrader
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function _firstStep() {
- if(isset($_GET['step_name'])) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Checks if first step of upgrader
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function _firstStepPeriod() {
- if(isset($_GET['step_name'])) {
- if($_GET['step_name'] != 'welcome')
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns next step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _getNextStep() {
- return $this->_getStepName(1);
- }
-
- /**
- * Returns previous step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _getPreviousStep() {
- return $this->_getStepName(-1);
- }
-
- /**
- * Returns the step name, given a position
- *
- * @author KnowledgeTree Team
- * @param integer $pos current position
- * @access private
- * @return string $name
- */
- private function _getStepName($pos = 0) {
- if($this->_firstStep()) {
- $step = (string) $this->simpleXmlObj->steps->step[0];
- } else {
- $pos += $this->getStepPosition();
- $step = (string) $this->simpleXmlObj->steps->step[$pos];
- }
-
- return $step;
- }
-
- /**
- * Executes next step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _proceed() {
- $step_name = $this->_getNextStep();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes previous step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _backward() {
- $step_name = $this->_getPreviousStep();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes step landing
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _landing() {
- $step_name = $this->_getStepName();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes step based on step class name
- *
- * @author KnowledgeTree Team
- * @param string $step_name
- * @access private
- * @return string
- */
- private function _runStepAction($stepName) {
- $this->stepAction = new stepAction($stepName);
- $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getUpgradeProperties());
-
- return $this->stepAction->doAction();
- }
-
- private function stepDisplayFirst() {
- if($this->upgraderAction == 'edit')
- return false; //
- $class = $this->stepAction->createStep(); // Get step class
- return $class->displayFirst(); // Check if class needs to display first
- }
-
- /**
- * Set steps class names in string format
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return array
- */
- private function _getUpgradeOrders() {
- return $this->upgradeOrders;
- }
-
- /**
- * Set steps as names
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsToArray() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step_name = (string) $d_step[0];
- $this->stepClassNames[] = $step_name;
- }
- $this->_loadToSession('stepClassNames', $this->stepClassNames);
- }
- }
-
- /**
- * Set steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsNames() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step_name = (string) $d_step[0];
- $this->stepNames[$step_name] = (string) $d_step['name'];
- }
- $this->_loadToSession('stepNames', $this->stepNames);
- }
- }
-
- /**
- * Set steps upgrade order
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsOrders() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- if(isset($d_step['order'])) {
- $step_name = (string) $d_step[0];
- $order = (string) $d_step['order'];
- $this->upgradeOrders[$order] = $step_name; // Store step upgrade order
- }
- }
- $this->_loadToSession('upgradeOrders', $this->upgradeOrders);
- }
- }
-
- /**
* Set upgrade properties
*
* @author KnowledgeTree Team
@@ -383,11 +82,11 @@ class Upgrader {
* @access private
* @return void
*/
- private function _xmlUpgradeProperties() {
+ public function xmlProperties() {
if(isset($this->simpleXmlObj)) {
- $this->upgradeProperties['upgrade_version'] = (string) $this->simpleXmlObj['version'];
- $this->upgradeProperties['upgrade_type'] = (string) $this->simpleXmlObj['type'];
- $this->_loadToSession('upgradeProperties', $this->upgradeProperties);
+ $this->properties['upgrade_version'] = (string) $this->simpleXmlObj['version'];
+ $this->properties['upgrade_type'] = (string) $this->simpleXmlObj['type'];
+ $this->loadToSession('upgradeProperties', $this->properties);
}
}
@@ -399,10 +98,10 @@ class Upgrader {
* @access private
* @return void
*/
- private function _runStepsUpgrades() {
- $steps = $this->_getUpgradeOrders();
+ public function runStepsUpgrades() {
+ $steps = $this->getOrders();
for ($i=1; $i< count($steps)+1; $i++) {
- $this->_upgradeHelper($steps[$i]);
+ $this->upgradeHelper($steps[$i]);
}
}
@@ -414,7 +113,7 @@ class Upgrader {
* @access private
* @return void
*/
- private function _upgradeHelper($className) {
+ public function upgradeHelper($className) {
$stepAction = new stepAction($className); // Instantiate a step action
$class = $stepAction->createStep(); // Get step class
if($class) { // Check if class Exists
@@ -430,75 +129,51 @@ class Upgrader {
}
}
- /**
- * Reset all session information on welcome landing
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _resetSessions() {
- if($this->session) {
- if($this->_firstStepPeriod()) {
- foreach ($this->getSteps() as $class) {
- $this->session->un_setClass($class);
- }
- foreach ($this->getStepNames() as $class) {
- $this->session->un_setClass($class);
- }
- foreach ($this->_getUpgradeOrders() as $class) {
- $this->session->un_setClass($class);
- }
- }
- }
- }
-
- function _loadFromSessions() {
+ function loadFromSessions() {
$this->stepClassNames = $this->session->get('stepClassNames');
if(!$this->stepClassNames) {
- $this->_xmlStepsToArray(); // String steps
+ $this->xmlStepsToArray(); // String steps
}
$this->stepNames = $this->session->get('stepNames');
if(!$this->stepNames) {
- $this->_xmlStepsNames();
+ $this->xmlStepsNames();
}
- $this->upgradeOrders = $this->session->get('upgradeOrders');
- if(!$this->upgradeOrders) {
- $this->_xmlStepsOrders();
+ $this->orders = $this->session->get('upgradeOrders');
+ if(!$this->orders) {
+ $this->xmlStepsOrders();
}
- $this->upgradeProperties = $this->session->get('upgradeProperties');
- if(!$this->upgradeProperties) {
- $this->_xmlUpgradeProperties();
+ $this->properties = $this->session->get('upgradeProperties');
+ if(!$this->properties) {
+ $this->xmlProperties();
}
}
- private function loadNeeded() {
- $this->_readXml(); // Xml steps
+ public function loadNeeded() {
+ $this->readXml(); // Xml steps
// Make sure session is cleared
- $this->_resetSessions();
- $this->_loadFromSessions();
+ $this->resetSessions();
+ $this->loadFromSessions();
if(isset($_POST['Next'])) {
- $this->upgraderAction = 'next';
+ $this->action = 'next';
$this->response = 'next';
} elseif (isset($_POST['Previous'])) {
- $this->upgraderAction = 'previous';
+ $this->action = 'previous';
$this->response = 'previous';
} elseif (isset($_POST['Confirm'])) {
- $this->upgraderAction = 'confirm';
+ $this->action = 'confirm';
$this->response = 'next';
} elseif (isset($_POST['Upgrade'])) {
- $this->upgraderAction = 'upgrade';
+ $this->action = 'upgrade';
$this->response = 'next';
} elseif (isset($_POST['Edit'])) {
- $this->upgraderAction = 'edit';
+ $this->action = 'edit';
$this->response = 'next';
} elseif (isset($_POST['Install'])) {
- $this->upgraderAction = 'install';
+ $this->action = 'install';
$this->response = 'install';
} else {
$this->response = '';
- $this->upgraderAction = '';
+ $this->action = '';
}
}
@@ -514,24 +189,24 @@ class Upgrader {
$this->loadNeeded();
switch($this->response) {
case 'next':
- $step_name = $this->_getStepName();
- $res = $this->_runStepAction($step_name);
+ $step_name = $this->getStepName();
+ $res = $this->runStepAction($step_name);
if($res == 'next') {
- $this->_proceed(); // Load next window
+ $this->proceed(); // Load next window
} elseif ($res == 'upgrade') {
- $this->_runStepsUpgraders(); // Load landing
- $this->_proceed(); // Load next window
+ $this->runStepsUpgraders(); // Load landing
+ $this->proceed(); // Load next window
} elseif ($res == 'confirm') {
if(!$this->stepDisplayFirst())
$this->stepConfirmation = true;
- $this->_landing();
+ $this->landing();
} elseif ($res == 'landing') {
- $this->_landing();
+ $this->landing();
} else {
}
break;
case 'previous':
- $this->_backward(); // Load previous page
+ $this->backward(); // Load previous page
break;
case 'install':
$util = new UpgradeUtil();
@@ -539,131 +214,11 @@ class Upgrader {
break;
default:
// TODO : handle silent
- $this->_landing();
+ $this->landing();
break;
}
$this->stepAction->paintAction(); // Display step
}
-
- /**
- * Returns the step number
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return integer $pos
- */
- public function getStepPosition() {
- $pos = 0;
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step = (string) $d_step;
- if ($step == $_GET['step_name']) {
- break;
- }
- $pos++;
- }
- if(isset($_GET['step'])) {
- if($_GET['step'] == "next")
- $pos = $pos+1;
- else
- $pos = $pos-1;
- }
-
- return $pos;
- }
-
- /**
- * Returns the step names for classes
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getSteps() {
- return $this->stepClassNames;
- }
-
- /**
- * Returns the steps as human readable string
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getStepNames() {
- return $this->stepNames;
- }
-
- /**
- * Returns whether or not a confirmation step is needed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function getStepConfirmation() {
- return $this->stepConfirmation;
- }
-
- /**
- * Return upgrade properties
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function getUpgradeProperties() {
- return $this->upgradeProperties;
- }
-
- /**
- * Returns session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function getSession() {
- return $this->session;
- }
-
- /**
- * Dump of SESSION
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function showSession() {
- echo '';
- print_r($_SESSION);
- echo ' ';
- }
-
- /**
- * Display errors that are not allowing the upgrader to operate
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function resolveErrors($errors) {
- echo $errors;
- exit();
- }
-
- private function _loadToSession($type, $values) {
- if($values) {
- $this->session->set($type , $values);
- }
- }
}
?>
diff --git a/setup/wizard/config/databases.xml b/setup/wizard/config/databases.xml
index 24a818b..b304b8a 100644
--- a/setup/wizard/config/databases.xml
+++ b/setup/wizard/config/databases.xml
@@ -15,8 +15,8 @@
3306
dms
root
- dmsadmin
+ ktcomadmin
js9281djw
- dms
+ ktcom-dms
djw9281js
diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php
index f9291ab..1fda2be 100644
--- a/setup/wizard/installWizard.php
+++ b/setup/wizard/installWizard.php
@@ -43,62 +43,9 @@
* @package Installer
* @version Version 0.1
*/
-include("path.php"); // Paths
-
-/**
- * Auto loader to bind installer package
- *
- * @param string $class
- * @return void
- */
-function __autoload($class) { // Attempt and autoload classes
- $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
- if(file_exists(WIZARD_DIR."$class.php")) {
- require_once(WIZARD_DIR."$class.php");
- } elseif (file_exists(STEP_DIR."$class.php")) {
- require_once(STEP_DIR."$class.php");
- } elseif (file_exists(WIZARD_LIB."$class.php")) {
- require_once(WIZARD_LIB."$class.php");
- } elseif (file_exists(SERVICE_LIB."$class.php")) {
- require_once(SERVICE_LIB."$class.php");
- } elseif (file_exists(VALID_DIR."$class.php")) {
- require_once(VALID_DIR."$class.php");
- } else {
- if(preg_match('/Helper/', $class)) {
- require_once(HELPER_DIR."$class.php");
- }
- }
- return false;
-}
-
-class InstallWizard {
- /**
- * Install bypass flag
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var mixed
- */
- protected $bypass = null;
-
- /**
- * Level of debugger
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var mixed
- */
- protected $debugLevel = 0;
-
- /**
- * Reference to installer utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $util = null;
+require_once("../wizard/share/wizardBase.php");
+class InstallWizard extends WizardBase {
/**
* Constructs installation wizard object
*
@@ -115,7 +62,7 @@ class InstallWizard {
* @param string
* @return void
*/
- public function displayInstaller($response = null) {
+ public function display($response = null) {
if($response) {
$ins = new Installer(); // Instantiate the installer
$ins->resolveErrors($response); // Run step
@@ -126,67 +73,6 @@ class InstallWizard {
}
/**
- * Set bypass flag
- *
- * @author KnowledgeTree Team
- * @access private
- * @param boolean
- * @return void
- */
- private function setBypass($bypass) {
- $this->bypass = $bypass;
- }
-
- /**
- * Set debug level
- *
- * @author KnowledgeTree Team
- * @access private
- * @param boolean
- * @return void
- */
- private function setDebugLevel($debug) {
- define('DEBUG', $debug);
- $this->debugLevel = $debug;
- }
-
- /**
- * Set util reference
- *
- * @author KnowledgeTree Team
- * @access private
- * @param object installer utility
- * @return void
- */
- private function setIUtil($util) {
- $this->util = $util;
- }
-
- /**
- * Get bypass flag
- *
- * @author KnowledgeTree Team
- * @access public
- * @param none
- * @return boolean
- */
- public function getBypass() {
- return $this->bypass;
- }
-
- /**
- * Bypass and force an install
- *
- * @author KnowledgeTree Team
- * @access private
- * @param none
- * @return boolean
- */
- private function bypass() {
-
- }
-
- /**
* Create install file
*
* @author KnowledgeTree Team
@@ -268,7 +154,7 @@ class InstallWizard {
public function dispatch() {
$this->load();
if($this->getBypass() === "1") { // Helper to force install
- $this->removeInstallFile(); // TODO: Remove
+ $this->removeInstallFile();
} elseif ($this->getBypass() === "0") {
$this->createInstallFile();
}
@@ -281,13 +167,13 @@ class InstallWizard {
if($this->util->loginSpecified()) { // Back to wizard from upgrader
$this->util->redirect('../../control.php');
} elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed
- $this->util->redirect('../migrate/index.php?');
+ $this->util->redirect('../migrate/index.php');
} elseif ($this->util->upgradeSpecified()) { // Check if the upgrader needs to be accessed
$this->util->redirect('../upgrade/index.php?action=installer');
}
$response = $this->systemChecks();
if($response === true) {
- $this->displayInstaller();
+ $this->display();
} else {
exit();
}
diff --git a/setup/wizard/installer.php b/setup/wizard/installer.php
index c684478..cf72d9d 100644
--- a/setup/wizard/installer.php
+++ b/setup/wizard/installer.php
@@ -44,99 +44,7 @@
* @version Version 0.1
*/
-class Installer {
- /**
- * Reference to simple xml object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object SimpleXMLElement
- */
- protected $simpleXmlObj = null;
-
- /**
- * Reference to step action object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object StepAction
- */
- protected $stepAction = null;
-
- /**
- * Reference to session object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object Session
- */
- protected $session = null;
-
- /**
- * List of installation steps as strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepClassNames = array();
-
- /**
- * List of installation steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepNames = array();
-
- /**
- * List of installation steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $stepObjects = array();
-
- /**
- * Order in which steps have to be installed
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $installOrders = array();
-
- /**
- * List of installation properties
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array string
- */
- protected $installProperties = array();
-
- /**
- * Flag if a step object needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $stepConfirmation = false;
-
- /**
- * Flag if a step object needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $stepDisplayFirst = false;
-
- private $installerAction = '';
-
+class Installer extends NavBase {
/**
* Constructs installation object
*
@@ -156,7 +64,7 @@ class Installer {
* @access private
* @return object
*/
- private function _readXml($name = "config.xml") {
+ public function readXml($name = "config.xml") {
try {
$this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name");
} catch (Exception $e) {
@@ -166,214 +74,6 @@ class Installer {
}
}
- /**
- * Checks if first step of installer
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function _firstStep() {
- if(isset($_GET['step_name'])) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Checks if first step of installer
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return boolean
- */
- private function _firstStepPeriod() {
- if(isset($_GET['step_name'])) {
- if($_GET['step_name'] != 'welcome')
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns next step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _getNextStep() {
- return $this->_getStepName(1);
- }
-
- /**
- * Returns previous step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _getPreviousStep() {
- return $this->_getStepName(-1);
- }
-
- /**
- * Returns the step name, given a position
- *
- * @author KnowledgeTree Team
- * @param integer $pos current position
- * @access private
- * @return string $name
- */
- private function _getStepName($pos = 0) {
- if($this->_firstStep()) {
- $step = (string) $this->simpleXmlObj->steps->step[0];
- } else {
- $pos += $this->getStepPosition();
- $step = (string) $this->simpleXmlObj->steps->step[$pos];
- }
-
- return $step;
- }
-
- /**
- * Executes next step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _proceed() {
- $step_name = $this->_getNextStep();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes previous step
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _backward() {
- $step_name = $this->_getPreviousStep();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes step landing
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return string
- */
- private function _landing() {
- $step_name = $this->_getStepName();
-
- return $this->_runStepAction($step_name);
- }
-
- /**
- * Executes step based on step class name
- *
- * @author KnowledgeTree Team
- * @param string $step_name
- * @access private
- * @return string
- */
- private function _runStepAction($stepName) {
- $this->stepAction = new stepAction($stepName);
- $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getInstallProperties());
-
- return $this->stepAction->doAction();
- }
-
- private function stepDisplayFirst() {
- if($this->installerAction == 'edit')
- return false; //
- $class = $this->stepAction->createStep(); // Get step class
- return $class->displayFirst(); // Check if class needs to display first
- }
-
- /**
- * Set steps class names in string format
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return array
- */
- private function _getInstallOrders() {
- return $this->installOrders;
- }
-
- /**
- * Set steps as names
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsToArray() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step_name = (string) $d_step[0];
- $this->stepClassNames[] = $step_name;
- }
- $this->_loadToSession('stepClassNames', $this->stepClassNames);
- }
- }
-
- /**
- * Set steps as human readable strings
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsNames() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step_name = (string) $d_step[0];
- $this->stepNames[$step_name] = (string) $d_step['name'];
- }
- $this->_loadToSession('stepNames', $this->stepNames);
- }
- }
-
- /**
- * Set steps install order
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _xmlStepsOrders() {
- if(isset($this->simpleXmlObj)) {
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- if(isset($d_step['order'])) {
- $step_name = (string) $d_step[0];
- $order = (string) $d_step['order'];
- $this->installOrders[$order] = $step_name; // Store step install order
- }
- }
- $this->_loadToSession('installOrders', $this->installOrders);
- }
- }
/**
* Set install properties
@@ -383,11 +83,11 @@ class Installer {
* @access private
* @return void
*/
- private function _xmlInstallProperties() {
+ public function xmlProperties() {
if(isset($this->simpleXmlObj)) {
- $this->installProperties['install_version'] = (string) $this->simpleXmlObj['version'];
- $this->installProperties['install_type'] = (string) $this->simpleXmlObj['type'];
- $this->_loadToSession('installProperties', $this->installProperties);
+ $this->properties['install_version'] = (string) $this->simpleXmlObj['version'];
+ $this->properties['install_type'] = (string) $this->simpleXmlObj['type'];
+ $this->loadToSession('installProperties', $this->properties);
}
}
@@ -399,25 +99,13 @@ class Installer {
* @access private
* @return void
*/
- private function _runStepsInstallers() {
- $steps = $this->_getInstallOrders();
+ private function runStepsInstallers() {
+ $steps = $this->getOrders();
for ($i=1; $i< count($steps)+1; $i++) {
- $this->_installHelper($steps[$i]);
+ $this->installHelper($steps[$i]);
}
- $this->_completeInstall();
- }
-
- /**
- * Complete install cleanup process
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _completeInstall() {
- touch(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock");
+ $this->completeInstall();
}
/**
@@ -428,7 +116,7 @@ class Installer {
* @access private
* @return void
*/
- private function _installHelper($className) {
+ private function installHelper($className) {
$stepAction = new stepAction($className); // Instantiate a step action
$class = $stepAction->createStep(); // Get step class
if($class) { // Check if class Exists
@@ -443,76 +131,85 @@ class Installer {
exit();
}
}
-
+
/**
- * Reset all session information on welcome landing
+ * Complete install cleanup process
*
* @author KnowledgeTree Team
* @param none
* @access private
* @return void
*/
- private function _resetSessions() {
- if($this->session) {
- if($this->_firstStepPeriod()) {
- foreach ($this->getSteps() as $class) {
- $this->session->un_setClass($class);
- }
- foreach ($this->getStepNames() as $class) {
- $this->session->un_setClass($class);
- }
- foreach ($this->_getInstallOrders() as $class) {
- $this->session->un_setClass($class);
- }
- }
+ private function completeInstall() {
+ touch(SYSTEM_DIR.'var'.DS.'bin'.DS."install.lock");
+ }
+
+ /**
+ * Set steps install order
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function xmlStepsOrders() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ if(isset($d_step['order'])) {
+ $step_name = (string) $d_step[0];
+ $order = (string) $d_step['order'];
+ $this->orders[$order] = $step_name; // Store step install order
+ }
+ }
+ $this->loadToSession('installOrders', $this->orders);
}
}
-
- function _loadFromSessions() {
+
+ public function loadFromSessions() {
$this->stepClassNames = $this->session->get('stepClassNames');
if(!$this->stepClassNames) {
- $this->_xmlStepsToArray(); // String steps
+ $this->xmlStepsToArray(); // String steps
}
$this->stepNames = $this->session->get('stepNames');
if(!$this->stepNames) {
- $this->_xmlStepsNames();
+ $this->xmlStepsNames();
}
- $this->installOrders = $this->session->get('installOrders');
- if(!$this->installOrders) {
- $this->_xmlStepsOrders();
+ $this->orders = $this->session->get('installOrders');
+ if(!$this->orders) {
+ $this->xmlStepsOrders();
}
- $this->installProperties = $this->session->get('installProperties');
- if(!$this->installProperties) {
- $this->_xmlInstallProperties();
+ $this->properties = $this->session->get('installProperties');
+ if(!$this->properties) {
+ $this->xmlProperties();
}
}
-
- private function loadNeeded() {
- $this->_readXml(); // Xml steps
+
+ public function loadNeeded() {
+ $this->readXml(); // Xml steps
// Make sure session is cleared
- $this->_resetSessions();
- $this->_loadFromSessions();
+ $this->resetSessions();
+ $this->loadFromSessions();
if(isset($_POST['Next'])) {
- $this->installerAction = 'next';
+ $this->action = 'next';
$this->response = 'next';
} elseif (isset($_POST['Previous'])) {
- $this->installerAction = 'previous';
+ $this->action = 'previous';
$this->response = 'previous';
} elseif (isset($_POST['Confirm'])) {
- $this->installerAction = 'confirm';
+ $this->action = 'confirm';
$this->response = 'next';
} elseif (isset($_POST['Install'])) {
- $this->installerAction = 'install';
+ $this->action = 'install';
$this->response = 'next';
} elseif (isset($_POST['Edit'])) {
- $this->installerAction = 'edit';
+ $this->action = 'edit';
$this->response = 'next';
} else {
$this->response = '';
- $this->installerAction = '';
+ $this->action = '';
}
}
-
+
/**
* Main control to handle the flow of install
*
@@ -525,155 +222,34 @@ class Installer {
$this->loadNeeded();
switch($this->response) {
case 'next':
- $step_name = $this->_getStepName();
- $res = $this->_runStepAction($step_name);
+ $step_name = $this->getStepName();
+ $res = $this->runStepAction($step_name);
if($res == 'next')
- $this->_proceed(); // Load next window
+ $this->proceed(); // Load next window
elseif ($res == 'install') {
// Load the current steps vars into session
$vars = $this->stepAction->getStepVars();
$this->stepAction->loadToSes($vars);
- $this->_runStepsInstallers(); // Load landing
- $this->_proceed(); // Load next window
+ $this->runStepsInstallers(); // Load landing
+ $this->proceed(); // Load next window
} elseif ($res == 'confirm') {
if(!$this->stepDisplayFirst())
$this->stepConfirmation = true;
- $this->_landing();
+ $this->landing();
} elseif ($res == 'landing') {
- $this->_landing();
+ $this->landing();
} else {
}
break;
case 'previous':
- $this->_backward(); // Load previous page
+ $this->backward(); // Load previous page
break;
default:
- // TODO : handle silent
- $this->_landing();
+ $this->landing();
break;
}
$this->stepAction->paintAction(); // Display step
}
-
- /**
- * Returns the step number
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return integer $pos
- */
- public function getStepPosition() {
- $pos = 0;
- foreach($this->simpleXmlObj->steps->step as $d_step) {
- $step = (string) $d_step;
- if ($step == $_GET['step_name']) {
- break;
- }
- $pos++;
- }
- if(isset($_GET['step'])) {
- if($_GET['step'] == "next")
- $pos = $pos+1;
- else
- $pos = $pos-1;
- }
-
- return $pos;
- }
-
- /**
- * Returns the step names for classes
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getSteps() {
- return $this->stepClassNames;
- }
-
- /**
- * Returns the steps as human readable string
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getStepNames() {
- return $this->stepNames;
- }
-
- /**
- * Returns whether or not a confirmation step is needed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function getStepConfirmation() {
- return $this->stepConfirmation;
- }
-
- /**
- * Return install properties
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function getInstallProperties() {
- return $this->installProperties;
- }
-
- /**
- * Returns session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function getSession() {
- return $this->session;
- }
-
- /**
- * Dump of SESSION
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function showSession() {
- echo '';
- print_r($_SESSION['installers']);
- echo ' ';
- }
-
- /**
- * Display errors that are not allowing the installer to operate
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function resolveErrors($errors) {
- echo $errors;
- exit();
- }
-
- private function _loadToSession($type, $values) {
- if($values) {
- $this->session->set($type , $values);
- }
- }
}
?>
diff --git a/setup/wizard/path.php b/setup/wizard/path.php
index 5eecf03..4cf7659 100644
--- a/setup/wizard/path.php
+++ b/setup/wizard/path.php
@@ -109,7 +109,6 @@
define('IMG_DIR', RES_DIR."graphics".DS);
define('STEP_DIR', WIZARD_DIR."steps".DS);
define('TEMP_DIR', WIZARD_DIR."templates".DS);
- define('SYS_DIR', WIZARD_LIB."system".DS);
define('HELPER_DIR', WIZARD_LIB."helpers".DS);
define('VALID_DIR', WIZARD_LIB."validation".DS);
// Define paths to system webroot
diff --git a/setup/wizard/resources/css/firstlogin.css b/setup/wizard/resources/css/firstlogin.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup/wizard/resources/css/firstlogin.css
diff --git a/setup/wizard/resources/css/wizard.css b/setup/wizard/resources/css/wizard.css
index 6efd975..73b06bb 100644
--- a/setup/wizard/resources/css/wizard.css
+++ b/setup/wizard/resources/css/wizard.css
@@ -54,7 +54,7 @@ th {
td {
padding: 2px 5px;
- width: 190px;
+ /*width: 190px;*/
}
select {
diff --git a/setup/wizard/session.php b/setup/wizard/session.php
index e97bf76..4b5a025 100644
--- a/setup/wizard/session.php
+++ b/setup/wizard/session.php
@@ -42,10 +42,10 @@
* @package Installer
* @version Version 0.1
*/
-class Session
+class Session extends SessionBase
{
- private $salt = 'installers';
+ public $salt = 'installers';
/**
* Constructs session object
@@ -55,189 +55,10 @@ class Session
* @param none
*/
public function __construct() {
+ $this->setSalt($this->salt);
$this->startSession();
}
- public function setSalt($salt) {
- $this->salt = $salt;
- }
-
- /**
- * Starts a session if one does not exist
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function startSession() {
- if(!isset($_SESSION[$this->salt]['ready'])) {
- @session_start();
- $_SESSION[$this->salt] ['ready'] = TRUE;
- }
- }
-
- /**
- * Sets a value key pair in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function set($fld, $val) {
- $this->startSession();
- $_SESSION[$this->salt] [$fld] = $val;
- }
-
- /**
- * Sets a value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClass($class , $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Sets a error value key pair in a class in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function setClassError($class, $k, $v) {
- $this->startSession();
- $classArray = $this->get($class);
- if(isset($classArray[$k])) {
- $classArray[$k] = $v;
- } else {
- $classArray[$k] = $v;
- }
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Clear error values in a class session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @param string $fld
- * @param string $val
- * @access public
- * @return void
- */
- public function clearErrors($class) {
- $classArray = $this->get($class);
- unset($classArray['errors']);
- $_SESSION[$this->salt] [ $class] = $classArray;
- }
-
- /**
- * Unset a value in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return void
- */
- public function un_set($fld) {
- $this->startSession();
- unset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Unset a class value in session
- *
- * @author KnowledgeTree Team
- * @param string $class
- * @access public
- * @return void
- */
- public function un_setClass($class) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$class]))
- unset($_SESSION[$this->salt] [$class]);
- }
-
- /**
- * Destroy the session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function destroy() {
- $this->startSession();
- unset($_SESSION[$this->salt]);
- session_destroy();
- }
-
- /**
- * Get a session value
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function get($fld) {
- $this->startSession();
- if(isset($_SESSION[$this->salt] [$fld]))
- return $_SESSION[$this->salt] [$fld];
- return false;
- }
-
- /**
- * Check if a field exists in session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function is_set($fld) {
- $this->startSession();
- return isset($_SESSION[$this->salt] [$fld]);
- }
-
- /**
- * Return a class from session
- *
- * @author KnowledgeTree Team
- * @param string $fld
- * @access public
- * @return string
- */
- public function getClass($class) {
- return $_SESSION[$this->salt][$class];
- }
-
-}
-if(isset($_GET['action'])) {
- $func = $_GET['action'];
- if($func != '') {
- $ses = new Session();
- $method = "$func";
- $ses->$method();
- }
}
?>
\ No newline at end of file
diff --git a/setup/wizard/share/navBase.php b/setup/wizard/share/navBase.php
new file mode 100644
index 0000000..3903daf
--- /dev/null
+++ b/setup/wizard/share/navBase.php
@@ -0,0 +1,511 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+*
+* @copyright 2008-2009, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Installer
+* @version Version 0.1
+*/
+
+class NavBase {
+ /**
+ * Reference to simple xml object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object SimpleXMLElement
+ */
+ protected $simpleXmlObj = null;
+
+ /**
+ * Reference to step action object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object StepAction
+ */
+ protected $stepAction = null;
+
+ /**
+ * Reference to session object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object Session
+ */
+ protected $session = null;
+
+ /**
+ * List of installation steps as strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepClassNames = array();
+
+ /**
+ * List of installation steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepNames = array();
+
+ /**
+ * List of installation steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $stepObjects = array();
+
+ /**
+ * Order in which steps have to be installed
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $orders = array();
+
+ /**
+ * List of installation properties
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array string
+ */
+ protected $properties = array();
+
+ /**
+ * Flag if a step object needs confirmation
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $stepConfirmation = false;
+
+ /**
+ * Flag if a step object needs confirmation
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $stepDisplayFirst = false;
+
+ protected $action = '';
+
+ /**
+ * Read xml configuration file
+ *
+ * @author KnowledgeTree Team
+ * @param string $name of config file
+ * @access public
+ * @return object
+ */
+ public function readXml() {
+
+ }
+
+ /**
+ * Checks if first step of installer
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function firstStep() {
+ if(isset($_GET['step_name'])) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks if first step of installer
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function firstStepPeriod() {
+ if(isset($_GET['step_name'])) {
+ if($_GET['step_name'] != 'welcome')
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns next step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function getNextStep() {
+ return $this->getStepName(1);
+ }
+
+ /**
+ * Returns previous step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function getPreviousStep() {
+ return $this->getStepName(-1);
+ }
+
+ /**
+ * Returns the step name, given a position
+ *
+ * @author KnowledgeTree Team
+ * @param integer $pos current position
+ * @access public
+ * @return string $name
+ */
+ public function getStepName($pos = 0) {
+ if($this->firstStep()) {
+ $step = (string) $this->simpleXmlObj->steps->step[0];
+ } else {
+ $pos += $this->getStepPosition();
+ $step = (string) $this->simpleXmlObj->steps->step[$pos];
+ }
+
+ return $step;
+ }
+
+ /**
+ * Executes next step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function proceed() {
+ $step_name = $this->getNextStep();
+
+ return $this->runStepAction($step_name);
+ }
+
+ /**
+ * Executes previous step
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function backward() {
+ $step_name = $this->getPreviousStep();
+
+ return $this->runStepAction($step_name);
+ }
+
+ /**
+ * Executes step landing
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function landing() {
+ $step_name = $this->getStepName();
+
+ return $this->runStepAction($step_name);
+ }
+
+ /**
+ * Executes step based on step class name
+ *
+ * @author KnowledgeTree Team
+ * @param string $step_name
+ * @access public
+ * @return string
+ */
+ public function runStepAction($stepName) {
+ $this->stepAction = new stepAction($stepName);
+ $this->stepAction->setUpStepAction($this->getSteps(), $this->getStepNames(), $this->getStepConfirmation(), $this->stepDisplayFirst(), $this->getSession(), $this->getProperties());
+
+ return $this->stepAction->doAction();
+ }
+
+ public function stepDisplayFirst() {
+ if($this->action == 'edit')
+ return false; //
+ $class = $this->stepAction->createStep(); // Get step class
+ return $class->displayFirst(); // Check if class needs to display first
+ }
+
+ /**
+ * Set steps class names in string format
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getOrders() {
+ return $this->orders;
+ }
+
+ /**
+ * Set steps as names
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function xmlStepsToArray() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step_name = (string) $d_step[0];
+ $this->stepClassNames[] = $step_name;
+ }
+ $this->loadToSession('stepClassNames', $this->stepClassNames);
+ }
+ }
+
+ /**
+ * Set steps as human readable strings
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function xmlStepsNames() {
+ if(isset($this->simpleXmlObj)) {
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step_name = (string) $d_step[0];
+ $this->stepNames[$step_name] = (string) $d_step['name'];
+ }
+ $this->loadToSession('stepNames', $this->stepNames);
+ }
+ }
+
+ /**
+ * Set steps install order
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function xmlStepsOrders() {
+ return false;
+ }
+
+ /**
+ * Set install properties
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function xmlProperties() {
+ return false;
+ }
+
+ /**
+ * Reset all session information on welcome landing
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function resetSessions() {
+ if($this->session) {
+ if($this->firstStepPeriod()) {
+ foreach ($this->getSteps() as $class) {
+ $this->session->un_setClass($class);
+ }
+ foreach ($this->getStepNames() as $class) {
+ $this->session->un_setClass($class);
+ }
+ foreach ($this->getOrders() as $class) {
+ $this->session->un_setClass($class);
+ }
+ }
+ }
+ }
+
+ public function loadFromSessions() {
+ return false;
+ }
+
+ public function loadNeeded() {
+ return false;
+ }
+
+ /**
+ * Main control to handle the flow of install
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function step() {
+ return false;
+ }
+
+ /**
+ * Returns the step number
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return integer $pos
+ */
+ public function getStepPosition() {
+ $pos = 0;
+ foreach($this->simpleXmlObj->steps->step as $d_step) {
+ $step = (string) $d_step;
+ if ($step == $_GET['step_name']) {
+ break;
+ }
+ $pos++;
+ }
+ if(isset($_GET['step'])) {
+ if($_GET['step'] == "next")
+ $pos = $pos+1;
+ else
+ $pos = $pos-1;
+ }
+
+ return $pos;
+ }
+
+ /**
+ * Returns the step names for classes
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getSteps() {
+ return $this->stepClassNames;
+ }
+
+ /**
+ * Returns the steps as human readable string
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getStepNames() {
+ return $this->stepNames;
+ }
+
+ /**
+ * Returns whether or not a confirmation step is needed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function getStepConfirmation() {
+ return $this->stepConfirmation;
+ }
+
+ /**
+ * Return install properties
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return string
+ */
+ public function getProperties() {
+ return $this->properties;
+ }
+
+ /**
+ * Returns session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function getSession() {
+ return $this->session;
+ }
+
+ /**
+ * Display errors that are not allowing the installer to operate
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function resolveErrors($errors) {
+ echo $errors;
+ exit();
+ }
+
+ public function loadToSession($type, $values) {
+ if($values) {
+ $this->session->set($type , $values);
+ }
+ }
+}
+
+?>
diff --git a/setup/wizard/share/sessionBase.php b/setup/wizard/share/sessionBase.php
new file mode 100644
index 0000000..d3b35fb
--- /dev/null
+++ b/setup/wizard/share/sessionBase.php
@@ -0,0 +1,219 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+*
+* @copyright 2008-2009, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Installer
+* @version Version 0.1
+*/
+class SessionBase
+{
+
+ public $salt = '';
+
+ public function setSalt($salt) {
+ $this->salt = $salt;
+ }
+
+ /**
+ * Starts a session if one does not exist
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function startSession() {
+ if(!isset($_SESSION[$this->salt]['ready'])) {
+ @session_start();
+ $_SESSION[$this->salt] ['ready'] = TRUE;
+ }
+ }
+
+ /**
+ * Sets a value key pair in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $fld
+ * @param string $val
+ * @access public
+ * @return void
+ */
+ public function set($fld, $val) {
+ $this->startSession();
+ $_SESSION[$this->salt] [$fld] = $val;
+ }
+
+ /**
+ * Sets a value key pair in a class in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class
+ * @param string $fld
+ * @param string $val
+ * @access public
+ * @return void
+ */
+ public function setClass($class , $k, $v) {
+ $this->startSession();
+ $classArray = $this->get($class);
+ if(isset($classArray[$k])) {
+ $classArray[$k] = $v;
+ } else {
+ $classArray[$k] = $v;
+ }
+ $_SESSION[$this->salt] [ $class] = $classArray;
+ }
+
+ /**
+ * Sets a error value key pair in a class in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class
+ * @param string $fld
+ * @param string $val
+ * @access public
+ * @return void
+ */
+ public function setClassError($class, $k, $v) {
+ $this->startSession();
+ $classArray = $this->get($class);
+ if(isset($classArray[$k])) {
+ $classArray[$k] = $v;
+ } else {
+ $classArray[$k] = $v;
+ }
+ $_SESSION[$this->salt] [ $class] = $classArray;
+ }
+
+ /**
+ * Clear error values in a class session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class
+ * @param string $fld
+ * @param string $val
+ * @access public
+ * @return void
+ */
+ public function clearErrors($class) {
+ $classArray = $this->get($class);
+ unset($classArray['errors']);
+ $_SESSION[$this->salt] [ $class] = $classArray;
+ }
+
+ /**
+ * Unset a value in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $fld
+ * @access public
+ * @return void
+ */
+ public function un_set($fld) {
+ $this->startSession();
+ unset($_SESSION[$this->salt] [$fld]);
+ }
+
+ /**
+ * Unset a class value in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class
+ * @access public
+ * @return void
+ */
+ public function un_setClass($class) {
+ $this->startSession();
+ if(isset($_SESSION[$this->salt] [$class]))
+ unset($_SESSION[$this->salt] [$class]);
+ }
+
+ /**
+ * Destroy the session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function destroy() {
+ $this->startSession();
+ unset($_SESSION[$this->salt]);
+ session_destroy();
+ }
+
+ /**
+ * Get a session value
+ *
+ * @author KnowledgeTree Team
+ * @param string $fld
+ * @access public
+ * @return string
+ */
+ public function get($fld) {
+ $this->startSession();
+ if(isset($_SESSION[$this->salt] [$fld]))
+ return $_SESSION[$this->salt] [$fld];
+ return false;
+ }
+
+ /**
+ * Check if a field exists in session
+ *
+ * @author KnowledgeTree Team
+ * @param string $fld
+ * @access public
+ * @return string
+ */
+ public function is_set($fld) {
+ $this->startSession();
+ return isset($_SESSION[$this->salt] [$fld]);
+ }
+
+ /**
+ * Return a class from session
+ *
+ * @author KnowledgeTree Team
+ * @param string $fld
+ * @access public
+ * @return string
+ */
+ public function getClass($class) {
+ return $_SESSION[$this->salt][$class];
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/setup/wizard/share/stepActionBase.php b/setup/wizard/share/stepActionBase.php
new file mode 100644
index 0000000..0657d03
--- /dev/null
+++ b/setup/wizard/share/stepActionBase.php
@@ -0,0 +1,522 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+*
+* @copyright 2008-2009, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Installer
+* @version Version 0.1
+*/
+
+class StepActionBase {
+ /**
+ * Step class name
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var string
+ */
+ protected $stepName = '';
+
+ /**
+ * Step names for classes
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $stepClassNames = array();
+
+ /**
+ * Flag if step needs confirmation
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $displayConfirm = false;
+
+ /**
+ * Returns whether or not to display the confirmation page first
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $displayFirst = false;
+
+ /**
+ * List of properties
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $properties = array();
+
+ /**
+ * Reference to session object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object Session
+ */
+ protected $session = null;
+
+ /**
+ * Reference to current step object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object class Step
+ */
+ protected $action = null;
+
+ /**
+ * Helper to initialize step actions
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return string
+ */
+ public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $properties) {
+ $this->setSteps($steps);
+ $this->setStepNames($stepNames);
+ $this->setDisplayConfirm($stepConfirmation);
+ $this->setDisplayFirst($stepDisplayFirst);
+ $this->loadSession($session);
+ $this->setProperties($properties);
+ }
+
+ /**
+ * Sets steps class names in string format
+ *
+ * @author KnowledgeTree Team
+ * @param array
+ * @access public
+ * @return void
+ */
+ public function setSteps($stepClassNames) {
+ $this->stepClassNames = $stepClassNames;
+ }
+
+ /**
+ * Sets steps in human readable string format
+ *
+ * @author KnowledgeTree Team
+ * @param array
+ * @access public
+ * @return void
+ */
+ public function setStepNames($step_names) {
+ $this->step_names = $step_names;
+ }
+
+ /**
+ * Sets confirmation page flag
+ *
+ * @author KnowledgeTree Team
+ * @param boolean
+ * @access public
+ * @return void
+ */
+ public function setDisplayConfirm($displayConfirm) {
+ $this->displayConfirm = $displayConfirm;
+ }
+
+ /**
+ * Sets confirmation page first flag
+ *
+ * @author KnowledgeTree Team
+ * @param boolean
+ * @access public
+ * @return void
+ */
+ public function setDisplayFirst($displayFirst) {
+ $this->displayFirst = $displayFirst;
+ }
+
+ /**
+ * Sets session object
+ *
+ * @author KnowledgeTree Team
+ * @param object Session
+ * @access public
+ * @return void
+ */
+ public function loadSession($ses) {
+ $this->session = $ses;
+ }
+
+ /**
+ * Sets properties
+ *
+ * @author KnowledgeTree Team
+ * @param array
+ * @access public
+ * @return void
+ */
+ public function setProperties($properties) {
+ $this->properties = $properties;
+ }
+
+ /**
+ * Main control to handle the steps actions
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function doAction() {
+ if($this->stepName != '') {
+ $this->action = $this->createStep();
+ if(!$this->action) {
+ $this->stepName = 'errors';
+ $this->action = $this->createStep();
+ $this->action->error = array('Class Files Missing in Step Directory');
+ }
+ $response = $this->action->doStep();
+ if($this->action->storeInSession()) { // Check if class values need to be stored in session
+ $this->_loadStepToSession($this->stepName); // Send class to session
+ }
+ if ($response == 'error') {
+ $this->_handleErrors(); // Send Errors to session
+ } else {
+ $this->_clearErrors($this->stepName); // Send Errors to session
+ }
+ } else {
+ $this->stepName = 'errors';
+ $this->action = $this->createStep();
+ $this->action->error = array('Class File Missing in Step Directory');
+ }
+ return $response;
+ }
+
+ /**
+ * Instantiate a step.
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return object Step
+ */
+ public function createStep() {
+ $step_class = $this->makeCamelCase($this->stepName);
+ return new $step_class();
+ }
+
+ /**
+ * Converts string to camel case
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return string
+ */
+ public function makeCamelCase($str) {
+ $upper=ucwords($str);
+ $str=str_replace('_', '', $upper);
+
+ return $str;
+ }
+
+ /**
+ * Converts string to human readable heading
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return string
+ */
+ public function makeHeading($str) {
+ $str = str_replace('_', ' ', $str);
+ $str = ucwords($str);
+
+ return $str;
+ }
+
+ /**
+ * Returns current step name
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function getCurrentStepName() {
+ if($this->stepName != 'errors')
+ return $this->step_names[$this->stepName];
+ return '';
+ }
+
+ /**
+ * Returns left menu
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function getLeftMenu()
+ {
+ $sideMenuElements = array();
+ $active = false;
+ if($this->stepClassNames) {
+ $ele = array();
+ foreach ($this->stepClassNames as $k=>$step) {
+ $ele['step'] = $step;
+ if($this->step_names[$step] != '') {
+ $ele['name'] = $this->step_names[$step];
+ } else {
+ $ele['name'] = $this->makeHeading($step);
+ }
+ if($step == $this->stepName) {
+ $ele['class'] = 'current';
+ $active = true;
+ } else {
+ if($active) {
+ $ele['class'] = 'inactive';
+ } else {
+ $ele['class'] = 'indicator';
+ }
+ }
+ $sideMenuElements[] = $ele;
+ }
+ }
+ $step_tpl = new Template("../wizard/templates/sidemenu.tpl"); // Create template
+ $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements
+ $step_tpl->set("ajax", AJAX); // Set ajax state
+
+ return $step_tpl->fetch();
+ }
+
+ /**
+ * Returns confirmation page flag
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function displayConfirm() {
+ return $this->displayConfirm;
+ }
+
+ /**
+ * Returns whether or not to display the confirmation page first
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function displayFirst() {
+ return $this->displayFirst;
+ }
+
+ /**
+ * Returns session object
+ *
+ * @author KnowledgeTree Team
+ * @param object Session
+ * @access public
+ * @return object
+ */
+ public function getSession() {
+ return $this->session;
+ }
+
+ /**
+ * Returns step tenplate content
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function paintAction() {
+ $step_errors = $this->action->getErrors(); // Get errors
+ $step_warnings = $this->action->getWarnings(); // Get warnings
+ if($this->displayConfirm()) { // Check if theres a confirm step
+ $template = "templates" . DS . "{$this->stepName}_confirm.tpl";
+ } else {
+ if($this->displayFirst()) {
+ $template = "templates" . DS . "{$this->stepName}_confirm.tpl";
+ } else {
+ $template = "templates" . DS . "{$this->stepName}.tpl";
+ }
+ }
+ $step_tpl = new Template($template);
+ $step_tpl->set("errors", $step_errors); // Set template errors
+ $step_tpl->set("warnings", $step_warnings); // Set template warnings
+ $step_vars = $this->action->getStepVars(); // Get template variables
+ $step_tpl->set("step_vars", $step_vars); // Set template errors
+ $this->loadToSes($step_vars);
+ $this->loadToTpl($step_tpl, $step_vars);
+ if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
+ echo $step_tpl->fetch();
+ } else {
+ $content = $step_tpl->fetch();
+ $tpl = new Template("templates/wizard.tpl");
+ $vars = $this->getVars(); // Get template variables
+ $tpl->set("vars", $vars); // Set template errors
+ $tpl->set('content', $content);
+ echo $tpl->fetch();
+ }
+ }
+
+ public function loadToSes($step_vars) {
+ if($this->action->storeInSession()) { // Check if class values need to be stored in session
+ foreach ($step_vars as $key => $value) { // Set template variables
+ $this->_loadValueToSession($this->stepName, $key, $value);
+ }
+ }
+ }
+
+ public function loadToTpl($step_tpl, $step_vars) {
+ foreach ($step_vars as $key => $value) { // Set template variables
+ $step_tpl->set($key, $value); // Load values to session
+ }
+ }
+
+ public function getStepVars() {
+ return $this->action->getStepVars();
+ }
+
+ public function getVars() {
+ return array();
+ }
+
+ /**
+ * Load class to session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class name of class
+ * @param array $v array of values
+ * @param boolean $overwrite whether or not to overwrite existing
+ * @access public
+ * @return void
+ */
+ public function _loadStepToSession($class, $v = array(), $overwrite = false) {
+ if($this->session != null) {
+ if($overwrite) {
+ $this->session->set($class , $v);
+ } else {
+ if(!$this->session->is_set($class))
+ $this->session->set($class , $v);
+ }
+ } else {
+ $this->stepName = 'errors';
+ $this->action = $this->createStep();
+ $this->action->error = array('Sessions Are Disabled');
+ }
+ }
+
+ /**
+ * Load class value to session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class name of class
+ * @param string $k key value
+ * @param string $v value to store
+ * @param boolean $overwrite whether or not to overwrite existing
+ * @access public
+ * @return void
+ */
+ public function _loadValueToSession($class, $k, $v, $overwrite = false) {
+ if($this->session != null) {
+ $this->session->setClass($class, $k, $v);
+ } else {
+ $this->stepName = 'errors';
+ $this->action = $this->createStep();
+ $this->action->error = array('Sessions Are Disabled');
+ }
+ }
+
+ /**
+ * Load all class errors value to session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function _handleErrors() {
+ $step_errors = $this->action->getErrors(); // Get errors
+ foreach ($step_errors as $key => $value) {
+ $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session
+ }
+ }
+
+ /**
+ * Remove all class errors value to session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function _clearErrors($class) {
+ if($this->session) {
+ $this->session->clearErrors($class);
+ }
+ }
+
+ /**
+ * Load class error value to session
+ *
+ * @author KnowledgeTree Team
+ * @param string $class name of class
+ * @param string $k key value
+ * @param string $v value to store
+ * @param boolean $overwrite whether or not to overwrite existing
+ * @access public
+ * @return void
+ */
+ public function _loadErrorToSession($class, $k, $v, $overwrite = false) {
+ $k = "errors";
+ if($this->session != null) {
+ $this->session->setClassError($class, $k, $v);
+ } else {
+ $this->stepName = 'errors';
+ $this->action = $this->createStep();
+ $this->action->error = array('Sessions Are Disabled');
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/setup/wizard/share/stepBase.php b/setup/wizard/share/stepBase.php
new file mode 100644
index 0000000..11afe26
--- /dev/null
+++ b/setup/wizard/share/stepBase.php
@@ -0,0 +1,424 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+*
+* @copyright 2008-2009, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Installer
+* @version Version 0.1
+*/
+
+class StepBase {
+ /**
+ * Session salt
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var string
+ */
+ protected $salt = '';
+
+ /**
+ * List of variables to be loaded to template
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $temp_variables = array();
+
+ /**
+ * List of errors encountered by step
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $error = array();
+
+ /**
+ * List of warnings encountered by step
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var array
+ */
+ protected $warnings = array();
+
+ /**
+ * Flag to store class information in session
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ protected $storeInSession = false;
+
+ /**
+ * Step order
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ protected $order = false;
+
+ /**
+ * Flag if step needs to run silently
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ protected $silent = false;
+
+ /**
+ * Flag if step needs to show confirm page first
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @var boolean
+ */
+ public $displayFirst = false;
+
+ /**
+ * Reference to utility object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var object
+ */
+ public $util;
+
+ /**
+ * Returns step state
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function doStep() {
+ return '';
+ }
+
+ public function displayFirst() {
+ return $this->displayFirst;
+ }
+
+ /**
+ * Returns step variables
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getStepVars() {
+ return $this->temp_variables;
+ }
+
+ /**
+ * Returns step errors
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getErrors() {
+ return $this->error;
+ }
+
+ /**
+ * Returns step errors
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getWarnings() {
+ return $this->warnings;
+ }
+
+ /**
+ * Load default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function loadDefaults() {
+
+ }
+
+ /**
+ * Return default step values
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function getDefaults() {
+ return array();
+ }
+
+ /**
+ * Checks if edit button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function edit() {
+ if(isset($_POST['Edit'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if next button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function next() {
+ if(isset($_POST['Next'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if previous button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function previous() {
+ if(isset($_POST['Previous'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if Confirm button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ function confirm() {
+ if(isset($_POST['Confirm'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if Install button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ function install() {
+ if(isset($_POST['Install'])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if Clean install button has been clicked
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ function migrate() {
+ if(isset($_POST['installtype'])) {
+ if($_POST['installtype'] == "Upgrade Installation") {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if we are currently in this class step
+ *
+ * @author KnowledgeTree Team
+ * @param string
+ * @access public
+ * @return boolean
+ */
+ public function inStep($name) {
+ if(!isset($_GET['step_name'])) return false;
+ if($_GET['step_name'] == $name)
+ return true;
+ return false;
+ }
+
+ /**
+ * Get session data from package
+ *
+ * @author KnowledgeTree Team
+ * @params none
+ * @access private
+ * @return boolean
+ */
+ public function getDataFromPackage($package, $class) {
+ if(empty($_SESSION[$package][$class])) {
+ return false;
+ }
+
+ return $_SESSION[$package][$class];
+ }
+
+ /**
+ * Safer way to return post data
+ *
+ * @author KnowledgeTree Team
+ * @params SimpleXmlObject $simplexml
+ * @access public
+ * @return void
+ */
+ public function getPostSafe($key) {
+ return isset($_POST[$key]) ? $_POST[$key] : "";
+ }
+
+ /**
+ * Safer way to return post data
+ *
+ * @author KnowledgeTree Team
+ * @params SimpleXmlObject $simplexml
+ * @access public
+ * @return void
+ */
+ public function getPostBoolean($key) {
+ return isset($_POST[$key]) ? $_POST[$key] : false;
+ }
+
+ /**
+ * Runs step install if required
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return void
+ */
+ public function installStep() {
+ return '';
+ }
+
+ /**
+ * Return whether or not to store a step information in session
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function storeInSession() {
+ return $this->storeInSession;
+ }
+
+ public function setPostConfig() {
+ return '';
+ }
+
+ /**
+ * Return whether or not to a step has to be in silent mode
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function silentMode() {
+ return $this->silent;
+ }
+
+ /**
+ * Set step errors
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return array
+ */
+ public function setErrors($error) {
+ $this->error = $error;
+ }
+
+ /**
+ * Is the installation
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return string
+ */
+ public function isCe() {
+ if($this->util->getVersionType() == "community")
+ return true;
+ return false;
+ }
+
+ public function storeSilent() {
+ return true;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/setup/wizard/share/wizardBase.php b/setup/wizard/share/wizardBase.php
new file mode 100644
index 0000000..e2c9091
--- /dev/null
+++ b/setup/wizard/share/wizardBase.php
@@ -0,0 +1,218 @@
+.
+*
+* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+* California 94120-7775, or email info@knowledgetree.com.
+*
+* The interactive user interfaces in modified source and object code versions
+* of this program must display Appropriate Legal Notices, as required under
+* Section 5 of the GNU General Public License version 3.
+*
+* In accordance with Section 7(b) of the GNU General Public License version 3,
+* these Appropriate Legal Notices must retain the display of the "Powered by
+* KnowledgeTree" logo and retain the original copyright notice. If the display of the
+* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+* must display the words "Powered by KnowledgeTree" and retain the original
+* copyright notice.
+*
+* @copyright 2008-2009, KnowledgeTree Inc.
+* @license GNU General Public License version 3
+* @author KnowledgeTree Team
+* @package Installer
+* @version Version 0.1
+*/
+include("../wizard/path.php"); // Paths
+
+/**
+ * Auto loader to bind installer package
+ *
+ * @param string $class
+ * @return void
+ */
+function __autoload($class) { // Attempt and autoload classes
+ $class = strtolower(substr($class,0,1)).substr($class,1); // Linux Systems.
+ if(file_exists(WIZARD_DIR."$class.php")) {
+ require_once(WIZARD_DIR."$class.php");
+ } elseif (file_exists(STEP_DIR."$class.php")) {
+ require_once(STEP_DIR."$class.php");
+ } elseif (file_exists(WIZARD_LIB."$class.php")) {
+ require_once(WIZARD_LIB."$class.php");
+ } elseif (file_exists(SERVICE_LIB."$class.php")) {
+ require_once(SERVICE_LIB."$class.php");
+ } elseif (file_exists(VALID_DIR."$class.php")) {
+ require_once(VALID_DIR."$class.php");
+ } else {
+ if(preg_match('/Helper/', $class)) {
+ require_once(HELPER_DIR."$class.php");
+ }
+ $base = preg_match("/Base/", $class, $matches);
+ if($base) {
+ $tmpClass = $class;
+ $class = "base";
+ }
+ switch ($class) { // Could Need a class in another package
+ case "template": // Load existing templating classes
+ loadTemplate();
+ break;
+ case "base":
+ loadBase($tmpClass);
+ break;
+ }
+ }
+
+}
+
+function loadBase($class) {
+ require_once("$class.php");
+}
+
+function loadTemplate() {
+ require_once("../wizard/template.php");
+ require_once("../wizard/lib".DS."helpers".DS."htmlHelper.php");
+}
+
+class WizardBase {
+ /**
+ * Bypass flag
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var mixed
+ */
+ protected $bypass = null;
+
+ /**
+ * Level of debugger
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var mixed
+ */
+ protected $debugLevel = 0;
+
+ /**
+ * Reference to utility object
+ *
+ * @author KnowledgeTree Team
+ * @access protected
+ * @var boolean
+ */
+ protected $util = null;
+
+ /**
+ * Display the wizard
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param string
+ * @return void
+ */
+ public function display() {
+
+ }
+
+ /**
+ * Set bypass flag
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param boolean
+ * @return void
+ */
+ public function setBypass($bypass) {
+ $this->bypass = $bypass;
+ }
+
+ /**
+ * Set debug level
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param boolean
+ * @return void
+ */
+ public function setDebugLevel($debug) {
+ define('DEBUG', $debug);
+ $this->debugLevel = $debug;
+ }
+
+ /**
+ * Set util reference
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param object installer utility
+ * @return void
+ */
+ public function setIUtil($util) {
+ $this->util = $util;
+ }
+
+ /**
+ * Get bypass flag
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return boolean
+ */
+ public function getBypass() {
+ return $this->bypass;
+ }
+
+ /**
+ * Load default values
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return void
+ */
+ public function load() {
+ return false;
+ }
+
+ /**
+ * Run pre-installation system checks
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return mixed
+ */
+ public function systemChecks() {
+ return false;
+ }
+
+ /**
+ * Control all requests to wizard
+ *
+ * @author KnowledgeTree Team
+ * @access public
+ * @param none
+ * @return void
+ */
+ public function dispatch() {
+ return false;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/setup/wizard/step.php b/setup/wizard/step.php
index e109929..23f40b3 100644
--- a/setup/wizard/step.php
+++ b/setup/wizard/step.php
@@ -42,289 +42,32 @@
* @package Installer
* @version Version 0.1
*/
-class Step
+class Step extends StepBase
{
/**
- * List of variables to be loaded to template
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $temp_variables = array();
-
- /**
- * List of errors encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $error = array();
-
- /**
- * List of warnings encountered by step
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $warnings = array();
-
- /**
- * Flag to store class information in session
- *
- * @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $storeInSession = false;
-
- /**
* Flag if step needs to be installed
*
* @author KnowledgeTree Team
- * @access public
- * @var array
- */
- protected $runInstall = false;
-
- /**
- * Step order
- *
- * @author KnowledgeTree Team
- * @access public
- * @var string
- */
- protected $order = false;
-
- /**
- * Flag if step needs to run silently
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- protected $silent = false;
-
- /**
- * Flag if step needs to show confirm page first
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
- */
- public $displayFirst = false;
-
- /**
- * Reference to utility object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object
- */
- public $util;
-
- /**
- * Session salt
- *
- * @author KnowledgeTree Team
- * @access public
- * @var boolean
+ * @access private
+ * @var booelean
*/
- private $salt = 'installers';
+ public $runInstall = false;
public function __construct() {
$this->util = new InstallUtil();
- }
-
- /**
- * Returns step state
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doStep() {
- return '';
- }
-
- public function displayFirst() {
- return $this->displayFirst;
+ $this->salt = 'installers';
}
/**
- * Returns step variables
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getStepVars() {
- return $this->temp_variables;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getErrors() {
- return $this->error;
- }
-
- /**
- * Returns step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getWarnings() {
- return $this->warnings;
- }
-
- /**
- * Load default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function loadDefaults() {
-
- }
-
- /**
- * Return default step values
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function getDefaults() {
- return array();
- }
-
- /**
- * Checks if edit button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function edit() {
- if(isset($_POST['Edit'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if next button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function next() {
- if(isset($_POST['Next'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if previous button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function previous() {
- if(isset($_POST['Previous'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if Confirm button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- function confirm() {
- if(isset($_POST['Confirm'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if Install button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- function install() {
- if(isset($_POST['Install'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Checks if Clean install button has been clicked
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- function migrate() {
- if(isset($_POST['installtype'])) {
- if($_POST['installtype'] == "Upgrade Installation") {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Checks if we are currently in this class step
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return boolean
- */
- public function inStep($name) {
- if(!isset($_GET['step_name'])) return false;
- if($_GET['step_name'] == $name)
- return true;
- return false;
+ * Return whether or not to a step has to be installed
+ *
+ * @author KnowledgeTree Team
+ * @param none
+ * @access public
+ * @return boolean
+ */
+ public function runInstall() {
+ return $this->runInstall;
}
/**
@@ -345,22 +88,6 @@ class Step
}
/**
- * Get session data from package
- *
- * @author KnowledgeTree Team
- * @params none
- * @access private
- * @return boolean
- */
- public function getDataFromPackage($package, $class) {
- if(empty($_SESSION[$package][$class])) {
- return false;
- }
-
- return $_SESSION[$package][$class];
- }
-
- /**
* Get session data from class
*
* @author KnowledgeTree Team
@@ -375,109 +102,6 @@ class Step
return $_SESSION[$this->salt][$class];
}
-
- /**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostSafe($key) {
- return isset($_POST[$key]) ? $_POST[$key] : "";
- }
-
- /**
- * Safer way to return post data
- *
- * @author KnowledgeTree Team
- * @params SimpleXmlObject $simplexml
- * @access public
- * @return void
- */
- public function getPostBoolean($key) {
- return isset($_POST[$key]) ? $_POST[$key] : false;
- }
-
- /**
- * Runs step install if required
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return void
- */
- public function installStep() {
- return '';
- }
-
- /**
- * Return whether or not to store a step information in session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function storeInSession() {
- return $this->storeInSession;
- }
-
- /**
- * Return whether or not to a step has to be installed
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function runInstall() {
- return $this->runInstall;
- }
-
- public function setPostConfig() {
- return '';
- }
-
- /**
- * Return whether or not to a step has to be in silent mode
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function silentMode() {
- return $this->silent;
- }
-
- /**
- * Set step errors
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return array
- */
- public function setErrors($error) {
- $this->error = $error;
- }
-
- /**
- * Is the installation
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function isCe() {
- if($this->util->getVersionType() == "community")
- return true;
- return false;
- }
-
}
?>
\ No newline at end of file
diff --git a/setup/wizard/stepAction.php b/setup/wizard/stepAction.php
index 004afa4..8de0e36 100644
--- a/setup/wizard/stepAction.php
+++ b/setup/wizard/stepAction.php
@@ -44,70 +44,7 @@
* @version Version 0.1
*/
-class stepAction {
- /**
- * Step class name
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var string
- */
- protected $stepName = '';
-
- /**
- * Step names for classes
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var array
- */
- protected $stepClassNames = array();
-
- /**
- * Flag if step needs confirmation
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayConfirm = false;
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $displayFirst = false;
-
- /**
- * List of install properties
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var boolean
- */
- protected $installProperties = array();
-
- /**
- * Reference to session object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object Session
- */
- protected $session = null;
-
- /**
- * Reference to current step object
- *
- * @author KnowledgeTree Team
- * @access protected
- * @var object class Step
- */
- protected $action = null;
-
+class stepAction extends stepActionBase {
/**
* Constructs step action object
*
@@ -119,424 +56,13 @@ class stepAction {
$this->stepName = $step;
}
- /**
- * Helper to initialize step actions
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function setUpStepAction($steps, $stepNames, $stepConfirmation, $stepDisplayFirst, $session, $installProperties) {
- $this->setSteps($steps);
- $this->setStepNames($stepNames);
- $this->setDisplayConfirm($stepConfirmation);
- $this->setDisplayFirst($stepDisplayFirst);
- $this->loadSession($session);
- $this->setInstallProperties($installProperties);
- }
-
- /**
- * Sets steps class names in string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setSteps($stepClassNames) {
- $this->stepClassNames = $stepClassNames;
- }
-
- /**
- * Sets steps in human readable string format
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setStepNames($step_names) {
- $this->step_names = $step_names;
- }
-
- /**
- * Sets confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayConfirm($displayConfirm) {
- $this->displayConfirm = $displayConfirm;
- }
-
- /**
- * Sets confirmation page first flag
- *
- * @author KnowledgeTree Team
- * @param boolean
- * @access public
- * @return void
- */
- public function setDisplayFirst($displayFirst) {
- $this->displayFirst = $displayFirst;
- }
-
- /**
- * Sets session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return void
- */
- public function loadSession($ses) {
- $this->session = $ses;
- }
-
- /**
- * Sets install properties
- *
- * @author KnowledgeTree Team
- * @param array
- * @access public
- * @return void
- */
- public function setInstallProperties($installProperties) {
- $this->installProperties = $installProperties;
- }
-
- /**
- * Main control to handle the steps actions
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function doAction() {
- if($this->stepName != '') {
- $this->action = $this->createStep();
- if(!$this->action) {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class Files Missing in Step Directory');
- }
- $response = $this->action->doStep();
- if($this->action->storeInSession()) { // Check if class values need to be stored in session
- $this->_loadStepToSession($this->stepName); // Send class to session
- }
- if ($response == 'error') {
- $this->_handleErrors(); // Send Errors to session
- } else {
- $this->_clearErrors($this->stepName); // Send Errors to session
- }
- return $response;
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Class File Missing in Step Directory');
- }
- }
-
- /**
- * Instantiate a step.
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return object Step
- */
- public function createStep() {
- $step_class = $this->makeCamelCase($this->stepName);
- return new $step_class();
- }
-
- /**
- * Converts string to camel case
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeCamelCase($str) {
- $upper=ucwords($str);
- $str=str_replace('_', '', $upper);
-
- return $str;
- }
-
- /**
- * Converts string to human readable heading
- *
- * @author KnowledgeTree Team
- * @param string
- * @access public
- * @return string
- */
- public function makeHeading($str) {
- $str = str_replace('_', ' ', $str);
- $str = ucwords($str);
-
- return $str;
- }
-
- /**
- * Returns current step name
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getCurrentStepName() {
- if($this->stepName != 'errors')
- return $this->step_names[$this->stepName];
- return '';
- }
-
- /**
- * Returns left menu
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function getLeftMenu()
- {
- $sideMenuElements = array();
- $active = false;
- if($this->stepClassNames) {
- $ele = array();
- foreach ($this->stepClassNames as $k=>$step) {
- $ele['step'] = $step;
- if($this->step_names[$step] != '') {
- $ele['name'] = $this->step_names[$step];
- } else {
- $ele['name'] = $this->makeHeading($step);
- }
- if($step == $this->stepName) {
- $ele['class'] = 'current';
- $active = true;
- } else {
- if($active) {
- $ele['class'] = 'inactive';
- } else {
- $ele['class'] = 'indicator';
- }
- }
- $sideMenuElements[] = $ele;
- }
- }
- $step_tpl = new Template("templates/sidemenu.tpl"); // Create template
- $step_tpl->set("sideMenuElements", $sideMenuElements); // Set side menu elements
- $step_tpl->set("ajax", AJAX); // Set ajax state
-
- return $step_tpl->fetch();
- }
-
- /**
- * Returns confirmation page flag
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayConfirm() {
- return $this->displayConfirm;
- }
-
- /**
- * Returns whether or not to display the confirmation page first
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return boolean
- */
- public function displayFirst() {
- return $this->displayFirst;
- }
-
- /**
- * Returns session object
- *
- * @author KnowledgeTree Team
- * @param object Session
- * @access public
- * @return object
- */
- public function getSession() {
- return $this->session;
- }
-
- /**
- * Returns step tenplate content
- *
- * @author KnowledgeTree Team
- * @param none
- * @access public
- * @return string
- */
- public function paintAction() {
- $step_errors = $this->action->getErrors(); // Get errors
- $step_warnings = $this->action->getWarnings(); // Get warnings
- if($this->displayConfirm()) { // Check if theres a confirm step
- $template = "templates/{$this->stepName}_confirm.tpl";
- } else {
- if($this->displayFirst()) {
- $template = "templates/{$this->stepName}_confirm.tpl";
- } else {
- $template = "templates/{$this->stepName}.tpl";
- }
- }
- $step_tpl = new Template($template);
- $step_tpl->set("errors", $step_errors); // Set template errors
- $step_tpl->set("warnings", $step_warnings); // Set template warnings
- $step_vars = $this->action->getStepVars(); // Get template variables
- $step_tpl->set("step_vars", $step_vars); // Set template errors
- $this->loadToSes($step_vars);
- $this->loadToTpl($step_tpl, $step_vars);
- // TODO: Force because it does not always recognize ajax request
- if(AJAX && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
- echo $step_tpl->fetch();
- } else {
- $content = $step_tpl->fetch();
- $tpl = new Template("templates/wizard.tpl");
- $vars = $this->getVars(); // Get template variables
- $tpl->set("vars", $vars); // Set template errors
- $tpl->set('content', $content);
- echo $tpl->fetch();
- }
- }
-
- public function loadToSes($step_vars) {
- if($this->action->storeInSession()) { // Check if class values need to be stored in session
- foreach ($step_vars as $key => $value) { // Set template variables
- $this->_loadValueToSession($this->stepName, $key, $value);
- }
- }
- }
-
- public function loadToTpl($step_tpl, $step_vars) {
- foreach ($step_vars as $key => $value) { // Set template variables
- $step_tpl->set($key, $value); // Load values to session
- }
- }
-
- public function getStepVars() {
- return $this->action->getStepVars();
- }
-
public function getVars() {
$left = $this->getLeftMenu();
$vars['left'] = $left; // Set left menu
- $vars['install_version'] = $this->installProperties['install_version']; // Set version
- $vars['install_type'] = $this->installProperties['install_type']; // Set type
+ $vars['install_version'] = $this->properties['install_version']; // Set version
+ $vars['install_type'] = $this->properties['install_type']; // Set type
return $vars;
}
-
- /**
- * Load class to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param array $v array of values
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadStepToSession($class, $v = array(), $overwrite = false) {
- if($this->session != null) {
- if($overwrite) {
- $this->session->set($class , $v);
- } else {
- if(!$this->session->is_set($class))
- $this->session->set($class , $v);
- }
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load class value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadValueToSession($class, $k, $v, $overwrite = false) {
- if($this->session != null) {
- $this->session->setClass($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
-
- /**
- * Load all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _handleErrors() {// TODO: handle multiple errors
- $step_errors = $this->action->getErrors(); // Get errors
- foreach ($step_errors as $key => $value) {
- $this->_loadErrorToSession($this->stepName, $key, $value); // Load values session
- }
- }
-
- /**
- * Remove all class errors value to session
- *
- * @author KnowledgeTree Team
- * @param none
- * @access private
- * @return void
- */
- private function _clearErrors($class) {
- if($this->session) {
- $this->session->clearErrors($class);
- }
- }
-
- /**
- * Load class error value to session
- *
- * @author KnowledgeTree Team
- * @param string $class name of class
- * @param string $k key value
- * @param string $v value to store
- * @param boolean $overwrite whether or not to overwrite existing
- * @access private
- * @return void
- */
- private function _loadErrorToSession($class, $k, $v, $overwrite = false) {
- $k = "errors";
- if($this->session != null) {
- $this->session->setClassError($class, $k, $v);
- } else {
- $this->stepName = 'errors';
- $this->action = $this->createStep();
- $this->action->error = array('Sessions Are Disabled');
- }
- }
}
?>
\ No newline at end of file
diff --git a/setup/wizard/steps/configuration.php b/setup/wizard/steps/configuration.php
index 6f812db..9132903 100644
--- a/setup/wizard/steps/configuration.php
+++ b/setup/wizard/steps/configuration.php
@@ -126,7 +126,7 @@ class configuration extends Step
* @access public
* @var array
*/
- protected $runInstall = true;
+ public $runInstall = true;
/**
* Flag if step needs to run silently
diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php
index 6b0dd3b..c83f8a9 100644
--- a/setup/wizard/steps/database.php
+++ b/setup/wizard/steps/database.php
@@ -214,7 +214,7 @@ class database extends Step
* @access public
* @var array
*/
- protected $runInstall = true;
+ public $runInstall = true;
/**
* Flag if step needs to run silently
diff --git a/setup/wizard/steps/install.php b/setup/wizard/steps/install.php
index 4e606c1..babc9fb 100644
--- a/setup/wizard/steps/install.php
+++ b/setup/wizard/steps/install.php
@@ -62,7 +62,7 @@ class install extends step
* @access public
* @var array
*/
- protected $runInstall = true;
+ public $runInstall = true;
private $ce_check = false;
public function doStep() {
diff --git a/setup/wizard/steps/registration.php b/setup/wizard/steps/registration.php
index ae3b6e7..146ec2f 100644
--- a/setup/wizard/steps/registration.php
+++ b/setup/wizard/steps/registration.php
@@ -145,7 +145,7 @@ class registration extends Step
$formPost = $_POST;
$formPost['submitted']['installation_guid'] = $this->temp_variables['installation_guid'];
// TODO set correctly using auto set mechanism
- $_SESSION['installers']['registration']['installation_guid'] = $this->temp_variables['installation_guid'];
+ // $_SESSION['installers']['registration']['installation_guid'] = $this->temp_variables['installation_guid'];
$this->curlForm($formPost);
// Prevent the form being reposted.
@@ -483,7 +483,7 @@ class registration extends Step
'RO' => 'ROMANIA',
'RU' => 'RUSSIAN FEDERATION',
'RW' => 'RWANDA',
-// TODO: Special Character for the e
+// TODO: Special Character for the É
'BL' => 'SAINT BARTHELEMY',
'SH' => 'SAINT HELENA',
'KN' => 'SAINT KITTS AND NEVIS',
diff --git a/setup/wizard/steps/services.php b/setup/wizard/steps/services.php
index 54a0319..b97552b 100644
--- a/setup/wizard/steps/services.php
+++ b/setup/wizard/steps/services.php
@@ -61,7 +61,7 @@ class services extends Step
* @access protected
* @var array
*/
- protected $runInstall = true;
+ public $runInstall = true;
/**
* List of services to be installed
diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl
index 7f88183..40e6199 100644
--- a/setup/wizard/templates/complete.tpl
+++ b/setup/wizard/templates/complete.tpl
@@ -13,7 +13,6 @@
-
Services
@@ -24,7 +23,6 @@
To start the services, using the instructions below:
-
@@ -159,7 +157,6 @@
-
diff --git a/tests/env/testPhpVersion.php b/tests/env/testPhpVersion.php
index daafeb9..34d8f26 100755
--- a/tests/env/testPhpVersion.php
+++ b/tests/env/testPhpVersion.php
@@ -1,5 +1,6 @@