/** * logged in users * * prints a list of other users who are logged in */ function print_logged_in_users($block = true, $config = "", $side, $index) { global $pgv_lang, $PGV_SESSION_TIME, $TEXT_DIRECTION; $block = true; // Always restrict this block's height // Log out inactive users foreach (get_idle_users(time() - $PGV_SESSION_TIME) as $user_id => $user_name) { if ($user_id != PGV_USER_ID) { userLogout($user_id); } } // List active users $NumAnonymous = 0; $loggedusers = array(); foreach (get_logged_in_users() as $user_id => $user_name) { if (PGV_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline') == 'Y') { $loggedusers[$user_id] = $user_name; } else { $NumAnonymous++; } } $id = "logged_in_users"; $title = print_help_link("index_loggedin_help", "qm", "", false, true); $title .= $pgv_lang["users_logged_in"]; $content = "<table width=\"90%\">"; $LoginUsers = count($loggedusers); if ($LoginUsers == 0 and $NumAnonymous == 0) { $content .= "<tr><td><b>" . $pgv_lang["no_login_users"] . "</b></td></tr>"; } $Advisory = "anon_user"; if ($NumAnonymous > 1) { $Advisory .= "s"; } if ($NumAnonymous > 0) { $pgv_lang["global_num1"] = $NumAnonymous; // Make it visible $content .= "<tr><td><b>" . print_text($Advisory, 0, 1) . "</b></td></tr>"; } $Advisory = "login_user"; if ($LoginUsers > 1) { $Advisory .= "s"; } if ($LoginUsers > 0) { $pgv_lang["global_num1"] = $LoginUsers; // Make it visible $content .= "<tr><td><b>" . print_text($Advisory, 0, 1) . "</b></td></tr>"; } if (PGV_USER_ID) { foreach ($loggedusers as $user_id => $user_name) { $content .= "<tr><td><br />" . PrintReady(getUserFullName($user_id)) . " - " . $user_name; if (PGV_USER_ID != $user_id && get_user_setting($user_id, 'contactmethod') != "none") { $content .= "<br /><a href=\"javascript:;\" onclick=\"return message('" . $user_id . "');\">" . $pgv_lang["message"] . "</a>"; } $content .= "</td></tr>"; } } $content .= "</table>"; global $THEME_DIR; if ($block) { require $THEME_DIR . 'templates/block_small_temp.php'; } else { require $THEME_DIR . 'templates/block_main_temp.php'; } }
static function _usersLoggedInTotal($type = 'all') { global $PGV_SESSION_TIME; foreach (get_idle_users(time() - $PGV_SESSION_TIME) as $user_id => $user_name) { if ($user_id != PGV_USER_ID) { userLogout($user_id); } } $anon = 0; $visible = 0; $x = get_logged_in_users(); foreach ($x as $user_id => $user_name) { if (PGV_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline') == 'Y') { $visible++; } else { $anon++; } } if ($type == 'anon') { return $anon; } elseif ($type == 'visible') { return $visible; } else { return $visible + $anon; } }