Skip to content
Snippets Groups Projects
Commit 082aeec1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge remote branch 'upstream/develop' into develop-next

Conflicts:
	include/class.file.php
parents db0cf05c 306b7ef8
No related branches found
No related tags found
No related merge requests found
......@@ -261,14 +261,16 @@ class AttachmentFile extends VerySimpleModel {
}
function download($name=false, $disposition=false, $expires=false) {
$disposition = $disposition ?: 'inline';
$disposition = ($disposition && strcasecmp($disposition, 'inline') == 0
&& strpos($this->getType(), 'image/') !== false)
? 'inline' : 'attachment';
$bk = $this->open();
if ($bk->sendRedirectUrl($disposition))
return;
$ttl = ($expires) ? $expires - Misc::gmtime() : false;
$this->makeCacheable($ttl);
$type = $this->getType() ?: 'application/octet-stream';
Http::download($this->getName(), $type, null, 'inline');
Http::download($name ?: $this->getName(), $type, null, $disposition);
header('Content-Length: '.$this->getSize());
$this->sendData(false);
exit();
......
......@@ -212,7 +212,7 @@ class Validator {
}
static function is_formula($text, &$error='') {
if (!preg_match('/^[^=\+@-].*$/', $text))
if (!preg_match('/^[^=\+@-].*$/s', $text))
$error = __('Content cannot start with the following characters: = - + @');
return $error == '';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment