Commit 806fd35e27e30a04281a7eae764a7a0dedaf7bd6

Authored by jarrett
1 parent 05ae1784

Merge Work/Home

Commited By: Jarrett Jordaan

Reviewed By: Megan Watson
config/cache-path
1 -var/cache  
config/config-path
1 -config/config.ini 1 +C:\ktdms\config\config.ini
2 \ No newline at end of file 2 \ No newline at end of file
config/config.ini
@@ -9,14 +9,14 @@ @@ -9,14 +9,14 @@
9 dbType = mysql 9 dbType = mysql
10 10
11 ; Database login details 11 ; Database login details
12 -dbHost = localhost  
13 -dbName = dms  
14 -dbUser = dms  
15 -dbPass = djw9281js  
16 -dbPort = default 12 +dbHost = localhost
  13 +dbName = dms_migrate
  14 +dbUser = dmsadmin
  15 +dbPass = js9281djw
  16 +dbPort = 3306
17 17
18 -dbAdminUser = dmsadmin  
19 -dbAdminPass = js9281djw 18 +dbAdminUser = dmsadmin
  19 +dbAdminPass = js9281djw
20 20
21 [KnowledgeTree] 21 [KnowledgeTree]
22 22
@@ -31,7 +31,7 @@ dbAdminPass = js9281djw @@ -31,7 +31,7 @@ dbAdminPass = js9281djw
31 ; 31 ;
32 ; Leave as default to have it automatically detected. 32 ; Leave as default to have it automatically detected.
33 ; 33 ;
34 -fileSystemRoot = default 34 +fileSystemRoot = D:/Program Files/Zend/Apache2/htdocs/knowledgetree
35 35
36 ; Webserver name (host name) 36 ; Webserver name (host name)
37 ; 37 ;
@@ -43,7 +43,7 @@ serverName = default @@ -43,7 +43,7 @@ serverName = default
43 ; 43 ;
44 ; Leave as default to have it automatically detected. 44 ; Leave as default to have it automatically detected.
45 ; 45 ;
46 -sslEnabled = default 46 +sslEnabled = false
47 47
48 ; Path to the web application from the root of the web site. 48 ; Path to the web application from the root of the web site.
49 ; If KT is at http://example.org/foo/, then rootUrl should be '/foo' 49 ; If KT is at http://example.org/foo/, then rootUrl should be '/foo'
@@ -115,11 +115,11 @@ phpErrorLogFile = false @@ -115,11 +115,11 @@ phpErrorLogFile = false
115 115
116 [urls] 116 [urls]
117 ; directories 117 ; directories
118 -varDirectory = ${fileSystemRoot}/var  
119 -logDirectory = ${varDirectory}/log  
120 -documentRoot = ${varDirectory}/Documents 118 +varDirectory = C:\Program Files\ktdms\var
  119 +logDirectory = C:\Program Files\ktdms\var\log
  120 +documentRoot = C:\Program Files\ktdms\var\Documents
121 uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree 121 uiDirectory = ${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree
122 -tmpDirectory = ${varDirectory}/tmp 122 +tmpDirectory = C:\Program Files\ktdms\var\tmp
123 123
124 ;dedicated feed url 124 ;dedicated feed url
125 ;dedicatedrsstitle = RSS Feed Title 125 ;dedicatedrsstitle = RSS Feed Title
@@ -146,4 +146,4 @@ encoding = default @@ -146,4 +146,4 @@ encoding = default
146 ; 146 ;
147 cacheEnabled = true 147 cacheEnabled = true
148 cacheDirectory = ${varDirectory}/cache 148 cacheDirectory = ${varDirectory}/cache
149 -cachePlugins = true  
150 \ No newline at end of file 149 \ No newline at end of file
  150 +cachePlugins = true
setup/migrate/migrateUtil.php
@@ -63,14 +63,14 @@ class MigrateUtil extends InstallUtil { @@ -63,14 +63,14 @@ class MigrateUtil extends InstallUtil {
63 $template_vars['error'] = $error; 63 $template_vars['error'] = $error;
64 $file = "templates/error.tpl"; 64 $file = "templates/error.tpl";
65 if (!file_exists($file)) { 65 if (!file_exists($file)) {
66 - return false; 66 + extract($template_vars); // Extract the vars to local namespace
  67 + ob_start();
  68 + include($file);
  69 + $contents = ob_get_contents();
  70 + ob_end_clean();
  71 + echo $contents;
67 } 72 }
68 - extract($template_vars); // Extract the vars to local namespace  
69 - ob_start();  
70 - include($file);  
71 - $contents = ob_get_contents();  
72 - ob_end_clean();  
73 - echo $contents; 73 + return false;
74 } 74 }
75 75
76 /** 76 /**
@@ -89,19 +89,10 @@ class MigrateUtil extends InstallUtil { @@ -89,19 +89,10 @@ class MigrateUtil extends InstallUtil {
89 89
90 return true; 90 return true;
91 } 91 }
92 -  
93 - public function loadInstallDBUtil() {  
94 - require_once("../wizard/dbUtilities.php");  
95 - return new dbUtilities();  
96 - }  
97 -  
98 - public function loadInstallUtil() {  
99 - require_once("../wizard/steps/services.php");  
100 - return new services();  
101 - }  
102 92
103 public function loadInstallServices() { 93 public function loadInstallServices() {
104 - $s = $this->loadInstallUtil(); 94 + require_once("../wizard/steps/services.php");
  95 + $s = new services();
105 return $s->getServices(); 96 return $s->getServices();
106 } 97 }
107 98
@@ -112,11 +103,6 @@ class MigrateUtil extends InstallUtil { @@ -112,11 +103,6 @@ class MigrateUtil extends InstallUtil {
112 return new $serviceName(); 103 return new $serviceName();
113 } 104 }
114 105
115 - public function loadInstallIni($path) {  
116 - require_once("../wizard/iniUtilities.php");  
117 - return new iniUtilities($path);  
118 - }  
119 -  
120 public function getPort($location) { 106 public function getPort($location) {
121 if(WINDOWS_OS) { 107 if(WINDOWS_OS) {
122 $myIni = "my.ini"; 108 $myIni = "my.ini";
@@ -125,8 +111,8 @@ class MigrateUtil extends InstallUtil { @@ -125,8 +111,8 @@ class MigrateUtil extends InstallUtil {
125 } 111 }
126 $dbConfigPath = $location.DS."mysql".DS."$myIni"; 112 $dbConfigPath = $location.DS."mysql".DS."$myIni";
127 if(file_exists($dbConfigPath)) { 113 if(file_exists($dbConfigPath)) {
128 - $ini = $this->loadInstallIni($dbConfigPath);  
129 - $dbSettings = $ini->getSection('mysqladmin'); 114 + $this->iniUtilities->load($dbConfigPath);
  115 + $dbSettings = $this->iniUtilities->getSection('mysqladmin');
130 return $dbSettings['port']; 116 return $dbSettings['port'];
131 } 117 }
132 118
setup/migrate/migrateWizard.php
@@ -52,16 +52,14 @@ function __autoload($class) { // Attempt and autoload classes @@ -52,16 +52,14 @@ function __autoload($class) { // Attempt and autoload classes
52 if ($class == "template") { // Load existing templating classes 52 if ($class == "template") { // Load existing templating classes
53 require_once("../wizard/template.php"); 53 require_once("../wizard/template.php");
54 require_once("../wizard/lib/helpers/htmlHelper.php"); 54 require_once("../wizard/lib/helpers/htmlHelper.php");
55 - return ;  
56 - }  
57 - if(file_exists(WIZARD_DIR."$class.php")) {  
58 - require_once(WIZARD_DIR."$class.php");  
59 - } elseif (file_exists(STEP_DIR."$class.php")) {  
60 - require_once(STEP_DIR."$class.php");  
61 - } elseif (file_exists(WIZARD_LIB."$class.php")) {  
62 - require_once(WIZARD_LIB."$class.php");  
63 } else { 55 } else {
64 - return null; 56 + if(file_exists(WIZARD_DIR."$class.php")) {
  57 + require_once(WIZARD_DIR."$class.php");
  58 + } elseif (file_exists(STEP_DIR."$class.php")) {
  59 + require_once(STEP_DIR."$class.php");
  60 + } elseif (file_exists(WIZARD_LIB."$class.php")) {
  61 + require_once(WIZARD_LIB."$class.php");
  62 + }
65 } 63 }
66 } 64 }
67 65
@@ -233,8 +231,6 @@ class MigrateWizard { @@ -233,8 +231,6 @@ class MigrateWizard {
233 return true; 231 return true;
234 break; 232 break;
235 } 233 }
236 -  
237 - return $res;  
238 } 234 }
239 235
240 /** 236 /**
setup/migrate/migrater.php
@@ -157,7 +157,7 @@ class Migrater { @@ -157,7 +157,7 @@ class Migrater {
157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name); 157 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.$name);
158 } catch (Exception $e) { 158 } catch (Exception $e) {
159 $util = new MigrateUtil(); 159 $util = new MigrateUtil();
160 - $util->error("Error reading configuration file: $name"); 160 + $util->error("Error reading configuration file: $e");
161 exit(); 161 exit();
162 } 162 }
163 } 163 }
@@ -431,8 +431,7 @@ class Migrater { @@ -431,8 +431,7 @@ class Migrater {
431 if($class->runMigrate()) { // Check if step needs to be migrated 431 if($class->runMigrate()) { // Check if step needs to be migrated
432 $class->setDataFromSession($className); // Set Session Information 432 $class->setDataFromSession($className); // Set Session Information
433 $class->setPostConfig(); // Set any posted variables 433 $class->setPostConfig(); // Set any posted variables
434 - $response = $class->migrateStep(); // Run migrate step  
435 - // TODO : Break on error response 434 + $class->migrateStep(); // Run migrate step
436 } 435 }
437 } else { 436 } else {
438 $util = new MigrateUtil(); 437 $util = new MigrateUtil();
setup/migrate/step.php
@@ -128,7 +128,6 @@ class Step @@ -128,7 +128,6 @@ class Step
128 128
129 public function __construct() { 129 public function __construct() {
130 $this->util = new MigrateUtil(); 130 $this->util = new MigrateUtil();
131 - $this->dbhandler = $this->util->loadInstallDBUtil();  
132 } 131 }
133 132
134 /** 133 /**
setup/migrate/stepAction.php
@@ -224,17 +224,18 @@ class stepAction { @@ -224,17 +224,18 @@ class stepAction {
224 if($this->action->storeInSession()) { // Check if class values need to be stored in session 224 if($this->action->storeInSession()) { // Check if class values need to be stored in session
225 $this->_loadStepToSession($this->stepName); // Send class to session 225 $this->_loadStepToSession($this->stepName); // Send class to session
226 } 226 }
227 - if ($response == 'error') {  
228 - $this->_handleErrors(); // Send Errors to session  
229 - } else {  
230 - $this->_clearErrors($this->stepName); // Send Errors to session  
231 - }  
232 - return $response;  
233 } else { 227 } else {
234 $this->stepName = 'errors'; 228 $this->stepName = 'errors';
235 $this->action = $this->createStep(); 229 $this->action = $this->createStep();
236 $this->action->error = array('Class File Missing in Step Directory'); 230 $this->action->error = array('Class File Missing in Step Directory');
  231 +
  232 + }
  233 + if ($response == 'error') {
  234 + $this->_handleErrors(); // Send Errors to session
  235 + } else {
  236 + $this->_clearErrors($this->stepName); // Send Errors to session
237 } 237 }
  238 + return $response;
238 } 239 }
239 240
240 /** 241 /**
@@ -308,7 +309,7 @@ class stepAction { @@ -308,7 +309,7 @@ class stepAction {
308 $menu = ''; 309 $menu = '';
309 $active = false; 310 $active = false;
310 if($this->stepClassNames) { 311 if($this->stepClassNames) {
311 - foreach ($this->stepClassNames as $k=>$step) { 312 + foreach ($this->stepClassNames as $step) {
312 if($this->step_names[$step] != '') { 313 if($this->step_names[$step] != '') {
313 $item = $this->step_names[$step]; 314 $item = $this->step_names[$step];
314 } else { 315 } else {
@@ -452,7 +453,7 @@ class stepAction { @@ -452,7 +453,7 @@ class stepAction {
452 * @access private 453 * @access private
453 * @return void 454 * @return void
454 */ 455 */
455 - private function _loadValueToSession($class, $k, $v, $overwrite = false) { 456 + private function _loadValueToSession($class, $k, $v) {
456 if($this->session != null) { 457 if($this->session != null) {
457 $this->session->setClass($class, $k, $v); 458 $this->session->setClass($class, $k, $v);
458 } else { 459 } else {
@@ -502,8 +503,7 @@ class stepAction { @@ -502,8 +503,7 @@ class stepAction {
502 * @access private 503 * @access private
503 * @return void 504 * @return void
504 */ 505 */
505 - private function _loadErrorToSession($class, $k, $v, $overwrite = false) {  
506 - $k = "errors"; 506 + private function _loadErrorToSession($class, $k = "errors", $v) {
507 if($this->session != null) { 507 if($this->session != null) {
508 $this->session->setClassError($class, $k, $v); 508 $this->session->setClassError($class, $k, $v);
509 } else { 509 } else {
setup/migrate/steps/migrateInstallation.php
@@ -225,8 +225,10 @@ class migrateInstallation extends step @@ -225,8 +225,10 @@ class migrateInstallation extends step
225 } 225 }
226 226
227 private function loadConfig($path) { 227 private function loadConfig($path) {
228 - $ini = $this->util->loadInstallIni($path);  
229 - $dbSettings = $ini->getSection('db'); 228 +// $ini = $this->util->loadInstallIni($path);
  229 + $this->util->iniUtilities->load($path);
  230 +// $dbSettings = $ini->getSection('db');
  231 + $dbSettings = $this->util->iniUtilities->getSection('db');
230 $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 232 $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'],
231 'dbName'=> $dbSettings['dbName'], 233 'dbName'=> $dbSettings['dbName'],
232 'dbUser'=> $dbSettings['dbUser'], 234 'dbUser'=> $dbSettings['dbUser'],
@@ -235,14 +237,16 @@ class migrateInstallation extends step @@ -235,14 +237,16 @@ class migrateInstallation extends step
235 'dbAdminUser'=> $dbSettings['dbAdminUser'], 237 'dbAdminUser'=> $dbSettings['dbAdminUser'],
236 'dbAdminPass'=> $dbSettings['dbAdminPass'], 238 'dbAdminPass'=> $dbSettings['dbAdminPass'],
237 ); 239 );
238 - $ktSettings = $ini->getSection('KnowledgeTree'); 240 + $ktSettings = $this->util->iniUtilities->getSection('KnowledgeTree');
  241 +// $ktSettings = $ini->getSection('KnowledgeTree');
239 $froot = $ktSettings['fileSystemRoot']; 242 $froot = $ktSettings['fileSystemRoot'];
240 if ($froot == 'default') { 243 if ($froot == 'default') {
241 $froot = $this->location; 244 $froot = $this->location;
242 } 245 }
243 $this->ktSettings = array('fileSystemRoot'=> $froot, 246 $this->ktSettings = array('fileSystemRoot'=> $froot,
244 ); 247 );
245 - $urlPaths = $ini->getSection('urls'); 248 +// $urlPaths = $ini->getSection('urls');
  249 + $urlPaths = $this->util->iniUtilities->getSection('urls');
246 $varDir = $froot.DS.'var'; 250 $varDir = $froot.DS.'var';
247 $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir), 251 $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir),
248 array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'), 252 array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
setup/migrate/steps/migrateServices.php
@@ -127,7 +127,6 @@ class migrateServices extends Step @@ -127,7 +127,6 @@ class migrateServices extends Step
127 public function doStep() 127 public function doStep()
128 { 128 {
129 $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent); 129 $this->temp_variables = array("step_name"=>"services", "silent"=>$this->silent);
130 - $this->installServices = $this->util->loadInstallUtil(); // Use installer utility class  
131 $this->services = $this->util->loadInstallServices(); // Use installer services class 130 $this->services = $this->util->loadInstallServices(); // Use installer services class
132 $this->storeSilent(); 131 $this->storeSilent();
133 if(!$this->inStep("services")) { 132 if(!$this->inStep("services")) {
setup/upgrade/step.php
@@ -110,7 +110,7 @@ class Step @@ -110,7 +110,7 @@ class Step
110 110
111 public function __construct() { 111 public function __construct() {
112 $this->util = new UpgradeUtil(); 112 $this->util = new UpgradeUtil();
113 - $this->dbhandler = $this->util->loadInstallDBUtil(); 113 + //$this->dbhandler = $this->util->dbUtilities;
114 } 114 }
115 115
116 /** 116 /**
setup/upgrade/steps/upgradeDatabase.php
@@ -242,7 +242,9 @@ class upgradeDatabase extends Step @@ -242,7 +242,9 @@ class upgradeDatabase extends Step
242 } 242 }
243 243
244 private function readConfig($path) { 244 private function readConfig($path) {
245 - $ini = $this->util->loadInstallIni($path); 245 + //$ini = $this->util->loadInstallIni($path);
  246 + $ini = $this->util->iniUtilities;
  247 + $ini->load($path);
246 $dbSettings = $ini->getSection('db'); 248 $dbSettings = $ini->getSection('db');
247 $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'], 249 $this->dbSettings = array('dbHost'=> $dbSettings['dbHost'],
248 'dbName'=> $dbSettings['dbName'], 250 'dbName'=> $dbSettings['dbName'],
setup/upgrade/steps/upgradeWelcome.php
@@ -40,6 +40,9 @@ @@ -40,6 +40,9 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
  43 +//require_once('../../config/dmsDefaults.php');
  44 +//require_once KT_LIB_DIR . '/authentication/authenticationutil.inc.php';
  45 +
43 class upgradeWelcome extends step { 46 class upgradeWelcome extends step {
44 47
45 protected $silent = false; 48 protected $silent = false;
@@ -91,15 +94,9 @@ class upgradeWelcome extends step { @@ -91,15 +94,9 @@ class upgradeWelcome extends step {
91 $dconf = $ini->getSection('db'); 94 $dconf = $ini->getSection('db');
92 $this->dbhandler->load($dconf['dbHost'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']); 95 $this->dbhandler->load($dconf['dbHost'], $dconf['dbUser'], $dconf['dbPass'], $dconf['dbName']);
93 } 96 }
94 - $sQuery = "SELECT count(*) AS match_count FROM users WHERE username = '$username' AND password = '".md5($password)."'";  
95 - $res = $this->dbhandler->query($sQuery);  
96 - $ass = $this->dbhandler->fetchAssoc($res);  
97 - if(isset($ass[0]['match_count'])) {  
98 - if($ass[0]['match_count'])  
99 - return true;  
100 - }  
101 $this->error[] = 'Could Not Authenticate User'; 97 $this->error[] = 'Could Not Authenticate User';
102 return false; 98 return false;
  99 +
103 } 100 }
104 101
105 public function getErrors() { 102 public function getErrors() {
setup/upgrade/upgradeUtil.php
@@ -40,10 +40,9 @@ @@ -40,10 +40,9 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
43 -//require_once('../../config/dmsDefaults.php');  
44 require_once("../wizard/installUtil.php"); 43 require_once("../wizard/installUtil.php");
45 44
46 -class UpgradeUtil extends InstallUtil { 45 +class UpgradeUtil extends InstallUtil {
47 /** 46 /**
48 * Check if system needs to be upgraded 47 * Check if system needs to be upgraded
49 * 48 *
@@ -75,16 +74,6 @@ class UpgradeUtil extends InstallUtil { @@ -75,16 +74,6 @@ class UpgradeUtil extends InstallUtil {
75 echo $contents; 74 echo $contents;
76 } 75 }
77 76
78 - public function loadInstallIni($path) {  
79 - require_once("../wizard/iniUtilities.php");  
80 - return new iniUtilities($path);  
81 - }  
82 -  
83 - public function loadInstallDBUtil() {  
84 - require_once("../wizard/dbUtilities.php");  
85 - return new dbUtilities();  
86 - }  
87 -  
88 /** 77 /**
89 * Function to send output to the browser prior to normal dynamic loading of a template after code execution 78 * Function to send output to the browser prior to normal dynamic loading of a template after code execution
90 * 79 *
setup/wizard/iniUtilities.php
@@ -43,11 +43,8 @@ class iniUtilities { @@ -43,11 +43,8 @@ class iniUtilities {
43 private $lineNum = 0; 43 private $lineNum = 0;
44 private $exists = ''; 44 private $exists = '';
45 45
46 - function iniUtilities() {  
47 - $this->iniFile = '';  
48 - }  
49 -  
50 - function load($iniFile) { 46 +
  47 + function load($iniFile) {
51 if($this->iniFile != $iniFile) { 48 if($this->iniFile != $iniFile) {
52 $this->cleanArray = array(); 49 $this->cleanArray = array();
53 $this->lineNum = 0; 50 $this->lineNum = 0;
@@ -56,9 +53,11 @@ class iniUtilities { @@ -56,9 +53,11 @@ class iniUtilities {
56 $this->iniFile = $iniFile; 53 $this->iniFile = $iniFile;
57 $this->backupIni($iniFile); 54 $this->backupIni($iniFile);
58 $this->read($iniFile); 55 $this->read($iniFile);
59 -  
60 } 56 }
61 57
  58 + function __construct() {
  59 + }
  60 +
62 /** 61 /**
63 * Create a backup with the date as an extension in the same location as the original config.ini 62 * Create a backup with the date as an extension in the same location as the original config.ini
64 * 63 *
setup/wizard/installUtil.php
@@ -40,12 +40,14 @@ @@ -40,12 +40,14 @@
40 * @version Version 0.1 40 * @version Version 0.1
41 */ 41 */
42 42
  43 +require_once("../wizard/iniUtilities.php");
  44 +require_once("../wizard/dbUtilities.php");
43 45
44 class InstallUtil { 46 class InstallUtil {
45 47
46 private $salt = 'installers'; 48 private $salt = 'installers';
47 - public $dbHandler = null;  
48 - public $iniHandler = null; 49 + public $dbUtilities = null;
  50 + public $iniUtilities = null;
49 51
50 /** 52 /**
51 * Constructs installation object 53 * Constructs installation object
@@ -54,8 +56,8 @@ class InstallUtil { @@ -54,8 +56,8 @@ class InstallUtil {
54 * @access public 56 * @access public
55 */ 57 */
56 public function __construct() { 58 public function __construct() {
57 - $this->dbHandler = new dbUtilities();  
58 - $this->iniHandler = new iniUtilities(); 59 + $this->dbUtilities = new dbUtilities();
  60 + $this->iniUtilities = new iniUtilities();
59 } 61 }
60 62
61 /** 63 /**
setup/wizard/step.php
@@ -127,7 +127,6 @@ class Step @@ -127,7 +127,6 @@ class Step
127 // public $dbhandler; 127 // public $dbhandler;
128 128
129 public function __construct() { 129 public function __construct() {
130 -// $this->dbhandler = new dbUtilities();  
131 $this->util = new InstallUtil(); 130 $this->util = new InstallUtil();
132 } 131 }
133 /** 132 /**
setup/wizard/steps/complete.php
@@ -142,8 +142,8 @@ class complete extends Step { @@ -142,8 +142,8 @@ class complete extends Step {
142 // retrieve database information from session 142 // retrieve database information from session
143 $dbconf = $this->getDataFromSession("database"); 143 $dbconf = $this->getDataFromSession("database");
144 // make db connection - admin 144 // make db connection - admin
145 - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']);  
146 - $loaded = $this->util->dbHandler->getDatabaseLink(); 145 + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']);
  146 + $loaded = $this->util->dbUtilities->getDatabaseLink();
147 if (!$loaded) { 147 if (!$loaded) {
148 $this->temp_variables['dbConnectAdmin'] .= '<td><div class="cross"></div></td>' 148 $this->temp_variables['dbConnectAdmin'] .= '<td><div class="cross"></div></td>'
149 . '<td class="error">Unable to connect to database (user: ' 149 . '<td class="error">Unable to connect to database (user: '
@@ -157,20 +157,20 @@ class complete extends Step { @@ -157,20 +157,20 @@ class complete extends Step {
157 } 157 }
158 158
159 // make db connection - user 159 // make db connection - user
160 - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']);  
161 - $loaded = $this->util->dbHandler->getDatabaseLink(); 160 + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsusername'], $dbconf['dmsuserpassword'], $dbconf['dname']);
  161 + $loaded = $this->util->dbUtilities->getDatabaseLink();
162 // if we can log in to the database, check access 162 // if we can log in to the database, check access
163 // TODO check write access? 163 // TODO check write access?
164 if ($loaded) 164 if ($loaded)
165 { 165 {
166 $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')'); 166 $this->temp_variables['dbConnectUser'] .= sprintf($html, 'tick', '', 'Database connectivity successful (user: ' . $dbconf['dmsusername'] . ')');
167 167
168 - $qresult = $this->util->dbHandler->query('SELECT COUNT(id) FROM documents'); 168 + $qresult = $this->util->dbUtilities->query('SELECT COUNT(id) FROM documents');
169 if (!$qresult) 169 if (!$qresult)
170 { 170 {
171 $this->temp_variables['dbPrivileges'] .= '<td style="width:15px;"><div class="cross" style="float:left;"></div></td>' 171 $this->temp_variables['dbPrivileges'] .= '<td style="width:15px;"><div class="cross" style="float:left;"></div></td>'
172 . '<td class="error" style="width:500px;">' 172 . '<td class="error" style="width:500px;">'
173 - . 'Unable to do a basic database query. Error: ' . $this->util->dbHandler->getLastError() 173 + . 'Unable to do a basic database query. Error: ' . $this->util->dbUtilities->getLastError()
174 . '</td>'; 174 . '</td>';
175 $this->privileges_check = 'cross'; 175 $this->privileges_check = 'cross';
176 $this->privileges_check = 'cross'; 176 $this->privileges_check = 'cross';
@@ -183,17 +183,17 @@ class complete extends Step { @@ -183,17 +183,17 @@ class complete extends Step {
183 183
184 // check transaction support 184 // check transaction support
185 $sTable = 'system_settings'; 185 $sTable = 'system_settings';
186 - $this->util->dbHandler->startTransaction();  
187 - $this->util->dbHandler->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")');  
188 - $this->util->dbHandler->rollback();  
189 - $res = $this->util->dbHandler->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1"); 186 + $this->util->dbUtilities->startTransaction();
  187 + $this->util->dbUtilities->query('INSERT INTO ' . $sTable . ' (name, value) VALUES ("transactionTest", "1")');
  188 + $this->util->dbUtilities->rollback();
  189 + $res = $this->util->dbUtilities->query("SELECT id FROM $sTable WHERE name = 'transactionTest' LIMIT 1");
190 if (!$res) { 190 if (!$res) {
191 $this->temp_variables['dbTransaction'] .= sprintf($html, 'cross', 'class="error"', 'Transaction support not available in database'); 191 $this->temp_variables['dbTransaction'] .= sprintf($html, 'cross', 'class="error"', 'Transaction support not available in database');
192 $this->privileges_check = 'cross'; 192 $this->privileges_check = 'cross';
193 } else { 193 } else {
194 $this->temp_variables['dbTransaction'] .= sprintf($html, 'tick', '', 'Database has transaction support'); 194 $this->temp_variables['dbTransaction'] .= sprintf($html, 'tick', '', 'Database has transaction support');
195 } 195 }
196 - $this->util->dbHandler->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"'); 196 + $this->util->dbUtilities->query('DELETE FROM ' . $sTable . ' WHERE name = "transactionTest"');
197 } 197 }
198 else 198 else
199 { 199 {
setup/wizard/steps/configuration.php
@@ -307,7 +307,7 @@ class configuration extends Step @@ -307,7 +307,7 @@ class configuration extends Step
307 { 307 {
308 $conf = $this->getDataFromSession("configuration"); // get data from the server 308 $conf = $this->getDataFromSession("configuration"); // get data from the server
309 $dbconf = $this->getDataFromSession("database"); 309 $dbconf = $this->getDataFromSession("database");
310 - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']); 310 + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['dmsname'], $dbconf['dmspassword'], $dbconf['dname']);
311 $server = $conf['server']; 311 $server = $conf['server'];
312 $paths = $conf['paths']; 312 $paths = $conf['paths'];
313 if ($this->util->isMigration()) { // Check if its an upgrade 313 if ($this->util->isMigration()) { // Check if its an upgrade
@@ -317,24 +317,24 @@ class configuration extends Step @@ -317,24 +317,24 @@ class configuration extends Step
317 $this->readConfigPath(); // initialise writing to config.ini 317 $this->readConfigPath(); // initialise writing to config.ini
318 } 318 }
319 $this->getFromConfigPath(); // Sets config Paths 319 $this->getFromConfigPath(); // Sets config Paths
320 - if(file_exists($this->confpaths['configIni'])) {  
321 - $this->util->iniHandler->load($this->confpaths['configIni']); 320 + if(file_exists($configPath)) {
  321 + $this->util->iniUtilities->load($configPath);
322 } 322 }
323 - if(!$this->util->iniHandler === false){ // write out the config.ini file  
324 - $this->writeUrlSection();  
325 - $this->writeDBSection($server);  
326 - $this->writeDBPathSection($paths);  
327 - $this->util->iniHandler->write(); 323 + $this->writeUrlSection();
  324 + $this->writeDBSection($server);
  325 + $this->writeDBPathSection($paths);
  326 + if(!$this->util->iniUtilities === false){ // write out the config.ini file
  327 + $this->util->iniUtilities->write();
328 } 328 }
329 - $this->util->dbHandler->close(); // close the database connection  
330 - $this->writeCachePath($this->getCachePath(), $paths['cacheDirectory']['path']); // Write cache path file  
331 - $this->writeConfigPath($this->getContentPath(), $this->confpaths['configIni']); // Write config file 329 + $this->util->dbUtilities->close(); // close the database connection
  330 + $this->writeCachePath(); // Write cache path file
  331 + $this->writeConfigPath($configPath); // Write config file
332 } 332 }
333 333
334 private function writeUrlSection() { 334 private function writeUrlSection() {
335 $directories = $this->registerDirs(); 335 $directories = $this->registerDirs();
336 foreach($directories as $item) { // write server settings to config_settings table and config.ini 336 foreach($directories as $item) { // write server settings to config_settings table and config.ini
337 - $this->util->iniHandler->updateItem($item['section'], $item['setting'], $item['value']); 337 + $this->util->iniUtilities->updateItem($item['section'], $item['setting'], $item['value']);
338 } 338 }
339 } 339 }
340 340
@@ -348,14 +348,14 @@ class configuration extends Step @@ -348,14 +348,14 @@ class configuration extends Step
348 $value = mysql_real_escape_string($item['path']); 348 $value = mysql_real_escape_string($item['path']);
349 $setting = mysql_real_escape_string($item['setting']); 349 $setting = mysql_real_escape_string($item['setting']);
350 $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; 350 $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'";
351 - $this->util->dbHandler->query($sql); 351 + $this->util->dbUtilities->query($sql);
352 } 352 }
353 } 353 }
354 } 354 }
355 355
356 private function writeDBSection($server) { 356 private function writeDBSection($server) {
357 $dbconf = $this->getDataFromSession("database"); // retrieve database information from session 357 $dbconf = $this->getDataFromSession("database"); // retrieve database information from session
358 - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection 358 + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection
359 $server = $this->registerDBConfig($server, $dbconf); // add db config to server variables 359 $server = $this->registerDBConfig($server, $dbconf); // add db config to server variables
360 $table = 'config_settings'; 360 $table = 'config_settings';
361 foreach($server as $item) { // write server settings to config_settings table and config.ini 361 foreach($server as $item) { // write server settings to config_settings table and config.ini
@@ -368,14 +368,14 @@ class configuration extends Step @@ -368,14 +368,14 @@ class configuration extends Step
368 if($value == 'no'){ 368 if($value == 'no'){
369 $value = 'false'; 369 $value = 'false';
370 } 370 }
371 - $this->util->iniHandler->updateItem($item['section'], $item['setting'], $value); 371 + $this->util->iniUtilities->updateItem($item['section'], $item['setting'], $value);
372 break; 372 break;
373 case 'db': 373 case 'db':
374 $value = mysql_real_escape_string($item['value']); 374 $value = mysql_real_escape_string($item['value']);
375 $setting = mysql_real_escape_string($item['setting']); 375 $setting = mysql_real_escape_string($item['setting']);
376 376
377 $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; 377 $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'";
378 - $this->util->dbHandler->query($sql); 378 + $this->util->dbUtilities->query($sql);
379 break; 379 break;
380 } 380 }
381 } 381 }
@@ -573,12 +573,13 @@ class configuration extends Step @@ -573,12 +573,13 @@ class configuration extends Step
573 573
574 public function readConfigPathIni() { 574 public function readConfigPathIni() {
575 if(isset($this->temp_variables['paths']['configFile']['path'])) { 575 if(isset($this->temp_variables['paths']['configFile']['path'])) {
576 - return $this->temp_variables['paths']['configFile']['path']; 576 + if($this->temp_variables['paths']['configFile']['path'] != '')
  577 + return $this->temp_variables['paths']['configFile']['path'];
577 } 578 }
578 $configPath = $this->getContentPath(); 579 $configPath = $this->getContentPath();
579 if(!$configPath) return false; 580 if(!$configPath) return false;
580 - $this->util->iniHandler->load($configPath);  
581 - $data = $this->util->iniHandler->getFileByLine(); 581 + $this->util->iniUtilities->load($configPath);
  582 + $data = $this->util->iniUtilities->getFileByLine();
582 $firstline = true; 583 $firstline = true;
583 foreach ($data as $k=>$v) { 584 foreach ($data as $k=>$v) {
584 if(preg_match('/config.ini/', $k)) { // Find config.ini 585 if(preg_match('/config.ini/', $k)) { // Find config.ini
@@ -600,8 +601,8 @@ class configuration extends Step @@ -600,8 +601,8 @@ class configuration extends Step
600 private function readConfigPath() { 601 private function readConfigPath() {
601 $configPath = $this->getContentPath(); 602 $configPath = $this->getContentPath();
602 if(!$configPath) return false; 603 if(!$configPath) return false;
603 - $this->util->iniHandler->load($configPath);  
604 - $data = $this->util->iniHandler->getFileByLine(); 604 + $this->util->iniUtilities->load($configPath);
  605 + $data = $this->util->iniUtilities->getFileByLine();
605 $firstline = true; 606 $firstline = true;
606 foreach ($data as $k=>$v) { 607 foreach ($data as $k=>$v) {
607 if($firstline) { // First line holds the var directory 608 if($firstline) { // First line holds the var directory
setup/wizard/steps/database.php
@@ -320,11 +320,11 @@ class database extends Step @@ -320,11 +320,11 @@ class database extends Step
320 return false; 320 return false;
321 } 321 }
322 if($this->dport == '') { 322 if($this->dport == '') {
323 - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); 323 + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
324 } else { 324 } else {
325 - $this->util->dbHandler->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); 325 + $this->util->dbUtilities->load($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
326 } 326 }
327 - if (!$this->util->dbHandler->getDatabaseLink()) { 327 + if (!$this->util->dbUtilities->getDatabaseLink()) {
328 $this->error['con'] = "Could not connect to the database, please check username and password"; 328 $this->error['con'] = "Could not connect to the database, please check username and password";
329 return false; 329 return false;
330 } else { 330 } else {
@@ -339,7 +339,7 @@ class database extends Step @@ -339,7 +339,7 @@ class database extends Step
339 } 339 }
340 340
341 public function dbExists() { 341 public function dbExists() {
342 - return $this->util->dbHandler->useDb(); 342 + return $this->util->dbUtilities->useDb();
343 } 343 }
344 344
345 public function match($str1, $str2) { 345 public function match($str1, $str2) {
@@ -500,7 +500,6 @@ class database extends Step @@ -500,7 +500,6 @@ class database extends Step
500 * @return object SimpleXmlObject 500 * @return object SimpleXmlObject
501 */ 501 */
502 public function readXml() { 502 public function readXml() {
503 -// echo CONF_DIR."databases.xml";  
504 $simplexml = simplexml_load_file(CONF_DIR."databases.xml"); 503 $simplexml = simplexml_load_file(CONF_DIR."databases.xml");
505 504
506 return $simplexml; 505 return $simplexml;
@@ -583,7 +582,7 @@ class database extends Step @@ -583,7 +582,7 @@ class database extends Step
583 * @return object mysql connection 582 * @return object mysql connection
584 */ 583 */
585 private function connectMysql() { 584 private function connectMysql() {
586 - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); 585 + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
587 } 586 }
588 587
589 /** 588 /**
@@ -642,7 +641,7 @@ class database extends Step @@ -642,7 +641,7 @@ class database extends Step
642 $this->error['con'] = "Could not create database: "; 641 $this->error['con'] = "Could not create database: ";
643 } 642 }
644 } 643 }
645 - $this->util->dbHandler->clearErrors(); 644 + $this->util->dbUtilities->clearErrors();
646 if(!$this->createDmsUser()) { // Create dms users 645 if(!$this->createDmsUser()) { // Create dms users
647 $this->error['con'] = "Could not create database users "; 646 $this->error['con'] = "Could not create database users ";
648 } 647 }
@@ -666,8 +665,7 @@ class database extends Step @@ -666,8 +665,7 @@ class database extends Step
666 */ 665 */
667 private function create() { 666 private function create() {
668 $sql = "CREATE DATABASE {$this->dname}"; 667 $sql = "CREATE DATABASE {$this->dname}";
669 - if ($this->util->dbHandler->query($sql)) {  
670 - 668 + if ($this->util->dbUtilities->query($sql)) {
671 return true; 669 return true;
672 } 670 }
673 671
@@ -683,7 +681,7 @@ class database extends Step @@ -683,7 +681,7 @@ class database extends Step
683 * @return boolean 681 * @return boolean
684 */ 682 */
685 private function usedb() { 683 private function usedb() {
686 - if($this->util->dbHandler->useDb()) { 684 + if($this->util->dbUtilities->useDb()) {
687 return true; 685 return true;
688 } else { 686 } else {
689 $this->error['con'] = "Error using database: {$this->dname}"; 687 $this->error['con'] = "Error using database: {$this->dname}";
@@ -702,7 +700,7 @@ class database extends Step @@ -702,7 +700,7 @@ class database extends Step
702 private function dropdb() { 700 private function dropdb() {
703 if($this->ddrop) { 701 if($this->ddrop) {
704 $sql = "DROP DATABASE {$this->dname};"; 702 $sql = "DROP DATABASE {$this->dname};";
705 - if(!$this->util->dbHandler->query($sql)) { 703 + if(!$this->util->dbUtilities->query($sql)) {
706 $this->error['con'] = "Cannot drop database: {$this->dname}"; 704 $this->error['con'] = "Cannot drop database: {$this->dname}";
707 return false; 705 return false;
708 } 706 }
@@ -724,7 +722,7 @@ class database extends Step @@ -724,7 +722,7 @@ class database extends Step
724 private function createDmsUser() { 722 private function createDmsUser() {
725 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; 723 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";";
726 $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; 724 $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";
727 - if ($this->util->dbHandler->query($user1) && $this->util->dbHandler->query($user2)) { 725 + if ($this->util->dbUtilities->query($user1) && $this->util->dbUtilities->query($user2)) {
728 return true; 726 return true;
729 } else { 727 } else {
730 $this->error['con'] = "Could not create users for database: {$this->dname}"; 728 $this->error['con'] = "Could not create users for database: {$this->dname}";
@@ -751,7 +749,7 @@ class database extends Step @@ -751,7 +749,7 @@ class database extends Step
751 while (!feof($handle)) { 749 while (!feof($handle)) {
752 $query.= fgets($handle, 4096); 750 $query.= fgets($handle, 4096);
753 if (substr(rtrim($query), -1) == ';') { 751 if (substr(rtrim($query), -1) == ';') {
754 - $this->util->dbHandler->query($query); 752 + $this->util->dbUtilities->query($query);
755 $query = ''; 753 $query = '';
756 } 754 }
757 } 755 }
@@ -778,9 +776,9 @@ class database extends Step @@ -778,9 +776,9 @@ class database extends Step
778 $sqlFile = $dbMigrate['dumpLocation']; 776 $sqlFile = $dbMigrate['dumpLocation'];
779 $this->parse_mysql_dump($sqlFile); 777 $this->parse_mysql_dump($sqlFile);
780 $dropPluginHelper = "TRUNCATE plugin_helper;"; 778 $dropPluginHelper = "TRUNCATE plugin_helper;";
781 - $this->util->dbHandler->query($dropPluginHelper); 779 + $this->util->dbUtilities->query($dropPluginHelper);
782 $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";'; 780 $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";';
783 - $this->util->dbHandler->query($updateUrls); 781 + $this->util->dbUtilities->query($updateUrls);
784 return true; 782 return true;
785 } 783 }
786 /** 784 /**
@@ -793,7 +791,7 @@ class database extends Step @@ -793,7 +791,7 @@ class database extends Step
793 */ 791 */
794 private function closeMysql() { 792 private function closeMysql() {
795 try { 793 try {
796 - $this->util->dbHandler->close(); 794 + $this->util->dbUtilities->close();
797 } catch (Exeption $e) { 795 } catch (Exeption $e) {
798 $this->error['con'] = "Could not close: " . $e; 796 $this->error['con'] = "Could not close: " . $e;
799 } 797 }
@@ -844,7 +842,7 @@ class database extends Step @@ -844,7 +842,7 @@ class database extends Step
844 $this->dpassword = 'root'; 842 $this->dpassword = 'root';
845 $this->dname = 'dms_install'; 843 $this->dname = 'dms_install';
846 $this->dbbinary = 'mysql'; 844 $this->dbbinary = 'mysql';
847 - $this->util->dbHandler->load($this->dhost, $this->duname, $this->dpassword, $this->dname); 845 + $this->util->dbUtilities->load($this->dhost, $this->duname, $this->dpassword, $this->dname);
848 $this->createSchema(); 846 $this->createSchema();
849 echo 'Schema loaded<br>'; 847 echo 'Schema loaded<br>';
850 } 848 }
setup/wizard/steps/install.php
@@ -107,14 +107,14 @@ class install extends step @@ -107,14 +107,14 @@ class install extends step
107 public function callHome() { 107 public function callHome() {
108 $conf = $this->getDataFromSession("install"); // retrieve database information from session 108 $conf = $this->getDataFromSession("install"); // retrieve database information from session
109 $dbconf = $this->getDataFromSession("database"); 109 $dbconf = $this->getDataFromSession("database");
110 - $this->util->dbHandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection 110 + $this->util->dbUtilities->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection
111 $complete = 1; 111 $complete = 1;
112 if($conf['call_home'] == 'enable'){ 112 if($conf['call_home'] == 'enable'){
113 $complete = 0; 113 $complete = 0;
114 } 114 }
115 $query = "UPDATE scheduler_tasks SET is_complete = {$complete} WHERE task = 'Call Home'"; 115 $query = "UPDATE scheduler_tasks SET is_complete = {$complete} WHERE task = 'Call Home'";
116 - $this->util->dbHandler->query($query);  
117 - $this->util->dbHandler->close(); // close the database connection 116 + $this->util->dbUtilities->query($query);
  117 + $this->util->dbUtilities->close(); // close the database connection
118 } 118 }
119 } 119 }
120 ?> 120 ?>
121 \ No newline at end of file 121 \ No newline at end of file
thirdparty/Smarty/internals/core.write_compiled_resource.php
@@ -17,7 +17,7 @@ function smarty_core_write_compiled_resource($params, &amp;$smarty) @@ -17,7 +17,7 @@ function smarty_core_write_compiled_resource($params, &amp;$smarty)
17 if(!@is_writable($smarty->compile_dir)) { 17 if(!@is_writable($smarty->compile_dir)) {
18 // compile_dir not writable, see if it exists 18 // compile_dir not writable, see if it exists
19 if(!@is_dir($smarty->compile_dir)) { 19 if(!@is_dir($smarty->compile_dir)) {
20 - $smarty->trigger_error('the $compile_dir ' . $smarty->compile_dir . ' does not exist, or is not a directory.', E_USER_ERROR); 20 + $smarty->trigger_error('the '.$compile_dir.' ' . $smarty->compile_dir . ' does not exist, or is not a directory.', E_USER_ERROR);
21 return false; 21 return false;
22 } 22 }
23 $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); 23 $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
var/bin/taskrunner.bat
1 -// DO NOT DELETE  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +@echo off
  3 +"D:\Program Files\Zend\ZendServer\bin\php.exe" "D:\Program Files\Zend\Apache2\htdocs\knowledgetree\bin\win32\schedulerService.php"
3 \ No newline at end of file 4 \ No newline at end of file