Changeset 2119 for trunk/include
- Timestamp:
- Oct 4, 2007, 1:36:21 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2029 r2119 33 33 { 34 34 global $conf, $calling_partner_id; 35 35 36 36 if ( strpos($methodName,'reflection.')===0 ) 37 37 { // OK for reflection 38 38 return $res; 39 39 } 40 40 41 41 if ( !is_autorize_status(ACCESS_GUEST) and 42 42 strpos($methodName,'pwg.session.')!==0 ) … … 44 44 return new PwgError(401, 'Access denied'); 45 45 } 46 46 47 47 if ( !$conf['ws_access_control'] ) 48 48 { … … 317 317 ); 318 318 } 319 $where_clauses[] = 'id NOT IN ('.$user['forbidden_categories'].')'; 319 $where_clauses[] = get_sql_condition_FandF( 320 array('forbidden_categories' => 'id'), 321 NULL, true 322 ); 320 323 321 324 $query = ' … … 461 464 else 462 465 { 463 $where[] = 'id NOT IN ('.$user['forbidden_categories'].')';464 466 $where[]= 'user_id='.$user['id']; 465 467 } … … 473 475 WHERE '. implode(' 474 476 AND ', $where); 475 $query .= '476 ORDER BY global_rank';477 477 478 478 $result = pwg_query($query); … … 513 513 $params['image_id'] = (int)$params['image_id']; 514 514 $query = ' 515 SELECT DISTINCT image_id 515 SELECT DISTINCT image_id 516 516 FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.CATEGORIES_TABLE.' ON category_id=id 517 WHERE commentable="true" 517 WHERE commentable="true" 518 518 AND image_id='.$params['image_id']. 519 519 get_sql_condition_FandF( … … 529 529 return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id"); 530 530 } 531 531 532 532 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 533 533 534 534 $comm = array( 535 535 'author' => trim( stripslashes($params['author']) ), … … 539 539 540 540 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 541 542 $comment_action = insert_user_comment( 541 542 $comment_action = insert_user_comment( 543 543 $comm, $params['key'], $infos 544 544 ); … … 551 551 case 'validate': 552 552 case 'moderate': 553 $ret = array( 553 $ret = array( 554 554 'id' => $comm['id'], 555 555 'validation' => $comment_action=='validate', … … 557 557 return new PwgNamedStruct( 558 558 'comment', 559 $ret, 560 null, array() 559 $ret, 560 null, array() 561 561 ); 562 562 default: … … 600 600 FROM '.IMAGE_CATEGORY_TABLE.' 601 601 INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id 602 WHERE image_id = '.$image_row['id'].' 603 AND category_id NOT IN ('.$user['forbidden_categories'].') 602 WHERE image_id = '.$image_row['id']. 603 get_sql_condition_FandF( 604 array( 'forbidden_categories' => 'category_id' ), 605 ' AND' 606 ).' 604 607 ;'; 605 608 $result = pwg_query($query); … … 668 671 //---------------------------------------------------------- related comments 669 672 $related_comments = array(); 670 673 671 674 $where_comments = 'image_id = '.$image_row['id']; 672 675 if ( !is_admin() ) … … 700 703 } 701 704 } 702 705 703 706 $comment_post_data = null; 704 if ($is_commentable and 707 if ($is_commentable and 705 708 (!is_a_guest() 706 709 or (is_a_guest() and $conf['comments_forall'] ) … … 709 712 { 710 713 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 711 $comment_post_data['author'] = $user['username']; 714 $comment_post_data['author'] = $user['username']; 712 715 $comment_post_data['key'] = get_comment_post_key($params['image_id']); 713 716 } … … 734 737 } 735 738 $ret['comments'] = array( 736 WS_XML_ATTRIBUTES => 739 WS_XML_ATTRIBUTES => 737 740 array( 738 741 'page' => $params['comments_page'], … … 806 809 $image_ids = $search_result['items']; 807 810 } 808 811 809 812 $image_ids = array_slice($image_ids, 810 813 $params['page']*$params['per_page'], … … 952 955 @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); 953 956 global $conf; 954 957 955 958 // first build all the tag_ids we are interested in 956 959 $params['tag_id'] = array_map( 'intval',$params['tag_id'] ); … … 1029 1032 while ($row = mysql_fetch_assoc($result)) 1030 1033 { 1034 $image = array(); 1031 1035 foreach ( array('id', 'width', 'height', 'hit') as $k ) 1032 1036 {
Note: See TracChangeset
for help on using the changeset viewer.