<?php
defined (
'main'
)
or
die
(
'no direct access'
);
$anzeige
= 0;
$antispam
= 1;
if
((
$anzeige
== 1 && loggedin()) ||
$anzeige
== 0)
{
$erg
= db_query(
"SHOW COLUMNS FROM `prefix_shoutbox` WHERE FIELD = 'time'"
);
if
(!db_num_rows(
$erg
))
{
db_query(
"ALTER TABLE `prefix_shoutbox` ADD `time` BIGINT(20) NOT NULL DEFAULT '0'"
);
}
function
smiliesshb()
{
global
$lang
;
$zeilen
= 5;
$i
= 0;
$b
=
'<script language="JavaScript" type="text/javascript">function moreSmilies() {'
;
$b
.=
'var x = window.open("about:blank", "moreSmilies", "width=250,height=200,left=100,top=100,status=no,scrollbars=yes,resizable=yes");'
;
$a
=
''
;
$erg
= db_query(
'SELECT `emo`, `ent`, `url` FROM `prefix_smilies`'
);
while
(
$row
= db_fetch_object(
$erg
))
{
$b
.=
'x.document.write ("<a href=\"javascript:opener.put_smilies(\'vshoutbox_textarea\',\' '
.
addslashes
(
addslashes
(
$row
->ent)) .
' \')\">");'
;
$b
.=
'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiles/'
.
$row
->url .
'\" title=\"'
.
$row
->emo .
'\"></a>");'
;
if
(
$i
<0)
{
if
(
$i
%
$zeilen
== 0 AND
$i
<> 0)
{
$a
.=
'<br /><br />'
;
}
$a
.=
'<a href="javascript:put_smilies(\'vshoutbox_textarea\',\' '
.
addslashes
(
$row
->ent).
' \')">'
;
$a
.=
'<img style="margin: 2px;" src="include/images/smiles/'
.
$row
->url .
'" border="0" title="'
.
$row
->emo .
'"></a>'
;
}
$i
++;
}
$b
.=
' x.document.write("<br /><br /><center><a href=\"javascript:window.close();\">'
.
$lang
[
'close'
] .
'</a></center>"); x.document.close(); }</script>'
;
if
(
$i
>0)
{
$a
.=
'<a class="box" href="javascript:moreSmilies();">Smilies</a>'
;
}
$a
=
$b
.
$a
;
return
(
$a
);
}
$tpl
=
new
tpl (
'v_shoutbox.htm'
);
if
(loggedin())
{
$vshoutbox_VALUE_name
=
$_SESSION
[
'authname'
];
$disabled
=
'disabled'
;
}
else
{
$vshoutbox_VALUE_name
=
'Nickname'
;
$disabled
=
''
;
}
if
((!
empty
(
$_POST
[
'vshoutbox_submit'
]) &&
$antispam
== 1 &&
$_POST
[
'vshoutbox_antispam'
] ==
$_SESSION
[
'loesung'
]) || (!
empty
(
$_POST
[
'vshoutbox_submit'
]) &&
$antispam
== 0))
{
if
(loggedin())
{
$vshoutbox_nickname
=
$_SESSION
[
'authname'
];
}
else
{
$vshoutbox_nickname
= escape(
$_POST
[
'vshoutbox_nickname'
],
'string'
);
$vshoutbox_nickname
=
substr
(
$vshoutbox_nickname
, 0, 15);
if
(db_count_query(
"SELECT COUNT(*) FROM `prefix_user` WHERE `name` LIKE '%$vshoutbox_nickname%'"
) > 0)
{
$vshoutbox_nickname
=
'Gast'
;
}
}
$vshoutbox_textarea
= escape(
$_POST
[
'vshoutbox_textarea'
],
'textarea'
);
$vshoutbox_textarea
= preg_replace(
"/\[.?(url|b|i|u|img|code|quote)[^\]]*?\]/i"
,
""
,
$vshoutbox_textarea
);
$vshoutbox_textarea
=
strip_tags
(
$vshoutbox_textarea
);
if
(!
empty
(
$vshoutbox_nickname
) AND !
empty
(
$vshoutbox_textarea
))
{
db_query(
'DELETE FROM `prefix_shoutbox` WHERE nickname = "'
.
$vshoutbox_nickname
.
'" AND textarea = "'
.
$vshoutbox_textarea
.
'"'
);
db_query(
'INSERT INTO `prefix_shoutbox` VALUES ("" , "'
.
$vshoutbox_nickname
.
'" , "'
.
$vshoutbox_textarea
.
'" , "'
. time() .
'" )'
);
}
}
$erg
= db_query(
'SELECT * FROM `prefix_shoutbox` ORDER BY `id` DESC LIMIT '
. (
is_numeric
(
$allgAr
[
'sb_limit'
])?
$allgAr
[
'sb_limit'
]:20));
$class
=
'Cmite'
;
$tpl
->out(0);
while
(
$row
= db_fetch_object(
$erg
))
{
$class
= (
$class
==
'Cmite'
?
'Cnorm'
:
'Cmite'
);
$erg1
= db_query(
'SELECT `id`, `avatar` FROM `prefix_user` WHERE `name` = "'
.
$row
->nickname .
'"'
);
if
(db_num_rows(
$erg1
))
{
$row1
= db_fetch_object(
$erg1
);
if
(
$row1
->avatar &&
file_exists
(
$row1
->avatar))
{
$avatar
=
'<a href="?user-details-'
.
$row1
->id .
'" title=""><img src="'
.
$row1
->avatar .
'" alt="Avatar" border="0" width="30"></a>'
;
}
else
{
$avatar
=
'<a href="?user-details-'
.
$row1
->id .
'" title=""><img src="include/images/avatars/wurstegal.jpg" alt="Avatar" border="0" width="30"></a>'
;
}
}
else
{
$avatar
=
'<img src="include/images/avatars/wurstegal.jpg" alt="Avatar" border="0" width="30">'
;
}
$ar
=
array
(
'NAME'
=>
$row
->nickname,
'AVATAR'
=>
$avatar
,
'DATE'
=>
$row
->time==0?
' '
:
date
(
'd.m.Y | H:i:s \U\h\r'
,
$row
->time),
'TEXT'
=> preg_replace(
'/([^\s]{'
.
$allgAr
[
'sb_maxwordlength'
] .
'})(?=[^\s])/'
,
"$1\n"
, BBcode(
$row
->textarea)),
'CLASS'
=>
$class
);
$tpl
->set_ar_out(
$ar
, 1);
}
$tpl
->out(2);
if
(has_right(
$allgAr
[
'sb_recht'
]))
{
if
(
$antispam
== 1)
{
$zahl1
= mt_rand(1, 10);
$zahl2
= mt_rand(1, 10);
eval
(
"\$_SESSION['loesung'] = {$zahl1} + {$zahl2};"
);
}
$ar
=
array
(
'URL'
=>
$menu
->get_complete(),
'VALUE_NAME'
=>
$vshoutbox_VALUE_name
,
'DISABLED'
=>
$disabled
,
'SMILIES'
=> smiliesshb(),
'ANTISPAM'
=>
$antispam
,
'RECHNUNG'
=> (
$antispam
==1)?
$zahl1
.
' + '
.
$zahl2
:
''
);
$tpl
->set_ar_out(
$ar
, 3);
}
$tpl
->out(4);
}
?>