Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2020-12-23 06:25:46 +01:00
commit 31ac06cfa8
10 changed files with 111 additions and 19 deletions

View File

@ -176,6 +176,8 @@ class SeedDMS_Preview_Base {
if($this->xsendfile && function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
} else {
$size = filesize($filename);
header("Content-Length: " . $size);
/* Make sure output buffering is off */
if (ob_get_level()) {
ob_end_clean();

View File

@ -4,17 +4,17 @@
<channel>pear.php.net</channel>
<summary>Create thumbnails from document content for SeedDMS</summary>
<description>SeedDMS is a web based document management system (DMS). These
are the classes to create preview images from the document content.</description>
are the classes to create preview images and pdf file from the document content.</description>
<lead>
<name>Uwe Steinmann</name>
<user>steinm</user>
<email>uwe@steinmann.cx</email>
<active>yes</active>
</lead>
<date>2020-03-21</date>
<date>2020-12-23</date>
<time>09:49:39</time>
<version>
<release>1.3.1</release>
<release>1.3.2</release>
<api>1.3.1</api>
</version>
<stability>
@ -23,7 +23,8 @@
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
add parameter $target to SeedDMS_Preview_pdfPreviewer::hasRawPreview() and SeedDMS_Preview_pdfPreviewer::getRawPreview()
set header Content-Length
update package description
</notes>
<contents>
<dir baseinstalldir="SeedDMS" name="/">
@ -436,5 +437,21 @@ fix creation of pdf preview if document content class is not SeedDMS_Core_Docume
add new methode getPreviewFile()
</notes>
</release>
<release>
<date>2020-03-21</date>
<time>09:49:39</time>
<version>
<release>1.3.1</release>
<api>1.3.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
add parameter $target to SeedDMS_Preview_pdfPreviewer::hasRawPreview() and SeedDMS_Preview_pdfPreviewer::getRawPreview()
</notes>
</release>
</changelog>
</package>

View File

@ -46,7 +46,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
if(null === $this->callHook('version')) {
if(file_exists($dms->contentDir . $content->getPath())) {
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($dms->contentDir . $content->getPath() ));
$efilename = rawurlencode($content->getOriginalFileName());
header("Content-Disposition: attachment; filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename);
header("Content-Type: " . $content->getMimeType());
@ -65,7 +64,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
if(null === $this->callHook('file')) {
if(file_exists($dms->contentDir . $file->getPath())) {
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($dms->contentDir . $file->getPath() ));
header("Content-Disposition: attachment; filename=\"" . $file->getOriginalFileName() . "\"");
header("Content-Type: " . $file->getMimeType());
header("Cache-Control: must-revalidate");
@ -86,7 +84,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
header('Content-Description: File Transfer');
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($basedir . $filename ));
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: public");
@ -106,7 +103,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
if(file_exists($basedir . $filename)) {
header("Content-Type: text/plain; name=\"" . $filename . "\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($basedir . $filename ));
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: must-revalidate");
@ -126,7 +122,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
if(file_exists($basedir . $filename)) {
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($basedir . $filename ));
$efilename = rawurlencode($filename);
header("Content-Disposition: attachment; filename=\"" .$efilename . "\"; filename*=UTF-8''".$efilename);
header("Cache-Control: must-revalidate");
@ -154,7 +149,6 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
header("Content-Type: ".$mimetype);
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename ));
header("Content-Disposition: attachment; filename=\"approval-" . $document->getID()."-".(int) $_GET['approvelogid'] . get_extension($mimetype) . "\"");
header("Cache-Control: must-revalidate");
sendFile($filename);

View File

@ -41,7 +41,6 @@ class SeedDMS_Controller_ExtensionMgr extends SeedDMS_Controller_Common {
if(null === $this->callHook('download')) {
if(file_exists($filename)) {
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=\"" . utf8_basename($filename) . "\"; filename*=UTF-8''".utf8_basename($filename));
header("Content-Type: application/zip");
header("Cache-Control: must-revalidate");

View File

@ -56,7 +56,6 @@ class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
} else {
header("Content-Disposition: filename=\"" . $efilename . "\"; filename*=UTF-8''".$efilename);
}
header("Content-Length: " . filesize($dms->contentDir . $content->getPath()));
header("Cache-Control: must-revalidate");
sendFile($dms->contentDir.$content->getPath());

View File

@ -128,7 +128,7 @@ Just open the settings in the admin tools and empty the currently set
encryption key on the tab 'System'. Save the settings and check the key again.
It should be new one. Save the settings again
UPDATING FROM A PREVIOUS VERSION OR SEEDDMS
UPGRATING FROM A PREVIOUS VERSION OR SEEDDMS
=============================================
As SeedDMS is a smooth continuation of LetoDMS there is no difference
@ -173,7 +173,7 @@ Fresh installation and take over of data
contain database updates.
- test your new installation.
Updating your current installation
Upgrading your current installation
-----------------------------------
- make a backup of your data folder and the configuration file settings.xml

View File

@ -24,3 +24,13 @@ XSendFilePath /var/www/seeddms51x/data/
If the XSendFilePath is not set propperly, you will notice an error message
in your apache log file, probably telling you that the download file could not
be found.
A positive side effect of xsendfile is support for content ranges which are
currently *not* supported by seeddms' Download and ViewOnline scripts. This is
especially usefull when previewing videos. Without content ranges it is not
possible to jump to certain time in the video.
In order to check if the xsendfile module is loaded, php uses apache_get_modules()
which is only available if php is loaded as an apache module. Running php in fpm
mode will prevent php from checking for xsendfile and consequently xsendfile support
will not be available.

View File

@ -661,11 +661,69 @@ function sendFile($filename) { /* {{{ */
if($settings->_enableXsendfile && function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
header("X-Sendfile: ".$filename);
} else {
/* Make sure output buffering is off */
if (ob_get_level()) {
ob_end_clean();
$size = filesize($filename);
header("Content-Length: " . $size);
if (isset($_SERVER['HTTP_RANGE'])) {
$fp = @fopen($filename, 'rb');
$length = $size; // Content length
$start = 0; // Start byte
$end = $size - 1; // End byte
header("Accept-Ranges: 0-$length");
$c_start = $start;
$c_end = $end;
list($unit, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
if (trim($unit) !== 'bytes') {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes $start-$end/$size");
exit;
}
if (strpos($range, ',') !== false) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes $start-$end/$size");
exit;
}
if ($range == '-') {
$c_start = $size - substr($range, 1);
} else {
$range = explode('-', $range);
$c_start = $range[0];
$c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
}
$c_end = ($c_end > $end) ? $end : $c_end;
if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
header('HTTP/1.1 416 Requested Range Not Satisfiable');
header("Content-Range: bytes $start-$end/$size");
exit;
}
$start = $c_start;
$end = $c_end;
$length = $end - $start + 1;
fseek($fp, $start);
header('HTTP/1.1 206 Partial Content');
header("Content-Range: bytes $start-$end/$size");
$buffer = 1024 * 8;
while(!feof($fp) && ($p = ftell($fp)) <= $end) {
if ($p + $buffer > $end) {
$buffer = $end - $p + 1;
}
set_time_limit(0);
echo fread($fp, $buffer);
flush();
}
fclose($fp);
} else {
/* Make sure output buffering is off */
if (ob_get_level()) {
ob_end_clean();
}
readfile($filename);
}
readfile($filename);
}
} /* }}} */

View File

@ -106,6 +106,19 @@ class SeedDMS_View_Info extends SeedDMS_Bootstrap_Style {
foreach(array_diff($requiredext, $phpextensions) as $extname)
echo "<tr><td>".$extname."</td><td>"."</td></tr>\n";
echo "</tbody>\n</table>\n";
if(function_exists('apache_get_modules')) {
$this->contentHeading(getMLText("installed_apache_extensions"));
$apacheextensions = apache_get_modules();
echo "<table class=\"table table-condensed\">\n";
echo "<thead>\n<tr>\n";
echo "<th>".getMLText("name");
echo "</th>\n";
echo "</tr>\n</thead>\n<tbody>\n";
foreach($apacheextensions as $extname)
echo "<tr><td>".$extname."</td><td>"."</td></tr>\n";
echo "</tbody>\n</table>\n";
}
}
$this->columnEnd();
$this->rowEnd();

View File

@ -371,7 +371,7 @@ class SeedDMS_View_Tasks extends SeedDMS_Bootstrap_Style {
}
if(!empty($tasks['rejected'])) {
$content .= " <li class=\"dropdown-submenu\">\n";
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("documents_user_rejected")."</a>\n";
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">".getMLText("documents_rejected")."</a>\n";
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
foreach($tasks['rejected'] as $t) {
$doc = $dms->getDocument($t['id']);