t.forum_id, mm1.id, mm2.id FROM phpgw_fud_ses s LEFT JOIN phpgw_fud_users u ON s.user_id=u.id LEFT JOIN phpgw_fud_msg m ON u.u_last_post_id=m.id LEFT JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_mod mm1 ON mm1.forum_id=t.forum_id AND mm1.user_id=' . _uid . ' LEFT JOIN phpgw_fud_mod mm2 ON mm2.forum_id=s.forum_id AND mm2.user_id=' . _uid . ' WHERE s.time_sec>' . (__request_timestamp__ - $LOGEDIN_TIMEOUT * 60) . ' AND s.user_id!=' . _uid . ' ORDER BY u.alias, s.time_sec DESC'); $action_data = ''; while ($r = db_rowarr($c)) { if ($r[6] & 32768 && !($usr->users_opt & 1048576)) { continue; } if ($r[3]) { $user_login = draw_user_link($r[3], $r[6], $r[4]); $user_login = '******' . $r[1] . '&' . _rsid . '">' . $user_login . '</a>'; if (!$r[9]) { $last_post = 'n.d.'; } else { $last_post = !($usr->users_opt & 1048576) && !$r[11] && empty($limit[$r[10]]) ? 'Non disponi dei permessi necessari per visualizzare questo topic.' : '' . strftime("%a, %d %B %Y %H:%M", $r[9]) . '<br /> <a href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r[7] . '&' . _rsid . '">' . $r[8] . '</a>'; } } else { $user_login = '' . $GLOBALS['ANON_NICK']; $last_post = 'n.d.'; } if (!$r[2] || ($usr->users_opt & 1048576 || !empty($limit[$r[2]]) || $r[12])) { if (($p = strpos($r[0], '?')) !== false) { $action = substr_replace($r[0], '?' . _rsid . '&', $p, 1); } else {
function rebuild_stats_cache($last_msg_id) { $tm_expire = __request_timestamp__ - $GLOBALS['LOGEDIN_TIMEOUT'] * 60; list($obj->last_user_id, $obj->user_count) = db_saq('SELECT MAX(id), count(*)-1 FROM phpgw_fud_users'); $obj->online_users_anon = q_singleval('SELECT count(*) FROM phpgw_fud_ses s WHERE time_sec>' . $tm_expire . ' AND user_id>2000000000'); $obj->online_users_hidden = q_singleval('SELECT count(*) FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768) > 0'); $obj->online_users_reg = q_singleval('SELECT count(*) FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768)=0'); $c = uq('SELECT u.id, u.alias, u.users_opt, u.custom_color FROM phpgw_fud_ses s INNER JOIN phpgw_fud_users u ON u.id=s.user_id WHERE s.time_sec>' . $tm_expire . ' AND (u.users_opt & 32768)=0 ORDER BY s.time_sec DESC LIMIT ' . $GLOBALS['MAX_LOGGEDIN_USERS']); while ($r = db_rowarr($c)) { $obj->online_users_text[$r[0]] = draw_user_link($r[1], $r[2], $r[3]); } q('UPDATE phpgw_fud_stats_cache SET cache_age=' . __request_timestamp__ . ', last_user_id=' . (int) $obj->last_user_id . ', user_count=' . (int) $obj->user_count . ', online_users_anon=' . (int) $obj->online_users_anon . ', online_users_hidden=' . (int) $obj->online_users_hidden . ', online_users_reg=' . (int) $obj->online_users_reg . ', online_users_text=' . strnull(addslashes(@serialize($obj->online_users_text)))); $obj->last_user_alias = q_singleval('SELECT alias FROM phpgw_fud_users WHERE id=' . $obj->last_user_id); $obj->last_msg_subject = q_singleval('SELECT subject FROM phpgw_fud_msg WHERE id=' . $last_msg_id); return $obj; }
LEFT JOIN phpgw_fud_thread t ON m.thread_id=t.id LEFT JOIN phpgw_fud_mod mm ON mm.forum_id=t.forum_id AND mm.user_id=' . _uid . ' INNER JOIN phpgw_fud_group_cache g1 ON g1.user_id=' . (_uid ? '2147483647' : '0') . ' AND g1.resource_id=t.forum_id LEFT JOIN phpgw_fud_group_cache g2 ON g2.user_id=' . _uid . ' AND g2.resource_id=t.forum_id WHERE u.last_visit>' . $today . ' AND ' . (!($usr->users_opt & 1048576) ? "(u.users_opt & 32768)=0 AND" : '') . ' u.id!=' . _uid . ' ORDER BY u.alias, u.last_visit'); /* array(9) { [0]=> string(4) "root" [1]=> string(1) "A" [2]=> string(4) "9944" [3]=> string(10) "1049362510" [4]=> string(5) "green" [5]=> string(6) "456557" [6]=> string(33) "Re: Deactivating TCP checksumming" [7]=> string(10) "1049299437" [8]=> string(1) "6" } */ $user_entries = ''; while ($r = db_rowarr($c)) { $user_login = draw_user_link($r[0], $r[1], $r[4]); $user_login = '******' . $r[2] . '&' . _rsid . '">' . $user_login . '</a>'; if (!$r[7]) { $last_post = 'n/a'; } else { if ($r[10] & 1 || $r[9] || $usr->users_opt & 1048576) { $last_post = '' . strftime("%a, %d %B %Y %H:%M", $r[7]) . '<br /> <a href="/egroupware/fudforum/3814588639/index.php?t=' . d_thread_view . '&goto=' . $r[5] . '&' . _rsid . '">' . $r[6] . '</a>'; } else { $last_post = 'You do not have appropriate permissions needed to see this topic.'; } } $user_entries .= '<tr class="' . alt_var('search_alt', 'RowStyleA', 'RowStyleB') . '"> <td class="GenText">' . $user_login . '</td> <td class="DateText">' . strftime("%H:%M:%S", $r[3]) . '</td> <td class="SmallText">' . $last_post . '</td>