Example #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;
}
    echo 'Topic view Query Failed!';
} else {
    //Prepare the table to show the subject of the topic
    echo '<div class="col-sm-8 col-sm-offset-2"><table class="table table-striped table-bordered">';
    while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
        echo '<tr><th  colspan="2" class="text-center">' . $row['topic_subject'] . '</th></tr>';
    }
    //Query database for post content
    $result = mysqli_query($link, $postsql);
    while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) {
        echo '<tr>';
        //User table cell
        echo '<td style="width:15%; text-align: center;">';
        //Link to user profile,
        echo '<span class="glyphicon glyphicon-user"></span><a href="profile.php?id=' . $row['userID'] . '"> ' . $row['username'] . '</a>';
        echo '<br>Posts<br><div class="post_count">' . post_count($row['userID']) . '</div><div class="post_time">';
        //Format Date
        $date = new DateTime($row['post_date']);
        $formatDate = $date->format('Y-M-D H:I:s');
        echo $formatDate;
        echo '</div></td>';
        //Post table cell
        echo '<td style="width:100%;">';
        //Show a Delete button, only if the post is that users, or the post is an admin
        if ($row['post_by'] == $_SESSION['loggedInUser'] || $_SESSION['isAdmin'] == 'yes') {
            echo '<a  title="Delete Post" href="delete_post.php?id=' . $row['post_id'] . '&topic=' . $row['post_topic'] . '">
					<span class="pull-right glyphicon glyphicon-remove-circle"></span></a><a  title="Edit Post" href="edit_post.php?edit=' . $row['post_id'] . '"> 
							<span class="pull-right glyphicon glyphicon-pencil"></span></a><br>';
        }
        echo $row['post_content'];
        echo '</td>';
Example #3
0
    $info = array();
    $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';
}