diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-07-20 07:22:23 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-07-20 07:22:23 +0300 |
commit | dead03e955367d4635764251f62256365c01b221 (patch) | |
tree | 24696b6896871521b12e36d778f2219f9987ac28 /MainApp.php | |
parent | ad4a149c32bd42bf374b56c88cdf43b5ee801874 (diff) | |
download | main-dead03e955367d4635764251f62256365c01b221.tar.gz main-dead03e955367d4635764251f62256365c01b221.tar.bz2 main-dead03e955367d4635764251f62256365c01b221.zip |
ordering children, PHP 5.3 changes
Diffstat (limited to 'MainApp.php')
-rw-r--r-- | MainApp.php | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/MainApp.php b/MainApp.php index 5a149a8..3ad37a0 100644 --- a/MainApp.php +++ b/MainApp.php @@ -10,7 +10,6 @@ class MainApp static public function init() { $url = self::url(); - @list($controller, $param, $action) = $url; // no controller given, read default one @@ -193,45 +192,6 @@ class MainApp return sprintf('%s_%s', $loc, strtoupper($lang)); } - public function delete($table, $where) - { - if (empty($where)) { - exit(self::error('Delete without parameters')); - } - - list($key, $value) = each($where); - $sql = "DELETE FROM `$table` WHERE $key = :{$key}"; - - self::log($sql); - self::query($sql, $where); - - } - - //// - // insert something in the database - static function insert($table, $data) - { - if (empty($data)) { - exit(self::error('Empty insert')); - } - - $cols = array(); - $vals = array(); - - foreach ($data as $k => $v) { - $cols[] = "`{$k}`"; - $vals[] = ":{$k}"; - } - - $cols = implode(',', $cols); - $vals = implode(',', $vals); - $sql = "INSERT INTO `$table` ($cols) VALUES ($vals)"; - - self::log($sql); - self::query($sql, $data); - - } - // Move this back to Controller once PHP 5.3 is out (get_called_class()) static function select($table, $where = 1, $what = '*', $order_by = '') { @@ -292,13 +252,25 @@ class MainApp //// // output a JavaScript fragment - public function js($string) + static function js($string) { header('Content-Type: text/javascript'); header('Content-Length: '.strlen($string)); echo '<script type="text/javascript" charset="utf-8">'.$string.'</script>'; } + //// + // urlencode() string twice to work with mod_rewrite + static function urlenc($string) + { + return urlencode(urlencode($string)); + } + + static function urldec($string) + { + return urldecode(urldecode($string)); + } + } //// |