diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-04-28 04:38:36 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-04-28 04:38:36 +0000 |
commit | 0510cfdc5ad38487600f8f1bf8e4d4f9747781df (patch) | |
tree | 5ca76dc04fa5e1e93eb9f2e781bfec5ed227c55c | |
parent | b0751afea224486bb4b423e569e2c75a502b4e35 (diff) |
merge -r1285 in from branch-1_6 to trunk
bug 359: transform rating html A links to FORM because some bots rate
pictures (even if rel="nofollow" is set)
git-svn-id: http://piwigo.org/svn/trunk@1286 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/picture_rate.inc.php | 42 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/common.lang.php | 3 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/common.lang.php | 3 | ||||
-rw-r--r-- | picture.php | 3 | ||||
-rw-r--r-- | template/yoga/image.css | 16 | ||||
-rw-r--r-- | template/yoga/picture.tpl | 15 | ||||
-rw-r--r-- | template/yoga/theme/clear/theme.css | 2 | ||||
-rw-r--r-- | template/yoga/theme/dark/theme.css | 2 |
8 files changed, 49 insertions, 37 deletions
diff --git a/include/picture_rate.inc.php b/include/picture_rate.inc.php index 46263d968..172d02ceb 100644 --- a/include/picture_rate.inc.php +++ b/include/picture_rate.inc.php @@ -54,6 +54,7 @@ SELECT COUNT(rate) AS count ); } + $user_rate = null; if ($conf['rate_anonymous'] or is_autorize_status(ACCESS_CLASSIC) ) { if ($row['count']>0) @@ -78,51 +79,40 @@ SELECT COUNT(rate) AS count if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); - $sentence = $lang['already_rated']; - $sentence.= ' ('.$row['rate'].'). '; - $sentence.= $lang['update_rate']; + $user_rate = $row['rate']; } - else - { - $sentence = $lang['never_rated'].'. '.$lang['Rate']; - } - } - else - { - $sentence = $lang['never_rated'].'. '.$lang['Rate']; } + $template->assign_block_vars( 'rate', array( - 'CONTENT' => $value, - 'SENTENCE' => $sentence + 'SENTENCE' =>isset($user_rate) ? l10n('update_rate') : l10n('new_rate'), + 'F_ACTION' => add_url_params( + $url_self, + array('action'=>'rate') + ) ) ); $template->assign_block_vars('info_rate', array('CONTENT' => $value)); - $template->assign_vars( - array( - 'INFO_RATE' => $value - ) - ); - foreach ($conf['rate_items'] as $num => $mark) { $template->assign_block_vars( 'rate.rate_option', array( 'OPTION' => $mark, - 'URL' => add_url_params( - $url_self, - array( - 'action'=>'rate', - 'rate'=>$mark - ) - ), 'SEPARATOR' => ($num > 0 ? '|' : ''), ) ); + if (isset($user_rate) and $user_rate==$mark) + { + $template->assign_block_vars('rate.rate_option.my_rate', array() ); + } + else + { + $template->assign_block_vars('rate.rate_option.not_my_rate', array() ); + } } } } diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 491a5966c..6273e9f88 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -130,7 +130,6 @@ $lang['admin'] = 'Administration'; $lang['adviser_mode_enabled'] = 'Adviser mode enabled'; $lang['all'] = 'all'; $lang['all_categories'] = 'all categories'; -$lang['already_rated'] = 'You\'ve already rated this item'; $lang['ascending'] = 'ascending'; $lang['author(s) : %s'] = 'author(s) : %s'; $lang['auto_expand'] = 'Expand all categories'; @@ -244,10 +243,10 @@ $lang['nb_image_per_row'] = 'Number of images per row'; $lang['nb_line_page_error'] = 'The number of rows per page must be a not null scalar'; $lang['nb_row_per_page'] = 'Number of rows per page'; $lang['nbm_unknown_identifier'] = 'Unknown identifier'; -$lang['never_rated'] = 'You\'ve never rated this item'; $lang['new_password'] = 'New password'; $lang['new_password_hint'] = 'You only have to give a password if you wish to change it.'; $lang['next_page'] = 'Next'; +$lang['new_rate'] = 'Rate this picture'; $lang['no'] = 'No'; $lang['no_category'] = 'Home'; $lang['no_rate'] = 'no rate'; diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index ca646b862..8fa0b6b1d 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -129,7 +129,6 @@ $lang['admin'] = 'Administration'; $lang['adviser_mode_enabled'] = 'Mode conseiller actif'; $lang['all'] = 'tout'; $lang['all_categories'] = 'toutes les catégories'; -$lang['already_rated'] = 'Vous avez déjà voté pour cette image'; $lang['ascending'] = 'croissant'; $lang['author(s) : %s'] = 'auteur(s) : %s'; $lang['auto_expand'] = 'Développer toutes les catégories'; @@ -243,9 +242,9 @@ $lang['nb_image_per_row'] = 'Nombre de miniatures par ligne'; $lang['nb_line_page_error'] = 'Le nombre de lignes par page doit être un entier non nul'; $lang['nb_row_per_page'] = 'Nombre de lignes par page'; $lang['nbm_unknown_identifier'] = 'Identifiants inconnus'; -$lang['never_rated'] = 'Vous n\'avez jamais voté pour cette image'; $lang['new_password'] = 'Nouveau mot de passe'; $lang['new_password_hint'] = 'Vous n\'avez à confirmer votre mot de passe que si vous désirez en changer.'; +$lang['new_rate'] = 'Votez pur cette image'; $lang['next_page'] = 'Suivant'; $lang['no'] = 'Non'; $lang['no_category'] = 'Accueil'; diff --git a/picture.php b/picture.php index 3dc08ac40..486e303cb 100644 --- a/picture.php +++ b/picture.php @@ -165,7 +165,8 @@ UPDATE '.CATEGORIES_TABLE.' case 'rate' : { include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php'); - rate_picture($page['image_id'], $_GET['rate']); + rate_picture($page['image_id'], + isset($_POST['rate']) ? $_POST['rate'] : $_GET['rate'] ); redirect($url_self); } case 'delete_comment' : diff --git a/template/yoga/image.css b/template/yoga/image.css index 3064ee46a..90d5c539b 100644 --- a/template/yoga/image.css +++ b/template/yoga/image.css @@ -107,6 +107,22 @@ TABLE.infoTable TD.value UL { list-style-type: square; } +.rateButton, .rateButtonSelected { + background-color:transparent; + padding:0; + border:0; +} + +.rateButton { + cursor: pointer; +} + +.rateButtonSelected { + color:inherit; + font-weight:bold; + font-size:120%; +} + #comments { text-align: left; } diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index 2464490f4..163dfc827 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -153,12 +153,19 @@ <!-- END metadata --> <!-- BEGIN rate --> -<p> -{rate.SENTENCE} : +<form action="{rate.F_ACTION}" method="post"> +<div>{rate.SENTENCE} : <!-- BEGIN rate_option --> -{rate.rate_option.SEPARATOR} <a href="{rate.rate_option.URL}" rel="nofollow" {TAG_INPUT_ENABLED}>{rate.rate_option.OPTION}</a> +{rate.rate_option.SEPARATOR} +<!-- BEGIN my_rate --> +<input type="button" name="rate" value="{rate.rate_option.OPTION}" class="rateButtonSelected" /> +<!-- END my_rate --> +<!-- BEGIN not_my_rate --> +<input type="submit" name="rate" value="{rate.rate_option.OPTION}" class="rateButton" /> +<!-- END not_my_rate --> <!-- END rate_option --> -</p> +</div> +</form> <!-- END rate --> <hr class="separation"> diff --git a/template/yoga/theme/clear/theme.css b/template/yoga/theme/clear/theme.css index 1260ce776..ee77519f6 100644 --- a/template/yoga/theme/clear/theme.css +++ b/template/yoga/theme/clear/theme.css @@ -53,7 +53,7 @@ FIELDSET, INPUT, SELECT, TEXTAREA, } /* links */ -A { +A, .rateButton { color: #005e89; background: transparent; } diff --git a/template/yoga/theme/dark/theme.css b/template/yoga/theme/dark/theme.css index 371ef680e..c173a89eb 100644 --- a/template/yoga/theme/dark/theme.css +++ b/template/yoga/theme/dark/theme.css @@ -83,7 +83,7 @@ H2, #menubar DT, #imageHeaderBar { } /* links */ -A { +A, .rateButton { color: #FFFFFF; } |