Changeset 2683
- Timestamp:
- Oct 8, 2008, 12:01:14 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2672 r2683 1458 1458 return $creation_output; 1459 1459 } 1460 1461 function ws_images_exist($params, &$service) 1462 { 1463 if (!is_admin() or is_adviser()) 1464 { 1465 return new PwgError(401, 'Access denied'); 1466 } 1467 1468 // search among photos the list of photos already added, based on md5sum 1469 // list 1470 $md5sums = preg_split( 1471 '/[\s,;\|]/', 1472 $params['md5sum_list'], 1473 -1, 1474 PREG_SPLIT_NO_EMPTY 1475 ); 1476 1477 $query = ' 1478 SELECT 1479 id, 1480 md5sum 1481 FROM '.IMAGES_TABLE.' 1482 WHERE md5sum IN (\''.implode("','", $md5sums).'\') 1483 ;'; 1484 $id_of_md5 = simple_hash_from_query($query, 'md5sum', 'id'); 1485 1486 $result = array(); 1487 1488 foreach ($md5sums as $md5sum) 1489 { 1490 $result[$md5sum] = null; 1491 if (isset($id_of_md5[$md5sum])) 1492 { 1493 $result[$md5sum] = $id_of_md5[$md5sum]; 1494 } 1495 } 1496 1497 return $result; 1498 } 1460 1499 ?> -
trunk/tools/piwigo_remote.pl
r2670 r2683 174 174 } 175 175 176 if ($opt{action} eq 'pwg.images.exist') { 177 $form = { 178 method => $opt{action}, 179 }; 180 181 foreach my $key (keys %{ $opt{define} }) { 182 $form->{$key} = $opt{define}{$key}; 183 } 184 185 my $response = $ua->post( 186 $conf{base_url}.'/ws.php?format=json', 187 $form 188 ); 189 190 use Data::Dumper; 191 print Dumper(from_json($response->content)->{result}); 192 # print Dumper($response); 193 } 194 176 195 $query = pwg_ws_get_query( 177 196 method => 'pwg.session.logout' -
trunk/ws.php
r2670 r2683 230 230 'administration method only' 231 231 ); 232 233 $service->addMethod( 234 'pwg.images.exist', 235 'ws_images_exist', 236 array( 237 'md5sum_list'=> array(), 238 ), 239 'check existence of a photo list' 240 ); 232 241 } 233 242
Note: See TracChangeset
for help on using the changeset viewer.