1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01: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.
$maxFileSize = e107::pref('core', 'upload_maxfilesize','20M');
$maxFileSize = e107::pref('core', 'upload_maxfilesize');
if(empty($maxFileSize))
{
$maxFileSize = "20M";
}
$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').'">

View File

@ -433,7 +433,7 @@ class news_admin_ui extends e_admin_ui
protected $fields = array(
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
'news_id' => array('title' => LAN_ID, 'type' => 'text', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'readParms'=>'link=sef&target=blank'),
'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'method', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>false),
'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'method', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60', 'readonly'=>false),
'news_title' => array('title' => LAN_TITLE, 'type' => 'text', 'tab'=>0, 'writeParms'=> array('required'=> 1, 'size'=>'block-level'), 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_summary' => array('title' => LAN_SUMMARY, 'type' => 'text', 'tab'=>0, 'writeParms'=>'size=block-level', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left', 'nosort' => false),
'news_body' => array('title' => "", 'type' => 'method', 'tab'=>0, 'nolist'=>true, 'writeParms'=>'nolabel=1','data'=>'str', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
@ -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[1]', varset($thumbTmp[1]), varset($paths[1]),'media=news&video=1');
$text .= $frm->imagepicker('news_thumbnail[2]', varset($thumbTmp[2]), varset($paths[2]),'media=news&video=1');
$text .= $frm->imagepicker('news_thumbnail[3]', varset($thumbTmp[3]), varset($paths[3]),'media=news&video=1');
$text .= $frm->imagepicker('news_thumbnail[4]', varset($thumbTmp[4]), varset($paths[4]),'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&legacyPath={e_IMAGE}newspost_images');
$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&legacyPath={e_IMAGE}newspost_images');
$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>";
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 .= "
</td>

View File

@ -1098,7 +1098,8 @@ class e_form
{
$sc_parameters['media'] = '_common';
}
$default_thumb = $default;
$class = '';
@ -1112,14 +1113,25 @@ class e_form
}
else
{
if('{' != $default[0])
if('{' != $default[0]) // legacy path or one without {}
{
// convert to sc path
$default_thumb = $tp->createConstants($default, 'nice');
$default = $tp->createConstants($default, 'mix');
list($default_thumb,$default) = $this->imagepickerDefault($default, $sc_parameters);
}
$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;
@ -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)
{
// 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");
if($in)