1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
| <?php
include('data/config.php');
ob_start();
include('layout/header.php');
ob_end_clean();
include_once('data/bbcode.php');
include_once('data/badwords.php');
function embed_topic($topic_id,$forum_url=".") {
?>
<script type="text/javascript">
function insert(was) {
document.topic.reply.value += was + " ";
document.topic.reply.focus();
}
</script>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0"><a name="top" id="top"></a>
<tr>
<td><?php
$sql = "SELECT
topics.topic_id,
topics.topic_subject,
topics.topic_cat,
categories.cat_id,
categories.cat_name
FROM
topics
LEFT JOIN
categories
ON
topics.topic_cat = categories.cat_id
WHERE
topic_id = " . mysql_real_escape_string($topic_id);
$result = mysql_query($sql);
$id = mysql_real_escape_string($topic_id);
if(!$result)
{
echo '<br /><p class="false">This topic could not be found - Try again.</p><br />';
}else{
if(mysql_num_rows($result) == 0)
{
echo '<br /><p class="false">This topic does not exist!</p><br />';
}else{
if($row = mysql_fetch_assoc($result))
{
$viewsql = "UPDATE
topics
SET
topic_views = topic_views + 1
WHERE
topic_id = " . $id;
$viewcount = mysql_query($viewsql);
echo '<table width="100%" cellpadding="5" class="maintable">';
$id = mysql_real_escape_string($topic_id);
$posts_sql = "SELECT
posts.post_topic,
posts.post_content,
posts.post_date,
posts.post_by,
users.user_id,
users.user_name,
users.user_date,
users.user_level,
user_signature
FROM
posts
LEFT JOIN
users
ON
posts.post_by = users.user_id
WHERE
posts.post_topic = '" . $id . "';";
$posts_result = mysql_query($posts_sql);
if(!$posts_result) {
echo '<tr><td><p class="false"> This topic could not be displayed.</p>
<p>MySQL says: '.mysql_errno().': '.mysql_error().'</td></tr>';
echo '</table>';
}else{
while($posts_row = mysql_fetch_assoc($posts_result))
{
echo '<tr>
<td width="25%"><p><strong><u><a href="'.$forum_url.'/profile.php?user_id=' . $posts_row['user_id'] . '">' . htmlentities($posts_row['user_name'], ENT_QUOTES) . '</a></u></strong><br/><br /><small>'; if($posts_row['user_level']==0) {
echo '<span class="user">User</span>';
}elseif ($posts_row['user_level']==2) {
echo '<span class="mod">Moderator</span>';
}elseif ($posts_row['user_level']==1) {
echo '<span class="admin">Administrator</span>'; }
echo '</small><br /><span class="blue">Dabei Seit:</span> ' . date('d.m.Y', strtotime($posts_row['user_date'])) . '</p></td>
<td width="75%">' . preg_replace( "/(src|href)=\"(layout.*)\"/i","\$1=\"$forum_url/\$2\" ",parseBBCode2HTML(delBad(nl2br(stripslashes(strip_tags($posts_row['post_content']))))) ) . '</td>
</tr>
<tr>
<td width="25%"> </td>
<td width="75%">'; if($posts_row['user_signature']) {
echo '<div id="line"> </div><br /><small>' . $posts_row['user_signature'] . '</small>';
}elseif ($posts_row['user_signature']== "") {
echo ''; }
echo '</td>
</tr>
<tr>
<td bgcolor="#efefef"><small>' . date('d.m.Y - H:i', strtotime($posts_row['post_date'])) . '</small></td>
<td bgcolor="#efefef" align="right">
<a href="#reply"><img src="'.$forum_url.'/layout/icons/answer.png" width="16" height="16" border="0" /></a> <a href="'.$forum_url.'/profile.php?user_id=' . $posts_row['user_id'] . '"><img src="'.$forum_url.'/layout/icons/profile.png" width="16" height="16" border="0" /></a> <a href="#top"><img src="'.$forum_url.'/layout/icons/top.png" width="16" height="16" border="0" /></a></td>
</tr>';
}
echo '</table>';
}
echo '<tr height="20 px"><td></td></tr>'; //placeholder
if(!$_SESSION['signed_in']) {
echo '<tr><td colspan="2"><a name="reply" id="reply"></a> You have to <a href="'.$forum_url.'/signin.php">sign in</a> to reply. - Not <a href="'.$forum_url.'/signup.php">registered</a>?<br /><br /></td></tr>';
}else{
include_once('data/flood.php');
echo "<tr><td colspan=\"2\" class=\"maintable\"><a name=\"reply\" id=\"reply\"></a><h1> Reply</h1><br />
<form name=\"topic\" method=\"post\" action=\"$forum_url/reply.php?id=" . $row['topic_id'] . "\">
<a href=\"javascript:insert('<b></b>')\"><img src=\"$forum_url/layout/images/bold.png\" width=\"32\" height=\"34\" border=\"0\" title=\"Bold\"></a><a href=\"javascript:insert('<i></i>')\"><img src=\"$forum_url/layout/images/kursiv.png\" width=\"31\" height=\"34\" border=\"0\" title=\"Italic\"></a><a href=\"javascript:insert('<u></u>')\"><img src=\"$forum_url/layout/images/underline.png\" width=\"31\" height=\"34\" border=\"0\" title=\"Underline\"></a><a href=\"javascript:insert('[url][/url]')\"><img src=\"$forum_url/layout/images/link.png\" width=\"31\" height=\"34\" border=\"0\" title=\"Hyperlink (mit http://)\"></a><br />
<textarea name=\"reply\" class=\"fields\"></textarea><br />
<p> <a href=\"javascript:insert(':P','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/000.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert(':)','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/001.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert(';)','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/002.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert(':(','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/003.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert('*grr*','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/004.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert('o_o','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/005.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert('*_*','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/006.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert('._.','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/007.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert('-_-','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/008.gif\" width=\"15\" height=\"14\" /></a>
<a href=\"javascript:insert(':D','')\"><img border=\"0\" src=\"$forum_url/layout/smileys/009.gif\" width=\"15\" height=\"14\" /></a></p>
<p><small>Spam protection *</small><br />
<strong>The sum of " . $random1 . " + " . $code . " =</strong> <input size=\"5\" name=\"zip\" id=\"Spamschutz\" type=\"text\" class=\"fields\" /><input type=\"hidden\" name=\"zip2\" value=" . $rand_result . " /></p>
<p> <input type=\"submit\" class=\"button\" value=\"Antworten\" alt=\"Reply\"/></p>
</form></td></tr><tr height=\"30 px\"><td></td></tr>";
}
}
}
}
echo '</table>';
?></td>
</tr>
</table>
<?php
} //end of embed topic function
?> |