Ignore:
Timestamp:
Dec 13, 2011, 4:00:32 PM (12 years ago)
Author:
plg
Message:

merge r12727 from branch 2.3 to trunk

feature 2532 added: pwg.images.add returns image_id (+url)

File:
1 edited

Legend:

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

    r12726 r12728  
    17681768  }
    17691769
     1770  $url_params = array('image_id' => $image_id);
     1771 
    17701772  // let's add links between the image and the categories
    17711773  if (isset($params['categories']))
    17721774  {
    17731775    ws_add_image_category_relations($image_id, $params['categories']);
     1776
     1777    if (preg_match('/^\d+/', $params['categories'], $matches)) {
     1778      $category_id = $matches[0];
     1779   
     1780      $query = '
     1781SELECT id, name, permalink
     1782  FROM '.CATEGORIES_TABLE.'
     1783  WHERE id = '.$category_id.'
     1784;';
     1785      $result = pwg_query($query);
     1786      $category = pwg_db_fetch_assoc($result);
     1787     
     1788      $url_params['section'] = 'categories';
     1789      $url_params['category'] = $category;
     1790    }
    17741791  }
    17751792
     
    17841801
    17851802  invalidate_user_cache();
     1803
     1804  return array(
     1805    'image_id' => $image_id,
     1806    'url' => make_picture_url($url_params),
     1807    );
    17861808}
    17871809
Note: See TracChangeset for help on using the changeset viewer.