aboutsummaryrefslogtreecommitdiffstats
path: root/MainApp.php
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-05-13 12:36:58 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-05-13 12:36:58 +0300
commitc63171e653c7bca1f8b23dede30e60d398de35ae (patch)
tree73b862e115a3fd042f7f8d59c01e934eb32b7996 /MainApp.php
parentf18fe95d034a73bc7a93ca48860fb010a8e01011 (diff)
downloadmain-c63171e653c7bca1f8b23dede30e60d398de35ae.tar.gz
main-c63171e653c7bca1f8b23dede30e60d398de35ae.tar.bz2
main-c63171e653c7bca1f8b23dede30e60d398de35ae.zip
fixes
Diffstat (limited to 'MainApp.php')
-rw-r--r--MainApp.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/MainApp.php b/MainApp.php
index 8ab3a94..ac58db5 100644
--- a/MainApp.php
+++ b/MainApp.php
@@ -11,6 +11,7 @@
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
+
class MainApp
{
////
@@ -24,7 +25,7 @@ class MainApp
if (!$controller) {
$controller = self::conf('defaults.controller');
}
-
+
// no action given, read default one
if (strlen($param) < 1) {
$action = self::conf('defaults.action');
@@ -36,9 +37,9 @@ class MainApp
// dispatch correct controller
$controller = self::classname($controller);
$c = new $controller;
-
+
// assume no method name was given, try $param, then default to defaultAction
- // controller/param/action
+ // URL format is always controller/param/action
if (method_exists($c, $action)) {
return $c->$action($_POST);
}
@@ -99,7 +100,7 @@ class MainApp
if (!file_exists($cpath)) {
trigger_error('Failed to open config file', E_USER_ERROR);
- return false;
+ return FALSE;
}
$config = parse_ini_file($cpath, true);
@@ -343,18 +344,19 @@ class MainApp
}
}
-
- ////
- // for autoloading the app's classes
- function __autoload($name)
- {
- $class_name = MainApp::classname($name);
- include_once "{$class_name}.php";
+
+////
+// for autoloading the app's classes
+function __autoload($name)
+{
+ $class_name = MainApp::classname($name);
+
+ include_once "{$class_name}.php";
- if (!class_exists($class_name)) {
- exit(MainApp::error("{$class_name}: no such class"));
- }
-
+ if (!class_exists($class_name)) {
+ exit(MainApp::error("{$class_name}: no such class"));
}
+
+}
-?> \ No newline at end of file
+?>