public static function file($index = null) { if (!$_FILES) { return array(); } if (!function_exists('get_upload_file') || !function_exists('transposed_all_files_array')) { self::ci()->load->helper('oa'); } if ($index === null) { return transposed_all_files_array($_FILES); } preg_match_all('/^(?P<var>\\w+)(\\s?\\[\\s?\\]\\s?)$/', $index, $matches); if ($matches = $matches['var'] ? $matches['var'][0] : null) { return get_upload_file($matches); } else { return get_upload_file($index, 'one'); } }
if (isset($xval[$midx])) { tep_set_products_extra($model_pid, $xkey, $xval[$midx]); } } } foreach ($postattrs as $aid => $av) { $optns_sort = $_POST['options_sort_order'][$aid]; $attrs_sort = isset($_POST['attrs_sort_order'][$aid . '_' . $av]) ? $_POST['attrs_sort_order'][$aid . '_' . $av] : ''; $attrs_sortq = $attrs_sort == '' ? 'NULL' : "'{$attrs_sort}'"; $attrs_img = ''; if (isset($_POST['attr_image'][$aid . '_' . $av]) && preg_match('/^(\\w+):(.*)/', $_POST['attr_image'][$aid . '_' . $av], $at_img_parse)) { if ($at_img_parse[1] == 'file') { $attrs_img = $at_img_parse[2]; } else { if ($at_img_parse[1] == 'upload') { $attrs_img = get_upload_file('upload_attr_image_' . $at_img_parse[2]); } } } if ($new_model_pid) { tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id,options_id,options_values_id,options_sort,options_values_sort,options_image) VALUES ('{$new_model_pid}','{$aid}','{$av}','{$optns_sort}',{$attrs_sortq},'" . addslashes($attrs_img) . "')"); } else { tep_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " SET options_sort='{$optns_sort}',options_values_sort={$attrs_sortq},options_image='" . addslashes($attrs_img) . "' WHERE products_id='{$model_pid}' AND options_id='{$aid}'"); } } } } } foreach ($curr_models as $mid => $mdata) { $url_rewrite->purge_item(sprintf('p%d', $mid)); tep_db_query("DELETE FROM " . TABLE_PRODUCTS . " WHERE products_id='{$mid}'");
private function _getPostFiles($index) { if (!($index && $_FILES)) { return null; } preg_match_all('/^(?P<var>\\w+)(\\s?\\[\\s?\\]\\s?)$/', $index, $matches); return ($matches = $matches['var'] ? $matches['var'][0] : null) ? get_upload_file($matches) : get_upload_file($index, 'one'); }