Changeset 2435 for trunk/include/ws_functions.inc.php
- Timestamp:
- Jul 15, 2008, 3:29:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2429 r2435 775 775 return new PwgNamedStruct('image',$ret, null, array('name','comment') ); 776 776 } 777 778 779 /** 780 * rates the image_id in the parameter 781 */ 782 function ws_images_Rate($params, &$service) 783 { 784 $image_id = (int)$params['image_id']; 785 $query = ' 786 SELECT DISTINCT id FROM '.IMAGES_TABLE.' 787 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id 788 WHERE id='.$image_id 789 .get_sql_condition_FandF( 790 array( 791 'forbidden_categories' => 'category_id', 792 'forbidden_images' => 'id', 793 ), 794 ' AND' 795 ).' 796 LIMIT 1'; 797 if ( mysql_num_rows( pwg_query($query) )==0 ) 798 { 799 return new PwgError(404, "Invalid image_id or access denied" ); 800 } 801 $rate = (int)$params['rate']; 802 include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php'); 803 $res = rate_picture( $image_id, $rate ); 804 if ($res==false) 805 { 806 global $conf; 807 return new PwgError( 403, "Forbidden or rate not in ". implode(',',$conf['rate_items'])); 808 } 809 return $res; 810 } 811 777 812 778 813 /**
Note: See TracChangeset
for help on using the changeset viewer.