コード例 #1
1
ファイル: functions.inc.php プロジェクト: khanhnnvn/OKMS
function list_comments_without_right($pid, $c = null)
{
    //Return list of comments by post ID without normal rights
    $output = '';
    $default = DEFAULT_AVATAR;
    $post = post_load($pid);
    $comments = comments_load_by_pid($pid);
    usort($comments, 'sort_comment_date_ascend');
    $count = $c == null ? count($comments) : $c;
    $output .= '<div class="comments" id="comments_pid_' . $pid . '" style="display: none">';
    for ($i = 0; $i < $count; $i++) {
        if (isset($comments[$i])) {
            $user = user_load($comments[$i]['User_ID']);
            $comid = $comments[$i]['Comment_ID'];
            $comment_vote = comment_vote_load($comid, $_SESSION['uid']);
            $email = $user['User_Mail'];
            $size = 30;
            $grav_url = $comments[$i]['Comment_Hide_Name'] == 0 && user_existed($comments[$i]['User_ID']) ? "http://0.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?d=" . $default . "&s=" . $size : $default;
            $output .= '<div class="comment">';
            $output .= '<a class="author" href="?p=user/' . $user['User_Username'] . '"><img src="' . $grav_url . '" width="30px"/></a>';
            $output .= '<div class="comment_right_detail">';
            $output .= '<div class="name' . ($user['Role_ID'] == 3 ? ' lecturer' : '') . '">' . ($comments[$i]['Comment_Hide_Name'] == 0 && user_existed($comments[$i]['User_ID']) ? isset($user['User_Fullname']) ? $user['User_Fullname'] : $user['User_Username'] : '******') . '</div>';
            $output .= '<div class="date">' . ago($comments[$i]['Comment_Created']) . ($comments[$i]['Comment_Edited'] != 0 ? ' - edited: ' . ago($comments[$i]['Comment_Edited']) : '') . '</div>';
            $output .= '<p>' . $comments[$i]['Comment_Body'] . '</p>';
            $output .= '<a title="Like this comment" class="button disabled like" id="comment_like_comid_' . $comid . '">' . count_comment_likes($comid) . ' Like' . (count_comment_likes($comid) == 0 || count_comment_likes($comid) == 1 ? '' : 's') . '</a>';
            $output .= '<a title="Dislike this comment" class="button disabled dislike" id="comment_dislike_comid_' . $comid . '">' . count_comment_dislikes($comid) . ' Dislike' . (count_comment_dislikes($comid) == 0 || count_comment_dislikes($comid) == 1 ? '' : 's') . '</a>';
            $output .= '</div>';
            $output .= '</div>';
        }
    }
    $output .= '</div>';
    return $output;
}
コード例 #2
0
ファイル: admin.inc.php プロジェクト: khanhnnvn/OKMS
        $title = 'Account of ' . $user['User_Username'];
        $body_class = 'admin user list';
    } else {
        $title = 'Not authorized';
        $body_class = 'not-authorized';
    }
} elseif (in_array($p, $profile_paths)) {
    $user = user_load_from_name($username);
    $title = 'Profile of ' . (isset($user['User_Fullname']) ? $user['User_Fullname'] : $user['User_Username']);
    $body_class = 'profile';
} elseif (in_array($p, $profile_follow_paths)) {
    $user = user_load_from_name($username);
    $title = 'Following posts of ' . (isset($user['User_Fullname']) ? $user['User_Fullname'] : $user['User_Username']);
    $body_class = 'profile';
} elseif (in_array($p, $post_paths)) {
    $post = post_load($pid);
    $title = $post['Post_Title'];
    $body_class = 'post';
} elseif (in_array($p, $week_paths)) {
    $title = 'Week ' . $week;
    $body_class = 'week week-' . $week;
} elseif (in_array($p, $course_paths)) {
    $course = course_load($cid);
    $title = $course['Course_Code'] . ': ' . $course['Course_Name'] . (isset($_SESSION['uid']) && $course['User_ID'] == $_SESSION['uid'] ? ' - You are coordinator' : '');
    $body_class = 'course';
} elseif (in_array($p, $course_week_paths)) {
    $cid = $course_week['cid'];
    $course = course_load($cid);
    $title = $course['Course_Code'] . ': ' . $course['Course_Name'] . (isset($_SESSION['uid']) && $course['User_ID'] == $_SESSION['uid'] ? ' - You are coordinator' : '') . ' - Week ' . $course_week['week'];
    $body_class = 'course week';
} elseif ($p == 'sitemap') {