function comment_display_single($comment_id, $max_length = NULL) { $sql = "SELECT \n\t\t\t\t\tid,\n\t\t\t\t\tcomment_type,\n\t\t\t\t\tuser,\n\t\t\t\t\tnick,\n\t\t\t\t\temail,\n\t\t\t\t\turl,\n\t\t\t\t\tflattrID,\n\t\t\t\t\tadded,"; if ($max_length !== NULL) { $sql .= "\n\t\t\t\t\tSUBSTRING(`comment`, 1, " . sql_safe($max_length) . ") AS comment"; } else { $sql .= "\n\t\t\t\t\tcomment"; } $sql .= "\n\t\tFROM " . PREFIX . "comment \n\t\tWHERE id=" . sql_safe($comment_id) . ";"; //echo "<br />DEBUG1323: $sql"; if ($cc = mysql_query($sql)) { if ($c = mysql_fetch_array($cc)) { $comment_link = comment_get_link($c['id']); //Skriv ut info om när kommentaren skrevs och av vem echo "<div class=\"comment_head\">"; if ($c['user'] != NULL) { // Kolla om vi har en avatar echo '<a href="' . user_get_link_url($c['user']) . '"><img class="left_avatar leftfloat" src="' . user_get_avatar_path($c['user'], 60) . '"></a>'; } else { if ($c['nick'] != NULL) { //Kolla om vi har en gravatar if ($c['url'] != NULL) { echo '<a href="' . $c['url'] . '">'; } if ($c['email'] != NULL) { echo "<img class=\"left_avatar leftfloat\" src=\"http://www.gravatar.com/avatar/" . md5(strtolower(trim($c['email']))) . "?s=60\" />"; } if ($c['url'] != NULL) { echo '</a>'; } } } echo "<div class=\"date\">"; comment_display_author_text($c['id']); //Eventuell Flattr-knapp if ($c['user'] != NULL && flattr_get_flattr_choice($c['user'], "comment")) { $flattrID = flattr_get_flattrID($c['user']); } else { if ($c['flattrID'] != NULL) { $flattrID = $c['flattrID']; } else { $flattrID = NULL; } } if ($flattrID) { echo "<br />"; flattr_button_show($flattrID, $comment_link, "Comment " . $c['id'] . " - a " . $c['comment_type'] . " comment on " . SITE_URL, $c['comment'], 'compact', 'en_GB'); } echo "</div>"; echo '<div class="clearfix"></div></div>'; echo "<div class=\"comment_body\">"; //Skriv ut kommentar $c_text = str_replace("\n", "<br />", $c['comment']); echo "<p class=\"comment_text\">" . $c_text; if ($max_length !== NULL) { echo "<a href=\"{$comment_link}\">[...]</a>"; } echo "</p>"; echo "</div>"; } } }
function user_display_profile($user_id) { echo '<h1>' . user_get_name($user_id) . '</h1>'; $user_description = user_get_description($user_id); $user_image = user_get_avatar_path($user_id, 180); if (login_check_logged_in_mini() > 0 && isset($_POST['profile_edit']) && $user_id === $_SESSION[PREFIX . 'user_id']) { //Show edit form //TODO: Image echo '<form method="post"> <div class="form-group"> <label for="description_text">' . _("Profile text") . '</label> <textarea class="form-control" id="description_text" name="description">' . $user_description . '</textarea> </div> <div class="form-group"> <label for="avatar_change_div">' . _("Profile image (avatar)") . '</label> <div id="avatar_change_div"> <p>To change your avatar, <a href="http://gravatar.com">go to Gravatar</a>, log in and upload desired picture!</p> <p>Current picture being used for ' . user_get_email($user_id) . ' is:</p> <img class="avatar" src="' . $user_image . '"> </div> </div> <input type="submit" class="btn btn-success" name="profile_save" value="' . _("Save") . '"> </form>'; } else { echo ' <div class="row profile"> <div class="col-md-2"> <img class="avatar" src="' . $user_image . '"> </div> <div class="col-md-10"> <p>' . $user_description . '</p> </div> </div>'; if (login_check_logged_in_mini() > 0 && $user_id == $_SESSION[PREFIX . 'user_id']) { //edit button echo ' <div class="row"> <div class="center"> <form method="post"> <input type="submit" class="btn btn-default" name="profile_edit" value="' . _("Edit profile") . '"> </form> </div> </div> '; } if (function_exists('user_profile_custom_content')) { user_profile_custom_content($user_id); } echo '<div class="col-lg-12">'; comments_show_comments_and_replies($user_id, "user"); echo "</div>"; } }