From 0510cfdc5ad38487600f8f1bf8e4d4f9747781df Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 28 Apr 2006 04:38:36 +0000 Subject: 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 --- include/picture_rate.inc.php | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'include/picture_rate.inc.php') 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() ); + } } } } -- cgit v1.2.3