mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-16 00:11:35 +00:00
Show HTML files in the HTML sandbox if enabled
This commit is contained in:
parent
63dd344c02
commit
4a5cc454ce
3 changed files with 50 additions and 1 deletions
|
|
@ -296,6 +296,22 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
return in_array(strtolower($extension), static::MODEL_EXTS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this is a locally stored HTML file, which can be shown by the sandbox viewer.
|
||||
* This is the case if we have an internal path with a html extension.
|
||||
* @return bool
|
||||
*/
|
||||
public function isLocalHTMLFile(): bool
|
||||
{
|
||||
if($this->hasInternal()){
|
||||
|
||||
$extension = pathinfo($this->getFilename(), PATHINFO_EXTENSION);
|
||||
|
||||
return in_array(strtolower($extension), ['html', 'htm'], true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this attachment has a path to an external file
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue