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

This commit is contained in:
Uwe Steinmann 2017-03-03 08:58:09 +01:00
commit b76448c3a4
5 changed files with 57 additions and 31 deletions

View File

@ -88,6 +88,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

@ -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

@ -244,7 +244,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);
@ -281,7 +281,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) {
@ -307,7 +307,7 @@ for ($file_num=0;$file_num<count($_FILES["userfile"]["tmp_name"]);$file_num++){
$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); $version_comment, $attributes, $attributes_version, $workflow);

View File

@ -454,6 +454,10 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$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";
@ -462,11 +466,12 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
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);
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

@ -300,12 +300,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 {
@ -315,7 +312,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 {
@ -323,13 +320,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