diff --git a/sources/ElkArte/Controller/Display.php b/sources/ElkArte/Controller/Display.php index 43110335bb..7ea99e6cd1 100644 --- a/sources/ElkArte/Controller/Display.php +++ b/sources/ElkArte/Controller/Display.php @@ -441,7 +441,7 @@ public function increaseTopicViews($topic) * * @param int $topic * @param int $board - * @throws \ElkArte\Exceptions\Exception on invalid topic value + * @throws Exception on invalid topic value */ public function loadTopicInfo($topic, $board) { @@ -583,6 +583,8 @@ public function setMessageContext() $context['topic_last_message'] = $this->topicinfo['id_last_msg']; $context['topic_unwatched'] = $this->topicinfo['unwatched'] ?? 0; $context['start_from'] = $this->start_from; + $context['topic_start_time'] = htmlTime($this->topicinfo['poster_time']); + $context['topic_starter_name'] = $this->topicinfo['poster_name']; // Did this user start the topic or not? $context['user']['started'] = $this->didThisUserStart(); @@ -1015,7 +1017,7 @@ public function buildModerationButtons() * @param string $action the function name of the current action * * @return bool - * @throws \ElkArte\Exceptions\Exception not_a_topic + * @throws Exception not_a_topic */ public function trackStats($action = '') { diff --git a/sources/ElkArte/Http/CurlFetchWebdata.php b/sources/ElkArte/Http/CurlFetchWebdata.php index ce0753568c..2993d2763b 100644 --- a/sources/ElkArte/Http/CurlFetchWebdata.php +++ b/sources/ElkArte/Http/CurlFetchWebdata.php @@ -150,7 +150,7 @@ private function _buildPostData($post_data) // we don't support that. foreach ($post_data as $name => $value) { - $post_vars[] = $name . '=' . urlencode($value[0] === '@' ? '' : $value); + $post_vars[] = $name . '=' . urlencode(($value === '' || $value[0] === '@') ? '' : $value); } return implode('&', $post_vars); diff --git a/sources/subs/Members.subs.php b/sources/subs/Members.subs.php index 77435a154d..79a34b3a59 100644 --- a/sources/subs/Members.subs.php +++ b/sources/subs/Members.subs.php @@ -2680,7 +2680,7 @@ function memberQuerySeeBoard($id_member) * - If the member's post number is updated, updates their post groups. * * @param int[]|int $members An array of member ids - * @param mixed[] $data An associative array of the columns to be updated and their respective values. + * @param array $data An associative array of the columns to be updated and their respective values. */ function updateMemberData($members, $data) { @@ -2719,7 +2719,7 @@ function updateMemberData($members, $data) if (!empty($modSettings['integrate_change_member_data'])) { // Only a few member variables are really interesting for integration. - $integration_vars = array( + $integration_vars = [ 'member_name', 'real_name', 'email_address', @@ -2731,7 +2731,7 @@ function updateMemberData($members, $data) 'time_offset', 'avatar', 'lngfile', - ); + ]; $vars_to_integrate = array_intersect($integration_vars, array_keys($data)); // Only proceed if there are any variables left to call the integration function. @@ -2740,7 +2740,7 @@ function updateMemberData($members, $data) // Fetch a list of member_names if necessary if ((!is_array($members) && $members === User::$info->id) || (is_array($members) && count($members) == 1 && in_array(User::$info->id, $members))) { - $member_names = array(User::$info->username); + $member_names = [User::$info->username]; } else { @@ -2797,7 +2797,7 @@ function ($row) { { if (preg_match('~^' . $var . ' (\+ |- |\+ -)([\d]+)~', $val, $match)) { - if ($match[1] != '+ ') + if ($match[1] !== '+ ') { $val = 'CASE WHEN ' . $var . ' <= ' . abs($match[2]) . ' THEN 0 ELSE ' . $val . ' END'; } diff --git a/sources/subs/Topic.subs.php b/sources/subs/Topic.subs.php index b8a47a6ed0..3d4edc3a9f 100644 --- a/sources/subs/Topic.subs.php +++ b/sources/subs/Topic.subs.php @@ -1362,7 +1362,7 @@ function getTopicInfo($topic_parameters, $full = '', $selects = array(), $tables } $messages_table = $full === 'message' || $full === 'all' || $full === 'starter'; - $members_table = $full === 'starter'; + $members_table = $full === 'starter' || $full === 'all'; $logs_table = $full === 'all'; // Create the query, taking full and integration in to account diff --git a/tests/ElkArte/Http/CurlFetchWebdataTest.php b/tests/ElkArte/Http/CurlFetchWebdataTest.php index 5fa7279f05..4fafe63bc0 100644 --- a/tests/ElkArte/Http/CurlFetchWebdataTest.php +++ b/tests/ElkArte/Http/CurlFetchWebdataTest.php @@ -34,8 +34,8 @@ protected function setUp(): void //), array( 'https://duckduckgo.com/html', - array('q' => 'stargate+sg1 site:www.imdb.com', 'ia' => 'about'), - 200, + array('q' => 'stargate+sg1 site:www.imdb.com', 'b' => ''), + [200, 403], 'TV Series', ), ); @@ -105,9 +105,10 @@ public function testCurlPost() // Check for correct fetch if (!empty($testcase[2])) { - $this->assertEquals($testcase[2], $curl->result('code')); + $this->assertContains($curl->result('code'), $testcase[2]); } - if (!empty($testcase[3])) + + if (!empty($testcase[3]) && $curl->result('code') == 200) { $this->assertStringContainsString($testcase[3], $curl->result('body')); } diff --git a/tests/ElkArte/Http/FsockFetchWebdataTest.php b/tests/ElkArte/Http/FsockFetchWebdataTest.php index 2a38997dd8..70f17d5cdd 100644 --- a/tests/ElkArte/Http/FsockFetchWebdataTest.php +++ b/tests/ElkArte/Http/FsockFetchWebdataTest.php @@ -31,7 +31,7 @@ protected function setUp(): void array( 'https://www.elkarte.net/community/index.php?action=search;sa=results', array('search' => 'stuff', 'search_selection' => 'all', 'advanced' => 0), - 200, + [200, 403], 'let you access this section', ), ); @@ -120,10 +120,10 @@ public function testFsockPost() // Check for correct fetch if (!empty($testcase[2])) { - $this->assertEquals($testcase[2], $fsock->result('code'), 'PostCodeError:: ' . $testcase[0]); + $this->assertContains($fsock->result('code'), $testcase[2], 'PostCodeError:: ' . $testcase[0]); } - if (!empty($testcase[3])) + if (!empty($testcase[3]) && $fsock->result('code') == 200) { $this->assertStringContainsString($testcase[3], $fsock->result('body'), 'PostBodyError:: ' . $testcase[0]); } diff --git a/tests/ElkArte/Http/StreamFetchWebdataTest.php b/tests/ElkArte/Http/StreamFetchWebdataTest.php index e6bd1d3ece..796e738fba 100644 --- a/tests/ElkArte/Http/StreamFetchWebdataTest.php +++ b/tests/ElkArte/Http/StreamFetchWebdataTest.php @@ -25,13 +25,13 @@ protected function setUp(): void array( 'https://www.w3schools.com/action_page.php', array('firstname' => 'elkarte', 'lastname' => 'forum'), - 200, + [200, 403], 'firstname=elkarte&lastname=forum ', ), array( 'https://www.elkarte.net/community/index.php?action=search;sa=results', array('search' => 'stuff', 'search_selection' => 'all', 'advanced' => 0), - 200, + [200, 403], 'let you access this section', ), ); @@ -113,10 +113,10 @@ public function testStreamPost() // Check for correct fetch if (!empty($testcase[2])) { - $this->assertEquals($testcase[2], $fsock->result('code'), 'PostCodeError:: ' . $testcase[0]); + $this->assertContains($fsock->result('code'), $testcase[2], 'PostCodeError:: ' . $testcase[0]); } - if (!empty($testcase[3])) + if (!empty($testcase[3]) && $fsock->result('code') == 200) { $this->assertStringContainsString($testcase[3], $fsock->result('body'), 'PostBodyError:: ' . $testcase[0]); } diff --git a/themes/default/Display.template.php b/themes/default/Display.template.php index 77ac07e26e..e3c9528d64 100644 --- a/themes/default/Display.template.php +++ b/themes/default/Display.template.php @@ -43,12 +43,19 @@ function template_messages_informations_above() { global $context, $settings, $txt, $scripturl, $modSettings; - // Show the topic information - icon, subject, etc. + // Show the topic information - icon, subject, stats, etc. echo '
- ', $context['subject'], ' (', $context['num_views_text'], ') + ', $context['subject'], ' + + ', $context['topic_starter_name'], ' + · + ', $context['topic_start_time'], ' + · + ', $context['num_views_text'], ' + ', empty($context['links']['go_prev']) ? '' : '' . $txt['previous_next_back'] . '', empty($context['links']['go_next']) ? '' : ' - ' . $txt['previous_next_forward'] . '', diff --git a/themes/default/css/_gold/index_gold.css b/themes/default/css/_gold/index_gold.css index e888a32942..ff50a6f126 100644 --- a/themes/default/css/_gold/index_gold.css +++ b/themes/default/css/_gold/index_gold.css @@ -2027,7 +2027,7 @@ ul.cf_icons { border-top-color: var(--infobox_border); border-bottom-color: var(--infobox_border); background-color: var(--infobox); - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 77 77'%3E%3Cpath fill-rule='evenodd' d='M38.4 0c21.208 0 38.4 17.192 38.4 38.4S59.608 76.8 38.4 76.8 0 59.608 0 38.4 17.192 0 38.4 0Zm8.952 28.286c-1.141-1.183-2.713-1.598-4.37-1.578-2.208.026-4.567.826-6.254 1.612-4.038 1.881-7.136 5.212-9.717 8.773-.464.64-.707 1.398.11 1.988.698.503 1.2.053 1.62-.396l.028-.03.095-.102a59.44 59.44 0 0 0 1.384-1.57l.114-.132.114-.133c1.369-1.587 2.762-3.152 4.605-4.213 1.096-.632 1.886.343 1.717 1.438-.102.657-.447 1.275-.688 1.91-.858 2.254-1.728 4.504-2.595 6.755a681.974 681.974 0 0 0-2.817 7.416l-.08.215-.08.215c-.812 2.186-1.612 4.355-2.142 6.636-.423 1.824-.992 4.037-.174 5.828.471 1.032 1.47 1.741 2.583 1.903 1.516.22 3.156.245 4.64-.092a17.387 17.387 0 0 0 2.263-.68c2.265-.853 4.329-2.167 6.187-3.71 1.89-1.576 3.557-3.44 5.076-5.373.488-.62 1.08-1.308 1.247-2.103.156-.747-.51-1.812-1.373-1.38-.456.23-.798.795-1.13 1.172a66.91 66.91 0 0 1-1.271 1.396c-.86.92-1.74 1.819-2.625 2.714a7.15 7.15 0 0 1-1.907 1.35c-.864.424-1.551-.046-1.458-1.003.086-.878.3-1.765.602-2.597 1.212-3.347 2.448-6.685 3.673-10.027a927.144 927.144 0 0 0 2.28-6.273c.702-1.957 1.3-3.898 1.554-5.972.174-1.428-.196-2.906-1.211-3.957zm2.549-16.06c-3.654-1.422-8.01 1.004-8.743 4.87-.53 2.792.533 5.25 2.72 6.286 4.23 2.007 9.291-1.198 9.291-5.883 0-2.6-1.144-4.447-3.268-5.273z' style='stroke-width:.04;stroke:none;stroke-opacity:1;fill:%230000bc;fill-opacity:1'/%3E%3C/svg%3E"); + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 77 77'%3E%3Cpath fill-rule='evenodd' d='M38.4 0c21.208 0 38.4 17.192 38.4 38.4S59.608 76.8 38.4 76.8 0 59.608 0 38.4 17.192 0 38.4 0Zm8.952 28.286c-1.141-1.183-2.713-1.598-4.37-1.578-2.208.026-4.567.826-6.254 1.612-4.038 1.881-7.136 5.212-9.717 8.773-.464.64-.707 1.398.11 1.988.698.503 1.2.053 1.62-.396l.028-.03.095-.102a59.44 59.44 0 0 0 1.384-1.57l.114-.132.114-.133c1.369-1.587 2.762-3.152 4.605-4.213 1.096-.632 1.886.343 1.717 1.438-.102.657-.447 1.275-.688 1.91-.858 2.254-1.728 4.504-2.595 6.755a681.974 681.974 0 0 0-2.817 7.416l-.08.215-.08.215c-.812 2.186-1.612 4.355-2.142 6.636-.423 1.824-.992 4.037-.174 5.828.471 1.032 1.47 1.741 2.583 1.903 1.516.22 3.156.245 4.64-.092a17.387 17.387 0 0 0 2.263-.68c2.265-.853 4.329-2.167 6.187-3.71 1.89-1.576 3.557-3.44 5.076-5.373.488-.62 1.08-1.308 1.247-2.103.156-.747-.51-1.812-1.373-1.38-.456.23-.798.795-1.13 1.172a66.91 66.91 0 0 1-1.271 1.396c-.86.92-1.74 1.819-2.625 2.714a7.15 7.15 0 0 1-1.907 1.35c-.864.424-1.551-.046-1.458-1.003.086-.878.3-1.765.602-2.597 1.212-3.347 2.448-6.685 3.673-10.027a927.144 927.144 0 0 0 2.28-6.273c.702-1.957 1.3-3.898 1.554-5.972.174-1.428-.196-2.906-1.211-3.957zm2.549-16.06c-3.654-1.422-8.01 1.004-8.743 4.87-.53 2.792.533 5.25 2.72 6.286 4.23 2.007 9.291-1.198 9.291-5.883 0-2.6-1.144-4.447-3.268-5.273z' style='stroke-width:.04;stroke:none;stroke-opacity:1;fill:%230000bc;fill-opacity:.55'/%3E%3C/svg%3E"); } .errorbox { diff --git a/themes/default/css/_light/index_light.css b/themes/default/css/_light/index_light.css index 14715da89a..4bf1046a94 100644 --- a/themes/default/css/_light/index_light.css +++ b/themes/default/css/_light/index_light.css @@ -1900,7 +1900,7 @@ ul.cf_icons { border-top-color: var(--infobox_border); border-bottom-color: var(--infobox_border); background-color: var(--infobox); - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 77 77'%3E%3Cpath fill-rule='evenodd' d='M38.4 0c21.208 0 38.4 17.192 38.4 38.4S59.608 76.8 38.4 76.8 0 59.608 0 38.4 17.192 0 38.4 0Zm8.952 28.286c-1.141-1.183-2.713-1.598-4.37-1.578-2.208.026-4.567.826-6.254 1.612-4.038 1.881-7.136 5.212-9.717 8.773-.464.64-.707 1.398.11 1.988.698.503 1.2.053 1.62-.396l.028-.03.095-.102a59.44 59.44 0 0 0 1.384-1.57l.114-.132.114-.133c1.369-1.587 2.762-3.152 4.605-4.213 1.096-.632 1.886.343 1.717 1.438-.102.657-.447 1.275-.688 1.91-.858 2.254-1.728 4.504-2.595 6.755a681.974 681.974 0 0 0-2.817 7.416l-.08.215-.08.215c-.812 2.186-1.612 4.355-2.142 6.636-.423 1.824-.992 4.037-.174 5.828.471 1.032 1.47 1.741 2.583 1.903 1.516.22 3.156.245 4.64-.092a17.387 17.387 0 0 0 2.263-.68c2.265-.853 4.329-2.167 6.187-3.71 1.89-1.576 3.557-3.44 5.076-5.373.488-.62 1.08-1.308 1.247-2.103.156-.747-.51-1.812-1.373-1.38-.456.23-.798.795-1.13 1.172a66.91 66.91 0 0 1-1.271 1.396c-.86.92-1.74 1.819-2.625 2.714a7.15 7.15 0 0 1-1.907 1.35c-.864.424-1.551-.046-1.458-1.003.086-.878.3-1.765.602-2.597 1.212-3.347 2.448-6.685 3.673-10.027a927.144 927.144 0 0 0 2.28-6.273c.702-1.957 1.3-3.898 1.554-5.972.174-1.428-.196-2.906-1.211-3.957zm2.549-16.06c-3.654-1.422-8.01 1.004-8.743 4.87-.53 2.792.533 5.25 2.72 6.286 4.23 2.007 9.291-1.198 9.291-5.883 0-2.6-1.144-4.447-3.268-5.273z' style='stroke-width:.04;stroke:none;stroke-opacity:1;fill:%230000bc;fill-opacity:1'/%3E%3C/svg%3E"); + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 77 77'%3E%3Cpath fill-rule='evenodd' d='M38.4 0c21.208 0 38.4 17.192 38.4 38.4S59.608 76.8 38.4 76.8 0 59.608 0 38.4 17.192 0 38.4 0Zm8.952 28.286c-1.141-1.183-2.713-1.598-4.37-1.578-2.208.026-4.567.826-6.254 1.612-4.038 1.881-7.136 5.212-9.717 8.773-.464.64-.707 1.398.11 1.988.698.503 1.2.053 1.62-.396l.028-.03.095-.102a59.44 59.44 0 0 0 1.384-1.57l.114-.132.114-.133c1.369-1.587 2.762-3.152 4.605-4.213 1.096-.632 1.886.343 1.717 1.438-.102.657-.447 1.275-.688 1.91-.858 2.254-1.728 4.504-2.595 6.755a681.974 681.974 0 0 0-2.817 7.416l-.08.215-.08.215c-.812 2.186-1.612 4.355-2.142 6.636-.423 1.824-.992 4.037-.174 5.828.471 1.032 1.47 1.741 2.583 1.903 1.516.22 3.156.245 4.64-.092a17.387 17.387 0 0 0 2.263-.68c2.265-.853 4.329-2.167 6.187-3.71 1.89-1.576 3.557-3.44 5.076-5.373.488-.62 1.08-1.308 1.247-2.103.156-.747-.51-1.812-1.373-1.38-.456.23-.798.795-1.13 1.172a66.91 66.91 0 0 1-1.271 1.396c-.86.92-1.74 1.819-2.625 2.714a7.15 7.15 0 0 1-1.907 1.35c-.864.424-1.551-.046-1.458-1.003.086-.878.3-1.765.602-2.597 1.212-3.347 2.448-6.685 3.673-10.027a927.144 927.144 0 0 0 2.28-6.273c.702-1.957 1.3-3.898 1.554-5.972.174-1.428-.196-2.906-1.211-3.957zm2.549-16.06c-3.654-1.422-8.01 1.004-8.743 4.87-.53 2.792.533 5.25 2.72 6.286 4.23 2.007 9.291-1.198 9.291-5.883 0-2.6-1.144-4.447-3.268-5.273z' style='stroke-width:.04;stroke:none;stroke-opacity:1;fill:%230000bc;fill-opacity:.55'/%3E%3C/svg%3E"); } .errorbox { diff --git a/themes/default/css/admin.css b/themes/default/css/admin.css index 25a6c47839..fbf4c66e38 100644 --- a/themes/default/css/admin.css +++ b/themes/default/css/admin.css @@ -150,7 +150,9 @@ h3.category_header form { /* Styles for the admin home screen. */ #quick_search { + order: 2; margin-top: -.2rem; + margin-left: auto; } .admincenter .well, #modcenter .well { @@ -1229,8 +1231,8 @@ dl.themes_list dd { } #core_features .features { - width: 100%; float: none; + width: 100%; } #core_features .features_switch { diff --git a/themes/default/css/index.css b/themes/default/css/index.css index c946b21399..37136ec741 100644 --- a/themes/default/css/index.css +++ b/themes/default/css/index.css @@ -613,6 +613,7 @@ h2.hdicon { margin: 0 .6rem 0 0; content: ""; vertical-align: text-bottom; + line-height: 1.8rem; } /* Expand/Collapse image in the various headers */ @@ -2886,6 +2887,7 @@ aside.poster, #quickreplybox .poster { display: flex; align-items: center; flex-direction: column; + padding-top: .4rem; } /* li lines in poster, could use flex / flex row here */ @@ -3285,26 +3287,50 @@ aside.poster, #quickreplybox .poster { border-radius: .4rem .4rem 0 0; } +/* The area at the top of each topic page, icon, title, views, links */ #forumposts .category_header { - overflow: hidden; - text-overflow: ellipsis; - display: flex; - align-items: center; + display: grid; + grid-template-columns: 3rem auto 1fr; + grid-template-rows: 4rem auto; + grid-template-areas: + "hdicon subject subject" + ". stats navigation"; +} + +/* Topic icon and title */ +#forumposts .hdicon { + align-self: center; + grid-area: hdicon; + height: 2.2rem; } -/* Number of views and previous /next links in the category header */ +#forumposts .hdicon::before { + vertical-align: initial; +} + +#topic_subject { + align-self: center; + grid-area: subject; + font-size: var(--font22); +} + +/* Number of views and previous / next links in the category header */ .nextlinks { font-size: var(--font15); margin-left: auto; white-space: pre; + justify-self: end; + grid-area: navigation; } -.views_text { +.stats_text { font-size: var(--font13); - white-space: pre; + opacity: .85; + place-self: start center; + grid-area: stats; } -/* Used a spacer between posts */ +/* Used as a spacer between posts */ .forumposts { margin-top: .13em; border: 1px solid; @@ -6127,7 +6153,15 @@ div.labels { max-width: 45%; } - #forumposts .views_text { + #forumposts .category_header { + grid-template-columns: auto 1fr; + grid-template-rows: 4rem auto; + grid-template-areas: + "subject subject" + "stats navigation"; + } + + #forumposts .views_text, #forumposts .category_header .hdicon { display: none; } diff --git a/themes/default/scripts/script_elk.js b/themes/default/scripts/script_elk.js index f27e51268b..be1b5b1a55 100644 --- a/themes/default/scripts/script_elk.js +++ b/themes/default/scripts/script_elk.js @@ -919,14 +919,17 @@ const ElkNotifier = new window.ElkNotifications({}); }, showBar = function() { clearTimeout(time_out); - elem.style.opacity = '1'; - if (settings.hide_delay !== 0) - { - time_out = setTimeout(function() { - hide(); - }, settings.hide_delay); - } + elem.fadeIn(250, function() { + if (settings.hide_delay !== 0) + { + // This will clear the bar if hide has not been implicitly called + time_out = setTimeout(function() { + hide(); + }, settings.hide_delay); + } + }); + return this; }, isError = function() { @@ -940,7 +943,7 @@ const ElkNotifier = new window.ElkNotifications({}); hide = function() { // Short delay to avoid removing opacity while it is still be added window.setTimeout(function() { - elem.style.opacity = '0'; + elem.fadeOut(300); }, 300); clearTimeout(time_out); @@ -961,23 +964,7 @@ const ElkNotifier = new window.ElkNotifications({}); }; }); - // AMD / RequireJS - if (typeof define !== 'undefined' && define.amd) - { - define([], function() { - return ElkInfoBar; - }); - } - // CommonJS - else if (typeof module !== 'undefined' && module.exports) - { - module.exports = ElkInfoBar; - } - // included directly via