Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Programme récupéré de https://sourceforge.net/projects/csv2vcf-php/
- test possible ici https://dwaves.org/2016/06/30/csv2vcf-online-converter/
- J'ai changé beaucoup de choses par rapport au départ.
- Le fichier csv provient d'un programme trouvé ici
- https://github.com/thomascube/vcfconvert
- Ce programme transforme les vcf en csv.
- J'ai donc changé le nom des champs pour l'adapter au csv que j'avais.
- Le client envoie un fichier CSV pour le transformer en fichier VCF (vcard)
- Il faut connaitre le séparateur du fichier csv.
- Comme séparateur possible ',' ';' ou tab (<p>You can put as separator: ',' ';' or tab </p> )
- Vous pouvez récupérer le fichier vcf produit mais dès que le vous revenez au début pour en transformer un autre, le fichier est détruit
- La permière ligne du fichier csv doit contenir
- First Name;Last Name;Display Name;Nickname;E-mail Address;E-mail 2 Address;E-mail 3 Address;Home Phone;Business Phone;Home Fax;Business Fax;Pager;Mobile Phone;Home Street;Home Address 2;Home City;Home State;Home Postal Code;Home Country;Business Address;Business Address 2;Business City;Business State;Business Postal Code;Business Country;Country Code;Related name;Job Title;Department;Organization;Notes;Birthday;Anniversary;Gender;Web Page;Web Page 2;Categories
- Le programme se base sur cela pour traiter les données du fichier csv
- Merci à tous ceux qui m'ont aidé pour finaliser le php
- surtout Edgar, Marc et Jérôme de la guilde de Grenoble
- La Guilde des utilisateurs d’informatique libre du Dauphiné (GUILDE) est une association loi 1901 ayant pour objectif de promouvoir les logiciels libres, et particulièrement le système GNU/Linux, auprès des particuliers et des professionnels et de rassembler les utilisateurs de la région du Dauphiné.
- */
- /* === examples for different vCard Versions according to Wikpedia ===
- vCard 2.1
- BEGIN:VCARD
- VERSION:2.1
- N:Gump;Forrest;;Mr.
- FN:Forrest Gump
- ORG:Bubba Gump Shrimp Co.
- TITLE:Shrimp Man
- PHOTO;GIF:http://www.example.com/dir_photos/my_photo.gif
- TEL;WORK;VOICE:(111) 555-1212
- TEL;HOME;VOICE:(404) 555-1212
- ADR;WORK;PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America
- LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:100 Waters Edge=0D=
- =0ABaytown\, LA 30314=0D=0AUnited States of America
- ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
- LABEL;HOME;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:42 Plantation St.=0D=0A=
- Baytown, LA 30314=0D=0AUnited States of America
- EMAIL:[email protected]
- REV:20080424T195243Z
- END:VCARD
- vCard 3.0
- BEGIN:VCARD
- VERSION:3.0
- N:Gump;Forrest;;Mr.
- FN:Forrest Gump
- ORG:Bubba Gump Shrimp Co.
- TITLE:Shrimp Man
- PHOTO;VALUE=URI;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif
- TEL;TYPE=WORK,VOICE:(111) 555-1212
- TEL;TYPE=HOME,VOICE:(404) 555-1212
- ADR;TYPE=WORK,PREF:;;100 Waters Edge;Baytown;LA;30314;United States of Amer
- ica
- LABEL;TYPE=WORK,PREF:100 Waters Edge\nBaytown\, LA 30314\nUnited States of
- America
- ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
- LABEL;TYPE=HOME:42 Plantation St.\nBaytown\, LA 30314\nUnited States of Ame
- rica
- EMAIL:[email protected]
- REV:2008-04-24T19:52:43Z
- END:VCARD
- vCard 4.0
- BEGIN:VCARD
- VERSION:4.0
- N:Forrest;Gump;;Mr.;
- FN:Forrest Gump
- ORG:Bubba Gump Shrimp Co.
- TITLE:Shrimp Man
- PHOTO;MEDIATYPE=image/gif:http://www.example.com/dir_photos/my_photo.gif
- TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212
- TEL;TYPE=home,voice;VALUE=uri:tel:+1-404-555-1212
- ADR;TYPE=work;LABEL="100 Waters Edge\nBaytown, LA 30314\nUnited States of A
- merica";PREF=1:;;100 Waters Edge;Baytown;LA;30314;United States of America
- ADR;TYPE=home;LABEL="42 Plantation St.\nBaytown, LA 30314\nUnited States of
- America":;;42 Plantation St.;Baytown;LA;30314;United States of America
- EMAIL:[email protected]
- REV:20080424T195243Z
- END:VCARD
- */
- error_reporting(E_ALL & ~E_NOTICE); // report all errors except notices
- // fonction pour l'affichage de la page avec header
- function print_html_header()
- {
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="convert csv2vcf" />
- <meta name="keywords" content="csv2vcf" />
- <title>convert csv2vcf</title>
- <!-- external styles -->
- <link href="css/style.css" type="text/css" rel="stylesheet"/>
- </head>
- <body>
- <div class="boxShadows" id="headline">
- <h1>csv2vcf: convert *.csv to *.vcf</h1>';
- }
- $comma = ',';
- $semicolon = ';';
- // $tab = ' ';
- $tab = 'tab';
- $oui='oui';
- $non='non';
- // if(isset($_REQUEST["convert"])) // detect upload of file
- // if ( isset($_REQUEST["convert"]) || isset($_REQUEST["verif"]) || isset($_REQUEST["retour"]) ) // detect upload of file
- if ( isset($_REQUEST["convert"]) || isset($_REQUEST["verif"]) ) // detect upload of file
- {
- //1
- $allowedExts = array('csv','txt'); // MMM
- $maximumFileSizeInKBytes = 4096;
- $allowedExts_string = "";
- for($i=0;$i<count($allowedExts);$i++) {
- $allowedExts_string .= "*.".$allowedExts[$i].", ";
- }
- $maximumFileSizeInBytes = $maximumFileSizeInKBytes * 1024;
- $delimiter = $_POST['$_delimiter'] == 'tab' ? "\t" : $_POST['$_delimiter'];
- // $delimiter = $_POST['$_delimiter'];
- $telfixe = $_POST['$_telfixe'];
- $categorie = $_POST['$_categorie'];
- // $_FILES = $_POST['$file1'];
- if($_FILES)
- {
- // 2
- if(checkExtension($allowedExts)) // MMM
- {
- // 3
- if(($_FILES["file"]["size"] < $maximumFileSizeInBytes))
- {
- // 4
- if ($_FILES["file"]["error"] > 0)
- {
- // 5
- print_html_header();
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "Return Code: ".$_FILES["file"]["error"]."<br>";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- }
- else
- if ($delimiter == "")
- {
- // 5
- print_html_header();
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "field selector not selected";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- }
- else
- if ( $telfixe !== "oui" && $telfixe !== "non" )
- {
- // 5
- print_html_header();
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "Vous devez sélectionner oui ou non pour Tel fixe (oui) ou nextcloud/tel mobile (non)";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- }
- else
- if ( isset($_REQUEST["convert"]))
- {
- // 5
- // print_html_header();
- $filename_vcf = $_FILES["file"]["name"].".vcf";
- header('Content-Type: text/vcard');
- header(sprintf('Content-Disposition: attachment; filename="%s"', $filename_vcf));
- /* echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "Nombre de lignes : ".$length1."<br>";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- */
- convert1($_FILES["file"]["tmp_name"],$delimiter,$telfixe,$catégorie);
- exit;
- }
- else
- if ( isset($_REQUEST["verif"]))
- {
- // 5
- print_html_header();
- $nomFich = file($_FILES["file"]["tmp_name"]);
- $length1 = count($nomFich);
- echo "Fichier Vérifié <br>";
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "Nombre de lignes : ".$length1."<br>";
- echo "Name 1: ".$_FILES["file"]["tmp_name"]."<br>";
- $fich_tmp = $_FILES["file"]["tmp_name"];
- # récupération des différentes catégories du fichier
- $categorie = checkCategorie($fich_tmp,$delimiter);
- echo '<form method="post" enctype="multipart/form-data">
- <input type="hidden" name="$_FILES["file"]["name"]" value="'.$nomFich.'" >
- <input type="hidden" name="$_delimiter" value="'.$delimiter.'" >
- <input type="hidden" name="$_telfixe" value="'.$telfixe.'" >
- Catégorie :
- <select name = "$_categorie[]" multiple size = 6> ';
- foreach($categorie as $select_cat){
- echo '<option value = "'.$select_cat.'" > '.$select_cat.' </option>';
- }
- echo '</select>
- <input type="submit" name="convert" value="convert" style="width: 100%;">
- <input type="submit" name="retour" value="retour" style="width: 100%;">
- </form>';
- finentete();
- }
- }
- else
- {
- // 4
- print_html_header();
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "File exceeds filezie limit of ".$maximumFileSizeInBytes."kByte.";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- }
- }
- else
- {
- // 3
- print_html_header();
- echo "Name: ".$_FILES["file"]["name"]."<br>";
- echo "field selector: '".$delimiter."'<br>";
- echo "Size: ".($_FILES["file"]["size"] / 1024)." kB<br>";
- echo "Tel fixe : '".$telfixe."'<br>";
- echo "File was not a allowed filetypes: ".$allowedExts_string."<br>";
- erreurs($_FILES["file"]["tmp_name"],$delimiter,$telfixe);
- }
- }
- }
- else
- {
- // 1
- print_html_header();
- if ( isset($_REQUEST["retour"]) )
- {
- // 2
- $delimiter = $_POST['$_delimiter'] == 'tab' ? "\t" : $_POST['$_delimiter'];
- $telfixe = $_POST['$_telfixe'];
- // ajouté pour test si cela passe bien ici
- echo '<label for="file">Please select your File.csv then hit convert:</label>';
- }
- echo '<form method="post" enctype="multipart/form-data">
- <label for="file">Please select your File.csv then hit convert:</label>
- <input type="file" name="file" id="file" style="width: 100%;">
- <br />
- field selector :
- <select name="$_delimiter" value="'.$delimiter.'" >
- <option value=""></option>
- <option value="'.$comma.'">Comma</option>
- <option value="'.$semicolon.'" selected >Semicolon</option>
- <option value="'.$tab.'">Tab</option>
- </select><br />
- téléphone fixe :
- <select name="$_telfixe" value="'.$telfixe.'" >
- <option value=""></option>
- <option value="'.$oui.'" selected >Oui</option>
- <option value="'.$non.'">Non</option>
- </select><br />
- <input type="submit" name="verif" value="selectionner la catégorie que vous voulez" style="width: 100%;">
- <input type="submit" name="convert" value="convert" style="width: 100%;">
- </form>';
- // <input type="submit" name="convert" value="convert" style="width: 100%;">
- finentete();
- }
- // MMM verifie que le fichier envoye a l'une des extensions de $allowedExts
- function checkExtension(array $allowedExts)
- {
- $upload_filename = $_FILES["file"]["name"];
- $upload_filename_array = explode(".", $upload_filename);
- $extension = strtolower(end($upload_filename_array));
- $key = array_search($extension, $allowedExts);
- return $key !== false;
- }
- // Récupère les différentes catégories dans un tableau
- function checkCategorie($filename_csv, $delimiter1)
- {
- $lines_csv = file($filename_csv);
- $length = count($lines_csv);
- # récupération de la catégorie de chaque ligne
- for($i = 0;$i < $length;$i++)
- {
- if($i == 0)
- {
- $keys_csv = $lines_csv[$i];
- $keys_csv = explode($delimiter1,$keys_csv);
- $keys_csv[36] = rtrim($keys_csv[36]); // on enlève les blancs en fin du dernier poste de chaque ligne
- }
- else
- {
- $values_csv = $lines_csv[$i];
- $values_csv = explode($delimiter1,$values_csv);
- $values_csv[36] = rtrim($values_csv[36]); // on enlève les blancs en fin du dernier poste de chaque ligne
- // Categories
- $position = findPos("Categories", $keys_csv);
- $categ = $values_csv[$position];
- $line[] = $values_csv[$position];
- }
- }
- # récupération des différentes catégories qui se trouve dans le fichier
- $cat = array_unique($line);
- return $cat;
- }
- // Conversion du fichier csv en vcf
- // J'ai changé la plupart des noms pour l'adapter au pgm qui fait vcf => csv qui vient de thomascube/vcfconvert
- // First Name;Last Name;Display Name;Nickname;E-mail Address;E-mail 2 Address;E-mail 3 Address;Home Phone;Business Phone;Home Fax;Business Fax;Pager;Mobile Phone;Home Street;Home Address 2;Home City;Home State;Home Postal Code;Home Country;Business Address;Business Address 2;Business City;Business State;Business Postal Code;Business Country;Country Code;Related name;Job Title;Department;Organization;Notes;Birthday;Anniversary;Gender;Web Page;Web Page 2;Categories
- // Si il n'y a pas de données dans les champs ci-dessus, rien n'est écrit dans le fichier de destination sauf
- // BEGIN:VCARD - VERSION:2.1 - END:VCARD
- // Donc si mauvais séparateur de champs donné votre fichier de sortie n'aura que des lignes avec
- // BEGIN:VCARD - VERSION:2.1 - END:VCARD
- function convert1($filename_csv, $delimiter1, $telfixe1, $categorie1)
- {
- // $filename_csv = "export2016.06.24.csv";
- $categorie1 = array('My Contacts','My Contacts1','Friends','Family');
- // gestion des fins de lignes selon si le vcf sert pour les téléphones fixes ou non
- if ( ( $telfixe1 ) !== "oui")
- {
- $fin_ligne = "\n";
- }
- else
- {
- $fin_ligne = "\r\n";
- }
- $lines_csv = file($filename_csv);
- $length = count($lines_csv);
- for($i = 0;$i < $length;$i++)
- {
- if($i == 0)
- {
- $keys_csv1 = $lines_csv[$i];
- $keys_csv = explode($delimiter1,$keys_csv1);
- $keys_csv[36] = rtrim($keys_csv[36]); // on enlève les blancs en fin du dernier poste de chaque ligne
- }
- else
- {
- $values_csv = $lines_csv[$i];
- $values_csv = explode($delimiter1,$values_csv);
- $values_csv[36] = rtrim($values_csv[36]); // on enlève les blancs en fin du dernier poste de chaque ligne
- // recheche si Catégories existe dans les catégories sélectionnées
- $position = findPos("Categories", $keys_csv);
- $categ = $values_csv[$position];
- if (in_array($categ, $categorie1))
- {
- print "BEGIN:VCARD".$fin_ligne; // what Version does this file have
- print "VERSION:2.1".$fin_ligne; // what Version does this file have
- // print "BEGIN:VCARD\n"; // what Version does this file have
- // print "VERSION:2.1\n".$fin_ligne; // what Version does this file have
- $position1 = findPos("First Name", $keys_csv);
- $position2 = findPos("Last Name", $keys_csv);
- $position = $values_csv[$position1] . ";" . $values_csv[$position2];
- if ( ( $position ) !== ";")
- {
- print "N:".$position.$fin_ligne; // N:Gump;Forrest;;Mr.
- }
- if ( ( $telfixe1 ) !== "oui")
- {
- $position3 = findPos("Display Name", $keys_csv);
- $position = $values_csv[$position3];
- if ( !empty( $position ) )
- {
- print "FN:".$position.$fin_ligne; // FN:Forrest Gump
- }
- }
- // ORG:Bubba Gump Shrimp Co.
- // TITLE:Shrimp Man
- // PHOTO;GIF:http://www.example.com/dir_photos/my_photo.gif
- $position = findPos("Home Phone", $keys_csv);
- $phone0 = $values_csv[$position];
- if ( !empty( $phone0 ) )
- {
- print "TEL;HOME:".$phone0.$fin_ligne; // phone0
- }
- $position = findPos("Business Phone", $keys_csv);
- $phone1 = $values_csv[$position];
- if ( !empty( $phone1 ) )
- {
- print "TEL;WORK:".$phone1.$fin_ligne; // phone1
- }
- $position = findPos("Mobile Phone", $keys_csv);
- $phone4 = $values_csv[$position];
- if ( !empty( $phone4 ) )
- {
- print "TEL;CELL:".$phone4.$fin_ligne; // phone3
- }
- if ( ( $telfixe1 ) !== "oui")
- {
- $position = findPos("Home Fax", $keys_csv);
- $phone2 = $values_csv[$position];
- if ( !empty( $phone2 ) )
- {
- print 'TEL;TYPE="fax,home":'.$phone2.$fin_ligne; // phone2
- }
- $position = findPos("Business Fax", $keys_csv);
- $phone3 = $values_csv[$position];
- if ( !empty( $phone3 ) )
- {
- print 'TEL;TYPE="fax,work":'.$phone3.$fin_ligne; // phone2
- }
- }
- if ( ( $telfixe1 ) !== "oui")
- {
- $position3 = findPos("E-mail Address", $keys_csv);
- $position = $values_csv[$position3];
- if ( !empty( $position ) )
- {
- print "EMAIL:".$position.$fin_ligne;
- }
- }# else
- {
- $position3 = findPos("E-mail Address", $keys_csv);
- $position = $values_csv[$position3];
- if ( !empty( $position ) )
- {
- print "EMAIL;TYPE=home:".$position.$fin_ligne;
- }
- $position3 = findPos("E-mail 2 Address", $keys_csv);
- $position = $values_csv[$position3];
- if ( !empty( $position ) )
- {
- print "EMAIL;TYPE=work:".$position.$fin_ligne;
- }
- $position3 = findPos("E-mail 3 Address", $keys_csv);
- $position = $values_csv[$position3];
- if ( !empty( $position ) )
- {
- print "EMAIL;TYPE=OTHER:".$position.$fin_ligne;
- }
- // ADR;HOME;PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America
- $street0 = $values_csv[findPos("Home Street", $keys_csv)];
- $street1 = $values_csv[findPos("Home Address 2", $keys_csv)];
- $city0 = $values_csv[findPos("Home City", $keys_csv)];
- $region0 = $values_csv[findPos("Home State", $keys_csv)];
- $postcode0 = $values_csv[findPos("Home Postal Code", $keys_csv)];
- $country0 = $values_csv[findPos("Home Country", $keys_csv)];
- if ( ( !empty( $street0 ) ) || ( !empty( $street1 ) ) || ( !empty( $city0 ) ) || ( !empty( $region0 ) ) || ( !empty( $postcode0 ) ) || ( !empty( $country0 ) ) )
- {
- print "ADR;TYPE=home:".$street0.";".$street1.";".$city0.";".$region0.";".$postcode0.";".$country0.$fin_ligne;
- }
- // ADR;WORK;PREF:;;100 Waters Edge;Baytown;LA;30314;United States of America
- $street0 = $values_csv[findPos("Business Address", $keys_csv)];
- $street1 = $values_csv[findPos("Business Address 2", $keys_csv)];
- $city0 = $values_csv[findPos("Business City", $keys_csv)];
- $region0 = $values_csv[findPos("Business State", $keys_csv)];
- $postcode0 = $values_csv[findPos("Business Postal Code", $keys_csv)];
- $country0 = $values_csv[findPos("Business Country", $keys_csv)];
- if ( ( !empty( $street0 ) ) || ( !empty( $street1 ) ) || ( !empty( $city0 ) ) || ( !empty( $region0 ) ) || ( !empty( $postcode0 ) ) || ( !empty( $country0 ) ) )
- {
- print "ADR;TYPE=work:".$street0.";".$street1.";".$city0.";".$region0.";".$postcode0.";".$country0.$fin_ligne;
- }
- // LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:100 Waters Edge=0D==0 ABaytown\, LA 30314=0D=0AUnited States of America
- // ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
- // LABEL;HOME;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:42 Plantation St.=0D=0A=
- // Baytown, LA 30314=0D=0AUnited States of America
- // Web page
- $position = findPos("Web Page", $keys_csv);
- if ( !empty( $values_csv[$position] ) )
- {
- print "URL;VALUE=URI:".$values_csv[$position].$fin_ligne; // email0 // EMAIL:
- }
- // Web page
- $position = findPos("Web Page 2", $keys_csv);
- if ( !empty( $values_csv[$position] ) )
- {
- print "URL;VALUE=URI:".$values_csv[$position].$fin_ligne; // email1 // EMAIL:
- }
- // NOTE
- $position = findPos("Notes", $keys_csv);
- if ( !empty( $values_csv[$position] ) )
- {
- print "NOTE:".$values_csv[$position].$fin_ligne;
- }
- }
- // Birthday
- $position = findPos("Birthday", $keys_csv);
- if ( !empty( $values_csv[$position] ) )
- {
- print "BDAY:".$values_csv[$position].$fin_ligne;
- }
- if ( ( $telfixe1 ) !== "oui")
- {
- // Categories
- $position = findPos("Categories", $keys_csv);
- if ( !empty( $values_csv[$position] ) )
- {
- print "CATEGORIES :".$values_csv[$position].$fin_ligne; // email0 // EMAIL:
- }
- }
- print "END:VCARD".$fin_ligne; // END:VCARD
- }
- }
- }
- }
- /* determine position of a value in an number-indexed array */
- function findPos($value,$array)
- {
- $result = null;
- $length = count($array);
- for($i=0;$i<$length;$i++)
- {
- if($array[$i] == $value)
- {
- $result = $i;
- break;
- }
- }
- return $result;
- }
- function erreurs($filename_csv, $delimiter1, $telfixe1)
- {
- echo '<form method="post" enctype="multipart/form-data">
- <input type="hidden" name="_nomFich" value="'.$filename_csv.'" >
- <input type="hidden" name="$_delimiter" value="'.$delimiter1.'" >
- <input type="hidden" name="$_telfixe" value="'.$telfixe1.'" >
- <input type="submit" name="retour" value="retour" style="width: 100%;">
- </form>';
- finentete();
- }
- function finentete()
- {
- echo '<p>the following fields in the *.csv will be converted:</p>
- <div style="overflow:auto;white-space:nowrap;width:100%;" class="codecolorer-container bash default">
- <pre>
- First Name
- Last Name
- Display Name
- Nicknam
- E-mail Address
- E-mail 2 Address
- E-mail 3 Address
- Home Phone
- Business Phone
- Home Fax
- Business Fax
- Pager
- Mobile Phone
- Home Street
- Home Address 2
- Home City
- Home State
- Home Postal Code
- Home Country
- Business Address
- Business Address 2
- Business City
- Business State
- Business Postal Code
- Business Country
- Country Code
- Related name
- Job Title
- Department
- Organization
- Notes
- Birthday
- Anniversary
- Gender
- Web Page
- Web Page 2
- Categories
- </pre>
- </div>
- </div>';
- }
- // </div>
- echo '
- <div class="boxShadows" id="headline">';
- // if ($_POST['_delimiter'] == ';')
- if ($delimiter == ';')
- {
- echo '
- <p>EXAMPLE INPUT with ";" : this goes in:</p>
- <div style="overflow:auto;white-space:nowrap;width:100%;" class="codecolorer-container bash default">
- <pre>
- First Name;Last Name;Display Name;Nickname;E-mail Address;E-mail 2 Address;E-mail 3 Address;Home Phone;Business Phone;Home Fax;Business Fax;Pager;Mobile Phone;Home Street;Home Address 2;Home City;Home State;Home Postal Code;Home Country;Business Address;Business Address 2;Business City;Business State;Business Postal Code;Business Country;Country Code;Related name;Job Title;Department;Organization;Notes;Birthday;Anniversary;Gender;Web Page;Web Page 2;Categories
- Aprenom1 Anom1;;Aprenom1 Anom1;;[email protected];[email protected];;+33 1 23 45 67 89;+33 2 87 65 43 21;+33 9 12 34 56 78;+33 9 87 65 43 21;;+33 6 12 34 56 78;rue1;rue2;meylan;rhone alpes;38240;france;rue1T;rue2T;Grenoble;isere;38000;france;;;;;;notes;1604-12-08 00:00:00;;;;;test
- Aprenom2;Anom2;Aprenom2 Anom2;;[email protected];[email protected];;+33 1 23 45 67 89;+33 9 12 34 76 78;;;;+33 6 56 78 12 34;rue D;rue D étendue;ville D;paca D;12345;france;rue T;rue T étendue;ville T;paca T;23456;france;;;;;;note lig 1 note lig 2 note lig 3;2020-01-05 00:00:00;;;www.xxx.com;;test
- Aprenom3;Anom3;Aprenom3 Anom3;;;;;;;;;;+33 6 12 34 56 78;;;;;;;;;;;;;;;;;;;;;;;;test
- Aprenom5;Anom5;Aprenom5 Anom5;;;;;;+33 9 87 65 43 21;;;;;;;;;;;;;;;;;;;;;;;;;;;;test
- Aprenom4;Anom4;Aprenom4 Anom4;;;;;+33 1 23 45 67 89;+33 9 12 34 56 78;;;;+33 6 87 65 43 21;;;;;;;;;;;;;;;;;;;;;;;;test
- Aprenom7;Anom7;Aprenom7 Anom7;;;;;+33 1 23 45 67 89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;test
- ;Aprenom Anom;Aprenom Anom;;[email protected];[email protected];[email protected];+33 9 12 34 56 78;+33 9 87 65 43 21;+33 8 12 34 56 78;+33 8 87 65 43 21;;+33 6 12 56 34 78;rueD;;VILLED;;01234;;rueT;;VilleT;;34567;;;;;;;notes en tout genre AAAAAA aaaaaa;2019-12-18 00:00:00;;;;;test
- ;;Aprenom6 Anom6;;;;;+33 1 23 45 67 89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;test
- </pre>
- </div>';
- }
- else
- // if ($_POST['_delimiter'] == ' ')
- if ($delimiter == ' ')
- {
- echo '
- <p>EXAMPLE INPUT with " " : this goes in:</p>
- <div style="overflow:auto;white-space:nowrap;width:100%;" class="codecolorer-container bash default">
- First Name Last Name Display Name Nickname E-mail Address E-mail 2 Address E-mail 3 Address Home Phone Business Phone Home Fax Business Fax Pager Mobile Phone Home Street Home Address 2 Home City Home State Home Postal Code Home Country Business Address Business Address 2 Business City Business State Business Postal Code Business Country Country Code Related name Job Title Department Organization Notes Birthday Anniversary Gender Web Page Web Page 2 Categories
- Aprenom1 Anom1 Aprenom1 Anom1 [email protected] [email protected] +33 1 23 45 67 89 +33 2 87 65 43 21 +33 9 12 34 56 78 +33 9 87 65 43 21 +33 6 12 34 56 78 rue1 rue2 meylan rhone alpes 38240 france rue1T rue2T Grenoble isere 38000 france notes 1604-12-08 00:00:00 test
- Aprenom2 Anom2 Aprenom2 Anom2 [email protected] [email protected] +33 1 23 45 67 89 +33 9 12 34 76 78 +33 6 56 78 12 34 rue D rue D étendue ville D paca D 12345 france rue T rue T étendue ville T paca T 23456 france note lig 1 note lig 2 note lig 3 2020-01-05 00:00:00 www.xxx.com test
- Aprenom3 Anom3 Aprenom3 Anom3 +33 6 12 34 56 78 test
- Aprenom5 Anom5 Aprenom5 Anom5 +33 9 87 65 43 21 test
- Aprenom4 Anom4 Aprenom4 Anom4 +33 1 23 45 67 89 +33 9 12 34 56 78 +33 6 87 65 43 21 test
- Aprenom7 Anom7 Aprenom7 Anom7 +33 1 23 45 67 89 test
- Aprenom Anom Aprenom Anom [email protected] [email protected] [email protected] +33 9 12 34 56 78 +33 9 87 65 43 21 +33 8 12 34 56 78 +33 8 87 65 43 21 +33 6 12 56 34 78 rueD VILLED 01234 rueT VilleT 34567 notes en tout genre AAAAAA aaaaaa 2019-12-18 00:00:00 test
- Aprenom6 Anom6 +33 1 23 45 67 89 test
- </pre>
- </div>';
- }
- else
- {
- echo '
- <p>EXAMPLE INPUT with "," : this goes in:</p>
- <div style="overflow:auto;white-space:nowrap;width:100%;" class="codecolorer-container bash default">
- <pre>
- First Name,Last Name,Display Name,Nickname,E-mail Address,E-mail 2 Address,E-mail 3 Address,Home Phone,Business Phone,Home Fax,Business Fax,Pager,Mobile Phone,Home Street,Home Address 2,Home City,Home State,Home Postal Code,Home Country,Business Address,Business Address 2,Business City,Business State,Business Postal Code,Business Country,Country Code,Related name,Job Title,Department,Organization,Notes,Birthday,Anniversary,Gender,Web Page,Web Page 2,Categories
- Aprenom1 Anom1,,Aprenom1 Anom1,,[email protected],[email protected],,+33 1 23 45 67 89,+33 2 87 65 43 21,+33 9 12 34 56 78,+33 9 87 65 43 21,,+33 6 12 34 56 78,rue1,rue2,meylan,rhone alpes,38240,france,rue1T,rue2T,Grenoble,isere,38000,france,,,,,,notes,1604-12-08 00:00:00,,,,,test
- Aprenom2,Anom2,Aprenom2 Anom2,,[email protected],[email protected],,+33 1 23 45 67 89,+33 9 12 34 76 78,,,,+33 6 56 78 12 34,rue D,rue D étendue,ville D,paca D,12345,france,rue T,rue T étendue,ville T,paca T,23456,france,,,,,,note lig 1 note lig 2 note lig 3,2020-01-05 00:00:00,,,www.xxx.com,,test
- Aprenom3,Anom3,Aprenom3 Anom3,,,,,,,,,,+33 6 12 34 56 78,,,,,,,,,,,,,,,,,,,,,,,,test
- Aprenom5,Anom5,Aprenom5 Anom5,,,,,,+33 9 87 65 43 21,,,,,,,,,,,,,,,,,,,,,,,,,,,,test
- Aprenom4,Anom4,Aprenom4 Anom4,,,,,+33 1 23 45 67 89,+33 9 12 34 56 78,,,,+33 6 87 65 43 21,,,,,,,,,,,,,,,,,,,,,,,,test
- Aprenom7,Anom7,Aprenom7 Anom7,,,,,+33 1 23 45 67 89,,,,,,,,,,,,,,,,,,,,,,,,,,,,,test
- ,Aprenom Anom,Aprenom Anom,,[email protected],[email protected],[email protected],+33 9 12 34 56 78,+33 9 87 65 43 21,+33 8 12 34 56 78,+33 8 87 65 43 21,,+33 6 12 56 34 78,rueD,,VILLED,,01234,,rueT,,VilleT,,34567,,,,,,,notes en tout genre AAAAAA aaaaaa,2019-12-18 00:00:00,,,,,test
- ,,Aprenom6 Anom6,,,,,+33 1 23 45 67 89,,,,,,,,,,,,,,,,,,,,,,,,,,,,,test
- </pre>
- </div>';
- }
- echo '
- </div>
- <div class="boxShadows" id="headline">
- <p>this comes out: (This comes from the nextcloud address book)</p>
- <div style="overflow:auto;white-space:nowrap;width:100%;" class="codecolorer-container bash default">
- <pre>
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom1 Anom1;;;
- FN:Aprenom1 Anom1
- EMAIL;TYPE=home:[email protected]
- EMAIL;TYPE=work:[email protected]
- TEL;TYPE=home:+33 1 23 45 67 89
- TEL;TYPE=work:+33 2 87 65 43 21
- TEL;TYPE="fax,home":+33 9 12 34 56 78
- TEL;TYPE="fax,work":+33 9 87 65 43 21
- TEL;TYPE=cell:+33 6 12 34 56 78
- ADR;TYPE=home:rue1;rue2;meylan;rhone alpes;38240;france
- ADR;TYPE=work:rue1T;rue2T;Grenoble;isere;38000;france
- NOTE:notes
- BDAY:1604-12-08 00:00:00
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom2;Anom2;;
- FN:Aprenom2 Anom2
- EMAIL;TYPE=home:[email protected]
- EMAIL;TYPE=work:[email protected]
- TEL;TYPE=home:+33 1 23 45 67 89
- TEL;TYPE=work:+33 9 12 34 76 78
- TEL;TYPE=cell:+33 6 56 78 12 34
- ADR;TYPE=home:rue D;rue D étendue;ville D;paca D;12345;france
- ADR;TYPE=work:rue T;rue T étendue;ville T;paca T;23456;france
- URL;VALUE=URI:www.xxx.com
- NOTE:note lig 1 note lig 2 note lig 3
- BDAY:2020-01-05 00:00:00
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom3;Anom3;;
- FN:Aprenom3 Anom3
- TEL;TYPE=cell:+33 6 12 34 56 78
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom5;Anom5;;
- FN:Aprenom5 Anom5
- TEL;TYPE=work:+33 9 87 65 43 21
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom4;Anom4;;
- FN:Aprenom4 Anom4
- TEL;TYPE=home:+33 1 23 45 67 89
- TEL;TYPE=work:+33 9 12 34 56 78
- TEL;TYPE=cell:+33 6 87 65 43 21
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:Aprenom7;Anom7;;
- FN:Aprenom7 Anom7
- TEL;TYPE=home:+33 1 23 45 67 89
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- N:;Aprenom Anom;;
- FN:Aprenom Anom
- EMAIL;TYPE=home:[email protected]
- EMAIL;TYPE=work:[email protected]
- EMAIL;TYPE=OTHER:[email protected]
- TEL;TYPE=home:+33 9 12 34 56 78
- TEL;TYPE=work:+33 9 87 65 43 21
- TEL;TYPE="fax,home":+33 8 12 34 56 78
- TEL;TYPE="fax,work":+33 8 87 65 43 21
- TEL;TYPE=cell:+33 6 12 56 34 78
- ADR;TYPE=home:rueD;;VILLED;;01234;
- ADR;TYPE=work:rueT;;VilleT;;34567;
- NOTE:notes en tout genre AAAAAA aaaaaa
- BDAY:2019-12-18 00:00:00
- END:VCARD
- BEGIN:VCARD
- VERSION:2.1
- FN:Aprenom6 Anom6
- TEL;TYPE=home:+33 1 23 45 67 89
- END:VCARD
- </pre>
- </div>
- </div>
- </body>
- </html>
- ';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement