]> git.mxchange.org Git - friendica-addons.git/blob - jappixmini/jappix/php/download-chat.php
Merge branch '3.6-release'
[friendica-addons.git] / jappixmini / jappix / php / download-chat.php
1 <?php
2
3 /*
4
5 Jappix - An open social platform
6 This is the PHP script used to download a chat log
7
8 -------------------------------------------------
9
10 License: AGPL
11 Author: Vanaryon
12 Last revision: 27/05/11
13
14 */
15
16 // PHP base
17 define('JAPPIX_BASE', '..');
18
19 // Get the needed files
20 require_once('./functions.php');
21 require_once('./read-main.php');
22 require_once('./read-hosts.php');
23
24 // Optimize the page rendering
25 hideErrors();
26 compressThis();
27
28 // Not allowed for a special node
29 if(isStatic() || isUpload())
30         exit;
31
32 // Send the HTML file to be downloaded
33 if(isset($_GET['id']) && !empty($_GET['id']) && isSafe($_GET['id'])) {
34         // We define the variables
35         $filename = $_GET['id'];
36         $content_dir = '../store/logs/';
37         $filepath = $content_dir.$filename.'.html';
38         
39         // We set special headers
40         header("Content-disposition: attachment; filename=\"$filename.html\"");
41         header("Content-Type: application/force-download");
42         header("Content-Transfer-Encoding: text/html\n");
43         header("Content-Length: ".filesize($filepath));
44         header("Pragma: no-cache");
45         header("Cache-Control: must-revalidate, post-check=0, pre-check=0, public");
46         header("Expires: 0");
47         readfile($filepath);
48         
49         // We delete the stored log file
50         unlink($filepath);
51 }
52
53 ?>