$dpmsg_prev_message = '';
}
$private_message_entry = tmpl_drawpmsg($m, $usr, false);
if (!$m->read_stamp && $m->pmsg_opt & 16) {
    q('UPDATE phpgw_fud_pmsg SET read_stamp=' . __request_timestamp__ . ', pmsg_opt=(pmsg_opt & ~ 4) |8 WHERE id=' . $m->id);
    if ($m->ouser_id != _uid && $m->pmsg_opt & 4 && !isset($_GET['dr'])) {
        $track_msg = new fud_pmsg();
        $track_msg->ouser_id = $track_msg->duser_id = $m->ouser_id;
        $track_msg->ip_addr = $track_msg->host_name = null;
        $track_msg->post_stamp = __request_timestamp__;
        $track_msg->read_stamp = 0;
        $track_msg->fldr = 1;
        $track_msg->pmsg_opt = 16 | 32;
        $track_msg->subject = 'Leggi la notifica per il topic: ' . $m->subject;
        $track_msg->body = 'Ciao,<br>' . $usr->login . ' ha letto il tuo messaggio personale, "' . $m->subject . '", ' . strftime("%a, %d %B %Y %H:%M", $m->post_stamp) . '<br>';
        $track_msg->add(1);
    }
}
if ($FUD_OPT_2 & 2) {
    $page_gen_end = gettimeofday();
    $page_gen_time = sprintf('%.5f', $page_gen_end['sec'] - $PAGE_TIME['sec'] + ($page_gen_end['usec'] - $PAGE_TIME['usec']) / 1000000);
    $page_stats = '<br /><div align="left" class="SmallText">Tempo totale richiesto per generare la pagina: ' . $page_gen_time . ' secondi</div>';
} else {
    $page_stats = '';
}
echo $GLOBALS['fud_egw_hdr'];
?>
<table width="100%" border="0" cellspacing="3" cellpadding="5"><tr><td class="ForumBackground">
<?php 
echo $cur_ppage;
echo $tabs;
 $msg_p->subject = htmlspecialchars($msg_p->subject);
 char_fix($msg_p->subject);
 if (empty($_POST['msg_id'])) {
     $msg_p->pmsg_opt = $msg_p->pmsg_opt & ~96;
     if ($_POST['reply']) {
         $msg_p->ref_msg_id = 'R' . $_POST['reply'];
         $msg_p->pmsg_opt |= 64;
     } else {
         if ($_POST['forward']) {
             $msg_p->ref_msg_id = 'F' . $_POST['forward'];
         } else {
             $msg_p->ref_msg_id = null;
             $msg_p->pmsg_opt |= 32;
         }
     }
     $msg_p->add();
 } else {
     $msg_p->id = (int) $_POST['msg_id'];
     $msg_p->sync();
 }
 if (isset($attach_list)) {
     attach_finalize($attach_list, $msg_p->id, 1);
     /* we need to add attachments to all copies of the message */
     if (!isset($_POST['btn_draft'])) {
         $c = uq('SELECT id, original_name, mime_type, fsize FROM phpgw_fud_attach WHERE message_id=' . $msg_p->id . ' AND attach_opt=1');
         while ($r = db_rowarr($c)) {
             $atl[$r[0]] = "'" . addslashes($r[1]) . "', " . $r[2] . ", " . $r[3];
         }
         if (isset($atl)) {
             foreach ($GLOBALS['send_to_array'] as $mid) {
                 foreach ($atl as $k => $v) {