<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* BLOC-NOTES engine for NPDS - Philippe Brunier & Arnaud Latourrette   */
/*                                                                      */
/* NPDS Copyright (c) 2002-2007 by Philippe Brunier                     */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

#autodoc blocnotes ($typeBlocNote="shared", $nomBlocNote="", $largeur="100%", $nblBlocNote="5", $gifbgcolor="") : Bloc blocnotes<br />=> syntaxe :
#autodoc : function#blocnotes<br />params#shared OU context (partagé ou contextuel), nom_du_bloc OU le texte : $username (nom du bloc=nom du membre ou de l'admin), largeur (en % ou en pixel), nb de ligne de la textarea, couleur du fond du gif (vide=transparent, sinon RVB)<br />
#autodoc : function#blocnotes<br />params#shared,TNT,150 (blocnote partagé s'appelant TNT de largeur 150 pixel)
function blocnotes ($typeBlocNote="shared", $nomBlocNote="", $largeur="100%", $nblBlocNote="5", $gifbgcolor="") {
   global $REQUEST_URI;
   if ($typeBlocNote=="shared") {
      if ($nomBlocNote=="\$username") {
         global $cookie;
         $nomBlocNote=$cookie[1];
      }
      $bouton="";
      $bnid=md5($nomBlocNote);
   } elseif ($typeBlocNote=="context") {
      if ($nomBlocNote=="\$username") {
         global $cookie, $admin;
         $nomBlocNote=$cookie[1];
         $cur_admin=explode(":",base64_decode($admin));
         if ($cur_admin) {
            $nomBlocNote=$cur_admin[0];
         }
      }
      $bouton="&nbsp;<input type=\"submit\" name=\"supBlocNote\" value=\"RAZ\" class=\"bouton_standard\" />";
      if (stristr($REQUEST_URI,"article.php")) {
         $bnid=md5($nomBlocNote.substr($REQUEST_URI,0,strpos($REQUEST_URI,"&")));
      } else {
         $bnid=md5($nomBlocNote.$REQUEST_URI);
      }
   } else {
      $nomBlocNote="";
   }
   if ($nomBlocNote) {
      echo "<table width=\"".$largeur."\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr align=\"center\" valign=\"middle\"><td>";
      echo "<table width=\"100%\" height=\"20\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
         <tr>
            <td width=\"100%\" height=\"20\" valign=\"middle\" style=\"background-color: #FFE500\">
            <span style=\"font-family: Arial,Helvetica,sans-serif; font-size: 11px; color: #000000;\">&nbsp;$nomBlocNote</span></td>
            <td width=\"51\" height=\"20\"";
            if ($gifbgcolor)
               echo " style=\"background-color: #$gifbgcolor\"";
      echo "><img src=\"modules/bloc-notes/bloc-note.gif\" width=\"51\" height=\"20\" alt=\"\" /></td>
         </tr>
         <tr valign=\"top\">
            <td colspan=\"2\" width=\"100%\" style=\"background-color: #FFE500\">
            <form method=\"post\" action=\"modules.php?ModPath=bloc-notes&amp;ModStart=blocnotes\" name=\"A".$bnid."\">".
            "&nbsp;<textarea class=\"textbox\" cols=\"20\" rows=\"".$nblBlocNote."\" name=\"texteBlocNote\" style=\"font-family: Arial,Helvetica,sans-serif; font-size: 10px; width: 96%;\"></textarea><br />
            <input type=\"hidden\" name=\"uriBlocNote\" value=\"".urlencode($REQUEST_URI)."\" />
            <input type=\"hidden\" name=\"typeBlocNote\" value=\"".$typeBlocNote."\" />
            <input type=\"hidden\" name=\"nomBlocNote\" value=\"".$nomBlocNote."\" />
            &nbsp;<input type=\"submit\" name=\"okBlocNote\" value=\"OK\" class=\"bouton_standard\" />".$bouton."
            </td>";
      echo "<script type=\"text/javascript\" src=\"modules.php?ModPath=bloc-notes&ModStart=blocnotes-read&bnid=".$bnid."\"></script>";
      echo "</tr><tr><td colspan=\"2\" width=\"100%\" style=\"line-height: 3px; background-color: #FFE500\">&nbsp;</td></tr></form>
         </table>\n";
      echo "</td></tr></table>";
   }
}
?>