Example #1
0
        } else {
            pmsg_del((int) $m);
        }
    }
}
if (isset($_GET['folder_id']) && isset($folders[$_GET['folder_id']])) {
    $folder_id = $_GET['folder_id'];
} else {
    if (isset($_POST['folder_id']) && isset($folders[$_POST['folder_id']])) {
        $folder_id = $_POST['folder_id'];
    } else {
        $folder_id = 1;
    }
}
ses_update_status($usr->sid, 'Using private messaging');
$cur_ppage = tmpl_cur_ppage($folder_id, $folders);
$lnk = $folder_id == 4 ? '/egroupware/fudforum/3814588639/index.php?t=pmsg&msg_id' : '';
$author_dest_col = $folder_id == 3 ? 'Recipient' : 'Author';
$select_options_cur_folder = tmpl_draw_select_opt(implode("\n", array_keys($folders)), implode("\n", $folders), $folder_id, '', '');
$disk_usage = q_singleval('SELECT SUM(length) FROM phpgw_fud_pmsg WHERE duser_id=' . _uid);
$percent_full = ceil($disk_usage / $MAX_PMSG_FLDR_SIZE * 100);
$full_indicator = ceil($percent_full * 1.69);
if ($percent_full < 90) {
    $full_indicator = '<td class="pmSn"><img src="blank.gif" alt="" width=' . $full_indicator . ' height="8" /></td>';
} else {
    if ($percent_full >= 90 && $percent_full < 100) {
        $full_indicator = '<td class="pmSa"><img src="blank.gif" alt="" width=' . $full_indicator . ' height="8" /></td>';
    } else {
        $full_indicator = '<td class="pmSf"><img src="blank.gif" alt="" width=' . $full_indicator . ' height="8" /></td>';
    }
}
}
$m = db_sab('SELECT
		p.*,
		u.id AS user_id, u.alias, u.users_opt, u.avatar_loc, u.email, u.posted_msg_count, u.join_date,
		u.location, u.sig, u.icq, u.aim, u.msnm, u.yahoo, u.jabber, u.affero, u.custom_status, u.last_visit,
		l.name AS level_name, l.level_opt, l.img AS level_img
	FROM
		phpgw_fud_pmsg p
		INNER JOIN phpgw_fud_users u ON p.ouser_id=u.id
		LEFT JOIN phpgw_fud_level l ON u.level_id=l.id
	WHERE p.duser_id=' . _uid . ' AND p.id=' . $id);
if (!$m) {
    invl_inp_err();
}
ses_update_status($usr->sid, 'Legge/Scrive i messagi personali');
$cur_ppage = tmpl_cur_ppage($m->fldr, $folders, $m->subject);
/* Next Msg */
if ($nid = q_singleval('SELECT p.id FROM phpgw_fud_pmsg p INNER JOIN phpgw_fud_users u ON u.id=p.ouser_id WHERE p.duser_id=' . _uid . ' AND p.fldr=' . $m->fldr . ' AND post_stamp>' . $m->post_stamp . ' ORDER BY p.post_stamp ASC LIMIT 1')) {
    $dpmsg_next_message = '<a href="/egroupware/fudforum/3814588639/index.php?t=pmsg_view&amp;' . _rsid . '&amp;id=' . $nid . '" class="GenLink">Messaggio successivo <img src="/egroupware/fudforum/3814588639/theme/italian/images/goto.gif" alt="" /></a>';
} else {
    $dpmsg_next_message = '';
}
/* Prev Msg */
if ($pid = q_singleval('SELECT p.id FROM phpgw_fud_pmsg p INNER JOIN phpgw_fud_users u ON u.id=p.ouser_id WHERE p.duser_id=' . _uid . ' AND p.fldr=' . $m->fldr . ' AND p.post_stamp<' . $m->post_stamp . ' ORDER BY p.post_stamp DESC LIMIT 1')) {
    $dpmsg_prev_message = '<a href="/egroupware/fudforum/3814588639/index.php?t=pmsg_view&amp;' . _rsid . '&amp;id=' . $pid . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/italian/images/goback.gif" alt="" /> Messaggio precedente</a>';
} else {
    $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);
        foreach ($tablist as $tab_name => $tab) {
            $tab_url = '/egroupware/fudforum/3814588639/index.php?t=' . $tab . '&amp;' . _rsid;
            if ($tab == 'referals') {
                if (!($FUD_OPT_2 & 8192)) {
                    continue;
                }
                $tab_url .= '&amp;id=' . _uid;
            }
            $tabs .= $pg == $tab ? '<td class="tabA"><div class="tabT"><a href="' . $tab_url . '">' . $tab_name . '</a></div></td>' : '<td class="tabI"><div class="tabT"><a href="' . $tab_url . '">' . $tab_name . '</a></div></td>';
        }
        $tabs = '<table border=0 cellspacing=1 cellpadding=0 class="tab">
<tr class="tab">' . $tabs . '</tr>
</table>';
    }
}
$cur_ppage = tmpl_cur_ppage('', $folders);
$spell_check_button = $FUD_OPT_1 & 2097152 && extension_loaded('pspell') && $usr->pspell_lang ? '<input type="submit" class="button" value="Spell-check Message" name="spell">&nbsp;' : '';
if (isset($_POST['preview']) || isset($_POST['spell'])) {
    $text = apply_custom_replace($_POST['msg_body']);
    $text_s = apply_custom_replace($_POST['msg_subject']);
    if ($FUD_OPT_1 & 4096) {
        $text = tags_to_html($text, $FUD_OPT_1 & 16384);
    } else {
        if ($FUD_OPT_1 & 2048) {
            $text = nl2br(htmlspecialchars($text));
        }
    }
    if ($FUD_OPT_1 & 6144) {
        char_fix($text);
    }
    if ($FUD_OPT_1 & 8192 && !$msg_smiley_disabled) {