コード例 #1
0
ファイル: stats.inc.php プロジェクト: richstokoe/BeehiveForum
function stats_get_html()
{
    // Get webtag
    $webtag = get_webtag();
    // Current active user UID
    $uid = session::get_value('UID');
    // Number of active users
    $session_count = stats_get_active_session_count();
    // Number of recent posts.
    $recent_post_count = stats_get_recent_post_count();
    // Update the stats records.
    stats_update($session_count, $recent_post_count);
    // User Profile link
    $user_profile_link = '%s<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500"><span class="%s" title="%s">%s</span></a>';
    // Newest ser Profile link
    $new_user_profile_link = '<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">%s</a>';
    // Search Engine Bot link
    $search_engine_bot_link = '<a href="%s" target="_blank"><span class="user_stats_normal">%s</span></a>';
    // Output the HTML.
    if ($user_stats = stats_get_active_user_list()) {
        $active_user_list_array = array();
        $html = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td>";
        if (forum_get_setting('guest_show_recent', 'Y') && user_guest_enabled()) {
            if ($user_stats['GUESTS'] != 1) {
                $active_user_list_array[] = sprintf(gettext("<b>%s</b> guests"), $user_stats['GUESTS']);
            } else {
                $active_user_list_array[] = gettext("<b>1</b> guest");
            }
        }
        if ($user_stats['USER_COUNT'] != 1) {
            $active_user_list_array[] = sprintf(gettext("<b>%s</b> members"), $user_stats['USER_COUNT']);
        } else {
            $active_user_list_array[] = gettext("<b>1</b> member");
        }
        if ($user_stats['ANON_USERS'] != 1) {
            $active_user_list_array[] = sprintf(gettext("<b>%s</b> anonymous members"), $user_stats['ANON_USERS']);
        } else {
            $active_user_list_array[] = gettext("<b>1</b> anonymous member");
        }
        $active_user_list = implode(", ", $active_user_list_array);
        $active_user_time = format_time_display(ini_get('session.gc_maxlifetime'), false);
        $html .= sprintf(gettext("%s active in the past %s."), $active_user_list, $active_user_time);
        $html .= " [ <a href=\"start.php?webtag={$webtag}&amp;show=visitors\" target=\"" . html_get_frame_name('main') . "\">" . gettext("View Complete List") . "</a> ]\n";
        $html .= "    </td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        if (sizeof($user_stats['USERS']) > 0) {
            $active_users_array = array();
            foreach ($user_stats['USERS'] as $user) {
                $active_user_title = '';
                $active_user_class = '';
                $active_user_avatar = '';
                if (isset($user['BOT_NAME']) && isset($user['BOT_URL'])) {
                    $active_user_display = word_filter_add_ob_tags($user['BOT_NAME'], true);
                    $active_user_display = sprintf($search_engine_bot_link, $user['BOT_URL'], $active_user_display);
                    $active_users_array[] = $active_user_display;
                } else {
                    $active_user_logon = format_user_name($user['LOGON'], $user['NICKNAME']);
                    $active_user_display = str_replace(" ", "&nbsp;", word_filter_add_ob_tags($active_user_logon, true));
                    if ($user['UID'] == $uid) {
                        if (isset($user['ANON_LOGON']) && $user['ANON_LOGON'] > USER_ANON_DISABLED) {
                            $active_user_title = gettext("You (Invisible)");
                            $active_user_class = 'user_stats_curuser';
                        } else {
                            $active_user_title = gettext("You");
                            $active_user_class = 'user_stats_curuser';
                        }
                    } else {
                        if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) {
                            $active_user_title = gettext("Friend");
                            $active_user_class = 'user_stats_friend';
                        } else {
                            $active_user_class = 'user_stats_normal';
                        }
                    }
                    if (isset($user['AVATAR_URL']) && strlen($user['AVATAR_URL']) > 0) {
                        $active_user_avatar = sprintf('<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">
                                                         <img src="%s" title="%s" alt="" border="0" width="16" height="16" />
                                                       </a>', $webtag, $user['UID'], $user['AVATAR_URL'], htmlentities_array($active_user_title));
                    } else {
                        if (isset($user['AVATAR_AID']) && is_md5($user['AVATAR_AID'])) {
                            $attachment = attachments_get_by_hash($user['AVATAR_AID']);
                            if (!($user_avatar_picture = attachments_make_link($attachment, false, false, false, false))) {
                                $active_user_avatar = sprintf('<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">
                                                             <img src="%s&amp;avatar_picture" title="%s" alt="" border="0" width="16" height="16" />
                                                           </a>', $webtag, $user['UID'], $user_avatar_picture, htmlentities_array($active_user_title));
                            }
                        }
                    }
                    $active_users_array[] = sprintf($user_profile_link, $active_user_avatar, $webtag, $user['UID'], $active_user_class, $active_user_title, $active_user_display);
                }
            }
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>&nbsp;</td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "  <tr>";
            $html .= "    <td>&nbsp;</td>\n";
            $html .= "    <td class=\"activeusers\">\n";
            $html .= "      " . implode(", ", $active_users_array) . "\n";
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
        }
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    $thread_count = stats_get_thread_count();
    $post_count = stats_get_post_count();
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>";
    if ($thread_count != 1) {
        $num_threads_display = sprintf(gettext("<b>%s</b> threads"), number_format($thread_count, 0, ".", ","));
    } else {
        $num_threads_display = gettext("<b>1</b> thread");
    }
    if ($post_count != 1) {
        $num_posts_display = sprintf(gettext("<b>%s</b> posts"), number_format($post_count, 0, ".", ","));
    } else {
        $num_posts_display = gettext("<b>1</b> post");
    }
    $html .= sprintf(gettext("Our members have made a total of %s and %s."), $num_threads_display, $num_posts_display) . '<br />';
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    if ($longest_thread = stats_get_longest_thread()) {
        $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>";
        $longest_thread_title = word_filter_add_ob_tags($longest_thread['TITLE'], true);
        $longest_thread_link = sprintf("<a href=\"./index.php?webtag={$webtag}&amp;msg=%d.1\">%s</a>", $longest_thread['TID'], $longest_thread_title);
        $longest_thread_post_count = $longest_thread['LENGTH'] != 1 ? sprintf(gettext("<b>%s</b> posts"), $longest_thread['LENGTH']) : gettext("<b>1</b> post");
        $html .= sprintf(gettext("Longest thread is <b>%s</b> with %s."), $longest_thread_link, $longest_thread_post_count);
        $html .= "    </td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>";
    if ($recent_post_count != 1) {
        $recent_post_count = number_format($recent_post_count, 0, ",", ",");
        $html .= sprintf(gettext("There have been <b>%s</b> posts made in the last 60 minutes."), $recent_post_count);
    } else {
        $html .= gettext("There has been <b>1</b> post made in the last 60 minutes.");
    }
    $html .= "    </td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    if ($most_posts = stats_get_most_posts()) {
        if ($most_posts['MOST_POSTS_COUNT'] > 0 && $most_posts['MOST_POSTS_DATE'] > 0) {
            $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>";
            $post_stats_record_date = format_time($most_posts['MOST_POSTS_DATE']);
            $html .= sprintf(gettext("Most posts ever made in a single 60 minute period is <b>%s</b> on %s."), $most_posts['MOST_POSTS_COUNT'], $post_stats_record_date);
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "</table>\n";
        }
    }
    if ($user_count = user_count()) {
        $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "    <td>";
        if ($user_count != 1) {
            if ($newest_member = stats_get_newest_user()) {
                $user_newest_display = word_filter_add_ob_tags(format_user_name($newest_member['LOGON'], $newest_member['NICKNAME']), true);
                $user_newest_profile_link = sprintf($new_user_profile_link, $webtag, $newest_member['UID'], $user_newest_display);
                $html .= sprintf(gettext("We have <b>%s</b> registered members and the newest member is <b>%s</b>."), $user_count, $user_newest_profile_link);
            } else {
                $html .= sprintf(gettext("We have %s registered members."), $user_count);
            }
        } else {
            $html .= gettext("We have one registered member.");
        }
        $html .= "    </td>\n";
        $html .= "    <td width=\"35\">&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "</table>\n";
    }
    if ($most_users = stats_get_most_users()) {
        if ($most_users['MOST_USERS_COUNT'] > 0 && $most_users['MOST_USERS_DATE'] > 0) {
            $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
            $html .= "  <tr>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "    <td>";
            $most_users_count = number_format($most_users['MOST_USERS_COUNT'], 0, ",", ",");
            $most_users_date = format_time($most_users['MOST_USERS_DATE']);
            $html .= sprintf(gettext("Most users ever online was <b>%s</b> on %s."), $most_users_count, $most_users_date);
            $html .= "    </td>\n";
            $html .= "    <td width=\"35\">&nbsp;</td>\n";
            $html .= "  </tr>\n";
            $html .= "</table>\n";
        }
    }
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    $html .= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    // Return the output buffer contents.
    return $html;
}
コード例 #2
0
function user_get_profile($uid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    $peer_uid = session::get_value('UID');
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $user_groups_array = array();
    $user_prefs = user_get_prefs($uid);
    $session_gc_maxlifetime = ini_get('session.gc_maxlifetime');
    $session_cutoff_datetime = date(MYSQL_DATETIME, time() - $session_gc_maxlifetime);
    $sql = "SELECT USER.UID, USER.LOGON, USER.NICKNAME, USER_PEER.PEER_NICKNAME, ";
    $sql .= "UNIX_TIMESTAMP(USER_FORUM.LAST_VISIT) AS LAST_VISIT, ";
    $sql .= "UNIX_TIMESTAMP(USER.REGISTERED) AS REGISTERED, ";
    $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_BEST) AS USER_TIME_BEST, ";
    $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_TOTAL) AS USER_TIME_TOTAL, ";
    $sql .= "USER_PEER.RELATIONSHIP, SESSIONS.ID FROM USER USER ";
    $sql .= "LEFT JOIN USER_PREFS USER_PREFS_GLOBAL ON (USER_PREFS_GLOBAL.UID = USER.UID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PREFS` USER_PREFS_FORUM ";
    $sql .= "ON (USER_PREFS_FORUM.UID = USER.UID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ";
    $sql .= "ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$peer_uid}') ";
    $sql .= "LEFT JOIN USER_FORUM USER_FORUM ON (USER_FORUM.UID = USER.UID ";
    $sql .= "AND USER_FORUM.FID = '{$forum_fid}') ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_TRACK` USER_TRACK ";
    $sql .= "ON (USER_TRACK.UID = USER.UID) ";
    $sql .= "LEFT JOIN SESSIONS ON (SESSIONS.UID = USER.UID ";
    $sql .= "AND SESSIONS.TIME >= CAST('{$session_cutoff_datetime}' AS DATETIME)) ";
    $sql .= "WHERE USER.UID = '{$uid}' ";
    $sql .= "GROUP BY USER.UID";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    $user_profile = $result->fetch_assoc();
    if (isset($user_prefs['ANON_LOGON']) && $user_prefs['ANON_LOGON'] > USER_ANON_DISABLED) {
        $anon_logon = $user_prefs['ANON_LOGON'];
    } else {
        $anon_logon = USER_ANON_DISABLED;
    }
    if ($anon_logon == USER_ANON_DISABLED && isset($user_profile['LAST_VISIT']) && $user_profile['LAST_VISIT'] > 0) {
        $user_profile['LAST_LOGON'] = format_time($user_profile['LAST_VISIT']);
    } else {
        $user_profile['LAST_LOGON'] = gettext("Unknown");
    }
    if (isset($user_profile['REGISTERED']) && $user_profile['REGISTERED'] > 0) {
        $user_profile['REGISTERED'] = format_date($user_profile['REGISTERED']);
    } else {
        $user_profile['REGISTERED'] = gettext("Unknown");
    }
    if (isset($user_profile['USER_TIME_BEST']) && $user_profile['USER_TIME_BEST'] > 0) {
        $user_profile['USER_TIME_BEST'] = format_time_display($user_profile['USER_TIME_BEST']);
    } else {
        $user_profile['USER_TIME_BEST'] = gettext("Unknown");
    }
    if (isset($user_profile['USER_TIME_TOTAL']) && $user_profile['USER_TIME_TOTAL'] > 0) {
        $user_profile['USER_TIME_TOTAL'] = format_time_display($user_profile['USER_TIME_TOTAL']);
    } else {
        $user_profile['USER_TIME_TOTAL'] = gettext("Unknown");
    }
    if (isset($user_prefs['DOB_DISPLAY']) && !empty($user_prefs['DOB']) && $user_prefs['DOB'] != "0000-00-00") {
        if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_BOTH) {
            $user_profile['DOB'] = format_birthday($user_prefs['DOB']);
            $user_profile['AGE'] = format_age($user_prefs['DOB']);
        } else {
            if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_DATE) {
                $user_profile['DOB'] = format_birthday($user_prefs['DOB']);
            } else {
                if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_AGE) {
                    $user_profile['AGE'] = format_age($user_prefs['DOB']);
                }
            }
        }
    }
    if (isset($user_prefs['PIC_URL']) && strlen($user_prefs['PIC_URL']) > 0) {
        $user_profile['PIC_URL'] = $user_prefs['PIC_URL'];
    }
    if (isset($user_prefs['PIC_AID']) && is_md5($user_prefs['PIC_AID'])) {
        $user_profile['PIC_AID'] = $user_prefs['PIC_AID'];
    }
    if (isset($user_prefs['AVATAR_URL']) && strlen($user_prefs['AVATAR_URL']) > 0) {
        $user_profile['AVATAR_URL'] = $user_prefs['AVATAR_URL'];
    }
    if (isset($user_prefs['AVATAR_AID']) && is_md5($user_prefs['AVATAR_AID'])) {
        $user_profile['AVATAR_AID'] = $user_prefs['AVATAR_AID'];
    }
    if (isset($user_prefs['HOMEPAGE_URL']) && strlen($user_prefs['HOMEPAGE_URL']) > 0) {
        $user_profile['HOMEPAGE_URL'] = $user_prefs['HOMEPAGE_URL'];
    }
    if (!isset($user_profile['RELATIONSHIP'])) {
        $user_profile['RELATIONSHIP'] = 0;
    }
    if (isset($user_profile['PEER_NICKNAME'])) {
        if (!is_null($user_profile['PEER_NICKNAME']) && strlen($user_profile['PEER_NICKNAME']) > 0) {
            $user_profile['NICKNAME'] = $user_profile['PEER_NICKNAME'];
        }
    }
    if ($anon_logon == USER_ANON_DISABLED) {
        if (isset($user_profile['ID'])) {
            $user_profile['STATUS'] = gettext("Online");
        } else {
            $user_profile['STATUS'] = gettext("Inactive / Offline");
        }
    } else {
        $user_profile['STATUS'] = gettext("Unknown");
    }
    if ($user_post_count = user_get_post_count($uid)) {
        $user_profile['POST_COUNT'] = $user_post_count;
    } else {
        $user_profile['POST_COUNT'] = 0;
    }
    if ($user_local_time = user_format_local_time($user_prefs)) {
        $user_profile['LOCAL_TIME'] = $user_local_time;
    }
    if (user_is_banned($uid)) {
        $user_profile['USER_GROUPS'] = gettext("Banned");
    } else {
        perm_user_get_group_names($uid, $user_groups_array);
        if (sizeof($user_groups_array) > 0) {
            $user_profile['USER_GROUPS'] = implode(', ', $user_groups_array);
        } else {
            $user_profile['USER_GROUPS'] = gettext("Registered");
        }
    }
    return $user_profile;
}
コード例 #3
0
ファイル: stats.inc.php プロジェクト: DeannaG65/BeehiveForum
/**
 * @return string
 */
function stats_get_html()
{
    // Get webtag
    $webtag = get_webtag();
    // Validate the webtag
    forum_check_webtag_available($webtag);
    // Number of active users
    $session_count = stats_get_active_session_count();
    // Number of recent posts.
    $recent_post_count = stats_get_recent_post_count();
    // Update the stats records.
    stats_update($session_count, $recent_post_count);
    // User Profile link
    $user_profile_link = '%s&nbsp;<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500"><span class="%s" title="%s">%s</span></a>';
    // Newest user Profile link
    $new_user_profile_link = '<a href="user_profile.php?webtag=%s&amp;uid=%s" target="_blank" class="popup 650x500">%s</a>';
    // Search Engine Bot link
    $search_engine_bot_link = '<a href="%s" target="_blank"><span class="user_stats_normal">%s</span></a>';
    $html = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
    $html .= "  <tr>\n";
    $html .= "    <td rowspan=\"19\" width=\"35\">&nbsp;</td>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "    <td rowspan=\"19\" width=\"35\">&nbsp;</td>\n";
    $html .= "  </tr>\n";
    // Output the HTML.
    if (($user_stats = stats_get_active_user_list()) !== false) {
        $user_list_array = array();
        $html .= "  <tr>\n";
        $html .= "    <td>";
        if (forum_get_setting('guest_show_recent', 'Y') && user_guest_enabled()) {
            if ($user_stats['GUESTS'] != 1) {
                $user_list_array[] = sprintf(gettext("<b>%s</b> guests"), format_number($user_stats['GUESTS']));
            } else {
                $user_list_array[] = gettext("<b>1</b> guest");
            }
        }
        if ($user_stats['USER_COUNT'] != 1) {
            $user_list_array[] = sprintf(gettext("<b>%s</b> members"), format_number($user_stats['USER_COUNT']));
        } else {
            $user_list_array[] = gettext("<b>1</b> member");
        }
        if ($user_stats['ANON_USERS'] != 1) {
            $user_list_array[] = sprintf(gettext("<b>%s</b> anonymous members"), format_number($user_stats['ANON_USERS']));
        } else {
            $user_list_array[] = gettext("<b>1</b> anonymous member");
        }
        $user_list = implode(", ", $user_list_array);
        $user_time = format_time_display(ini_get('session.gc_maxlifetime'), false);
        $html .= sprintf(gettext("%s active in the past %s."), $user_list, $user_time);
        $html .= " <a href=\"start.php?webtag={$webtag}&amp;show=visitors\" target=\"" . html_get_frame_name('main') . "\">" . gettext("View More Visitors") . "</a>\n";
        $html .= "    </td>\n";
        $html .= "  </tr>\n";
        if (sizeof($user_stats['USERS']) > 0) {
            $users_array = array();
            foreach ($user_stats['USERS'] as $user) {
                $user_avatar = '';
                if (isset($user['BOT_NAME']) && isset($user['BOT_URL'])) {
                    $user_display = word_filter_add_ob_tags($user['BOT_NAME'], true);
                    $user_display = sprintf($search_engine_bot_link, $user['BOT_URL'], $user_display);
                    $users_array[] = $user_display;
                } else {
                    $user_logon = format_user_name($user['LOGON'], $user['NICKNAME']);
                    $user_display = str_replace(" ", "&nbsp;", word_filter_add_ob_tags($user_logon, true));
                    if ($user['UID'] == $_SESSION['UID']) {
                        if (isset($user['ANON_LOGON']) && $user['ANON_LOGON'] > USER_ANON_DISABLED) {
                            $user_title = gettext("You (Invisible)");
                            $user_class = 'user_stats_curuser';
                        } else {
                            $user_title = gettext("You");
                            $user_class = 'user_stats_curuser';
                        }
                    } else {
                        if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) {
                            $user_title = gettext("Friend");
                            $user_class = 'user_stats_friend';
                        } else {
                            $user_class = 'user_stats_normal';
                            $user_title = '';
                        }
                    }
                    if (isset($user['AVATAR_URL']) && filter_var($user['AVATAR_URL'], FILTER_VALIDATE_URL)) {
                        $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s')", $user['AVATAR_URL'])));
                    } else {
                        if (isset($user['AVATAR_AID']) && is_numeric($user['AVATAR_AID'])) {
                            $attachment = attachments_get_by_aid($user['AVATAR_AID']);
                            if (($user_avatar_picture = attachments_make_link($attachment, false, false, false, false)) !== false) {
                                $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s&amp;profile_picture')", $user_avatar_picture)));
                            }
                        }
                    }
                    $users_array[] = sprintf($user_profile_link, $user_avatar, $webtag, $user['UID'], $user_class, $user_title, $user_display);
                }
            }
            $html .= "  <tr>";
            $html .= "    <td class=\"activeusers\">\n";
            $html .= "      " . implode(", ", $users_array) . "\n";
            $html .= "    </td>\n";
            $html .= "  </tr>\n";
        }
        $html .= "  <tr>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "  </tr>\n";
    }
    if (($users_birthdays_array = user_get_todays_birthdays()) !== false) {
        $html .= "  <tr>\n";
        $html .= "    <td>";
        if (count($users_birthdays_array) == 1) {
            $html .= gettext("<b>1</b> member is celebrating their birthday today:");
        } else {
            $html .= sprintf(gettext("<b>%d</b> members are celebrating their birthdays today:"), format_number(count($users_birthdays_array)));
        }
        $html .= "</td>\n";
        $html .= "  </tr>\n";
        $users_array = array();
        foreach ($users_birthdays_array as $user) {
            $user_avatar = '';
            $user_logon = format_user_name($user['LOGON'], $user['NICKNAME']);
            $user_display = str_replace(" ", "&nbsp;", word_filter_add_ob_tags($user_logon, true));
            if ($user['UID'] == $_SESSION['UID']) {
                $user_title = gettext("You");
                $user_class = 'user_stats_curuser';
            } else {
                if (($user['RELATIONSHIP'] & USER_FRIEND) > 0) {
                    $user_title = gettext("Friend");
                    $user_class = 'user_stats_friend';
                } else {
                    $user_class = 'user_stats_normal';
                    $user_title = '';
                }
            }
            if (isset($user['AVATAR_URL']) && filter_var($user['AVATAR_URL'], FILTER_VALIDATE_URL)) {
                $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s')", $user['AVATAR_URL'])));
            } else {
                if (isset($user['AVATAR_AID']) && is_numeric($user['AVATAR_AID'])) {
                    $attachment = attachments_get_by_aid($user['AVATAR_AID']);
                    if (($user_avatar_picture = attachments_make_link($attachment, false, false, false, false)) !== false) {
                        $user_avatar = html_style_image('profile_image profile_image_small', htmlentities_array($user_title), null, array('background-image' => sprintf("url('%s&amp;profile_picture')", $user_avatar_picture)));
                    }
                }
            }
            $users_array[] = sprintf($user_profile_link, $user_avatar, $webtag, $user['UID'], $user_class, $user_title, $user_display);
        }
        $html .= "  <tr>\n";
        $html .= "    <td class=\"birthdayusers\">\n";
        $html .= "      " . implode(", ", $users_array) . "\n";
        $html .= "    </td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "  </tr>\n";
    }
    $thread_count = stats_get_thread_count();
    $post_count = stats_get_post_count();
    $html .= "  <tr>\n";
    $html .= "    <td>";
    if ($thread_count != 1) {
        $num_threads_display = sprintf(gettext("<b>%s</b> threads"), format_number($thread_count));
    } else {
        $num_threads_display = gettext("<b>1</b> thread");
    }
    if ($post_count != 1) {
        $num_posts_display = sprintf(gettext("<b>%s</b> posts"), format_number($post_count));
    } else {
        $num_posts_display = gettext("<b>1</b> post");
    }
    $html .= sprintf(gettext("Our members have made a total of %s and %s."), $num_threads_display, $num_posts_display) . '<br />';
    $html .= "  </tr>\n";
    $html .= "  <tr>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "  </tr>\n";
    if (($longest_thread = stats_get_longest_thread()) !== false) {
        $html .= "  <tr>\n";
        $html .= "    <td>";
        $longest_thread_title = word_filter_add_ob_tags($longest_thread['TITLE'], true);
        $longest_thread_link = sprintf("<a href=\"index.php?webtag={$webtag}&amp;msg=%d.1\">%s</a>", $longest_thread['TID'], $longest_thread_title);
        $longest_thread_post_count = $longest_thread['LENGTH'] != 1 ? sprintf(gettext("<b>%s</b> posts"), format_number($longest_thread['LENGTH'])) : gettext("<b>1</b> post");
        $html .= sprintf(gettext("Longest thread is <b>%s</b> with %s."), $longest_thread_link, $longest_thread_post_count);
        $html .= "    </td>\n";
        $html .= "  </tr>\n";
    }
    if (($most_read_thread = stats_get_most_read_thread()) !== false) {
        $html .= "  <tr>\n";
        $html .= "    <td>";
        $most_read_thread_title = word_filter_add_ob_tags($most_read_thread['TITLE'], true);
        $most_read_thread_link = sprintf("<a href=\"index.php?webtag={$webtag}&amp;msg=%d.1\">%s</a>", $most_read_thread['TID'], $most_read_thread_title);
        $most_read_thread_view_count = $most_read_thread['VIEWCOUNT'] != 1 ? sprintf(gettext("<b>%s</b> views"), format_number($most_read_thread['VIEWCOUNT'])) : gettext("<b>1</b> view");
        $html .= sprintf(gettext("Most read thread is <b>%s</b> with %s."), $most_read_thread_link, $most_read_thread_view_count);
        $html .= "    </td>\n";
        $html .= "  </tr>\n";
    }
    $html .= "  <tr>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "  <tr>\n";
    $html .= "    <td>";
    if ($recent_post_count != 1) {
        $html .= sprintf(gettext("There have been <b>%s</b> posts made in the last 60 minutes."), format_number($recent_post_count));
    } else {
        $html .= gettext("There has been <b>1</b> post made in the last 60 minutes.");
    }
    $html .= "    </td>\n";
    $html .= "  </tr>\n";
    if (($most_posts = stats_get_most_posts()) !== false) {
        if ($most_posts['MOST_POSTS_COUNT'] > 0 && $most_posts['MOST_POSTS_DATE'] > 0) {
            $html .= "  <tr>\n";
            $html .= "    <td>";
            $html .= sprintf(gettext("Most posts ever made in a single 60 minute period is <b>%s</b> on %s."), format_number($most_posts['MOST_POSTS_COUNT']), format_date_time($most_posts['MOST_POSTS_DATE']));
            $html .= "    </td>\n";
            $html .= "  </tr>\n";
        }
    }
    if (($user_count = user_count()) !== false) {
        $html .= "  <tr>\n";
        $html .= "    <td>&nbsp;</td>\n";
        $html .= "  </tr>\n";
        $html .= "  <tr>\n";
        $html .= "    <td>";
        if ($user_count != 1) {
            if (($newest_member = stats_get_newest_user()) !== false) {
                $user_newest_display = word_filter_add_ob_tags(format_user_name($newest_member['LOGON'], $newest_member['NICKNAME']), true);
                $user_newest_profile_link = sprintf($new_user_profile_link, $webtag, $newest_member['UID'], $user_newest_display);
                $html .= sprintf(gettext("We have <b>%s</b> registered members and the newest member is <b>%s</b>."), format_number($user_count), $user_newest_profile_link);
            } else {
                $html .= sprintf(gettext("We have %s registered members."), $user_count);
            }
        } else {
            $html .= gettext("We have one registered member.");
        }
        $html .= "    </td>\n";
        $html .= "  </tr>\n";
    }
    if (($most_users = stats_get_most_users()) !== false) {
        if ($most_users['MOST_USERS_COUNT'] > 0 && $most_users['MOST_USERS_DATE'] > 0) {
            $html .= "  <tr>\n";
            $html .= "    <td>";
            $most_users_date = format_date_time($most_users['MOST_USERS_DATE']);
            $html .= sprintf(gettext("Most users ever online was <b>%s</b> on %s."), format_number($most_users['MOST_USERS_COUNT']), $most_users_date);
            $html .= "    </td>\n";
            $html .= "  </tr>\n";
        }
    }
    $html .= "  <tr>\n";
    $html .= "    <td>&nbsp;</td>\n";
    $html .= "  </tr>\n";
    $html .= "</table>\n";
    // Return the output buffer contents.
    return $html;
}
コード例 #4
0
function visitor_log_browse_items($user_search, $profile_items_array, $page, $sort_by, $sort_dir, $hide_empty, $hide_guests)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($page) || $page < 1) {
        return false;
    }
    $offset = calculate_page_offset($page, 10);
    if (!is_array($profile_items_array)) {
        return false;
    }
    // Fetch the table prefix.
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    // Forum FID which we'll need later.
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    // Permitted columns to sort the results by
    $sort_by_array = array_keys($profile_items_array);
    // Permitted sort directions.
    $sort_dir_array = array('ASC', 'DESC');
    // Check the specified sort by and sort directions. If they're
    // invalid default to LAST_VISIT DESC.
    if (!in_array($sort_by, $sort_by_array)) {
        $sort_by = 'UID';
    }
    if (!in_array($sort_dir, $sort_dir_array)) {
        $sort_dir = 'DESC';
    }
    // Get the current session's UID.
    if (($uid = session::get_value('UID')) === false) {
        return false;
    }
    // Escape the UID just in case.
    $uid = $db->escape($uid);
    // Constant for the relationship
    $user_friend = USER_FRIEND;
    // Named column NULL filtering
    $column_null_filter_having_array = array('POST_COUNT' => '(POST_COUNT IS NOT NULL)', 'LAST_VISIT' => '(LAST_VISIT IS NOT NULL)', 'REGISTERED' => '(REGISTERED IS NOT NULL)', 'USER_TIME_BEST' => '(USER_TIME_BEST IS NOT NULL)', 'USER_TIME_TOTAL' => '(USER_TIME_TOTAL IS NOT NULL)', 'DOB' => '(DOB IS NOT NULL)', 'AGE' => '(AGE IS NOT NULL AND AGE > 0)', 'TIMEZONE' => '(TIMEZONE IS NOT NULL)', 'LOCAL_TIME' => '(LOCAL_TIME IS NOT NULL)');
    // Main Query
    $select_sql = "SELECT SQL_CALC_FOUND_ROWS USER.UID, USER.LOGON, USER.NICKNAME, USER_PEER.RELATIONSHIP, ";
    $select_sql .= "USER_PEER.PEER_NICKNAME, USER_TRACK.POST_COUNT AS POST_COUNT, ";
    $select_sql .= "IF (USER_PREFS_GLOBAL.DOB_DISPLAY > 1, DATE_FORMAT(USER_PREFS_GLOBAL.DOB, '0000-%m-%d'), NULL) AS DOB, ";
    $select_sql .= "IF (USER_PREFS_GLOBAL.DOB_DISPLAY IN (1, 3), 2012 - DATE_FORMAT(USER_PREFS_GLOBAL.DOB, '%Y') - ";
    $select_sql .= "('00-07-07' < DATE_FORMAT(USER_PREFS_GLOBAL.DOB, '00-%m-%d')), ";
    $select_sql .= "NULL) AS AGE, TIMEZONES.TZID AS TIMEZONE, UNIX_TIMESTAMP('2012-07-07 11:03:00') AS LOCAL_TIME, ";
    $select_sql .= "UNIX_TIMESTAMP(USER.REGISTERED) AS REGISTERED, UNIX_TIMESTAMP(USER_TRACK.USER_TIME_BEST) AS USER_TIME_BEST, ";
    $select_sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_TOTAL) AS USER_TIME_TOTAL, ";
    $select_sql .= "COALESCE(USER_PREFS_FORUM.AVATAR_URL, USER_PREFS_GLOBAL.AVATAR_URL) AS AVATAR_URL, ";
    $select_sql .= "COALESCE(USER_PREFS_FORUM.AVATAR_AID, USER_PREFS_GLOBAL.AVATAR_AID) AS AVATAR_AID, ";
    $select_sql .= "SEARCH_ENGINE_BOTS.SID, SEARCH_ENGINE_BOTS.NAME, SEARCH_ENGINE_BOTS.URL, ";
    $select_sql .= "IF (USER_PREFS_GLOBAL.ANON_LOGON = 1, NULL, UNIX_TIMESTAMP(VISITOR_LOG.LAST_LOGON)) AS LAST_VISIT ";
    // Include the selected numeric (PIID) profile items
    $profile_entry_array = array();
    // Include the profile item types and options.
    $profile_item_type_array = array();
    $profile_item_options_array = array();
    // Iterate through them.
    foreach ($sort_by_array as $column) {
        if (is_numeric($column)) {
            $profile_entry_array[$column] = "USER_PROFILE_{$column}.ENTRY AS ENTRY_{$column} ";
            $profile_item_type_array[] = "PROFILE_ITEM_{$column}.TYPE AS PROFILE_ITEM_TYPE_{$column} ";
            $profile_item_options_array[] = "PROFILE_ITEM_{$column}.OPTIONS AS PROFILE_ITEM_OPTIONS_{$column} ";
        }
    }
    // From portion which selects users and guests from the VISITOR_LOG table.
    $from_sql = "FROM VISITOR_LOG LEFT JOIN USER ON (USER.UID = VISITOR_LOG.UID) ";
    // Various joins we need for User's Age, DOB, etc.
    $join_sql = "LEFT JOIN USER_PREFS USER_PREFS_GLOBAL ON (USER_PREFS_GLOBAL.UID = USER.UID) ";
    $join_sql .= "LEFT JOIN `{$table_prefix}USER_PREFS` USER_PREFS_FORUM ON (USER_PREFS_FORUM.UID = USER.UID) ";
    $join_sql .= "LEFT JOIN `{$table_prefix}USER_TRACK` USER_TRACK ON (USER_TRACK.UID = USER.UID) ";
    $join_sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$uid}') ";
    $join_sql .= "LEFT JOIN SEARCH_ENGINE_BOTS ON (SEARCH_ENGINE_BOTS.SID = VISITOR_LOG.SID) ";
    $join_sql .= "LEFT JOIN TIMEZONES ON (TIMEZONES.TZID = USER_PREFS_GLOBAL.TIMEZONE) ";
    // Joins on the selected numeric (PIID) profile items.
    foreach ($sort_by_array as $column) {
        if (is_numeric($column)) {
            $join_sql .= "LEFT JOIN `{$table_prefix}PROFILE_ITEM` PROFILE_ITEM_{$column} ";
            $join_sql .= "ON (PROFILE_ITEM_{$column}.PIID = '{$column}') ";
            $join_sql .= "LEFT JOIN `{$table_prefix}USER_PROFILE` USER_PROFILE_{$column} ";
            $join_sql .= "ON (USER_PROFILE_{$column}.PIID = PROFILE_ITEM_{$column}.PIID ";
            $join_sql .= "AND USER_PROFILE_{$column}.UID = USER.UID ";
            $join_sql .= "AND (USER_PROFILE_{$column}.PRIVACY = 0 ";
            $join_sql .= "OR (USER_PROFILE_{$column}.PRIVACY = 1 ";
            $join_sql .= "AND (USER_PEER.RELATIONSHIP & {$user_friend} > 0)))) ";
        }
    }
    // The Where clause
    $where_query_array = array("VISITOR_LOG.FORUM = '{$forum_fid}'");
    // Having clause for filtering NULL columns.
    $having_query_array = array();
    // Filter by user name / search engine bot name
    if ($user_search !== false && strlen(trim($user_search)) > 0) {
        $user_search = $db->escape(str_replace('%', '', $user_search));
        $user_search_sql = "(USER.LOGON LIKE '{$user_search}%' OR ";
        $user_search_sql .= "USER.NICKNAME LIKE '{$user_search}%')";
        $where_query_array[] = $user_search_sql;
    }
    // Hide Guests
    if ($hide_guests === true) {
        $where_query_array[] = "(USER.UID IS NOT NULL) ";
    }
    // Hide empty or NULL values
    if ($hide_empty === true) {
        foreach ($sort_by_array as $column) {
            if (is_numeric($column)) {
                $having_query_array[] = "(LENGTH(ENTRY_{$column}) > 0) ";
            } else {
                $having_query_array[] = $column_null_filter_having_array[$column];
            }
        }
    }
    // Main query NULL column filtering
    if (sizeof($having_query_array) > 0) {
        $having_sql = sprintf("HAVING %s", implode(" OR ", $having_query_array));
    } else {
        $having_sql = "";
    }
    if (sizeof($where_query_array) > 0) {
        $where_sql = sprintf("WHERE %s", implode(" AND ", $where_query_array));
    } else {
        $where_sql = "";
    }
    // Sort direction specified?
    $order_sql = is_numeric($sort_by) ? "ORDER BY ENTRY_{$sort_by} {$sort_dir} " : "ORDER BY {$sort_by} {$sort_dir} ";
    // Limit the display to 10 per page.
    $limit_sql = "LIMIT {$offset}, 10";
    // Array to store our results in.
    $user_array = array();
    // Combine the profile columns with the main select SQL.
    $query_array_merge = array_merge(array($select_sql), $profile_entry_array, $profile_item_type_array, $profile_item_options_array);
    // Construct final SQL query.
    $sql = implode(",", $query_array_merge) . "{$from_sql} {$join_sql} ";
    $sql .= "{$where_sql} {$having_sql} {$order_sql} {$limit_sql}";
    if (!($result = $db->query($sql))) {
        return false;
    }
    // Fetch the number of total results
    $sql = "SELECT FOUND_ROWS() AS ROW_COUNT";
    if (!($result_count = $db->query($sql))) {
        return false;
    }
    list($user_count) = $result_count->fetch_row();
    // Check if we have any results.
    if ($result->num_rows == 0 && $user_count > 0 && $page > 1) {
        return visitor_log_browse_items($user_search, $profile_items_array, $page - 1, $sort_by, $sort_dir, $hide_empty, $hide_guests);
    }
    while ($user_data = $result->fetch_assoc()) {
        if (isset($user_data['LOGON']) && isset($user_data['PEER_NICKNAME'])) {
            if (!is_null($user_data['PEER_NICKNAME']) && strlen($user_data['PEER_NICKNAME']) > 0) {
                $user_data['NICKNAME'] = $user_data['PEER_NICKNAME'];
            }
        }
        if ($user_data['UID'] == 0) {
            $user_data['LOGON'] = gettext("Guest");
            $user_data['NICKNAME'] = gettext("Guest");
        } else {
            if (!isset($user_data['LOGON']) || is_null($user_data['LOGON'])) {
                $user_data['LOGON'] = gettext("Unknown user");
                $user_data['NICKNAME'] = "";
            }
        }
        if (isset($user_data['LAST_VISIT']) && is_numeric($user_data['LAST_VISIT'])) {
            $user_data['LAST_VISIT'] = format_time($user_data['LAST_VISIT']);
        } else {
            $user_data['LAST_VISIT'] = gettext("Unknown");
        }
        if (isset($user_data['REGISTERED']) && is_numeric($user_data['REGISTERED'])) {
            $user_data['REGISTERED'] = format_date($user_data['REGISTERED']);
        } else {
            $user_data['REGISTERED'] = gettext("Unknown");
        }
        if (isset($user_data['USER_TIME_BEST']) && is_numeric($user_data['USER_TIME_BEST'])) {
            $user_data['USER_TIME_BEST'] = format_time_display($user_data['USER_TIME_BEST']);
        } else {
            $user_data['USER_TIME_BEST'] = gettext("Unknown");
        }
        if (isset($user_data['USER_TIME_TOTAL']) && is_numeric($user_data['USER_TIME_TOTAL'])) {
            $user_data['USER_TIME_TOTAL'] = format_time_display($user_data['USER_TIME_TOTAL']);
        } else {
            $user_data['USER_TIME_TOTAL'] = gettext("Unknown");
        }
        if (!isset($user_data['AGE']) || !is_numeric($user_data['AGE'])) {
            $user_data['AGE'] = gettext("Unknown");
        }
        if (!($user_data['DOB'] = format_birthday($user_data['DOB']))) {
            $user_data['DOB'] = gettext("Unknown");
        }
        $user_data['TIMEZONE'] = timezone_id_to_string($user_data['TIMEZONE']);
        if (isset($user_data['LOCAL_TIME']) && is_numeric($user_data['LOCAL_TIME'])) {
            $user_data['LOCAL_TIME'] = format_time($user_data['LOCAL_TIME']);
        } else {
            $user_data['LOCAL_TIME'] = gettext("Unknown");
        }
        if (!isset($user_data['POST_COUNT']) || !is_numeric($user_data['POST_COUNT'])) {
            $user_data['POST_COUNT'] = 0;
        }
        $user_array[] = $user_data;
    }
    return array('user_count' => $user_count, 'user_array' => $user_array);
}
コード例 #5
0
if (($active_guest_count = stats_get_active_guest_count()) !== false) {
    echo "                <tr>\n";
    echo "                  <td align=\"left\" style=\"white-space: nowrap\" width=\"40%\">", gettext("Number of active guests"), ":&nbsp;</td>\n";
    echo "                  <td align=\"left\">", number_format($active_guest_count, 0, '.', ','), "</td>\n";
    echo "                </tr>\n";
}
if (($most_users = stats_get_most_users()) !== false) {
    echo "                <tr>\n";
    echo "                  <td align=\"left\" style=\"white-space: nowrap\" width=\"40%\">", gettext("Most users ever online"), ":&nbsp;</td>\n";
    echo "                  <td align=\"left\">", sprintf(gettext("%s on %s"), number_format($most_users['MOST_USERS_COUNT'], 0, '.', ','), format_time($most_users['MOST_USERS_DATE'])), "</td>\n";
    echo "                </tr>\n";
}
if (($most_active_user = stats_get_most_active_user()) !== false) {
    echo "                <tr>\n";
    echo "                  <td align=\"left\" style=\"white-space: nowrap\" width=\"40%\">", gettext("Most active user"), ":&nbsp;</td>\n";
    echo "                  <td align=\"left\"><a href=\"user_profile.php?webtag={$webtag}&amp;uid={$most_active_user['UID']}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags(format_user_name($most_active_user['LOGON'], $most_active_user['NICKNAME']), true), "</a> (", format_time_display($most_active_user['TOTAL_TIME'], true), ")</td>\n";
    echo "                </tr>\n";
}
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"3\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
echo "    </tr>\n";
echo "  </table>\n";
echo "  <br />\n";
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"70%\">\n";
echo "    <tr>\n";