if (!($usr->users_opt & 1048576)) { $fids = implode(',', array_keys(get_all_read_perms(_uid, $usr->users_opt & 524288))); } if (isset($_GET['so']) && !strcasecmp($_GET['so'], 'asc')) { $SORT_ORDER = 'ASC'; $SORT_ORDER_R = 'DESC'; } else { $SORT_ORDER = 'DESC'; $SORT_ORDER_R = 'ASC'; } $post_entry = ''; if ($usr->users_opt & 1048576 || $fids) { $qry_limit = $usr->users_opt & 1048576 ? '' : 'f.id IN (' . $fids . ') AND '; /* we need the total for the pager & we don't trust the user to pass it via GET or POST */ $total = q_singleval("SELECT count(*)\n\t\t\t\t\tFROM phpgw_fud_msg m\n\t\t\t\t\tINNER JOIN phpgw_fud_thread t ON m.thread_id=t.id\n\t\t\t\t\tINNER JOIN phpgw_fud_forum f ON t.forum_id=f.id\n\t\t\t\t\tINNER JOIN phpgw_fud_cat c ON c.id=f.cat_id\n\t\t\t\t\tWHERE " . $qry_limit . " m.apr=1 AND m.poster_id=" . $uid); $c = uq("SELECT f.name, f.id, m.subject, m.id, m.post_stamp\n\t\t\tFROM phpgw_fud_msg m\n\t\t\tINNER JOIN phpgw_fud_thread t ON m.thread_id=t.id\n\t\t\tINNER JOIN phpgw_fud_forum f ON t.forum_id=f.id\n\t\t\tINNER JOIN phpgw_fud_cat c ON c.id=f.cat_id\n\t\t\tWHERE " . $qry_limit . " m.apr=1 AND m.poster_id=" . $uid . "\n\t\t\tORDER BY m.post_stamp " . $SORT_ORDER . " LIMIT " . qry_limit($THREADS_PER_PAGE, $start)); while ($r = db_rowarr($c)) { $post_entry .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td class="GenText"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r[3] . '&' . _rsid . '">' . $r[2] . '</a></td><td class="GenText" nowrap><a href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[1] . '&' . _rsid . '" class="GenLink">' . htmlspecialchars($r[0]) . '</a></td><td class="DateText" nowrap>' . strftime("%a, %d %B %Y %H:%M", $r[4]) . '</td></tr>'; } $pager = tmpl_create_pager($start, $THREADS_PER_PAGE, $total, '/egroupware/fudforum/3814588639/index.php?t=showposts&id=' . $uid . '&' . _rsid); } 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">Total time taken to generate the page: ' . $page_gen_time . ' seconds</div>'; } else { $page_stats = ''; } echo $GLOBALS['fud_egw_hdr']; ?> <table width="100%" border="0" cellspacing="3" cellpadding="5"><tr><td class="ForumBackground">
LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_level l ON u.level_id=l.id LEFT JOIN phpgw_fud_poll p ON m.poll_id=p.id LEFT JOIN phpgw_fud_poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id=' . _uid . ' LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' WHERE m.apr=1 ' . $date_limit . ' ' . ($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])) {
} $c = uq('SELECT f.id, f.name FROM phpgw_fud_forum_notify fn LEFT JOIN phpgw_fud_forum f ON fn.forum_id=f.id WHERE fn.user_id=' . _uid . ' ' . $lmt . ' ORDER BY f.last_post_id DESC'); $subscribed_forum_data = ''; while ($r = db_rowarr($c)) { $subscribed_forum_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td width="100%"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[0] . '&' . _rsid . '">' . htmlspecialchars($r[1]) . '</a></td><td nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=subscribed&frm_id=' . $r[0] . '&' . _rsid . '">Unsubscribe</a> | <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r[0] . '&' . _rsid . '" target="_blank">View Forum</a></td></tr>'; } if (!$subscribed_forum_data) { $subscribed_forum_data = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td colspan=2>No subscribed forums</td></tr>'; } /* Since a person can have MANY subscribed threads, we need a pager & for the pager we need a entry count */ $total = q_singleval('SELECT count(*) FROM phpgw_fud_thread_notify tn LEFT JOIN phpgw_fud_thread t ON tn.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tn.user_id=' . _uid . ' ' . $lmt); if (!isset($_GET['start']) || !($start = (int) $_GET['start'])) { $start = 0; } $subscribed_thread_data = ''; $c = uq('SELECT t.id, m.subject FROM phpgw_fud_thread_notify tn INNER JOIN phpgw_fud_thread t ON tn.thread_id=t.id INNER JOIN phpgw_fud_msg m ON t.root_msg_id=m.id WHERE tn.user_id=' . _uid . ' ' . $lmt . ' ORDER BY t.last_post_id DESC LIMIT ' . qry_limit($THREADS_PER_PAGE, $start)); while ($r = db_rowarr($c)) { $subscribed_thread_data .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td width="100%"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $r[0] . '&' . _rsid . '">' . $r[1] . '</a></td><td nowrap><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=subscribed&th=' . $r[0] . '&' . _rsid . '">Unsubscribe</a> | <a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&th=' . $r[0] . '&' . _rsid . '" target="_blank">View Topic</a></td></tr>'; } if (!$subscribed_thread_data) { $subscribed_thread_data = '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"><td colspan=2>No subscribed topics</td></tr>'; } $pager = tmpl_create_pager($start, $THREADS_PER_PAGE, $total, '/egroupware/fudforum/3814588639/index.php?t=subscribed&a=1&' . _rsid, '#fff'); 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">Total time taken to generate the page: ' . $page_gen_time . ' seconds</div>'; } else { $page_stats = ''; } echo $GLOBALS['fud_egw_hdr'];
function fetch_search_cache($qry, $start, $count, $logic, $srch_type, $order, $forum_limiter, &$total) { if (strncmp($GLOBALS['usr']->lang, 'chinese', 7)) { $cs = array('!\\W!', '!\\s+!'); $cd = array(' ', ' '); $qry = trim(preg_replace($cs, $cd, $qry)); $w = array_unique(explode(' ', strtolower($qry))); $qr = ''; $i = 0; foreach ($w as $v) { $v = trim($v); if (strlen($v) <= 2) { continue; } else { if ($i++ == 10) { /* limit query length to 10 words */ break; } } $qr .= " '" . addslashes($v) . "',"; } if (!$qr) { return; } else { $qr = substr($qr, 0, -1); } } else { /* handling for multibyte languages */ fud_use('isearch.inc'); if (!($w = mb_word_split($qry))) { return; } $qr = implode(',', $w); $i = count($w); } if ($srch_type == 'all') { $tbl = 'index'; $qt = '0'; } else { $tbl = 'title_index'; $qt = '1'; } $qry_lck = md5($qr); /* remove expired cache */ q('DELETE FROM phpgw_fud_search_cache WHERE expiry<' . (__request_timestamp__ - $GLOBALS['SEARCH_CACHE_EXPIRY'])); if (!($total = q_singleval("SELECT count(*) FROM phpgw_fud_search_cache WHERE query_type=" . $qt . " AND srch_query='" . $qry_lck . "'"))) { if (__dbtype__ == 'mysql') { q("INSERT IGNORE INTO phpgw_fud_search_cache (srch_query, query_type, expiry, msg_id, n_match) SELECT '" . $qry_lck . "', " . $qt . ", " . __request_timestamp__ . ", msg_id, count(*) as word_count FROM phpgw_fud_search s INNER JOIN phpgw_fud_" . $tbl . " i ON i.word_id=s.id WHERE word IN(" . $qr . ") GROUP BY msg_id ORDER BY word_count DESC LIMIT 500"); if (!($total = (int) db_affected())) { return; } } else { q("BEGIN; DELETE FROM phpgw_fud_search_cache; INSERT INTO phpgw_fud_search_cache (srch_query, query_type, expiry, msg_id, n_match) SELECT '" . $qry_lck . "', " . $qt . ", " . __request_timestamp__ . ", msg_id, count(*) as word_count FROM phpgw_fud_search s INNER JOIN phpgw_fud_" . $tbl . " i ON i.word_id=s.id WHERE word IN(" . $qr . ") GROUP BY msg_id ORDER BY word_count DESC LIMIT 500; COMMIT;"); } } if ($forum_limiter) { if ($forum_limiter[0] != 'c') { $qry_lmt = ' AND f.id=' . (int) $forum_limiter . ' '; } else { $qry_lmt = ' AND c.id=' . (int) substr($forum_limiter, 1) . ' '; } } else { $qry_lmt = ''; } $qry_lck = "'" . $qry_lck . "'"; $total = q_singleval('SELECT count(*) FROM phpgw_fud_search_cache sc INNER JOIN phpgw_fud_msg m ON m.id=sc.msg_id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE sc.query_type=' . $qt . ' AND sc.srch_query=' . $qry_lck . $qry_lmt . ' ' . ($logic == 'AND' ? ' AND sc.n_match>=' . $i : '') . ' ' . ($GLOBALS['usr']->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 262146) >= 262146)')); if (!$total) { return; } return uq('SELECT u.alias, f.name AS forum_name, f.id AS forum_id, m.poster_id, m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon FROM phpgw_fud_search_cache sc INNER JOIN phpgw_fud_msg m ON m.id=sc.msg_id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE sc.query_type=' . $qt . ' AND sc.srch_query=' . $qry_lck . $qry_lmt . ' ' . ($logic == 'AND' ? ' AND sc.n_match>=' . $i : '') . ' ' . ($GLOBALS['usr']->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 262146) >= 262146)') . ' ORDER BY sc.n_match DESC, m.post_stamp ' . $order . ' LIMIT ' . qry_limit($count, $start)); }
} if ($all_v = empty($_GET['all'])) { $desc = 'all'; } else { $desc = 'none'; } $ttl = q_singleval("SELECT count(*) FROM phpgw_fud_pmsg WHERE duser_id=" . _uid . " AND fldr=" . $folder_id); $count = $usr->posts_ppg ? $usr->posts_ppg : $POSTS_PER_PAGE; $start = empty($_GET['start']) || $_GET['start'] >= $ttl ? 0 : (int) $_GET['start']; $c = uq('SELECT p.id, p.read_stamp, p.post_stamp, p.duser_id, p.ouser_id, p.subject, p.pmsg_opt, p.fldr, p.pdest, u.users_opt, u.alias, u.last_visit AS time_sec, u2.users_opt AS users_opt2, u2.alias AS alias2, u2.last_visit AS time_sec2 FROM phpgw_fud_pmsg p INNER JOIN phpgw_fud_users u ON p.ouser_id=u.id LEFT JOIN phpgw_fud_users u2 ON p.pdest=u2.id WHERE duser_id=' . _uid . ' AND fldr=' . $folder_id . ' ORDER BY post_stamp DESC LIMIT ' . qry_limit($count, $start)); $private_msg_entry = ''; while ($obj = db_rowobj($c)) { switch ($obj->fldr) { case 1: case 2: $action = '<a href="/egroupware/fudforum/3814588639/index.php?t=ppost&' . _rsid . '&reply=' . $obj->id . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/default/images/msg_reply.gif" alt="" /></a> <a href="/egroupware/fudforum/3814588639/index.php?t=ppost&quote=' . $obj->id . '&' . _rsid . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/default/images/msg_quote.gif" alt="" /></a> <a href="/egroupware/fudforum/3814588639/index.php?t=ppost&forward=' . $obj->id . '&' . _rsid . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/default/images/msg_forward.gif" alt="" /></a>'; break; case 3: $obj->users_opt = $obj->users_opt2; $obj->alias = $obj->alias2; $obj->time_sec = $obj->time_sec2; $obj->ouser_id = $obj->pdest; $action = ''; break; case 5:
u.home_page, u.bday, u.last_visit, u.icq, u.aim, u.yahoo, u.msnm, u.jabber, u.affero, u.name, u.email, m.id AS msg_id, m.subject, m.thread_id, t.forum_id, f.name AS frm_name, c.name AS cat_name ' . $perms . ' FROM phpgw_fud_users u LEFT JOIN phpgw_fud_msg m ON m.id=u.u_last_post_id LEFT JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_forum f ON f.id=t.forum_id LEFT JOIN phpgw_fud_cat c ON c.id=f.cat_id ' . $join . ' WHERE ' . $lmt . ' ORDER BY ' . $order_by . ' DESC LIMIT ' . qry_limit($limit, $offset)); $res = 0; while ($r = db_rowobj($c)) { if (!$res) { header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="' . $charset . '"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns="http://purl.org/rss/1.0/"> <channel rdf:about="' . __ROOT__ . '"> <title>' . $FORUM_TITLE . ' RDF feed</title> <link>' . __ROOT__ . '</link> <description>' . $FORUM_TITLE . ' RDF feed</description> </channel>'; $res = 1; } if ($r->bday && $r->bday > 18500000) { $y = substr($r->bday, 0, 4);
t.thread_opt, ' . ($usr->users_opt & 1048576 ? '1' : 'mm.id') . ' AS md, pot.id AS cant_vote, (CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) AS gco FROM phpgw_fud_poll p INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=p.forum_id INNER JOIN phpgw_fud_forum f ON p.forum_id=f.id INNER JOIN phpgw_fud_cat c ON c.id=f.cat_id INNER JOIN phpgw_fud_msg m ON m.poll_id=p.id INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=p.forum_id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=p.forum_id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_users u ON u.id=m.poster_id LEFT JOIN phpgw_fud_poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id=' . _uid . ' WHERE ' . $usr_lmt . ' ' . ($usr->users_opt & 1048576 ? '1=1' : '(mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0)') . ' ORDER BY p.creation_date ' . $oby . ' LIMIT ' . qry_limit($POLLS_PER_PAGE, $start)); while ($obj = db_rowobj($c)) { if (!$obj->total_votes) { $obj->total_votes = '0'; } $vote_lnk = ''; if (!$obj->cant_vote && (!$obj->poll_expiry_date || $obj->poll_expiry_date < __request_timestamp__)) { if ($obj->md || $obj->gco & 512 && (!($obj->thread_opt & 1) || $obj->gco & 4096)) { if (!$obj->max_votes || $obj->total_votes < $obj->max_votes) { $vote_lnk = ' <b>::</b> <a href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $obj->id . '&' . _rsid . '">Vota</a> <b>::</b> '; } } } $view_res_lnk = $obj->total_votes ? '<a href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $obj->id . '&pl_view=' . $obj->poid . '&' . _rsid . '">Vedi risultati</a> <b>::</b> ' : ''; if ($obj->owner && (!($obj->users_opt & 32768) || $usr->users_opt & 1048576) && $FUD_OPT_2 & 32) { $online_indicator = $obj->last_visit > __request_timestamp__ ? '<img src="/egroupware/fudforum/3814588639/theme/italian/images/online.gif" title="' . $user_login . ' è attualmente online" alt="' . $user_login . ' è attualmente online" /> ' : '<img src="/egroupware/fudforum/3814588639/theme/italian/images/offline.gif" title="' . $user_login . ' è attualmente offline" alt="' . $user_login . ' è attualmente offline" /> ';
$start = $total - q_singleval("SELECT count(*) FROM phpgw_fud_msg WHERE thread_id=" . $th_id . " AND apr=1 AND id>=" . $reply_to); $msg_order_by = 'ASC'; } else { $msg_order_by = 'DESC'; } $c = uq('SELECT m.*, t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id, u.id AS user_id, u.alias AS login, u.users_opt, u.last_visit AS time_sec, p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_poll p ON m.poll_id=p.id WHERE m.thread_id=' . $th_id . ' AND m.apr=1 ORDER BY id ' . $msg_order_by . ' LIMIT ' . qry_limit($count, $start)); $message_data = ''; $m_count = 0; while ($obj = db_rowobj($c)) { $message_data .= tmpl_drawmsg($obj, $usr, $perms, true, $m_count, ''); $mid = $obj->id; } un_register_fps(); $minimsg_pager = tmpl_create_pager($start, $count, $total, "javascript: document.post_form.minimsg_pager_switch.value='%s'; document.post_form.submit();", null, false, false); $minimsg = '<br /><br /> <table border=0 width="100%" cellspacing=0 cellpadding=3 class="dashed"> <tr><td class="miniMH">Thread View</td></tr> <tr><td> <table border="0" cellspacing="1" cellpadding="2" class="ContentTable"> ' . $message_data . ' </table>
$mnav_data = '<div align="center" class="GenText" class="manvNoRes">There are no messages matching query.</div>'; } else { $c = uq('SELECT u.alias, f.name AS forum_name, f.id AS forum_id, m.poster_id, m.id, m.thread_id, m.subject, m.poster_id, m.foff, m.length, m.post_stamp, m.file_id, m.icon FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id INNER JOIN phpgw_fud_cat c ON f.cat_id=c.id INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=f.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=f.id AND mm.user_id=' . _uid . ' LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=f.id WHERE m.post_stamp > ' . $tm . ' AND m.apr=1 ' . $qry_lmt . ' ' . ($usr->users_opt & 1048576 ? '' : ' AND (mm.id IS NOT NULL OR ((CASE WHEN g2.id IS NOT NULL THEN g2.group_cache_opt ELSE g1.group_cache_opt END) & 2) > 0)') . ' ORDER BY m.thread_id, t.forum_id, m.post_stamp DESC LIMIT ' . qry_limit($ppg, $start)); $oldf = $oldt = 0; $mnav_data = '<div align="center"> <table border="0" cellspacing="0" cellpadding="0" class="ContentTable">'; while ($r = db_rowobj($c)) { if ($oldf != $r->forum_id) { $mnav_data .= '<tr><th colspan="3"> Forum: <a class="thLnk" href="/egroupware/fudforum/3814588639/index.php?t=' . t_thread_view . '&frm_id=' . $r->forum_id . '&' . _rsid . '"><font clas="lg">' . htmlspecialchars($r->forum_name) . '</font></a></th></tr>'; $oldf = $r->forum_id; } if ($oldt != $r->thread_id) { $mnav_data .= '<tr><th class="RowStyleC"> </th><th colspan="2"> Topic: <a class="thLnk" href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r->id . '&' . _rsid . '">' . $r->subject . '</a></th></tr>'; $oldt = $r->thread_id; } $body = trim_body(read_msg_body($r->foff, $r->length, $r->file_id)); $poster_info = !empty($r->poster_id) ? '<a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&id=' . $r->poster_id . '&' . _rsid . '">' . $r->alias . '</a>' : '' . $GLOBALS['ANON_NICK']; $mnav_data .= '<tr><td class="RowStyleC"> </td><td class="RowStyleC"> </td><td>
} else { $ord = 'id DESC'; } } $usr_login = !empty($_GET['usr_login']) ? trim($_GET['usr_login']) : ''; $usr_email = !empty($_GET['usr_email']) ? trim($_GET['usr_email']) : ''; if ($usr_login) { $qry = "alias LIKE '" . addslashes(htmlspecialchars(str_replace('\\', '\\\\', $usr_login))) . "%' AND"; } else { if ($usr_email) { $qry = "email LIKE '" . addslashes($usr_email) . "%' AND"; } else { $qry = ''; } } $lmt = ' LIMIT ' . qry_limit($count, $start); $admin_opts = $adm ? '<th>Admin Opts.</th>' : ''; $find_user_data = ''; $c = uq('SELECT home_page, users_opt, alias, join_date, posted_msg_count, id FROM phpgw_fud_users WHERE ' . $qry . ' id>1 ORDER BY ' . $ord . ' ' . $lmt); while ($r = db_rowobj($c)) { $pm_link = $FUD_OPT_1 & 1024 && _uid ? '<a href="/egroupware/index.php?menuaction=messenger.uimessenger.compose&message_to=;' . _rsid . '&message_to=' . $u->alias . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/italian/images/msg_pm.gif" alt="" /></a>' : ''; $homepage_link = $r->home_page ? '<a class="GenLink" href="' . $r->home_page . '" target="_blank"><img alt="" src="/egroupware/fudforum/3814588639/theme/italian/images/homepage.gif" /></a>' : ''; $email_link = $FUD_OPT_2 & 1073741824 && $r->users_opt & 16 ? '<a href="/egroupware/fudforum/3814588639/index.php?t=email&toi=' . $r->id . '&' . _rsid . '" class="GenLink"><img src="/egroupware/fudforum/3814588639/theme/italian/images/msg_email.gif" alt="" /></a>' : ''; if ($adm) { $admi = $r->users_opt & 65536 ? '<a href="' . $GLOBALS['WWW_ROOT'] . 'adm/admuser.php?act=block&usr_id=' . $r->id . '&' . _rsid . '">UnBan</a>' : '<a href="' . $GLOBALS['WWW_ROOT'] . 'adm/admuser.php?act=block&usr_id=' . $r->id . '&' . _rsid . '">Ban</a>'; $admi = '<td class="SmallText" nowrap><a href="' . $GLOBALS['WWW_ROOT'] . 'adm/admuser.php?usr_id=' . $r->id . '&' . _rsid . '&act=1">Edit</a> || ' . $admi . '</td>'; } else { $admi = ''; } $find_user_data .= '<tr class="' . alt_var('finduser_alt', 'RowStyleA', 'RowStyleB') . '"><td nowrap class="GenText"><a class="GenLink" href="/egroupware/fudforum/3814588639/index.php?t=usrinfo&id=' . $r->id . '&' . _rsid . '">' . $r->alias . '</a></td><td align="center" nowrap>' . $r->posted_msg_count . '</td><td class="DateText" nowrap>' . strftime("%a, %d %B %Y", $r->join_date) . '</td><td nowrap class="GenText"><a href="/egroupware/fudforum/3814588639/index.php?t=showposts&id=' . $r->id . '&' . _rsid . '" class="GenLink"><img alt="" src="/egroupware/fudforum/3814588639/theme/italian/images/show_posts.gif" /></a> ' . $email_link . '
u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location, u.sig, u.custom_status, u.icq, u.jabber, u.affero, u.aim, u.msnm, u.yahoo, u.users_opt, u.last_visit AS time_sec, l.name AS level_name, l.level_opt, l.img AS level_img, p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes, pot.id AS cant_vote FROM phpgw_fud_msg m INNER JOIN phpgw_fud_thread t ON m.thread_id=t.id INNER JOIN phpgw_fud_forum f ON t.forum_id=f.id LEFT JOIN phpgw_fud_users u ON m.poster_id=u.id LEFT JOIN phpgw_fud_level l ON u.level_id=l.id LEFT JOIN phpgw_fud_poll p ON m.poll_id=p.id LEFT JOIN phpgw_fud_poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id=' . _uid . ' WHERE m.thread_id=' . $_GET['th'] . ' AND m.apr=1 ORDER BY m.id ASC LIMIT ' . qry_limit($count, $_GET['start'])); $obj2 = $message_data = ''; $usr->md = $frm->md; $m_num = 0; while ($obj = db_rowobj($result)) { $message_data .= tmpl_drawmsg($obj, $usr, $perms, false, $m_num, array($_GET['start'], $count)); $obj2 = $obj; } unset($result); un_register_fps(); if (!isset($_GET['prevloaded'])) { th_inc_view_count($frm->id); if (_uid && $obj2) { if ($frm->last_forum_view < $obj2->post_stamp) { user_register_forum_view($frm->forum_id); }