Guten Abend
Leider habe ich momentan einige Probleme mit meinem Chatsystem. Ich habe die originale Version etwas verkleinert, und nach meinen Vorstellungen ummodeliert.
Das Problem dabei sind jedoch die Farben. Sobald ich mehrere viewcommentary's auf einer Seite verwende, funktionieren die Farben nur noch in der jeweils ersten, in den nachfolgenden werden sie vorbehaltlos entfernt.
Ich hoffe, dass jemand von euch eine Idee hat. ich bin jedenfalls momentan ratlos.
Mit freundlichen Grüssen,
Harthas
[php]function addcommentary() {
global $session;
$emote = 1;
if (isset($_POST['section'])) $section = $_POST['section'];
if (isset($_POST['talkline'])) $talkline = $_POST['talkline'];
if ($_POST['insertcommentary'][$section] !== NULL &&
trim($_POST['insertcommentary'][$section]) != '')
{
$commentary = rechtschreibung(soap($_POST['insertcommentary'][$section]));
}
$commentary = preg_replace("'([^[:space:]]{45,45})([^[:space:]])'","\\1 \\2",$commentary);
if (substr($commentary,0,3) == '/me')
{
$emote = 2;
if ($session['user']['prefs']['commentemotecolor']) $commentary = substr($commentary,0,3).$session['user']['prefs']['commentemotecolor'].substr($commentary,3);
}
elseif (strtolower(substr($commentary,0,2)) == '/x')
{
$emote = 3;
if ($session['user']['prefs']['commentxcolor']) $commentary = substr($commentary,0,2).$session['user']['prefs']['commentxcolor'].substr($commentary,2);
}
else
{
if ($session['user']['prefs']['commenttalkcolor']) $commentary = $session['user']['prefs']['commenttalkcolor'].$commentary;
}
if ($emote == 1) $commentary = '`3'.$talkline.': \"`#'.$commentary.'`3\"';
$maxcomm = getsetting('kommentarlaenge','5000');
if (strlen($commentary) > $maxcomm) $commentary = substr($commentary,0,$maxcomm);
$sql = 'INSERT INTO `commentary`
(`postdate`, `section`, `author`, `comment`, `emote`)
VALUES
(now(),\''.$section.'\','.$session['user']['acctid'].',\''.$commentary.'\','.$emote.')';
db_query($sql) or die(db_error(LINK));
return true;
}
function viewcommentary($section,$message="Kommentar hinzufügen?",$limit=10,$talkline = 'sagt') {
global $session;
$com = (int)$_GET['comscroll'];
$sql = "SELECT `commentary`.*,
`accounts`.`name`,
`accounts`.`acctid`
FROM `commentary`
INNER JOIN `accounts`
ON `accounts`.`acctid` = `commentary`.`author`
WHERE `section` = '$section'
AND `accounts`.`locked` = 0
ORDER BY `commentid` DESC
LIMIT ".($com*$limit).",$limit";
$result = db_query($sql) or die(db_error(LINK));
$counttoday=0;
$appoencode_str = Get_Allowed_Tags();
$max = db_num_rows($result);
for ($i=0;$i < $max;$i++)
{
$row = db_fetch_assoc($result);
$row['comment'] = preg_replace("'[`][^".$appoencode_str."`]'","",$row['comment']);
$commentids[$i] = $row['commentid'];
$x = 0;
$ft = '';
$timest = '';
if ($session['user']['prefs']['author']==1) $authors[$i] = '['.$row['name'].']';
if ($session['user']['prefs']['timestamps']) $timest = '`0['.date('H:i',strtotime($row['postdate'])).'] ';
for ($x=0;strlen($ft) < 3 && $x < strlen($row['comment']);$x++)
{
if (substr($row['comment'],$x,1) == '`' && strlen($ft)==0)
{
$x++;
}
else
{
$ft .= substr($row['comment'],$x,1);
}
}
$link = "bio.php?id=".$row['acctid']."&ret=".URLEncode($_SERVER['REQUEST_URI']);
/*Landschafts-Emote by Eliwood*/
if ($row['emote'] == 3)
{
$ft = substr($ft,0,2);
$x = strpos($row['comment'],$ft);
if ($x !== false)
{
$op[$i] = $timest.str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
}
}/*Landschaft-Emote Ende*/
elseif ($row['emote'] == 2)
{
$ft = substr($ft,0,3);
$x = strpos($row['comment'],$ft);
if ($x !== false)
{
$op[$i] = $timest.str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x)))
."`0<a href='$link' style='text-decoration: none'>`&".$row['name']."`0</a>`& "
.str_replace("&","&",HTMLEntities(substr($row['comment'],$x+strlen($ft))))
."`0`n";
}
}
else
{
$op[$i] = $timest."`0<a href='$link' style='text-decoration: none'>`&".$row['name']."`0</a>`# "
.str_replace("&","&",HTMLEntities($row['comment']))."`0`n";
}
if ($message == 'X') $op[$i] = '`0('.$row['section'].') '.$op[$i];
addnav('',$link);
}
$i--;
$outputcomments = array();
$sect ="x";
for (;$i >= 0;$i--)
{
$out = '';
if ($session['user']['superuser'] == 4)
{
$out.="`0[ <a href='superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI'])."'>Löschen</a> ]".$authors[$i]."";
addnav("","superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI']));
$matches = array();
preg_match("/[(][^)]*[)]/",$op[$i],$matches);
$sect = $matches[0];
}
$out.=$op[$i];
if (!is_array($outputcomments[$sect])) $outputcomments[$sect]=array();
array_push($outputcomments[$sect],$out);
}
ksort($outputcomments);
reset($outputcomments);
while (list($sec,$v)=each($outputcomments))
{
if ($sec!="x") output('`n`b'.$sec.'`b`n');
output(nl2br(implode('',$v)),true);
}
if ($session['user']['loggedin'])
{
if ($message != 'X' && $message != 'Y')
{
if ($session['user']['prefs']['eingabe']) output("<form action=\"".REQUEST_URI."\" method='POST'>`@$message`n<textarea name='insertcommentary[$section]' cols='50' rows='5' style='background-color: #433828; border: 1px solid #433838;'></textarea><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><input type='submit' class='button' value='Hinzufügen'>`n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n</form>",true);
else output("<form action=\"".REQUEST_URI."\" method='POST'>`@$message`n<input name='insertcommentary[$section]' size='40' maxlength='".getsetting('kommentarlaenge','5000')."'><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><input type='submit' class='button' value='Hinzufügen'>`n".(round($limit/2,0)-$counttoday<3?"`)(Du hast noch ".(round($limit/2,0)-$counttoday)." Beiträge für heute übrig)":"")."`0`n</form>",true);
addnav("",REQUEST_URI);
}
}
if (db_num_rows($result) >= $limit)
{
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",REQUEST_URI)."&comscroll=".($com+1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output("|<a href=\"$req\"><< Vorherige</a>| ",true);
addnav("",$req);
}
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",REQUEST_URI)."&comscroll=0";
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output("|<a href=\"$req\">Aktualisieren</a>|",true);
addnav("",$req);
if ($com>0)
{
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",REQUEST_URI)."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output(" |<a href=\"$req\">Nächste >></a>|",true);
addnav("",$req);
}
db_free_result($result);
if($section != 'off') output('`n`n`1``1 `!``! `9``9 `j``j `X``X `+``+ `2``2 `@``@ `G``G `g``g `8``8 `3``3 `#``# `F``F `A``A`n
`4``4 `S``S `$``$ `J``J `5``5 `%``% `R``R `r``r `6``6 `^``^ `C``C `T``T `o``o `(``( `Q``Q`n
`q``q `t``t `€``€ `f``f `p``p `x``x `m``m `P``P `s``s `L``L `V``V `v``v `w``w `W``W `e``e`n
`d``d `D``D `E``E `Z``Z `O``O `~``~ `?``? `&``& `-``- `I``I `k``k `Y``Y `M``M `=``= `l``l`n
`_``_ `)``) `7``7 `N``N `K``K `y``y');
}[/php]
|