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

This commit is contained in:
Uwe Steinmann 2017-03-03 09:43:45 +01:00
commit 012d4d9f8d
15 changed files with 159 additions and 135 deletions

View File

@ -25,6 +25,7 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.1 Changes in version 5.1.1
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- fix initial creation of postgres database
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.0 Changes in version 5.1.0
@ -111,6 +112,8 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.34 Changes in version 4.3.34
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- add multibyte save basename() replacement, which fixes uploading files whose
name starts with a multibyte char
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.33 Changes in version 4.3.33

View File

@ -39,16 +39,17 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
} }
$output = ''; $output = '';
do {
$timeleft = $timeout - time(); $timeleft = $timeout - time();
$read = array($pipes[1]); $read = array($pipes[1]);
$write = NULL; $write = NULL;
$exeptions = NULL; $exeptions = NULL;
do {
stream_select($read, $write, $exeptions, $timeleft, 200000); stream_select($read, $write, $exeptions, $timeleft, 200000);
if (!empty($read)) { if (!empty($read)) {
$output .= fread($pipes[1], 8192); $output .= fread($pipes[1], 8192);
} }
$timeleft = $timeout - time();
} while (!feof($pipes[1]) && $timeleft > 0); } while (!feof($pipes[1]) && $timeleft > 0);
if ($timeleft <= 0) { if ($timeleft <= 0) {
@ -127,20 +128,13 @@ class SeedDMS_Lucene_IndexedDocument extends Zend_Search_Lucene_Document {
$mimetype = $version->getMimeType(); $mimetype = $version->getMimeType();
if(isset($_convcmd[$mimetype])) { if(isset($_convcmd[$mimetype])) {
$cmd = sprintf($_convcmd[$mimetype], $path); $cmd = sprintf($_convcmd[$mimetype], $path);
try {
$content = self::execWithTimeout($cmd, $timeout); $content = self::execWithTimeout($cmd, $timeout);
/*
$fp = popen($cmd, 'r');
if($fp) {
$content = '';
while(!feof($fp)) {
$content .= fread($fp, 2048);
}
pclose($fp);
}
*/
if($content) { if($content) {
$this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8')); $this->addField(Zend_Search_Lucene_Field::UnStored('content', $content, 'utf-8'));
} }
} catch (Exception $e) {
}
} }
} }
} }

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2016-04-28</date> <date>2017-03-01</date>
<time>08:11:19</time> <time>15:55:32</time>
<version> <version>
<release>1.1.9</release> <release>1.1.10</release>
<api>1.1.7</api> <api>1.1.10</api>
</version> </version>
<stability> <stability>
<release>stable</release> <release>stable</release>
@ -23,8 +23,7 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
pass variables to stream_select() to fullfill strict standards. catch exception in execWithTimeout()
make all functions in Indexer.php static
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">
@ -235,5 +234,22 @@ add command for indexing postѕcript files
set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0 set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0
</notes> </notes>
</release> </release>
<release>
<date>2016-04-28</date>
<time>08:11:19</time>
<version>
<release>1.1.9</release>
<api>1.1.7</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
pass variables to stream_select() to fullfill strict standards.
make all functions in Indexer.php static
</notes>
</release>
</changelog> </changelog>
</package> </package>

View File

@ -89,8 +89,13 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile); $target = $this->previewDir.$dir.md5($infile);
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) { if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
$cmd = ''; $cmd = '';
$mimeparts = explode('/', $mimetype, 2);
if(isset($this->converters[$mimetype])) { if(isset($this->converters[$mimetype])) {
$cmd = str_replace(array('%f', '%o'), array($infile, $target.'.pdf'), $this->converters[$mimetype]); $cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimetype]);
} elseif(isset($this->converters[$mimeparts[0].'/*'])) {
$cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimeparts[0].'/*']);
} elseif(isset($this->converters['*'])) {
$cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters['*']);
} }
if($cmd) { if($cmd) {
try { try {

View File

@ -106,9 +106,15 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile).'-'.$width; $target = $this->previewDir.$dir.md5($infile).'-'.$width;
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) { if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
$cmd = ''; $cmd = '';
$mimeparts = explode('/', $mimetype, 2);
if(isset($this->converters[$mimetype])) { if(isset($this->converters[$mimetype])) {
$cmd = str_replace(array('%w', '%f', '%o'), array($width, $infile, $target.'.png'), $this->converters[$mimetype]); $cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimetype]);
} elseif(isset($this->converters[$mimeparts[0].'/*'])) {
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimeparts[0].'/*']);
} elseif(isset($this->converters['*'])) {
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters['*']);
} }
/* /*
switch($mimetype) { switch($mimetype) {
case "image/png": case "image/png":
@ -131,7 +137,6 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
} }
*/ */
if($cmd) { if($cmd) {
//exec($cmd);
try { try {
self::execWithTimeout($cmd, $this->timeout); self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) { } catch(Exception $e) {

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2016-11-15</date> <date>2017-03-02</date>
<time>21:00:26</time> <time>07:14:59</time>
<version> <version>
<release>1.2.1</release> <release>1.2.2</release>
<api>1.2.0</api> <api>1.2.0</api>
</version> </version>
<stability> <stability>
@ -23,7 +23,8 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
setConverters() overrides exiting converters commands can be set for mimetypes 'xxxx/*' and '*'
pass mimetype as parameter '%m' to converter
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">
@ -254,5 +255,21 @@ check if cache dir exists before deleting it in deleteDocumentPreviews()
add new previewer which converts document to pdf instead of png add new previewer which converts document to pdf instead of png
</notes> </notes>
</release> </release>
<release>
<date>2016-11-15</date>
<time>21:00:26</time>
<version>
<release>1.2.1</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
setConverters() overrides exiting converters
</notes>
</release>
</changelog> </changelog>
</package> </package>

View File

@ -133,10 +133,13 @@ class SeedDMS_SQLiteFTS_IndexedDocument extends SeedDMS_SQLiteFTS_Document {
$mimetype = $version->getMimeType(); $mimetype = $version->getMimeType();
if(isset($_convcmd[$mimetype])) { if(isset($_convcmd[$mimetype])) {
$cmd = sprintf($_convcmd[$mimetype], $path); $cmd = sprintf($_convcmd[$mimetype], $path);
try {
$content = self::execWithTimeout($cmd, $timeout); $content = self::execWithTimeout($cmd, $timeout);
if($content) { if($content) {
$this->addField('content', $content, 'unstored'); $this->addField('content', $content, 'unstored');
} }
} catch (Exception $e) {
}
} }
} }
} }

View File

@ -11,11 +11,11 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2016-03-29</date> <date>2017-03-01</date>
<time>08:09:48</time> <time>15:53:24</time>
<version> <version>
<release>1.0.6</release> <release>1.0.7</release>
<api>1.0.1</api> <api>1.0.7</api>
</version> </version>
<stability> <stability>
<release>stable</release> <release>stable</release>
@ -23,7 +23,7 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
fix calculation of timeout (see bug #269) catch exception in execWithTimeout()
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">
@ -162,5 +162,21 @@ make it work with sqlite3 &lt; 3.8.0
set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0 set last parameter of stream_select() to 200000 micro sec. in case the timeout in sec. is set to 0
</notes> </notes>
</release> </release>
<release>
<date>2016-03-29</date>
<time>08:09:48</time>
<version>
<release>1.0.6</release>
<api>1.0.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
fix calculation of timeout (see bug #269)
</notes>
</release>
</changelog> </changelog>
</package> </package>

View File

@ -66,7 +66,7 @@ class SeedDMS_Controller_AddDocument extends SeedDMS_Controller_Common {
if($result === null) { if($result === null) {
$filesize = SeedDMS_Core_File::fileSize($userfiletmp); $filesize = SeedDMS_Core_File::fileSize($userfiletmp);
$res = $folder->addDocument($name, $comment, $expires, $owner, $keywords, $res = $folder->addDocument($name, $comment, $expires, $owner, $keywords,
$cats, $userfiletmp, basename($userfilename), $cats, $userfiletmp, utf8_basename($userfilename),
$filetype, $userfiletype, $sequence, $filetype, $userfiletype, $sequence,
$reviewers, $approvers, $reqversion, $reviewers, $approvers, $reqversion,
$version_comment, $attributes, $attributes_version, $workflow, $initialdocumentstatus); $version_comment, $attributes, $attributes_version, $workflow, $initialdocumentstatus);

View File

@ -339,6 +339,27 @@ function dskspace($dir) { /* {{{ */
return $space; return $space;
} /* }}} */ } /* }}} */
/**
* Replacement of PHP's basename function
*
* Because basename is locale dependent and strips off non ascii chars
* from the beginning of filename, it cannot be used in a environment
* where locale is set to e.g. 'C'
*/
function utf8_basename($path, $suffix='') { /* {{{ */
$rpos = strrpos($path, DIRECTORY_SEPARATOR);
if($rpos === false)
return $path;
$file = substr($path, $rpos+1);
$suflen = strlen($suffix);
if($suflen && (substr($file, -$suflen) == $suffix)){
$file = substr($file, 0, -$suflen);
}
return $file;
} /* }}} */
/** /**
* Log a message * Log a message
* *

View File

@ -279,7 +279,7 @@ if(isset($_POST['fineuploaderuuids']) && $_POST['fineuploaderuuids']) {
$uuids = explode(';', $_POST['fineuploaderuuids']); $uuids = explode(';', $_POST['fineuploaderuuids']);
$names = explode(';', $_POST['fineuploadernames']); $names = explode(';', $_POST['fineuploadernames']);
foreach($uuids as $i=>$uuid) { foreach($uuids as $i=>$uuid) {
$fullfile = $settings->_stagingDir.'/'.basename($uuid); $fullfile = $settings->_stagingDir.'/'.utf8_basename($uuid);
if(file_exists($fullfile)) { if(file_exists($fullfile)) {
$finfo = finfo_open(FILEINFO_MIME_TYPE); $finfo = finfo_open(FILEINFO_MIME_TYPE);
$mimetype = finfo_file($finfo, $fullfile); $mimetype = finfo_file($finfo, $fullfile);
@ -366,7 +366,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
if ((count($_FILES["userfile"]["tmp_name"])==1)&&($_POST["name"]!="")) if ((count($_FILES["userfile"]["tmp_name"])==1)&&($_POST["name"]!=""))
$name = trim($_POST["name"]); $name = trim($_POST["name"]);
else $name = basename($userfilename); else $name = utf8_basename($userfilename);
/* Check if name already exists in the folder */ /* Check if name already exists in the folder */
if(!$settings->_enableDuplicateDocNames) { if(!$settings->_enableDuplicateDocNames) {
@ -406,66 +406,6 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
if(!$document = $controller->run()) { if(!$document = $controller->run()) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg())); UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText($controller->getErrorMsg()));
} else { } else {
<<<<<<< HEAD
=======
$document = $res[0];
/* Set access as specified in settings. */
if($settings->_defaultAccessDocs) {
if($settings->_defaultAccessDocs > 0 && $settings->_defaultAccessDocs < 4) {
$document->setInheritAccess(0, true);
$document->setDefaultAccess($settings->_defaultAccessDocs, true);
}
}
if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) {
if (method_exists($hookObj, 'postAddDocument')) {
$hookObj->postAddDocument($document);
}
}
}
if($settings->_enableFullSearch) {
$index = $indexconf['Indexer']::open($settings->_luceneDir);
if($index) {
$indexconf['Indexer']::init($settings->_stopWordsFile);
$idoc = new $indexconf['IndexedDocument']($dms, $document, isset($settings->_converters['fulltext']) ? $settings->_converters['fulltext'] : null, !($filesize < $settings->_maxSizeForFullText));
if(isset($GLOBALS['SEEDDMS_HOOKS']['addDocument'])) {
foreach($GLOBALS['SEEDDMS_HOOKS']['addDocument'] as $hookObj) {
if (method_exists($hookObj, 'preIndexDocument')) {
$hookObj->preIndexDocument(null, $document, $idoc);
}
}
}
$index->addDocument($idoc);
}
}
/* Add a default notification for the owner of the document */
if($settings->_enableOwnerNotification) {
$res = $document->addNotify($user->getID(), true);
}
/* Check if additional notification shall be added */
if(!empty($_POST['notification_users'])) {
foreach($_POST['notification_users'] as $notuserid) {
$notuser = $dms->getUser($notuserid);
if($notuser) {
if($document->getAccessMode($user) >= M_READ)
$res = $document->addNotify($notuserid, true);
}
}
}
if(!empty($_POST['notification_groups'])) {
foreach($_POST['notification_groups'] as $notgroupid) {
$notgroup = $dms->getGroup($notgroupid);
if($notgroup) {
if($document->getGroupAccessMode($notgroup) >= M_READ)
$res = $document->addNotify($notgroupid, false);
}
}
}
>>>>>>> seeddms-5.1.x
// Send notification to subscribers of folder. // Send notification to subscribers of folder.
if($notifier) { if($notifier) {
$fnl = $folder->getNotifyList(); $fnl = $folder->getNotifyList();

View File

@ -204,7 +204,7 @@ if ($action == "saveSettings")
$settings->_converters['fulltext'] = $_POST["converters"]["fulltext"]; $settings->_converters['fulltext'] = $_POST["converters"]["fulltext"];
else else
$settings->_converters['fulltext'] = $_POST["converters"]; $settings->_converters['fulltext'] = $_POST["converters"];
$newmimetype = preg_replace('#[^A-Za-z0-9_/+.-]+#', '', $settings->_converters["fulltext"]["newmimetype"]); $newmimetype = preg_replace('#[^A-Za-z0-9_/+.-*]+#', '', $settings->_converters["fulltext"]["newmimetype"]);
if($newmimetype && trim($settings->_converters['fulltext']['newcmd'])) if($newmimetype && trim($settings->_converters['fulltext']['newcmd']))
$settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']); $settings->_converters['fulltext'][$newmimetype] = trim($settings->_converters['fulltext']['newcmd']);
unset($settings->_converters['fulltext']['newmimetype']); unset($settings->_converters['fulltext']['newmimetype']);
@ -212,7 +212,7 @@ if ($action == "saveSettings")
if(isset($_POST["converters"]["preview"])) if(isset($_POST["converters"]["preview"]))
$settings->_converters['preview'] = $_POST["converters"]["preview"]; $settings->_converters['preview'] = $_POST["converters"]["preview"];
$newmimetype = preg_replace('#[^A-Za-z0-9_/+.-]+#', '', $settings->_converters["preview"]["newmimetype"]); $newmimetype = preg_replace('#[^A-Za-z0-9_/+.-*]+#', '', $settings->_converters["preview"]["newmimetype"]);
if($newmimetype && trim($settings->_converters['preview']['newcmd'])) if($newmimetype && trim($settings->_converters['preview']['newcmd']))
$settings->_converters['preview'][$newmimetype] = trim($settings->_converters['preview']['newcmd']); $settings->_converters['preview'][$newmimetype] = trim($settings->_converters['preview']['newcmd']);
unset($settings->_converters['preview']['newmimetype']); unset($settings->_converters['preview']['newmimetype']);

View File

@ -62,6 +62,7 @@ function check_queue() {
data: {command: 'indexdocument', id: docid}, data: {command: 'indexdocument', id: docid},
beforeSend: function() { beforeSend: function() {
queue_count++; // Add request to the counter queue_count++; // Add request to the counter
$('.queue-bar').css('width', (queue_count*100/MAX_REQUESTS)+'%');
}, },
error: function(xhr, textstatus) { error: function(xhr, textstatus) {
noty({ noty({

View File

@ -552,6 +552,10 @@ $(document).ready( function() {
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); $this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart(); // $this->contentContainerStart();
$txt = $this->callHook('searchListHeader', $folder, $orderby);
if(is_string($txt))
echo $txt;
else {
print "<table class=\"table table-hover\">"; print "<table class=\"table table-hover\">";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th></th>\n"; print "<th></th>\n";
@ -560,12 +564,13 @@ $(document).ready( function() {
print "<th>".getMLText("status")."</th>\n"; print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n"; print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
}
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout); $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters); $previewer->setConverters($previewconverters);
foreach ($entries as $entry) { foreach ($entries as $entry) {
if(get_class($entry) == $dms->getClassname('document')) { if(get_class($entry) == $dms->getClassname('document')) {
$txt = $this->callHook('documentListItem', $entry, $previewer); $txt = $this->callHook('documentListItem', $entry, $previewer, 'search');
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
else { else {

View File

@ -302,12 +302,9 @@ function folderSelected(id, name) {
print "<th>".getMLText("action")."</th>\n"; print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n"; print "</tr>\n</thead>\n<tbody>\n";
} }
}
else printMLText("empty_folder_list");
foreach($subFolders as $subFolder) { foreach($subFolders as $subFolder) {
$txt = $this->callHook('folderListItem', $subFolder); $txt = $this->callHook('folderListItem', $subFolder, 'viewfolder');
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
else { else {
@ -317,7 +314,7 @@ function folderSelected(id, name) {
foreach($documents as $document) { foreach($documents as $document) {
$document->verifyLastestContentExpriry(); $document->verifyLastestContentExpriry();
$txt = $this->callHook('documentListItem', $document, $previewer); $txt = $this->callHook('documentListItem', $document, $previewer, 'viewfolder');
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
else { else {
@ -325,13 +322,14 @@ function folderSelected(id, name) {
} }
} }
if ((count($subFolders) > 0)||(count($documents) > 0)) {
$txt = $this->callHook('folderListFooter', $folder); $txt = $this->callHook('folderListFooter', $folder);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
else else
echo "</tbody>\n</table>\n"; echo "</tbody>\n</table>\n";
} }
else printMLText("empty_folder_list");
echo "</div>\n"; // End of right column div echo "</div>\n"; // End of right column div
echo "</div>\n"; // End of div around left and right column echo "</div>\n"; // End of div around left and right column