1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-11 09:04:38 +02:00

Bugfix: img bbcode wasn't checking for 'admin' privelages.

This commit is contained in:
CaMer0n
2007-11-13 07:41:32 +00:00
parent 851f8cc320
commit 61ecd13a8c

View File

@@ -7,20 +7,22 @@ $code_text = str_replace($search, $replace, $code_text);
unset($imgParms); unset($imgParms);
$imgParms['class']="bbcode"; $imgParms['class']="bbcode";
$imgParms['alt']=''; $imgParms['alt']='';
$imgParms['style']="vertical-align:middle; border:0";
$code_text = $tp -> toAttribute($code_text); $code_text = $tp -> toAttribute($code_text);
if($parm) { if($parm)
{
$parm = preg_replace('#onerror *=#i','',$parm); $parm = preg_replace('#onerror *=#i','',$parm);
$parm = str_replace("amp;", "&", $parm); $parm = str_replace("amp;", "&", $parm);
parse_str($parm,$tmp); parse_str($parm,$tmp);
foreach($tmp as $p => $v) { foreach($tmp as $p => $v)
{
$imgParms[$p]=$v; $imgParms[$p]=$v;
} }
} }
$parmStr=""; $parmStr="";
foreach($imgParms as $k => $v) { foreach($imgParms as $k => $v)
{
$parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' "; $parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
} }
@@ -30,20 +32,28 @@ if((strpos($code_text,'../') === FALSE) && file_exists(e_IMAGE."newspost_images/
$code_text = e_IMAGE."newspost_images/".$code_text; $code_text = e_IMAGE."newspost_images/".$code_text;
} }
if (!$postID) { if (!$postID || $postID == 'admin')
{
return "<img src='".$code_text."' {$parmStr} />"; return "<img src='".$code_text."' {$parmStr} />";
} else { }
if(strstr($postID,'class:')) { else
{
if(strstr($postID,'class:'))
{
$uc = substr($postID,6); $uc = substr($postID,6);
} }
if ($pref['image_post']) { if ($pref['image_post'])
if(!isset($uc) || ($uc == '')) { {
if (!function_exists('e107_userGetuserclass')) { if(!isset($uc) || ($uc == ''))
{
if (!function_exists('e107_userGetuserclass'))
{
require_once(e_HANDLER.'user_func.php'); require_once(e_HANDLER.'user_func.php');
} }
$uc = e107_userGetuserclass($postID); $uc = e107_userGetuserclass($postID);
} }
if (check_class($pref['image_post_class'],$uc)) { if (check_class($pref['image_post_class'],$uc))
{
return "<img src='".$code_text."' {$parmStr} />"; return "<img src='".$code_text."' {$parmStr} />";
} }
else else
@@ -53,9 +63,12 @@ if (!$postID) {
} }
else else
{ {
if ($pref['image_post_disabled_method']) { if ($pref['image_post_disabled_method'])
{
return '[ image disabled ]'; return '[ image disabled ]';
} else { }
else
{
return "Image: $code_text"; return "Image: $code_text";
} }
} }