Fix #607 #662 thumbnail_type=none always overrides custom setting

This commit is contained in:
Kijin Sung 2017-02-14 16:09:43 +09:00
parent b068dfe4ba
commit 3b7d0da0f6
2 changed files with 18 additions and 24 deletions

View file

@ -600,23 +600,20 @@ class commentItem extends Object
return;
}
// Get thumbnai_type information from document module's configuration
if(!in_array($thumbnail_type, array('crop', 'ratio', 'none')))
// Get thumbnail type information from document module's configuration
$config = $GLOBALS['__document_config__'];
if(!$config)
{
$config = $GLOBALS['__document_config__'];
if(!$config)
{
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
$GLOBALS['__document_config__'] = $config;
}
$thumbnail_type = $config->thumbnail_type ?: 'crop';
$config = $GLOBALS['__document_config__'] = getModel('document')->getDocumentConfig();
}
if ($thumbnail_type === 'none')
if ($config->thumbnail_type === 'none')
{
return;
}
if(!in_array($thumbnail_type, array('crop', 'ratio', 'none')))
{
$thumbnail_type = $config->thumbnail_type ?: 'crop';
}
if($this->isSecret() && !$this->isGranted())
{

View file

@ -879,23 +879,20 @@ class documentItem extends Object
// Return false if the document doesn't exist
if(!$this->document_srl) return;
// Get thumbnai_type information from document module's configuration
if(!in_array($thumbnail_type, array('crop', 'ratio', 'none')))
// Get thumbnail type information from document module's configuration
$config = $GLOBALS['__document_config__'];
if(!$config)
{
$config = $GLOBALS['__document_config__'];
if(!$config)
{
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
$GLOBALS['__document_config__'] = $config;
}
$thumbnail_type = $config->thumbnail_type ?: 'crop';
$config = $GLOBALS['__document_config__'] = getModel('document')->getDocumentConfig();
}
if ($thumbnail_type === 'none')
if ($config->thumbnail_type === 'none')
{
return;
}
if(!in_array($thumbnail_type, array('crop', 'ratio', 'none')))
{
$thumbnail_type = $config->thumbnail_type ?: 'crop';
}
if($this->isSecret() && !$this->isGranted())
{