2 define('AT_INCLUDE_PATH', '../../../include/');
5 // Prints out an single formatted thread message
6 function print_entry2($row) {
7 global $page,$system_courses, $forum_info;
11 $reply_link = '<a href="forum/view.php?fid='.$row['forum_id'].SEP.'pid=';
12 if ($row['parent_id'] == 0) {
13 $reply_link .= $row['post_id'];
15 $reply_link .= $row['parent_id'];
17 $reply_link .= SEP.'reply='.$row['post_id'].SEP.'page='.$page.'#post" >'._AT('reply').'</a>';
21 <li class="<?php if ($counter %2) { echo 'odd'; } else { echo 'even'; } ?>">
22 <a name="<?php echo $row['post_id']; ?>"></a>
23 <div class="forum-post-author">
24 <label class="title"><?php echo htmlspecialchars(get_display_name($row['member_id'])); ?></label><br />
27 <div class="forum-post-content">
30 <p><?php echo AT_date(_AT('forum_date_format'), $row['date'], AT_DATE_MYSQL_DATETIME); ?></p>
32 <div class="postheader"><h3><?php echo AT_Print($row['subject'], 'forums_threads.subject'); ?></h3></div>
35 <p><?php echo AT_print($row['body'], 'forums_threads.body'); ?></p>
42 copy(getcwd()."/styles.css", AT_CONTENT_DIR."/styles.css");
44 $head = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
45 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
46 <html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>";
48 $head .= "<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><link rel=StyleSheet href='styles.css' type='text/css' media='screen'><title>Exported Forum</title></head><body>";
50 $tmpfile = AT_CONTENT_DIR."/exported_forum.html";
51 $main = fopen($tmpfile, "w");
55 fwrite($main, "<h1>".$forum_title."</h1><br />");
56 fwrite($main, "<div class='threadlist'>");
58 $filearr = array(); // will hold all the files that were created
60 $sql = "SELECT *, DATE_FORMAT(date, '%Y-%m-%d %H-%i:%s') AS date, UNIX_TIMESTAMP(date) AS udate FROM ".TABLE_PREFIX."forums_threads WHERE parent_id=0 AND forum_id=".$forum_id." ORDER BY date ASC LIMIT 0, 70";
61 $result = mysql_query($sql) or die(mysql_error());
63 // Print out each post for each thread
64 while ($row = mysql_fetch_array($result)) {
67 $handle = fopen(AT_CONTENT_DIR."/t-".$row['post_id'].".html", "w");
68 array_push($filearr, "t-".$row['post_id'].".html");
70 fwrite($main, "<a href='t-".$row['post_id'].".html'>".$row['subject']."</a><br />");
71 fwrite($handle, $head);
72 fwrite($handle, "<br /><div><a href='exported_forum.html' class='midtext'>Back to: Thread list</a></div><br />");
73 fwrite($handle, "<div><p><br /><h1>".$row['subject']."</h1></div><br />");
74 fwrite($handle, "<div><ul class='forum-thread'>");
76 $sql = "SELECT *, DATE_FORMAT(date, '%Y-%m-%d %H-%i:%s') AS date, UNIX_TIMESTAMP(date) AS udate FROM ".TABLE_PREFIX."forums_threads WHERE parent_id=".$row['post_id']." AND forum_id=".$forum_id." ORDER BY date ASC LIMIT 0, 70";
78 $result_post = mysql_query($sql, $db);
83 while ($post_row = mysql_fetch_assoc($result_post)) {
84 print_entry2($post_row);
86 fwrite($handle, ob_get_contents());
88 fwrite($handle, "</ul></div>");
89 fwrite($handle, "</body></html>");
92 fwrite($main, "<div></body></html>");