aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--App.php4
-rw-r--r--Db.php10
2 files changed, 9 insertions, 5 deletions
diff --git a/App.php b/App.php
index 686f92e..32191a0 100644
--- a/App.php
+++ b/App.php
@@ -15,7 +15,9 @@ class App
{
// Set custom error handler
set_error_handler("App::error_handler");
-
+ // Set correct timezone
+ date_default_timezone_set(self::conf("app.timezone"));
+
@list($controller, $param, $action) = App::url();
if (empty($param)) {
diff --git a/Db.php b/Db.php
index 7c9d4f8..d80071a 100644
--- a/Db.php
+++ b/Db.php
@@ -67,12 +67,13 @@ class Db
try {
- $stmt = self::getInstance()->prepare($sql);
+ $pdo = self::getInstance();
+ $stmt = $pdo->prepare($sql);
$result = $stmt->execute($data);
if (!$result) {
- $e = $pdo->errorInfo();
- $error = $e[2] ."\n" . print_r(debug_backtrace(), true);
+ list($ec, $dec, $emsg) = $pdo->errorInfo();
+ $error = $emsg ."\n" . print_r(debug_backtrace(), true);
return App::error($error);
}
@@ -88,10 +89,11 @@ class Db
}
if (empty($data['id'])) {
- $data['id'] = self::getInstance()->lastInsertId();
+ $data['id'] = $pdo->lastInsertId();
}
$out = array();
+
// Always strip ":" prefixes from input array keys
foreach ($data as $k => $v) {
$key = ltrim($k, ':');