Commit 17f95d94 by pupi1985

Added qa_format_number to votes in question lists

parent d70f05b5
...@@ -393,23 +393,26 @@ ...@@ -393,23 +393,26 @@
$downvotes=(int)@$post['downvotes']; $downvotes=(int)@$post['downvotes'];
} }
$netvotes=(int)($upvotes-$downvotes); $netvotes = $upvotes - $downvotes;
$fields['upvotes_raw']=$upvotes; $fields['upvotes_raw'] = $upvotes;
$fields['downvotes_raw']=$downvotes; $fields['downvotes_raw'] = $downvotes;
$fields['netvotes_raw']=$netvotes; $fields['netvotes_raw'] = $netvotes;
// Create HTML versions... // Create HTML versions...
$upvoteshtml=qa_html($upvotes); $upvoteshtml = qa_html(qa_format_number($upvotes));
$downvoteshtml=qa_html($downvotes); $downvoteshtml = qa_html(qa_format_number($downvotes));
if ($netvotes>=1) if ($netvotes >= 1)
$netvoteshtml='+'.qa_html($netvotes); $netvotesPrefix = '+';
elseif ($netvotes<=-1) elseif ($netvotes <= -1)
$netvoteshtml='&ndash;'.qa_html(-$netvotes); $netvotesPrefix = '&ndash;';
else else
$netvoteshtml='0'; $netvotesPrefix = '';
$netvotes = abs($netvotes);
$netvoteshtml = $netvotesPrefix . qa_html(qa_format_number($netvotes));
// ...with microformats if appropriate // ...with microformats if appropriate
...@@ -436,7 +439,7 @@ ...@@ -436,7 +439,7 @@
$fields['downvotes_view']=($downvotes==1) ? qa_lang_html_sub_split('main/1_disliked', $downvoteshtml, '1') $fields['downvotes_view']=($downvotes==1) ? qa_lang_html_sub_split('main/1_disliked', $downvoteshtml, '1')
: qa_lang_html_sub_split('main/x_disliked', $downvoteshtml); : qa_lang_html_sub_split('main/x_disliked', $downvoteshtml);
$fields['netvotes_view']=(abs($netvotes)==1) ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1') $fields['netvotes_view']=($netvotes==1) ? qa_lang_html_sub_split('main/1_vote', $netvoteshtml, '1')
: qa_lang_html_sub_split('main/x_votes', $netvoteshtml); : qa_lang_html_sub_split('main/x_votes', $netvoteshtml);
// Voting buttons // Voting buttons
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment