aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-08-02 19:20:50 +0000
committerrvelices <rv-github@modusoptimus.com>2011-08-02 19:20:50 +0000
commit86ae4d8b3ae8d1a4b3f78567dd8f67aa48ef43a8 (patch)
treecf4067b3b6298d2f700b6b5f59187ffe8e4efc55
parenta61fea92834dcadc8c1a648ca1fdb2c56d2079cd (diff)
rename #images.average_rate to rating_score
git-svn-id: http://piwigo.org/svn/trunk@11893 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/configuration.php4
-rw-r--r--admin/element_set_ranks.php14
-rw-r--r--admin/rating.php4
-rw-r--r--admin/themes/default/template/configuration.tpl2
-rw-r--r--include/category_default.inc.php2
-rw-r--r--include/config_default.inc.php2
-rw-r--r--include/functions_category.inc.php10
-rw-r--r--include/functions_rate.inc.php12
-rw-r--r--include/picture_rate.inc.php2
-rw-r--r--include/section_init.inc.php14
-rw-r--r--include/ws_functions.inc.php88
-rw-r--r--install/config.sql2
-rw-r--r--install/db/109-database.php41
-rw-r--r--install/piwigo_structure-mysql.sql4
-rw-r--r--install/piwigo_structure-pdo-sqlite.sql4
-rw-r--r--install/piwigo_structure-pgsql.sql4
-rw-r--r--install/piwigo_structure-sqlite.sql4
-rw-r--r--language/it_IT/help/configuration.html2
-rw-r--r--themes/default/template/picture.tpl2
-rw-r--r--ws.php2
20 files changed, 130 insertions, 89 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index f22b0f4fb..9915af3cc 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -98,7 +98,7 @@ $display_info_checkboxes = array(
'tags',
'categories',
'visits',
- 'average_rate',
+ 'rating_score',
'privacy_level',
);
@@ -109,7 +109,7 @@ $sort_fields = array(
'file' => l10n('File name'),
'date_creation' => l10n('Creation date'),
'date_available' => l10n('Post date'),
- 'average_rate' => l10n('Rating score'),
+ 'rating_score' => l10n('Rating score'),
'hit' => l10n('Most visited'),
'id' => 'Id',
);
diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php
index f11aa68b1..f37ff4a34 100644
--- a/admin/element_set_ranks.php
+++ b/admin/element_set_ranks.php
@@ -92,7 +92,7 @@ if (isset($_POST['submit']))
if (isset($_POST['rank_of_image']))
{
asort($_POST['rank_of_image'], SORT_NUMERIC);
-
+
save_images_order(
$page['category_id'],
array_keys($_POST['rank_of_image'])
@@ -105,12 +105,12 @@ if (isset($_POST['submit']))
}
$image_order = null;
- if (!empty($_POST['image_order_choice'])
+ if (!empty($_POST['image_order_choice'])
&& in_array($_POST['image_order_choice'], $image_order_choices))
{
$image_order_choice = $_POST['image_order_choice'];
}
-
+
if ($image_order_choice=='user_define')
{
for ($i=1; $i<=3; $i++)
@@ -141,7 +141,7 @@ UPDATE '.CATEGORIES_TABLE.' SET image_order=\''.$image_order.'\'
if (isset($_POST['image_order_subcats']))
{
$cat_info = get_cat_info($page['category_id']);
-
+
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET image_order = '.(isset($image_order) ? '\''.$image_order.'\'' : 'NULL').'
@@ -172,7 +172,7 @@ if ($category['image_order']=='rank')
{
$image_order_choice = 'rank';
}
-elseif ($category['image_order']!='')
+elseif ($category['image_order']!='')
{
$image_order_choice = 'user_define';
}
@@ -217,7 +217,7 @@ if (pwg_db_num_rows($result) > 0)
while ($row = pwg_db_fetch_assoc($result))
{
$src = get_thumbnail_url($row);
-
+
$thumbnail_size = getimagesize($src);
if ( !empty( $row['name'] ) )
{
@@ -273,7 +273,7 @@ $sort_fields = array(
'' => '',
'date_creation' => l10n('Creation date'),
'date_available' => l10n('Post date'),
- 'average_rate' => l10n('Rating score'),
+ 'rating_score' => l10n('Rating score'),
'hit' => l10n('Most visited'),
'file' => l10n('File name'),
'id' => 'Id',
diff --git a/admin/rating.php b/admin/rating.php
index 339f3044a..5d5a1971c 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -164,7 +164,7 @@ SELECT i.id,
i.path,
i.file,
i.tn_ext,
- i.average_rate AS score,
+ i.rating_score AS score,
MAX(r.date) AS recently_rated,
ROUND(AVG(r.rate),2) AS avg_rates,
COUNT(r.rate) AS nb_rates,
@@ -176,7 +176,7 @@ SELECT i.id,
i.path,
i.file,
i.tn_ext,
- i.average_rate,
+ i.rating_score,
r.element_id
ORDER BY ' . $available_order_by[$order_by_index][1] .'
LIMIT '.$elements_per_page.' OFFSET '.$start.'
diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl
index 9162cad18..895d52295 100644
--- a/admin/themes/default/template/configuration.tpl
+++ b/admin/themes/default/template/configuration.tpl
@@ -416,7 +416,7 @@ jQuery(document).ready(function () {
<li>
<label>
<span class="property">{'Rating score'|@translate}</span>
- <input type="checkbox" name="picture_informations[average_rate]" {if ($display.picture_informations.average_rate)}checked="checked"{/if}>
+ <input type="checkbox" name="picture_informations[rating_score]" {if ($display.picture_informations.rating_score)}checked="checked"{/if}>
</label>
</li>
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index bbc63fe21..c6e9834d7 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -153,7 +153,7 @@ foreach ($pictures as $row)
{
case 'best_rated' :
{
- $name = '('.$row['average_rate'].') '.$name;
+ $name = '('.$row['rating_score'].') '.$name;
break;
}
case 'most_visited' :
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index c57929471..f4cacc854 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -496,7 +496,7 @@ $conf['apache_authentication'] = false;
// delete from piwigo_user_infos;
// delete from piwigo_sessions;
// delete from piwigo_rate;
-// update piwigo_images set average_rate = null;
+// update piwigo_images set rating_score = null;
// delete from piwigo_caddie;
// delete from piwigo_favorites;
//
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 23509a684..19436fd30 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -290,7 +290,7 @@ function get_category_preferred_image_orders()
return trigger_event('get_category_preferred_image_orders',
array(
array(l10n('Default'), '', true),
- array(l10n('Rating score'), 'average_rate DESC', $conf['rate']),
+ array(l10n('Rating score'), 'rating_score DESC', $conf['rate']),
array(l10n('Most visited'), 'hit DESC', true),
array(l10n('Creation date'), 'date_creation DESC', true),
array(l10n('Post date'), 'date_available DESC', true),
@@ -559,11 +559,11 @@ function categories_flatlist_to_tree($categories)
{
$tree = array();
$key_of_cat = array();
-
+
foreach ($categories as $key => &$node)
{
$key_of_cat[$node['id']] = $key;
-
+
if (!isset($node['id_uppercat']))
{
$tree[$key] = &$node;
@@ -574,11 +574,11 @@ function categories_flatlist_to_tree($categories)
{
$categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'] = array();
}
-
+
$categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'][$key] = &$node;
}
}
-
+
return $tree;
}
?> \ No newline at end of file
diff --git a/include/functions_rate.inc.php b/include/functions_rate.inc.php
index de52c37f3..4cf6cc9ca 100644
--- a/include/functions_rate.inc.php
+++ b/include/functions_rate.inc.php
@@ -120,13 +120,13 @@ INSERT
}
-/* update images.average_rate field
+/* update images.rating_score field
* we use a bayesian average (http://en.wikipedia.org/wiki/Bayesian_average) with
C = average number of rates per item
m = global average rate (all rates)
* param int $element_id optional, otherwise applies to all
- * @return array(average_rate, count) if element_id is specified
+ * @return array(rating_score, count) if element_id is specified
*/
function update_rating_score($element_id = false)
{
@@ -166,13 +166,13 @@ SELECT element_id,
'count' => $rate_summary['rcount'],
);
}
- $updates[] = array( 'id'=>$id, 'average_rate'=>$score );
+ $updates[] = array( 'id'=>$id, 'rating_score'=>$score );
}
mass_updates(
IMAGES_TABLE,
array(
'primary' => array('id'),
- 'update' => array('average_rate')
+ 'update' => array('rating_score')
),
$updates
);
@@ -183,7 +183,7 @@ SELECT element_id,
$query='
SELECT id FROM '.IMAGES_TABLE .'
LEFT JOIN '.RATE_TABLE.' ON id=element_id
- WHERE element_id IS NULL AND average_rate IS NOT NULL';
+ WHERE element_id IS NULL AND rating_score IS NOT NULL';
$to_update = array_from_query( $query, 'id');
@@ -191,7 +191,7 @@ SELECT id FROM '.IMAGES_TABLE .'
{
$query='
UPDATE '.IMAGES_TABLE .'
- SET average_rate=NULL
+ SET rating_score=NULL
WHERE id IN (' . implode(',',$to_update) . ')';
pwg_query($query);
}
diff --git a/include/picture_rate.inc.php b/include/picture_rate.inc.php
index 086287c81..2459d56a2 100644
--- a/include/picture_rate.inc.php
+++ b/include/picture_rate.inc.php
@@ -28,7 +28,7 @@
if ($conf['rate'])
{
- $rate_summary = array( 'count'=>0, 'score'=>$picture['current']['average_rate'], 'average'=>null );
+ $rate_summary = array( 'count'=>0, 'score'=>$picture['current']['rating_score'], 'average'=>null );
if ( NULL != $rate_summary['score'] )
{
$query = '
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index da064cb68..a3f617e41 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -61,10 +61,10 @@ else
$rewritten = $key;
break;
}
-
+
// the $_GET keys are not protected in include/common.inc.php, only the values
$rewritten = pwg_db_real_escape_string($rewritten);
-
+
$page['root_path'] = PHPWG_ROOT_PATH;
}
@@ -463,9 +463,9 @@ SELECT DISTINCT(id)
else if ($page['section'] == 'most_visited')
{
$page['super_order_by'] = true;
- $conf['order_by'] = ' ORDER BY hit DESC, file ASC';
+ $conf['order_by'] = ' ORDER BY hit DESC, id DESC';
$query = '
-SELECT DISTINCT(id), hit, file
+SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE hit > 0
@@ -489,13 +489,13 @@ SELECT DISTINCT(id), hit, file
else if ($page['section'] == 'best_rated')
{
$page['super_order_by'] = true;
- $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC';
+ $conf['order_by'] = ' ORDER BY rating_score DESC, id DESC';
$query ='
-SELECT DISTINCT(id), average_rate
+SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
- WHERE average_rate IS NOT NULL
+ WHERE rating_score IS NOT NULL
'.$forbidden.'
'.$conf['order_by'].'
LIMIT '.$conf['top_number'].'
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 04e0dbbf3..af96a360a 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -54,11 +54,11 @@ function ws_std_image_sql_filter( $params, $tbl_name='' )
$clauses = array();
if ( is_numeric($params['f_min_rate']) )
{
- $clauses[] = $tbl_name.'average_rate>'.$params['f_min_rate'];
+ $clauses[] = $tbl_name.'rating_score>'.$params['f_min_rate'];
}
if ( is_numeric($params['f_max_rate']) )
{
- $clauses[] = $tbl_name.'average_rate<='.$params['f_max_rate'];
+ $clauses[] = $tbl_name.'rating_score<='.$params['f_max_rate'];
}
if ( is_numeric($params['f_min_hit']) )
{
@@ -123,7 +123,7 @@ function ws_std_image_sql_order( $params, $tbl_name='' )
case 'rand': case 'random':
$matches[1][$i] = DB_RANDOM_FUNCTION.'()'; break;
}
- $sortable_fields = array('id', 'file', 'name', 'hit', 'average_rate',
+ $sortable_fields = array('id', 'file', 'name', 'hit', 'rating_score',
'date_creation', 'date_available', DB_RANDOM_FUNCTION.'()' );
if ( in_array($matches[1][$i], $sortable_fields) )
{
@@ -192,7 +192,7 @@ function ws_getInfos($params, &$service)
}
$infos['version'] = PHPWG_VERSION;
-
+
$query = 'SELECT COUNT(*) FROM '.IMAGES_TABLE.';';
list($infos['nb_elements']) = pwg_db_fetch_row(pwg_query($query));
@@ -443,7 +443,7 @@ function ws_categories_getList($params, &$service)
// PwgNamedArray is useful to define which data is an attribute and
// which is an element in the XML output. The "hierarchy" output is
// only compatible with json/php output.
-
+
return new PwgError(405, "The tree_output option is only compatible with json/php output formats");
}
}
@@ -471,7 +471,7 @@ function ws_categories_getList($params, &$service)
{
$where[] = 'status = "public"';
$where[] = 'visible = "true"';
-
+
$join_user = $conf['guest_id'];
}
elseif (is_admin())
@@ -479,7 +479,7 @@ function ws_categories_getList($params, &$service)
// in this very specific case, we don't want to hide empty
// categories. Function calculate_permissions will only return
// categories that are either locked or private and not permitted
- //
+ //
// calculate_permissions does not consider empty categories as forbidden
$forbidden_categories = calculate_permissions($user['id'], $user['status']);
$where[]= 'id NOT IN ('.$forbidden_categories.')';
@@ -518,7 +518,7 @@ SELECT id, name, permalink, uppercats, global_rank, id_uppercat,
'ws_categories_getList'
)
);
-
+
$row['comment'] = strip_tags(
trigger_event(
'render_category_description',
@@ -526,13 +526,13 @@ SELECT id, name, permalink, uppercats, global_rank, id_uppercat,
'ws_categories_getList'
)
);
-
+
array_push($cats, $row);
}
usort($cats, 'global_rank_compare');
if ($params['tree_output'])
- {
+ {
return categories_flatlist_to_tree($cats);
}
else
@@ -781,7 +781,7 @@ SELECT id, name, permalink, uppercats, global_rank, commentable
$related_tags[$i]=$tag;
}
//------------------------------------------------------------- related rates
- $rating = array('score'=>$image_row['average_rate'], 'count'=>0, 'average'=>null);
+ $rating = array('score'=>$image_row['rating_score'], 'count'=>0, 'average'=>null);
if (isset($rating['score']))
{
$query = '
@@ -1028,7 +1028,7 @@ function ws_images_setRank($params, &$service)
{
return new PwgError(401, 'Access denied');
}
-
+
if (!$service->isPost())
{
return new PwgError(405, "This method requires HTTP POST");
@@ -1054,7 +1054,7 @@ function ws_images_setRank($params, &$service)
{
return new PwgError(WS_ERR_INVALID_PARAM, "Invalid rank");
}
-
+
// does the image really exist?
$query='
SELECT
@@ -1068,7 +1068,7 @@ SELECT
{
return new PwgError(404, "image_id not found");
}
-
+
// is the image associated to this category?
$query = '
SELECT
@@ -1137,7 +1137,7 @@ UPDATE '.IMAGE_CATEGORY_TABLE.'
function ws_images_add_chunk($params, &$service)
{
global $conf;
-
+
ws_logfile('[ws_images_add_chunk] welcome');
// data
// original_sum
@@ -1158,7 +1158,7 @@ function ws_images_add_chunk($params, &$service)
if ('data' == $param_key) {
continue;
}
-
+
ws_logfile(
sprintf(
'[ws_images_add_chunk] input param "%s" : "%s"',
@@ -1218,7 +1218,7 @@ function ws_images_add_chunk($params, &$service)
function merge_chunks($output_filepath, $original_sum, $type)
{
global $conf;
-
+
ws_logfile('[merge_chunks] input parameter $output_filepath : '.$output_filepath);
if (is_file($output_filepath))
@@ -1286,7 +1286,7 @@ function merge_chunks($output_filepath, $original_sum, $type)
function add_file($file_path, $type, $original_sum, $file_sum)
{
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
-
+
$file_path = file_path_for_type($file_path, $type);
$upload_dir = dirname($file_path);
@@ -1297,7 +1297,7 @@ function add_file($file_path, $type, $original_sum, $file_sum)
ws_logfile('[add_file] file_path : '.$file_path);
ws_logfile('[add_file] upload_dir : '.$upload_dir);
-
+
if (!is_dir($upload_dir)) {
umask(0000);
$recursive = true;
@@ -1445,7 +1445,7 @@ function ws_images_add($params, &$service)
{
$where_clause = "file = '".$params['original_filename']."'";
}
-
+
$query = '
SELECT
COUNT(*) AS counter
@@ -1549,7 +1549,7 @@ SELECT
// update metadata from the uploaded file (exif/iptc)
require_once(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php');
update_metadata(array($image_id=>$file_path));
-
+
invalidate_user_cache();
}
@@ -1570,7 +1570,7 @@ function ws_images_addSimple($params, &$service)
{
return new PwgError(405, "The image (file) parameter is missing");
}
-
+
$params['image_id'] = (int)$params['image_id'];
if ($params['image_id'] > 0)
{
@@ -1676,7 +1676,7 @@ SELECT
WHERE id = '.$image_id.'
;';
list($file_path) = pwg_db_fetch_row(pwg_query($query));
-
+
require_once(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php');
update_metadata(array($image_id=>$file_path));
@@ -1731,7 +1731,7 @@ function ws_session_getStatus($params, &$service)
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
$res['current_datetime'] = $dbnow;
-
+
return $res;
}
@@ -1826,7 +1826,7 @@ function ws_tags_getImages($params, &$service)
$image_ids = array_slice($image_ids, (int)($params['per_page']*$params['page']), (int)$params['per_page'] );
-
+
$image_tag_map = array();
if ( !empty($image_ids) and !$params['tag_mode_and'] )
{ // build list of image ids with associated tags per image
@@ -1962,7 +1962,7 @@ function ws_tags_add($params, &$service)
function ws_images_exist($params, &$service)
{
global $conf;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2001,7 +2001,7 @@ SELECT
}
}
}
-
+
if ('filename' == $conf['uniqueness_mode'])
{
// search among photos the list of photos already added, based on
@@ -2480,7 +2480,7 @@ function ws_categories_setInfo($params, &$service)
function ws_categories_setRepresentative($params, &$service)
{
global $conf;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2518,7 +2518,7 @@ SELECT
{
return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
}
-
+
// does the image really exist?
$query='
SELECT
@@ -2611,7 +2611,7 @@ SELECT id
{
return;
}
-
+
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
delete_categories($category_ids, $params['photo_deletion_mode']);
update_global_rank();
@@ -2620,7 +2620,7 @@ SELECT id
function ws_categories_move($params, &$service)
{
global $conf, $page;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2660,7 +2660,7 @@ function ws_categories_move($params, &$service)
// we can't move physical categories
$categories_in_db = array();
-
+
$query = '
SELECT
id,
@@ -2683,7 +2683,7 @@ SELECT
'ws_categories_move'
)
);
-
+
return new PwgError(
403,
sprintf(
@@ -2698,7 +2698,7 @@ SELECT
if (count($categories_in_db) != count($category_ids))
{
$unknown_category_ids = array_diff($category_ids, array_keys($categories_in_db));
-
+
return new PwgError(
403,
sprintf(
@@ -2716,7 +2716,7 @@ SELECT
{
return new PwgError(403, 'Invalid parent input parameter');
}
-
+
if (0 != $params['parent']) {
$params['parent'] = intval($params['parent']);
$subcat_ids = get_subcat_ids(array($params['parent']));
@@ -2765,19 +2765,19 @@ function ws_images_checkUpload($params, &$service)
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
$ret['message'] = ready_for_upload_message();
$ret['ready_for_upload'] = true;
-
+
if (!empty($ret['message']))
{
$ret['ready_for_upload'] = false;
}
-
+
return $ret;
}
function ws_plugins_getList($params, &$service)
{
global $conf;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2817,7 +2817,7 @@ function ws_plugins_getList($params, &$service)
function ws_plugins_performAction($params, &$service)
{
global $template;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2833,7 +2833,7 @@ function ws_plugins_performAction($params, &$service)
$plugins = new plugins();
$errors = $plugins->perform_action($params['action'], $params['plugin']);
-
+
if (!empty($errors))
{
return new PwgError(500, $errors);
@@ -2851,7 +2851,7 @@ function ws_plugins_performAction($params, &$service)
function ws_themes_performAction($params, &$service)
{
global $template;
-
+
if (!is_admin())
{
return new PwgError(401, 'Access denied');
@@ -2866,7 +2866,7 @@ function ws_themes_performAction($params, &$service)
include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
$themes = new themes();
$errors = $themes->perform_action($params['action'], $params['theme']);
-
+
if (!empty($errors))
{
return new PwgError(500, $errors);
@@ -3044,7 +3044,7 @@ function ws_extensions_update($params, &$service)
. '&format=json'
);
}
-
+
$upgrade_status = $extension->extract_plugin_files('upgrade', $revision, $extension_id);
$extension_name = $extension->fs_plugins[$extension_id]['name'];
@@ -3175,4 +3175,4 @@ function ws_extensions_checkupdates($params, &$service)
return $result;
}
-?>
+?> \ No newline at end of file
diff --git a/install/config.sql b/install/config.sql
index aeeacc085..62077301a 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -47,7 +47,7 @@ INSERT INTO piwigo_config (param,value,comment) VALUES ('picture_menu','false','
INSERT INTO piwigo_config (param,value,comment)
VALUES (
'picture_informations',
- 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"average_rate";b:1;s:13:"privacy_level";b:1;}',
+ 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"rating_score";b:1;s:13:"privacy_level";b:1;}',
'Information displayed on picture page'
);
INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week');
diff --git a/install/db/109-database.php b/install/db/109-database.php
new file mode 100644
index 000000000..391942ee4
--- /dev/null
+++ b/install/db/109-database.php
@@ -0,0 +1,41 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
+
+$upgrade_description = 'Rename #images.average_rate to ratingscore.';
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+if ('mysql' == $conf['dblayer'])
+ $q = 'ALTER TABLE '.IMAGES_TABLE.' CHANGE average_rate rating_score float(5,2) unsigned default NULL';
+else
+ $q = 'ALTER TABLE '.IMAGES_TABLE.' RENAME average_rate TO rating_score';
+pwg_query($q);
+
+$q="UPDATE ".CATEGORIES_TABLE." SET image_order=REPLACE(image_order, 'average_rate', 'rating_score')";
+pwg_query($q);
+
+$q="UPDATE ".CONFIG_TABLE." SET value=REPLACE(value, 'average_rate', 'rating_score')
+WHERE param IN ('picture_informations', 'order_by', 'order_by_inside_category')";
+pwg_query($q);
+?> \ No newline at end of file
diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql
index cc05c311f..b149d3918 100644
--- a/install/piwigo_structure-mysql.sql
+++ b/install/piwigo_structure-mysql.sql
@@ -187,7 +187,7 @@ CREATE TABLE `piwigo_images` (
`height` smallint(9) unsigned default NULL,
`representative_ext` varchar(4) default NULL,
`date_metadata_update` date default NULL,
- `average_rate` float(5,2) unsigned default NULL,
+ `rating_score` float(5,2) unsigned default NULL,
`has_high` enum('true') default NULL,
`path` varchar(255) NOT NULL default '',
`storage_category_id` smallint(5) unsigned default NULL,
@@ -199,7 +199,7 @@ CREATE TABLE `piwigo_images` (
`added_by` smallint(5) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `images_i2` (`date_available`),
- KEY `images_i3` (`average_rate`),
+ KEY `images_i3` (`rating_score`),
KEY `images_i4` (`hit`),
KEY `images_i5` (`date_creation`),
KEY `images_i1` (`storage_category_id`)
diff --git a/install/piwigo_structure-pdo-sqlite.sql b/install/piwigo_structure-pdo-sqlite.sql
index a0b502fc8..46132f7be 100644
--- a/install/piwigo_structure-pdo-sqlite.sql
+++ b/install/piwigo_structure-pdo-sqlite.sql
@@ -183,7 +183,7 @@ CREATE TABLE piwigo_images
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -199,7 +199,7 @@ CREATE TABLE piwigo_images
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");
diff --git a/install/piwigo_structure-pgsql.sql b/install/piwigo_structure-pgsql.sql
index cf55dea0c..7fb3da355 100644
--- a/install/piwigo_structure-pgsql.sql
+++ b/install/piwigo_structure-pgsql.sql
@@ -227,7 +227,7 @@ CREATE TABLE "piwigo_images"
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -246,7 +246,7 @@ COMMENT ON TABLE "piwigo_images" IS '';
SET search_path TO public;
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");
diff --git a/install/piwigo_structure-sqlite.sql b/install/piwigo_structure-sqlite.sql
index a0b502fc8..46132f7be 100644
--- a/install/piwigo_structure-sqlite.sql
+++ b/install/piwigo_structure-sqlite.sql
@@ -183,7 +183,7 @@ CREATE TABLE piwigo_images
"height" INTEGER,
"representative_ext" VARCHAR(4),
"date_metadata_update" DATE,
- "average_rate" FLOAT,
+ "rating_score" FLOAT,
"has_high" BOOLEAN default false,
"path" VARCHAR(255) default '' NOT NULL,
"storage_category_id" INTEGER,
@@ -199,7 +199,7 @@ CREATE TABLE piwigo_images
CREATE INDEX "images_i2" ON "piwigo_images" ("date_available");
-CREATE INDEX "images_i3" ON "piwigo_images" ("average_rate");
+CREATE INDEX "images_i3" ON "piwigo_images" ("rating_score");
CREATE INDEX "images_i4" ON "piwigo_images" ("hit");
diff --git a/language/it_IT/help/configuration.html b/language/it_IT/help/configuration.html
index 3663e38ed..4ac0e8997 100644
--- a/language/it_IT/help/configuration.html
+++ b/language/it_IT/help/configuration.html
@@ -43,7 +43,7 @@ alla galleria.</li>
<li><b>date_creation</b> : data di creazione</li>
<li><b>name</b> : nome della foto</li>
<li><b>hit</b> : numero di visite</li>
- <li><b>average_rate</b>: nota globbale</li>
+ <li><b>rating_score</b>: nota globbale</li>
</ul>
Non dimenticate che per ogni campo di specificare l'ordinamento con le parole chiavi <i>ASC</i> e <i>DESC</i>
</li>
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index d83795d58..c4dddac98 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -194,7 +194,7 @@ y.callService(
</tr>
{/if}
-{if $display_info.average_rate and isset($rate_summary)}
+{if $display_info.rating_score and isset($rate_summary)}
<tr id="Average">
<td class="label">{'Rating score'|@translate}</td>
<td class="value">
diff --git a/ws.php b/ws.php
index 2a60e3697..1a0f1db69 100644
--- a/ws.php
+++ b/ws.php
@@ -73,7 +73,7 @@ function ws_addDefaultMethods( $arr )
),
'Returns elements for the corresponding categories.
<br><b>cat_id</b> can be empty if <b>recursive</b> is true. Can be sent as an array.
-<br><b>order</b> comma separated fields for sorting (file,id, average_rate,...)'
+<br><b>order</b> comma separated fields for sorting (file,id, rating_score,...)'
);
$service->addMethod('pwg.categories.getList', 'ws_categories_getList',