Changeset 3453 for branches/2.0
- Timestamp:
- Jun 24, 2009, 11:42:39 PM (15 years ago)
- Location:
- branches/2.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/ws_functions.inc.php
r3239 r3453 1734 1734 } 1735 1735 1736 function ws_categories_setInfo($params, &$service) 1737 { 1738 global $conf; 1739 if (!is_admin() || is_adviser() ) 1740 { 1741 return new PwgError(401, 'Access denied'); 1742 } 1743 1744 // category_id 1745 // name 1746 // comment 1747 1748 $params['category_id'] = (int)$params['category_id']; 1749 if ($params['category_id'] <= 0) 1750 { 1751 return new PwgError(WS_ERR_INVALID_PARAM, "Invalid category_id"); 1752 } 1753 1754 // database registration 1755 $update = array( 1756 'id' => $params['category_id'], 1757 ); 1758 1759 $info_columns = array( 1760 'name', 1761 'comment', 1762 ); 1763 1764 $perform_update = false; 1765 foreach ($info_columns as $key) 1766 { 1767 if (isset($params[$key])) 1768 { 1769 $perform_update = true; 1770 $update[$key] = $params[$key]; 1771 } 1772 } 1773 1774 if ($perform_update) 1775 { 1776 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 1777 mass_updates( 1778 CATEGORIES_TABLE, 1779 array( 1780 'primary' => array('id'), 1781 'update' => array_diff(array_keys($update), array('id')) 1782 ), 1783 array($update) 1784 ); 1785 } 1786 1787 } 1788 1736 1789 function ws_logfile($string) 1737 1790 { -
branches/2.0/tools/piwigo_remote.pl
r3239 r3453 25 25 GetOptions( 26 26 \%opt, 27 qw/action=s file=s thumbnail=s high=s original=s categories=s chunk_size=i define=s%/ 27 qw/ 28 action=s 29 file=s 30 thumbnail=s 31 high=s 32 original=s 33 categories=s 34 chunk_size=i 35 base_url=s 36 username=s 37 password=s 38 define=s% 39 / 28 40 ); 29 41 … … 32 44 33 45 my %conf; 34 $conf{base_url} = 'http://localhost/piwigo/2.0';35 46 $conf{response_format} = 'json'; 36 $conf{username} = 'plg';37 $conf{password} = 'plg';38 47 $conf{limit} = 10; 39 $conf{chunk_size} = defined $opt{chunk_size} ? $opt{chunk_size} : 500_000; 48 49 my %conf_default = ( 50 base_url => 'http://localhost/piwigo/2.0', 51 username => 'plg', 52 password => 'plg', 53 chunk_size => 500_000, 54 ); 55 foreach my $conf_key (keys %conf_default) { 56 $conf{$conf_key} = defined $opt{$conf_key} ? $opt{$conf_key} : $conf_default{$conf_key} 57 } 40 58 41 59 my $result = undef; … … 217 235 } 218 236 219 if ($opt{action} eq 'pwg.images.setInfo' ) {237 if ($opt{action} eq 'pwg.images.setInfo' or $opt{action} eq 'pwg.categories.setInfo') { 220 238 $form = { 221 239 method => $opt{action}, -
branches/2.0/ws.php
r3192 r3453 271 271 <br/><b>categories</b> is a string list "category_id[,rank];category_id[,rank]" The rank is optional and is equivalent to "auto" if not given.' 272 272 ); 273 274 $service->addMethod( 275 'pwg.categories.setInfo', 276 'ws_categories_setInfo', 277 array( 278 'category_id' => array(), 279 280 'name' => array('default' => null), 281 'comment' => array('default' => null), 282 ), 283 'POST method only.' 284 ); 273 285 } 274 286
Note: See TracChangeset
for help on using the changeset viewer.