aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-11-21 20:48:37 +0000
committerrvelices <rv-github@modusoptimus.com>2011-11-21 20:48:37 +0000
commitaa87a2583b10dfcd7cd2b0e5bbdd717122778c3f (patch)
treec06c3e4437523a007c4e8102996fee884269e173 /include
parent26def6668593bfbc03935eb2bd1ab7bc66d974a9 (diff)
feature 2486 merge from trunk -r12624,12625,12650 Add an admin view for rates by user (improvement)
git-svn-id: http://piwigo.org/svn/branches/2.3@12651 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/calendar_base.class.php4
-rw-r--r--include/ws_functions.inc.php39
2 files changed, 40 insertions, 3 deletions
diff --git a/include/calendar_base.class.php b/include/calendar_base.class.php
index a64e20fe9..15f20f7f3 100644
--- a/include/calendar_base.class.php
+++ b/include/calendar_base.class.php
@@ -215,9 +215,7 @@ SELECT DISTINCT('.$this->calendar_levels[$level]['sql'].') as period,
COUNT(DISTINCT id) as nb_images'.
$this->inner_sql.
$this->get_date_where($level).'
- GROUP BY period
- ORDER BY period ASC
-;';
+ GROUP BY period;';
$level_items = simple_hash_from_query($query, 'period', 'nb_images');
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 1ebb7502a..47d7d32f1 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -1883,6 +1883,45 @@ SELECT
);
}
+function ws_rates_delete($params, &$service)
+{
+ global $conf;
+
+ if (!$service->isPost())
+ {
+ return new PwgError(405, 'This method requires HTTP POST');
+ }
+
+ if (!is_admin())
+ {
+ return new PwgError(401, 'Access denied');
+ }
+
+ $user_id = (int)$params['user_id'];
+ if ($user_id<=0)
+ {
+ return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid user_id');
+ }
+
+ $query = '
+DELETE FROM '.RATE_TABLE.'
+ WHERE user_id='.$user_id;
+
+ if (!empty($params['anonymous_id']))
+ {
+ $query .= ' AND anonymous_id=\''.$params['anonymous_id'].'\'';
+ }
+
+ $changes = pwg_db_changes(pwg_query($query));
+ if ($changes)
+ {
+ include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
+ update_rating_score();
+ }
+ return $changes;
+}
+
+
/**
* perform a login (web service method)
*/