allow to insert files with differing extension but same basename and mimetype

This commit is contained in:
Garvin Hicking 2011-04-21 15:07:33 +00:00
parent 288c937f60
commit 18ff07d7ce
2 changed files with 11 additions and 5 deletions

View File

@ -3,6 +3,10 @@
Version 1.6 ()
------------------------------------------------------------------------
* Fixed a bug in synchronizing new files with the same basename
but different extensions, where files with the same mimetype
would not get added (garvinhicking)
* Show subscription status of comments in frontend and backend
* Added ability to report spam/ham to akismet (Black Warthog)

View File

@ -573,7 +573,7 @@ function serendipity_insertImageInDatabase($filename, $directory, $authorid = 0,
serendipity_db_escape_string($directory),
serendipity_db_escape_string($realname)
);
$sql = serendipity_db_query($query);
if (is_string($sql)) {
echo $query . '<br />';
@ -1152,15 +1152,17 @@ function serendipity_syncThumbs($deleteThumbs = false) {
$cond = array(
'and' => "WHERE name = '" . serendipity_db_escape_string($fbase) . "'
" . ($fdir != '' ? "AND path = '" . serendipity_db_escape_string($fdir) . "'" : '') . "
AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'"
AND mime = '" . serendipity_db_escape_string($fdim['mime']) . "'
AND extension = '" . serendipity_db_escape_string($f[1]) . "'"
);
serendipity_ACL_SQL($cond, false, 'directory');
$rs = serendipity_db_query("SELECT *
FROM {$serendipity['dbPrefix']}images AS i
{$cond['joins']}
{$cond['and']}", true, 'assoc');
if (is_array($rs)) {
// This image is in the database. Check our calculated data against the database data.
$update = array();
@ -1187,12 +1189,12 @@ function serendipity_syncThumbs($deleteThumbs = false) {
/* Do the database update, if needed */
if (sizeof($update) != 0) {
printf(FOUND_FILE . '<br />', $files[$x]);
printf(FOUND_FILE . ' (2)<br />', $files[$x]);
serendipity_updateImageInDatabase($update, $rs['id']);
$i++;
}
} else {
printf(FOUND_FILE . '<br />', $files[$x]);
printf(FOUND_FILE . ' (1)<br />', $files[$x]);
serendipity_insertImageInDatabase($fbase . '.' . $f[1], $fdir, 0, filemtime($ffull));
$i++;
}