2012-05-22 07:27:26 +00:00
|
|
|
//<?
|
2012-07-11 04:46:09 +00:00
|
|
|
|
2012-05-22 07:27:26 +00:00
|
|
|
|
2007-05-01 20:27:55 +00:00
|
|
|
global $pref, $fromadmin;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2012-07-11 04:46:09 +00:00
|
|
|
|
|
|
|
$class = e107::getBB()->getClass('file');
|
|
|
|
|
|
|
|
if(is_numeric($parm)) // Media-Manager file.
|
|
|
|
{
|
|
|
|
return "<a class='".$class."' href='".e_BASE."request.php?file={$parm}'>".$code_text."</a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-01 20:27:55 +00:00
|
|
|
if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
list($fname, $uc) = explode("^", $parm."^");
|
2007-07-12 19:12:53 +00:00
|
|
|
if($uc)
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
if(!check_class($uc))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-02-01 14:21:55 +00:00
|
|
|
|
2009-10-27 20:32:05 +00:00
|
|
|
$ext = substr($fname, strrpos($fname, '.')+1);
|
2008-02-01 14:21:55 +00:00
|
|
|
|
2009-10-27 20:32:05 +00:00
|
|
|
if(is_readable(THEME.'images/'.$ext.'.png'))
|
|
|
|
{
|
2009-11-17 20:34:50 +00:00
|
|
|
$image = THEME_ABS.'images/'.$ext.'.png';
|
2009-10-27 20:32:05 +00:00
|
|
|
}
|
|
|
|
elseif(is_readable(e_IMAGE.'/generic/'.$ext.'.png'))
|
|
|
|
{
|
2009-11-17 20:34:50 +00:00
|
|
|
$image = e_IMAGE_ABS.'generic/'.$ext.'.png';
|
2008-02-01 14:21:55 +00:00
|
|
|
|
2009-10-27 20:32:05 +00:00
|
|
|
}
|
|
|
|
elseif(is_readable(THEME.'images/file.png'))
|
|
|
|
{
|
2009-11-17 20:34:50 +00:00
|
|
|
$image = THEME_ABS.'images/file.png';
|
2008-02-01 14:21:55 +00:00
|
|
|
|
2009-10-27 20:32:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-17 20:34:50 +00:00
|
|
|
$image = e_IMAGE_ABS.'generic/lite/file.png';
|
|
|
|
}
|
|
|
|
if (strpos($fname, '{e_BASE}') === 0)
|
|
|
|
{
|
|
|
|
$fname = str_replace('{e_BASE}', SITEURL, $fname); // Translate into an absolute URL
|
2008-02-01 14:21:55 +00:00
|
|
|
}
|
2012-05-22 07:27:26 +00:00
|
|
|
return "<a class='{$class}' href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|