Ejemplo n.º 1
3
function runtime_init()
{
    global $conf;
    $runtime = cache_get('runtime');
    // 实时运行的数据,初始化!
    if ($runtime === NULL || !isset($runtime['users']) || !isset($runtime['onlines'])) {
        $runtime = array();
        $runtime['users'] = user_count();
        $runtime['posts'] = post_count();
        $runtime['threads'] = thread_count();
        $runtime['posts'] -= $runtime['threads'];
        // 减去首帖
        $runtime['todayusers'] = 0;
        $runtime['todayposts'] = 0;
        $runtime['todaythreads'] = 0;
        $runtime['onlines'] = max(1, online_count());
        // runtime_append
        $arr = kv_get('runtime_append');
        is_array($arr) and $runtime += $arr;
        cache_set('runtime', $runtime, TRUE);
    }
    return $runtime;
}
function create_account($dirty_email)
{
    $email = escape($dirty_email);
    if (user_count($email) != 0) {
        echo "signup-failure";
        return;
    }
    if (validate_email($email) == false) {
        echo "signup-failure";
        return;
    }
    $pending_verification = "pending-verification";
    $sql1 = "INSERT INTO account_head (account, email, status)";
    $sql1 .= " VALUES (null, '{$email}', '{$pending_verification}');";
    query($sql1);
    if (user_count($email) == 1) {
        $new_account_num = account_id_from_email($email);
        $time = time();
        $signupString = generate_string();
        $sql2 = "INSERT INTO account_signup (account, code, date_requested)";
        $sql2 .= " VALUES ({$new_account_num}, '{$signupString}', {$time});";
        query($sql2);
        $sql3 = "SELECT * FROM account_signup WHERE account={$new_account_num}";
        $result = query($sql3);
        $count = mysqli_num_rows($result);
        //mail($email,"ProjectPortfolio - Complete signup", "This is the msg telling you to sign up, fart.");
        send_signup_email($email, $signupString);
        if ($count == 1) {
            echo "signup-success";
            return;
        } else {
            $sql4 = "DELETE FROM account_signup WHERE account={$new_account_num}";
            $sql5 = "DELETE FROM account_head WHERE account={$new_account_num}";
            query($sql4);
            query($sql5);
        }
    } else {
        echo "deleting head table failed";
        $sql6 = "DELETE FROM account_head WHERE email={$email}";
        query($sql6);
    }
    echo "signup-failure";
}
Ejemplo n.º 3
1
<?php

!defined('DEBUG') and exit('Access Denied.');
$action = param(1);
if ($action == 'list') {
    $header['title'] = '用户管理';
    $pagesize = 20;
    $srchtype = param(2);
    $keyword = trim(urldecode(param(3)));
    $page = param(4, 0);
    $cond = array();
    if ($keyword) {
        !in_array($srchtype, array('uid', 'username', 'mobile', 'email', 'gid', 'create_ip')) and $srchtype = 'uid';
        $cond[$srchtype] = $srchtype == 'create_ip' ? ip2long($keyword) : $keyword;
    }
    $n = user_count($cond);
    $page = page($page, $n, $pagesize);
    $userlist = user_find($cond, array('uid' => -1), $page, $pagesize);
    $pagehtml = pages("admin/user-list-{$srchtype}-" . urlencode($keyword) . '-{page}.htm', $n, $page, $pagesize);
    foreach ($userlist as &$_user) {
        $_user['group'] = array_value($grouplist, $_user['gid'], '');
    }
    include "./admin/view/user_list.htm";
} elseif ($action == 'create') {
    if ($method == 'GET') {
        $header['title'] = '用户创建';
        include "./admin/view/user_create.htm";
    } elseif ($method == 'POST') {
        $mobile = param('mobile');
        $email = param('email');
        $username = param('username');
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
<div class="inner">
	<ul>
		<li><a href="changepw.php">change password</a></li>
		<li><a href="<?php 
echo $user_data['username'];
?>
">view profile</a></li>
		<li><a href="profile.php">update profile</a></li>
		<li><a href="post_article.php">post article</a></li>
		<?php 
if (superuser($user_data['user_id'], 1) === true) {
    echo '<li><a href="admin.php">admin page</a></li>';
}
?>
	</ul>
</div>
<h4 class="ausers">Active users...</h4>
<div class="usercount">
	<?php 
$user_count = user_count();
$suffix = $user_count != 1 ? 's' : '';
?>
 <!-- daca avem doar 1 user iregistrat vom genera cuvantul user. Daca avem mai mult de un user inregistrat pe site, vom genera cuvantul users. -->
	We currently have <?php 
echo $user_count;
?>
 registered user<?php 
echo $suffix;
?>
.
</div>
<?php

echo user_count();
Ejemplo n.º 7
0
 	 </div><!--wrapper ends here-->
</div><!-- container ends here-->
	
    <div class="clearer"></div>
    <div id="footer-wrap">
    <div id="footer">
    	<div id="copyright">
        	<p>Copyright &#169; 2015.<br />
        
			<?php 
$user_count_z = user_count();
$suffix = $user_count_z != 1 ? 's' : '';
?>
            Currently we have <?php 
echo $user_count_z;
?>
 registerd user<?php 
echo $suffix;
?>
</p>
     	</div><!-- Copyright ends here -->
     
		<div id="about">
            <p><a href="about.php" target="_blank">Developers</a></p>
         </div>
	</div><!--- footer ends here -->
    </div><!--footer-wrap ends here -->
     
</body>
</html>
<div style="vertical-align:bottom">
<h2>User count </h2>><hr />

<div>
<?php 
$suffix = user_count();
$var = $suffix != 1 ? 's' : '';
?>
we have currently  <?php 
echo $suffix;
?>
 user<?php 
echo $var;
?>
 registered
</div>




</div>
Ejemplo n.º 9
0
<?php

require_once "../config.php";
require_once "../function.php";
ob_start();
session_start();
date_default_timezone_set('Asia/Ho_Chi_Minh');
$_SESSION["admin"] = $_COOKIE["admin"];
if ($_SESSION["admin"] != 1) {
    header("refresh: 0; url=/admin.php");
}
require_once "header.php";
echo "<script>\ndocument.getElementById('container').setAttribute('style', 'background: #fff;');\ndocument.getElementById('x1').setAttribute('class', 'active');\n</script>";
echo "\n                    \t<li style='border: 0;'></li>\n                    </ul>\n                </div>\n                <div id='main' style='width: 100%; float: left; padding-left: 19px;'>\n\t\t\t\t<br/>\n\t\t\t\t<form action='' class='jNice'>\n                    \t<fieldset style='width:93%;padding: 10px;margin: 0 0 12px 0;'>\n\t\t\t\t\t\t<legend><b>&nbsp;<img src='./img/statistiques.png'>&nbsp;Thống kê&nbsp;</b></legend>\n\t\t\t\t\t\t<table style='width: 100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Số thành viên</td>\n\t\t\t\t\t\t<td>" . user_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='odd'>\n\t\t\t\t\t\t<td>Số đề kiểm tra</td>\n\t\t\t\t\t\t<td>" . test_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Số lượt xem</td>\n\t\t\t\t\t\t<td>" . settings(view) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='odd'>\n\t\t\t\t\t\t<td>Số lượt tải về</td>\n\t\t\t\t\t\t<td>" . download_count() . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n                        </fieldset>\n\t\t\t\t\t\t<fieldset style='width:93%;padding: 10px;margin: 0 0 12px 0;'>\n\t\t\t\t\t\t<legend><b>&nbsp;<img src='./img/test.png'>&nbsp;Đề kiểm tra mới nhất&nbsp;</b></legend>\n\t\t\t\t\t\t<table cellpadding='0' cellspacing='0' style='width: 100%'>";
$sql = "SELECT * FROM `tests` order by `id` DESC LIMIT 0,5";
$query = @mysql_query($sql);
$record = @mysql_num_rows($query);
// Gán biến tổng số CSDL $record
if ($record != 0) {
    while ($row = @mysql_fetch_array($query)) {
        $i++;
        if ($i % 2 == 0) {
            echo "<tr>";
        } else {
            echo "<tr class='odd'>";
        }
        echo "\n                                <td><a target='_blank' href='../" . strtolower(str_filter($row['title'])) . "." . $row['id'] . ".php'>" . cu_t($row[title], 135) . "</a></td>\n                                <td class='action'><a target='_blank' href='../" . strtolower(str_filter($row['title'])) . "." . $row['id'] . ".php' class='view'>Xem</a><a href='edittest.php?id=" . $row[id] . "' class='edit'>Sửa</a><a href='deltest.php?id=" . $row[id] . "' class='delete'>Xóa</a></td>\n                            </tr>\n";
    }
} else {
    echo "Chưa có đề kiểm tra nào\n                        ";
}
<div class="thumbnail">
	<div class="caption">
		<h4>Total Users</h4>
		<div>
		    <?php 
$all_user_count = user_count("all");
$active_user_count = user_count("active");
$inactive_user_count = user_count("inactive");
$suffix = $all_user_count != 1 ? 's' : '';
?>
            <div>We have <?php 
echo $all_user_count;
?>
 registered user<?php 
echo $suffix;
?>
.</div>
            <div>Active: <?php 
echo $active_user_count;
?>
</div>
            <div>Inactive: <?php 
echo $inactive_user_count;
?>
</div>
		</div>
	</div>
</div><!-- end widget -->
Ejemplo n.º 11
0
/**
 * @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;
}
Ejemplo n.º 12
0
    $info['disable_functions'] = ini_get('disable_functions');
    $info['allow_url_fopen'] = ini_get('allow_url_fopen') ? '是' : '否';
    $info['safe_mode'] = ini_get('safe_mode') ? '是' : '否';
    empty($info['disable_functions']) && ($info['disable_functions'] = '无');
    $info['upload_max_filesize'] = ini_get('upload_max_filesize');
    $info['post_max_size'] = ini_get('post_max_size');
    $info['memory_limit'] = ini_get('memory_limit');
    $info['max_execution_time'] = ini_get('max_execution_time');
    $info['dbversion'] = $db->version();
    $info['SERVER_SOFTWARE'] = array_value($_SERVER, 'SERVER_SOFTWARE', '');
    $info['HTTP_X_FORWARDED_FOR'] = array_value($_SERVER, 'HTTP_X_FORWARDED_FOR', '');
    $info['REMOTE_ADDR'] = array_value($_SERVER, 'REMOTE_ADDR', '');
    $stat = array();
    $stat['threads'] = thread_count();
    $stat['posts'] = post_count();
    $stat['users'] = user_count();
    $stat['attachs'] = attach_count();
    $stat['disk_free_space'] = function_exists('disk_free_space') ? humansize(disk_free_space('./')) : '未知';
    $lastversion = get_last_version($stat);
    // 潜在错误检测,目录可写检测,避免搬家导致的问题。
    $check = array();
    $upload_tmp_dir = ini_get('upload_tmp_dir');
    if (!empty($upload_tmp_dir)) {
        $check['upload_path_check'] = is_writable($upload_tmp_dir) ? "<span class\"red\">{$upload_tmp_dir} 不可写</span>,上传功能会受到影响。" : "<span class=\"green\">{$upload_tmp_dir} 可写</span>";
    } else {
        $check['upload_path_check'] = "<span class=\"red\">php.ini 中未设置 upload_tmp_dir,可能会导致上传失败 </span>";
    }
    $check['php_ini'] = ini_get('upload_tmp_dir');
    include './admin/view/index.htm';
}
function get_last_version($stat)