From be66258bfce19e5775b90c7fe237e141bceb9f15 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Tue, 31 Jan 2017 23:03:53 +0000 Subject: [PATCH] Fix bugs (#1026) --- application/controllers/Items.php | 9 ++++++--- application/helpers/table_helper.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/application/controllers/Items.php b/application/controllers/Items.php index 425d11466..262d4fedd 100644 --- a/application/controllers/Items.php +++ b/application/controllers/Items.php @@ -71,9 +71,12 @@ class Items extends Secure_Controller if($ext == '') { $images = glob('./uploads/item_pics/' . $item->pic_filename . '.*'); - $new_pic_filename = pathinfo($images[0], PATHINFO_BASENAME); - $item_data = array('pic_filename' => $new_pic_filename); - $this->Item->save($item_data, $item->item_id); + if(sizeof($images) > 0) + { + $new_pic_filename = pathinfo($images[0], PATHINFO_BASENAME); + $item_data = array('pic_filename' => $new_pic_filename); + $this->Item->save($item_data, $item->item_id); + } } } diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 70f8eef86..64f8c6d3f 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -269,9 +269,9 @@ function get_item_data_row($item, $controller) $tax_percents = substr($tax_percents, 0, -2); $controller_name = strtolower(get_class($CI)); + $image = NULL; if ($item->pic_filename != '') { - $image = ''; $ext = pathinfo($item->pic_filename, PATHINFO_EXTENSION); if($ext == '') {