aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-12-13 14:41:59 +0000
committerplegall <plg@piwigo.org>2011-12-13 14:41:59 +0000
commitdf9bc84102b7bb5ee57ab07ccac816644057020f (patch)
tree674bb23fbb2ace7084bdd44c52d1111ec1af5e72 /include/ws_functions.inc.php
parent5dca66c7d1d6ff04f313d371ea2bf45284d20862 (diff)
feature 2533 added: ability to deactivate uniqueness check on pwg.images.add
git-svn-id: http://piwigo.org/svn/branches/2.3@12725 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r--include/ws_functions.inc.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 3d5d823c3..dd3c79086 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1634,24 +1634,27 @@ function ws_images_add($params, &$service)
}
// does the image already exists ?
- if ('md5sum' == $conf['uniqueness_mode'])
- {
- $where_clause = "md5sum = '".$params['original_sum']."'";
- }
- if ('filename' == $conf['uniqueness_mode'])
+ if ($params['check_uniqueness'])
{
- $where_clause = "file = '".$params['original_filename']."'";
- }
+ if ('md5sum' == $conf['uniqueness_mode'])
+ {
+ $where_clause = "md5sum = '".$params['original_sum']."'";
+ }
+ if ('filename' == $conf['uniqueness_mode'])
+ {
+ $where_clause = "file = '".$params['original_filename']."'";
+ }
- $query = '
+ $query = '
SELECT
COUNT(*) AS counter
FROM '.IMAGES_TABLE.'
WHERE '.$where_clause.'
;';
- list($counter) = pwg_db_fetch_row(pwg_query($query));
- if ($counter != 0) {
- return new PwgError(500, 'file already exists');
+ list($counter) = pwg_db_fetch_row(pwg_query($query));
+ if ($counter != 0) {
+ return new PwgError(500, 'file already exists');
+ }
}
if ($params['resize'])