Changeset 1777


Ignore:
Timestamp:
Feb 3, 2007, 4:50:07 PM (17 years ago)
Author:
vdigital
Message:

Web Service:

  • Delete functions_webserv.inc.php
  • Activate $colling_partner_id in ws.php
Location:
trunk/include
Files:
1 deleted
1 edited

Legend:

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

    r1768 r1777  
    5252
    5353/**
    54  * ws_add_controls
     54 * ws_addControls
    5555 * returns additionnal controls if requested
    5656 * usable for 99% of Web Service methods
    5757 *
    5858 * - Args 
    59  * $method: is the requested method
     59 * $methodName: is the requested method
    6060 * $partner: is the key
    6161 * $tbl_name: is the alias_name in the query (sometimes called correlation name)
     
    7070 * The additionnal in-where-clause is return
    7171 */       
    72 function ws_add_controls( $method, $tbl_name )
    73 {
    74   global $conf, $partner;
     72function ws_addControls( $methodName, $tbl_name )
     73{
     74  global $conf, $calling_partner_id, $params;
    7575  if ( !$conf['ws_access_control'] )
    7676  {
     
    8181  $query = '
    8282SELECT * FROM '.WEB_SERVICES_ACCESS_TABLE."
    83  WHERE `name` = '$partner'
     83 WHERE `name` = '$calling_partner_id'
    8484   AND NOW() <= end; ";
    8585$result = pwg_query($query);
     
    9595// For generic you can say... tags. or categories. or images. maybe?
    9696  $filter = $row['request'];
    97   $request_method = substr($method, 0, strlen($filter)) ;
     97  $request_method = substr($methodName, 0, strlen($filter)) ;
    9898  if ( $filter !== $filter_method )
    9999  {
    100100    return ' 0 = 1'; // Unauthorized method request
    101101  }
    102 
     102// Overide general object limit   
     103  $params['per_page'] = $row['limit'];
     104 
    103105// Target restrict
    104106// 3 cases: list, cat or tag
     
    248250function ws_getVersion($params, &$service)
    249251{
    250 //  Needed for security reason... Maybe???
    251 //  $where_clause[] =
    252 //          ws_add_controls( 'getVersion', null );
     252//  TODO = Version availability is under control of $conf['show_version']
    253253  return PHPWG_VERSION;
    254254}
     
    310310      .')';
    311311
    312 //  Mandatory
    313 //  $where_clause[] =
    314 //          ws_add_controls( 'categories.getImages', 'i.' );
     312    $where_clause[] =
     313          ws_addControls( 'categories.getImages', 'i.' );
    315314   
    316315    $order_by = ws_std_image_sql_order($params, 'i.');
     
    432431  }
    433432
    434 // To ONLY build external links maybe ??? 
    435 //  $where_clause[] =
    436 //          ws_add_controls( 'categories.getList', null );
    437 // Making links in a Blog...
    438 
    439433  $query = '
    440434SELECT id, name, uppercats, global_rank,
     
    482476    return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
    483477  }
    484 // Mandatory (No comment) 
    485 //  $where_clause[] =
    486 //          ws_add_controls( 'images.getInfo', '' ); 
     478 
    487479  $query='
    488480SELECT * FROM '.IMAGES_TABLE.'
     
    491483      array('visible_images' => 'id'),
    492484      ' AND'
    493     ).'
    494 LIMIT 1';
     485    ).' AND '.
     486    ws_addControls( 'images.getInfo', '' ).'
     487LIMIT 1;';
    495488
    496489  $image_row = mysql_fetch_assoc(pwg_query($query));
     
    755748      );
    756749    $where_clauses[] = 'id IN ('.implode(',',$image_ids).')';
    757 // Mandatory 
    758 //  $where_clause[] =
    759 //          ws_add_controls( 'tags.getImages', '' ); 
     750    $where_clause[] =
     751            ws_addControls( 'tags.getImages', 'i.' );
    760752
    761753    $order_by = ws_std_image_sql_order($params);
Note: See TracChangeset for help on using the changeset viewer.