Ignore:
Timestamp:
Nov 14, 2011, 9:10:37 PM (12 years ago)
Author:
rvelices
Message:

feature 2486: Add an admin view for rates by user

File:
1 edited

Legend:

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

    r12544 r12624  
    18841884}
    18851885
     1886function ws_rates_delete($params, &$service)
     1887{
     1888  global $conf;
     1889
     1890  if (!$service->isPost())
     1891  {
     1892    return new PwgError(405, 'This method requires HTTP POST');
     1893  }
     1894
     1895  if (!is_admin())
     1896  {
     1897    return new PwgError(401, 'Access denied');
     1898  }
     1899
     1900  $user_id = (int)$params['user_id'];
     1901  if ($user_id<=0)
     1902  {
     1903    return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid user_id');
     1904  }
     1905 
     1906  $query = '
     1907DELETE FROM '.RATE_TABLE.'
     1908  WHERE user_id='.$user_id;
     1909 
     1910  if (!empty($params['anonymous_id']))
     1911  {
     1912    $query .= ' AND anonymous_id=\''.$params['anonymous_id'].'\'';
     1913  }
     1914 
     1915  $changes = pwg_db_changes(pwg_query($query));
     1916  if ($changes)
     1917  {
     1918    include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
     1919    update_rating_score();
     1920  }
     1921  return $changes;
     1922}
     1923
     1924
    18861925/**
    18871926 * perform a login (web service method)
Note: See TracChangeset for help on using the changeset viewer.