aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2010-07-09 09:24:49 +0300
committerFilipp Lepalaan <filipp@mac.com>2010-07-09 09:24:49 +0300
commitb4cd2ad59440171ea330ddaad28b4743d4936b51 (patch)
tree62d9d58ece9e1fb07356f4cf12119b7f5be1f88f
parent92733d581c1b810771606ffb18722c1b6294f040 (diff)
downloadmain-b4cd2ad59440171ea330ddaad28b4743d4936b51.tar.gz
main-b4cd2ad59440171ea330ddaad28b4743d4936b51.tar.bz2
main-b4cd2ad59440171ea330ddaad28b4743d4936b51.zip
better logging
-rw-r--r--MainApp.php4
-rw-r--r--MainController.php5
2 files changed, 5 insertions, 4 deletions
diff --git a/MainApp.php b/MainApp.php
index 4bf4543..96050b0 100644
--- a/MainApp.php
+++ b/MainApp.php
@@ -130,7 +130,7 @@ class MainApp
static function error($msg)
{
- $err = array('result' => 'error', 'msg' => $msg);
+ $err = array('error' => $msg);
trigger_error($msg, E_USER_ERROR);
// And log it locally
self::log($msg);
@@ -158,7 +158,7 @@ class MainApp
foreach (func_get_args() as $arg)
{
- if (is_array($arg)) {
+ if (is_array($arg) || is_object($arg)) {
$arg = print_r($arg, true);
}
fwrite($fh, date('r') . "\t" . trim($arg) . "\n");
diff --git a/MainController.php b/MainController.php
index c4d937d..81c68bf 100644
--- a/MainController.php
+++ b/MainController.php
@@ -53,6 +53,7 @@ class MainController
}
$this->find($where);
+
if (!is_array($this->data)) {
return false; // found nothing
}
@@ -256,14 +257,14 @@ class MainController
$insert = rtrim($insert, ', ');
$val = implode(', ', array_keys($values));
$sql = "INSERT INTO `{$this->table}` ({$insert}) VALUES ({$val})";
-
+
return MainDb::query($sql, $values);
}
////
// delete This Thing
- protected function delete($where, $limit = '')
+ public function delete($where, $limit = '')
{
if (empty($where)) {
return MainApp::error('Cannot delete without arguments');