Changeset 1852 for trunk/include/ws_functions.inc.php
- Timestamp:
- Feb 23, 2007, 2:18:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r1849 r1852 270 270 function ws_getVersion($params, &$service) 271 271 { 272 // TODO = Version availability is under control of $conf['show_version'] 273 return PHPWG_VERSION; 272 global $conf; 273 if ($conf['show_version']) 274 return PHPWG_VERSION; 275 else 276 return new PwgError(403, 'Forbidden'); 274 277 } 275 278 … … 337 340 338 341 $order_by = ws_std_image_sql_order($params, 'i.'); 339 if (empty($order_by)) 340 {// TODO check for category order by (image_order) 341 $order_by = $conf['order_by']; 342 } 343 else 344 { 345 $order_by = 'ORDER BY '.$order_by; 346 } 342 if ( empty($order_by) 343 and count($params['cat_id'])==1 344 and isset($cats[ $params['cat_id'][0] ]['image_order']) 345 ) 346 { 347 $order_by = $cats[ $params['cat_id'][0] ]['image_order']; 348 } 349 $order_by = empty($order_by) ? $conf['order_by'] : 'ORDER BY '.$order_by; 350 347 351 $query = ' 348 352 SELECT i.*, GROUP_CONCAT(category_id) cat_ids … … 500 504 function ws_images_addComment($params, &$service) 501 505 { 506 if (!$service->isPost()) 507 { 508 return new PwgError(405, "This method requires HTTP POST"); 509 } 502 510 $params['image_id'] = (int)$params['image_id']; 503 511 $query = ' … … 580 588 if ($image_row==null) 581 589 { 582 return new PwgError( 999, "image_id not found");590 return new PwgError(404, "image_id not found"); 583 591 } 584 592 $image_row = array_merge( $image_row, ws_std_get_urls($image_row) ); … … 860 868 if (!$service->isPost()) 861 869 { 862 return new PwgError(40 0, "This method requiresPOST");870 return new PwgError(405, "This method requires HTTP POST"); 863 871 } 864 872 if (try_log_user($params['username'], $params['password'],false)) … … 943 951 @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); 944 952 global $conf; 945 953 946 954 // first build all the tag_ids we are interested in 947 $ tag_ids = array();948 $tags = get_available_tags();955 $params['tag_id'] = array_map( 'intval',$params['tag_id'] ); 956 $tags = find_tags($params['tag_id'], $params['tag_url_name'], $params['tag_name']); 949 957 $tags_by_id = array(); 950 for( $i=0; $i<count($tags); $i++ )951 {952 $tags[$i]['id']=(int)$tags[$i]['id'];953 }954 958 foreach( $tags as $tag ) 955 959 { 960 $tags['id'] = (int)$tag['id']; 956 961 $tags_by_id[ $tag['id'] ] = $tag; 957 if (958 in_array($tag['name'], $params['tag_name'])959 or960 in_array($tag['url_name'], $params['tag_url_name'])961 or962 in_array($tag['id'], $params['tag_id'])963 )964 {965 $tag_ids[] = $tag['id'];966 }967 962 } 968 963 unset($tags); 969 970 $tag_ids = array_unique( $tag_ids ); 964 $tag_ids = array_keys($tags_by_id); 965 971 966 972 967 $image_ids = array();
Note: See TracChangeset
for help on using the changeset viewer.