Changeset 1022

Show
Ignore:
Timestamp:
03/12/07 12:10:28 (2 years ago)
Author:
ben
Message:

All icons are now displayed using the user_icon_html function; all user full names are displayed using the user_name function. This is to allow potential plugins to do things like hide names if required (eg in a school situation), and add bling to the icon.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/_files/rss2.php

    r659 r1022  
    2626 
    2727    if ($info = get_record('users','ident',$page_owner)) { 
    28         $name = stripslashes($info->name); 
     28        $name = stripslashes(user_name($info->ident)); 
    2929        $mainurl = $CFG->wwwroot . $info->username . "/files/"; 
    3030        $rssurl = $mainurl . "rss/" . urlencode($tag); 
  • devel/_weblog/rss091.php

    r454 r1022  
    3333END; 
    3434            if ($info = get_record('users','ident',$page_owner)) { 
    35                 $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     35                $name = htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8'); 
    3636                $username = htmlspecialchars($info->username, ENT_COMPAT, 'utf-8'); 
    3737                $sitename = sitename; 
  • devel/_weblog/rss2.php

    r659 r1022  
    7575                                    $rssweblog = $rssdescription; 
    7676                                    break; 
    77                     default:        $name = (stripslashes($info->name)); 
     77                    default:        $name = (stripslashes(user_name($info->ident))); 
    7878                                    $rssdescription = sprintf(__gettext("The weblog for %s, hosted on %s."),$name,$sitename); 
    7979                                    break; 
  • devel/lib/elgglib.php

    r1019 r1022  
    41154115            $title = "[" . __gettext("Restricted") . "] "; 
    41164116            if (substr_count($accessvalue, "community") > 0) { 
    4117                 $name = run("profile:display:name", str_replace("community", '', $accessvalue)); 
     4117                $name = user_name(str_replace("community", '', $accessvalue)); 
    41184118                $title = '<span title="' . __gettext('Restricted to Community: ') . $name . '">' . $title . '</span>'; 
    41194119            } else if (substr_count($accessvalue, "group") > 0) { 
  • devel/lib/templates.php

    r1021 r1022  
    14031403                 
    14041404                foreach($users as $user) { 
     1405                    $icon_html = user_icon_html($user->ident,67); 
    14051406                    $result .= <<< END 
    14061407                     
    14071408                      <td align="center"> 
    14081409                         <div class="image_holder"> 
    1409                          <a href="{$CFG->wwwroot}{$user->username}/"><img src="{$CFG->wwwroot}_icon/user/{$user->iconid}/w/80/h/80" border="0" /></a> 
     1410                         <a href="{$CFG->wwwroot}{$user->username}/">{$icon_html}</a> 
    14101411                         </div> 
    14111412                        <div class="userdetails"> 
  • devel/lib/userlib.php

    r1016 r1022  
    8787         
    8888    } 
     89     
     90    /** 
     91     * Returns a user's name, with event hooks allowing for interception. 
     92     * Internally passes around a "user_name" "display" event, with an object 
     93     * containing the elements 'name' and 'owner'. 
     94     * 
     95     * @uses $CFG 
     96     * @param integer $user_id  The unique ID of the user we want to find the name for. 
     97     * @return string Returns the user's name, or a blank string if something went wrong (eg the user didn't exist). 
     98     */ 
     99     function user_name($user_id) { 
     100         global $CFG; 
     101         $user_name = new stdClass; 
     102         $user_name->owner = $user_id; 
     103         if ($user_name->name = user_info("name",$user_id)) { 
     104             if ($user_name = plugin_hook("user_name","display",$user_name)) { 
     105                 return $user_name->name; 
     106             } 
     107         } 
     108         return ""; 
     109     } 
     110    /** 
     111     * Returns the HTML to display a user's icon, with event hooks allowing for interception. 
     112     * Internally passes around a "user_icon" "display" event, with an object 
     113     * containing the elements 'html', 'icon' (being the icon ID), 'size', 'owner' and 'url'. 
     114     * 
     115     * @uses $CFG 
     116     * @param integer $user_id  The unique ID of the user we want to display the icon for. 
     117     * @param integer $size  The size of the icon we want to display (max: 100). 
     118     * @param boolean $urlonly  If true, returns the URL of the icon rather than the full HTML. 
     119     * @return string Returns the icon HTML, or the default icon if something went wrong (eg the user didn't exist). 
     120     */ 
     121     function user_icon_html($user_id, $size = 100, $urlonly = false) { 
     122         global $CFG; 
     123         $extra = ""; 
     124         $user_icon = new stdClass; 
     125         $user_icon->owner = $user_id; 
     126         $user_icon->size = $size; 
     127         if ($size < 100) { 
     128             $extra = "/h/$size/w/$size"; 
     129         } 
     130         if ($user_icon->icon = user_info("icon",$user_id)) { 
     131             $user_icon->url = "{$CFG->wwwroot}_icon/user/{$user_icon->icon}{$extra}"; 
     132             $user_icon->html = "<img src=\"{$user_icon->url}\" border=\"0\" />"; 
     133             if ($user_icon = plugin_hook("user_icon","display",$user_icon)) { 
     134                 if ($urlonly) { 
     135                    return $user_icon->url; 
     136                 } else { 
     137                    return $user_icon->html; 
     138                } 
     139             } 
     140         } 
     141         if ($urlonly) { 
     142             return -1; 
     143         } else { 
     144             return "<img src=\"{$CFG->wwwroot}_icon/user/-1{$extra}\" border=\"0\" />"; 
     145         } 
     146     } 
    89147     
    90148// USER FLAGS ////////////////////////////////////////////////////////////////// 
  • devel/mod/adash/index.php

    r758 r1022  
    3636    // Initialise page body and title 
    3737        $body = ""; 
    38         $title = run("profile:display:name", $user_id) . " :: " . __gettext("Dashboard"); 
     38        $title = user_name( $user_id) . " :: " . __gettext("Dashboard"); 
    3939         
    4040        templates_page_setup(); 
  • devel/mod/blog/lib.php

    r1016 r1022  
    133133            $data = new stdClass; 
    134134            $data->ident = $page_owner; 
    135             $data->name = run("profile:display:name", $page_owner); 
     135            $data->name = user_name($page_owner); 
    136136            $connections[] = $data; 
    137137            if ($page_owner != $_SESSION['userid']) { 
    138138                $data = new stdClass; 
    139139                $data->ident = $_SESSION['userid']; 
    140                 $data->name = run("profile:display:name", $_SESSION['userid']); 
     140                $data->name = user_name($_SESSION['userid']); 
    141141                $connections[] = $data; 
    142142            } 
     
    195195                        $body .= "<p class=\"frontpage-blog-date\">" . strftime("%B %d, %Y",$post->posted) . "</p>"; 
    196196                        $body .= "<p class=\"frontpage-blog-body\">" . run("weblogs:text:process", $post->body) . "</p>"; 
    197                         $body .= "<p class=\"frontpage-blog-from\">" . __gettext("From:") . " <a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "\">" . user_info("name",$post->weblog) . "</a> - "; 
     197                        $body .= "<p class=\"frontpage-blog-from\">" . __gettext("From:") . " <a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "\">" . user_name($post->weblog) . "</a> - "; 
    198198                        $body .= "<a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "/weblog/" . $post->ident . ".html\">" . __gettext("Read more") . "</a></p>"; 
    199199                        $body .= "</div>"; 
     
    229229                    $body .= "<h4>" . $post->title . "</h4>"; 
    230230                    $body .= "<p class=\"frontpage-blog-date\">" . strftime("%B %d, %Y",$post->posted) . "</p>"; 
    231                     $body .= "<p class=\"frontpage-blog-from\">" . __gettext("From:") . " <a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "\">" . user_info("name",$post->weblog) . "</a> - "; 
     231                    $body .= "<p class=\"frontpage-blog-from\">" . __gettext("From:") . " <a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "\">" . user_name($post->weblog) . "</a> - "; 
    232232                    $body .= "<a href=\"{$CFG->wwwroot}" . user_info("username",$post->weblog) . "/weblog/" . $post->ident . ".html\">" . __gettext("Read more") . "</a></p>"; 
    233233                    $body .= "</div>"; 
  • devel/mod/browser/index.php

    r971 r1022  
    161161                $description = get_field("profile_data", "value", "owner", $result->ident, "name", 'minibio'); 
    162162                 
    163                 $icon = "{$CFG->wwwroot}_icon/user/{$result->icon}"
     163                $icon = user_icon_html($result->ident)
    164164                 
    165165                $name = htmlspecialchars($result->name); 
    166166                 
    167                 $iconcode = "<a href=\"{$CFG->wwwroot}{$result->username}\"><img src=\"{$icon}\" border=\"0\" alt=\"{$result->username}\" /></a>"; 
     167                $iconcode = "<a href=\"{$CFG->wwwroot}{$result->username}\">{$icon_html}</a>"; 
    168168                if (!$displayicons) { 
    169169                    // Uncomment this if we move to Javascript unhide 
  • devel/profile/edit.php

    r1007 r1022  
    4343} 
    4444 
    45 $title = run("profile:display:name", $page_owner) . " :: ". __gettext("Edit profile") .""; 
     45$title = user_name($page_owner) . " :: ". __gettext("Edit profile") .""; 
    4646templates_page_setup(); 
    4747 
  • devel/profile/profile.class.php

    r1007 r1022  
    382382                    } 
    383383                    $friends_username = $info->username; 
    384                     $friends_name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     384                    $friends_name = htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8'); 
    385385                    $friends_menu = run("users:infobox:menu",array($info->ident)); 
     386                    $friends_icon = user_icon_html($info->ident,$width); 
    386387                    $body .= <<< END 
    387388                        <td align="center"> 
    388389                        <p> 
    389390                        <a href="{$CFG->wwwroot}{$friends_username}/"> 
    390                         <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$width}" alt="{$friends_name}" border="0" /></a><br /> 
     391                        {$friends_icon}</a><br /> 
    391392                        <span class="userdetails"> 
    392393                        {$friends_name} 
     
    460461                                          WHERE '.$searchline)) { 
    461462                foreach($result as $key => $info) { 
    462                     $icon = url . '_icon/user/'.$post->icon
     463                    $icon = user_icon_html($info->ident,100,true)
    463464                    $sub_result .= "\t\t\t<item>\n"; 
    464                     $sub_result .= "\t\t\t\t<name><![CDATA[" . htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8') . "]]></name>\n"; 
     465                    $sub_result .= "\t\t\t\t<name><![CDATA[" . htmlspecialchars(stripslashes(user_info($info->ident)), ENT_COMPAT, 'utf-8') . "]]></name>\n"; 
    465466                    $sub_result .= "\t\t\t\t<link>" . url . htmlspecialchars($info->username, ENT_COMPAT, 'utf-8') . "</link>\n"; 
    466467                    $sub_result .= "\t\t\t\t<link>$icon</link>\n"; 
     
    503504                foreach($result as $key => $info) { 
    504505                    $run_result .= "\t<item>\n"; 
    505                     $run_result .= "\t\t<title><![CDATA['" . htmlspecialchars($tagtype, ENT_COMPAT, 'utf-8') . "' = " . htmlspecialchars($tagvalue, ENT_COMPAT, 'utf-8') . " :: " . htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8') . "]]></title>\n"; 
     506                    $run_result .= "\t\t<title><![CDATA['" . htmlspecialchars($tagtype, ENT_COMPAT, 'utf-8') . "' = " . htmlspecialchars($tagvalue, ENT_COMPAT, 'utf-8') . " :: " . htmlspecialchars(stripslashes(user_info($info->ident)), ENT_COMPAT, 'utf-8') . "]]></title>\n"; 
    506507                    $run_result .= "\t\t<link>" . url . htmlspecialchars($info->username, ENT_COMPAT, 'utf-8') . "</link>\n"; 
    507508                    $run_result .= "\t</item>\n"; 
     
    919920        } 
    920921         
    921         $icon = '<img alt="" src="' . url . '_icon/user/' . $info->icon . '/w/67" />'
    922         $name = stripslashes($info->name); 
     922        $icon = user_icon_html($info->ident,67)
     923        $name = stripslashes(user_name($info->ident)); 
    923924        $url = url . $info->username . "/"; 
    924925         
  • devel/profile/rss2.php

    r659 r1022  
    2626     
    2727    if ($info = get_record('users','ident',$page_owner)) { 
    28         $name = stripslashes($info->name); 
     28        $name = stripslashes(user_name($info->ident)); 
    2929        $username = $info->username; 
    3030        $mainurl = url . $username . "/"; 
  • devel/search/personaltags.php

    r667 r1022  
    2424        templates_page_setup(); 
    2525         
    26         $title = run("profile:display:name", $user_id) . " :: " . __gettext("Tags"); 
     26        $title = user_name($user_id) . " :: " . __gettext("Tags"); 
    2727 
    2828        $body = run("content:tags"); 
  • devel/units/communities/communities_edit.php

    r776 r1022  
    2323        } 
    2424        foreach($result as $key => $info) { 
    25             $friends_name = run("profile:display:name",$info->ident); 
     25            $friends_name = user_name($info->ident); 
    2626            $info->icon = run("icons:get",$info->ident); 
    2727            $friends_menu = run("users:infobox:menu",array($info->ident)); 
     28            $friends_icon = user_icon_html($info->ident,$w); 
    2829            $body .= <<< END 
    2930                <td> 
    3031                    <p> 
    3132                    <a href="{$CFG->wwwroot}{$info->username}/"> 
    32                     <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     33                    {$friends_icon}</a><br /> 
    3334                    <span class="userdetails"> 
    3435                        <a href="{$CFG->wwwroot}{$info->username}/">{$friends_name}</a> 
  • devel/units/communities/communities_edit_wrapper.php

    r659 r1022  
    33global $page_owner; 
    44 
    5 $title = run("profile:display:name") . " :: ". __gettext("Communities") .""; 
     5$title = user_name($page_owner) . " :: ". __gettext("Communities") .""; 
    66 
    77$body = run("content:communities:manage"); 
  • devel/units/communities/communities_members.php

    r777 r1022  
    2323        } 
    2424        foreach($result as $key => $info) { 
    25             $friends_name = run("profile:display:name", $info->ident); 
     25            $friends_name = user_name($info->ident); 
    2626            $info->icon = run("icons:get",$info->ident); 
    2727            // $friends_menu = run("users:infobox:menu",array($info->ident)); 
     28            $friends_icon = user_icon_html($info->ident,$w); 
    2829            $body .= <<< END 
    2930                <td> 
    3031                    <p> 
    3132                    <a href="{$CFG->wwwroot}{$info->username}/"> 
    32                     <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     33                    {$friends_icon}</a><br /> 
    3334                    <span class="userdetails"> 
    3435                        {$friends_name} 
  • devel/units/communities/communities_membership_requests.php

    r697 r1022  
    3737                    $body .= templates_draw(array( 
    3838                                                    'context' => 'adminTable', 
    39                                                     'name' => '<img src="' . url . '_icon/user/' . $pending_user->icon . '" />'
     39                                                    'name' => user_icon_html($pending_user->ident)
    4040                                                    'column1' => $col1, 
    4141                                                    'column2' => $col2 
  • devel/units/communities/communities_moderator_of.php

    r690 r1022  
    2323            //    $w = 100; 
    2424            //} 
    25             // $friends_name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
    26             $friends_name = run("profile:display:name", $info->ident); 
     25            $friends_name = user_name($info->ident); 
    2726            $info->icon = run("icons:get",$info->ident); 
    2827            // $friends_menu = run("users:infobox:menu",array($info->ident)); 
     28            $friends_icon = user_icon_html($info->ident,$w); 
    2929            $body .= <<< END 
    3030        <td> 
    3131            <p> 
    3232            <a href="{$CFG->wwwroot}{$info->username}/"> 
    33             <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     33            {$friends_icon}</a><br /> 
    3434            <span class="userdetails"> 
    3535                <a href="{$CFG->wwwroot}{$info->username}/">{$friends_name}</a> 
  • devel/units/communities/userdetails_edit.php

    r687 r1022  
    66         
    77        $info = get_record('users','ident',$page_owner); 
    8         $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     8        $name = htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8'); 
    99        $email = htmlspecialchars(stripslashes($info->email), ENT_COMPAT, 'utf-8'); 
    1010     
  • devel/units/files/function_rss_publish.php

    r659 r1022  
    3636             
    3737            $info = get_record('users','ident',$userid); 
    38             $name = stripslashes($info->name); 
     38            $name = stripslashes(user_name($info->ident)); 
    3939            $username = $info->username; 
    4040            $mainurl = $CFG->wwwroot . $username . "/files/"; 
  • devel/units/files/function_search.php

    r935 r1022  
    129129        foreach($users as $key => $info) { 
    130130            $friends_userid = $info->ident; 
    131             // $friends_name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
    132             $friends_name = run("profile:display:name",$info->ident); 
     131            $friends_name = user_name($info->ident); 
    133132            $info->icon = run("icons:get",$info->ident); 
    134133            $friends_menu = run("users:infobox:menu",array($info->ident)); 
    135134            $link_keyword = urlencode($parameter[1]); 
     135            $friends_icon = user_icon_html($info->ident,$w); 
    136136            $body .= <<< END 
    137137        <td align="center"> 
    138138            <p> 
    139139            <a href="{$CFG->wwwroot}search/index.php?file={$link_keyword}&amp;owner={$friends_userid}"> 
    140             <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     140            {$friends_icon}</a><br /> 
    141141            <span class="userdetails"> 
    142142                {$friends_name} 
  • devel/units/files/function_search_ecl.php

    r454 r1022  
    2525END; 
    2626            if ($info = get_record('users','ident',$page_owner)) { 
    27                 $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     27                $name = htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8'); 
    2828                $username = htmlspecialchars($info->username, ENT_COMPAT, 'utf-8'); 
    2929                $mainurl = url . $username . "/files/"; 
  • devel/units/friends/friends_actions.php

    r861 r1022  
    8181                         delete_records('friends_requests','ident',$request_id); 
    8282                         $messages[] = sprintf(__gettext("You approved the friendship request. %s now lists you as a friend."),stripslashes($request->name)); 
    83                          $message_body = sprintf(__gettext("%s has approved your friendship request!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_info("name",$request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
     83                         $message_body = sprintf(__gettext("%s has approved your friendship request!\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_name($request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
    8484                         $title = sprintf(__gettext("%s friend request approved!"), $CFG->sitename); 
    8585                         notify_user($request->owner,$title,$message_body); 
     
    106106                     delete_records('friends_requests','ident',$request_id); 
    107107                     $messages[] = sprintf(__gettext("You declined the friendship request. %s does not list you as a friend."),stripslashes($request->name)); 
    108                      $message_body = sprintf(__gettext("%s has denied your friendship request.\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your existing friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_info("name",$request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
     108                     $message_body = sprintf(__gettext("%s has denied your friendship request.\n\nTo visit this user's profile, click on the following link:\n\n\t%s\n\nTo view all your existing friends, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."),user_name($request->friend), $CFG->wwwroot . user_info("username",$request->friend) . "/", $CFG->wwwroot . user_info("username",$request->owner) . "/friends/",$CFG->sitename); 
    109109                     $title = sprintf(__gettext("%s friend request denied"), $CFG->sitename); 
    110110                     notify_user($request->owner,$title,$message_body); 
  • devel/units/friends/friends_edit.php

    r776 r1022  
    2626            $info->icon = run("icons:get",$info->ident); 
    2727            $friends_menu = run("users:infobox:menu",array($info->ident)); 
     28            $friends_icon = user_icon_html($info->ident,$w); 
    2829            $body .= <<< END 
    2930        <td> 
    3031            <p> 
    3132            <a href="{$CFG->wwwroot}{$info->username}/"> 
    32             <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     33            {$friends_icon}</a><br /> 
    3334            <span class="userdetails"> 
    3435                <a href="{$CFG->wwwroot}{$info->username}/">{$friends_name}</a> 
  • devel/units/friends/friends_of_edit.php

    r776 r1022  
    3737            $info->icon = run("icons:get",$info->ident); 
    3838            $friends_menu = run("users:infobox:menu",array($info->ident)); 
     39            $friends_icon = user_icon_html($info->ident,$w); 
    3940            $body .= <<< END 
    4041        <td> 
    4142            <p> 
    4243            <a href="{$CFG->wwwroot}{$info->username}/"> 
    43             <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     44            {$friends_icon}</a><br /> 
    4445            <span class="userdetails"> 
    4546                <a href="{$CFG->wwwroot}{$info->username}/">{$friends_name}</a> 
  • devel/units/friends/generate_foaf.php

    r690 r1022  
    1212     
    1313    if ($user->icon != -1) { 
    14         $iconstring = "<foaf:depiction rdf:resource=\"". $CFG->wwwroot . "_icon/user/".$user->icon."\" />"; 
     14        $iconurl = user_icon_html($user->ident,100,true); 
     15        $iconstring = "<foaf:depiction rdf:resource=\"{$iconurl}\" />"; 
    1516    } else { 
    1617        $iconstring = ""; 
     
    5758        $foafurl = $personalurl . "foaf/"; 
    5859        if ($friend->icon != -1) { 
    59             $iconstring = "<foaf:depiction rdf:resource=\"". url . "_icon/user/".$friend->icon."\" />"; 
     60            $iconurl = user_icon_html($friend->ident,100,true); 
     61            $iconstring = "<foaf:depiction rdf:resource=\"{$iconurl}\" />"; 
    6062        } else { 
    6163            $iconstring = ""; 
  • devel/units/friends/user_friendship_requests.php

    r690 r1022  
    4040                    $body .= templates_draw(array( 
    4141                                                        'context' => 'adminTable', 
    42                                                         'name' => "<img src=\"" . url . "_icon/user/{$pending_user->icon}\" />"
     42                                                        'name' => user_icon_html($pending_user->ident)
    4343                                                        'column1' => $col1, 
    4444                                                        'column2' => $col2 
  • devel/units/profile/function_display_name.php

    r557 r1022  
    11<?php 
    22 
    3     // TODO: This should almost certainly be a function rather than a run() command 
    4  
    5     if (!defined('profileinit')) { 
    6         run("profile:init"); 
    7     } 
    8  
    9     global $profile_id; 
    10      
    11     $profile_id = (int) $profile_id; 
    12      
    13     global $name_cache; 
     3    // TODO: remove all references to this that aren't a direct reference to the function 
    144     
    155    if (empty($parameter)) { 
     6        global $profile_id; 
     7        $profile_id = (int) $profile_id; 
    168        $user_id = $profile_id; 
    179    } else { 
     
    1911    } 
    2012     
    21     if (!isset($name_cache[$user_id]) || (time() - $name_cache[$user_id]->created > 60)) { 
    22  
    23         $name_cache[$user_id]->created = time(); 
    24         $name_cache[$user_id]->data = htmlspecialchars(user_info('name',$user_id), ENT_COMPAT, 'utf-8'); 
    25          
    26     } 
    27     $run_result = $name_cache[$user_id]->data; 
     13    $run_result = user_name($user_id); 
    2814     
    2915?> 
  • devel/units/profile/function_rss_publish.php

    r659 r1022  
    3636             
    3737            $info = get_record('users','ident',$userid); 
    38             $name = stripslashes($info->name); 
     38            $name = stripslashes(user_name($info->ident)); 
    3939            //$username = $info->username; 
    4040            $mainurl = url . $username . "/"; 
  • devel/units/profile/function_search.php

    r876 r1022  
    5454                foreach($result as $key => $info) { 
    5555                    $friends_username = $info->username; 
    56                     // $friends_name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
    5756                    $friends_name = run("profile:display:name",$info->ident); 
    5857                    $info->icon = run("icons:get",$info->ident); 
     58                    $friends_icon = user_icon_html($info->ident,$w); 
    5959                    $body .= <<< END 
    6060        <td align="center"> 
    6161            <p> 
    6262            <a href="{$CFG->wwwroot}{$friends_username}/"> 
    63             <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br /> 
     63            {$friends_icon}</a><br /> 
    6464            <span class="userdetails"> 
    6565                <a href="{$CFG->wwwroot}{$friends_username}/">{$friends_name}</a> 
  • devel/units/profile/function_search_ecl.php

    r876 r1022  
    2424                foreach($result as $key => $info) { 
    2525                     
    26                     $icon = url . "_icon/user/".$info->icon
     26                    $icon = user_icon_html($info->ident,100,true)
    2727                     
    2828                    $sub_result .= "\t\t\t<item>\n"; 
    29                     $sub_result .= "\t\t\t\t<name><![CDATA[" . htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8') . "]]></name>\n"; 
     29                    $sub_result .= "\t\t\t\t<name><![CDATA[" . htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8') . "]]></name>\n"; 
    3030                    $sub_result .= "\t\t\t\t<link>" . url . htmlspecialchars($info->username, ENT_COMPAT, 'utf-8') . "</link>\n"; 
    3131                    $sub_result .= "\t\t\t\t<link>$icon</link>\n"; 
  • devel/units/profile/function_search_rss.php

    r876 r1022  
    2222                foreach($result as $key => $info) { 
    2323                    $run_result .= "\t<item>\n"; 
    24                     $run_result .= "\t\t<title><![CDATA['" . htmlspecialchars($parameter[0], ENT_COMPAT, 'utf-8') . "' = " . htmlspecialchars($parameter[1], ENT_COMPAT, 'utf-8') . " :: " . htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8') . "]]></title>\n"; 
     24                    $run_result .= "\t\t<title><![CDATA['" . htmlspecialchars($parameter[0], ENT_COMPAT, 'utf-8') . "' = " . htmlspecialchars($parameter[1], ENT_COMPAT, 'utf-8') . " :: " . htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8') . "]]></title>\n"; 
    2525                    $run_result .= "\t\t<link>" . url . htmlspecialchars($info->username, ENT_COMPAT, 'utf-8') . "</link>\n"; 
    2626                    $run_result .= "\t</item>\n"; 
  • devel/units/profile/profile_user_info.php

    r690 r1022  
    1919$info->icon = run("icons:get", $page_owner); 
    2020 
    21 $icon = '<img alt="" src="'.url. '_icon/user/'.$info->icon.'/h/67/w/67" border="0" />'; // height is the important one here. 
    22 $name = stripslashes($info->name);  
     21$icon = user_icon_html($info->ident,67); 
     22$name = stripslashes(user_name($info->ident));  
    2323//$name = run("profile:display:name"); 
    2424$url = url . $info->username . "/"; 
  • devel/units/rpc/lib/class_user.php

    r690 r1022  
    4949                $this->username        = $info->username; 
    5050                $this->email           = $info->email; 
    51                 $this->name            = $info->name
     51                $this->name            = user_name($info->ident)
    5252                $this->alias           = $info->alias; 
    5353                $this->code            = $info->code; 
     
    8484                } 
    8585 
    86                 $this->icon = url . '_icon/user/' . $info->icon
     86                $this->icon = user_icon_html($info->ident,100,true)
    8787            } 
    8888        } 
  • devel/units/users/main.php

    r963 r1022  
    4444         
    4545    // Display a user's name, given a user ID 
    46         $function['users:display:name'][] = $CFG->dirroot . "units/users/function_display_name.php";// DEPRECATED - use run("profile:display:name", $ident) or user_info("name", $ident
     46        $function['users:display:name'][] = $CFG->dirroot . "units/users/function_display_name.php";// DEPRECATED - use user_name($id
    4747         
    4848    // User details edit screen 
  • devel/units/users/user_info.php

    r659 r1022  
    4545            } 
    4646             
    47             // $username = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
    48             $username = run("profile:display:name", $info->ident); 
     47            $username = user_name($info->ident); 
    4948            $usermenu = ''; 
    5049 
  • devel/units/users/userdetails_edit.php

    r1014 r1022  
    66     
    77    $info = get_record('users','ident',$page_owner); 
    8     $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     8    $name = htmlspecialchars(stripslashes(user_name($info->ident)), ENT_COMPAT, 'utf-8'); 
    99    $email = htmlspecialchars(stripslashes($info->email), ENT_COMPAT, 'utf-8'); 
    1010     
  • devel/units/weblogs/default_template.php

    r819 r1022  
    2727<div class="weblog-post"><!-- Holds all aspects of a blog post --> 
    2828        <div class="user"><!-- Open class user --> 
    29             <a href="{{url}}{{username}}/weblog/"><img alt="" src="{{url}}_icon/user/{{usericon}}"/></a><br /><a href="{{url}}{{username}}/weblog/">{{fullname}}</a> 
     29            <a href="{{url}}{{username}}/weblog/">{{usericon}}</a><br /><a href="{{url}}{{username}}/weblog/">{{fullname}}</a> 
    3030        </div><!-- Close class user --> 
    3131        <div class="weblog-title"><h3>{{title}}</h3></div> 
  • devel/units/weblogs/function_rss_publish.php