<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/*                                                                      */
/* 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.       */
/************************************************************************/
$userdatat=$userdata;
if ($allow_forum_hide) {
   $messageP = control_hide_post($message,true);
} else {
   $messageP = $message;
}
$messageP=split_string_without_space($messageP, 80);
$time = date(translate("dateinternal"),time()+($gmt*3600));

switch ($acc) {
   case "newtopic":
      $forum_type=$myrow[forum_type];
      if ($forum_type==8) {
         $formulaire=$myrow[forum_pass];
         include ("modules/sform/forum/forum_extender.php");
      }
      if ($allow_html == 0 || isset($html))
         $messageP = htmlspecialchars($messageP   );
      if ($sig && $userdata[uid] != 1 && $myrow[forum_type]!=6 && $myrow[forum_type]!=5) {
         $messageP .= " [addsig]";
      }
      if (($forum_type!=6) and ($forum_type!=5)) {
         $messageP = aff_code($messageP);
         $messageP = str_replace("\n", "<br />", $messageP);
      }
      if ((!$smile) and ($forum_type!=6) and ($forum_type!=5)) {
         $messageP = smile($messageP);
      }
      if (($forum_type!=6) and ($forum_type!=5)) {
         $messageP = make_clickable($messageP);
         $messageP = removeHack($messageP);
      }
      if (!$Mmod) {
         $subject = removeHack(strip_tags($subject));
      }
      $subject = htmlspecialchars($subject);
   break;

   case "reply":
      $userdata = get_userdata($userdata[1]);
      if ($allow_html == 0 || isset($html)) $messageP = htmlspecialchars($messageP);
      if ($sig && $userdata[uid] != 1) $messageP .= " [addsig]";
      if (($forum_type!="6") and ($forum_type!="5")) {
         $messageP = aff_code($messageP);
         $messageP = str_replace("\n", "<br />", $messageP);
      }
      if (($allow_bbcode==1) and ($forum_type!="6") and ($forum_type!="5")) {
         $messageP = smile($messageP);
      }
      if (($forum_type!="6") and ($forum_type!="5")){
         $messageP = make_clickable($messageP);
         $messageP = removeHack($messageP);
      }
      $messageP = addslashes($messageP);
   break;

   case"editpost" :
      $userdata = get_userdata($userdata[1]);
      settype($post_id,"integer");
      $sql = "SELECT poster_id, topic_id FROM ".$NPDS_Prefix."posts WHERE (post_id = '$post_id')";
      $result = sql_query($sql);
      if (!$result) {
         forumerror('0022');
      }
      $row2 = sql_fetch_assoc($result);

      $userdata[uid] = $row2[poster_id];
      // IF we made it this far we are allowed to edit this message
      settype($forum,"integer");
      $myrow2 = sql_fetch_assoc(sql_query("SELECT forum_type FROM ".$NPDS_Prefix."forums WHERE (forum_id = '$forum')"));
      $forum_type = $myrow2[forum_type];

      if ($allow_html == 0 || isset($html)) {
         $messageP = htmlspecialchars($messageP);
      }
      if ((!$smile) and ($forum_type!=6) and ($forum_type!=5)) {
         $messageP = smile($messageP);
      }
      if (($forum_type!=6) and ($forum_type!=5)) {
         $messageP = aff_code($messageP);
         $messageP = str_replace("\n", "<br />", removeHack($messageP));
         $messageP .= "<br /><br /><p class=\"lignb\">".translate("This message was edited by")." : $userdata[uname]</p>";
      } else {
         $messageP .= "\n\n".translate("This message was edited by")." : $userdata[uname]";
      }
      $messageP = addslashes($messageP);
   break;
}

  echo "<hr noshade class=\"ongl\"><p align=\"center\" class=\"header\">".translate("Preview")."</p><table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">";
  echo "<tr>";
      if (($forum_type=="6") or ($forum_type=="5"))
         echo "<tr><td wrap style=\"font-color: #000000; background-color: #FBFCFB;\" valign=\"top\" width=\"100%\" height=\"100%\">";
      else
         echo "<tr><td wrap valign=\"top\" width=\"100%\" height=\"100%\">";

      if ($image_subject!="") {
         if ($ibid=theme_image("forum/subject/$image_subject")) {$imgtmp=$ibid;} else {$imgtmp="images/forum/subject/$image_subject";}
         echo "<img src=\"$imgtmp\" border=\"0\" alt=\"\" />";
      } else {
         if ($ibid=theme_image("forum/icons/posticon.gif")) {$imgtmpP=$ibid;} else {$imgtmpP="images/forum/icons/posticon.gif";}
         echo "<img src=\"$imgtmpP\" border=\"0\" alt=\"\" />";
      }
      echo "&nbsp;&nbsp;".translate("Posted: ")."$time";
      echo "<br /><br />\n";
      $messageP=stripslashes($messageP);
      // <a href in the message
      if (stristr($messageP,"<a href")) {
         $messageP=eregi_replace("_blank\"", "_blank\" class=\"noir\"", $messageP);
      }
      if (($forum_type=="6") or ($forum_type=="5")) {
         highlight_string(stripslashes($messageP));
      } else {
         if (($allow_bbcode==1) or(!smile)) {
            $messageP = Smilie($messageP);
         }
         $messageP=str_replace("[addsig]", "", $messageP);
         echo $messageP;
      }
      echo "</td></tr>";
    echo "</table><hr noshade class=\"ongl\">";

if ($acc=="reply"||$acc=="editpost")
   $userdata=$userdatat;
?>