PEEL Shopping
Open source ecommerce : PEEL Shopping
export_clients.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: export_clients.php 47326 2015-10-12 14:32:38Z sdelaporte $
14 
15 define('IN_PEEL_ADMIN', true);
16 include("../../../configuration.inc.php");
18 necessite_priv("admin_webmastering");
19 
20 if (!empty($_GET['encoding'])) {
21  $page_encoding = $_GET['encoding'];
22 } elseif (!empty($GLOBALS['site_parameters']['export_encoding'])) {
23  $page_encoding = $GLOBALS['site_parameters']['export_encoding'];
24 } else {
25  $page_encoding = 'utf-8';
26 }
27 $output = '';
28 $cle = trim(vb($_GET['cle']));
29 $priv = trim(vb($_GET['priv']));
30 
31 
32 $filename = "export_clients_" . str_replace('/', '-', date($GLOBALS['date_basic_format_short'])) . ".csv";
33 // On ne veut pas polluer le fichier exporté par un quelconque message d'erreur
34 @ini_set('display_errors', 0);
36 if (!empty($_GET['export']) && $_GET['export'] == 'search_user') {
37  $sqlC = afficher_liste_utilisateurs($priv, $cle, $_GET, 'date_insert', false, true);
38 } else {
39  $sqlC = "SELECT u.*
40  FROM peel_utilisateurs u
41  WHERE " . get_filter_site_cond('utilisateurs', 'u', true) . "";
42  if (!empty($_GET['priv'])) {
43  $sqlC .= " AND u.priv = '" . nohtml_real_escape_string($_GET['priv']) . "'";
44  }
45  if (!empty($cle)) {
46  $sqlC .= " AND (u.code_client LIKE '%" . nohtml_real_escape_string($cle) . "%' OR u.email LIKE '%" . nohtml_real_escape_string($cle) . "%' OR u.ville LIKE '%" . nohtml_real_escape_string($cle) . "%' OR u.nom_famille LIKE '%" . nohtml_real_escape_string($cle) . "%' OR u.code_postal LIKE '%" . nohtml_real_escape_string($cle) . "%')";
47  }
48 }
49 $output .= "Email\tNom\tPrénom\tSociété\tAdresse\tCode postal\tVille\tTéléphone\r\n";
50 
52 
53 while ($C = fetch_assoc($resC)) {
54  $output .= filtre_csv($C['email']) . "\t";
55  $output .= filtre_csv($C['nom_famille']) . "\t";
56  $output .= filtre_csv($C['prenom']) . "\t";
57  $output .= filtre_csv($C['societe']) . "\t";
58  $output .= filtre_csv($C['adresse']) . "\t";
59  $output .= filtre_csv($C['code_postal']) . "\t";
60  $output .= filtre_csv($C['ville']) . "\t";
61  $output .= filtre_csv($C['telephone']) . "\r\n";
62 }
63 
64 echo String::convert_encoding($output, $page_encoding, GENERAL_ENCODING);
65 
$filename
static convert_encoding($string, $new_encoding, $original_encoding=null)
Converts the character encoding of string $string to $new_encoding from optionally $original_encoding...
Definition: String.php:375
afficher_liste_utilisateurs($priv, $cle, $frm=null, $order= 'date_insert', $allow_message_no_result=false, $return_sql_request_without_display=false)
Affiche la liste des utilisateurs en fonction des critères de recherche Un certain nombre de champs d...
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 ...
Definition: database.php:400
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
Definition: fonctions.php:1575
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.
Definition: fonctions.php:4643
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.
Definition: database.php:158
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
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))
Definition: chart-data.php:160
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
Definition: fonctions.php:1596
filtre_csv($string, $separator="\t")
Formatte une chaine de caractère pour insertion dans du CSV.
Definition: format.php:277
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
$GLOBALS['page_columns_count']
if(!check_if_module_active('search')) $page_encoding
Definition: produit.php:23
$output
output_csv_http_export_header($filename, $type= 'excel', $page_encoding)
Génère les entêtes HTTP pour un fichier CSV.
Definition: format.php:802

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:28 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.