5 Jappix - An open social platform
6 This is the PHP script used to generate a chat log
8 -------------------------------------------------
12 Last revision: 26/08/11
17 define('JAPPIX_BASE', '..');
19 // Get the needed files
20 require_once('./functions.php');
21 require_once('./read-main.php');
22 require_once('./read-hosts.php');
24 // Optimize the page rendering
28 // Not allowed for a special node
29 if(isStatic() || isUpload())
32 // Create the HTML file to be downloaded
33 if(isset($_POST['content']) && isset($_POST['xid']) && !empty($_POST['xid']) && isset($_POST['nick']) && !empty($_POST['nick']) && isset($_POST['avatar']) && !empty($_POST['avatar']) && isset($_POST['date']) && !empty($_POST['date']) && isset($_POST['type']) && !empty($_POST['type'])) {
35 $original = $_POST['content'];
37 $nick = $_POST['nick'];
38 $avatar = $_POST['avatar'];
39 $date = $_POST['date'];
40 $type = $_POST['type'];
42 // Generate the XID link
43 $xid_link = 'xmpp:'.$xid;
45 if($type == 'groupchat')
48 // Generates the avatar code
50 $avatar = '<div class="avatar-container">'.$avatar.'</div>';
54 // Generates an human-readable date
55 $date = explode('T', $date);
56 $date = explode('-', $date[0]);
57 $date = $date[2].'/'.$date[1].'/'.$date[0];
59 // Generate some values
60 $content_dir = '../store/logs/';
61 $filename = 'chat_log-'.md5($xid.time());
62 $filepath = $content_dir.$filename.'.html';
64 // Generate Jappix logo Base64 code
65 $logo = base64_encode(file_get_contents(JAPPIX_BASE.'/img/sprites/logs.png'));
67 // Create the HTML code
73 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
74 <title>'.$nick.' ('.$xid.')</title>
75 <style type="text/css">
82 background-color: #424242;
83 font-family : Verdana, Arial, Helvetica, sans-serif;
85 text-shadow: 0 0 5px white;
99 #head .avatar-container {
115 text-shadow: 1px 1px 1px black;
125 margin: 8px 0 16px 0;
130 text-shadow: 0 0 1px black;
140 background-color: #e8f1f3;
145 -moz-border-radius: 4px;
146 -webkit-border-radius: 4px;
147 box-shadow: 0 0 20px #202020;
148 -moz-box-shadow: 0 0 20px #202020;
149 -webkit-box-shadow: 0 0 20px #202020;
156 #content .one-group {
157 border-bottom: 1px dotted #d0d0d0;
162 #content .one-group b.name {
167 #content .one-group b.name.me {
171 #content .one-group b.name.him {
175 #content .one-group span.date {
180 #content .user-message {
184 #content .system-message {
187 padding-left: 0 !important;
190 #content .system-message a {
195 display: none !important;
205 <h3><a href="'.$xid_link.'">'.$xid.'</a></h3>
208 <a class="logo" href="https://project.jappix.com/" target="_blank">
209 <img src="data:image/png;base64,'.$logo.'" alt="" />
220 $new_text = stripslashes($new_text_inter);
222 // Write the code into a file
223 file_put_contents($filepath, $new_text);
225 // Security: remove the file and stop the script if too bit (+6MiB)
226 if(filesize($filepath) > 6000000) {
231 // Return to the user the generated file ID