diff options
author | plegall <plg@piwigo.org> | 2006-02-20 22:14:24 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2006-02-20 22:14:24 +0000 |
commit | 16034a592a32d9a6a0af0ed04c27ad4cf28cd844 (patch) | |
tree | 7d60ab262e82c126f528ffabb595dd665a6f4e66 /admin/include/functions.php | |
parent | d62ce7376079a7435317fc843eb04f3927e4adad (diff) |
request 290: replace function get_themes name to avoid redeclaration from
Wordpress in jillij template.
git-svn-id: http://piwigo.org/svn/trunk@1048 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r-- | admin/include/functions.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 25bbadf84..1ed30f3c6 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -1316,8 +1316,6 @@ UPDATE '.IMAGES_TABLE.' */ function update_average_rate( $element_id=-1 ) { - $average_rates = array(); - $query = ' SELECT element_id, ROUND(AVG(rate),2) AS average_rate @@ -1329,24 +1327,28 @@ SELECT element_id, $query .= ' GROUP BY element_id;'; $result = pwg_query($query); - while ($row = mysql_fetch_array($result)) - { - array_push($average_rates, $row); - } $datas = array(); - foreach ($average_rates as $item) + + while ($row = mysql_fetch_array($result)) { array_push( $datas, array( - 'id' => $item['element_id'], - 'average_rate' => $item['average_rate'] + 'id' => $row['element_id'], + 'average_rate' => $row['average_rate'] ) ); } - $fields = array('primary' => array('id'), 'update' => array('average_rate')); - mass_updates(IMAGES_TABLE, $fields, $datas); + + mass_updates( + IMAGES_TABLE, + array( + 'primary' => array('id'), + 'update' => array('average_rate') + ), + $datas + ); $query=' UPDATE '.IMAGES_TABLE .' |