diff --git a/setup/wizard/config/config.xml b/setup/wizard/config/config.xml index 8a49e48..74b7a00 100755 --- a/setup/wizard/config/config.xml +++ b/setup/wizard/config/config.xml @@ -3,9 +3,8 @@ @@ -18,4 +17,4 @@ install complete - + \ No newline at end of file diff --git a/setup/wizard/config/databases.xml b/setup/wizard/config/databases.xml index c4998d1..df6ec5e 100755 --- a/setup/wizard/config/databases.xml +++ b/setup/wizard/config/databases.xml @@ -3,9 +3,8 @@ diff --git a/setup/wizard/config/mysql.xml b/setup/wizard/config/mysql.xml deleted file mode 100755 index ff07b48..0000000 --- a/setup/wizard/config/mysql.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - localhost - dms - root - - 3306 - dmsadmin - - diff --git a/setup/wizard/config/oracle.xml b/setup/wizard/config/oracle.xml deleted file mode 100755 index 969d587..0000000 --- a/setup/wizard/config/oracle.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/setup/wizard/config/postgres.xml b/setup/wizard/config/postgres.xml deleted file mode 100755 index a849320..0000000 --- a/setup/wizard/config/postgres.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/setup/wizard/resources/wizard.css b/setup/wizard/resources/wizard.css index d5e4ad8..fca1545 100755 --- a/setup/wizard/resources/wizard.css +++ b/setup/wizard/resources/wizard.css @@ -10,38 +10,33 @@ body { } h1 { - font-size: 2em; + font-size: 3em; font-weight: normal; padding: 10px 0; - color: #444; + color: #555; } h2 { - font-size: 1.5em; + font-size: 2em; font-weight: normal; padding: 10px 0; color: #555; } h3 { - font-size: 1.2em; + font-size: 1.5em; font-weight: normal; padding: 10px 0; color: #555; } -p { - padding-bottom: 10px; - word-wrap: break-word; -} - a { color: #EC7725; } th { font-weight: bold; - text-align: left; + font-size: 1.1em; padding: 5px 5px; } @@ -54,7 +49,6 @@ td { margin: 50px; margin-top: 20px; text-align: left; - z-index: -1; } .header { @@ -72,32 +66,22 @@ td { } .content { - background: #F1F1F1; } .left { - position: relative; float: left; width: 200px; text-align: center; /*background: url("graphics/left.png") repeat-y;*/ background-position: top left; - background: #F1F1F1; height: inherit; padding-bottom: 20px; padding-top: 40px; } .right { - position: relative; float: left; padding: 20px; - background: white; -} - -.onclick { - color: #EC7725; - cursor: pointer; } .menu { @@ -130,7 +114,6 @@ td { height: 15px; width: 15px; padding-left: 20px; - color: #919191; } .tick { @@ -155,10 +138,6 @@ td { align: center; } -.error { - color: #9F0000; -} - .buttons { margin-top: 20px; position: relative; @@ -187,7 +166,7 @@ td { } .adv_options { - display: none; + } .description { @@ -197,8 +176,13 @@ td { } .top { - font-size: 2em; - font-weight: normal; - padding: 10px 0; - color: #444; + color:#EC7725; +} + +.right_top { + height:45px; +} + +#database td { + width : 340px; } \ No newline at end of file diff --git a/setup/wizard/session.php b/setup/wizard/session.php index 6b3b336..deb1e30 100755 --- a/setup/wizard/session.php +++ b/setup/wizard/session.php @@ -193,7 +193,9 @@ class Session */ public function get($fld) { $this->startSession(); - return $_SESSION [$fld]; + if(isset($_SESSION [$fld])) + return $_SESSION [$fld]; + return false; } /** diff --git a/setup/wizard/step.php b/setup/wizard/step.php index c5bd195..1680890 100755 --- a/setup/wizard/step.php +++ b/setup/wizard/step.php @@ -260,7 +260,7 @@ class Step } /** - * Safer way to return post data helper + * Safer way to return post data * * @author KnowledgeTree Team * @params SimpleXmlObject $simplexml @@ -272,6 +272,18 @@ class Step } /** + * 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 diff --git a/setup/wizard/steps/complete.php b/setup/wizard/steps/complete.php index 5562b27..2d20772 100755 --- a/setup/wizard/steps/complete.php +++ b/setup/wizard/steps/complete.php @@ -1,6 +1,6 @@ done = true; } - + private function setDetails() { $conf = $this->getDataFromSession("configuration"); if($conf) { @@ -71,7 +71,7 @@ class configuration extends Step $this->temp_variables['paths'] = $conf['paths']; } } - + public function doStep() { if($this->next()) { if($this->doRun()){ @@ -97,7 +97,7 @@ class configuration extends Step $this->doRun(); return 'landing'; } - + public function doRun() { $server = $this->getServerInfo(); @@ -120,7 +120,7 @@ class configuration extends Step $port = $_SERVER['SERVER_PORT']; $ssl_enabled = isset($_SERVER['HTTPS']) ? (strtolower($_SERVER['HTTPS']) === 'on' ? 'yes' : 'no') : true; - $pos = strpos($script, '/setup/wizard/'); + $pos = strpos($script, '/wizard/'); $root_url = substr($script, 0, $pos); $server = array(); diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php index e523030..848860f 100755 --- a/setup/wizard/steps/database.php +++ b/setup/wizard/steps/database.php @@ -1,6 +1,6 @@ next()) { $this->setDBConfig(); // Set any posted variables $this->setDetails(); - return 'confirm'; + if($this->doTest()) { // Test + return 'confirm'; + } else { + return 'error'; + } } else if($this->previous()) { return 'previous'; } else if($this->confirm()) { $this->setDataFromSession("database"); // Set Session Information $this->setDBConfig(); // Set any posted variables - if($this->doTest()) { // Test - return 'next'; - } else { - return 'error'; - } + return 'next'; } else if($this->edit()) { $this->setDataFromSession("database"); // Set Session Information, since its an edit return 'landing'; @@ -253,6 +280,14 @@ class database extends Step * @return boolean */ public function doTest() { + if($this->match($this->dmspassword, $this->getPassword1()) != 0) { + $this->error = array("19"=>"Passwords do not match: " . $this->dmspassword." ". $this->getPassword1()); + return false; + } + if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) { + $this->error = array("17"=>"Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2()); + return false; + } $con = @mysql_connect($this->dhost, $this->duname, $this->dpassword); if (!$con) { $this->error = array("1"=>"Could not connect: " . mysql_error()); @@ -262,6 +297,17 @@ class database extends Step } } + public function match($str1, $str2) { + return strcmp($str1, $str2); + } + + public function getPassword1() { + return $_POST['dmspassword2']; + } + + public function getPassword2() { + return $_POST['dmsuserpassword2']; + } /** * Check if theres a database type * @@ -306,16 +352,19 @@ class database extends Step */ public function setDBConfig() { $this->dtype = $this->getPostSafe("dtype"); - $this->dtypes = array("0"=>"mysql");//$this->getPostSafe("dtypes"); + $this->dtypes = array("0"=>"mysql"); // TODO:multiple databases $this->dhost = $this->getPostSafe("dhost"); $this->dport = $this->getPostSafe("dport"); $this->dname = $this->getPostSafe("dname"); $this->duname = $this->getPostSafe("duname"); $this->dpassword = $this->getPostSafe("dpassword"); $this->dmsname = $this->getPostSafe("dmsname"); + $this->dmsusername = $this->getPostSafe("dmsusername"); $this->dmspassword = $this->getPostSafe("dmspassword"); + $this->dmsuserpassword = $this->getPostSafe("dmsuserpassword"); + $this->dbbinary = $this->getPostSafe("dbbinary"); $this->tprefix = $this->getPostSafe("tprefix"); - $this->ddrop = $this->getPostSafe("ddrop"); + $this->ddrop = $this->getPostBoolean("ddrop"); } /** @@ -329,16 +378,19 @@ class database extends Step public function loadDefaults($simplexml) { if($simplexml) { $this->temp_variables['dtype'] = ""; - $this->temp_variables['dtypes'] = array("0"=>"mysql");//$this->getTypes($simplexml->dtypes); + $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases $this->temp_variables['dname'] = (string) $simplexml->dname; $this->temp_variables['duname'] = (string) $simplexml->duname; $this->temp_variables['dhost'] = (string) $simplexml->dhost; $this->temp_variables['dport'] = (string) $simplexml->dport; $this->temp_variables['dpassword'] = ''; $this->temp_variables['dmsname'] = ''; + $this->temp_variables['dmsusername'] = ''; $this->temp_variables['dmspassword'] = ''; + $this->temp_variables['dmsuserpassword'] = ''; + $this->temp_variables['dbbinary'] = ''; $this->temp_variables['tprefix'] = ''; - $this->temp_variables['ddrop'] = 0; + $this->temp_variables['ddrop'] = false; } } @@ -352,16 +404,19 @@ class database extends Step */ private function setDetails() { $this->temp_variables['dtype'] = $this->getPostSafe('dtype'); - $this->temp_variables['dtypes'] = array("0"=>"mysql");//$this->getPostSafe('dtypes'); + $this->temp_variables['dtypes'] = array("0"=>"mysql"); // TODO:multiple databases; $this->temp_variables['dhost'] = $this->getPostSafe('dhost'); $this->temp_variables['dport'] = $this->getPostSafe('dport'); $this->temp_variables['dname'] = $this->getPostSafe('dname'); $this->temp_variables['duname'] = $this->getPostSafe('duname'); $this->temp_variables['dpassword'] = $this->getPostSafe('dpassword'); $this->temp_variables['dmsname'] = $this->getPostSafe('dmsname'); + $this->temp_variables['dmsusername'] = $this->getPostSafe('dmsusername'); $this->temp_variables['dmspassword'] = $this->getPostSafe('dmspassword'); + $this->temp_variables['dmsuserpassword'] = $this->getPostSafe('dmsuserpassword');; + $this->temp_variables['dbbinary'] = $this->getPostSafe('dbbinary'); $this->temp_variables['tprefix'] = $this->getPostSafe('tprefix'); - $this->temp_variables['ddrop'] = $this->getPostSafe('ddrop'); + $this->temp_variables['ddrop'] = $this->getPostBoolean('ddrop'); } /** @@ -474,23 +529,27 @@ class database extends Step * @return object mysql connection */ private function createDB($con) { - if($this->usedb($con)) { // attempt to use the db - if($this->dropdb($con)) { // attempt to drop the db - if($this->create($con)) { // attempt to create the db - - } - } - } else { - if($this->create($con)) { // attempt to create the db - - } - } - + if($this->usedb($con)) { // attempt to use the db + if($this->dropdb($con)) { // attempt to drop the db + if(!$this->create($con)) { // attempt to create the db + $this->error = array("15"=>"Could create database: " . mysql_error()); + return false;// cannot overwrite database + } + } else { + $this->error = array("14"=>"Could not drop database: " . mysql_error()); + return false;// cannot overwrite database + } + } else { + if(!$this->create($con)) { // attempt to create the db + $this->error = array("16"=>"Could create database: " . mysql_error()); + return false;// cannot overwrite database + } + } $this->createDmsUser($con); - $this->createSchema($con); - $this->populateSchema($con); - - return $con; + $this->createSchema($con); + $this->populateSchema($con); + + return true; } /** @@ -550,24 +609,8 @@ class database extends Step return false; } - } - - /** - * Attempts to use a db - * - * @author KnowledgeTree Team - * @params mysql connection object $con - * @access private - * @return boolean - */ - private function usedb2($con) { - $sql = "USE {$this->dname};"; - if (@mysql_query($sql, $con)) { - return $con; - } else { - $this->error = array("4"=>"Error using database: ".mysql_error().""); - return false; - } + + return true; } /** @@ -579,21 +622,20 @@ class database extends Step * @return boolean */ private function createDmsUser($con) { - //TODO - $com = "mysql -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/user.sql"; - exec($com, $output); -// $sql = @file_get_contents("sql/user.sql"); -// if($sql) { -// if (@mysql_query($sql, $con)) { -// return true; -// } else { -// $this->error = array("7"=>"Error populating database : ".mysql_error().""); -// return false; -// } -// } else { -// $this->error = array("8"=>"Error Reading sql File : ".mysql_error().""); -// return false; -// } + if($this->dmsname == '' || $this->dmspassword == '') { + $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/user.sql"; + + return exec($command, $output); + } else { + $sql = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY '{$this->dmsuserpassword}';GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY '{$this->dmspassword}';"; + if (@mysql_query($sql, $con)) { + return true; + } else { + $this->error = array("18"=>"Could not create users in database: ".mysql_error().""); + return false; + } + } + } /** @@ -605,25 +647,8 @@ class database extends Step * @return boolean */ private function createSchema($con) { - // TODO : - $com = "mysql -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/structure.sql"; - exec($com, $output); -// $sql = "USE {$this->dname};"; -// $sql .= file_get_contents("sql/structure.sql"); -// echo $sql;die; -// if($sql) { -// if (mysql_query($sql, $con)) { -// -// return true; -// } else { -// -// $this->error = array("9"=>"Error creating database schema : ".mysql_error().""); -// return false; -// } -// } else { -// $this->error = array("10"=>"Error Reading sql File : ".mysql_error().""); -// return false; -// } + $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/structure.sql"; + exec($command, $output); } /** @@ -635,21 +660,8 @@ class database extends Step * @return boolean */ private function populateSchema($con) { - // TODO : - $com = "mysql -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/data.sql"; - exec($com, $output); -// $sql = @file_get_contents("sql/data.sql"); -// if($sql) { -// if (@mysql_query($sql, $con)) { -// return true; -// } else { -// $this->error = array("11"=>"Error populating database : ".mysql_error().""); -// return false; -// } -// } else { -// $this->error = array("12"=>"Error Reading sql File : ".mysql_error().""); -// return false; -// } + $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/data.sql"; + return exec($command, $output); } /** diff --git a/setup/wizard/steps/dependency_check.php b/setup/wizard/steps/dependency_check.php index 9af7159..6e3db8f 100755 --- a/setup/wizard/steps/dependency_check.php +++ b/setup/wizard/steps/dependency_check.php @@ -1,6 +1,6 @@ checkPhpVersion(); diff --git a/setup/wizard/steps/install.php b/setup/wizard/steps/install.php index 17b873a..f82fbb9 100755 --- a/setup/wizard/steps/install.php +++ b/setup/wizard/steps/install.php @@ -1,6 +1,6 @@ next()) { if($this->doRun()) - + return 'next'; else return 'error'; @@ -59,7 +59,7 @@ class license extends step { return 'previous'; } - return 'landing'; // Just a welcome, so return "next" action + return 'landing'; // Just a license, so return "next" action } public function doRun() { diff --git a/setup/wizard/steps/welcome.php b/setup/wizard/steps/welcome.php index d00605e..de9b19a 100755 --- a/setup/wizard/steps/welcome.php +++ b/setup/wizard/steps/welcome.php @@ -1,6 +1,6 @@ System Configuration -
+

Server Settings

diff --git a/setup/wizard/templates/configuration_confirm.tpl b/setup/wizard/templates/configuration_confirm.tpl index cd7a7f5..4de69ee 100755 --- a/setup/wizard/templates/configuration_confirm.tpl +++ b/setup/wizard/templates/configuration_confirm.tpl @@ -44,7 +44,7 @@ ?> - +
-
- - - -
+ + + + + + + + + + + + + + + + +
/>
+
Advanced Options
+ +
+ + +
- - - - - - - - - - - - - - - - - -
>
- -
- -
Advanced Options
-
- These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings. -
-
- -

-
- If your database is located on a different server, change this.
- -

- -

-
- If your database server is listening to a non-standard port, enter its number.
- -

- -

-
- If more than one application will be sharing this database, enter a table prefix such as kt_ for your KnowledgeTree site here.
- -

- + -
- - + + +
$e) { @@ -75,12 +116,25 @@ Select your database type: }?>
- \ No newline at end of file diff --git a/setup/wizard/templates/database_confirm.tpl b/setup/wizard/templates/database_confirm.tpl index 8c35782..3d11129 100755 --- a/setup/wizard/templates/database_confirm.tpl +++ b/setup/wizard/templates/database_confirm.tpl @@ -1,52 +1,27 @@ -

Database Configuration Confirmation

- -
- + +DB Configuration Confirmation:
$v) { - if(!$k) $dtype = $v; - } - } + ?> + /> +
+ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Selected database type:MySQL
Databse Name:
Administrative / Root Username:
Password:
Database Server Host:
Port:
Table Prefix:
You have selected the option to drop the database if it already exists.
- - +Name:
+Root Username:
+Root Password:
+DMS Admin Username:
+DMS Admin Password:
+DMS User Username:
+DMS User Password:
+Host:
+Port:
+Binary:
+Table Prefix:
+ You are about to drop the table if it exists
diff --git a/setup/wizard/templates/dependency_check.tpl b/setup/wizard/templates/dependency_check.tpl index f7b9d7b..d8125a8 100755 --- a/setup/wizard/templates/dependency_check.tpl +++ b/setup/wizard/templates/dependency_check.tpl @@ -1,15 +1,5 @@

PHP Dependencies Check

-'; - foreach ($errors as $msg){ - echo $msg . "
\n"; - } - echo '
'; -} -?> -

PHP Version Check

     {$version['version']}"; ?> @@ -70,7 +60,7 @@ if($errors){ ?> - +
diff --git a/setup/wizard/templates/install.tpl b/setup/wizard/templates/install.tpl index d04037f..26eb5ee 100755 --- a/setup/wizard/templates/install.tpl +++ b/setup/wizard/templates/install.tpl @@ -1,6 +1,6 @@ install
- +
diff --git a/setup/wizard/templates/license.tpl b/setup/wizard/templates/license.tpl index 4f70b11..0b61746 100755 --- a/setup/wizard/templates/license.tpl +++ b/setup/wizard/templates/license.tpl @@ -1,81 +1,49 @@ -

License Agreement

- -
- $e) { - echo $e; - } - }?> -
- - -
-

KnowledgeTree On-premise Commercial End-User

-

+ +

+
-
-   I accept the agreement + I accept the agreement
-   I do not accept the agreement + I do not accept the agreement +
+
+ $e) { + echo $e; + } + }?>
+
\ No newline at end of file diff --git a/setup/wizard/templates/welcome.tpl b/setup/wizard/templates/welcome.tpl index 0985b2d..caf3b51 100755 --- a/setup/wizard/templates/welcome.tpl +++ b/setup/wizard/templates/welcome.tpl @@ -12,7 +12,7 @@ applications.

-
+
diff --git a/setup/wizard/templates/wizard.tpl b/setup/wizard/templates/wizard.tpl index 36dc35a..ffa7aad 100755 --- a/setup/wizard/templates/wizard.tpl +++ b/setup/wizard/templates/wizard.tpl @@ -1,7 +1,8 @@ - + KnowledgeTree Installer +