protected function convertValuesToPaths()
{
if (empty($this->varValue)) {
return;
}
if (!is_array($this->varValue)) {
$this->varValue = array($this->varValue);
} elseif (empty($this->varValue[0])) {
$this->varValue = array();
}
if (empty($this->varValue)) {
return;
}
// TinyMCE will pass the path instead of the ID
if (strpos($this->varValue[0], \Config::get('uploadPath') . '/') === 0) {
return;
}
// Ignore the numeric IDs when in switch mode (TinyMCE)
if (\Input::get('switch')) {
return;
}
// Return if the custom path is not within the upload path (see #8562)
if ($this->path != '' && strpos($this->path, \Config::get('uploadPath') . '/') !== 0) {
return;
}
$objFiles = \FilesModel::findMultipleByIds($this->varValue);
if ($objFiles !== null) {
$this->varValue = array_values($objFiles->fetchEach('path'));
}
}