summaryrefslogtreecommitdiffstats
path: root/app/model/sysconf.mod.php
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-10-22 00:29:30 -0400
committerMalf Furious <m@lfurio.us>2016-10-22 00:29:30 -0400
commited99654d2e139a847a63e9295bf976d17462ee34 (patch)
tree23ab0c9d3b813da85e08d4008dbf98b7f0c9fd01 /app/model/sysconf.mod.php
parent9d0ff6546fb03489bbd127aeec6ee161e204a139 (diff)
downloadscrott-ed99654d2e139a847a63e9295bf976d17462ee34.tar.gz
scrott-ed99654d2e139a847a63e9295bf976d17462ee34.zip
Deprecate application code
Setup to perform an iteration of development focused on a simpler implementation and eliminating redundancy in design.
Diffstat (limited to 'app/model/sysconf.mod.php')
-rw-r--r--app/model/sysconf.mod.php93
1 files changed, 0 insertions, 93 deletions
diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php
deleted file mode 100644
index cfbed42..0000000
--- a/app/model/sysconf.mod.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/*
- * SCROTT Copyright (C) 2016 Malf Furious
- *
- * Scrott is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * Scrott is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- */
-
-require_once "model/master.mod.php";
-require_once "class/form.class.php";
-
-class SysconfModel extends MasterModel
-{
- var $CONF_FILE = "scrott.conf.php";
-
- /*
- * Default action
- */
- function deflt()
- {
- }
-
- /*
- * Save the submitted data to the config file
- */
- function save($input)
- {
- global $_SCROTT;
-
- $form = new Form();
- $form->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;
- }
-
- /* test database connection (set global vars and try to get a db object) */
- $_SCROTT['conf'] = 'conf';
- $_SCROTT['dbEngine'] = 'mysql';
- $_SCROTT['dbAddress'] = $form->dbAddress;
- $_SCROTT['dbName'] = $form->dbName;
- $_SCROTT['dbUser'] = $form->dbUser;
- $_SCROTT['dbPass'] = $form->dbPass;
-
- try
- {
- $db = $this->getDbConnection();
- }
- catch (Exception $e)
- {
- $this->logError($e->getMessage());
- return;
- }
-
- /* write file */
- $f = fopen($this->CONF_FILE, "w");
-
- if (!$f)
- {
- $this->logError("Can not create configuration file");
- return;
- }
-
- fwrite($f, "<?php\n");
- fwrite($f, "\$_SCROTT['conf'] = 'conf';\n");
- fwrite($f, "\$_SCROTT['dbEngine'] = 'mysql';\n");
- fwrite($f, "\$_SCROTT['dbAddress'] = '" . $form->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() . "/");
- }
-}
-
-?>