From a879ccf6e80faf33ef536d7faeaad78b4938efec Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Wed, 30 Jan 2019 01:59:06 -0300 Subject: [PATCH 01/12] Treat blob ids as strings due to size limitations --- qa-include/db/cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa-include/db/cache.php b/qa-include/db/cache.php index 0ee1abd95..4030571a9 100644 --- a/qa-include/db/cache.php +++ b/qa-include/db/cache.php @@ -44,7 +44,7 @@ function qa_db_cache_set($type, $cacheid, $content) ); qa_db_query_sub( - 'INSERT INTO ^cache (type, cacheid, content, created, lastread) VALUES ($, #, $, NOW(), NOW()) ' . + 'INSERT INTO ^cache (type, cacheid, content, created, lastread) VALUES ($, $, $, NOW(), NOW()) ' . 'ON DUPLICATE KEY UPDATE content = VALUES(content), created = VALUES(created), lastread = VALUES(lastread)', $type, $cacheid, $content ); From 9e07a036b5c0d4a9d04d9bbf3ba2f1c3463faf74 Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Thu, 31 Jan 2019 04:06:58 -0300 Subject: [PATCH 02/12] Fix negative upvoteCount wrongly displayed --- qa-include/app/format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa-include/app/format.php b/qa-include/app/format.php index b2f8acb9b..f59a4c3f3 100644 --- a/qa-include/app/format.php +++ b/qa-include/app/format.php @@ -495,7 +495,7 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt // schema.org microdata - vote display might be formatted (e.g. '2k') so we use meta tag for true count if ($microdata) { - $fields['netvotes_view']['suffix'] .= ' '; + $fields['netvotes_view']['suffix'] .= ' '; $fields['upvotes_view']['suffix'] .= ' '; } From 7ed3f6a077fd0ad7715ab307c7310f1760ae52a3 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 21 Mar 2019 18:38:10 +0000 Subject: [PATCH 03/12] Limit file input width Fixes #544 --- qa-theme/SnowFlat/qa-styles.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qa-theme/SnowFlat/qa-styles.css b/qa-theme/SnowFlat/qa-styles.css index e0dd0dbef..95ab65490 100644 --- a/qa-theme/SnowFlat/qa-styles.css +++ b/qa-theme/SnowFlat/qa-styles.css @@ -1812,6 +1812,16 @@ input[type="submit"], button { cursor: pointer; text-align: center; } +@media (max-width: 479px) { + input[type="file"] { + max-width: 220px; + } +} +@media (max-width: 359px) { + input[type="file"] { + max-width: 180px; + } +} [class^="qa-part-form"], [class^="qa-part-custom"] { From 6e7176d20abfb322ef5976c03dd7dd6c22529793 Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Thu, 2 May 2019 20:14:09 -0300 Subject: [PATCH 04/12] Prevent duplicated vote events --- qa-include/app/votes.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qa-include/app/votes.php b/qa-include/app/votes.php index 420a3ffad..14f41c385 100644 --- a/qa-include/app/votes.php +++ b/qa-include/app/votes.php @@ -126,6 +126,10 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote) $vote = (int)min(1, max(-1, $vote)); $oldvote = (int)qa_db_uservote_get($post['postid'], $userid); + if ($oldvote === $vote) { + return; + } + qa_db_uservote_set($post['postid'], $userid, $vote); qa_db_post_recount_votes($post['postid']); From d92b3a9c07eb3500ed7d6dbec1cdf540704a563f Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Sat, 11 May 2019 00:36:23 -0300 Subject: [PATCH 05/12] Fire u_delete_before event before deleting a user --- qa-include/pages/user-profile.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qa-include/pages/user-profile.php b/qa-include/pages/user-profile.php index 73a926467..d51af83e2 100644 --- a/qa-include/pages/user-profile.php +++ b/qa-include/pages/user-profile.php @@ -285,6 +285,11 @@ if (qa_clicked('dodelete') && ($loginlevel >= QA_USER_LEVEL_ADMIN)) { require_once QA_INCLUDE_DIR . 'app/users-edit.php'; + qa_report_event('u_delete_before', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array( + 'userid' => $userid, + 'handle' => $useraccount['handle'], + )); + qa_delete_user($userid); qa_report_event('u_delete', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array( From 188f5e98792f2aca3afdd8a03d88e5732c7f5685 Mon Sep 17 00:00:00 2001 From: Guillaume Turri Date: Mon, 4 May 2020 18:27:55 +0200 Subject: [PATCH 06/12] Prevent using and tags we don't really need them, do we? --- qa-include/qa-base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa-include/qa-base.php b/qa-include/qa-base.php index 4a9f95125..f0a691de2 100644 --- a/qa-include/qa-base.php +++ b/qa-include/qa-base.php @@ -1024,7 +1024,7 @@ function qa_sanitize_html($html, $linksnewwindow = false, $storage = false) $safe = htmLawed($html, array( 'safe' => 1, - 'elements' => '*+embed+object-form', + 'elements' => '*-form', '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('/.*/', ''), From e37b830d4b6ed81a029e5bb7819160cfdd23e1b5 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 6 May 2020 15:37:47 +0100 Subject: [PATCH 07/12] Avoid magic quotes deprecation notice on PHP 7.4 Fixes #786. --- qa-include/qa-base.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qa-include/qa-base.php b/qa-include/qa-base.php index f0a691de2..65b4a2ca7 100644 --- a/qa-include/qa-base.php +++ b/qa-include/qa-base.php @@ -1167,7 +1167,11 @@ function qa_gpc_to_string($string) { if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } - return get_magic_quotes_gpc() ? stripslashes($string) : $string; + // get_magic_quotes_gpc always returns false from PHP 5.4; this avoids deprecation notice on PHP 7.4+ + if (qa_php_version_below('5.4.0')) + return get_magic_quotes_gpc() ? stripslashes($string) : $string; + else + return $string; } @@ -1180,7 +1184,11 @@ function qa_string_to_gpc($string) { if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } - return get_magic_quotes_gpc() ? addslashes($string) : $string; + // get_magic_quotes_gpc always returns false from PHP 5.4; this avoids deprecation notice on PHP 7.4+ + if (qa_php_version_below('5.4.0')) + return get_magic_quotes_gpc() ? addslashes($string) : $string; + else + return $string; } From dc6ce3f0d97a0dd543ce86f124157f9cf6b3f125 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 7 May 2020 16:25:40 +0100 Subject: [PATCH 08/12] 1.8.4 --- VERSION.txt | 2 +- qa-include/qa-base.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index fe4e75fb7..7b378be30 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -1.8.3 \ No newline at end of file +1.8.4 \ No newline at end of file diff --git a/qa-include/qa-base.php b/qa-include/qa-base.php index 65b4a2ca7..a06bbaeb0 100644 --- a/qa-include/qa-base.php +++ b/qa-include/qa-base.php @@ -20,8 +20,8 @@ */ -define('QA_VERSION', '1.8.3'); // also used as suffix for .js and .css requests -define('QA_BUILD_DATE', '2019-01-12'); +define('QA_VERSION', '1.8.4'); // also used as suffix for .js and .css requests +define('QA_BUILD_DATE', '2020-05-07'); /** From efcc78ae28f32d86ed3d72cbad1dcac1028ac96f Mon Sep 17 00:00:00 2001 From: Benjamin Klaus Date: Thu, 14 May 2020 12:24:00 +0200 Subject: [PATCH 09/12] extracted accessibility improvements from master of https://github.com/wbt-vienna/question2answer (part 1) --- .gitignore | 2 ++ qa-content/qa-global.js | 13 ++++++---- qa-include/app/format.php | 28 ++++++++++++--------- qa-include/app/page.php | 1 + qa-include/pages/ask.php | 2 ++ qa-include/pages/feedback.php | 7 ++++-- qa-include/pages/forgot.php | 1 + qa-include/pages/login.php | 9 ++++--- qa-include/pages/question-post.php | 17 +++++++++---- qa-include/pages/question-view.php | 25 ++++++++++++------- qa-include/pages/register.php | 3 +++ qa-include/qa-theme-base.php | 39 ++++++++++++++++-------------- 12 files changed, 94 insertions(+), 53 deletions(-) diff --git a/.gitignore b/.gitignore index ecc5ae578..58bf25168 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ ehthumbs.db Thumbs.db .idea/ + +*.iml diff --git a/qa-content/qa-global.js b/qa-content/qa-global.js index 6d3f3a0fc..3f304a438 100644 --- a/qa-content/qa-global.js +++ b/qa-content/qa-global.js @@ -95,9 +95,12 @@ function qa_vote_click(elem) mess = document.createElement('div'); mess.id = 'errorbox'; mess.className = 'qa-error'; - mess.innerHTML = lines[1]; mess.style.display = 'none'; + mess.role = 'alert'; + mess.innerHTML = lines[1]; } + mess.setAttribute('role', 'alert'); + elem.setAttribute('aria-describedby', mess.id); var postelem = document.getElementById(anchor); var e = postelem.parentNode.insertBefore(mess, postelem); @@ -194,19 +197,19 @@ function qa_display_rule_show(target, show, first) var qa_element_revealed = null; -function qa_toggle_element(elem) +function qa_toggle_element(elem, dontClose) { var e = elem ? document.getElementById(elem) : null; if (e && e.qa_disabled) e = null; - if (e && (qa_element_revealed == e)) { + if (e && (qa_element_revealed === e) && !dontClose) { qa_conceal(qa_element_revealed, 'form'); qa_element_revealed = null; } else { - if (qa_element_revealed) + if (qa_element_revealed !== e) qa_conceal(qa_element_revealed, 'form'); if (e) { @@ -431,7 +434,7 @@ function qa_form_params(formname) var e = es[i]; var t = (e.type || '').toLowerCase(); - if (((t != 'checkbox') && (t != 'radio')) || e.checked) + if (((t != 'checkbox') && (t != 'radio')) || (e && e.checked)) params[e.name] = e.value; } diff --git a/qa-include/app/format.php b/qa-include/app/format.php index f59a4c3f3..1d4af5ec3 100644 --- a/qa-include/app/format.php +++ b/qa-include/app/format.php @@ -426,7 +426,7 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt // this is for backwards compatibility with any existing links using the old style of anchor // that contained the post id only (changed to be valid under W3C specifications) - $fields['content'] = '' . $fields['content']; + $fields['content'] = '' . $fields['content']; } // Voting stuff @@ -542,7 +542,8 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt $fields['vote_down_tags'] = 'title="' . qa_lang_html('main/voted_down_popup') . '" name="' . qa_html('vote_' . $postid . '_0_' . $elementid) . '" ' . $onclick; } else { - $fields['vote_up_tags'] = 'title="' . qa_lang_html('main/vote_up_popup') . '" name="' . qa_html('vote_' . $postid . '_1_' . $elementid) . '" ' . $onclick; + $title = $fields['raw']['type'] == "Q" ? qa_lang_html('main/vote_up_popup_question') : qa_lang_html('main/vote_up_popup_answer'); + $fields['vote_up_tags'] = 'title="' . $title . '" name="' . qa_html('vote_' . $postid . '_1_' . $elementid) . '" ' . $onclick; if (strpos($voteview, '-uponly-level')) { $fields['vote_state'] = 'up_only'; @@ -553,8 +554,9 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt $fields['vote_down_tags'] = 'title="' . qa_lang_html('main/vote_disabled_down_approve') . '"'; } else { - $fields['vote_state'] = 'enabled'; - $fields['vote_down_tags'] = 'title="' . qa_lang_html('main/vote_down_popup') . '" name="' . qa_html('vote_' . $postid . '_-1_' . $elementid) . '" ' . $onclick; + $title = $fields['raw']['type'] == "Q" ? qa_lang_html('main/vote_down_popup_question') : qa_lang_html('main/vote_down_popup_answer'); + $fields['vote_state'] = 'enabled'; + $fields['vote_down_tags'] = 'title="' . $title . '" name="' . qa_html('vote_' . $postid . '_-1_' . $elementid) . '" ' . $onclick; } } } @@ -1867,8 +1869,9 @@ function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = '' { $fields['name'] = array( 'label' => qa_lang_html('question/anon_name_label'), - 'tags' => 'name="' . $fieldprefix . 'name"', + 'tags' => 'name="' . $fieldprefix . 'name" id="' .$fieldprefix . 'inputNameAnon"', 'value' => qa_html($inname), + 'id' => $fieldprefix . 'inputNameAnon' ); } @@ -1889,10 +1892,12 @@ function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = '' */ function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email, $innotify, $inemail, $errors_email, $fieldprefix = '') { - $fields['notify'] = array( - 'tags' => 'name="' . $fieldprefix . 'notify"', + + $fields['notify'] = array( + 'tags' => 'name="' . $fieldprefix . 'notify" id="' . $fieldprefix .'notify"', 'type' => 'checkbox', 'value' => qa_html($innotify), + 'id' => $fieldprefix.'notify' ); switch ($basetype) { @@ -1920,19 +1925,20 @@ function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email '' . $labelaskemail . '' . ''; - $fields['notify']['tags'] .= ' id="' . $fieldprefix . 'notify" onclick="if (document.getElementById(\'' . $fieldprefix . 'notify\').checked) document.getElementById(\'' . $fieldprefix . 'email\').focus();"'; + $fields['notify']['tags'] .= ' id="' . $fieldprefix . 'notify" onclick="if (document.getElementById(\'' . $fieldprefix . 'notify\').checked) document.getElementById(\'' . $fieldprefix . 'email_display\').focus();"'; $fields['notify']['tight'] = true; $fields['email'] = array( - 'id' => $fieldprefix . 'email_display', - 'tags' => 'name="' . $fieldprefix . 'email" id="' . $fieldprefix . 'email"', + 'label' => qa_lang_html('main/email_optional'), + 'id' => $fieldprefix . 'email_display', + 'tags' => 'name="' . $fieldprefix . 'email" id="' . $fieldprefix . 'email_display"', 'value' => qa_html($inemail), 'note' => qa_lang_html('question/notify_email_note'), 'error' => qa_html($errors_email), ); qa_set_display_rules($qa_content, array( - $fieldprefix . 'email_display' => $fieldprefix . 'notify', + $fieldprefix . 'email_display-tbody' => $fieldprefix . 'notify', $fieldprefix . 'email_shown' => $fieldprefix . 'notify', $fieldprefix . 'email_hidden' => '!' . $fieldprefix . 'notify', )); diff --git a/qa-include/app/page.php b/qa-include/app/page.php index ce6bc767e..80db415f4 100644 --- a/qa-include/app/page.php +++ b/qa-include/app/page.php @@ -517,6 +517,7 @@ function qa_content_prepare($voting = false, $categoryids = array()) 'feedback' => array( 'url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback'), + 'role' => 'link' ), ), diff --git a/qa-include/pages/ask.php b/qa-include/pages/ask.php index 4f11c2438..374d2b2ff 100644 --- a/qa-include/pages/ask.php +++ b/qa-include/pages/ask.php @@ -189,6 +189,7 @@ $field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false); $field['label'] = qa_lang_html('question/q_content_label'); $field['error'] = qa_html(@$errors['content']); +$field['id'] = 'content'; $custom = qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : ''; @@ -208,6 +209,7 @@ 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => qa_html(@$in['title']), 'error' => qa_html(@$errors['title']), + 'id' => 'title' ), 'similar' => array( diff --git a/qa-include/pages/feedback.php b/qa-include/pages/feedback.php index 477b237d7..2916f8e5b 100644 --- a/qa-include/pages/feedback.php +++ b/qa-include/pages/feedback.php @@ -138,21 +138,24 @@ 'value' => qa_html(@$inmessage), 'rows' => 8, 'error' => qa_html(@$errors['message']), + 'id' => 'message' ), 'name' => array( 'type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_name'), - 'tags' => 'name="name"', + 'tags' => 'name="name" id="nameInput"', 'value' => qa_html(isset($inname) ? $inname : @$userprofile['name']), + 'id' => 'nameInput' ), 'email' => array( 'type' => $feedbacksent ? 'static' : '', 'label' => qa_lang_html('misc/feedback_email'), - 'tags' => 'name="email"', + 'tags' => 'name="email" id="emailInput"', 'value' => qa_html(isset($inemail) ? $inemail : qa_get_logged_in_email()), 'note' => $feedbacksent ? null : qa_opt('email_privacy'), + 'id' => 'emailInput' ), ), diff --git a/qa-include/pages/forgot.php b/qa-include/pages/forgot.php index 9b1ce5b23..c606dbfe8 100644 --- a/qa-include/pages/forgot.php +++ b/qa-include/pages/forgot.php @@ -94,6 +94,7 @@ 'value' => qa_html(@$inemailhandle), 'error' => qa_html(@$errors['emailhandle']), 'note' => qa_lang_html('users/send_reset_note'), + 'id' => 'emailhandle' ), ), diff --git a/qa-include/pages/login.php b/qa-include/pages/login.php index 0a8582656..0ad6532e6 100644 --- a/qa-include/pages/login.php +++ b/qa-include/pages/login.php @@ -151,25 +151,28 @@ 'fields' => array( 'email_handle' => array( 'label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), - 'tags' => 'name="emailhandle" id="emailhandle" dir="auto"', + 'tags' => 'name="emailhandle" id="emailhandle" dir="auto" autocomplete="username"', 'value' => qa_html(@$inemailhandle), 'error' => qa_html(@$errors['emailhandle']), + 'id' => 'emailhandle' ), 'password' => array( 'type' => 'password', 'label' => qa_lang_html('users/password_label'), - 'tags' => 'name="password" id="password" dir="auto"', + 'tags' => 'name="password" id="password" dir="auto" autocomplete="current-password"', 'value' => qa_html(@$inpassword), 'error' => empty($errors['password']) ? '' : (qa_html(@$errors['password']) . ' - ' . $forgothtml), 'note' => $passwordsent ? qa_lang_html('users/password_sent') : $forgothtml, + 'id' => 'password' ), 'remember' => array( 'type' => 'checkbox', 'label' => qa_lang_html('users/remember_label'), - 'tags' => 'name="remember"', + 'tags' => 'name="remember" id="rememberInput"', 'value' => !empty($inremember), + 'id' => 'rememberInput' ), ), diff --git a/qa-include/pages/question-post.php b/qa-include/pages/question-post.php index 801be44c9..6e708ab1d 100644 --- a/qa-include/pages/question-post.php +++ b/qa-include/pages/question-post.php @@ -309,9 +309,10 @@ function qa_page_q_edit_q_form(&$qa_content, $question, $in, $errors, $completet 'title' => array( 'type' => $question['editable'] ? 'text' : 'static', 'label' => qa_lang_html('question/q_title_label'), - 'tags' => 'name="q_title"', + 'tags' => 'name="q_title" id="q_title"', 'value' => qa_html(($question['editable'] && isset($in['title'])) ? $in['title'] : $question['title']), 'error' => qa_html(@$errors['title']), + 'id' => 'q_title' ), 'category' => array( @@ -322,6 +323,8 @@ function qa_page_q_edit_q_form(&$qa_content, $question, $in, $errors, $completet 'content' => array( 'label' => qa_lang_html('question/q_content_label'), 'error' => qa_html(@$errors['content']), + 'tags' => 'name="q_content" id="q_content"', + 'id' => 'q_content' ), 'extra' => array( @@ -404,8 +407,9 @@ function qa_page_q_edit_q_form(&$qa_content, $question, $in, $errors, $completet $form['fields']['silent'] = array( 'type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), - 'tags' => 'name="q_silent"', + 'tags' => 'name="q_silent" id="q_silent"', 'value' => qa_html(@$in['silent']), + 'id' => 'q_silent' ); } @@ -711,10 +715,11 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers, '', 'type' => 'checkbox', 'tight' => true, + 'id' => $prefix . 'dotoc' ); $form['fields']['commenton'] = array( - 'tags' => 'name="' . $prefix . 'commenton"', + 'tags' => 'name="' . $prefix . 'commenton" id="' . $prefix . 'commenton"', 'id' => $prefix . 'commenton', 'type' => 'select', 'note' => qa_lang_html($hascomments ? 'question/a_convert_warn_cs' : 'question/a_convert_warn'), @@ -744,8 +749,9 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers, $form['fields']['silent'] = array( 'type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), - 'tags' => 'name="' . $prefix . 'silent"', + 'tags' => 'name="' . $prefix . 'silent" id="' . $prefix . '_silent"', 'value' => qa_html(@$in['silent']), + 'id' => $prefix . '_silent' ); } @@ -951,8 +957,9 @@ function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors) $form['fields']['silent'] = array( 'type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), - 'tags' => 'name="' . $prefix . 'silent"', + 'tags' => 'name="' . $prefix . 'silent" id="' . $prefix . '_silent"', 'value' => qa_html(@$in['silent']), + 'id' => $prefix . '_silent' ); } diff --git a/qa-include/pages/question-view.php b/qa-include/pages/question-view.php index 0f5940933..904d976a0 100644 --- a/qa-include/pages/question-view.php +++ b/qa-include/pages/question-view.php @@ -395,7 +395,7 @@ function qa_page_q_question_view($question, $parentquestion, $closepost, $usersh if ($question['answerbutton']) { // don't show if shown by default $buttons['answer'] = array( - 'tags' => 'name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element(\'anew\')"', + 'tags' => 'name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element(\'anew\', true)"', 'label' => qa_lang_html('question/answer_button'), 'popup' => qa_lang_html('question/answer_q_popup'), ); @@ -403,7 +403,7 @@ function qa_page_q_question_view($question, $parentquestion, $closepost, $usersh if ($question['commentbutton']) { $buttons['comment'] = array( - 'tags' => 'name="q_docomment" onclick="return qa_toggle_element(\'c' . $questionid . '\')"', + 'tags' => 'name="q_docomment" onclick="return qa_toggle_element(\'c' . $questionid . '\', true)"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_q_popup'), ); @@ -617,7 +617,7 @@ function qa_page_q_answer_view($question, $answer, $isselected, $usershtml, $for if ($answer['commentbutton']) { $buttons['comment'] = array( - 'tags' => 'name="' . $prefix . 'docomment" onclick="return qa_toggle_element(\'c' . $answerid . '\')"', + 'tags' => 'name="' . $prefix . 'docomment" onclick="return qa_toggle_element(\'c' . $answerid . '\', true)"', 'label' => qa_lang_html('question/comment_button'), 'popup' => qa_lang_html('question/comment_a_popup'), ); @@ -755,7 +755,7 @@ function qa_page_q_comment_view($question, $parent, $comment, $usershtml, $formr if ($parent['commentbutton'] && qa_opt('show_c_reply_buttons') && $comment['type'] == 'C') { $buttons['comment'] = array( 'tags' => 'name="' . (($parent['basetype'] == 'Q') ? 'q' : ('a' . qa_html($parent['postid']))) . - '_docomment" onclick="return qa_toggle_element(\'c' . qa_html($parent['postid']) . '\')"', + '_docomment" onclick="return qa_toggle_element(\'c' . qa_html($parent['postid']) . '\', true)"', 'label' => qa_lang_html('question/reply_button'), 'popup' => qa_lang_html('question/reply_c_popup'), ); @@ -935,8 +935,6 @@ function qa_page_q_add_a_form(&$qa_content, $formid, $captchareason, $question, $form = array( 'tags' => 'method="post" action="' . qa_self_html() . '" name="a_form"', - 'title' => qa_lang_html('question/your_answer_title'), - 'fields' => array( 'custom' => array( 'type' => 'custom', @@ -947,7 +945,11 @@ function qa_page_q_add_a_form(&$qa_content, $formid, $captchareason, $question, qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'a_content', 12, $formrequested, $loadnow), array( 'error' => qa_html(@$errors['content']), - ) + ), + [ + 'label' => qa_lang_html('question/your_answer_title'), + 'id' => 'a_content' + ] ), ), @@ -1083,10 +1085,11 @@ function qa_page_q_add_c_form(&$qa_content, $question, $parent, $formid, $captch $custom = qa_opt('show_custom_comment') ? trim(qa_opt('custom_comment')) : ''; + $label = qa_lang_html(($question['postid'] == $parent['postid']) ? 'question/your_comment_q' : 'question/your_comment_a'); $form = array( 'tags' => 'method="post" action="' . qa_self_html() . '" name="c_form_' . qa_html($parent['postid']) . '"', - 'title' => qa_lang_html(($question['postid'] == $parent['postid']) ? 'question/your_comment_q' : 'question/your_comment_a'), + 'fields' => array( 'custom' => array( @@ -1098,7 +1101,11 @@ function qa_page_q_add_c_form(&$qa_content, $question, $parent, $formid, $captch qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], $prefix . 'content', 4, $loadfocusnow, $loadfocusnow), array( 'error' => qa_html(@$errors['content']), - ) + ), + [ + 'label' => $label, + 'id' => $prefix . 'content' + ] ), ), diff --git a/qa-include/pages/register.php b/qa-include/pages/register.php index dacde6c39..e0ba230fe 100644 --- a/qa-include/pages/register.php +++ b/qa-include/pages/register.php @@ -158,6 +158,7 @@ 'tags' => 'name="handle" id="handle" dir="auto"', 'value' => qa_html(@$inhandle), 'error' => qa_html(@$errors['handle']), + 'id' => 'handle' ), 'password' => array( @@ -166,6 +167,7 @@ 'tags' => 'name="password" id="password" dir="auto"', 'value' => qa_html(@$inpassword), 'error' => qa_html(@$errors['password']), + 'id' => 'password' ), 'email' => array( @@ -174,6 +176,7 @@ 'value' => qa_html(@$inemail), 'note' => qa_opt('email_privacy'), 'error' => qa_html(@$errors['email']), + 'id' => 'email' ), ), diff --git a/qa-include/qa-theme-base.php b/qa-include/qa-theme-base.php index 9069b7406..49f4052e9 100644 --- a/qa-include/qa-theme-base.php +++ b/qa-include/qa-theme-base.php @@ -156,7 +156,7 @@ public function output_split($parts, $class, $outertag = 'span', $innertag = 'sp return; $this->output( - '<' . $outertag . ' class="' . $class . (isset($extraclass) ? (' ' . $extraclass) : '') . '">', + '<' . $outertag . ' class="' . $class . (isset($extraclass) ? (' ' . $extraclass) : '') . '"' . (isset($parts['aria-hidden']) ? 'aria-hidden="true"' : '') . '>', (strlen(@$parts['prefix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['prefix'] . '') : '') . (strlen(@$parts['data']) ? ('<' . $innertag . ' class="' . $class . '-data">' . $parts['data'] . '') : '') . (strlen(@$parts['suffix']) ? ('<' . $innertag . ' class="' . $class . '-pad">' . $parts['suffix'] . '') : ''), @@ -566,12 +566,12 @@ public function search_button($search) $this->output(''); } - public function nav($navtype, $level = null) + public function nav($navtype, $level = null, $ariaLabel = "") { $navigation = @$this->content['navigation'][$navtype]; if ($navtype == 'user' || isset($navigation)) { - $this->output('
'); + $this->output('
'); + $this->output(''); } } public function nav_list($navigation, $class, $level = null) { - $this->output('
    '); + $role = 'role="tablist"'; + foreach ($navigation as $key => $navlink) { + $role = isset($navlink['role']) ? 'role="presentation"' : $role; + } + $this->output('
      '); $index = 0; @@ -626,8 +630,9 @@ public function nav_item($key, $navlink, $class, $level = null) '/' => '-', )); - $this->output('
    • '); + $role = isset($navlink['role']) ? $navlink['role'] : 'tab'; + $this->output('
    • '); $this->nav_link($navlink, $class); $subnav = isset($navlink['subnav']) ? $navlink['subnav'] : array(); @@ -715,7 +720,7 @@ public function main() $content = $this->content; $hidden = !empty($content['hidden']) ? ' qa-main-hidden' : ''; - $this->output('
      '); + $this->output('
      '); $this->widgets('main', 'top'); @@ -732,7 +737,7 @@ public function main() $this->widgets('main', 'bottom'); - $this->output('
      ', ''); + $this->output(' ', ''); } public function page_title_error() @@ -911,7 +916,7 @@ public function attribution() // Hi there. I'd really appreciate you displaying this link on your Q2A site. Thank you - Gideon $this->output( - '
      ', + '
      ', 'Powered by Question2Answer', '
      ' ); @@ -986,7 +991,7 @@ public function form_body($form) $columns = $this->form_columns($form); if ($columns) - $this->output(''); + $this->output('
      '); $this->form_ok($form, $columns); $this->form_fields($form, $columns); @@ -1065,9 +1070,9 @@ public function form_field_rows($form, $columns, $field) if (isset($field['id'])) { if ($columns == 1) - $this->output('', ''); + $this->output('', ''); else - $this->output(''); + $this->output(''); } else $this->output(''); @@ -1102,15 +1107,13 @@ public function form_label($field, $style, $columns, $prefixed, $suffixed, $cols $this->output('