From a7b3a3e6f1abb03f27094f38c2deb631877991ef Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 19 Apr 2013 14:00:19 -0700 Subject: [PATCH] New avatar paths: avatars/default and avatars/uploaded . Paths need to be checked throughout the core. --- e107_admin/image.php | 22 ++++++++++++++++--- e107_admin/update_routines.php | 8 ++++--- e107_handlers/form_handler.php | 6 ++--- .../shortcodes/batch/view_shortcodes.php | 15 +++++++++++-- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index bdfb48778..2f48723d3 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -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)) ? "Image in use" : 'Not in use'; + $users = (in_array(basename($image_name),$imageUsed)) ? "Image in use" : 'Not in use'; //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 .= "
+
".$type."
"; + } + + + + + + + $for = $frm->name2id('multiaction-'.$image_name); $img_src = ""; + + $prevType = $type; } diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 516ae5767..cb0d00a74 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -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']); } } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index b72a069d6..c2d75ea4a 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -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 .= ""; //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