| 1 |
lars |
1 |
<?
|
|
|
2 |
$self=basename($PHP_SELF);
|
|
|
3 |
$DB="forum_beitraege";
|
|
|
4 |
define ("modul_name", "forum");
|
|
|
5 |
define ("tool_name", "beitrag");
|
|
|
6 |
require_once "../Online-Shop/connect2.php";
|
|
|
7 |
if ($ReplyTo)
|
|
|
8 |
{
|
|
|
9 |
$query="
|
|
|
10 |
insert into
|
|
|
11 |
forum_beitraege
|
|
|
12 |
(
|
|
|
13 |
ReplyTo,
|
|
|
14 |
user,
|
|
|
15 |
mail,
|
|
|
16 |
headline,
|
|
|
17 |
text,
|
|
|
18 |
erstellt_am,
|
|
|
19 |
erstellt_von,
|
|
|
20 |
letzte_Aenderung_am,
|
|
|
21 |
letzte_Aenderung_von
|
|
|
22 |
)
|
|
|
23 |
values
|
|
|
24 |
(
|
|
|
25 |
$ReplyTo,
|
|
|
26 |
'$user',
|
|
|
27 |
'$mail',
|
|
|
28 |
'$headline',
|
|
|
29 |
'$text',
|
|
|
30 |
NOW(),
|
|
|
31 |
'Web-Interface',
|
|
|
32 |
NOW(),
|
|
|
33 |
'Web-Interface'
|
|
|
34 |
)";
|
|
|
35 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
if ($delete)
|
|
|
39 |
{
|
|
|
40 |
loesche_antworten_auf($delete);
|
|
|
41 |
}
|
|
|
42 |
?>
|
|
|
43 |
<html>
|
|
|
44 |
<head>
|
|
|
45 |
<title>Forum: Beiträge</title>
|
|
|
46 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
47 |
<meta name="author" content="Webagentur Niewerth - www.weban.de">
|
|
|
48 |
<meta name="revisit-after" content="30 days">
|
|
|
49 |
<meta http-equiv="expires" content="0">
|
|
|
50 |
<meta name="language" content="deutsch, de">
|
|
|
51 |
<meta name="distribution" content="global">
|
|
|
52 |
<meta name="robots" content="all">
|
|
|
53 |
<script language="JavaScript">
|
|
|
54 |
<!--
|
|
|
55 |
function MM_findObj(n, d) { //v4.01
|
|
|
56 |
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
|
|
57 |
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
|
|
|
58 |
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
|
|
59 |
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
|
|
60 |
if(!x && d.getElementById) x=d.getElementById(n); return x;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
function MM_validateForm() { //v4.0
|
|
|
64 |
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
|
|
|
65 |
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
|
|
|
66 |
if (val) { nm=val.name; if ((val=val.value)!="") {
|
|
|
67 |
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
|
|
|
68 |
if (p<1 || p==(val.length-1)) errors+='- '+nm+' muss eine E-Mail Adresse sein.\n';
|
|
|
69 |
} else if (test!='R') {
|
|
|
70 |
if (isNaN(val)) errors+='- '+nm+' muss eine Zahl sein.\n';
|
|
|
71 |
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
|
|
|
72 |
min=test.substring(8,p); max=test.substring(p+1);
|
|
|
73 |
if (val<min || max<val) errors+='- '+nm+' muss eine Zahl zwischen '+min+' und '+max+' sein.\n';
|
|
|
74 |
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' wird benötigt.\n'; }
|
|
|
75 |
} if (errors) alert('Folgende Fehler sind aufgetreten:\n'+errors);
|
|
|
76 |
document.MM_returnValue = (errors == '');
|
|
|
77 |
}
|
|
|
78 |
//-->
|
|
|
79 |
</script>
|
|
|
80 |
<link rel="stylesheet" href="forum.css" type="text/css">
|
|
|
81 |
</head>
|
|
|
82 |
|
|
|
83 |
<body leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" bgcolor="#<? echo $webs[bgcolor_seite] ?>" text="#<? echo $webs[font_color_seite] ?>" alink="#<? echo $webs[font_color_seite] ?>" vlink="#<? echo $webs[font_color_seite] ?>">
|
|
|
84 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
85 |
<tr>
|
|
|
86 |
<td width="95%">
|
|
|
87 |
<?
|
|
|
88 |
if (!$selectForum) {$selectForum = 1;}
|
|
|
89 |
|
|
|
90 |
if (!$ID)
|
|
|
91 |
{
|
|
|
92 |
$query="SELECT * FROM forum_beitraege where ReplyTo = -1 and forum_ID = ".$selectForum." order by erstellt_am desc";
|
|
|
93 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query);
|
|
|
94 |
if (mysql_num_rows($result) == 0)
|
|
|
95 |
{
|
|
|
96 |
?>
|
|
|
97 |
<a href="<? echo $self ?>?ID=-1">Leider sind noch keine Themen vorhanden!</a>
|
|
|
98 |
<?
|
|
|
99 |
}
|
|
|
100 |
while ($zeile=mysql_fetch_array($result))
|
|
|
101 |
{
|
|
|
102 |
$Datum = datetime2human($zeile[erstellt_am]);
|
|
|
103 |
?>
|
|
|
104 |
<table width="80%" border="1" cellspacing="0" cellpadding="3">
|
|
|
105 |
<tr>
|
|
|
106 |
<td colspan="2" bgcolor="#<? echo $webs[bgcolor_links] ?>"> <a href="<? echo $self ?>?ID=<? echo $zeile[ID] ?>">
|
|
|
107 |
<? echo $zeile[headline] ?>
|
|
|
108 |
</a> von
|
|
|
109 |
<? if ($zeile[mail]) { ?>
|
|
|
110 |
<a href="mailto:<? echo $zeile[user] ?>">
|
|
|
111 |
<? echo $zeile[user] ?>
|
|
|
112 |
</a>
|
|
|
113 |
<? } else { ?>
|
|
|
114 |
<? echo $zeile[user] ?>
|
|
|
115 |
<? } ?>
|
|
|
116 |
am
|
|
|
117 |
<? echo $Datum[Datum] ?>
|
|
|
118 |
um
|
|
|
119 |
<? echo $Datum[Zeit] ?>
|
|
|
120 |
Uhr </td>
|
|
|
121 |
<td width="20" bgcolor="#<? echo $webs[bgcolor_links] ?>" align="center"><a href="<? echo $self ?>?selectForum=<?=$_GET[selectForum];?>&delete=<?=$zeile[ID];?>"><img src="/images/Icons/delete.gif" width="12" height="12" border="0"></a></td>
|
|
|
122 |
</tr>
|
|
|
123 |
<?
|
|
|
124 |
$query_reply="SELECT * FROM forum_beitraege where ReplyTo = $zeile[ID]";
|
|
|
125 |
$result_reply = mysql_query ($query_reply) or die (mysql_errno().": ".mysql_error());
|
|
|
126 |
if (mysql_num_rows($result_reply) != 0)
|
|
|
127 |
{
|
|
|
128 |
?>
|
|
|
129 |
<tr>
|
|
|
130 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
|
|
|
131 |
<? zeige_antworten_auf($zeile[ID]) ?>
|
|
|
132 |
</td>
|
|
|
133 |
</tr>
|
|
|
134 |
<?
|
|
|
135 |
}
|
|
|
136 |
?>
|
|
|
137 |
</table>
|
|
|
138 |
<br>
|
|
|
139 |
<?
|
|
|
140 |
} // end of while
|
|
|
141 |
}
|
|
|
142 |
else
|
|
|
143 |
{
|
|
|
144 |
|
|
|
145 |
$query="SELECT * FROM forum_beitraege where ID = $ID";
|
|
|
146 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
|
|
|
147 |
$zeile=mysql_fetch_array($result);
|
|
|
148 |
$input=$zeile;
|
|
|
149 |
$Datum = datetime2human($zeile[erstellt_am]);
|
|
|
150 |
?>
|
|
|
151 |
<form name="forum" method="post" action="<? echo $self ?>">
|
|
|
152 |
<?
|
|
|
153 |
if ($ID > -1)
|
|
|
154 |
{
|
|
|
155 |
?>
|
|
|
156 |
<table width="80%" border="1" cellspacing="0" cellpadding="3">
|
|
|
157 |
<tr>
|
|
|
158 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_links] ?>" class="fliess">
|
|
|
159 |
<p>
|
|
|
160 |
<? echo $zeile[headline] ?>
|
|
|
161 |
von
|
|
|
162 |
<? if ($zeile[mail]) { ?>
|
|
|
163 |
<a href="mailto:<? echo $zeile[name] ?>">
|
|
|
164 |
<? }?>
|
|
|
165 |
<? echo $zeile[user] ?>
|
|
|
166 |
<? if ($zeile[mail]) { ?>
|
|
|
167 |
</a>
|
|
|
168 |
<? }?>
|
|
|
169 |
am
|
|
|
170 |
<? echo $Datum[Datum] ?>
|
|
|
171 |
um
|
|
|
172 |
<? echo $Datum[Zeit] ?>
|
|
|
173 |
Uhr</p>
|
|
|
174 |
</td>
|
|
|
175 |
</tr>
|
|
|
176 |
<tr>
|
|
|
177 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
|
|
|
178 |
<? echo nl2br($zeile[text]) ?>
|
|
|
179 |
</td>
|
|
|
180 |
</tr>
|
|
|
181 |
<?
|
|
|
182 |
$query_reply="SELECT * FROM forum_beitraege where ReplyTo = $zeile[ID]";
|
|
|
183 |
$result_reply = mysql_query ($query_reply) or die (mysql_errno().": ".mysql_error()."<hr>$query_reply<hr>");
|
|
|
184 |
if (mysql_num_rows($result_reply) != 0)
|
|
|
185 |
{
|
|
|
186 |
?>
|
|
|
187 |
<tr>
|
|
|
188 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>">
|
|
|
189 |
<? zeige_antworten_auf($zeile[ID]) ?>
|
|
|
190 |
</td>
|
|
|
191 |
</tr>
|
|
|
192 |
<?
|
|
|
193 |
}
|
|
|
194 |
?>
|
|
|
195 |
</table>
|
|
|
196 |
<br>
|
|
|
197 |
<?
|
|
|
198 |
}
|
|
|
199 |
?>
|
|
|
200 |
<table width="80%" border="1" cellspacing="0" cellpadding="3">
|
|
|
201 |
<tr>
|
|
|
202 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_links] ?>" class="links">
|
|
|
203 |
<? if ($ID > -1) {?>
|
|
|
204 |
Antwort zum Beitrag
|
|
|
205 |
<? } else { ?>
|
|
|
206 |
Neues Thema
|
|
|
207 |
<? } ?>
|
|
|
208 |
</td>
|
|
|
209 |
</tr>
|
|
|
210 |
<tr>
|
|
|
211 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>" class="rechts">
|
|
|
212 |
Name:<br>
|
|
|
213 |
<input type="text" name="name" size="25" maxlength="255">
|
|
|
214 |
<p>E-Mail:<br>
|
|
|
215 |
<input type="text" name="mail" size="25" maxlength="255">
|
|
|
216 |
</p>
|
|
|
217 |
<p>Thema:<br>
|
|
|
218 |
<input type="text" name="headline" size="60" maxlength="255" value="<? if ($ID > -1) { ?>RE: <? } ?><? echo $input[headline] ?>">
|
|
|
219 |
</p>
|
|
|
220 |
</td>
|
|
|
221 |
</tr>
|
|
|
222 |
<tr>
|
|
|
223 |
<td colspan="3" bgcolor="#<? echo $webs[bgcolor_rechts] ?>" class="rechts">
|
|
|
224 |
Ihre Antwort:
|
|
|
225 |
<p>
|
|
|
226 |
<textarea name="text" cols="50" rows="10"></textarea>
|
|
|
227 |
</p>
|
|
|
228 |
<p> <a href="javascript:document.forum.submit();" onClick="MM_validateForm('user','','R','mail','','NisEmail','headline','','R','text','','R');return document.MM_returnValue">Abschicken</a> <a href="javascript:document.forum.reset()">Reset</a>
|
|
|
229 |
<input type="hidden" name="ReplyTo" value="<? echo $ID ?>">
|
|
|
230 |
</p>
|
|
|
231 |
</td>
|
|
|
232 |
</tr>
|
|
|
233 |
</table>
|
|
|
234 |
</form>
|
|
|
235 |
<?
|
|
|
236 |
}
|
|
|
237 |
?>
|
|
|
238 |
</td>
|
|
|
239 |
<td valign="top" width="5%">
|
|
|
240 |
<?
|
|
|
241 |
if ($web_rechte[forum][forum][foren])
|
|
|
242 |
{
|
|
|
243 |
?>
|
|
|
244 |
Foren:
|
|
|
245 |
<ul><?
|
|
|
246 |
foreach(explode(";",$web_rechte[forum][forum][foren]) as $nr => $forum)
|
|
|
247 |
{
|
|
|
248 |
?><li><a href="<?=$self?>?selectForum=<?=$nr+1;?>"><?=$forum;?></a></li><?
|
|
|
249 |
}
|
|
|
250 |
}
|
|
|
251 |
?></ul>
|
|
|
252 |
</td>
|
|
|
253 |
</tr>
|
|
|
254 |
</table>
|
|
|
255 |
</body>
|
|
|
256 |
</html>
|
|
|
257 |
<?
|
|
|
258 |
function zeige_antworten_auf($beitrag)
|
|
|
259 |
{
|
|
|
260 |
global $self;
|
|
|
261 |
$query="SELECT * FROM forum_beitraege where ReplyTo = $beitrag order by erstellt_am";
|
|
|
262 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
|
|
|
263 |
while ($zeile=mysql_fetch_array($result))
|
|
|
264 |
{
|
|
|
265 |
$Datum = datetime2human($zeile[erstellt_am]);
|
|
|
266 |
?>
|
|
|
267 |
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
|
|
268 |
<tr>
|
|
|
269 |
<td rowspan=2 width="10"> </td>
|
|
|
270 |
<td> <a href="<? echo $self ?>?ID=<? echo $zeile[ID] ?>">
|
|
|
271 |
<?=$zeile[headline];?>
|
|
|
272 |
</a> von
|
|
|
273 |
<?=$zeile[user];?>
|
|
|
274 |
am
|
|
|
275 |
<? echo $Datum[Datum] ?>
|
|
|
276 |
um
|
|
|
277 |
<? echo $Datum[Zeit] ?>
|
|
|
278 |
</td>
|
|
|
279 |
<td align="center" width="20"><a href="<? echo $self ?>?selectForum=<?=$_GET[selectForum];?>&delete=<?=$zeile[ID];?>"><img src="/images/Icons/delete.gif" width="12" height="12" border="0"></a></td>
|
|
|
280 |
</tr>
|
|
|
281 |
<tr>
|
|
|
282 |
<td colspan=2><? zeige_antworten_auf($zeile[ID]) ?></td>
|
|
|
283 |
</tr>
|
|
|
284 |
</table>
|
|
|
285 |
<?
|
|
|
286 |
}
|
|
|
287 |
}
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
function loesche_antworten_auf($beitrag)
|
|
|
291 |
{
|
|
|
292 |
$query="SELECT * FROM forum_beitraege where ReplyTo = $beitrag";
|
|
|
293 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
|
|
|
294 |
while ($zeile=mysql_fetch_array($result))
|
|
|
295 |
{
|
|
|
296 |
loesche_antworten_auf($zeile[ID]);
|
|
|
297 |
}
|
|
|
298 |
$query="DELETE FROM forum_beitraege where ID = $beitrag";
|
|
|
299 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error());
|
|
|
300 |
}
|
|
|
301 |
?>
|