Ignore:
Timestamp:
Oct 4, 2007, 1:36:21 AM (17 years ago)
Author:
rvelices
Message:
  • bug 755: admin permalinks page - fix category field sort
  • web service functions: 1 fix and 3 optimizations
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/ws_functions.inc.php

    r2029 r2119  
    3333{
    3434  global $conf, $calling_partner_id;
    35  
     35
    3636  if ( strpos($methodName,'reflection.')===0 )
    3737  { // OK for reflection
    3838    return $res;
    3939  }
    40  
     40
    4141  if ( !is_autorize_status(ACCESS_GUEST) and
    4242      strpos($methodName,'pwg.session.')!==0 )
     
    4444    return new PwgError(401, 'Access denied');
    4545  }
    46  
     46
    4747  if ( !$conf['ws_access_control'] )
    4848  {
     
    317317      );
    318318  }
    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      );
    320323
    321324  $query = '
     
    461464  else
    462465  {
    463     $where[] = 'id NOT IN ('.$user['forbidden_categories'].')';
    464466    $where[]= 'user_id='.$user['id'];
    465467  }
     
    473475  WHERE '. implode('
    474476    AND ', $where);
    475   $query .= '
    476 ORDER BY global_rank';
    477477
    478478  $result = pwg_query($query);
     
    513513  $params['image_id'] = (int)$params['image_id'];
    514514  $query = '
    515 SELECT DISTINCT image_id 
     515SELECT DISTINCT image_id
    516516  FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.CATEGORIES_TABLE.' ON category_id=id
    517   WHERE commentable="true" 
     517  WHERE commentable="true"
    518518    AND image_id='.$params['image_id'].
    519519    get_sql_condition_FandF(
     
    529529    return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
    530530  }
    531  
     531
    532532  include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    533  
     533
    534534  $comm = array(
    535535    'author' => trim( stripslashes($params['author']) ),
     
    539539
    540540  include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    541  
    542   $comment_action = insert_user_comment( 
     541
     542  $comment_action = insert_user_comment(
    543543      $comm, $params['key'], $infos
    544544    );
     
    551551    case 'validate':
    552552    case 'moderate':
    553       $ret = array( 
     553      $ret = array(
    554554          'id' => $comm['id'],
    555555          'validation' => $comment_action=='validate',
     
    557557      return new PwgNamedStruct(
    558558          'comment',
    559           $ret, 
    560           null, array() 
     559          $ret,
     560          null, array()
    561561        );
    562562    default:
     
    600600  FROM '.IMAGE_CATEGORY_TABLE.'
    601601    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    ).'
    604607;';
    605608  $result = pwg_query($query);
     
    668671  //---------------------------------------------------------- related comments
    669672  $related_comments = array();
    670  
     673
    671674  $where_comments = 'image_id = '.$image_row['id'];
    672675  if ( !is_admin() )
     
    700703    }
    701704  }
    702  
     705
    703706  $comment_post_data = null;
    704   if ($is_commentable and 
     707  if ($is_commentable and
    705708      (!is_a_guest()
    706709        or (is_a_guest() and $conf['comments_forall'] )
     
    709712  {
    710713    include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
    711     $comment_post_data['author'] = $user['username'];   
     714    $comment_post_data['author'] = $user['username'];
    712715    $comment_post_data['key'] = get_comment_post_key($params['image_id']);
    713716  }
     
    734737  }
    735738  $ret['comments'] = array(
    736      WS_XML_ATTRIBUTES => 
     739     WS_XML_ATTRIBUTES =>
    737740        array(
    738741          'page' => $params['comments_page'],
     
    806809    $image_ids = $search_result['items'];
    807810  }
    808  
     811
    809812  $image_ids = array_slice($image_ids,
    810813    $params['page']*$params['per_page'],
     
    952955  @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    953956  global $conf;
    954  
     957
    955958  // first build all the tag_ids we are interested in
    956959  $params['tag_id'] = array_map( 'intval',$params['tag_id'] );
     
    10291032    while ($row = mysql_fetch_assoc($result))
    10301033    {
     1034      $image = array();
    10311035      foreach ( array('id', 'width', 'height', 'hit') as $k )
    10321036      {
Note: See TracChangeset for help on using the changeset viewer.