Ignore:
Timestamp:
Feb 23, 2007, 2:18:34 PM (17 years ago)
Author:
rvelices
Message:

Plugins:

  • display author and and author url (if present) on plugin admin page
  • uniformized versions/authors... for all plugins in svn
  • security fix (html escape name, version, uri, author... to avoid javascript injection which could automatically simulate click on Install)
  • added confirmation for install/uninstall plugins

Web services:

  • web service explorer now caches method details in order to avoid unnecessary web calls
  • web service explorer can now send parameters as arrays
  • web service explorer uses now prototype.js version 1.5
  • small improvements
  • added and use function bad_request (sends http status code 400)
File:
1 edited

Legend:

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

    r1849 r1852  
    270270function ws_getVersion($params, &$service)
    271271{
    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');
    274277}
    275278
     
    337340
    338341    $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
    347351    $query = '
    348352SELECT i.*, GROUP_CONCAT(category_id) cat_ids
     
    500504function ws_images_addComment($params, &$service)
    501505{
     506  if (!$service->isPost())
     507  {
     508    return new PwgError(405, "This method requires HTTP POST");
     509  }
    502510  $params['image_id'] = (int)$params['image_id'];
    503511  $query = '
     
    580588  if ($image_row==null)
    581589  {
    582     return new PwgError(999, "image_id not found");
     590    return new PwgError(404, "image_id not found");
    583591  }
    584592  $image_row = array_merge( $image_row, ws_std_get_urls($image_row) );
     
    860868  if (!$service->isPost())
    861869  {
    862     return new PwgError(400, "This method requires POST");
     870    return new PwgError(405, "This method requires HTTP POST");
    863871  }
    864872  if (try_log_user($params['username'], $params['password'],false))
     
    943951  @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
    944952  global $conf;
    945 
     953 
    946954  // 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']);
    949957  $tags_by_id = array();
    950   for( $i=0; $i<count($tags); $i++ )
    951   {
    952     $tags[$i]['id']=(int)$tags[$i]['id'];
    953   }
    954958  foreach( $tags as $tag )
    955959  {
     960    $tags['id'] = (int)$tag['id'];
    956961    $tags_by_id[ $tag['id'] ] = $tag;
    957     if (
    958         in_array($tag['name'], $params['tag_name'])
    959       or
    960         in_array($tag['url_name'], $params['tag_url_name'])
    961       or
    962         in_array($tag['id'], $params['tag_id'])
    963        )
    964     {
    965       $tag_ids[] = $tag['id'];
    966     }
    967962  }
    968963  unset($tags);
    969 
    970   $tag_ids = array_unique( $tag_ids );
     964  $tag_ids = array_keys($tags_by_id);
     965
    971966
    972967  $image_ids = array();
Note: See TracChangeset for help on using the changeset viewer.