mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix #135 : substitution of a story image
This commit is contained in:
@@ -192,6 +192,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$this->path = $registry->get('GV_RootPath') . 'www/skins/icons/';
|
||||
$this->file = 'deleted.png';
|
||||
$this->is_physically_present = false;
|
||||
$this->is_substituted = true;
|
||||
}
|
||||
if (!$row || !file_exists($this->path . $this->file))
|
||||
{
|
||||
@@ -204,6 +205,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$this->path = $registry->get('GV_RootPath')
|
||||
. 'www/skins/icons/substitution/';
|
||||
$this->file = 'regroup_thumb.png';
|
||||
$this->is_substituted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -217,6 +219,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$this->path = $registry->get('GV_RootPath')
|
||||
. 'www/skins/icons/substitution/';
|
||||
$this->file = str_replace('+', '%20', $mime) . '.png';
|
||||
$this->is_substituted = true;
|
||||
}
|
||||
$this->is_physically_present = false;
|
||||
if (!file_exists($this->path . $this->file))
|
||||
@@ -225,6 +228,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
|
||||
$this->path = $registry->get('GV_RootPath')
|
||||
. 'www/skins/icons/';
|
||||
$this->file = 'substitution.png';
|
||||
$this->is_substituted = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -436,7 +436,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
|
||||
try
|
||||
{
|
||||
$reg_record = $this->get_grouping_head();
|
||||
$reg_sbas_id = $reg_record->get_base_id();
|
||||
$reg_sbas_id = $reg_record->get_sbas_id();
|
||||
|
||||
$newsubdef_reg = new record_adapter($reg_sbas_id, $request->get('newrepresent'));
|
||||
|
||||
@@ -452,7 +452,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -968,6 +968,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
try
|
||||
{
|
||||
$value = $this->get_subdef($name);
|
||||
|
||||
if ($value->is_substituted())
|
||||
{
|
||||
throw new Exception('Cannot replace a substitution');
|
||||
}
|
||||
|
||||
$original_file = p4string::addEndSlash($value->get_path()) . $value->get_file();
|
||||
unlink($original_file);
|
||||
}
|
||||
|
Reference in New Issue
Block a user