' . ($frm_id ? ' AND f.id=' . $frm_id : '') . ' ' . ($th ? ' AND t.id=' . $th : '') . ' ' . (isset($_GET['reply_count']) ? ' AND t.replies=' . (int) $_GET['reply_count'] : '') . ' ' . $unread_limit . ' ' . $perm_limit . ' ORDER BY f.last_post_id, t.last_post_date, m.post_stamp LIMIT ' . qry_limit($count, $start)); /* message drawing code */ $message_data = ''; $n = $prev_frm = $prev_th = ''; while ($r = db_rowobj($c)) { if ($prev_frm != $r->forum_id) { $prev_frm = $r->forum_id; $message_data .= '<tr><th class="SelFS">Forum: <a class="thLnk" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r->forum_id . '&' . _rsid . '"><font class="lg">' . htmlspecialchars($r->name) . '</font></a></th></tr>'; $perms = perms_from_obj($r, $usr->users_opt & 1048576); } if ($prev_th != $r->thread_id) { $thl[] = $r->thread_id; $prev_th = $r->thread_id; $message_data .= '<tr><th class="SelTS"> Topic: <a class="thLnk" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r->id . '&' . _rsid . '">' . $r->thr_subject . '</a></th></tr>'; } if (_uid && $r->last_view < $r->post_stamp && $r->post_stamp > $usr->last_read && !isset($mark_read[$r->thread_id])) { $mark_read[$r->thread_id] = $r->id; } $usr->md = $r->md; $message_data .= tmpl_drawmsg($r, $usr, $perms, false, $n, ''); } un_register_fps(); unset($c); } else {
if (!$thr) { invl_inp_err(); } $frm_id = $thr->forum_id; } else { if ($frm_id) { $th_id = null; } else { std_error('systemerr'); } } $frm = db_sab('SELECT id, name, max_attach_size, forum_opt, max_file_attachments, post_passwd, message_threshold FROM phpgw_fud_forum WHERE id=' . $frm_id); $frm->forum_opt = (int) $frm->forum_opt; /* fetch permissions & moderation status */ $MOD = (int) ($usr->users_opt & 1048576 || $usr->users_opt & 524288 && is_moderator($frm->id, _uid)); $perms = perms_from_obj(db_sab('SELECT group_cache_opt, ' . $MOD . ' as md FROM phpgw_fud_group_cache WHERE user_id IN(' . _uid . ',2147483647) AND resource_id=' . $frm->id . ' ORDER BY user_id ASC LIMIT 1'), $usr->users_opt & 1048576); /* this is a hack, it essentially disables file attachment code when file_uploads are off */ if (ini_get("file_uploads") != 1 || !($perms & 256)) { $post_enctype = ''; $perms = $perms & ~256; } else { $post_enctype = 'enctype="multipart/form-data"'; } /* More Security */ if (isset($thr) && !($perms & 4096) && $thr->thread_opt & 1) { error_dialog('ERRORE: Topic chiuso', 'Questo topic è chiuso, non è più possibile inserire messaggi'); } if (_uid) { /* all sorts of user blocking filters */ is_allowed_user($usr); /* if not moderator, validate user permissions */