1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Fixes media-manager upload issue when no limit found. legacyPath option added to imagepicker()

This commit is contained in:
Cameron
2016-12-03 20:47:26 -08:00
parent 03a6a63694
commit 7adf8590f6
5 changed files with 59 additions and 14 deletions

View File

@@ -1095,7 +1095,12 @@ class media_admin_ui extends e_admin_ui
// if 'for' has no value, files are placed in /temp and not added to the db. // if 'for' has no value, files are placed in /temp and not added to the db.
$maxFileSize = e107::pref('core', 'upload_maxfilesize','20M'); $maxFileSize = e107::pref('core', 'upload_maxfilesize');
if(empty($maxFileSize))
{
$maxFileSize = "20M";
}
$text = "<h4>".IMALAN_145."</h4>"; $text = "<h4>".IMALAN_145."</h4>";
$text .= '<div id="uploader" data-max-size="'.str_replace('M','mb',$maxFileSize).'" rel="'.e_JS.'plupload/upload.php?for='.$this->getQuery('for').'"> $text .= '<div id="uploader" data-max-size="'.str_replace('M','mb',$maxFileSize).'" rel="'.e_JS.'plupload/upload.php?for='.$this->getQuery('for').'">

View File

@@ -1629,11 +1629,11 @@ class news_form_ui extends e_admin_form_ui
} }
} }
$text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]),'media=news&video=1'); $text = $frm->imagepicker('news_thumbnail[0]', varset($thumbTmp[0]), varset($paths[0]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]), varset($paths[1]),'media=news&video=1'); $text .= $frm->imagepicker('news_thumbnail[1]', varset($thumbTmp[1]), varset($paths[1]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]),'media=news&video=1'); $text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]),'media=news&video=1'); $text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]),'media=news&video=1'); $text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]),'media=news&video=1&legacyPath={e_IMAGE}newspost_images');
// $text .= "<div class='field-help'>Insert image/video into designated area of template.</div>"; // $text .= "<div class='field-help'>Insert image/video into designated area of template.</div>";
return $text; return $text;

View File

@@ -370,7 +370,7 @@ if(!empty($pref['sitebutton']) && strpos($pref['sitebutton'],'{')===false && fil
$text .= $frm->imagepicker('sitebutton',$pref['sitebutton'],'','help='.PRFLAN_225); $text .= $frm->imagepicker('sitebutton',$pref['sitebutton'],'','help='.PRFLAN_225); //todo use 'LegacyPath' option instead of code above.
$text .= " $text .= "
</td> </td>

View File

@@ -1099,6 +1099,7 @@ class e_form
$sc_parameters['media'] = '_common'; $sc_parameters['media'] = '_common';
} }
$default_thumb = $default; $default_thumb = $default;
$class = ''; $class = '';
@@ -1112,14 +1113,25 @@ class e_form
} }
else else
{ {
if('{' != $default[0]) if('{' != $default[0]) // legacy path or one without {}
{ {
// convert to sc path list($default_thumb,$default) = $this->imagepickerDefault($default, $sc_parameters);
$default_thumb = $tp->createConstants($default, 'nice');
$default = $tp->createConstants($default, 'mix');
} }
$default_url = $tp->replaceConstants($default, 'abs'); $default_url = $tp->replaceConstants($default, 'abs');
} }
$debugInfo = "
<pre>
default-thumb: ".$default_thumb."
defautlt: ".$default."
default-url: ".$default_url."
</pre>";
// e107::getDebug()->log($debugInfo);
$blank = FALSE; $blank = FALSE;
@@ -1198,7 +1210,35 @@ class e_form
} }
private function imagepickerDefault($path, $parms=array())
{
$tp = e107::getParser();
if(!empty($parms['legacyPath'])) // look in a specific path.
{
$legacyDefault = rtrim($parms['legacyPath'],'/')."/".$path;
$legacyRel = $tp->replaceConstants($legacyDefault);
if(is_readable($legacyRel))
{
return array($legacyDefault, $legacyDefault);
}
else
{
// e107::getDebug()->log("Legacy Default:".$legacyDefault);
// e107::getDebug()->log("wasnt found:".$legacyRel);
}
}
$path = str_replace('e_MEDIA_IMAGE/','{e_MEDIA_IMAGE}',$path);
$default_thumb = $tp->createConstants($path, 'nice');
$default = $tp->createConstants($path, 'mix');
return array($default_thumb, $default);
}
/** /**

View File

@@ -118,7 +118,7 @@
if($out) if($out)
{ {
// Read binary input stream and append it to temp file // Read binary input stream and append it to temp file
$tmpName = e107::getParser()->filter($_FILES['file']['tmp_name'],'w'); $tmpName = e107::getParser()->filter($_FILES['file']['tmp_name'],'str');
$in = fopen($tmpName, "rb"); $in = fopen($tmpName, "rb");
if($in) if($in)