1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Avatar path corrections.

This commit is contained in:
Cameron 2013-04-19 22:50:41 -07:00
parent 42c47b7742
commit 1500effbd7
13 changed files with 78 additions and 86 deletions

View File

@ -105,7 +105,7 @@ if (count($allowed_types) == 0)
//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />'; //echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />';
// avatar check. // avatar check.
$public = array(e_UPLOAD, e_UPLOAD.'avatars'); $public = array(e_UPLOAD, e_AVATAR_UPLOAD);
$exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess'); $exceptions = array(".","..","/","CVS","avatars","Thumbs.db",".ftpquota",".htaccess","php.ini",".cvsignore",'e107.htaccess');
//TODO use $file-class to grab list and perform this check. //TODO use $file-class to grab list and perform this check.

View File

@ -2032,10 +2032,11 @@ if (isset($_POST['submit_show_delete_multi']))
*/ */
if (isset($_POST['submit_show_deleteall'])) if (isset($_POST['submit_show_deleteall']))
{ {
$handle = opendir(e_UPLOAD."avatars/"); $handle = opendir(e_AVATAR_UPLOAD);
$dirlist = array(); $dirlist = array();
while ($file = readdir($handle)) { while ($file = readdir($handle))
if (!is_dir(e_UPLOAD."avatars/{$file}") && $file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') { {
if (!is_dir(e_AVATAR_UPLOAD.$file) && $file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') {
$dirlist[] = $file; $dirlist[] = $file;
} }
} }
@ -2050,7 +2051,7 @@ if (isset($_POST['submit_show_deleteall']))
$image_name = basename($image_name); $image_name = basename($image_name);
$image_todb = $tp->toDB($image_name); $image_todb = $tp->toDB($image_name);
if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) { if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) {
unlink(e_UPLOAD."avatars/".$image_name); unlink(e_AVATAR_UPLOAD.$image_name);
$imgList .= '[!br!]'.$image_name; $imgList .= '[!br!]'.$image_name;
$count++; $count++;
} }

View File

@ -1151,7 +1151,7 @@ function update_706_to_800($type='')
$root_media = str_replace(basename(e_MEDIA)."/","",e_MEDIA); $root_media = str_replace(basename(e_MEDIA)."/","",e_MEDIA);
$user_media_dirs = array("images","avatars", "avatars/default", "avatars/uploaded", "files","temp","videos","icons"); $user_media_dirs = array("images","avatars", "avatars/default", "avatars/upload", "files","temp","videos","icons");
// check for old paths and rename. // check for old paths and rename.
if(is_dir($root_media."images") || is_dir($root_media."temp")) if(is_dir($root_media."images") || is_dir($root_media."temp"))
@ -1185,9 +1185,9 @@ function update_706_to_800($type='')
if ($just_check) return update_needed('Avatar paths require updating.'); if ($just_check) return update_needed('Avatar paths require updating.');
foreach($avatar_images as $av) foreach($avatar_images as $av)
{ {
$apath = (strstr($av['path'],'public/')) ? 'uploaded/' : 'default/'; $apath = (strstr($av['path'],'public/')) ? e_AVATAR_UPLOAD : e_AVATAR_DEFAULT;
@rename($av['path'].$av['fname'],e_MEDIA."avatars/".$apath. $av['fname']); @rename($av['path'].$av['fname'], $apath. $av['fname']);
} }
} }

View File

@ -24,11 +24,5 @@ else
{ {
$image = USERPHOTO; $image = USERPHOTO;
} }
if($image && file_exists(e_MEDIA_AVATAR.$image))
{ return e107::getParser()->parseTemplate("{USER_AVATAR=".$image."}",true);
return "<img src='".e_MEDIA_AVATAR_ABS."{$image}' alt='' />";
}
else
{
return "";
}

View File

@ -42,16 +42,31 @@ function user_avatar_shortcode($parm='')
if (vartrue($image)) if (vartrue($image))
{ {
$img = (strpos($image,"://")!==false) ? $image : $tp->thumbUrl(e_MEDIA."avatars/".$image,"w=".$width."&h=".$height);
$text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' /> if(strpos($image,"://")!==false) // Remove Image
";
}
else
{ {
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height); $img = $image;
$text = "<img class='user-avatar' src='".$img."' alt='' />"; }
elseif(file_exists(e_AVATAR_DEFAULT.$image)) // Local Default Image
{
$img = $tp->thumbUrl(e_AVATAR_DEFAULT.$image,"w=".$width."&h=".$height,true);
}
elseif(file_exists(e_AVATAR_UPLOAD.$image)) // User-Uplaoded Image
{
$img = $tp->thumbUrl(e_AVATAR_UPLOAD.$image,"w=".$width."&h=".$height,true);
}
else // Image Missing.
{
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
}
}
else // No image provided - so send generic.
{
$img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height,true);
} }
$text = "<img class='user-avatar e-tip' src='".$img."' alt='' style='width:".$width."px; height:".$height."px' />";
// return $img;
return $text; return $text;
} }

View File

@ -18,10 +18,14 @@ if (!defined('e107_INIT'))
function avatar($avatar) function avatar($avatar)
{ {
return e107::getParser()->parseTemplate("{USER_AVATAR=".$avatar."}",true);
global $tp; global $tp;
if (stristr($avatar, '-upload-') !== false) if (stristr($avatar, '-upload-') !== false)
{ {
return e_UPLOAD.'avatars/'.str_replace('-upload-', '', $avatar); return e_AVATAR_UPLOAD.str_replace('-upload-', '', $avatar);
} }
elseif (stristr($avatar, 'Binary') !== false) elseif (stristr($avatar, 'Binary') !== false)
{ {

View File

@ -440,10 +440,11 @@ class e107
$ret['MEDIA_IMAGES_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'images/'; $ret['MEDIA_IMAGES_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'images/';
$ret['MEDIA_ICONS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'icons/'; $ret['MEDIA_ICONS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'icons/';
$ret['MEDIA_AVATARS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'avatars/';
$ret['MEDIA_VIDEOS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'videos/'; $ret['MEDIA_VIDEOS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'videos/';
$ret['MEDIA_FILES_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'files/'; $ret['MEDIA_FILES_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'files/';
$ret['MEDIA_UPLOAD_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/'; // security measure. Media is public, system is private. $ret['MEDIA_UPLOAD_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/'; // security measure. Media is public, system is private.
$ret['AVATARS_DIRECTORY'] = $ret['MEDIA_DIRECTORY'].'avatars/';
$ret['WEB_JS_DIRECTORY'] = $ret['WEB_DIRECTORY'].'js/'; $ret['WEB_JS_DIRECTORY'] = $ret['WEB_DIRECTORY'].'js/';
// $ret['WEB_JS_DIRECTORY'] = $ret['FILES_DIRECTORY'].'jslib/'; // $ret['WEB_JS_DIRECTORY'] = $ret['FILES_DIRECTORY'].'jslib/';
@ -462,6 +463,9 @@ class e107
$ret['CACHE_DB_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'db/'; $ret['CACHE_DB_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'db/';
$ret['CACHE_URL_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'url/'; $ret['CACHE_URL_DIRECTORY'] = $ret['CACHE_DIRECTORY'].'url/';
$ret['AVATARS_UPLOAD_DIRECTORY'] = $ret['AVATARS_DIRECTORY'].'upload/';
$ret['AVATARS_DEFAULT_DIRECTORY'] = $ret['AVATARS_DIRECTORY'].'default/';
$ret['LOGS_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'logs/'; $ret['LOGS_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'logs/';
$ret['BACKUP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'backup/'; $ret['BACKUP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'backup/';
$ret['TEMP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/'; $ret['TEMP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/';
@ -2819,7 +2823,7 @@ class e107
define('e_MEDIA_VIDEO', $this->get_override_rel('MEDIA_VIDEOS')); define('e_MEDIA_VIDEO', $this->get_override_rel('MEDIA_VIDEOS'));
define('e_MEDIA_IMAGE', $this->get_override_rel('MEDIA_IMAGES')); define('e_MEDIA_IMAGE', $this->get_override_rel('MEDIA_IMAGES'));
define('e_MEDIA_ICON', $this->get_override_rel('MEDIA_ICONS')); define('e_MEDIA_ICON', $this->get_override_rel('MEDIA_ICONS'));
define('e_MEDIA_AVATAR', $this->get_override_rel('MEDIA_AVATARS')); // define('e_MEDIA_AVATAR', $this->get_override_rel('MEDIA_AVATARS'));
define('e_DOWNLOAD', $this->get_override_rel('DOWNLOADS')); define('e_DOWNLOAD', $this->get_override_rel('DOWNLOADS'));
define('e_UPLOAD', $this->get_override_rel('UPLOADS')); define('e_UPLOAD', $this->get_override_rel('UPLOADS'));
@ -2864,10 +2868,15 @@ class e107
define('e_MEDIA_VIDEO_ABS', $this->get_override_http('MEDIA_VIDEOS')); define('e_MEDIA_VIDEO_ABS', $this->get_override_http('MEDIA_VIDEOS'));
define('e_MEDIA_IMAGE_ABS', $this->get_override_http('MEDIA_IMAGES')); define('e_MEDIA_IMAGE_ABS', $this->get_override_http('MEDIA_IMAGES'));
define('e_MEDIA_ICON_ABS', $this->get_override_http('MEDIA_ICONS')); define('e_MEDIA_ICON_ABS', $this->get_override_http('MEDIA_ICONS'));
define('e_MEDIA_AVATAR_ABS', $this->get_override_http('MEDIA_AVATARS')); // define('e_MEDIA_AVATAR_ABS', $this->get_override_http('MEDIA_AVATARS'));
// XXX DISCUSSS - e_JS_ABS, e_CSS_ABS etc is not following the naming standards but they're more usable. // XXX DISCUSSS - e_JS_ABS, e_CSS_ABS etc is not following the naming standards but they're more usable.
// Example: e_JS_ABS vs e_WEB_JS_ABS // Example: e_JS_ABS vs e_WEB_JS_ABS
//XXX Absolute is assumed.
define('e_WEB_ABS', $this->get_override_http('WEB')); define('e_WEB_ABS', $this->get_override_http('WEB'));
define('e_JS_ABS', $this->get_override_http('WEB_JS')); define('e_JS_ABS', $this->get_override_http('WEB_JS'));
define('e_CSS_ABS', $this->get_override_http('WEB_CSS')); define('e_CSS_ABS', $this->get_override_http('WEB_CSS'));
@ -2877,6 +2886,15 @@ class e107
define('e_JS', $this->get_override_http('WEB_JS')); // ABS Alias define('e_JS', $this->get_override_http('WEB_JS')); // ABS Alias
define('e_CSS', $this->get_override_http('WEB_CSS')); // ABS Alias define('e_CSS', $this->get_override_http('WEB_CSS')); // ABS Alias
define('e_AVATAR', $this->get_override_rel('AVATARS'));
define('e_AVATAR_UPLOAD', $this->get_override_rel('AVATARS_UPLOAD'));
define('e_AVATAR_DEFAULT', $this->get_override_rel('AVATARS_DEFAULT'));
define('e_AVATAR_ABS', $this->get_override_http('AVATARS'));
define('e_AVATAR_UPLOAD_ABS', $this->get_override_http('AVATARS_UPLOAD'));
define('e_AVATAR_DEFAULT_ABS', $this->get_override_http('AVATARS_DEFAULT'));
} }
return $this; return $this;
} }

View File

@ -1889,7 +1889,7 @@ class e_parse extends e_parser
'e_MEDIA_VIDEO/' => '{e_MEDIA_VIDEO}', 'e_MEDIA_VIDEO/' => '{e_MEDIA_VIDEO}',
'e_MEDIA_IMAGE/' => '{e_MEDIA_IMAGE}', 'e_MEDIA_IMAGE/' => '{e_MEDIA_IMAGE}',
'e_MEDIA_ICON/' => '{e_MEDIA_ICON}', 'e_MEDIA_ICON/' => '{e_MEDIA_ICON}',
'e_MEDIA_AVATAR/' => '{e_MEDIA_AVATAR}', 'e_AVATAR/' => '{e_AVATAR}',
'e_WEB_JS/' => '{e_WEB_JS}', 'e_WEB_JS/' => '{e_WEB_JS}',
'e_WEB_CSS/' => '{e_WEB_CSS}', 'e_WEB_CSS/' => '{e_WEB_CSS}',
'e_WEB_IMAGE/' => '{e_WEB_IMAGE}', 'e_WEB_IMAGE/' => '{e_WEB_IMAGE}',
@ -1950,7 +1950,7 @@ class e_parse extends e_parser
$e107->getFolder('media_video'), $e107->getFolder('media_video'),
$e107->getFolder('media_image'), $e107->getFolder('media_image'),
$e107->getFolder('media_icon'), $e107->getFolder('media_icon'),
$e107->getFolder('media_avatar'), $e107->getFolder('avatars'),
$e107->getFolder('web_js'), $e107->getFolder('web_js'),
$e107->getFolder('web_css'), $e107->getFolder('web_css'),
$e107->getFolder('web_image'), $e107->getFolder('web_image'),
@ -1981,7 +1981,7 @@ class e_parse extends e_parser
e_MEDIA_VIDEO_ABS, e_MEDIA_VIDEO_ABS,
e_MEDIA_IMAGE_ABS, e_MEDIA_IMAGE_ABS,
e_MEDIA_ICON_ABS, e_MEDIA_ICON_ABS,
e_MEDIA_AVATAR_ABS, e_AVATAR_ABS,
e_JS_ABS, e_JS_ABS,
e_CSS_ABS, e_CSS_ABS,
e_WEB_IMAGE_ABS, e_WEB_IMAGE_ABS,
@ -2011,7 +2011,7 @@ class e_parse extends e_parser
SITEURLBASE.e_MEDIA_VIDEO_ABS, SITEURLBASE.e_MEDIA_VIDEO_ABS,
SITEURLBASE.e_MEDIA_IMAGE_ABS, SITEURLBASE.e_MEDIA_IMAGE_ABS,
SITEURLBASE.e_MEDIA_ICON_ABS, SITEURLBASE.e_MEDIA_ICON_ABS,
SITEURLBASE.e_MEDIA_AVATAR_ABS, SITEURLBASE.e_AVATAR_ABS,
SITEURLBASE.e_JS_ABS, SITEURLBASE.e_JS_ABS,
SITEURLBASE.e_CSS_ABS, SITEURLBASE.e_CSS_ABS,
SITEURLBASE.e_WEB_IMAGE_ABS, SITEURLBASE.e_WEB_IMAGE_ABS,
@ -2041,7 +2041,7 @@ class e_parse extends e_parser
'{e_MEDIA_VIDEO}', '{e_MEDIA_VIDEO}',
'{e_MEDIA_IMAGE}', '{e_MEDIA_IMAGE}',
'{e_MEDIA_ICON}', '{e_MEDIA_ICON}',
'{e_MEDIA_AVATAR}', '{e_AVATAR}',
'{e_WEB_JS}', '{e_WEB_JS}',
'{e_WEB_CSS}', '{e_WEB_CSS}',
'{e_WEB_IMAGE}', '{e_WEB_IMAGE}',
@ -2166,7 +2166,7 @@ class e_parse extends e_parser
'{e_MEDIA_VIDEO}' => $e107->getFolder('media_videos'), '{e_MEDIA_VIDEO}' => $e107->getFolder('media_videos'),
'{e_MEDIA_IMAGE}' => $e107->getFolder('media_images'), '{e_MEDIA_IMAGE}' => $e107->getFolder('media_images'),
'{e_MEDIA_ICON}' => $e107->getFolder('media_icons'), '{e_MEDIA_ICON}' => $e107->getFolder('media_icons'),
'{e_MEDIA_AVATAR}' => $e107->getFolder('media_avatars'), '{e_AVATAR}' => $e107->getFolder('avatars'),
'{e_WEB_JS}' => $e107->getFolder('web_js'), '{e_WEB_JS}' => $e107->getFolder('web_js'),
'{e_WEB_CSS}' => $e107->getFolder('web_css'), '{e_WEB_CSS}' => $e107->getFolder('web_css'),
'{e_WEB_IMAGE}' => $e107->getFolder('web_images'), '{e_WEB_IMAGE}' => $e107->getFolder('web_images'),
@ -2194,7 +2194,7 @@ class e_parse extends e_parser
'{e_MEDIA_VIDEO}' => e_MEDIA_VIDEO, '{e_MEDIA_VIDEO}' => e_MEDIA_VIDEO,
'{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE, '{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE,
'{e_MEDIA_ICON}' => e_MEDIA_ICON, '{e_MEDIA_ICON}' => e_MEDIA_ICON,
'{e_MEDIA_AVATAR}' => e_MEDIA_AVATAR, '{e_AVATAR}' => e_AVATAR,
'{e_WEB_JS}' => e_WEB_JS, '{e_WEB_JS}' => e_WEB_JS,
'{e_WEB_CSS}' => e_WEB_CSS, '{e_WEB_CSS}' => e_WEB_CSS,
'{e_WEB_IMAGE}' => e_WEB_IMAGE, '{e_WEB_IMAGE}' => e_WEB_IMAGE,
@ -2219,7 +2219,7 @@ class e_parse extends e_parser
'{e_MEDIA_VIDEO}' => e_MEDIA_VIDEO_ABS, '{e_MEDIA_VIDEO}' => e_MEDIA_VIDEO_ABS,
'{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE_ABS, '{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE_ABS,
'{e_MEDIA_ICON}' => e_MEDIA_ICON_ABS, '{e_MEDIA_ICON}' => e_MEDIA_ICON_ABS,
'{e_MEDIA_AVATAR}' => e_MEDIA_AVATAR_ABS, '{e_AVATAR}' => e_AVATAR_ABS,
'{e_WEB_JS}' => e_JS_ABS, '{e_WEB_JS}' => e_JS_ABS,
'{e_WEB_CSS}' => e_CSS_ABS, '{e_WEB_CSS}' => e_CSS_ABS,
'{e_WEB_IMAGE}' => e_WEB_IMAGE_ABS, '{e_WEB_IMAGE}' => e_WEB_IMAGE_ABS,
@ -2244,7 +2244,7 @@ class e_parse extends e_parser
'{e_MEDIA_VIDEO}' => SITEURLBASE.e_MEDIA_VIDEO_ABS, '{e_MEDIA_VIDEO}' => SITEURLBASE.e_MEDIA_VIDEO_ABS,
'{e_MEDIA_IMAGE}' => SITEURLBASE.e_MEDIA_IMAGE_ABS, '{e_MEDIA_IMAGE}' => SITEURLBASE.e_MEDIA_IMAGE_ABS,
'{e_MEDIA_ICON}' => SITEURLBASE.e_MEDIA_ICON_ABS, '{e_MEDIA_ICON}' => SITEURLBASE.e_MEDIA_ICON_ABS,
'{e_MEDIA_AVATAR}' => SITEURLBASE.e_MEDIA_AVATAR_ABS, '{e_AVATAR}' => SITEURLBASE.e_AVATAR_ABS,
'{e_WEB_JS}' => SITEURLBASE.e_JS_ABS, '{e_WEB_JS}' => SITEURLBASE.e_JS_ABS,
'{e_WEB_CSS}' => SITEURLBASE.e_CSS_ABS, '{e_WEB_CSS}' => SITEURLBASE.e_CSS_ABS,
'{e_WEB_IMAGE}' => SITEURLBASE.e_WEB_IMAGE_ABS, '{e_WEB_IMAGE}' => SITEURLBASE.e_WEB_IMAGE_ABS,

View File

@ -93,7 +93,7 @@ class UserHandler
'user_login' => array('niceName'=> LAN_USER_03, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'realname', 'dbClean' => 'toDB'), // Real name (no real vetting) 'user_login' => array('niceName'=> LAN_USER_03, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'realname', 'dbClean' => 'toDB'), // Real name (no real vetting)
'user_customtitle' => array('niceName'=> LAN_USER_04, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'customtitle', 'dbClean' => 'toDB', 'enablePref' => 'signup_option_customtitle'), // No real vetting 'user_customtitle' => array('niceName'=> LAN_USER_04, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'customtitle', 'dbClean' => 'toDB', 'enablePref' => 'signup_option_customtitle'), // No real vetting
'user_password' => array('niceName'=> LAN_USER_05, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'password1', 'dataType' => 2, 'minLength' => varset($pref['signup_pass_len'],1)), 'user_password' => array('niceName'=> LAN_USER_05, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'password1', 'dataType' => 2, 'minLength' => varset($pref['signup_pass_len'],1)),
'user_sess' => array('niceName'=> LAN_USER_06, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'image', 'imagePath' => e_UPLOAD.'avatars/', 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Photo 'user_sess' => array('niceName'=> LAN_USER_06, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'image', 'imagePath' => e_AVATAR_UPLOAD, 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120)), // Photo
'user_image' => array('niceName'=> LAN_USER_07, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'image', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'avatar'), //, 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120) resized on-the-fly // Avatar 'user_image' => array('niceName'=> LAN_USER_07, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'image', 'stripChars' => "#\"|'|(|)#", 'dbClean' => 'avatar'), //, 'maxHeight' => varset($pref['im_height'], 100), 'maxWidth' => varset($pref['im_width'], 120) resized on-the-fly // Avatar
'user_email' => array('niceName'=> LAN_USER_08, 'fieldType' => 'string', 'vetMethod' => '1,3', 'vetParam' => '', 'fieldOptional' => varset($pref['disable_emailcheck'],0), 'srcName' => 'email', 'dbClean' => 'toDB'), 'user_email' => array('niceName'=> LAN_USER_08, 'fieldType' => 'string', 'vetMethod' => '1,3', 'vetParam' => '', 'fieldOptional' => varset($pref['disable_emailcheck'],0), 'srcName' => 'email', 'dbClean' => 'toDB'),
'user_signature' => array('niceName'=> LAN_USER_09, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'signature', 'dbClean' => 'toDB'), 'user_signature' => array('niceName'=> LAN_USER_09, 'fieldType' => 'string', 'vetMethod' => '0', 'vetParam' => '', 'srcName' => 'signature', 'dbClean' => 'toDB'),

View File

@ -1125,7 +1125,7 @@ class validatorClass
{ {
if (strpos('-upload-', $value) === 0) if (strpos('-upload-', $value) === 0)
{ {
$img = e_UPLOAD.'avatars/'.str_replace('-upload-', '', $value); // Its a user-uploaded image $img = e_AVATAR_UPLOAD.str_replace('-upload-', '', $value); // Its a user-uploaded image
} }
elseif (strpos($avName, '/') !== FALSE) elseif (strpos($avName, '/') !== FALSE)
{ {
@ -1133,7 +1133,7 @@ class validatorClass
} }
else else
{ {
$img = e_MEDIA.'avatars/'.$value; // Its a server-stored image $img = e_AVATAR_DEFAULT.$value; // Its a server-stored image
} }
} }
// Deliberately fall through into normal image processing // Deliberately fall through into normal image processing
@ -1143,16 +1143,17 @@ class validatorClass
$img = $defs['imagePath'].$value; $img = $defs['imagePath'].$value;
} }
$img = varset($img,$value); $img = varset($img,$value);
//XXX There should be no size limits - as image sizes are handled by thumb.php
if ($size = getimagesize($img)) if ($size = getimagesize($img))
{ {
// echo "Image {$img} size: {$size[0]} x {$size[1]}<br />"; // echo "Image {$img} size: {$size[0]} x {$size[1]}<br />";
if (isset($defs['maxWidth']) && $size[0] > $defs['maxWidth']) if (isset($defs['maxWidth']) && $size[0] > $defs['maxWidth'])
{ // Image too wide { // Image too wide
$errNum = ERR_IMAGE_TOO_WIDE; // $errNum = ERR_IMAGE_TOO_WIDE;
} }
if (isset($defs['maxHeight']) && $size[1] > $defs['maxHeight']) if (isset($defs['maxHeight']) && $size[1] > $defs['maxHeight'])
{ // Image too high { // Image too high
$errNum = ERR_IMAGE_TOO_HIGH; // $errNum = ERR_IMAGE_TOO_HIGH;
} }
} }
else else

View File

@ -159,48 +159,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_avatar() function sc_avatar()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
//return e107::getParser()->parseTemplate("{AVATAR=".$this->postInfo['user_image']."}"); return $tp->parseTemplate("{USER_AVATAR=".$this->postInfo['user_image']."}", true);
$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'])
{
if(!$avatar = getcachedvars('forum_avatar_'.$this->postInfo['post_user']))
{
if ($this->postInfo['user_image'])
{
// require_once(e_HANDLER.'avatar_handler.php');
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
{
$avatar = "<img class='user-avatar' src='".$img."' alt='' />";
}
cachevars('forum_avatar_'.$this->postInfo['post_user'], $avatar);
}
return $avatar;
}
// $img = $tp->thumbUrl(e_IMAGE."generic/blank_avatar.jpg","w=".$width."&h=".$height);
// return print_a($img, true);
return "<img class='user-avatar' src='".$img."' alt='' width='".$width."' />";
return $text;
} }
function sc_anon_ip() function sc_anon_ip()

View File

@ -56,10 +56,10 @@ if (isset($_POST['delp']))
} }
if (USERID == $tmp[1] || (ADMIN && getperms("4"))) if (USERID == $tmp[1] || (ADMIN && getperms("4")))
{ {
$sql->db_Select("user", "user_sess", "user_id='". USERID."'"); $sql->select("user", "user_sess", "user_id='". USERID."'");
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
@unlink(e_UPLOAD."avatars/".$row['user_sess']); @unlink(e_AVATAR_UPLOAD.$row['user_sess']);
$sql->db_Update("user", "user_sess='' WHERE user_id=".intval($tmp[1])); $sql->update("user", "user_sess='' WHERE user_id=".intval($tmp[1]));
header("location:".e_SELF."?id.".$tmp[1]); header("location:".e_SELF."?id.".$tmp[1]);
exit; exit;
} }

View File

@ -216,7 +216,7 @@ if (isset($_POST['updatesettings']))
require_once (e_HANDLER.'upload_handler.php'); require_once (e_HANDLER.'upload_handler.php');
require_once (e_HANDLER.'resize_handler.php'); require_once (e_HANDLER.'resize_handler.php');
if ($uploaded = process_uploaded_files(e_UPLOAD.'avatars/', 'prefix+ap_'.$udata['user_id'].'_', array('overwrite' => TRUE, 'file_mask'=>'jpg,png,gif', 'max_file_count' => 2))) if ($uploaded = process_uploaded_files(e_AVATAR_UPLOAD, 'prefix+ap_'.$udata['user_id'].'_', array('overwrite' => TRUE, 'file_mask'=>'jpg,png,gif', 'max_file_count' => 2)))
{ {
foreach ($uploaded as $upload) foreach ($uploaded as $upload)
{ {