Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ php:
- '7.0'
- '7.2'
- '7.3'
- '7.4'

jobs:
include:
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.5
1.8.6
4 changes: 2 additions & 2 deletions qa-config-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,6 @@
define('QA_DEBUG_PERFORMANCE', false);

/*
And lastly... if you want to, you can predefine any constant from qa-db-maxima.php in this
file to override the default setting. Just make sure you know what you're doing!
And lastly... if you want to, you can predefine any constant from qa-include/db/maxima.php in
this file to override the default setting. Just make sure you know what you're doing!
*/
2 changes: 1 addition & 1 deletion qa-external-example/qa-external-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function qa_get_users_html($userids, $should_include_link, $relative_url_prefix)
*
* If $padding is true, the HTML you return should render to a square of $size x $size pixels,
* even if the avatar is not square. This can be achieved using CSS padding - see function
* qa_get_avatar_blob_html(...) in qa-app-format.php for an example. If $padding is false,
* qa_get_avatar_blob_html(...) in app/format.php for an example. If $padding is false,
* the HTML can render to anything which would fit inside a square of $size x $size pixels.
*
* Note that this function may be called many times to render an individual page, so it is not
Expand Down
4 changes: 2 additions & 2 deletions qa-include/app/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function qa_get_logged_in_points()
$qa_cached_logged_in_points = qa_db_select_with_pending(qa_db_user_points_selectspec(qa_get_logged_in_userid(), true));
}

return $qa_cached_logged_in_points['points'];
return isset($qa_cached_logged_in_points['points']) ? $qa_cached_logged_in_points['points'] : null;
}


Expand Down Expand Up @@ -1254,7 +1254,7 @@ function qa_user_userfield_label($userfield)
'website' => 'users/website',
);

if (isset($defaultlabels[$userfield['title']]))
if (isset($userfield['title']) && isset($defaultlabels[$userfield['title']]))
return qa_lang($defaultlabels[$userfield['title']]);
}

Expand Down
7 changes: 5 additions & 2 deletions qa-include/pages/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@

// Check we're not using single-sign on integration, that we're logged in

if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
if (QA_FINAL_EXTERNAL_USERS) {
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}

$userid = qa_get_logged_in_userid();

Expand Down
7 changes: 5 additions & 2 deletions qa-include/pages/admin/admin-approve.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

// Check we're not using single-sign on integration

if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
if (QA_FINAL_EXTERNAL_USERS) {
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}


// Find most flagged questions, answers, comments
Expand Down
2 changes: 1 addition & 1 deletion qa-include/pages/confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
if (strlen($handle) > 0) { // If there is a handle present in the URL
$userInfo = qa_db_select_with_pending(qa_db_user_account_selectspec($handle, false));

if (strtolower(trim($userInfo['emailcode'])) == strtolower($code)) {
if ($userInfo !== null && strtolower(trim($userInfo['emailcode'])) == strtolower($code)) {
qa_complete_confirm($userInfo['userid'], $userInfo['email'], $userInfo['handle']);
$userConfirmed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion qa-include/pages/hot.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// Get list of hottest questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php

$categoryslugs = QA_ALLOW_UNINDEXED_QUERIES ? qa_request_parts(1) : null;
$countslugs = @count($categoryslugs);
$countslugs = $categoryslugs === null ? null : count($categoryslugs);

$start = qa_get_start();
$userid = qa_get_logged_in_userid();
Expand Down
7 changes: 5 additions & 2 deletions qa-include/pages/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@

// Check we have a handle, we're not using Q2A's single-sign on integration and that we're logged in

if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
if (QA_FINAL_EXTERNAL_USERS) {
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}

if (!strlen($handle))
qa_redirect('users');
Expand Down
7 changes: 5 additions & 2 deletions qa-include/pages/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
else
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';

if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
if (QA_FINAL_EXTERNAL_USERS) {
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}

if (!isset($loginUserId)) {
$qa_content = qa_content_prepare();
Expand Down
2 changes: 2 additions & 0 deletions qa-include/pages/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@

// Process submitted form

$errors = array();

if (qa_clicked('doregister')) {
require_once QA_INCLUDE_DIR . 'app/limits.php';

Expand Down
2 changes: 1 addition & 1 deletion qa-include/pages/unanswered.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
else
$categoryslugs = null;

$countslugs = @count($categoryslugs);
$countslugs = $categoryslugs === null ? null : count($categoryslugs);
$by = qa_get('by');
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
Expand Down
4 changes: 2 additions & 2 deletions qa-include/pages/user-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
$qa_content['error'] = @$errors['page'];

if (isset($loginuserid) && $loginuserid != $useraccount['userid'] && !QA_FINAL_EXTERNAL_USERS) {
if (!QA_FINAL_EXTERNAL_USERS && isset($loginuserid) && $loginuserid != $useraccount['userid']) {
$favoritemap = qa_get_favorite_non_qs_map();
$favorite = @$favoritemap['user'][$useraccount['userid']];

Expand Down Expand Up @@ -753,7 +753,7 @@
'bonus' => array(
'label' => qa_lang_html('profile/bonus_points'),
'tags' => 'name="bonus"',
'value' => qa_html(isset($inbonus) ? $inbonus : $userpoints['bonus']),
'value' => qa_html(isset($inbonus) ? $inbonus : @$userpoints['bonus']),
'type' => 'number',
'note' => qa_lang_html('users/only_shown_admins'),
'id' => 'bonus',
Expand Down
7 changes: 5 additions & 2 deletions qa-include/pages/user-wall.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

// Check we're not using single-sign on integration, which doesn't allow walls

if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
if (QA_FINAL_EXTERNAL_USERS) {
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}


// $handle, $userhtml are already set by /qa-include/page/user.php
Expand Down
4 changes: 3 additions & 1 deletion qa-include/pages/users-blocked.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
// Check we're not using single-sign on integration

if (QA_FINAL_EXTERNAL_USERS) {
qa_fatal_error('User accounts are handled by external code');
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}


Expand Down
4 changes: 3 additions & 1 deletion qa-include/pages/users-newest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
// Check we're not using single-sign on integration

if (QA_FINAL_EXTERNAL_USERS) {
qa_fatal_error('User accounts are handled by external code');
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}


Expand Down
4 changes: 3 additions & 1 deletion qa-include/pages/users-special.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
// Check we're not using single-sign on integration

if (QA_FINAL_EXTERNAL_USERS) {
qa_fatal_error('User accounts are handled by external code');
header('HTTP/1.1 404 Not Found');
echo qa_lang_html('main/page_not_found');
qa_exit();
}


Expand Down
6 changes: 3 additions & 3 deletions qa-include/qa-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/


define('QA_VERSION', '1.8.5'); // also used as suffix for .js and .css requests
define('QA_BUILD_DATE', '2020-07-15');
define('QA_VERSION', '1.8.6'); // also used as suffix for .js and .css requests
define('QA_BUILD_DATE', '2021-04-20');


/**
Expand Down Expand Up @@ -1024,7 +1024,7 @@ function qa_sanitize_html($html, $linksnewwindow = false, $storage = false)

$safe = htmLawed($html, array(
'safe' => 1,
'elements' => '*-form-style',
'elements' => '*-form-input-select-textarea-style',
'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; style: !; classid:clsid',
'keep_bad' => 0,
'anti_link_spam' => array('/.*/', ''),
Expand Down
4 changes: 2 additions & 2 deletions qa-include/qa-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function qa_feed_not_found()
function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title,
$questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
{
$countslugs = @count($categoryslugs);
$countslugs = $categoryslugs === null ? null : count($categoryslugs);

list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending(
$questionselectspec1,
Expand Down Expand Up @@ -165,7 +165,7 @@ function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title,
break;
}

$countslugs = @count($categoryslugs);
$countslugs = $categoryslugs === null ? null : count($categoryslugs);

if (!isset($feedoption))
qa_feed_not_found();
Expand Down
8 changes: 4 additions & 4 deletions qa-include/qa-theme-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ public function page_title_error()
if (isset($favorite))
$this->output('<form ' . $favorite['form_tags'] . '>');

$this->output('<div class="qa-main-heading">');
$this->output('<div class="qa-main-heading" dir="auto">');
$this->favorite();
$this->output('<h1>');
$this->title();
Expand Down Expand Up @@ -1713,7 +1713,7 @@ public function q_item_clear()
public function q_item_title($q_item)
{
$this->output(
'<div class="qa-q-item-title">',
'<div class="qa-q-item-title" dir="auto">',
'<a href="' . $q_item['url'] . '">' . $q_item['title'] . '</a>',
// add closed note in title
empty($q_item['closed']['state']) ? '' : ' [' . $q_item['closed']['state'] . ']',
Expand Down Expand Up @@ -2198,7 +2198,7 @@ public function q_view_content($q_view)
{
$content = isset($q_view['content']) ? $q_view['content'] : '';

$this->output('<div class="qa-q-view-content qa-post-content">');
$this->output('<div class="qa-q-view-content qa-post-content" dir="auto">');
$this->output_raw($content);
$this->output('</div>');
}
Expand Down Expand Up @@ -2361,7 +2361,7 @@ public function a_item_content($a_item)
$a_item['content'] = '';
}

$this->output('<div class="qa-a-item-content qa-post-content">');
$this->output('<div class="qa-a-item-content qa-post-content" dir="auto">');
$this->output_raw($a_item['content']);
$this->output('</div>');
}
Expand Down
3 changes: 3 additions & 0 deletions qa-include/util/external-users-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ function qa_get_logged_in_user()
else
$level = QA_USER_LEVEL_BASIC;

// flush WP email cache (for displaying avatars)
qa_get_public_from_userids([$wordpressuser->ID]);

return array(
'userid' => $wordpressuser->ID,
'publicusername' => $wordpressuser->user_nicename,
Expand Down
2 changes: 1 addition & 1 deletion qa-plugin/wysiwyg-editor/qa-wysiwyg-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function match_request($request)
// Fix path to WYSIWYG editor smileys
public function process_request($request)
{
require_once QA_INCLUDE_DIR.'qa-app-posts.php';
require_once QA_INCLUDE_DIR . 'app/posts.php';

// smiley replacement regexes
$rxSearch = '<(img|a)([^>]+)(src|href)="([^"]+)/wysiwyg-editor/plugins/smiley/images/([^"]+)"';
Expand Down
2 changes: 1 addition & 1 deletion qa-theme/SnowFlat/qa-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public function q_item_title($q_item)
: '<img src="' . $this->rooturl . $this->icon_url . '/closed-q-list.png" class="qam-q-list-close-icon" alt="' . $closedText . '" title="' . $closedText . '"/>';

$this->output(
'<div class="qa-q-item-title">',
'<div class="qa-q-item-title" dir="auto">',
// add closed note in title
$imgHtml,
'<a href="' . $q_item['url'] . '">' . $q_item['title'] . '</a>',
Expand Down