2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2009-11-17 10:46:35 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2009-11-18 01:06:08 +00:00
|
|
|
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
2009-11-17 10:46:35 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
*
|
2011-07-01 12:30:18 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2009-11-17 10:46:35 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-10 16:37:17 +00:00
|
|
|
if (!defined('e107_INIT'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-10 16:37:17 +00:00
|
|
|
function avatar($avatar)
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
global $tp;
|
2008-12-10 16:37:17 +00:00
|
|
|
if (stristr($avatar, '-upload-') !== false)
|
|
|
|
{
|
2009-11-07 02:28:59 +00:00
|
|
|
return e_UPLOAD.'avatars/'.str_replace('-upload-', '', $avatar);
|
2008-12-10 16:37:17 +00:00
|
|
|
}
|
|
|
|
elseif (stristr($avatar, 'Binary') !== false)
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$sqla = new db;
|
|
|
|
preg_match("/Binary\s(.*?)\//", $avatar, $result);
|
2008-12-10 16:37:17 +00:00
|
|
|
$sqla->db_Select('rbinary', '*', "binary_id='".$tp->toDB($result[1])."' ");
|
2006-12-02 04:36:16 +00:00
|
|
|
$row = $sqla->db_Fetch();
|
2008-12-10 16:37:17 +00:00
|
|
|
return $row['binary_data'];
|
|
|
|
}
|
|
|
|
elseif (strpos($avatar, 'http://') === false)
|
|
|
|
{
|
2011-07-01 12:30:18 +00:00
|
|
|
return SITEURLBASE.e_IMAGE_ABS."avatars/".$avatar;
|
2008-12-10 16:37:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
return $avatar;
|
|
|
|
}
|
|
|
|
}
|
2008-12-10 16:37:17 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
?>
|