Skip to content

Commit 71ba713

Browse files
authored
Merge branch 'bugfix' into fix_sanitize_style
2 parents e19bb69 + 1cb97a5 commit 71ba713

162 files changed

Lines changed: 1725 additions & 1437 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Ignore config file in development
2-
qa-config.php
3-
qa-cache/*/
1+
# Ignore Q2A config file and .htaccess in development
2+
/qa-config.php
3+
/.htaccess
4+
5+
# Ignore cached files
6+
/qa-cache/*/
47

58
# Other files
69
.DS_Store

.htaccess

Lines changed: 0 additions & 11 deletions
This file was deleted.

.htaccess-example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# In order for the web server to process this file it must be renamed to ".htaccess"
2+
3+
Options -Indexes
4+
DirectoryIndex index.php
5+
6+
<IfModule mod_rewrite.c>
7+
RewriteEngine On
8+
#RewriteBase /
9+
10+
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
11+
RewriteRule . %1/%2 [R=301,L]
12+
13+
RewriteCond %{REQUEST_FILENAME} !-f
14+
RewriteCond %{REQUEST_FILENAME} !-d
15+
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
16+
</IfModule>

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.3
1+
1.8.4

qa-content/jquery-3.3.1.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

qa-content/jquery-3.5.1.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

qa-include/app/format.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
495495

496496
// schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count
497497
if ($microdata) {
498-
$fields['netvotes_view']['suffix'] .= ' <meta itemprop="upvoteCount" content="' . qa_html($netvotes) . '"/>';
498+
$fields['netvotes_view']['suffix'] .= ' <meta itemprop="upvoteCount" content="' . qa_html($upvotes - $downvotes) . '"/>';
499499
$fields['upvotes_view']['suffix'] .= ' <meta itemprop="upvoteCount" content="' . qa_html($upvotes) . '"/>';
500500
}
501501

@@ -2359,7 +2359,8 @@ function qa_favorite_form($entitytype, $entityid, $favorite, $title)
23592359

23602360
/**
23612361
* Format a number using the decimal point and thousand separator specified in the language files.
2362-
* If the number is compacted it is turned into a string such as 1.3k or 2.5m.
2362+
* If the number is compacted it is turned into a string such as 17.3k (only the thousand/million
2363+
* cases are currently supported).
23632364
*
23642365
* @since 1.8.0
23652366
* @param integer $number Number to be formatted
@@ -2374,20 +2375,15 @@ function qa_format_number($number, $decimals = 0, $compact = false)
23742375
$suffix = '';
23752376

23762377
if ($compact && qa_opt('show_compact_numbers')) {
2377-
$decimals = 0;
2378-
// only the k/m cases are currently supported (i.e. no billions)
2378+
// when compacting we keep 2-3 significant figures (e.g. 9.1k, 234k)
23792379
if ($number >= 1000000) {
23802380
$number /= 1000000;
23812381
$suffix = qa_lang_html('main/_millions_suffix');
2382+
$decimals = $number < 100 ? 1 : 0;
23822383
} elseif ($number >= 1000) {
23832384
$number /= 1000;
23842385
$suffix = qa_lang_html('main/_thousands_suffix');
2385-
}
2386-
2387-
// keep decimal part if not 0 and number is short (e.g. 9.1k)
2388-
$rounded = round($number, 1);
2389-
if ($number < 100 && ($rounded != (int)$rounded)) {
2390-
$decimals = 1;
2386+
$decimals = $number < 100 ? 1 : 0;
23912387
}
23922388
}
23932389

qa-include/app/page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ function qa_content_prepare($voting = false, $categoryids = array())
798798
}
799799
}
800800

801-
$qa_content['script_rel'] = array('qa-content/jquery-3.3.1.min.js');
801+
$qa_content['script_rel'] = array('qa-content/jquery-3.5.1.min.js');
802802
$qa_content['script_rel'][] = 'qa-content/qa-global.js?' . QA_VERSION;
803803

804804
if ($voting)

qa-include/app/recalc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ function qa_recalc_perform_step(&$state)
543543
case 'docacheclear_process':
544544
$cacheDriver = Q2A_Storage_CacheFactory::getCacheDriver();
545545
$cacheStats = $cacheDriver->getStats();
546-
$limit = min($cacheStats['files'], 20);
546+
$limit = min($cacheStats['files'], 500);
547547

548548
if ($cacheStats['files'] > 0 && $next <= $length) {
549549
$deleted = $cacheDriver->clear($limit, $next, ($operation === 'docachetrim_process'));

qa-include/app/votes.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
126126
$vote = (int)min(1, max(-1, $vote));
127127
$oldvote = (int)qa_db_uservote_get($post['postid'], $userid);
128128

129+
if ($oldvote === $vote) {
130+
return;
131+
}
132+
129133
qa_db_uservote_set($post['postid'], $userid, $vote);
130134
qa_db_post_recount_votes($post['postid']);
131135

0 commit comments

Comments
 (0)