Skip to content

Commit

Permalink
Merge pull request #3786 from Spuds/RandomFixes
Browse files Browse the repository at this point in the history
Random fixes
  • Loading branch information
Spuds committed Apr 14, 2024
2 parents c0e368c + 20b6f6e commit 7fdcd48
Show file tree
Hide file tree
Showing 22 changed files with 278 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .github/setup-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set +x
# Passed params
DB=$1
PHP_VERSION=$2
CODECOV_TOKEN=$3

# Build a config string for PHPUnit
CONFIG="--verbose --configuration .github/phpunit-${DB}.xml"
Expand All @@ -18,5 +19,5 @@ vendor/bin/phpunit ${CONFIG}
# Agents will merge all coverage data...
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]
then
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml'
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}"
fi
7 changes: 6 additions & 1 deletion .github/setup-selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
set -e
set -x

# Passed params
DB=$1
PHP_VERSION=$2
CODECOV_TOKEN=$3

# Per actions in the tests.yaml file
#
# Current Versions for Ref
Expand Down Expand Up @@ -42,6 +47,6 @@ else
# Agents will merge all coverage data...
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]
then
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.clover'
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}"
fi
fi
9 changes: 6 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ jobs:
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-selenium.sh $DB $PHP_VERSION
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: .github/setup-selenium.sh $DB $PHP_VERSION $CODECOV_TOKEN
working-directory: ./elkarte
continue-on-error: true

Expand Down Expand Up @@ -244,7 +245,8 @@ jobs:
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-results.sh $DB $PHP_VERSION
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: .github/setup-results.sh $DB $PHP_VERSION $CODECOV_TOKEN
working-directory: ./elkarte
# END MySQL and MariaDB Job

Expand Down Expand Up @@ -323,6 +325,7 @@ jobs:
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-results.sh $DB $PHP_VERSION
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: .github/setup-results.sh $DB $PHP_VERSION $CODECOV_TOKEN
working-directory: ./elkarte
# END Postgres Job
8 changes: 5 additions & 3 deletions sources/ElkArte/AdminController/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ private function loadMenu()
'class' => 'i-envelope-blank i-admin',
'subsections' => array(
'browse' => array($txt['mailqueue_browse'], 'admin_forum'),
'test' => array($txt['mailqueue_test'], 'admin_forum'),
'settings' => array($txt['mailqueue_settings'], 'admin_forum'),
),
),
Expand Down Expand Up @@ -792,7 +793,7 @@ public function action_search_internal()
// Load a lot of language files.
$language_files = [
'Help', 'ManageMail', 'ManageSettings', 'ManageBoards', 'ManagePaid', 'ManagePermissions', 'Search',
'Login', 'ManageSmileys', 'Maillist', 'Mentions'
'Login', 'ManageSmileys', 'Maillist', 'Mentions', 'Addons'
];

// All the files we need to include to search for settings
Expand All @@ -818,6 +819,8 @@ public function action_search_internal()
['settings_search', 'area=languages;sa=settings', ManageLanguages::class],
['settings_search', 'area=mailqueue;sa=settings', ManageMail::class],
['settings_search', 'area=maillist;sa=emailsettings', ManageMaillist::class],
['filter_search', 'area=maillist;sa=emailsettings', ManageMaillist::class],
['parser_search', 'area=maillist;sa=emailsettings', ManageMaillist::class],
['settings_search', 'area=membergroups;sa=settings', ManageMembergroups::class],
['settings_search', 'area=news;sa=settings', ManageNews::class],
['settings_search', 'area=paidsubscribe;sa=settings', ManagePaid::class],
Expand Down Expand Up @@ -885,8 +888,7 @@ public function action_search_member()
* This file allows the user to search the wiki documentation for a little help.
*
* What it does:
*
* - Creates an exception since GitHub does not yet support API wiki searches so the connection
* - Creates an exception since GitHub does not yet support API wiki searches so the connection
* will fail.
*/
public function action_search_doc()
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/AdminController/CoreFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function settings()
global $modSettings;

require_once(SUBSDIR . '/Mentions.subs.php');
require_once(SUBSDIR . 'Notification.subs.php');
require_once(SUBSDIR . '/Notification.subs.php');

// Makes all the like/rlike mentions invisible (or visible)
toggleMentionsVisibility('likemsg', !empty($value));
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/AdminController/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use ElkArte\User;

/**
* Entry point class for all of the maintenance ,routine, members, database,
* Entry point class for all maintenance, routine, members, database,
* attachments, topics and hooks
*
* @package Maintenance
Expand Down
5 changes: 5 additions & 0 deletions sources/ElkArte/AdminController/ManageCalendarModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ private function _settings()
*/
public function settings_search()
{
if (isModuleEnabled('calendar'))
{
return $this->_settings();
}

return ['check', 'dummy_calendar'];
}
}
7 changes: 6 additions & 1 deletion sources/ElkArte/AdminController/ManageDraftsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ private function _settings()
*/
public function settings_search()
{
return $this->_settings();
if (isModuleEnabled('drafts'))
{
return $this->_settings();
}

return ['check', 'dummy_drafts'];
}
}
2 changes: 1 addition & 1 deletion sources/ElkArte/AdminController/ManageEmojiModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function integrate_save_smiley_settings()
/**
* Unzips a selected Emoji set if it has not already been extracted
*
* @param \ElkArte\Helper\HttpReq $req
* @param HttpReq $req
*/
private static function unZipEmoji($req)
{
Expand Down
17 changes: 17 additions & 0 deletions sources/ElkArte/AdminController/ManageFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ private function _likesSettings()
array('int', 'likeWaitCount', 6),
array('check', 'likeRestrictAdmins'),
array('check', 'likeAllowSelf'),
array('check', 'useLikesNotViews'),
'',
array('int', 'likeDisplayLimit', 6)
);
Expand Down Expand Up @@ -1796,6 +1797,14 @@ public function layoutSettings_search()
*/
public function karmaSettings_search()
{
global $modSettings;

// Karma - On or off?
if (empty($modSettings['karmaMode']))
{
return ['check', 'dummy_karma'];
}

return $this->_karmaSettings();
}

Expand All @@ -1804,6 +1813,14 @@ public function karmaSettings_search()
*/
public function likesSettings_search()
{
global $modSettings;

// Likes - On or off?
if (empty($modSettings['enable_likes']))
{
return ['check', 'dummy_likes'];
}

return $this->_likesSettings();
}

Expand Down
52 changes: 51 additions & 1 deletion sources/ElkArte/AdminController/ManageMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use ElkArte\Languages\Loader;
use ElkArte\Languages\Txt;
use ElkArte\SettingsForm\SettingsForm;
use ElkArte\User;

/**
* This class is the administration mailing controller.
Expand All @@ -30,6 +31,7 @@
*
* - It handles mail configuration,
* - It displays and allows to remove items from the mail queue.
* - It handles sending a test email
*
* @package Mail
*/
Expand All @@ -54,12 +56,13 @@ public function action_index()
'browse' => array($this, 'action_browse', 'permission' => 'admin_forum'),
'clear' => array($this, 'action_clear', 'permission' => 'admin_forum'),
'settings' => array($this, 'action_mailSettings_display', 'permission' => 'admin_forum'),
'test' => array($this, 'action_test_email', 'permission' => 'admin_forum'),
);

// Action control
$action = new Action('manage_mail');

// By default we want to browse, call integrate_sa_manage_mail
// By default, we want to browse, call integrate_sa_manage_mail
$subAction = $action->initialize($subActions, 'browse');

// Final bits
Expand All @@ -71,6 +74,11 @@ public function action_index()
'title' => 'mailqueue_title',
'class' => 'i-envelope',
'description' => 'mailqueue_desc',
'tabs' => [
'test' => [
'description' => $txt['mail_send_desc'],
],
]
]);

// Call the right function for this sub-action.
Expand Down Expand Up @@ -448,4 +456,46 @@ public function action_browse()

createList($listOptions);
}

/**
* Test email action
*/
public function action_test_email()
{
global $context, $txt;

require_once(SUBSDIR . '/Mail.subs.php');

theme()->getTemplates()->load('ManageMail');
$context['page_title'] = $txt['mail_test'];
$context['sub_template'] = 'mail_test';

if (isset($this->_req->post->send))
{
checkSession();
validateToken('admin-mailtest');

$sendTo = $this->_req->getPost('send_to', 'trim');
$subject = $this->_req->getPost('subject', 'Util::htmlspecialchars', '');
$message = $this->_req->getPost('message', 'Util::htmlspecialchars', '');

$sendTo = $sendTo ?: User::$info->email;
if (empty($subject) || empty($message))
{
$result = false;
}
else
{
// Let 'er rip!
$result = sendmail($sendTo, $subject, $message, null, null, true, 0);
}

redirectexit('action=admin;area=mailqueue;sa=test;result=' . ($result ? 'pass' : 'fail'));
}

createToken('admin-mailtest');

$result = $this->_req->getQuery('result', 'trim', '');
$context['result'] = $result;
}
}
37 changes: 37 additions & 0 deletions sources/ElkArte/AdminController/ManageMaillist.php
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,21 @@ private function _filtersSettings()
return $config_vars;
}

/**
* Return the form settings for use in admin search
*/
public function filter_search()
{
global $modSettings;

if (empty($modSettings['maillist_enabled']))
{
return ['check', 'filter_name'];
}

return $this->_filtersSettings();
}

/**
* Deletes a filter from the system / database
*/
Expand Down Expand Up @@ -1456,6 +1471,21 @@ private function _parsersSettings()
return $config_vars;
}

/**
* Return the form settings for use in admin search
*/
public function parser_search()
{
global $modSettings;

if (empty($modSettings['maillist_enabled']))
{
return ['check', 'filter_name'];
}

return $this->_parsersSettings();
}

/**
* Removes a parser from the system and database
*/
Expand Down Expand Up @@ -1714,6 +1744,13 @@ private function _settings()
*/
public function settings_search()
{
global $modSettings;

if (empty($modSettings['maillist_enabled']))
{
return ['check', 'maillist_enabled'];
}

return $this->_settings();
}

Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/AdminController/ManageMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ public function action_browse()
{
$context['allowed_actions'] = [
'reject' => $txt['admin_browse_w_approve_deletion'],
'ok' => $txt['admin_browse_w_reject'],
'ok' => $txt['admin_browse_w_reject_delete'],
];
}
else
Expand Down
7 changes: 7 additions & 0 deletions sources/ElkArte/AdminController/ManageSecurity.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,13 @@ private function _spamSettings()
*/
public function moderationSettings_search()
{
global $modSettings;

if (empty($modSettings['warning_enable']))
{
return ['check', 'dummy_enable'];
}

return $this->_moderationSettings();
}

Expand Down
1 change: 0 additions & 1 deletion sources/ElkArte/AdminController/ManageTopics.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ private function _settings()
// Hot topics (etc)...
array('int', 'hotTopicPosts', 'postinput' => $txt['manageposts_posts']),
array('int', 'hotTopicVeryPosts', 'postinput' => $txt['manageposts_posts']),
array('check', 'useLikesNotViews'),
'',
// All, next/prev...
array('int', 'enableAllMessages', 'postinput' => $txt['manageposts_posts'], 'subtext' => $txt['enableAllMessages_zero']),
Expand Down
5 changes: 5 additions & 0 deletions sources/ElkArte/AdminSettingsSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ private function _get_label($var)
return $txt['groups_' . $var[1]];
}

if (!is_array($var) && isset($txt[$var]))
{
return $txt[$var];
}

return $save ?? $var[1];
}

Expand Down
1 change: 1 addition & 0 deletions sources/ElkArte/Languages/Admin/English.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@

$txt['mailqueue_browse'] = 'Browse Queue';
$txt['mailqueue_settings'] = 'Settings';
$txt['mailqueue_test'] = 'Test Email';

$txt['admin_search'] = 'Quick Search';
$txt['admin_search_type_internal'] = 'Task/Setting';
Expand Down
Loading

0 comments on commit 7fdcd48

Please sign in to comment.