Das wäre die Box
<?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.'',$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=250,height=200,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" height="63"/>';
} 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 '<form action="index.php" method="POST" name="shoutbox">';
echo '<table width="90%" class="border" cellpadding="2" cellspacing="1" border="0">
<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>
</table>';
echo '<table width="90%" class="border" cellpadding="2" cellspacing="1" border="0">
<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>
</table>';
echo '<table width="90%" class="border" cellpadding="2" cellspacing="1" border="0">
<tr><td align="center">'.get_antispam ('shoutbox', 0).'
<input type="submit" value="'.$lang['formsub'].'" name="shoutbox_submit"></td></tr>
</table>';
echo '</form>';
} else {
//Gaeste
echo '<table width="90%" class="border" cellpadding="2" cellspacing="1" border="0">
<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>';
}
echo '<table width="90%" class="border" cellpadding="2" cellspacing="1" 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/noavatar.jpg';
}
} else {
$avatar = 'include/images/avatars/gast.png';
}
$avatar = '<img src="'.$avatar.'" border="0" width="50" height="63"/>';
} else {
$avatar = '';
}
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$time = is_null($row->time) ? '<br />' : '<br /><em style="font-size:0.9em;">'.date('d.m.y - H:i',$row->time).' Uhr</em><br />';
echo '<tr class="'.$class.'"><td><div style="float:left; width:40%;">'.$avatar.'</div><div style="float:left; text-align:left; width:60%;"><b>'.$row->nickname.': '.$time.'</b></div></td></tr>
<tr class="'.$class.'"><td>'.smilies(preg_replace( '/([^\s]{'.$allgAr['sb_maxwordlength'].'})(?=[^\s])/', "$1\n", bbcode($row->textarea))).'</td></tr>';
}
echo '</table><a class="box" href="index.php?shoutbox">'.$lang['archiv'].'</a>';
?>
Und das die content
<?php
# Copyright by: Manuel Staechele
# Support: www.ilch.de und www.fhag-gaming.de
# modifiziert bei Puni
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: Shoutbox '.$lang['archiv'];
$hmenu = 'Shoutbox '.$lang['archiv'];
$design = new design ( $title , $hmenu );
$design->header();
if (is_siteadmin()) {
# delete
if ($menu->getA(1) == 'd' AND is_numeric($menu->getE(1))) {
db_query("DELETE FROM prefix_shoutbox WHERE id = ".$menu->getE(1));
}
# delete all
if ($menu->get(1) == 'delall') {
if (is_numeric($menu->get(2))) {
$anz = db_result(db_query("SELECT COUNT(*) FROM `prefix_shoutbox`"),0) - $menu->get(2);
if ($anz > 0) {
db_query("DELETE FROM `prefix_shoutbox` ORDER BY id ASC LIMIT $anz");
}
}
else { db_query("DELETE FROM `prefix_shoutbox`"); }
}
}
echo '<script type="text/javascript">
function del() {
if (anz = prompt("Wieviele Einträge sollen erhalten bleiben?\n(Es werden die zuletzt geschriebenen erhalten)", "0")) {
if (anz >= 0) { window.location.href = "index.php?shoutbox-delall-"+anz; }
else alert("Du musst eine Zahl größer gleich 0 eingeben");
}
}
</script>';
# mehrere seiten falls gefordert
$limit = 10; // Limit
$page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
$MPL = db_make_sites($page,'',$limit ,'?shoutbox','shoutbox');
$anfang = ($page - 1) * $limit;
$class = 'Cnorm';
echo '<table width="100%" align="center" class="border" cellpadding="2" cellspacing="1" border="0"><tr class="Chead"><td><b>Shoutbox '.$lang['archiv'].'</b></td></tr></table>';
echo '<table width="100%" align="center" class="border" cellpadding="2" cellspacing="1" 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 '.$anfang.','.$limit.'');
while ($row = db_fetch_assoc($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/noavatar.jpg';
}
} else {
$avatar = 'include/images/avatars/gast.png';
}
$avatar = '<img src="'.$avatar.'" border="0" width="50" height="63"/>';
} else {
$avatar = '';
}
$class = ( $class == 'Cmite' ? 'Cnorm' : 'Cmite' );
echo '<tr class="'.$class.'"><td>';
if ( is_siteadmin() ) {
echo '<a href="index.php?shoutbox-d'.$row['id'].'"><img src="include/images/icons/del.gif" alt="'.$lang['delete'].'" title="'.$lang['delete'].'"></a> ';
}
$time = is_null($row['time']) ? '' : '<em>'.date('d.m.Y \u\m H:i',$row['time']).' Uhr</em> ';
echo ''.$avatar.'</td><td><b>'.$row['nickname'].' am '.$time.':</b> <br> '.smilies(preg_replace ( '/([^\s]{'.$allgAr['sb_maxwordlength'].'})(?=[^\s])/', "$1\n", bbcode($row[textarea]))).'</td></tr>';
}
echo '</table>';
if (is_siteadmin()) {
echo '<a href="javascript:del();">'.$lang['clearshoutbox'].'</a> ';
}
echo '<div align="center"><b>Seite:</b> '.$MPL.'</div>';
echo '<div align="center"><b>@ by <a href="http://www.fhag-gaming.de">www.fhag-gaming.de</a></b></div>';
$design->footer();
?>
Zuletzt modifiziert von Vauxhall am 20.10.2010 - 14:52:09