Changeset 2553
- Timestamp:
- Sep 20, 2008, 12:59:41 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2548 r2553 365 365 global $user,$conf; 366 366 367 $query = '368 SELECT369 category_id,370 MAX(rank) AS max_rank371 FROM '.IMAGE_CATEGORY_TABLE.'372 WHERE rank IS NOT NULL373 GROUP BY category_id374 ;';375 $max_image_rank_of = simple_hash_from_query(376 $query,377 'category_id',378 'max_rank'379 );380 381 367 $where = array(); 382 368 … … 429 415 { 430 416 $row[$key] = (int)$row[$key]; 431 }432 433 if (isset($max_image_rank_of[ $row['id'] ]))434 {435 $row['images_max_rank'] = $max_image_rank_of[ $row['id'] ];436 417 } 437 418 … … 451 432 'date_last', 452 433 'max_date_last', 453 'images_max_rank',454 434 ) 455 435 ) … … 863 843 // $fh_log = fopen('/tmp/php.log', 'w'); 864 844 // fwrite($fh_log, time()."\n"); 845 // fwrite($fh_log, 'input rank :'.$params['rank']."\n"); 865 846 // fwrite($fh_log, 'input: '.$params['file_sum']."\n"); 866 847 // fwrite($fh_log, 'input: '.$params['thumbnail_sum']."\n"); … … 959 940 'category_id' => $params['category_id'], 960 941 'image_id' => $image_id, 961 'rank' => $params['rank'], 962 ); 942 ); 943 944 if ('auto' == $params['rank']) 945 { 946 $query = ' 947 SELECT 948 MAX(rank) AS max_rank 949 FROM '.IMAGE_CATEGORY_TABLE.' 950 WHERE rank IS NOT NULL 951 AND category_id = '.$params['category_id'].' 952 ;'; 953 $row = mysql_fetch_assoc(pwg_query($query)); 954 $insert['rank'] = isset($row['max_rank']) ? $row['max_rank']+1 : 1; 955 } 956 else if (is_numeric($params['rank'])) 957 { 958 $insert['rank'] = (int)$params['rank']; 959 } 960 963 961 mass_inserts( 964 962 IMAGE_CATEGORY_TABLE, -
trunk/tools/piwigo_remote.pl
r2520 r2553 11 11 GetOptions( 12 12 \%opt, 13 qw/action=s file=s thumbnail=s category_id=i name=s rank= i/13 qw/action=s file=s thumbnail=s category_id=i name=s rank=s/ 14 14 ); 15 15 … … 62 62 category_id => $opt{category_id}, 63 63 name => $opt{name}, 64 rank => defined($opt{rank}) ? $opt{rank} : 1,64 rank => defined($opt{rank}) ? $opt{rank} : 'auto', 65 65 }; 66 66
Note: See TracChangeset
for help on using the changeset viewer.