Ich möchte gern die function viewcommentary dahingehend umbauen,
dass es nur ein Ausgabebereich von Systemposts ist. Also es soll keine Möglichkeit geben, dass User einen Post eingeben können.
Einträge in diese "commentary" sollen über
$this->bbcode_second_pass_code('', '$sql = "INSERT INTO')
gemacht werden, also ohne den "hinzufügen"-Button stattfinden.
Es bedarf also weder einem Eingabefeld, noch dem "hinzufügen"-Button.
Die Lösch-/Editfunktion einzelner Post soll erhalten bleiben. die Steahlt-funktion brauch nicht drinbleiben, kann aber.
Was auch von Vorteil wäre, wär, wenn ausser der Uhrzeit auch das Realdatum mit ausgegeben werden würde.
Evtl. könnte man das auch in einer eigenen Tabelle arbeiten lassen,
so das es mit den anderen commentarys nicht durcheinander gerät.
Diese function soll später den namen function syscommentary bekommen
Hier meine function viewcommentary (wie sie im moment ist)
[php]function viewcommentary($section,$message="Kommentar hinzufügen?",$limit=10,$talkline="sagt") {
global $_POST,$session,$REQUEST_URI,$_GET, $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");
$message = translate($message);
$com=(int)$_GET[comscroll];
$sql = "SELECT commentary.*,
accounts.name,
accounts.login,
accounts.loggedin,
accounts.location,
accounts.laston,
accounts.memberid,
accounts.acctid,
gilden.gildenprefix,
gilden.gildenid,
gilden.leaderid
FROM commentary
INNER JOIN accounts
ON accounts.acctid = commentary.author
LEFT JOIN gilden
ON gilden.leaderid = accounts.acctid OR gilden.gildenid =accounts.memberid
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("'[`][^123456789!@#$%&QqRr*~^?VvGgTtAa]'","",$row[comment]);
$row[comment]=preg_replace("'[`][^".$appoencode_str."`]'","",$row[comment]);
$commentids[$i] = $row[commentid];
/* limit posts
if (date("Y-m-d",strtotime($row[postdate]))==date("Y-m-d")){
// if ($row[name]==$session[user][name] && substr($section,0,5)!="house") $counttoday++;
}
*/
// /X-Posts an allen Orten hack by Linus in 2007
if($talkline!="sagt")
{
if(strpos($row[comment],"/X ")==strlen($talkline)+10)
{
$row[comment]=str_replace("&","&",HTMLSpecialChars(substr($row[comment],'8'+strlen($talkline))));
$row[comment]=substr($row[comment],'0',strlen($row[comment])-8);
}
}
$x=0;
$ft="";
//Uhrzeit vor Post
$timest="";
if ($session['user']['prefs']['timestamps']) $timest="`0[".date("H:i",strtotime($row['postdate']))."] ";
//Uhrzeit vor Post
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']);
$link2 = "`7[`0<a href='showdetail.php?id=".$row['gildenid']."' target='window_popup' onClick=\"".popup("showdetail.php?id=".$row['gildenid'])."; return false;\">".stripslashes($row[gildenprefix])."</a>`7] `0";
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);
/*
Landschafts-Emote by Eliwood
*/
if ($ft=="/X")
{
//Stealthwatcher by Wraith
if ($session[user][superuser]>=2){
if ($session['user']['prefs']["xmote"]==1){
$SW_sql = "SELECT name FROM accounts WHERE acctid='".$row[author]."'";
$SW_result = db_query($SW_sql) or die(db_error(LINK));
$SW_c=0;
for ($SW_c=0;$SW_c < db_num_rows($SW_result);$SW_c++){
//$op[$i].=" `7[`&".$row[name]."`7] ";
$op[$i].=" `7[`&".$row[name]."`7] ";
}
}
}
//end Stealthwatcher
$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 ".$timest."`n";
}
}
/*Landschaft-Emote Ende*/
elseif ($ft=="::" || $ft=="/me" || $ft==":"){
$x = strpos($row[comment],$ft);
if ($x!==false){
if ($linkbios)
$op[$i] = $timest.str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x)))
//$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
//."`0<a href='$link' style='text-decoration: none'>\n`&$row[name]`0</a>\n`& "
.$link2
."`0<a href='$link' style='text-decoration: none' onmouseover=\"this.T_WIDTH=225;this.T_TEXTALIGN='center';this.T_BGCOLOR='#000000';this.T_FONTCOLOR='#999999';this.T_BORDERWIDTH=1;this.T_BORDERCOLOR='#999999'; return escape('".MyPostDate($row['postdate'])."')\">\n`&$row[name]`0</a>\n`& "
.str_replace("&","&",HTMLEntities(substr($row[comment],$x+strlen($ft))))
."`0`n";
else
$op[$i] = $timest.str_replace("&","&",HTMLEntities(substr($row['comment'],0,$x)))
//$op[$i] = str_replace("&","&",HTMLEntities(substr($row[comment],0,$x)))
.$link2
."`0\n`&$row[name]`0\n`& "
.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 sagt: \"`#"
$op[$i] = $timest.$link2."`0<a href='$link' style='text-decoration: none' onmouseover=\"this.T_WIDTH=225;this.T_TEXTALIGN='center';this.T_BGCOLOR='#000000';this.T_FONTCOLOR='#999999';this.T_BORDERWIDTH=1;this.T_BORDERCOLOR='#999999'; return escape('".MyPostDate($row['postdate'])."')\">`&$row[name]`0</a>`3 sagt: \"`#"
.str_replace("&","&",HTMLEntities($row[comment]))."`3\"`0`n";
else
$op[$i] = $timest.$link2."`0`&$row[name]`0`3 sagt: \"`#"
.str_replace("&","&",HTMLEntities($row[comment]))."`3\"`0`n";
if ($message=="X") $op[$i]="`0($row[section]) ".$op[$i];
$loggedin=(date("U") - strtotime($row[laston]) < getsetting("LOGINTIMEOUT",900) && $row[loggedin] && $row[location]==0);
//if ($row['postdate']>=$session['user']['recentcomments']) $op[$i]=($loggedin?"<img src='images/new-online.gif' alt='>' width='3' height='5' align='absmiddle'> ":"<img src='images/new.gif' alt='>' width='3' height='5' align='absmiddle'> ").$op[$i];
if ($row['postdate']>=$session['user']['recentcomments']) $op[$i]=($loggedin?"<img src='images/new-online.gif' alt='>' width='4' height='6' align='absmiddle'> ":"<img src='images/new.gif' alt='>' width='4' height='6' align='absmiddle'> ").$op[$i];
addnav("",$link);
}
$i--;
$outputcomments=array();
$sect="x";
for (;$i>=0;$i--){
$out="";
//Post einzeln löschen
if ($session[user][superuser]>=3 && $message=="X" || $session[user][superuser]>=1 ){ //Superuser can delete messages in chatareas, Hadriel
$out.="`0[<a href='superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI'])."'>X</a>] ";
addnav("","superuser.php?op=commentdelete&commentid=$commentids[$i]&return=".URLEncode($_SERVER['REQUEST_URI']));
if ($session[user][superuser]>=3 && $message=="X"){
$matches=array();
preg_match("/[(][^)]*[)]/",$op[$i],$matches);
$sect=$matches[0];
}
}
//Post einzeln löschen
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");
output(implode('',$v),true);
}
if ($session[user][loggedin]) {
//if ($counttoday<($limit/2) || $session['user']['superuser']>=2){
if ($message!="X"){
// chat preview mod by Chaosmaker
output("<p><form action=\"$REQUEST_URI\" method='POST'>`@$message`n<textarea cols='40' rows='3' class='input' name='insertcommentary[$section]' maxlength='".(750-$tll)."' onkeyup=\"document.getElementById('chatpreview').innerHTML = appoencode(this.value);\" style='width: 500px;'></textarea></p><input type='hidden' name='talkline' value='$talkline'><input type='hidden' name='section' value='$section'><br /><input type='submit' class='button' value='Hinzufügen'><span id='chatpreview'></span>`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);
}
// }else{
// output("`@$message`nSorry, du hast deine Beiträge in dieser Region 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=$_GET[c]"."&comscroll=".($com+1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output("<a href=\"$req\"><font color=\"yellow\">[<< Vorherige]</font></a>",true);
addnav("",$req);
}
$req = preg_replace("'[&]?c(omscroll)?=([[:digit:]]|-)*'","",$REQUEST_URI)."&comscroll=0";
//$req = substr($REQUEST_URI,0,strpos($REQUEST_URI,"c="))."&c=$_GET[c]"."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output(" <a href=\"$req\">`4`b[Aktualisieren]`b</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=$_GET[c]"."&comscroll=".($com-1);
$req = str_replace("?&","?",$req);
if (!strpos($req,"?")) $req = str_replace("&","?",$req);
output(" <a href=\"$req\"><font color=\"yellow\">[Nächste >>]</font></a>",true);
addnav("",$req);
}
//Delete/Edit Funktion Anfang
if($section!='ooc')
{
output('`7 | `2Letzten Post <a href="chatdelete.php?op=delete§ion='.$section.'&restore='.$REQUEST_URI.'" onClick="return confirm(\'Willst du diesen Eintrag wirklich löschen?\');">[Löschen]`0</a>',true);
addnav("","chatdelete.php?op=delete§ion=".$section."&restore=$REQUEST_URI");
output(" oder <a href=\"chatdelete.php?op=edit§ion=".$section."&restore=$REQUEST_URI\">`\$[Editieren]`0</a>",true);
addnav("","chatdelete.php?op=edit§ion=".$section."&restore=$REQUEST_URI");
//Delete/Edit Funktion Ende
}
//$dellink="chat_delete.php?return=".$REQUEST_URI."§ion=".$section;
// output(" <a href=\"$dellink\" style=\"color: red;\">Letzten Post löschen</a>",true);
//addnav("",$dellink);
db_free_result($result);
}[/php]
wer kann mir dazu auskunft geben oder mir helfen das umzubasteln?
_________________ so long
Stefan
---------
Source im Profil
|