aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/sys
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-10-05 15:18:23 +0200
committerKevin Chabowski <kevin@kch42.de>2011-10-05 15:18:23 +0200
commit990b708dff0c9eca3d576a890e962c4dd40226c8 (patch)
treef79512536a1ee8e8fd3b239fe9f96460dfc257ae /ratatoeskr/sys
parent0f185543bb9851fddc137f81a1e2a1d21589bc83 (diff)
downloadratatoeskr-cms-990b708dff0c9eca3d576a890e962c4dd40226c8.tar.gz
ratatoeskr-cms-990b708dff0c9eca3d576a890e962c4dd40226c8.tar.bz2
ratatoeskr-cms-990b708dff0c9eca3d576a890e962c4dd40226c8.zip
Fixed some bugs in db.php and models.php.
Diffstat (limited to 'ratatoeskr/sys')
-rw-r--r--ratatoeskr/sys/db.php2
-rw-r--r--ratatoeskr/sys/models.php19
2 files changed, 15 insertions, 6 deletions
diff --git a/ratatoeskr/sys/db.php b/ratatoeskr/sys/db.php
index 55801c0..e5caddc 100644
--- a/ratatoeskr/sys/db.php
+++ b/ratatoeskr/sys/db.php
@@ -73,7 +73,7 @@ function qdb_vfmt($args)
*/
function qdb_fmt()
{
- return qdb_vfmt(fung_get_args());
+ return qdb_vfmt(func_get_args());
}
/*
diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php
index eb8f26c..0ec4111 100644
--- a/ratatoeskr/sys/models.php
+++ b/ratatoeskr/sys/models.php
@@ -984,7 +984,7 @@ class Style
*/
public static function by_id($id)
{
- $obj = new seld;
+ $obj = new self;
$obj->populate_by_sqlresult(qdb("SELECT `id`, `name`, `code` FROM `PREFIX_styles` WHERE `id` = %d", $id));
return $obj;
}
@@ -1183,9 +1183,18 @@ class Section
$this->name = $sqlrow["name"];
$this->title = Multilingual::by_id($sqlrow["title"]);
$this->template = $sqlrow["template"];
- $this->styles = array_filter_empty(array_map(
- function($id) { try{return Style::by_id($id);}catch(DoesNotExistError $e){ return "";} },
- array_filter_empty(explode("+", $sqlrow["styles"]))));
+ $this->styles = array();
+ foreach(explode("+", $sqlrow["styles"]) as $style_id)
+ {
+ if(!empty($style_id))
+ {
+ try
+ {
+ $this->styles[] = Style::by_id($style_id);
+ }
+ catch(DoesNotExistError $e) { }
+ }
+ }
}
/*
@@ -1285,7 +1294,7 @@ class Section
$this->title->save();
qdb("UPDATE `PREFIX_sections` SET `name` = '%s', `title` = %d, `template` = '%s', `styles` = '%s' WHERE `id` = %d",
- $this->name, $this->title->get_id(), $this->template, $styles);
+ $this->name, $this->title->get_id(), $this->template, $styles, $this->id);
}
/*