aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MainApp.php4
-rw-r--r--MainController.php31
-rw-r--r--config.default.ini12
3 files changed, 29 insertions, 18 deletions
diff --git a/MainApp.php b/MainApp.php
index e55a74a..6007bd0 100644
--- a/MainApp.php
+++ b/MainApp.php
@@ -8,7 +8,7 @@ class MainApp
////
// Fire up the application
static public function init()
- {
+ {
@list($controller, $param, $action) = App::url();
// no action given, read default one
@@ -81,7 +81,7 @@ class MainApp
if (!file_exists($cpath)) {
trigger_error('Failed to open config file', E_USER_ERROR);
- exit();
+ return false;
}
$config = parse_ini_file($cpath, true);
diff --git a/MainController.php b/MainController.php
index e1545b7..ed8d5e6 100644
--- a/MainController.php
+++ b/MainController.php
@@ -8,16 +8,16 @@ class MainController
public $pageTitle = ''; // Title of the rendered page
public $defaultAction = ''; // Method to run when none specified
- const OrderBy = "";
- const HasMany = "";
- const TableName = "";
- const ManyToMany = "";
- const ForeignKey = "";
- const TableSelect = "";
+ const OrderBy = '';
+ const HasMany = '';
+ const TableName = '';
+ const ManyToMany = '';
+ const ForeignKey = '';
+ const TableSelect = '';
function __construct($id = null)
{
- // Child classes should always have the same name as their tables
+ // child classes should always have the same name as their tables
$this->class = get_class($this);
$this->table = eval("return {$this->class}::TableName;");
@@ -38,9 +38,8 @@ class MainController
}
- /**
- * Get One Thing
- */
+ ////
+ // Get One Thing
public function get($where)
{
if (!is_array($where)) {
@@ -62,7 +61,7 @@ class MainController
*/
public function find($where = null, $sort = false, $limit = false)
{
- $select = "*"; $q = "";
+ $select = '*'; $q = '';
// Allow custom queries
if (is_array($where))
@@ -70,18 +69,18 @@ class MainController
foreach ($where as $k => $v)
{
$values[] = $v;
- $args = explode(" ", $k);
+ $args = explode(' ', $k);
$col = array_shift($args);
- $op = implode(" ", $args);
+ $op = implode(' ', $args);
// No column name given, default to "id"
if (empty($col)) {
- $col = "id";
+ $col = 'id';
}
// No operator given, default to "="
if (empty($op)) {
- $op = "=";
+ $op = '=';
}
$tmp = (empty($q)) ? ' WHERE ' : ' AND ';
@@ -94,7 +93,7 @@ class MainController
}
if ($where == null) {
- $q = "WHERE ?";
+ $q = 'WHERE ?';
$values = array(1);
}
diff --git a/config.default.ini b/config.default.ini
new file mode 100644
index 0000000..68c97ce
--- /dev/null
+++ b/config.default.ini
@@ -0,0 +1,12 @@
+[development]
+db.name = servo
+db.driver = mysql
+db.host = localhost
+db.username = servo
+db.password =
+
+app.timezone = Europe/Helsinki
+app.error_log = error.log
+
+defaults.controller = session
+defaults.action = check