1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Upgrade Fixes - Legacy Download image paths and Download Category icons.

This commit is contained in:
Cameron
2016-12-05 15:41:19 -08:00
parent 11a90dcbbb
commit e6be1b8a2c
4 changed files with 56 additions and 13 deletions

View File

@@ -1743,7 +1743,7 @@ class e_parse extends e_parser
// Convert URL's to clickable links, unless modifiers or prefs override // Convert URL's to clickable links, unless modifiers or prefs override
if ($opts['link_click']) if ($opts['link_click'])
{ {
if ($opts['link_replace'] && ADMIN_AREA !== true) if ($opts['link_replace'] && defset('ADMIN_AREA') !== true)
{ {
$link_text = $pref['link_text']; $link_text = $pref['link_text'];
@@ -3796,8 +3796,8 @@ class e_parser
elseif(!empty($parm['legacy'])) // Search legacy path for image in a specific folder. No path, only file name provided. elseif(!empty($parm['legacy'])) // Search legacy path for image in a specific folder. No path, only file name provided.
{ {
$legacyPath = $parm['legacy'].$file; $legacyPath = rtrim($parm['legacy'],'/').'/'.$file;
$filePath = $tp->replaceConstants($legacyPath,'rel'); $filePath = $tp->replaceConstants($legacyPath);
if(is_readable($filePath)) if(is_readable($filePath))
{ {

View File

@@ -4340,7 +4340,7 @@ class e_form
$value = '<a href="'.$url.'" title="Direct link to '.$name.'" rel="external">'.$name.'</a>'; $value = '<a href="'.$url.'" title="Direct link to '.$name.'" rel="external">'.$name.'</a>';
break; break;
case 'image': //TODO - thumb, js tooltip... case 'image': //js tooltip...
if($value) if($value)
{ {
@@ -4396,13 +4396,27 @@ class e_form
{ {
$thparms['aw'] = intval($parms['thumb_aw']); $thparms['aw'] = intval($parms['thumb_aw']);
} }
if(!empty($parms['legacyPath']))
{
$thparms['legacy'] = $parms['legacyPath'];
$parms['pre'] = rtrim($parms['legacyPath'],'/').'/';
}
// return print_a($thparms,true); // return print_a($thparms,true);
$src = $tp->replaceConstants(vartrue($parms['pre']).$value, 'abs'); $src = $tp->replaceConstants(vartrue($parms['pre']).$value, 'abs');
$thsrc = $tp->thumbUrl(vartrue($parms['pre']).$value, $thparms, varset($parms['thumb_urlraw'])); $thsrc = $tp->thumbUrl(vartrue($parms['pre']).$value, $thparms, varset($parms['thumb_urlraw']));
$alt = basename($src); $alt = basename($src);
$ttl = '<img src="'.$thsrc.'" alt="'.$alt.'" class="thumbnail e-thumb" />'; // $ttl = '<img src="'.$thsrc.'" alt="'.$alt.'" class="thumbnail e-thumb" />';
$thparms['alt'] = $alt;
$thparms['class'] = "thumbnail e-thumb";
$ttl = $tp->toImage(vartrue($parms['pre']).$value, $thparms);
e107::getDebug()->log($value);
e107::getDebug()->log($thparms);
$value = '<a href="'.$src.'" data-modal-caption="'.$alt.'" data-target="#uiModal" class="e-modal e-image-preview" title="'.$alt.'" rel="external">'.$ttl.'</a>'; $value = '<a href="'.$src.'" data-modal-caption="'.$alt.'" data-target="#uiModal" class="e-modal e-image-preview" title="'.$alt.'" rel="external">'.$ttl.'</a>';
} }
else else
@@ -4419,7 +4433,7 @@ class e_form
$ret = '<ol>'; $ret = '<ol>';
for ($i=0; $i < 5; $i++) for ($i=0; $i < 5; $i++)
{ {
$k = $key.'['.$i.'][path]'; //$k = $key.'['.$i.'][path]';
$ival = $value[$i]['path']; $ival = $value[$i]['path'];
$ret .= '<li>'.$ival.'</li>'; $ret .= '<li>'.$ival.'</li>';
} }

View File

@@ -138,7 +138,7 @@ class download_cat_ui extends e_admin_ui
protected $fields = array( protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'download_category_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '5%', 'thclass' => 'center','class'=>'center','writeParms'=>'glyphs=1' ), 'download_category_icon' => array('title'=> LAN_ICON, 'type' => 'method', 'width' => '5%', 'thclass' => 'center','class'=>'center','writeParms'=>'glyphs=1' ),
'download_category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE), 'download_category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
'download_category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'), 'download_category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
'download_category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'), 'download_category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
@@ -196,6 +196,34 @@ class download_cat_form_ui extends e_admin_form_ui
break; break;
} }
} }
public function download_category_icon($curVal,$mode)
{
if(!empty($curVal) && strpos($curVal, chr(1)))
{
list($curVal,$tmp) = explode(chr(1),$curVal);
}
switch($mode)
{
case 'read':
return e107::getParser()->toIcon($curVal, array('legacy'=>'{e_IMAGE}icons/'));
break;
case 'write':
return $this->iconpicker('download_category_icon', $curVal,null,array('glyphs'=>true, 'legacyPath'=>'{e_IMAGE}icons/'));
break;
case 'filter':
case 'batch':
return null;
break;
}
}
} }
@@ -250,8 +278,8 @@ class download_main_admin_ui extends e_admin_ui
'download_active' => array('title'=> DOWLAN_21, 'type' => 'method', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true), 'download_active' => array('title'=> DOWLAN_21, 'type' => 'method', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
'download_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => ''), 'download_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => ''),
'download_thumb' => array('title'=> DOWLAN_20, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE ), 'download_thumb' => array('title'=> DOWLAN_20, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60&legacyPath={e_FILE}downloadthumbs', 'readonly'=>TRUE ),
'download_image' => array('title'=> DOWLAN_19, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'batch' => FALSE, 'filter'=>FALSE), 'download_image' => array('title'=> DOWLAN_19, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60&legacyPath={e_FILE}downloadimages', 'readonly'=>TRUE, 'batch' => FALSE, 'filter'=>FALSE),
'download_comment' => array('title'=> DOWLAN_102, 'type' => 'boolean', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true), 'download_comment' => array('title'=> DOWLAN_102, 'type' => 'boolean', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
'download_class' => array('title'=> DOWLAN_113, 'type' => 'userclass', 'width' => 'auto', 'inline'=>true, 'data' => 'int','batch' => TRUE, 'filter'=>TRUE), 'download_class' => array('title'=> DOWLAN_113, 'type' => 'userclass', 'width' => 'auto', 'inline'=>true, 'data' => 'int','batch' => TRUE, 'filter'=>TRUE),
@@ -1387,7 +1415,7 @@ $columnInfo = array(
$text .= " </select>"; $text .= " </select>";
*/ */
$text .= $frm->imagepicker('download_image', $download_image,'','download_image'); $text .= $frm->imagepicker('download_image', $download_image,'',array('mode'=>'download_image', 'legacyPath'=>'{e_FILE}downloadimages'));
if ($subAction == "dlm" && $download_image) if ($subAction == "dlm" && $download_image)
{ {
@@ -1418,7 +1446,7 @@ $columnInfo = array(
$text .= " </select>"; $text .= " </select>";
*/ */
$text .= $frm->imagepicker('download_thumb', $download_thumb,'','download_thumb'); $text .= $frm->imagepicker('download_thumb', $download_thumb,'',array('mode'=>'download_thumb', 'legacyPath'=>'{e_FILE}downloadthumbs'));
$text .= " $text .= "

View File

@@ -1124,7 +1124,8 @@ if(is_dir("remotefile")) {
} }
} }
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 2) { if (isset($pref['nfp_display']) && $pref['nfp_display'] == 2 && is_readable(e_PLUGIN."newforumposts_main/newforumposts_main.php"))
{
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
} }