1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

Fix for TinyMce image resize. Also disabled static URLs in the admin area.

This commit is contained in:
Cameron
2018-01-26 14:10:15 -08:00
parent 318a849b77
commit 4d3ef86bb7
4 changed files with 21 additions and 15 deletions

View File

@@ -20,15 +20,17 @@ class bb_img extends e_bb_base
$parms = eHelper::scParams($parm); $parms = eHelper::scParams($parm);
$safe = array(); $safe = array();
if(vartrue($parms['class'])) $safe['class'] = eHelper::secureClassAttr($parms['class']); if(!empty($parms['class'])) $safe['class'] = eHelper::secureClassAttr($parms['class']);
if(vartrue($parms['id'])) $safe['id'] = eHelper::secureIdAttr($parms['id']); if(!empty($parms['id'])) $safe['id'] = eHelper::secureIdAttr($parms['id']);
if(vartrue($parms['style'])) $safe['style'] = eHelper::secureStyleAttr($parms['style']); if(!empty($parms['style'])) $safe['style'] = eHelper::secureStyleAttr($parms['style']);
if(vartrue($parms['alt'])) $safe['alt'] = e107::getParser()->filter($parms['alt'],'str'); if(!empty($parms['alt'])) $safe['alt'] = e107::getParser()->filter($parms['alt'],'str');
if(isset($parms['width'])) $safe['width'] = (int) $parms['width'];
if($safe) if(!empty($safe))
{ {
return '[img '.eHelper::buildAttr($safe).']'.$code_text.'[/img]'; return '[img '.eHelper::buildAttr($safe).']'.$code_text.'[/img]';
} }
return '[img]'.$code_text.'[/img]'; return '[img]'.$code_text.'[/img]';
} }
@@ -167,8 +169,6 @@ class bb_img extends e_bb_base
} }
var_dump($code_text);
if (preg_match("#\.php\?.*#",$code_text)){return "";} //XXX Breaks MediaManager Images, so do it after mediaManager check. if (preg_match("#\.php\?.*#",$code_text)){return "";} //XXX Breaks MediaManager Images, so do it after mediaManager check.
$addlink = FALSE; $addlink = FALSE;

View File

@@ -684,7 +684,7 @@ class e_bbcode
foreach($arr['img'] as $img) foreach($arr['img'] as $img)
{ {
if(substr($img['src'],0,4) == 'http' || strpos($img['src'], e_IMAGE_ABS.'emotes/')!==false) // dont resize external images or emoticons. if(/*substr($img['src'],0,4) == 'http' ||*/ strpos($img['src'], e_IMAGE_ABS.'emotes/')!==false) // dont resize external images or emoticons.
{ {
continue; continue;
} }
@@ -693,7 +693,7 @@ class e_bbcode
$qr = $tp->thumbUrlDecode($img['src']); // extract width/height and src from thumb URLs. $qr = $tp->thumbUrlDecode($img['src']); // extract width/height and src from thumb URLs.
if(substr($qr['src'],0,4)!=='http' && empty($qr['w']) && empty($qr['aw'])) if(strpos($qr['src'],'http')!==0 && empty($qr['w']) && empty($qr['aw']))
{ {
$qr['w'] = $img['width']; $qr['w'] = $img['width'];
$qr['h'] = $img['height']; $qr['h'] = $img['height'];
@@ -701,7 +701,7 @@ class e_bbcode
$qr['ebase'] = true; $qr['ebase'] = true;
unset($img['src'],$img['srcset'],$img['@value'], $img['caption'], $img['alt']);
if(!empty($img['class'])) if(!empty($img['class']))
{ {
@@ -729,9 +729,14 @@ class e_bbcode
} }
$parms = !empty($img) ? ' '.str_replace('+', ' ', http_build_query($img,null, '&')) : "";
$code_text = str_replace($tp->getUrlConstants('raw'), $tp->getUrlConstants('sc'), $qr['src']);
$code_text = (strpos($img['src'],'http') === 0) ? $img['src'] : str_replace($tp->getUrlConstants('raw'), $tp->getUrlConstants('sc'), $qr['src']);
unset($img['src'],$img['srcset'],$img['@value'], $img['caption'], $img['alt']);
$parms = !empty($img) ? ' '.str_replace('+', ' ', http_build_query($img,null, '&')) : "";
$replacement = '[img'.$parms.']'.$code_text.'[/img]'; $replacement = '[img'.$parms.']'.$code_text.'[/img]';

View File

@@ -2628,7 +2628,7 @@ class e_parse extends e_parser
*/ */
public function staticUrl($path=null) public function staticUrl($path=null)
{ {
if(!defined('e_HTTP_STATIC')) if(!defined('e_HTTP_STATIC') || deftrue('e_ADMIN_AREA'))
{ {
// e107::getDebug()->log("e_HTTP_STATIC not defined"); // e107::getDebug()->log("e_HTTP_STATIC not defined");
return ($path === null) ? e_HTTP : $path; return ($path === null) ? e_HTTP : $path;

View File

@@ -19,6 +19,7 @@ $_E107['no_menus'] = true;
$_E107['no_forceuserupdate'] = true; $_E107['no_forceuserupdate'] = true;
$_E107['no_maintenance'] = true; $_E107['no_maintenance'] = true;
define('e_ADMIN_AREA', true);
if(!defined('TINYMCE_DEBUG')) if(!defined('TINYMCE_DEBUG'))
{ {
require_once("../../../../class2.php"); require_once("../../../../class2.php");