Das Addon ist zwar sehr gut, doch leider werden bei Dashers Gilden nun keine Clan kürzel mehr angezeigt. Nach mehrmaligen fehlversuchen dieses in der /lib/commentary.php anzugleichen bin ich mit meinem Latein am Ende. Ich stell hier mal meine alte function viewcommentary rein, vielleicht weiß jemand von euch Rat.
schon mal vielen Dank im voraus!
[php]<?
function viewcommentary($section,$message="Kommentar hinzufügen?",$limit=10,$talkline="sagt", $sticky = false) {
global $HTTP_POST_VARS,$session,$REQUEST_URI,$HTTP_GET_VARS, $doublepost,$appoencode_str;
$nobios = array("motd.php"=>true);
if ($nobios[basename($_SERVER['SCRIPT_NAME'])]) $linkbios=false; else $linkbios=true;
//output("`b".basename($_SERVER['SCRIPT_NAME'])."`b`n");
if ($doublepost) output("`\$`bDoppelpost?`b`0`n");
if ((int)getsetting("expirecontent",180)>0){
$sql = "DELETE FROM commentary WHERE postdate<'".date("Y-m-d H:i:s",strtotime("-".getsetting("expirecontent",180)." days"))."'";
db_query($sql);
}
$com=(int)$HTTP_GET_VARS[comscroll];
// Guild/Clans code by Dasher, modified by Gargamel
if (!$sticky) {
$sql = "SELECT commentary.*,
accounts.name,
accounts.login,
accounts.guildID,
accounts.clanID,
guilds.GuildPrefix as GuildPrefixG,
clans.GuildPrefix as GuildPrefixC
FROM commentary
INNER JOIN accounts
ON accounts.acctid = commentary.author
LEFT JOIN lotbd_guilds as guilds
ON guilds.ID = accounts.GuildID
LEFT JOIN lotbd_guilds as clans
ON clans.ID = accounts.clanID
WHERE section = '$section'
AND accounts.locked=0
ORDER BY commentid DESC
LIMIT ".($com*$limit).",$limit";
} else {
$sql = "SELECT stickycom.*,
accounts.name,
accounts.login,
accounts.guildID,
accounts.clanID,
guilds.GuildPrefix as GuildPrefixG,
clans.GuildPrefix as GuildPrefixC
FROM stickycom
INNER JOIN accounts
ON accounts.acctid = stickycom.author
LEFT JOIN lotbd_guilds as guilds
ON guilds.ID = accounts.GuildID
LEFT JOIN lotbd_guilds as clans
ON clans.ID = accounts.clanID
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;
for ($i=0;$i < db_num_rows($result);$i++){
$row = db_fetch_assoc($result);
$row[comment]=preg_replace("'[`][^".$appoencode_str."`]'","",$row[comment]);
$commentids[$i] = $row[commentid];
if (date("Y-m-d",strtotime($row[postdate]))==date("Y-m-d")){
if ($row[name]==$session[user][name]) $counttoday++;
}
$x=0;
$ft="";
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?char=".rawurlencode($row[login]) . "&ret=".URLEncode($_SERVER['REQUEST_URI']);
if (substr($ft,0,2)=="::") $ft = substr($ft,0,2);
else
if (substr($ft,0,2)=="/x") $ft = substr($ft,0,2);
else
if (substr($ft,0,1)==":") $ft = substr($ft,0,1);
// Guild/Clans code by Dasher
// modified by gargamel
// - supports general suppressing of guilds abbreviation
// - fixes links to guild and bio within commentary output
// - supports display of Guilds and clans TLA at the same time
if (!(unserialize($row['GuildPrefixG'])===false)) {
$row['GuildPrefixG']=unserialize($row['GuildPrefixG']);
$pre=$row['GuildPrefixG']['pre']; // Prefix or postfix
$prefix=$row['GuildPrefixG']['display'].""; // This Guild TLA
if ($prefix!="") {
// The link to display the guild info for non-members
$Guildshortlink = "guild.php?op=nonmember&action=examine&id=".$row['guildID'].
"&return=".URLEncode(CalcReturnPath());
$Guildlink = "`0<a href='".$Guildshortlink."' style='text-decoration: none'>`0[$prefix`0]</a>`& ";
switch ( $pre ) {
case 0: // suffix
$guildsuf = $Guildlink;
$guildpre = "";
addnav("",$Guildshortlink);
break;
case 1: // prefix
$guildsuf = "";
$guildpre = $Guildlink;
addnav("",$Guildshortlink);
break;
case 2: // nofix
default:
$guildsuf = "";
$guildpre = "";
break;
}
}
}
if (!(unserialize($row['GuildPrefixC'])===false)) {
$row['GuildPrefixC']=unserialize($row['GuildPrefixC']);
$pre=$row['GuildPrefixC']['pre']; // Prefix or postfix
$prefix=$row['GuildPrefixC']['display'].""; // This Guild TLA
if ($prefix!="") {
// The link to display the guild info for non-members
// replace GuildID with clanID - Raven
$Clanshortlink = "clan.php?op=nonmember&action=examine&id=".$row['clanID'].
"&return=".URLEncode(CalcReturnPath());
$Clanlink = "`0<a href='".$Clanshortlink."' style='text-decoration: none'>`0[$prefix`0]</a>`& ";
switch ( $pre ) {
case 0: // suffix
$clansuf = $Clanlink;
$clanpre = "";
addnav("",$Clanshortlink);
break;
case 1: // prefix
$clansuf = "";
$clanpre = $Clanlink;
addnav("",$Clanshortlink);
break;
case 2: // nofix
default:
$clansuf = "";
$clanpre = "";
break;
}
}
}
/*
Landschafts-Emote by Eliwood
*/
/*if ($ft=="/x")
{
$x = strpos($row[comment],$ft);
if ($x!==false)
{
if ($linkbios)
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
else
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
}
}
/*Landschaft-Emote Ende*/
/*
Landschafts-Emote by Eliwood
Edited by Lestat
*/
if ($ft=="/x"){
if ($session[user][superuser]>=4){
$x = strpos($row[comment],$ft);
if ($x!==false)
{
if ($linkbios)
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0<a href='$link' style='text-decoration: none'>\n`&[ $row[name]`& ]`0</a>\n`&`n ";
else
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0\n`&[ $row[name]`& ]`0\n`&`n ";
}
}
else{
$x = strpos($row[comment],$ft);
if ($x!==false)
{
if ($linkbios)
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
else
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
."`0\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
}
}
}
/*Landschaft-Emote Ende*/
/*if ($ft=="::" || $ft=="/me" || $ft==":")*/elseif ($ft=="::" || $ft=="/me" || $ft==":"){
$x = strpos($row[comment],$ft);
if ($x!==false){
if ($linkbios)
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
.$guildpre.$clanpre
."`0<a href='$link' style='text-decoration: none'>\n`&$row[name]`0</a>\n`"
.$session['flags']['emote']." "
.$guildsuf.$clansuf
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
else
$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
.$guildpre.$clanpre
."`0\n`&$row[name]`0\n`& "
.$guildsuf.$clansuf
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
}
}
if ($op[$i]=="")
if ($linkbios)
//$op[$i] = "`0<a href='$link' style='text-decoration: none'>`&$row[name]`0</a>`3 says, \"`#"
$op[$i] = $guildpre.$clanpre."`0<a href='$link' style='text-decoration: none'>`&$row[name] `0</a>"
.$guildsuf.$clansuf."`".$session['flags']['emote']."sagt: \"`"
.$session['flags']['chat']." "
.str_replace("&","&",HTMLEntities($row[comment]))."`3\"`0`n";
else
//$op[$i] = "`0`&$row[name]`0`3 says, \"`#"
$op[$i] = $guildpre.$clanpre."`0`&$row[name]`0 ".$guildsuf.$clansuf."`3sagt: \"`#"
.$guildsuf.$clansuf.str_replace("&","&",HTMLEntities($row[comment]))."`3\"`0`n";
if ($message=="X") $op[$i]="`0($row[section]) ".$op[$i];
if ($row['postdate']>=$session['user']['recentcomments']) $op[$i]="<img src='images/new.gif' alt='>' width='3' height='5' align='absmiddle'> ".$op[$i];
addnav("",$link);
$guildpre = $guildsuf = $clanpre = $clansuf = "";
}
$i--;
$outputcomments=array();
$sect="x";
for (;$i>=0;$i--){
$out="";
if ($session[user][superuser]>=3 && $message=="X"){
$out.="`0[ <a href='superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI'])."'>Löschen</a> ] ";
addnav("","superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI']));
$matches=array();
preg_match("/[(][^)]*[)]/",$op[$i],$matches);
$sect=$matches[0];
}
//output($op[$i],true);
$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");
reset($v);
while (list($key,$val)=each($v)){
output($val,true);
}
}
if ($session[user][loggedin]) {
//if ($counttoday<($limit/4) || $session['user']['superuser']>=4){
if ($message!="X"){
if ($talkline!="says") $tll = strlen($talkline)+11; else $tll=0;
output("<form action=\"$REQUEST_URI\" method='POST'>$message`n<input name='insertcommentary[$section]' size='90' maxlength='".(900 -$tll)."'><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><input type='submit' class='button' value='reden'>`0`n</form>",true);
addnav("",$REQUEST_URI);
}
//}else{
// output("`@$message`nDu hast deine Posts für heute aufgebraucht.`0`n");
//}
}
if (db_num_rows($result)>=$limit){
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]-])*'","",$REQUEST_URI)."&comscroll=".($com+1);
//$req = substr($REQUEST_URI,0,strpos($REQUEST_URI,"c="))."&c=$HTTP_GET_VARS[c]"."&comscroll=".($com+1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
//output("<a href=\"$req\"><< Previous</a>",true);
output("<a href=\"$req\"><< Vorherige</a>",true);
addnav("",$req);
}
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",$REQUEST_URI)."&comscroll=0";
//$req = substr($REQUEST_URI,0,strpos($REQUEST_URI,"c="))."&c=$HTTP_GET_VARS[c]"."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
//output(" <a href=\"$req\">Refresh</a> ",true);
output(" <a href=\"$req\"> Aktualisieren</a> ",true);
addnav("",$req);
if ($com>0){
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",$REQUEST_URI)."&comscroll=".($com-1);
//$req = substr($REQUEST_URI,0,strpos($REQUEST_URI,"c="))."&c=$HTTP_GET_VARS[c]"."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
//output(" <a href=\"$req\">Next >></a>",true);
output(" <a href=\"$req\">Nächste >></a>",true);
addnav("",$req);
}
db_free_result($result);
}
?>[/php]
|