14 define(
'IN_PEEL_ADMIN',
true);
15 include(
"../configuration.inc.php");
19 $specific_fields_array = array(
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_LISTED_PRICE_INCLUDING_VAT'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_LISTED_PRICE_EXCLUDING_VAT'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_SIZES'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_COLORS'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_BRAND'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_ASSOCIATED_PRODUCTS'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_CATEGORY'],
'Stock',
'Categorie',
'categorie_id');
22 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_haut.php");
31 FROM peel_nom_attributs
33 ORDER BY nom_" .
$_SESSION[
'session_langue'] .
"");
43 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_DEMO_RIGHTS_LIMITED']))->fetch();
46 echo
$GLOBALS[
'tplEngine']->createTemplate(
'admin_import_produits_table.tpl')->fetch();
47 if (isset($_POST[
'on_update'])) {
49 query(
"UPDATE peel_import_field SET etat='0'");
50 foreach($_POST[
'on_update'] as $this_id => $this_value) {
51 echo
'<input type="hidden" name="on_update[' . $this_id .
']" value="' .
String::str_form_value($this_value) .
'" />';
52 query(
"UPDATE peel_import_field
57 query(
"INSERT INTO peel_import_field
63 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_INVALID_TOKEN']))->fetch();
64 }
elseif (empty($_POST[
'type_import'])) {
65 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_TYPE_NOT_CHOSEN']))->fetch();
66 }
elseif ($_POST[
'type_import'] ==
'chosen_fields' && empty($_POST[
'on_update'])) {
67 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_FIELDS_NOT_CHOSEN']))->fetch();
69 $fichier =
upload(
'fichier',
false,
'data',
$GLOBALS[
'site_parameters'][
'image_max_width'],
$GLOBALS[
'site_parameters'][
'image_max_height']);
70 if (empty($fichier) || !file_exists(
$GLOBALS[
'uploaddir'] .
'/' . $fichier)) {
72 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' =>
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_FILE_NOT_FOUND']))->fetch();
74 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_import_produits_fichier.tpl');
75 $tpl->assign(
'href',
$GLOBALS[
'repertoire_upload'] .
'/' . $fichier);
76 $tpl->assign(
'name', $fichier);
78 $tpl->assign(
'STR_BEFORE_TWO_POINTS',
$GLOBALS[
'STR_BEFORE_TWO_POINTS']);
80 if ($_POST[
'type_import'] ==
'chosen_fields') {
81 foreach($_POST[
'on_update'] as $this_field_name) {
83 $selected_product_field_names[] = $this_field_name;
90 if (empty($_POST[
'columns_separator'])) {
92 if (strpos($this_line,
"\t") !==
false) {
94 }
elseif (strpos($this_line,
";") !==
false) {
96 }
elseif (strpos($this_line,
",") !==
false) {
101 }
elseif ($_POST[
'columns_separator'] ==
'\t') {
104 $separator = $_POST[
'columns_separator'];
106 $field_names = explode($separator, $this_line);
107 $temp_trim_field_names = array();
109 foreach($field_names as $this_key => $this_field_name) {
110 $this_field_name = trim($this_field_name);
111 $field_names[$this_key] = $this_field_name;
112 if ($_POST[
'type_import'] ==
'chosen_fields' && !in_array($this_field_name, $selected_product_field_names)) {
117 if (!in_array($this_field_name,
$product_field_names) && strpos($this_field_name,
"#") ===
false && strpos($this_field_name,
"§") ===
false) {
120 if(!in_array($this_field_name, array(
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_CATEGORY'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_SIZES'],
$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_COLORS'],
'Stock',
'Categorie',
'categorie_id'))) {
123 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_COLUMN_NOT_HANDLED'], $this_key, (!empty($this_field_name)?$this_field_name:
'[-]'))))->fetch();
128 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_COLUMN_NOT_KNOWN'], $this_key, (!empty($this_field_name)?$this_field_name:
'[-]'))))->fetch();
132 if (in_array($this_field_name, $temp_trim_field_names)) {
133 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_INCOHERENT_COLUMNS'], $this_field_name)))->fetch();
136 $temp_trim_field_names[] = $this_field_name;
138 unset($temp_trim_field_names);
141 if (empty($skip_import)) {
144 unset($set_sql_fields);
145 unset($field_values);
146 $last_treated_columns = 0;
152 if (empty($this_line)) {
156 $line_fields = explode($separator, $this_line);
157 foreach($line_fields as $key => $this_field) {
159 if(isset($field_names[$key + $last_treated_columns])) {
160 if (!isset($field_values[$field_names[$key + $last_treated_columns]])) {
161 $field_values[$field_names[$key + $last_treated_columns]] = trim($this_field);
163 $field_values[$field_names[$key + $last_treated_columns]] .= trim($this_field);
166 echo
$GLOBALS[
'tplEngine']->createTemplate(
'global_error.tpl', array(
'message' => sprintf(
$GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_ERR_COLUMN_NOT_KNOWN'], $key + $last_treated_columns, $this_field)))->fetch();
169 $last_treated_columns += $key;
171 if (!empty($field_values) && count($field_values) > count(
$columns_skipped)) {
173 if (empty($field_values[
'date_insere'])) {
174 $field_values[
'date_insere'] = date(
'Y-m-d H:i:s', time());
176 if (empty($field_values[
'date_maj'])) {
177 $field_values[
'date_maj'] = date(
'Y-m-d H:i:s', time());
194 $tpl =
$GLOBALS[
'tplEngine']->createTemplate(
'admin_import_produits_form.tpl');
197 $tpl_inputs = array();
199 FROM peel_import_field
208 $product_field_names[$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_SIZES']] = $GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_SIZES'];
209 $product_field_names[$GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_COLORS']] = $GLOBALS[
'STR_ADMIN_EXPORT_PRODUCTS_COLORS'];
213 if ($this_field !=
'stock') {
214 $tpl_inputs[] = array(
'field' => $this_field,
215 'issel' =>
vb($fields_explanations_arrays[$this_field][
'etat']) == 1,
216 'explanation' =>
vb($fields_explanations_arrays[$this_field][
'texte']),
217 'is_important' => ($this_field ==
'id' || $this_field ==
'categorie_id')
221 $tpl->assign(
'inputs', $tpl_inputs);
222 $tpl->assign(
'uploaddir', $uploaddir);
223 $tpl->assign(
'import_encoding',
vb(
$frm[
'import_encoding']));
224 $tpl->assign(
'example_href',
'import/exemple_prod.csv');
225 $tpl->assign(
'STR_BEFORE_TWO_POINTS', $GLOBALS[
'STR_BEFORE_TWO_POINTS']);
226 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FORM_TITLE', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FORM_TITLE']);
227 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FILE_FORMAT', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FILE_FORMAT']);
228 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FILE_FORMAT_EXPLAIN', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FILE_FORMAT_EXPLAIN']);
229 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FILE_EXAMPLE', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FILE_EXAMPLE']);
230 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_MODE', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_MODE']);
231 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_ALL_FIELDS', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_ALL_FIELDS']);
232 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_SELECTED_FIELDS', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_IMPORT_SELECTED_FIELDS']);
233 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_SELECT_FIELDS', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_SELECT_FIELDS']);
234 $tpl->assign(
'STR_WARNING', $GLOBALS[
'STR_WARNING']);
235 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_EXPLAIN', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_EXPLAIN']);
236 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_WARNING_ID', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_WARNING_ID']);
237 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FILE_NAME', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FILE_NAME']);
238 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_FILE_ENCODING', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_FILE_ENCODING']);
239 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_SEPARATOR', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_SEPARATOR']);
240 $tpl->assign(
'STR_ADMIN_IMPORT_PRODUCTS_SEPARATOR_EXPLAIN', $GLOBALS[
'STR_ADMIN_IMPORT_PRODUCTS_SEPARATOR_EXPLAIN']);
241 $tpl->assign(
'STR_VALIDATE', $GLOBALS[
'STR_VALIDATE']);
245 include(
$GLOBALS[
'repertoire_modele'] .
"/admin_bas.php");
if(!empty($GLOBALS['site_parameters']['order_specific_field_titles'])) if(check_if_module_active('socolissimo')&&!empty($_REQUEST)&&!empty($_REQUEST['PUDOFOID'])&&!empty($_REQUEST['CEEMAIL'])&&!empty($_REQUEST['SIGNATURE'])&&!empty($_REQUEST['ORDERID'])) elseif(!empty($_POST)) elseif(check_if_module_active('socolissimo')&&!empty($_SESSION['session_commande']['is_socolissimo_order'])) foreach(array('bill'=> 1, 'ship'=> 2) as $address_type=> $session_commande_address_id) $frm['societe1']
static convert_encoding($string, $new_encoding, $original_encoding=null)
Converts the character encoding of string $string to $new_encoding from optionally $original_encoding...
get_current_url($with_get=true, $get_short_url=false, $take_away_get_args_array=null)
get_current_url()
upload($field_name, $rename_file=true, $file_kind=null, $image_max_width=null, $image_max_height=null, $path=null, $new_file_name_without_extension=null, $default_return_value=null)
Fonction d'upload de fichiers.
while($attrib=fetch_assoc($q_nom_attrib)) $columns_skipped
static fopen_utf8($filename, $mode, $force_filename_in_iso_8859=false, $try_filename_in_iso_8859_if_file_not_found=true)
Ouvre un fichier.
affected_rows($database_object=null)
affected_rows()
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
create_or_update_product($field_values, $columns_skipped=array(), $product_field_names=array(), $specific_fields_array=array(), $admin_mode=false)
Import d'un produit : mise à jour ou création du produit.
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
static feof($handle)
Tests for end-of-file on a file pointer In contrary of the default feof function, it returns true if ...
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
static str_form_value($value, $flags=ENT_COMPAT)
Encode une chaine de caractères pour affichage dans un value="".
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
get_table_field_names($table_name, $link_identifier=null, $silent_if_error=false)
get_table_field_names()
fetch_assoc($query_result)
fetch_assoc()
get_form_token_input($name= 'general', $use_existing_token=true, $return_as_input_form=true)
get_form_token_input()
get_site_id_sql_set_value($site_ids)
Retourne la valeur SQL d'un champ INT ou SET suivant que ce soit un entier ou un tableau.
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
verify_token($name= 'general', $delay_in_minutes=60, $check_referer_if_set_by_server=true, $cancel_token=true, $minimum_wait_in_seconds_before_use=0)
Vérification de la validité d'un token Par défaut, un token est valide 1h, et utilisable 1 seule fois...
if(defined('IN_PEEL_ADMIN')||IN_INSTALLATION) $_SESSION['session_langue']