* @package AgileBill * @version 1.4.93 */ class product_img { # Open the constructor for this mod function product_img() { # name of this module: $this->module = "product_img"; # location of the construct XML file: $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; # open the construct file for parsing $C_xml = new CORE_xml; $construct = $C_xml->xml_to_array($this->xml_construct); $this->method = $construct["construct"]["method"]; $this->trigger = $construct["construct"]["trigger"]; $this->field = $construct["construct"]["field"]; $this->table = $construct["construct"]["table"]; $this->module = $construct["construct"]["module"]; $this->cache = $construct["construct"]["cache"]; $this->order_by = $construct["construct"]["order_by"]; $this->limit = $construct["construct"]["limit"]; } ############################## ## ADD ## ############################## function add($VAR) { global $_FILES, $C_translate, $C_debug; $imgarr = Array('jpeg','jpg','gif','bmp','tif','tiff','png'); if(isset($_FILES['upload_file1']) && $_FILES['upload_file1']['size'] > 0) { for($i=0; $imethod["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $result = $db->add($VAR, $this, $type); # copy the image if($result && !empty($filename)) { $file = 'prod_img_' . $result . '.' . $filename; copy($_FILES['upload_file1']['tmp_name'], PATH_IMAGES . "" . $file); } } ############################## ## VIEW ## ############################## function view($VAR) { $type = "view"; $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->view($VAR, $this, $type); } ############################## ## DELETE ## ############################## function delete($VAR) { $db = &DB(); ### Delete any saved images: if(isset($VAR["delete_id"])) { $id = explode(',',$VAR["delete_id"]); } elseif (isset($VAR["id"])) { $id = explode(',',$VAR["id"]); } for($i=0; $ifields['url']); } # delete the record $sql = 'DELETE FROM ' . AGILE_DB_PREFIX . 'product_img WHERE site_id = ' . $db->qstr(DEFAULT_SITE) . ' AND id = ' . $db->qstr($id[$i]); $result = $db->Execute($sql); } } } # Alert delete message global $C_debug, $C_translate; $C_translate->value["CORE"]["module_name"] = $C_translate->translate('name',$this->module,""); $message = $C_translate->translate('alert_delete_ids',"CORE",""); $C_debug->alert($message); } ############################## ## SEARCH ## ############################## function search($VAR) { $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->search($VAR, $this, $type); } ############################## ## SEARCH SHOW ## ############################## function search_show($VAR) { $type = "search"; $this->method["$type"] = explode(",", $this->method["$type"]); $db = new CORE_database; $db->search_show($VAR, $this, $type); } } ?>