From 3d31b0e7fe2d0595e67cc50510305439dcc6201b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Mon, 14 Feb 2005 12:03:06 +0000 Subject: [PATCH] nicer save-function --- resources/inc/class.bo_resources.inc.php | 2 +- resources/inc/class.so_resources.inc.php | 25 +++++++++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/resources/inc/class.bo_resources.inc.php b/resources/inc/class.bo_resources.inc.php index 6f125f7d83..6f476b81a9 100755 --- a/resources/inc/class.bo_resources.inc.php +++ b/resources/inc/class.bo_resources.inc.php @@ -174,7 +174,7 @@ class bo_resources } function get_images($params) - { + { $id = implode($params); $picture = $this->so->get_value('picture_thumb',$id); if($picture) diff --git a/resources/inc/class.so_resources.inc.php b/resources/inc/class.so_resources.inc.php index 9c1e840409..8600189c3a 100755 --- a/resources/inc/class.so_resources.inc.php +++ b/resources/inc/class.so_resources.inc.php @@ -115,26 +115,19 @@ class so_resources @function save @abstract saves a resource including binary datas @param array $resource key => value - @return array with key => value or false if not found + @return bool succsess or not! */ function save($resource) { $where = array('id' => $resource['id']); - $data = array( 'name' => $resource['name'], - 'cat_id' => $resource['cat_id'], - 'short_description' => $resource['short_description'], - 'long_description' => $resource['long_description'], - 'location' => $resource['location'], - 'quantity' => $resource['quantity'], - 'useable' => $resource['useable'], - 'bookable' => $resource['bookable'], - 'buyable' => $resource['buyable'], - 'prize' => $resource['prize'], - 'accessories' => $resource['accessories'], - 'picture_src' => $resource['picture_src'], - 'picture_thumb' => $resource['picture_thumb'], - 'picture' => $resource['picture'] - ); + + // get rid of the non storeable datas + $tabledef = $this->db->metadata($table=$this->rs_table,$full=false); + foreach($tabledef as $n => $fielddef) + { + $data[$fielddef['name']] = $resource[$fielddef['name']]; + } + return $this->db->insert($this->rs_table,$data,$where,__LINE__,__FILE__) ? true : false; }