Changeset 4513


Ignore:
Timestamp:
Dec 18, 2009, 10:12:41 PM (14 years ago)
Author:
rvelices
Message:

merge -r4512 from branch 2.0 to trunk
web method images.setPrivacyLevel (ws_images_setPrivacyLevel) is POST only

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_weekly.class.php

    r4398 r4513  
    5555        ),
    5656      array(
    57           'sql'=> pwg_db_get_week($this->date_field)+1,
     57          'sql'=> pwg_db_get_week($this->date_field).'+1',
    5858          'labels' => $week_no_labels,
    5959        ),
    6060      array(
    61           'sql'=> pwg_db_get_dayofweek($this->date_field)-1,
     61          'sql'=> pwg_db_get_dayofweek($this->date_field).'-1',
    6262          'labels' => $lang['day']
    6363        ),
  • trunk/include/ws_functions.inc.php

    r4511 r4513  
    856856    return new PwgError(401, 'Access denied');
    857857  }
     858  if (!$service->isPost())
     859  {
     860    return new PwgError(405, "This method requires HTTP POST");
     861  }
    858862  $params['image_id'] = array_map( 'intval',$params['image_id'] );
    859863  if ( empty($params['image_id']) )
     
    866870    return new PwgError(WS_ERR_INVALID_PARAM, "Invalid level");
    867871  }
     872
    868873  $query = '
    869874UPDATE '.IMAGES_TABLE.'
     
    951956  {
    952957    unlink($output_filepath);
    953    
     958
    954959    if (is_file($output_filepath))
    955960    {
     
    958963    }
    959964  }
    960  
     965
    961966  $upload_dir = PHPWG_ROOT_PATH.'upload/buffer';
    962967  $pattern = '/'.$original_sum.'-'.$type.'/';
     
    983988
    984989  $i = 0;
    985  
     990
    986991  foreach ($chunks as $chunk)
    987992  {
     
    10151020
    10161021  $upload_dir = dirname($file_path);
    1017  
     1022
    10181023  if (!is_dir($upload_dir)) {
    10191024    umask(0000);
     
    11021107  //
    11031108  $update = array();
    1104  
     1109
    11051110  if ('high' == $params['type'])
    11061111  {
     
    11211126  {
    11221127    $update['id'] = $params['image_id'];
    1123    
     1128
    11241129    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    11251130    mass_updates(
     
    18401845    exit();
    18411846  }
    1842  
     1847
    18431848  $query = '
    18441849SELECT
     
    18581863    exit();
    18591864  }
    1860  
     1865
    18611866  $to_update_cat_ids = array();
    1862    
     1867
    18631868  // in case of replace mode, we first check the existing associations
    18641869  $query = '
     
    18851890    }
    18861891  }
    1887  
     1892
    18881893  $new_cat_ids = array_diff($cat_ids, $existing_cat_ids);
    18891894  if (count($new_cat_ids) == 0)
     
    18911896    return true;
    18921897  }
    1893    
     1898
    18941899  if ($search_current_ranks)
    18951900  {
     
    19151920        $current_rank_of[$cat_id] = 0;
    19161921      }
    1917      
     1922
    19181923      if ('auto' == $rank_on_category[$cat_id])
    19191924      {
     
    19221927    }
    19231928  }
    1924  
     1929
    19251930  $inserts = array();
    1926  
     1931
    19271932  foreach ($new_cat_ids as $cat_id)
    19281933  {
     
    19361941      );
    19371942  }
    1938  
     1943
    19391944  include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    19401945  mass_inserts(
     
    19431948    $inserts
    19441949    );
    1945  
     1950
    19461951  update_category($new_cat_ids);
    19471952}
  • trunk/template-common/scripts.js

    r3282 r4513  
    112112                this.transport.onreadystatechange = this.onStateChange.pwgBind(this);
    113113
    114                 var url = this.urlRoot;
    115                 url += "ws.php?format=json&method="+method;
     114                var url = this.urlRoot+"ws.php?format=json";
     115
     116                var body = "method="+method;
    116117                if (parameters)
    117118                {
     
    121122                                {
    122123                                        for (var i=0; i<parameters[property].length; i++)
    123                                                 url += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
     124                                                body += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
    124125                                }
    125126                                else
    126                                         url += "&"+property+"="+encodeURIComponent(parameters[property]);
     127                                        body += "&"+property+"="+encodeURIComponent(parameters[property]);
    127128                        }
    128129                }
    129                 this.transport.open(this.options.method, url, this.options.async);
    130                 this.transport.send(null);
     130
     131                if (this.options.method == "POST" )
     132                {
     133                        this.transport.open(this.options.method, url, this.options.async);
     134                        this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     135                        this.transport.send(body);
     136                }
     137                else
     138                {
     139                        url += "&"+body;
     140                        this.transport.open(this.options.method, url, this.options.async);
     141                        this.transport.send(null);
     142                }
    131143        },
    132144
  • trunk/template/yoga/picture.tpl

    r3445 r4513  
    215215        "pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
    216216        {
     217                method: "POST",
    217218                onFailure: function(num, text) { selectElement.disabled = false; alert(num + " " + text); },
    218219                onSuccess: function(result) { selectElement.disabled = false; }
  • trunk/ws.php

    r4460 r4513  
    137137      'level' => array('maxValue'=>$conf['available_permission_levels']),
    138138      ),
    139     'sets the privacy levels for the images'
     139    'sets the privacy levels for the images (POST method only)'
    140140    );
    141141
     
    279279    array(
    280280      'image_id' => array(),
    281      
     281
    282282      'name' => array('default' => null),
    283283      'author' => array('default' => null),
     
    298298<br><b>multiple_value_mode</b> can be "append" (no change on existing values, add the new values) or "replace" and applies to multiple values properties like tag_ids/categories'
    299299    );
    300  
     300
    301301  $service->addMethod(
    302302    'pwg.categories.setInfo',
     
    304304    array(
    305305      'category_id' => array(),
    306      
     306
    307307      'name' => array('default' => null),
    308308      'comment' => array('default' => null),
Note: See TracChangeset for help on using the changeset viewer.