mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
New avatar paths: avatars/default and avatars/uploaded . Paths need to be checked throughout the core.
This commit is contained in:
@@ -2127,13 +2127,13 @@ function show_avatars()
|
||||
$mes = e107::getMessage();
|
||||
|
||||
|
||||
$avFiles = e107::getFile()->get_files(e_MEDIA."avatars/",".jpg|.png|.gif|.jpeg|.JPG|.GIF|.PNG");
|
||||
$avFiles = e107::getFile()->get_files(e_MEDIA."avatars/",".jpg|.png|.gif|.jpeg|.JPG|.GIF|.PNG",null,2);
|
||||
|
||||
$dirlist = array();
|
||||
|
||||
foreach($avFiles as $f)
|
||||
{
|
||||
$dirlist[] = $f['fname'];
|
||||
$dirlist[] = str_replace(e_MEDIA."avatars/","",$f['path']). $f['fname'];
|
||||
}
|
||||
|
||||
$text = '';
|
||||
@@ -2179,7 +2179,7 @@ function show_avatars()
|
||||
|
||||
// :
|
||||
|
||||
$users = (in_array($image_name,$imageUsed)) ? "<span class='badge badge-warning'>Image in use</span>" : '<span class="badge">Not in use</span>';
|
||||
$users = (in_array(basename($image_name),$imageUsed)) ? "<span class='badge badge-warning' style='margin-bottom:5px'>Image in use</span>" : '<span class="badge" style="margin-bottom:5px">Not in use</span>';
|
||||
|
||||
//directory?
|
||||
if(is_dir(e_MEDIA."avatars/".$image_name))
|
||||
@@ -2205,6 +2205,20 @@ function show_avatars()
|
||||
$attr = "aw=".$pref['im_width']."&ah=".$pref['im_height'];
|
||||
$img_path = $tp->thumbUrl(e_MEDIA_ABS."avatars/".$image_name,$attr);
|
||||
|
||||
$type = dirname($image_name);
|
||||
|
||||
if($prevType != $type)
|
||||
{
|
||||
$text .= "<div class='clearfix'></div>
|
||||
<h5 >".$type."</h5>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$for = $frm->name2id('multiaction-'.$image_name);
|
||||
|
||||
$img_src = "<label for='".$for."' >
|
||||
@@ -2213,6 +2227,8 @@ function show_avatars()
|
||||
</div>
|
||||
</label>";
|
||||
|
||||
$prevType = $type;
|
||||
|
||||
}
|
||||
|
||||
//style attribute allowed here - server side width/height control
|
||||
|
@@ -1151,7 +1151,7 @@ function update_706_to_800($type='')
|
||||
|
||||
|
||||
$root_media = str_replace(basename(e_MEDIA)."/","",e_MEDIA);
|
||||
$user_media_dirs = array("images","avatars","files","temp","videos","icons");
|
||||
$user_media_dirs = array("images","avatars", "avatars/default", "avatars/uploaded", "files","temp","videos","icons");
|
||||
|
||||
// check for old paths and rename.
|
||||
if(is_dir($root_media."images") || is_dir($root_media."temp"))
|
||||
@@ -1163,7 +1163,7 @@ function update_706_to_800($type='')
|
||||
}
|
||||
|
||||
// create sub-directories if they do not exist.
|
||||
if(!is_dir(e_MEDIA."images") || !is_dir(e_MEDIA."temp"))
|
||||
if(!is_dir(e_MEDIA."images") || !is_dir(e_MEDIA."temp") || !is_dir(e_MEDIA."avatars/default") )
|
||||
{
|
||||
foreach($user_media_dirs as $md)
|
||||
{
|
||||
@@ -1185,7 +1185,9 @@ function update_706_to_800($type='')
|
||||
if ($just_check) return update_needed('Avatar paths require updating.');
|
||||
foreach($avatar_images as $av)
|
||||
{
|
||||
@rename($av['path'].$av['fname'],e_MEDIA."avatars/".$av['fname']);
|
||||
$apath = (strstr($av['path'],'public/')) ? 'uploaded/' : 'default/';
|
||||
|
||||
@rename($av['path'].$av['fname'],e_MEDIA."avatars/".$apath. $av['fname']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -397,7 +397,7 @@ class e_form
|
||||
$previnput = $idinput."-preview";
|
||||
$optioni = $idinput."-options";
|
||||
|
||||
$img = (strpos($curVal,"://")!==false) ? $curVal : $tp->thumbUrl(e_MEDIA."avatars/".$curVal,"aw=".vartrue($width)."&ah=".vartrue($height));
|
||||
$img = (strpos($curVal,"://")!==false) ? $curVal : $tp->thumbUrl(e_MEDIA."avatars/default/".$curVal,"aw=".vartrue($width)."&ah=".vartrue($height));
|
||||
|
||||
if(!$curVal)
|
||||
{
|
||||
@@ -416,7 +416,7 @@ class e_form
|
||||
$text .= "<input class='btn button e-expandit' type ='button' style='cursor:pointer' size='30' value=\"Choose Avatar\" />"; //TODO Common LAN.
|
||||
}
|
||||
|
||||
$avFiles = e107::getFile()->get_files(e_MEDIA."avatars/",".jpg|.png|.gif|.jpeg|.JPG|.GIF|.PNG");
|
||||
$avFiles = e107::getFile()->get_files(e_MEDIA."avatars/default/",".jpg|.png|.gif|.jpeg|.JPG|.GIF|.PNG");
|
||||
|
||||
$text .= "\n<div id='{$optioni}' style='display:none' >\n"; //TODO unique id.
|
||||
|
||||
@@ -433,7 +433,7 @@ class e_form
|
||||
|
||||
foreach($avFiles as $fi)
|
||||
{
|
||||
$img_path = $tp->thumbUrl(e_MEDIA_ABS."avatars/".$fi['fname'],$attr);
|
||||
$img_path = $tp->thumbUrl(e_MEDIA_ABS."avatars/default/".$fi['fname'],$attr);
|
||||
$text .= "\n<a class='e-expandit' title='Choose this avatar' href='#{$optioni}'><img src='".$img_path."' alt='' onclick=\"insertext('".$fi['fname']."', '".$idinput."');document.getElementById('".$previnput."').src = this.src;\" /></a> ";
|
||||
//TODO javascript CSS selector
|
||||
}
|
||||
|
@@ -163,6 +163,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
|
||||
$height = e107::getPref("im_height");
|
||||
$width = e107::getPref("im_width");
|
||||
|
||||
$img = e_IMAGE_ABS."generic/blank_avatar.jpg";
|
||||
|
||||
if ($this->postInfo['post_user'] && $this->postInfo['user_image'])
|
||||
{
|
||||
@@ -171,7 +172,17 @@ class plugin_forum_view_shortcodes extends e_shortcode
|
||||
if ($this->postInfo['user_image'])
|
||||
{
|
||||
// require_once(e_HANDLER.'avatar_handler.php');
|
||||
$avatar = "<img src='".e_MEDIA_AVATAR.$this->postInfo['user_image']."' alt=\"".$this->postInfo['user_name']."\"/>";
|
||||
|
||||
if(file_exists(e_MEDIA_AVATAR."default/".$this->postInfo['user_image']))
|
||||
{
|
||||
$img = e_MEDIA_AVATAR_ABS."default/".$this->postInfo['user_image'];
|
||||
}
|
||||
elseif(file_exists(e_MEDIA_AVATAR."uploaded/".$this->postInfo['user_image']))
|
||||
{
|
||||
$img = e_MEDIA_AVATAR_ABS."uploaded/".$this->postInfo['user_image'];
|
||||
}
|
||||
|
||||
$avatar = "<img class='user-avatar' src='".$img."' alt=\"".$this->postInfo['user_name']."\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,7 +195,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
|
||||
|
||||
// $img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height);
|
||||
// return print_a($img, true);
|
||||
$img = e_IMAGE."generic/blank_avatar.jpg";
|
||||
|
||||
|
||||
return "<img class='user-avatar' src='".$img."' alt='' width='".$width."' />";
|
||||
|
||||
|
Reference in New Issue
Block a user