[2] | 1 | <?php |
---|
[5509] | 2 | /*************************************************************************** |
---|
| 3 | * Expresso Livre * |
---|
| 4 | * http://www.expressolivre.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
[1679] | 12 | require_once '../../header.session.inc.php'; |
---|
[2] | 13 | // This script upload an CSV file to import contacts .... |
---|
[5131] | 14 | if(array_key_exists('import_file', $_FILES) && $ftmp = $_FILES['import_file']['tmp_name']){ |
---|
[4510] | 15 | // Foi necessário modificar o caminho onde se recuperava o diretório temporário. |
---|
| 16 | // Esse caminho foi hardcodificado na string abaixo ( /tmp ) temporariamente, mas deve ser recuperada atraves |
---|
| 17 | // da configuracao do Expresso. Ver ticket #385. |
---|
| 18 | $fname = "/tmp/contacts_".md5(microtime()).".swp"; |
---|
[2] | 19 | if(move_uploaded_file($ftmp, $fname)) |
---|
| 20 | $_SESSION['contactcenter']['importCSV'] = $fname; |
---|
| 21 | } |
---|
[4510] | 22 | // ... or download an CSVfile to export contacts. |
---|
[2] | 23 | else if($_GET['file_name']) { |
---|
| 24 | $file_name = $_GET['file_name']; |
---|
| 25 | $file_path = $_GET['file_path']; |
---|
[4880] | 26 | header("Pragma: public"); |
---|
[2] | 27 | header ("Content-Type: application/octet-stream"); |
---|
| 28 | header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
---|
| 29 | header('Content-Length: ' . filesize($file_path)); |
---|
| 30 | header("Content-disposition: attachment; filename=".$file_name); |
---|
| 31 | readfile($file_path); |
---|
[4510] | 32 | unlink($file_path); |
---|
[2] | 33 | } |
---|
| 34 | ?> |
---|