<commit_before><?PHP // $Id$

//  Display profile for a particular user

    require_once("../config.php");
    require_once("../mod/forum/lib.php");

    require_variable($id);
    require_variable($course);


    if (! $user = get_record("user", "id", $id) ) {
        error("No such user in this course");
    }

    if (! $course = get_record("course", "id", $course) ) {
        error("No such course id");
    }

    if ($course->category) {
        require_login($course->id);
    }

    add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");

    if ($student = get_record("user_students", "userid", $user->id, "course", $course->id)) {
        $user->lastaccess = $student->timeaccess;
    } else if ($teacher = get_record("user_teachers", "userid", $user->id, "course", $course->id)) {
        $user->lastaccess = $teacher->timeaccess;
    }

    $fullname = fullname($user, isteacher($course->id));
    $personalprofile = get_string("personalprofile");
    $participants = get_string("participants");

    if ($course->category) {
        print_header("$personalprofile: $fullname", "$personalprofile: $fullname", 
                     "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> 
                      <a href=\"index.php?id=$course->id\">$participants</a> -> $fullname",
                      "", "", true, "&nbsp;", navmenu($course));
    } else {
        print_header("$course->fullname: $personalprofile: $fullname", "$course->fullname", 
                     "$fullname", "", "", true, "&nbsp;", navmenu($course));
    }

    if ($course->category and ! isguest() ) {
        if (!isstudent($course->id, $user->id) && !isteacher($course->id, $user->id)) {
            print_heading(get_string("notenrolled", "", $fullname));
            print_footer($course);
            die;
        }
    }

    if ($user->deleted) {
        print_heading(get_string("userdeleted"));
    }

    echo "<table width=\"80%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" class=\"userinfobox\">";
    echo "<tr>";
    echo "<td width=\"100\" valign=\"top\" class=\"userinfoboxside\">";
    print_user_picture($user->id, $course->id, $user->picture, true, false, false);
    echo "</td><td width=\"100%\" bgcolor=\"$THEME->cellcontent\" class=\"userinfoboxcontent\">";


    // Print name and edit button across top

    echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td nowrap>";
    echo "<h3>$fullname</h3>";
    echo "</td><td align=\"right\">";
    if (empty($USER->id)) {
       $currentuser = false;
    } else {
       $currentuser = ($user->id == $USER->id);
    }
    if (($currentuser and !isguest()) or isadmin()) {
        echo "<p><form action=edit.php method=get>";
        echo "<input type=hidden name=id value=\"$id\">";
        echo "<input type=hidden name=course value=\"$course->id\">";
        echo "<input type=submit value=\"".get_string("editmyprofile")."\">";
        echo "</form></p>";
    }
    echo "</td></tr></table>";


    // Print the description

    if ($user->description) {
        echo "<p>".format_text($user->description)."</p><hr>";
    }

    // Print all the little details in a list

    echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"2\"";

    if ($user->city or $user->country) {
        $countries = get_list_of_countries();
        print_row(get_string("location").":", "$user->city, ".$countries["$user->country"]);
    }

    if (isteacher($course->id)) {
        if ($user->address) {
            print_row(get_string("address").":", "$user->address");
        }
        if ($user->phone1) {
            print_row(get_string("phone").":", "$user->phone1");
        }
        if ($user->phone2) {
            print_row(get_string("phone").":", "$user->phone2");
        }
    }

    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
        print_row(get_string("email").":", obfuscate_mailto($user->email));
    }

    if ($user->url) {<commit_msg>Clean output for old entries<commit_after><?PHP // $Id$

//  Display profile for a particular user

    require_once("../config.php");
    require_once("../mod/forum/lib.php");

    require_variable($id);
    require_variable($course);


    if (! $user = get_record("user", "id", $id) ) {
        error("No such user in this course");
    }

    if (! $course = get_record("course", "id", $course) ) {
        error("No such course id");
    }

    if ($course->category) {
        require_login($course->id);
    }

    add_to_log($course->id, "user", "view", "view.php?id=$user->id&course=$course->id", "$user->id");

    if ($student = get_record("user_students", "userid", $user->id, "course", $course->id)) {
        $user->lastaccess = $student->timeaccess;
    } else if ($teacher = get_record("user_teachers", "userid", $user->id, "course", $course->id)) {
        $user->lastaccess = $teacher->timeaccess;
    }

    $fullname = fullname($user, isteacher($course->id));
    $personalprofile = get_string("personalprofile");
    $participants = get_string("participants");

    if ($course->category) {
        print_header("$personalprofile: $fullname", "$personalprofile: $fullname", 
                     "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> 
                      <a href=\"index.php?id=$course->id\">$participants</a> -> $fullname",
                      "", "", true, "&nbsp;", navmenu($course));
    } else {
        print_header("$course->fullname: $personalprofile: $fullname", "$course->fullname", 
                     "$fullname", "", "", true, "&nbsp;", navmenu($course));
    }

    if ($course->category and ! isguest() ) {
        if (!isstudent($course->id, $user->id) && !isteacher($course->id, $user->id)) {
            print_heading(get_string("notenrolled", "", $fullname));
            print_footer($course);
            die;
        }
    }

    if ($user->deleted) {
        print_heading(get_string("userdeleted"));
    }

    echo "<table width=\"80%\" align=\"center\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" class=\"userinfobox\">";
    echo "<tr>";
    echo "<td width=\"100\" valign=\"top\" class=\"userinfoboxside\">";
    print_user_picture($user->id, $course->id, $user->picture, true, false, false);
    echo "</td><td width=\"100%\" bgcolor=\"$THEME->cellcontent\" class=\"userinfoboxcontent\">";


    // Print name and edit button across top

    echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td nowrap>";
    echo "<h3>$fullname</h3>";
    echo "</td><td align=\"right\">";
    if (empty($USER->id)) {
       $currentuser = false;
    } else {
       $currentuser = ($user->id == $USER->id);
    }
    if (($currentuser and !isguest()) or isadmin()) {
        echo "<p><form action=edit.php method=get>";
        echo "<input type=hidden name=id value=\"$id\">";
        echo "<input type=hidden name=course value=\"$course->id\">";
        echo "<input type=submit value=\"".get_string("editmyprofile")."\">";
        echo "</form></p>";
    }
    echo "</td></tr></table>";


    // Print the description

    if ($user->description) {
        echo "<p>".format_text(clean_text($user->description))."</p><hr>";
    }

    // Print all the little details in a list

    echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"2\"";

    if ($user->city or $user->country) {
        $countries = get_list_of_countries();
        print_row(get_string("location").":", "$user->city, ".$countries["$user->country"]);
    }

    if (isteacher($course->id)) {
        if ($user->address) {
            print_row(get_string("address").":", "$user->address");
        }
        if ($user->phone1) {
            print_row(get_string("phone").":", "$user->phone1");
        }
        if ($user->phone2) {
            print_row(get_string("phone").":", "$user->phone2");
        }
    }

    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category) or isteacher($course->id)) {
        print_row(get_string("email").":", obfuscate_mailto($user->email));
    }

    if ($user->url) {
{'fraction_non_alphanumeric': 0.21992458338401655, 'fraction_numerical': 0.006811823379150955, 'mean_word_length': 2.8047200370198984, 'pattern_counts': {'":': 10, '<': 65, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '174966', 'n_tokens_mistral': 2641, 'n_tokens_neox': 2561, 'n_words': 490}