From 7acf1af340b9d11b72bca70731ed6dbcd7c95132 Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 02:45:31 -0500 Subject: + Adding model for sysconf mvc --- app/model/sysconf.mod.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/model/sysconf.mod.php (limited to 'app/model/sysconf.mod.php') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php new file mode 100644 index 0000000..11b8f4f --- /dev/null +++ b/app/model/sysconf.mod.php @@ -0,0 +1,15 @@ + -- cgit v1.2.3 From 2710f0de8d8d900a0997fd72f315c8a6f07329cf Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 03:04:06 -0500 Subject: * Derp, default is a reserved word, calling the function 'deflt' instead * Removed explicit call to parent constructor in model class, since that function is not explicitly defined --- app/model/sysconf.mod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/model/sysconf.mod.php') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index 11b8f4f..cc29294 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -7,7 +7,7 @@ class SysconfModel extends Model /* * Default action */ - function default() + function deflt() { } } -- cgit v1.2.3 From b1f4cf9b23acbcb80f937ef7f0b9f18fdb167f5a Mon Sep 17 00:00:00 2001 From: M Date: Sun, 22 Nov 2015 12:40:37 -0500 Subject: + Start of Master MVC ( will define generic layout of pages but will not define logic for header ui. since this depends on an established database ). + Added Master model ! As far as I am planning right now, the only MVC that will inherit Master directly will be sysconf since it cannot rely on an existing database connection. --- app/model/sysconf.mod.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/model/sysconf.mod.php') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index cc29294..754d1a6 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -1,8 +1,8 @@ Date: Sun, 6 Dec 2015 02:16:46 -0500 Subject: * Implemented the "save" action for MVC sysconf --- app/model/sysconf.mod.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'app/model/sysconf.mod.php') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index 754d1a6..d86f589 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -1,15 +1,58 @@ field_text("dbAddress"); + $form->field_text("dbName"); + $form->field_text("dbUser"); + $form->field_text("dbPass", null, false); + $form->field_enum("settSSL", array("force", "neither", "forbid")); + + if (!$form->populate($input)) + { + $this->logFormErrors($form); + return; + } + + $f = fopen($this->CONF_FILE, "w"); + + if (!$f) + { + $this->logError("Can not create configuration file"); + return; + } + + fwrite($f, "dbAddress . "';\n"); + fwrite($f, "\$_SCROTT['dbName'] = '" . $form->dbName . "';\n"); + fwrite($f, "\$_SCROTT['dbUser'] = '" . $form->dbUser . "';\n"); + fwrite($f, "\$_SCROTT['dbPass'] = '" . $form->dbPass . "';\n"); + fwrite($f, "\$_SCROTT['settSSL'] = '" . $form->settSSL . "';\n"); + fwrite($f, "?>\n"); + + fclose($f); + $this->redirectTo($this->ar()); + } } ?> -- cgit v1.2.3 From b7dfa1cbde0eb56a3251e48692e5757559bf604a Mon Sep 17 00:00:00 2001 From: M Date: Sun, 6 Dec 2015 03:27:39 -0500 Subject: + Adding a TODO note for later --- app/model/sysconf.mod.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/model/sysconf.mod.php') diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index d86f589..30ebd58 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -32,6 +32,8 @@ class SysconfModel extends MasterModel return; } + /* TODO -- test database connection before proceeding */ + $f = fopen($this->CONF_FILE, "w"); if (!$f) -- cgit v1.2.3