aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-07-14 00:30:05 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-07-14 00:30:05 +0300
commit84b13d3d2642ad79369b33772c31c3e51d46d36f (patch)
treeda76d831a24112660da083dca8e6620bb8fca3eb
parent721154b01441db5fefaf62e9f2ea2c990a4a0d37 (diff)
downloadmain-84b13d3d2642ad79369b33772c31c3e51d46d36f.tar.gz
main-84b13d3d2642ad79369b33772c31c3e51d46d36f.tar.bz2
main-84b13d3d2642ad79369b33772c31c3e51d46d36f.zip
Added MainDb::one()
-rw-r--r--MainApp.php11
-rw-r--r--MainDb.php6
2 files changed, 12 insertions, 5 deletions
diff --git a/MainApp.php b/MainApp.php
index a74c6d4..0e79f96 100644
--- a/MainApp.php
+++ b/MainApp.php
@@ -35,8 +35,8 @@ class MainApp
// dispatch requested controller
$controller = self::classname($controller);
- $c = new $controller();
-
+ $c = new $controller;
+// var_dump($c);
// assume no method name was given, try $param
// URL format is always controller/param/action
if (method_exists($c, $action)) {
@@ -144,7 +144,7 @@ class MainApp
static function error($msg)
{
$err = array('error' => $msg);
- header('HTTP/1.0 500 Internal Server Error');
+// header('HTTP/1.0 500 Internal Server Error');
// send it to the browser
//self::json($err);
//trigger_error($msg, E_USER_NOTICE);
@@ -335,7 +335,8 @@ class MainApp
}
$lang_file_content = file_get_contents($lang_file);
- /* Load the language file as a JSON object and transform it into an associative array */
+ /* Load the language file as a JSON object
+ and transform it into an associative array */
$translations = json_decode($lang_file_content, TRUE);
}
@@ -353,7 +354,7 @@ class MainApp
function __autoload($name)
{
$class_name = MainApp::classname($name);
-
+
include_once "{$class_name}.php";
if (!class_exists($class_name)) {
diff --git a/MainDb.php b/MainDb.php
index e1f293b..1f9401a 100644
--- a/MainDb.php
+++ b/MainDb.php
@@ -62,6 +62,12 @@ class MainDb
trigger_error('Cloning disabled', E_USER_ERROR);
}
+ public function one($sql, $data = NULL)
+ {
+ $result = self::fetch($sql, $data);
+ return current($result);
+ }
+
////
// execute an SQL query
// @return mixed