コード例 #1
0
ファイル: online.func.php プロジェクト: 994724435/Ride
function online_format(&$online)
{
    global $conf, $grouplist;
    if (empty($online)) {
        return;
    }
    $online['last_date_fmt'] = date('Y-n-j', $online['last_date']);
    $online['groupname'] = $grouplist[$online['gid']]['name'];
    $user = $online['uid'] ? user_read_cache($online['uid']) : user_guest();
    $online['username'] = $user['username'];
}
コード例 #2
0
function post_agree_find_by_pid($pid, $page = 1, $pagesize = 100)
{
    $agreelist = post_agree_find(array('pid' => $pid), array('pid' => 1), $page, $pagesize);
    if (empty($agreelist)) {
        return array();
    }
    foreach ($agreelist as &$agree) {
        $agree['user'] = user_read_cache($agree['uid']);
        $agree['avatar_url'] = $agree['user']['avatar_url'];
        $agree['username'] = $agree['user']['username'];
        $agree['create_date_fmt'] = humandate($agree['create_date']);
    }
    return $agreelist;
}
コード例 #3
0
ファイル: post.func.php プロジェクト: 994724435/Ride
function post_format(&$post)
{
    global $conf;
    if (empty($post)) {
        return;
    }
    $post['create_date_fmt'] = humandate($post['create_date']);
    $user = $post['uid'] ? user_read_cache($post['uid']) : user_guest();
    $post['username'] = $user['username'];
    $post['user_avatar_url'] = $user['avatar_url'];
    !isset($post['floor']) and $post['floor'] = '';
    $post['agrees_class'] = 'agrees_' . thread_get_level($post['agrees'], $conf['agrees_level']);
    // 权限判断
    global $uid, $sid, $longip;
    $post['allowupdate'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['allowdelete'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['user_url'] = "user-{$post['uid']}" . ($post['uid'] ? '' : "-{$post['pid']}") . ".htm";
}
コード例 #4
0
ファイル: user.func.php プロジェクト: 994724435/Ride
function user_find_by_uids($uids)
{
    $uids = trim($uids);
    if (empty($uids)) {
        return array();
    }
    $arr = explode(',', $uids);
    $r = array();
    foreach ($arr as $uid) {
        $user = user_read_cache($uid);
        if (empty($user)) {
            continue;
        }
        $r[$user['uid']] = $user;
    }
    return $r;
}
コード例 #5
0
function thread_format(&$thread)
{
    global $conf, $forumlist;
    if (empty($thread)) {
        return;
    }
    $thread['create_date_fmt'] = humandate($thread['create_date']);
    $thread['last_date_fmt'] = humandate($thread['last_date']);
    $user = user_read_cache($thread['uid']);
    empty($user) and $user = user_guest();
    $thread['username'] = $user['username'];
    $thread['user_avatar_url'] = $user['avatar_url'];
    $forum = $forumlist[$thread['fid']];
    $thread['forumname'] = $forum['name'];
    if ($thread['last_date'] == $thread['create_date']) {
        //$thread['last_date'] = 0;
        $thread['last_date_fmt'] = '';
        $thread['lastuid'] = 0;
        $thread['lastusername'] = '';
    } else {
        $lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
        $thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : '******';
    }
    $thread['seo_url'] = $conf['seo_url_rewrite'] && $thread['url_on'] ? thread_url_read($thread['tid']) : '';
    $thread['url'] = $thread['seo_url'] ? $thread['seo_url'] : "thread-{$thread['tid']}.htm";
    $thread['user_url'] = "user-{$thread['uid']}" . ($thread['uid'] ? '' : "-{$thread['firstpid']}") . ".htm";
    $n = $thread['agrees'] + $thread['posts'];
    $agree_level = thread_get_level($n, $conf['agrees_level']);
    $thread['posts_class'] = 'posts_' . thread_get_level($thread['posts'], $conf['posts_level']);
    $thread['agrees_class'] = 'agrees_' . $agree_level;
    $thread['thread_class'] = 'thread_agrees_' . $agree_level;
    $thread['top_class'] = $thread['top'] ? 'thread_top_' . $thread['top'] : '';
}