Ich schreib hier jetzt einfach auch mal die Shoutbox.php rein...
<?php
# Copyright by Manuel
# Support www.ilch.de
defined ('main') or die ( 'no direct access' );
//Smilies in der Textarea ausgeben
function smilies ($string) {
global $smilies_array;
if (!isset($smilies_array)) {
$smilies_array = array();
$erg = db_query("SELECT ent, url, emo FROM `prefix_smiliesshb`");
while ($row = db_fetch_object($erg) ) {
$smilies_array[$row->ent] = $row->emo.'#@#-_-_-#@#'.$row->url;
}
}
foreach ($smilies_array as $k => $v) {
list($emo, $url) = explode('#@#-_-_-#@#', $v);
$string = str_replace($k,'<img src="include/images/smiliesshb/'.$url.'" border="0" alt="'.$emo.'" title="'.$emo.'" />',$string);
}
return $string;
}
//Smilies in die Textarea übermitteln
function smiliesshb () {
global $lang;
$zeilen = 5; $i = 0;
$b = '<script language="JavaScript" type="text/javascript">function moreSmilies () { var x = window.open("about:blank", "moreSmilies", "width=650,height=500,left=200,top=300,status=no,scrollbars=yes,resizable=yes"); ';
$a = '';
$erg = db_query('SELECT emo, ent, url FROM `prefix_smiliesshb`');
while ($row = db_fetch_object($erg) ) {
$b .= 'x.document.write ("<a href=\"javascript:opener.put_shb(\''.addslashes(addslashes($row->ent)).'\')\">");';
$b .= 'x.document.write ("<img style=\"border: 0px; padding: 5px;\" src=\"include/images/smiliesshb/'.$row->url.'\" title=\"'.$row->emo.'\"></a>");';
if ($i<0) {
# float einbauen
if($i%$zeilen == 0 AND $i <> 0) { $a .= '<br /><br />'; }
$a .= '<a href="javascript:put_shb(\''.addslashes($row->ent).'\')">';
$a .= '<img style="margin: 2px;" src="include/images/smilesshb/'.$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 .= '<br /><center><a href="javascript:moreSmilies();">Smilies</a></center>'; }
$a = $b.$a;
return ($a);
}
// IP und Zeit ausgeben
$shoutbox_VALUE_name2 = getenv("REMOTE_ADDR");
$datum = date("j.n.Y");
$zeit = date(" H:i ");
//Avatar prüfen und ggf. anzeigen
$abf = 'SELECT avatar FROM prefix_user WHERE name = "'.$_SESSION['authname'].'"';
$erg = db_query($abf);
$row = db_fetch_object($erg);
if ($allgAr['sh_avatar'] == 1) {
if (loggedin ()) {
if (file_exists($row->avatar)) {
$avatar = $row->avatar; // $row->avatar sollte den Pfad zum Bild enthalten
} else {
$avatar = 'include/images/avatars/noavatar.jpg';
}
} else {
$avatar = 'include/images/avatars/gast.png';
}
$avatar = '<img src="'.$avatar.'" border="0" width="50" />';
} else {
$avatar = '';
}
//Nickname und Gast
if ( loggedin() ) {
$shoutbox_VALUE_name = $_SESSION['authname'];
} else {
$shoutbox_VALUE_name = 'Gast';
}
//Shoutbox , Namenschutz
if (has_right($allgAr['sb_recht'])){
if (!empty($_POST['shoutbox_submit']) AND chk_antispam ('shoutbox')) {
$insert = true;
if (!loggedin()) {
$shoutbox_nickname = escape($_POST['shoutbox_nickname'], 'string');
$shoutbox_nickname = substr($shoutbox_nickname, 0, 15);
if (db_count_query("SELECT COUNT(*) FROM prefix_user WHERE name LIKE '%$shoutbox_nickname%'") > 0) {
$insert = false;
echo '<center><font color="#ff0000">Benutzen sie einen anderen Namen, dieser ist bereits vergeben.</font></center><br />';
}
} else {
$shoutbox_nickname = escape($_SESSION['authname'], 'string');
}
$shoutbox_textarea = escape($_POST['shoutbox_textarea'], 'textarea');
$shoutbox_textarea = preg_replace("/\[.?(url|b|i|u|img|code|quote)[^\]]*?\]/i", "", $shoutbox_textarea);
$shoutbox_textarea = strip_tags($shoutbox_textarea);
if (!empty($shoutbox_nickname) AND !empty($shoutbox_textarea) AND $insert) {
db_query('INSERT INTO `prefix_shoutbox` (`nickname`,`textarea`,`time`) VALUES ( "' . $shoutbox_nickname . '" , "' . $shoutbox_textarea . '", ' . time() . ' ) ');
}
}
?>
<script type="text/javascript">
// S-Box-Smileys START
function simple_insert_shb(aTag,eTag) {
var input = document.forms['shoutbox'].elements['shoutbox_textarea'];
input.focus();
/* für Internet Explorer */
if(typeof document.selection != 'undefined') {
/* Einfügen des Formatierungscodes */
var range = document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
/* Anpassen der Cursorposition */
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
}
/* für neuere auf Gecko basierende Browser */
else if(typeof input.selectionStart != 'undefined')
{
/* Einfügen des Formatierungscodes */
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
/* Anpassen der Cursorposition */
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
/* für die übrigen Browser */
else
{
/* Abfrage der Einfügeposition */
var pos = input.value.length;
/* Einfügen des Formatierungscodes */
var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
}
}
function put_shb ( towrite ) {
simple_insert_shb ( towrite, '' );
}
// S-Box-Smileys END
</script>
<?php
echo '<link rel="stylesheet" href="include/boxes/shoutbox/shoutbox_style.css" type="text/css"/>';
echo '<form action="index.php" method="POST" name="shoutbox">';
echo '<table width="100%" cellpadding="2" cellspacing="1" border="0" class="shoutbox_oben">
<tr><td style="font-size:11px; text-align:center;">Heute ist der '.$datum.' <br />um '.$zeit.' Uhr<br />Deine IP:<b> '.$shoutbox_VALUE_name2.'</b></td></tr>
';
echo '
<tr><td align="center">'.$avatar.'<br />
<input type="text" size="15" name="shoutbox_nickname" value="'.$shoutbox_VALUE_name.'" onFocus="if (value == \''.$shoutbox_VALUE_name.'\') {value = \'\'}" onBlur="if (value == \'\') {value = \''.$shoutbox_VALUE_name.'\'}" maxlength="15">
<textarea style="width: 85%" cols="15" rows="4" name="shoutbox_textarea"></textarea>
'.smiliesshb ('shoutbox', 0).'</td></tr>
';
echo '
<tr><td align="center">'.get_antispam ('shoutbox', 0).'
<input type="submit" value="'.$lang['formsub'].'" name="shoutbox_submit"></td></tr>
</table><br/>';
echo '</form>';
} else {
//Gaeste
echo '<link rel="stylesheet" href="include/boxes/shoutbox/shoutbox_style.css" type="text/css"/>';
echo '<table width="100%" cellpadding="2" cellspacing="1" border="0" class="shoutbox_oben">
<tr><td style="font-size:11px; text-align:center;"><b>Zum Posten<br />Bitte Einloggen!<br /></b>Deine IP: '.$shoutbox_VALUE_name2.'</td></tr>
</table><br/>';
}
echo '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
$erg = db_query('SELECT `prefix_shoutbox`.*, `prefix_user`.name, `prefix_user`.avatar FROM `prefix_shoutbox` LEFT JOIN `prefix_user` ON `prefix_user`.name = `prefix_shoutbox`.nickname ORDER BY id DESC LIMIT ' . (is_numeric($allgAr['sb_limit'])?$allgAr['sb_limit']:5));
$class = 'Cnorm';
while ($row = db_fetch_object($erg)) {
// Avatar prüfen und ggf. anzeigen
if ($allgAr['sh_avatar'] == 1) {
if ($row->name) {
if (file_exists($row->avatar)) {
$avatar = $row->avatar; // $row->avatar sollte den Pfad zum Bild enthalten
} else {
$avatar = 'include/images/avatars/wurstegal.jpg';
}
} else {
$avatar = 'include/images/avatars/wurstegal_gast.jpg';
}
$avatar = '<img src="'.$avatar.'" border="0" width="50"/>';
} else {
$avatar = '';
}
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$time = is_null($row->time) ? '<br />' : ' '.date('d.m.y - H:i',$row->time).' Uhr';
echo '<tr><td class="shoutboxuser">'.$row->nickname.'<br/><span class="time_sh_box" title="Eintrag von '.$row->nickname.' am '.$time.'">'.$time.'</span></td></tr>
<tr><td class="shoutboxfeld"><span style="float:left;width: 50px;">'.$avatar.'</span>'.smilies(preg_replace( '/([^\s]{'.$allgAr['sb_maxwordlength'].'})(?=[^\s])/', "$1\n", bbcode($row->textarea))).'</td></tr>
<tr><td class="shoutboxend"></td></tr>
<tr><td class="losse"></td></tr>';
}
echo '</table><span style="float:right;"><a class="archivbut_sh_box" href="index.php?shoutbox" title="Shoutbox Archiv anzeigen">'.$lang['archiv'].'</a></span>';
?>