Quer-Verweis

ein kleines Forum 2

Weiterentwicklung des »kleinen Forums«

Erweitertung und Weiterentwicklung der »kleinen Forums«

<style>
.forum {
font-size:11px;
font-family:verdana;
width:100%;
overflow:hidden;
}
.forumitem {
border:1px solid #eee;     
}
.forumhead, .forumheader{
background-color:#f3f3f3;
}
.forumheader {
font-weight:bold;
}
.forumbody {
}
.forumcontent {
font-size:11px;
font-family:verdana;
width:400;
height:80px;
overflow:hidden;
}
#mess {
position:absolute;
top:0;
left:0;
width:400;
width:expression(eval(410));
height:203;
padding:4 4 4 4;
border:1px solid #888;
border-top:12px solid #888;
background-color:#f7f7f7;
visibility:hidden;
}
</style>

Beim Style hat sich nicht viel getan ...

<?
  global $db_praefix;$link=connectDB();
  $bb=array("[b]"=>"<b>","[/b]"=>"</b>","[i]"=>"<i>","[/i]"=>"</i>","[u]"=>"<u>","[/u]"=>"</u>",
            "[pre]"=>"<pre>","[/pre]"=>"</pre>","[hr]"=>"<hr />","[br]"=>"<br />","[o]"=>"&bull;",
            "&gt;&gt;"=>"&raquo;","&lt;&lt;"=>"&laquo;","..."=>"&hellip;","&lt;-&gt;"=>"&harr;",
            "-&gt;"=>"&rarr;","&lt;-"=>"&larr;",
            "[:)]"=>"<img src=../img/s/regular_smile.gif alt=[:)]>",
            "[angel]"=>"<img src=../img/s/angel_smile.gif alt=[angel]>",
            "[angry]"=>"<img src=../img/s/angry_smile.gif alt=[angry]>",
            "[broken]"=>"<img src=../img/s/broken_heart.gif alt=[broken]>",
            "[cake]"=>"<img src=../img/s/cake.gif alt=[cake]>",
            "[confused]"=>"<img src=../img/s/confused_smile.gif alt=[confused]>",
            "[cry]"=>"<img src=../img/s/cry_smile.gif alt=[cry]>",
            "[devil]"=>"<img src=../img/s/devil_smile.gif alt=[devil]>",
            "[embaressed]"=>"<img src=../img/s/embaressed_smile.gif alt=[embaressed]>",
            "[heart]"=>"<img src=../img/s/heart.gif alt=[heart]>",
            "[kiss]"=>"<img src=../img/s/kiss.gif alt=[kiss]>",
            "[lightbulb]"=>"<img src=../img/s/lightbulb.gif alt=[lightbulb]>",
            "[omg]"=>"<img src=../img/s/omg_smile.gif alt=[omg]>",
            "[sad]"=>"<img src=../img/s/sad_smile.gif alt=[sad]>",
            "[shades]"=>"<img src=../img/s/shades_smile.gif alt=[shades]>",
            "[teeth]"=>"<img src=../img/s/teeth_smile.gif alt=[teeth]>",
            "[down]"=>"<img src=../img/s/thumbs_down.gif alt=[down]>",
            "[up]"=>"<img src=../img/s/thumbs_up.gif alt=[up]>",
            "[tounge]"=>"<img src=../img/s/tounge_smile.gif alt=[tounge]>",
            "[what]"=>"<img src=../img/s/whatchutalkingabout_smile.gif alt=[what]>",
            "[wink]"=>"<img src=../img/s/wink_smile.gif alt=[wink]>",
            "[~"=>"["          
            );
  $bb1=array("alt"=>"onclick=f.content.value+=this.alt alt");
  $hh=<<<EOF
BB-Codes:
<span title=[~b]...[~/b] onclick="f.content.value+=this.title">[b]fett[/b]</span>
<span title=[~i]...[~/b] onclick="f.content.value+=this.title">[i]kursiv[/i]</span>
<span title=[~u]...[~/u] onclick="f.content.value+=this.title">[u]unter[/u]</span>
<span title=[~pre]...[~/pre] onclick="f.content.value+=this.title">preformat</span>
<span title=[~hr] onclick="f.content.value+=this.title">NL</span>
<span title=[~br] onclick="f.content.value+=this.title">HR</span>
<span title=[~o] onclick="f.content.value+=this.title"> [o] </span>
<span title='>>' onclick="f.content.value+=this.title"> &gt;&gt; </span>
<span title='<<' onclick="f.content.value+=this.title"> &lt;&lt; </span>
<span title='<->' onclick="f.content.value+=this.title"> &lt;-&gt; </span>
<span title='->' onclick="f.content.value+=this.title"> -&gt; </span>
<span title='<-' onclick="f.content.value+=this.title"> &lt;- </span>[br]
[:)][angel][angry][confused][cry][devil][embaressed][omg][sad][shades][teeth][tounge][what][wink][heart][broken][kiss][cake][lightbulb][down][up]
EOF;
  $hh=strtr(strtr($hh,$bb),$bb1);
  if ($_POST["thread"] == "") {
    $query="SELECT DISTINCT forum_thread FROM ".$db_praefix."forum ORDER BY 1";
    $res=mysql_query($query);closeDB($link);
?>
    Themen-Auswahl:<br><div class=forum><form name=f method=post>
<?  while ($row = mysql_fetch_array($res)){
?>
      <a href='javascript:f.thread.value="<?= $row["forum_thread"] ?>"; f.submit();'>
      <?= $row["forum_thread"] ?></a><br />
<?    } //endwhile ?>
    <input type=hidden name=thread value="" /></form></div>
<? }
  else {
  if (isAdmin() and $_POST["action"] == "delete") {
    $query="DELETE FROM ".$db_praefix."forum WHERE forum_author='".$_POST["author"]."' AND forum_date='".$_POST["date"]."'";
    $res=mysql_query($query);
    }
  if (isAdmin() and $_POST["action"] == "update") {
    $query="UPDATE ".$db_praefix."forum SET forum_content='".$_POST["content"];
    $query.="', forum_header='".$_POST["title"]."' WHERE forum_author='".$_POST["author"]."' AND forum_date='".$_POST["date"]."'";
    $res=mysql_query($query);
    }  
  if (($_POST["title"] <> "") and (strlen($_POST["content"]) < 4096)) {
    if ($_POST["author"] == "") $_POST["author"] = "Gast";
    $query="INSERT INTO ".$db_praefix."forum VALUES ('".htmlentities($_POST["thread"])."','".$_POST["author"]."','".$_POST["date"]."','".htmlspecialchars($_POST["title"])."','".htmlspecialchars($_POST["content"])."')";
    $res=mysql_query($query);
    $_POST["title"]="";
    }
  $query="SELECT * FROM ".$db_praefix."forum WHERE forum_thread='".$_POST["thread"]."' ORDER BY 3";
  $res=mysql_query($query);closeDB($link);
  $anzahl=mysql_num_rows($res);
  if ($anzahl == 1) $anzahl = $anzahl . " Beitrag"; else $anzahl = $anzahl . " Beiträge";
?>
  <form name=f method=post><input type=hidden name=action value="">
  Thema: <?= $_POST["thread"] ?> [ <?= $anzahl ?> ] |
  <span onclick="with (document.getElementById('mess').style) { visibility='visible';top=0;left=0}">Beitrag verfassen</span>
  <br /><span onclick="movedown('middle_col','middle_col_content',100000);stopscroll();">zum letzten Eintrag</span>
  <div class=forum title="Beitrag verfassen = Doppelklick" ondblclick="with (document.getElementById('mess').style)
  {visibility='visible';top=window.event.offsetY; left=window.event.offsetX;} ">
<?  while ($row = mysql_fetch_array($res)){ ?>
      <div class=forumitem>
      <div class=forumhead>
      <span style="width:50%"><?= $row["forum_author"] ?></span>
      <span style="width:45%; text-align:right"><?= substr($row["forum_date"],0,16) ?></span>
      <? if (isAdmin()){ ?>
         <img src="../img/oes_delete.png" onclick="f.author.value='<?= $row["forum_author"] ?>';f.date.value='<?= $row["forum_date"] ?>';
         f.action.value='delete';f.submit();">
         <img src="../img/oes_open.png" onclick="
         f.author.value='<?= $row["forum_author"] ?>';
         f.content.value='<?= $row["forum_content"] ?>';
         f.date.value='<?= $row["forum_date"] ?>';
         f.title.value='<?= $row["forum_header"] ?>';
         f.action.value='update';
         with (document.getElementById('mess').style){visibility='visible';top=0; left=0;}
         ">   
      <? } ?>
      <div class=forumheader onClick="f.title.value=this.innerHTML"><?= $row["forum_header"] ?></div></div>
      <div class=forumbody><?= nl2br(strtr($row["forum_content"],$bb)) ?></b></i></u></pre></div></div>
<?  } //end while ?>
  <span onclick="moveup('middle_col','middle_col_content',100000);stopscroll();">zum ersten Eintrag</span>
  </div>
  <input type=hidden name=author value="<?= $_SESSION["account_firstname"] ?> <?= $_SESSION["account_lastname"] ?>" />
  <input type=hidden name=date value="<?= date("Y-m-d H:i:s") ?>" />
  <div id=mess title="Fenster schliessen = Doppelklick"
   ondblClick="this.style.visibility='hidden'"
   onMousedown="initializedrag(this,event)"
   onMouseup="stopdrag(this)"
   style="top:0; left:0">
  Thema<input type=input maxlenght=254 name=thread style="width:400" value="<?= $_POST["thread"] ?>" >
  Titel<input type=text name=title maxlength=254 style="width:400" value="" />
  <textarea name=content class=forumcontent></textarea>
  <input class=button style="width:198" type=button value=schliessen
  onclick="document.getElementById('mess').style.visibility='hidden'" />
  <input class=button style="width:198" type=button value=absenden
  onclick="if (f.title.value == '') alert('Titel nicht vergessen'); else {
      document.getElementById('mess').style.visibility='hidden'; f.submit();}"/>
  <?= $hh ?>
  </form></div>
<? } //endif ?>

Anmerkungen:

BB-Codes sind jetzt im Content der Beiträge möglich. Etwas provisorisch ist noch das Abfangen nicht geschlossener BB-Codes.

Die Smilies sind im Verzeichnis /htdocs/img/s abgelegt, aber ein anderer Pfad ist auch möglich.

Für den Admin besteht jetzt die Möglichkeit, Beiträge zu ändern und zu löschen.

Die Eingabe-Pop-Up-Maske für neue Beiträge kann verschoben werden (siehe auch den Beitrag zum Pop-Up-Move).

© 2005 cptc | Impressum | powered by OpenEngine 1.6