1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Avatar paths fix

This commit is contained in:
Cameron
2013-04-22 13:43:06 -07:00
parent 459d0c5395
commit a47591d654
3 changed files with 36 additions and 15 deletions

View File

@@ -421,7 +421,7 @@ class user_shortcodes extends e_shortcode
if (USERID == $this->var['user_id'])
{
//return "<a href='".$url->create('user/myprofile/edit')."'>".LAN_USER_38."</a>";
return "<a href='usersettings.php' alt=''>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
return "<a href='usersettings.php'>".LAN_USER_38."</a>"; // TODO: repair dirty fix for usersettings
}
else if(ADMIN && getperms("4") && !$this->var['user_admin'])
{
@@ -469,6 +469,9 @@ class user_shortcodes extends e_shortcode
function sc_user_picture($parm)
{
$tp = e107::getParser();
return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_sess']."}",true);
if ($this->var['user_sess'] && file_exists(e_MEDIA."avatars/".$this->var['user_sess']))
{
//return $tp->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}", true); // this one will resize.

View File

@@ -5,8 +5,8 @@ function user_avatar_shortcode($parm='')
global $loop_uid;
$height = e107::getPref("im_height",100);
$width = e107::getPref("im_width",100);
//$height = e107::getPref("im_height",100); // these prefs are too limiting.
//$width = e107::getPref("im_width",100);
$tp = e107::getParser();
if(intval($loop_uid) > 0 && trim($parm) == "")
@@ -39,6 +39,8 @@ function user_avatar_shortcode($parm='')
$image = "";
}
$genericImg = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
if (vartrue($image))
{
@@ -47,25 +49,35 @@ function user_avatar_shortcode($parm='')
{
$img = $image;
}
elseif(file_exists(e_AVATAR_DEFAULT.$image)) // Local Default Image
elseif(substr($image,0,8) == "-upload-")
{
$img = $tp->thumbUrl(e_AVATAR_DEFAULT.$image,"w=".$width."&h=".$height,true);
$image = substr($image,8); // strip the -upload- from the beginning.
if(file_exists(e_AVATAR_UPLOAD.$image)) // Local Default Image
{
$img = $tp->thumbUrl(e_AVATAR_UPLOAD.$image,"w=".$width."&h=".$height,true);
}
else
{
$img = $genericImg;
}
}
elseif(file_exists(e_AVATAR_UPLOAD.$image)) // User-Uplaoded Image
elseif(file_exists(e_AVATAR_DEFAULT.$image)) // User-Uplaoded Image
{
$img = $tp->thumbUrl(e_AVATAR_UPLOAD.$image,"w=".$width."&h=".$height,true);
$img = $tp->thumbUrl(e_AVATAR_DEFAULT.$image,"w=".$width."&h=".$height,true);
}
else // Image Missing.
{
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
$img = $genericImg;
}
}
else // No image provided - so send generic.
{
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
$img = $genericImg;
}
$text = "<img class='img-rounded user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />";
$title = (ADMIN) ? $image : "";
$text = "<img class='img-rounded user-avatar e-tip' title='".$title."' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />";
// return $img;
return $text;

View File

@@ -62,6 +62,7 @@ $USER_SHORT_TEMPLATE_START = "
</tr>
</thead>
<tbody>
{SETIMAGE: w=40}
";
$USER_SHORT_TEMPLATE_END = "
</tbody>
@@ -71,7 +72,7 @@ $USER_SHORT_TEMPLATE_END = "
$USER_SHORT_TEMPLATE = "
<tr>
<td class='forumheader3' style='width:2%'>{USER_ICON_LINK}</td>
<td class='forumheader3' style='width:2%'>{USER_PICTURE}</td>
<td class='forumheader3' style='width:20%'>{USER_ID}: {USER_NAME_LINK}</td>
<td class='forumheader3' style='width:20%'>{USER_EMAIL}</td>
<td class='forumheader3' style='width:20%'>{USER_JOIN}</td>
@@ -95,6 +96,7 @@ $sc_style['USER_RATING']['post'] = "</div></td></tr>";
$sc_style['USER_LOGINNAME']['pre'] = " : ";
//FIXME TODO - Remove IF statements from template.
if(isset($pref['photo_upload']) && $pref['photo_upload'])
{
$user_picture = "{USER_PICTURE}";
@@ -116,17 +118,21 @@ $span = 4;
if ($tp->parseTemplate("{USER_SENDPM}", FALSE, $user_shortcodes)) $span++;
$span = " rowspan='".$span."' ";
$sc_style['USER_PICTURE']['pre']="<td {$span} class='forumheader3 center middle' style='width:20%'>";
$sc_style['USER_PICTURE']['post']="</td>";
//$sc_style['USER_PICTURE']['pre']="<td {$span} class='forumheader3 center middle' style='width:20%'>";
//$sc_style['USER_PICTURE']['post']="</td>";
$USER_FULL_TEMPLATE = "
$USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
<div class='content user'>
<table style='".USER_WIDTH."' class='table fborder'>
<tr>
<td colspan='2' class='fcaption center'>".LAN_USER_58." {USER_ID} : {USER_NAME}{USER_LOGINNAME}</td>
</tr>
<tr>
{$user_picture}
<td {$span} class='forumheader3 center middle' style='width:20%'>{USER_PICTURE}</td>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_REALNAME_ICON} ".LAN_USER_63."</div>
<div class='f-right right'>{USER_REALNAME}</div>