function newUpload($jng_sp_id, $type, $filename, $upload_by) { $upload_data = array('jng_sp_id' => $jng_sp_id, 'type' => $type, 'filename' => $filename, 'upload_time' => date('Y-m-d H:i:s'), 'upload_by' => $upload_by); tep_db_perform('jng_sp_upload', $upload_data); $upload_id = tep_db_insert_id(); return $upload_id; }
function affiliate_insert($sql_data_array, $affiliate_parent = 0) { // LOCK TABLES tep_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE"); if ($affiliate_parent > 0) { $affiliate_root_query = tep_db_query("select affiliate_root, affiliate_rgt, affiliate_lft�from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' "); // Check if we have a parent affiliate if ($affiliate_root_array = tep_db_fetch_array($affiliate_root_query)) { tep_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); tep_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root']; $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt']; $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1; tep_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = tep_db_insert_id(); } // no parent -> new root } else { $sql_data_array['affiliate_lft'] = '1'; $sql_data_array['affiliate_rgt'] = '2'; tep_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = tep_db_insert_id(); tep_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' "); } // UNLOCK TABLES tep_db_query("UNLOCK TABLES"); return $affiliate_id; }
function add($products_id, $type, $links_id, $prepared = false) { if (is_array($links_id) && count($links_id) > 0) { if (!$prepared) { $products_id = tep_db_prepare_input($products_id); $type = tep_db_prepare_input($type); } $plids = array(); foreach ($links_id as $lid) { if (!$prepared) { $lid = tep_db_prepare_input($lid); } if (intval($lid) != 0 && $products_id != $lid) { //$check_exist = tep_db_query("SELECT products_linking_id FROM products_linking WHERE products_id=$products_id AND type='$type' AND links_id=$lid"); $check_exist = tep_db_query("SELECT products_linking_id FROM products_linking WHERE products_id={$products_id} AND links_id={$lid}"); if (tep_db_num_rows($check_exist) == 0) { $sda = array(); $sda['products_id'] = $products_id; $sda['type'] = $type; $sda['links_id'] = $lid; $sda['date_added'] = date('Y-m-d H:i:s'); tep_db_perform('products_linking', $sda); $plids[] = tep_db_insert_id(); } } } } else { if ($links_id != '') { $links = explode(',', $links_id); $plids = $this->add($products_id, $type, $links, $prepared); } } return $plids; }
public function createNew($order_currency, $username) { /* $sda = array(); $sda['elements_suppliers_id'] = $this->suppliers_id; $sda['currency'] = $order_currency; $sda['date_created'] = date('Y-m-d'); $sda['status'] = '0'; $sda['created_by'] = $username; tep_db_perform('elements_orders', $sda); */ //USED THIS, SO PO NUMBER GENERATED WHEN INSERT, REDUCE SAME PO NUMBER USED BY TWO SUPPLIERS AT THE SAME TIME $q = "INSERT INTO elements_orders"; $q .= " ("; $q .= " po_number"; $q .= ",elements_suppliers_id"; $q .= ",currency"; $q .= ",date_created"; $q .= ",status"; $q .= ",created_by"; $q .= " )"; $q .= " SELECT CONCAT(LPAD(MONTH(NOW()),2,0),'-',LPAD((IFNULL(MAX(SUBSTRING(po_number,4,3)*1)+1,1)), 3, '0')) po_number"; //po_number e.g: 01-001, 12-999 (MONTH-INCREMENT) $q .= " ," . $this->suppliers_id; $q .= " ,'{$order_currency}'"; $q .= " ,'" . date('Y-m-d') . "'"; $q .= " ,'0'"; $q .= " ,'{$username}'"; $q .= " FROM elements_orders WHERE date_created LIKE '" . date('Y-m') . "%'"; tep_db_query($q); $this->orders_id = tep_db_insert_id(); $this->loadDetail(); }
/** * * @return */ function store() { $new_entry = true; if (isset($this->fields['doba_log_id']) && $this->fields['doba_log_id'] > 0) { $new_entry = false; } if ($new_entry) { $sql = 'insert into DobaLog set '; } else { $sql = 'update DobaLog set '; } $cnt = 0; foreach ($this->fields as $i => $f) { if ($cnt > 0) { $sql .= ','; } $sql .= $i . '="' . $f . '"'; ++$cnt; } if (!$new_entry) { $sql .= ' where doba_log_id=' . $this->fields['doba_log_id']; } if ($cnt > 0) { $store = tep_db_query($sql); $this->doba_log_id(tep_db_insert_id()); return true; } return false; }
function createNew($package_code = '', $package_type = null) { $counter = 0; if ($package_code == '') { $counter++; $prefix = !is_null($package_type) ? 'JG' : 'RET'; $dateprefix = date('ymd'); $package_code = $prefix . '-' . $dateprefix . '-' . $counter; } $check_code_exist = tep_db_query("SELECT packages_id FROM minierp_packages WHERE packages_code='{$package_code}'"); while (tep_db_num_rows($check_code_exist) > 0) { if ($counter > 0) { $old_counter = $dateprefix . '-' . $counter; $counter++; $new_counter = $dateprefix . '-' . $counter; $package_code = str_replace($old_counter, $new_counter, $package_code); } else { $package_code .= '-New'; } $check_code_exist = tep_db_query("SELECT packages_id FROM minierp_packages WHERE packages_code='{$package_code}'"); } $psda = array(); //$psda['logistic_partners'] = 'SPN'; $psda['packages_code'] = $package_code; if (!is_null($package_type)) { $psda['package_type'] = $package_type; } tep_db_perform('minierp_packages', $psda); $new_id = tep_db_insert_id(); return $new_id; }
function create($name, $type, $code, $is_active, $pic, $address_street, $address_postcode, $address_city, $address_country_id) { $sql_data_array = array('name' => $name, 'warehouse_type' => $type, 'warehouse_code' => $code, 'is_active' => $is_active, 'pic' => $pic, 'address_street' => $address_street, 'address_postcode' => $address_postcode, 'address_city' => $address_city, 'address_country_id' => $address_country_id); tep_db_perform('jng_warehouses', $sql_data_array); $jng_warehouses_id = tep_db_insert_id(); return $jng_warehouses_id; }
/** * Create a new category top * @param String $name Name of new category top * @param Boolean $is_using_size True if category is using size instead of length * @return Int ID of new category top or 0 if insert failed */ public static function createNewCategoryTop($name, $is_using_size) { $sda = array(); $sda[self::COLNAME_NAME] = $name; $sda[self::COLNAME_SIZE] = $is_using_size ? '1' : '0'; tep_db_perform(self::TABLENAME, $sda); return tep_db_insert_id(); }
function add($products_id, $price, $price_old, $options, $prepared = false) { if (!$prepared) { $products_id = tep_db_prepare_input($products_id); $price = tep_db_prepare_input($price); foreach ($options as $key => $value) { $options[$key] = tep_db_prepare_input($value); } } //$get_vs = tep_db_query("SELECT virtual_stock FROM jng_sp_catalog WHERE jng_sp_catalog_id=$jng_sp_catalog_id"); //$vs = tep_db_fetch_array($get_vs); /* $sda = array( 'jng_sp_catalog_id'=>$jng_sp_catalog_id, 'sp_extra_id'=>'3', 'sp_extra_name'=>'Länge', 'sp_extra_value'=>$new_length, 'sp_extra_price'=>$new_length_price, 'virtual_stock'=>$vs['virtual_stock'] ); tep_db_perform('jng_sp_catalog_extra', $sda); */ //check if any existing options exist - start $check_filter = " WHERE products_id={$products_id}"; foreach ($options as $key => $value) { $check_filter .= " AND {$key}='{$value}'"; } $check_query = tep_db_query("SELECT products_articles_id FROM products_articles {$check_filter}"); if (tep_db_num_rows($check_query) == 0) { $update = true; //check if same with default length if (array_key_exists('length', $options)) { $cq = "SELECT IFNULL(pc.products_length, pnc.products_length) AS products_length FROM products p"; $cq .= " LEFT JOIN products_configurator pc ON pc.products_id=p.products_id"; $cq .= " LEFT JOIN products_non_configurator pnc ON pnc.products_id=p.products_id"; $cq .= " WHERE p.products_id={$products_id}"; $cr = tep_db_query($cq); $cd = tep_db_fetch_array($cr); if ($cd['products_length'] == $options['length']) { $update = false; } } } else { $update = false; } if ($update) { $sda = array('products_id' => $products_id, 'price' => $price, 'price_old' => $price_old); foreach ($options as $key => $value) { $sda[$key] = $value; } tep_db_perform('products_articles', $sda); $products_articles_id = tep_db_insert_id(); } else { $products_articles_id = '0'; } return $products_articles_id; }
function addExtraDesignImage($design_id, $design_image, $createby) { $sda = array(); $sda['project_id'] = $design_id; $sda['project_image'] = $design_image; $sda['create_by'] = $createby; $sda['create_date'] = date('Y-m-d H:i:s'); tep_db_perform('projectplan_images', $sda); $newid = tep_db_insert_id(); return $newid; }
function create($bundle_name, $bundle_desc) { $result = null; $bundle_id = $this->id; if (is_null($bundle_id)) { $this->detail['bundle_name'] = $bundle_name; $this->detail['bundle_desc'] = $bundle_desc; tep_db_perform('products_bundle', $this->detail); $this->id = tep_db_insert_id(); } return $result; }
function addDownload($jng_sp_id, $type, $filename, $process_status, $download_by = 'auto-download', $info = '') { $dsda = array(); $dsda['jng_sp_id'] = $jng_sp_id; $dsda['type'] = $type; $dsda['filename'] = $filename; $dsda['process_status'] = $process_status; $dsda['download_time'] = date('Y-m-d H:i:s'); $dsda['download_by'] = $download_by; $dsda['info'] = $info; tep_db_perform('jng_sp_download', $dsda); return tep_db_insert_id(); }
function addNewDescription($design_id, $design_description, $updateby, $reminder) { $sdo = array(); $sdo['reminder'] = $reminder; $result = tep_db_perform('projectplan_newdesign', $sdo, 'update', "project_id={$design_id}"); $sda = array(); $sda['project_id'] = $design_id; $sda['project_description'] = $design_description; $sda['last_update_by'] = $updateby; $sda['last_update_time'] = date('Y-m-d H:i:s'); tep_db_perform('projectplan_description', $sda); $newid = tep_db_insert_id(); return $newid; }
function install_ORP_to_sql($gid = 0) { $old_table_name = tep_db_fetch_array(tep_db_query("SHOW TABLES LIKE 'products_options_products'")); if (tep_not_null($old_table_name)) { tep_db_query("RENAME TABLE products_options_products TO products_related_products"); } $insert_relationship_table = "CREATE TABLE IF NOT EXISTS `products_related_products` (\n `pop_id` int(11) NOT NULL auto_increment,\n `pop_products_id_master` int(11) NOT NULL default '0',\n `pop_products_id_slave` int(11) NOT NULL default '0',\n `pop_order_id` smallint(6) NOT NULL default '0',\n PRIMARY KEY (`pop_id`)\n ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"; tep_db_query($insert_relationship_table); if (!$gid) { tep_db_query("INSERT INTO `configuration_group` VALUES ( '', 'Related Products', 'Optional Related Products module', '999', '1' )"); $set_group_id = tep_db_insert_id(); } else { $set_group_id = $gid; } tep_db_query("INSERT INTO `configuration`\n VALUES ('', 'Current Version', 'RELATED_PRODUCTS_VERSION_INSTALLED', '4.0', 'This key is used by the SQL install to automatically update your database during upgrades. It is read only.', " . $set_group_id . ", '0', NULL, now(), NULL , 'tep_version_readonly('),\n ('', 'Display Thumbnail Images', 'RELATED_PRODUCTS_SHOW_THUMBS', 'True', 'Show Product Image', " . $set_group_id . ", '1', NULL, now(), NULL , 'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Display Product Name', 'RELATED_PRODUCTS_SHOW_NAME', 'True', 'Show Product Name', " . $set_group_id . ", 2, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Display Product Model', 'RELATED_PRODUCTS_SHOW_MODEL', 'False', 'Show Product Model', " . $set_group_id . ", 3, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Display Price', 'RELATED_PRODUCTS_SHOW_PRICE', 'True', 'Show Product Price', " . $set_group_id . ", 4, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Display Quantity Available', 'RELATED_PRODUCTS_SHOW_QUANTITY', 'False', 'Show Product Quantity', " . $set_group_id . ", 5, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Display Buy Now Button', 'RELATED_PRODUCTS_SHOW_BUY_NOW', 'False', 'Show Buy Now Button', " . $set_group_id . ", 6, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Split Display Into Rows','RELATED_PRODUCTS_USE_ROWS','False','Set this option to True to display Related Products in multiple rows.'," . $set_group_id . ", 7,NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Define Number of Items Per Row','RELATED_PRODUCTS_PER_ROW','3','Maximum number of items to display per row when Split Display Into Rows is set to True.'," . $set_group_id . ", 8,NULL, now(),NULL,''),\n ('', 'Define Number of Items to Display', 'RELATED_PRODUCTS_MAX_DISP', '0', 'Maximum number of Related Products to display. 0 is unlimited.', " . $set_group_id . ", 9, NULL, now(),NULL,''),\n ('', 'Use Random Display Order', 'RELATED_PRODUCTS_RANDOMIZE', 'False', 'Adds random sort order to products displayed. Recommended if maximum number of products is set.', " . $set_group_id . ", 10, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Admin Display: Maximum Rows', 'RELATED_PRODUCTS_MAX_ROW_LISTS_OPTIONS', '10', 'Sets the maximum number of rows to display per page.', " . $set_group_id . ", 11, NULL, now(),NULL,''),\n ('', 'Admin Display: Drop-Down List Maximum Length', 'RELATED_PRODUCTS_MAX_NAME_LENGTH', '25', 'Sets the maximum length (in characters) of product name displayed in drop-down lists. Enter \\'0\\' to set this option to false.', " . $set_group_id . ", 12, NULL, now(),NULL,''),\n ('', 'Admin Display: Display List Maximum Length', 'RELATED_PRODUCTS_MAX_DISPLAY_LENGTH', '0', 'Sets the maximum length (in characters) of product name displayed in list. Enter \\'0\\' to set this option to false.', " . $set_group_id . ", 13, NULL, now(),NULL,''),\n ('', 'Admin Display: Use Product Model', 'RELATED_PRODUCTS_ADMIN_USE_MODEL', 'False', 'Uses Product Model in lists. When Product Name is also selected, Product Model is displayed first.', " . $set_group_id . ", 14, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Admin Display: Use Product Name', 'RELATED_PRODUCTS_ADMIN_USE_NAME', 'True', 'Uses Product Name in lists. When Product Model is also selected, Product Model is displayed first.', " . $set_group_id . ", 15, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Admin Display: Combine Model and Name separator', 'RELATED_PRODUCTS_ADMIN_MODEL_SEPARATOR', ': ', 'Enter the characters you would like to separate Model from Name, when using both. Leave empty if only using Model.', " . $set_group_id . ", 16, NULL, now(),NULL,''),\n ('', 'Admin Function: Use Delete Confirmation', 'RELATED_PRODUCTS_CONFIRM_DELETE', 'True', 'When set to True, a confirmation box will pop-up when deleting an association. Set to False to Delete without confirmation.', " . $set_group_id . ", 17, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),'),\n ('', 'Admin Function: Combine Insert with Inherit', 'RELATED_PRODUCTS_INSERT_AND_INHERIT', 'True', 'When set to True, clicking on Inherit will also Insert the product association. When False, Inherit works as before.', " . $set_group_id . ", 18, NULL, now(),NULL,'tep_cfg_select_option(array(\\'True\\', \\'False\\'),')\n "); }
function create($s_name, $s_address, $s_contact, $s_phone, $s_outsourced = null, $s_scheduled = null, $safety_delivery_time = '0') { $s_outsourced = $s_outsourced == '1' ? '1' : '0'; $s_scheduled = $s_scheduled == '1' ? '1' : '0'; $sda = array(); $sda['suppliers_name'] = $s_name; $sda['suppliers_address'] = $s_address; $sda['suppliers_contact_person'] = $s_contact; $sda['suppliers_contact_number'] = $s_phone; $sda['suppliers_outsourced'] = $s_outsourced; $sda['suppliers_scheduled'] = $s_scheduled; $sda['safety_delivery_time'] = $safety_delivery_time; tep_db_perform('elements_suppliers', $sda); $this->id = tep_db_insert_id(); $this->setDetail($s_name, $s_address, $s_contact, $s_phone, $s_outsourced, $s_scheduled, $safety_delivery_time); }
function add($user_id, $name, $prior, $status, $createby, $eta = null) { $sda = array(); $sda['user_id'] = $user_id; $sda['name'] = $name; $sda['priority'] = $prior; if (!is_null($eta)) { $sda['estimated_time'] = $eta; } $sda['status'] = $status; $sda['create_by'] = $createby; $sda['create_date'] = date('Y-m-d H:i:s'); tep_db_perform('minierp_todos', $sda); $newid = tep_db_insert_id(); return $newid; }
function create_temp_customer($customer_info) { global $customer_id, $customer_first_name, $customer_default_address_id, $customer_country_id, $customer_zone_id, $billto, $sendto; $query = tep_db_query("SELECT c.customers_id as customer_id, c.customers_firstname, c.customers_default_address_id as customer_default_address_id, ab.entry_country_id as customer_country_id, ab.entry_zone_id as customer_zone_id FROM " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab WHERE c.customers_id = ab.customers_id AND c.customers_default_address_id = ab.address_book_id AND c.customers_email_address = '" . $customer_info['EMAIL'] . "'"); if (tep_db_num_rows($query) > 0) { $data = tep_db_fetch_array($query); $customer_id = $data['customer_id']; $customer_first_name = $data['customer_first_name']; $customer_default_address_id = $data['customer_default_address_id']; $customer_country_id = $data['customer_country_id']; $customer_zone_id = $data['customer_zone_id']; } else { $_SESSION['temp_password'] = tep_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $sql_data_array = array('customers_firstname' => $customer_info['FIRSTNAME'], 'customers_lastname' => $customer_info['LASTNAME'], 'customers_email_address' => $customer_info['EMAIL'], 'customers_validation' => '1', 'customers_password' => tep_encrypt_password($_SESSION['temp_password'])); tep_db_perform(TABLE_CUSTOMERS, $sql_data_array); $customer_id = tep_db_insert_id(); $sql_query = tep_db_query("SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $customer_info['SHIPTOCOUNTRYCODE'] . "'"); if (tep_db_num_rows($sql_query) == 0) { $sql_query = tep_db_query("SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $customer_info['COUNTRYCODE'] . "'"); } $country = tep_db_fetch_array($sql_query); $customer_country_id = $country['countries_id']; $zone = tep_db_fetch_array(tep_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_country_id = '" . $country['countries_id'] . "' AND zone_code = '" . $customer_info['SHIPTOSTATE'] . "'")); if (tep_not_null($zone['zone_id'])) { $customer_zone_id = $zone['zone_id']; $state = ''; } else { $customer_zone_id = '0'; $state = $customer_info['SHIPTOSTATE']; } $customer_first_name = $customer_info['FIRSTNAME']; $customer_last_name = $customer_info['LASTNAME']; $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $customer_first_name, 'entry_lastname' => $customer_last_name, 'entry_telephone' => $customer_info['PHONENUM'], 'entry_street_address' => $customer_info['SHIPTOSTREET'], 'entry_postcode' => $customer_info['SHIPTOZIP'], 'entry_city' => $customer_info['SHIPTOCITY'], 'entry_country_id' => $customer_country_id, 'entry_zone_id' => $customer_zone_id, 'entry_state' => $state); tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $customer_default_address_id = tep_db_insert_id(); $billto = $customer_default_address_id; $sendto = $customer_default_address_id; tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $customer_default_address_id . "' where customers_id = '" . (int) $customer_id . "'"); tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customer_id . "', '0', now())"); $_SESSION['paypalxc_create_account'] = '1'; } $_SESSION['customer_id'] = $customer_id; $_SESSION['customer_first_name'] = $customer_first_name; $_SESSION['customer_default_address_id'] = $customer_default_address_id; $_SESSION['customer_country_id'] = $customer_country_id; $_SESSION['customer_zone_id'] = $customer_zone_id; }
/** * Create a new Manobo user * @param String $username Username to be used for login * @param String $password Password to be used for login * @param String $email User's email address * @param Int $active_status Use active status, 0=inactive / 1=active * @param String $skype_id User's Skype ID * @return Int return new id or 0 if failed because username already exist */ function createNewUser($username, $password, $email, $active_status, $skype_id) { $users = $this->retrieveList("username='******'"); if (count($users) > 0) { //username already exist $result = 0; } else { $data = array(); $data['username'] = $username; $data['password'] = md5($password); $data['email'] = $email; $data['status'] = $active_status; $data['skype_id'] = $skype_id; $data['show_todo'] = '0'; tep_db_perform('minierp_users', $data); $result = tep_db_insert_id(); } return $result; }
function create($user_id, $team, $posted_by, $posted_date, $message) { global $obj_notifications; $sda = array(); $sda['user_id'] = $user_id; $sda['department'] = $team; $sda['posted_by'] = $posted_by; $sda['posted_date'] = $posted_date; $sda['message'] = $message; tep_db_perform('walls', $sda); $this->id = tep_db_insert_id(); $this->getDetail(); if ($this->user_id > 0) { $notification_targets = array(); $notification_targets[] = $this->user_id; $notification_message = $obj_notifications->messageTemplateWallPost($this->user_name, $this->excerpt, 'your'); $obj_notifications->broadcast($notification_targets, $notification_message, $this->posted_by_name, 'open=wall&id=' . $this->id); } }
function add($process, $process_time, $process_method, $process_data_submit, $process_data_result = null) { if (is_array($process_data_submit)) { $process_data_submit = serialize($process_data_submit); } if (is_array($process_data_result)) { $process_data_result = serialize($process_data_result); } if (is_null($process_data_result)) { $process_data_result = 'null'; } $sda = array(); $sda['log_process'] = $process; $sda['log_process_time'] = $process_time; $sda['log_process_method'] = $process_method; $sda['log_process_data_submit'] = $process_data_submit; $sda['log_process_data_result'] = $process_data_result; tep_db_perform('payone_log', $sda); $log_id = tep_db_insert_id(); return $log_id; }
function createNew($jng_sp_id, $package_code = '', $package_type = null) { $counter = 0; if ($package_code == '') { $counter++; if ($jng_sp_id == '0') { $prefix_code = !is_null($package_type) ? 'SP' : 'RET'; } else { $prefix_query = tep_db_query("SELECT package_prefix FROM jng_sp WHERE jng_sp_id={$jng_sp_id}"); $prefix = tep_db_fetch_array($prefix_query); $prefix_code = $prefix['package_prefix']; if (!is_null($package_type)) { $prefix_code .= $package_type; } } $dateprefix = date('ymd'); $package_code = $prefix_code . '-' . $dateprefix . '-' . $counter; } $check_code_exist = tep_db_query("SELECT jng_sp_packages_id FROM jng_sp_packages WHERE package_code='{$package_code}'"); while (tep_db_num_rows($check_code_exist) > 0) { if ($counter > 0) { $old_counter = $dateprefix . '-' . $counter; $counter++; $new_counter = $dateprefix . '-' . $counter; $package_code = str_replace($old_counter, $new_counter, $package_code); } else { $package_code .= '-New'; } $check_code_exist = tep_db_query("SELECT jng_sp_packages_id FROM jng_sp_packages WHERE package_code='{$package_code}'"); } $psda = array(); $psda['jng_sp_id'] = $jng_sp_id; $psda['package_code'] = $package_code; if (!is_null($package_type)) { $psda['package_type'] = $package_type; } tep_db_perform('jng_sp_packages', $psda); $new_id = tep_db_insert_id(); return $new_id; }
function db_config() { $sql = 'SELECT configuration_group_id AS id FROM ' . TABLE_CONFIGURATION_GROUP . " WHERE configuration_group_title='Elm@r'"; $rs = tep_db_query($sql); if ($rs) { if ($row = tep_db_fetch_array($rs)) { $gid = $row['id']; echo "Elm@r-Konfigurationsgruppe gefunden: {$gid}\n"; } } if (empty($gid)) { $sql = 'INSERT INTO ' . TABLE_CONFIGURATION_GROUP . "(configuration_group_title, configuration_group_description) VALUES('Elm@r', 'Shop- und Produktdaten gemäß shopinfo.xml-Standard')"; $rs = tep_db_query($sql); if ($rs == 1) { $gid = tep_db_insert_id(); echo "Elm@r-Konfigurationsgruppe eingefügt: {$gid}\n"; } else { echo "Einfügen der Elm@r-Konfigurationsgruppe hat nicht geklappt:\n"; tep_db_error($sql, mysql_errno(), mysql_error()); } } $sql = 'SELECT COUNT(*) AS cnt FROM ' . TABLE_CONFIGURATION . ' WHERE configuration_key=\'MODULE_ELMAR_WARN_ELMAR_RENAME\''; $rs = tep_db_query($sql); if ($rs && ($row = tep_db_fetch_array($rs)) && $row['cnt'] > 0) { echo "Elm@r-Konfigurationswert vorhanden.\n"; } else { $sql = 'INSERT INTO ' . TABLE_CONFIGURATION . "(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Verzeichnis-umbenennen-Warnung', 'MODULE_ELMAR_WARN_ELMAR_RENAME', 'False', 'Warnen, wenn das elmar-Verzeichnis noch nicht umbenannt wurde (siehe readme.html).', {$gid}, 1, 'tep_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())"; $rs = tep_db_query($sql); if ($rs == 1) { echo "Elm@r-Konfigurationswert eingefügt.\n"; } else { echo "Einfügen eines Elm@r-Konfigurationswerts hat nicht geklappt.\n"; tep_db_error($sql, mysql_errno(), mysql_error()); } } }
if (empty($title)) { $messageStack->add(ERROR_NEWSLETTER_TITLE, 'error'); $affiliate_newsletter_error = true; } if (empty($affiliate_newsletter_module)) { $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error'); $affiliate_newsletter_error = true; } if ($affiliate_newsletter_error == false) { $sql_data_array = array('title' => $title, 'content' => $content, 'module' => $affiliate_newsletter_module); if ($action == 'insert') { $sql_data_array['date_added'] = 'now()'; $sql_data_array['status'] = '0'; $sql_data_array['locked'] = '0'; tep_db_perform(TABLE_AFFILIATE_NEWSLETTERS, $sql_data_array); $affiliate_newsletter_id = tep_db_insert_id(); } elseif ($action == 'update') { tep_db_perform(TABLE_AFFILIATE_NEWSLETTERS, $sql_data_array, 'update', "affiliate_newsletters_id = '" . (int) $affiliate_newsletter_id . "'"); } tep_redirect(tep_href_link(FILENAME_AFFILIATE_NEWSLETTERS, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'nID=' . $affiliate_newsletter_id)); } else { $action = 'new'; } break; case 'deleteconfirm': $affiliate_newsletter_id = tep_db_prepare_input($_GET['nID']); tep_db_query("delete from " . TABLE_AFFILIATE_NEWSLETTERS . " where affiliate_newsletters_id = '" . (int) $affiliate_newsletter_id . "'"); tep_redirect(tep_href_link(FILENAME_AFFILIATE_NEWSLETTERS, 'page=' . $_GET['page'])); break; case 'delete': case 'new':
public function saveToDB() { if ($this->fields['orders_id'] == OSCommerce_Order::NEW_RECORD) { unset($this->fields['orders_id']); tep_db_perform(TABLE_ORDERS, $this->fields); $this->fields['orders_id'] = $orderID = tep_db_insert_id(); $totalPrice = 0; $productsOrdered = ''; // Text summary of products ordered; for email. foreach ($this->products as $productID => $fields) { $orderProduct = array('orders_id' => $orderID, 'products_id' => $fields['id'], 'products_model' => $fields['model'], 'products_name' => $fields['name'], 'products_price' => $fields['price'], 'final_price' => $fields['final_price'], 'products_tax' => 0, 'products_quantity' => $fields['quantity']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $orderProduct); $orderProductID = tep_db_insert_id(); $productsAttributesText = ''; if (isset($fields['attributes'])) { foreach ($fields['attributes'] as $option_id => $value_id) { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $fields['id'] . "' and pa.options_id = '" . $option_id . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value_id . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . DEFAULT_LANGUAGE_ID . "' and poval.language_id = '" . DEFAULT_LANGUAGE_ID . "'"); $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $orderID, 'orders_products_id' => $orderProductID, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); $productsAttributesText .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name']; } } $productsOrdered .= $fields['quantity'] . ' x ' . $fields['name'] . ' (' . $fields['model'] . ') = ' . sprintf('$ %.2f', $fields['quantity'] * $fields['final_price']) . $productsAttributesText . "\n"; } $orderTotals = array(); $count = 0; $orderTotals[] = array('orders_id' => $orderID, 'title' => 'Subtotal', 'text' => 'Subtotal', 'value' => $this->getSubtotal(), 'text' => sprintf('$%.2f', $this->getSubtotal()), 'class' => 'ot_subtotal', 'sort_order' => count($orderTotals)); tep_db_perform(TABLE_ORDERS_TOTAL, $orderTotals[$count++]); $orderTotals[] = array('orders_id' => $orderID, 'title' => 'Tax', 'text' => 'Tax', 'value' => $this->getTax(), 'text' => sprintf('$%.2f', $this->getTax()), 'class' => 'ot_tax', 'sort_order' => count($orderTotals)); tep_db_perform(TABLE_ORDERS_TOTAL, $orderTotals[$count++]); $orderTotals[] = array('orders_id' => $orderID, 'title' => 'Shipping', 'text' => 'Shipping', 'text' => sprintf('$%.2f', $this->getShippingTotal()), 'value' => $this->getShippingTotal(), 'class' => 'ot_shipping', 'sort_order' => count($orderTotals)); tep_db_perform(TABLE_ORDERS_TOTAL, $orderTotals[$count++]); $orderTotals[] = array('orders_id' => $orderID, 'title' => 'Total', 'text' => sprintf('$%.2f', $this->getTotal()), 'value' => $this->getTotal(), 'class' => 'ot_total', 'sort_order' => count($orderTotals)); tep_db_perform(TABLE_ORDERS_TOTAL, $orderTotals[$count++]); reset($orderTotals); $this->sendOrderEmail($productsOrdered, $orderTotals); } else { throw new Exception("not happening: order update not implemented."); } }
function changeOrderProductStatus($opp_id, $order_product_id, $product_qty, $order_status, $comment = '', $delivery_note = false) { $opp_id = tep_db_prepare_input($opp_id); $op = tep_db_prepare_input($order_product_id); $pq = tep_db_prepare_input($product_qty); $os = $order_status; $comment = tep_db_prepare_input($comment); if ($opp_id == null || $opp_id == '' || $opp_id == '0') { $sql_data_array = array('orders_products_id' => $op, 'products_quantity' => $pq, 'products_orders_status' => $os); if ($delivery_note) { $sql_data_array['delivery_note'] = '1'; } tep_db_perform('orders_products_problem', $sql_data_array); $opp_id = tep_db_insert_id(); } else { $sql_data_array = array('products_quantity' => $pq, 'products_orders_status' => $os); tep_db_perform('orders_products_problem', $sql_data_array, 'update', "orders_products_problem_id={$opp_id}"); } $sql_data_array = array('orders_products_problem_id' => $opp_id, 'products_quantity' => $pq, 'orders_status_id' => $os, 'date_added' => 'now()', 'comment' => $comment); tep_db_perform('orders_products_problem_history', $sql_data_array); return $opp_id; }
if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => tep_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = tep_db_insert_id(); //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename \n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa \n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "' \n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' \n and pa.options_id = popt.products_options_id \n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' \n and pa.options_values_id = poval.products_options_values_id \n and popt.language_id = '" . $languages_id . "' \n and poval.language_id = '" . $languages_id . "'"; $attributes = tep_db_query($attributes_query); } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); } $attributes_values = tep_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]); tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int) $value_id . "', '" . (int) $languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')"); } tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int) $option_id . "', '" . (int) $value_id . "')"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'add_product_attributes': $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']); $options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']); $values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']); $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']); $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int) $products_id . "', '" . (int) $options_id . "', '" . (int) $values_id . "', '" . (double) tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')"); if (DOWNLOAD_ENABLED == 'true') { $products_attributes_id = tep_db_insert_id(); $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']); $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']); $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']); if (tep_not_null($products_attributes_filename)) { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int) $products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')"); } } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_option_name': $option_name_array = $HTTP_POST_VARS['option_name']; $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]); tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int) $option_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
function install() { if (!defined('MODULE_PAYMENT_MONEYBOOKERS_STATUS')) { tep_redirect(tep_href_link('ext/modules/payment/moneybookers/activation.php', 'action=coreRequired')); } $zone_id = 0; $zone_query = tep_db_query("select geo_zone_id from " . TABLE_GEO_ZONES . " where geo_zone_name = 'Moneybookers iDeal'"); if (tep_db_num_rows($zone_query)) { $zone = tep_db_fetch_array($zone_query); $zone_id = $zone['geo_zone_id']; } else { tep_db_query("insert into " . TABLE_GEO_ZONES . " values (null, 'Moneybookers iDeal', 'The zone for the Moneybookers iDeal payment module', null, now())"); $zone_id = tep_db_insert_id(); $country_query = tep_db_query("select countries_id from " . TABLE_COUNTRIES . " where countries_iso_code_2 = 'NL'"); if (tep_db_num_rows($country_query)) { $country = tep_db_fetch_array($country_query); tep_db_query("insert into " . TABLE_ZONES_TO_GEO_ZONES . " values (null, '" . (int) $country['countries_id'] . "', 0, '" . (int) $zone_id . "', null, now())"); } } tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Moneybookers iDeal', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_STATUS', 'False', 'Do you want to accept Moneybookers iDeal payments?', '6', '3', 'tep_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_ZONE', '" . (int) $zone_id . "', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_PREPARE_ORDER_STATUS_ID', '" . MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID . "', 'Set the status of prepared orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Transactions Order Status', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_TRANSACTIONS_ORDER_STATUS_ID', '" . MODULE_PAYMENT_MONEYBOOKERS_TRANSACTIONS_ORDER_STATUS_ID . "', 'Set the status of callback transactions to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_MONEYBOOKERS_IDL_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); }
if (empty($title)) { $messageStack->add(ERROR_NEWSLETTER_TITLE, 'error'); $newsletter_error = true; } if (empty($module)) { $messageStack->add(ERROR_NEWSLETTER_MODULE, 'error'); $newsletter_error = true; } if ($newsletter_error == false) { $sql_data_array = array('title' => $title, 'content' => $content, 'module' => $newsletter_module, 'filter' => serialize(array('orders' => $orders, 'site' => $site, 'city' => $city))); if ($action == 'insert') { $sql_data_array['date_added'] = 'now()'; $sql_data_array['status'] = '0'; $sql_data_array['locked'] = '0'; tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array); $newsletter_id = tep_db_insert_id(); } elseif ($action == 'update') { tep_db_perform(TABLE_NEWSLETTERS, $sql_data_array, 'update', "newsletters_id = '" . (int) $newsletter_id . "'"); } tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'nID=' . $newsletter_id)); } else { $action = 'new'; } break; case 'deleteconfirm': $newsletter_id = tep_db_prepare_input($HTTP_GET_VARS['nID']); tep_db_query("delete from " . TABLE_NEWSLETTERS . " where newsletters_id = '" . (int) $newsletter_id . "'"); tep_redirect(tep_href_link(FILENAME_NEWSLETTERS, 'page=' . $HTTP_GET_VARS['page'])); break; case 'delete': case 'new':
require 'includes/application_top.php'; $action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''; if (tep_not_null($action)) { switch ($action) { case 'insert': case 'save': if (isset($HTTP_GET_VARS['mID'])) { $manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']); } $manufacturers_name = tep_db_prepare_input($HTTP_POST_VARS['manufacturers_name']); $sql_data_array = array('manufacturers_name' => $manufacturers_name); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array); $manufacturers_id = tep_db_insert_id(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int) $manufacturers_id . "'"); } $manufacturers_image = new upload('manufacturers_image'); $manufacturers_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($manufacturers_image->parse() && $manufacturers_image->save()) { tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . tep_db_input($manufacturers_image->filename) . "' where manufacturers_id = '" . (int) $manufacturers_id . "'"); } $languages = tep_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $manufacturers_url_array = $HTTP_POST_VARS['manufacturers_url']; $language_id = $languages[$i]['id']; $sql_data_array = array('manufacturers_url' => tep_db_prepare_input($manufacturers_url_array[$language_id]));