From a12b8f3062ee4143171932859ca7b5f47d22620d Mon Sep 17 00:00:00 2001
From: Michael {txt_quote_from}: {author} {txt_search_on} {date}',
'after' => '
',
diff --git a/Sources/Db/DatabaseApi.php b/Sources/Db/DatabaseApi.php
index e124f14fea..53fc3504b4 100644
--- a/Sources/Db/DatabaseApi.php
+++ b/Sources/Db/DatabaseApi.php
@@ -363,7 +363,7 @@ final public static function load(array $options = [])
// Double check that we found what we expected.
if (!(self::$db instanceof DatabaseApi)) {
- unset($self::$db);
+ unset(self::$db);
ErrorHandler::displayDbError();
}
diff --git a/Sources/Graphics/Image.php b/Sources/Graphics/Image.php
index 9dfd4fb1a5..ca042aaf4f 100644
--- a/Sources/Graphics/Image.php
+++ b/Sources/Graphics/Image.php
@@ -14,6 +14,7 @@
namespace SMF\Graphics;
use SMF\BackwardCompatibility;
+use SMF\Cache\CacheApi;
use SMF\Config;
use SMF\ErrorHandler;
use SMF\Url;
diff --git a/Sources/Msg.php b/Sources/Msg.php
index e2c3741e81..9f0a072324 100644
--- a/Sources/Msg.php
+++ b/Sources/Msg.php
@@ -726,7 +726,7 @@ function ($a) {
$non_breaking_space = Utils::$context['utf8'] ? '\\x{A0}' : '\\xA0';
// Now that we've fixed all the code tags, let's fix the img and url tags...
- fixTags($message);
+ self::fixTags($message);
// Replace /me.+?\n with [me=name]dsf[/me]\n.
if (strpos(User::$me->name, '[') !== false || strpos(User::$me->name, ']') !== false || strpos(User::$me->name, '\'') !== false || strpos(User::$me->name, '"') !== false) {
@@ -1033,7 +1033,7 @@ public static function fixTags(&$message): void
// Fix each type of tag.
foreach ($fixArray as $param) {
- fixTag($message, $param['tag'], $param['protocols'], $param['embeddedUrl'], $param['hasEqualSign'], !empty($param['hasExtra']));
+ self::fixTag($message, $param['tag'], $param['protocols'], $param['embeddedUrl'], $param['hasEqualSign'], !empty($param['hasExtra']));
}
// Now fix possible security problems with images loading links automatically...
diff --git a/Sources/PackageManager/PackageManager.php b/Sources/PackageManager/PackageManager.php
index b2fb665656..2c3307eb96 100644
--- a/Sources/PackageManager/PackageManager.php
+++ b/Sources/PackageManager/PackageManager.php
@@ -2046,7 +2046,7 @@ public function permissions()
// If we're submitting then let's move on to another function to keep things cleaner..
if (isset($_POST['action_changes'])) {
- return PackagePermissionsAction();
+ return $this->PackagePermissionsAction();
}
Utils::$context['look_for'] = [];
diff --git a/Sources/Subscriptions/PayPal/Payment.php b/Sources/Subscriptions/PayPal/Payment.php
index b46140038f..df766b5ad1 100644
--- a/Sources/Subscriptions/PayPal/Payment.php
+++ b/Sources/Subscriptions/PayPal/Payment.php
@@ -15,6 +15,7 @@
use SMF\Config;
use SMF\Lang;
+use SMF\Db\DatabaseApi as Db;
/**
* Class of functions to validate a IPN response and provide details of the payment
diff --git a/Sources/WebFetch/APIs/FtpFetcher.php b/Sources/WebFetch/APIs/FtpFetcher.php
index b5f2b0afe7..5ffa241c84 100644
--- a/Sources/WebFetch/APIs/FtpFetcher.php
+++ b/Sources/WebFetch/APIs/FtpFetcher.php
@@ -15,6 +15,7 @@
use SMF\Config;
use SMF\Lang;
+use SMF\PackageManager\FtpConnection;
use SMF\Url;
use SMF\WebFetch\WebFetchApi;
@@ -120,7 +121,7 @@ public function request(string $url, array|string $post_data = []): object
$this->port = !empty($url->port) ? $url->port : 21;
// Establish a connection and attempt to enable passive mode.
- $ftp = new SMF\PackageManager\FtpConnection($this->host, $this->port, $this->user, $this->email);
+ $ftp = new FtpConnection($this->host, $this->port, $this->user, $this->email);
$this->error_message = !empty($ftp->error) ? (string) ($ftp->last_message ?? $ftp->error) : '';
diff --git a/Sources/tasks/RemoveTempAttachments.php b/Sources/tasks/RemoveTempAttachments.php
index 536443fa7c..20ea48d771 100644
--- a/Sources/tasks/RemoveTempAttachments.php
+++ b/Sources/tasks/RemoveTempAttachments.php
@@ -14,6 +14,7 @@
namespace SMF\Tasks;
use SMF\Config;
+use SMF\ErrorHandler;
use SMF\Lang;
use SMF\Theme;
use SMF\Utils;
diff --git a/Sources/tasks/UpdateUnicode.php b/Sources/tasks/UpdateUnicode.php
index a775b92975..d851eec6fb 100644
--- a/Sources/tasks/UpdateUnicode.php
+++ b/Sources/tasks/UpdateUnicode.php
@@ -14,7 +14,7 @@
namespace SMF\Tasks;
use SMF\Config;
-use SMF\DatabaseApi as Db;
+use SMF\Db\DatabaseApi as Db;
use SMF\ErrorHandler;
use SMF\Lang;
use SMF\TaskRunner;
diff --git a/Themes/default/Admin.template.php b/Themes/default/Admin.template.php
index 86e1c0691d..f65a612ad2 100644
--- a/Themes/default/Admin.template.php
+++ b/Themes/default/Admin.template.php
@@ -10,6 +10,7 @@
* @version 3.0 Alpha 1
*/
+use SMF\Actions\Admin\Permissions;
use SMF\Config;
use SMF\Lang;
use SMF\Theme;
@@ -928,7 +929,7 @@ function ($v)
';
// Permission group?
elseif ($config_var['type'] == 'permissions')
- theme_inline_permissions($config_var['name']);
+ Permissions::theme_inline_permissions($config_var['name']);
// BBC selection?
elseif ($config_var['type'] == 'bbc')
From aa7ec56b8c7a29df9ce5360f44331e0fddc23455 Mon Sep 17 00:00:00 2001
From: Jon Stovell
' . Lang::$txt['hooks_field_included_file'] . ': ' . $data['included_file'];
}
-
return $instance . $data['real_function'];
},
'class' => 'word_break',
@@ -2060,7 +2059,6 @@ function ($accumulator, $functions) {
return '';
}
-
$change_status = ['before' => '', 'after' => ''];
// Can only enable/disable if it exists...
@@ -2070,7 +2068,6 @@ function ($accumulator, $functions) {
}
return $change_status['before'] . '' . $change_status['after'];
-
},
'class' => 'centertext',
],
diff --git a/Sources/Actions/Admin/Membergroups.php b/Sources/Actions/Admin/Membergroups.php
index 44e85a2c8a..c29f1446f0 100644
--- a/Sources/Actions/Admin/Membergroups.php
+++ b/Sources/Actions/Admin/Membergroups.php
@@ -543,7 +543,6 @@ public function add(): void
['id_group', 'id_board', 'deny'],
);
}
-
}
// If this is joinable then set it to show group membership in people's profiles.
diff --git a/Sources/Actions/Admin/Members.php b/Sources/Actions/Admin/Members.php
index d8c12cb3c6..384627d965 100644
--- a/Sources/Actions/Admin/Members.php
+++ b/Sources/Actions/Admin/Members.php
@@ -398,7 +398,6 @@ public function view()
$where_params[$param_name . '_low'] = $search_params[$param_name]['low'];
$where_params[$param_name . '_high'] = $search_params[$param_name]['high'];
}
-
} elseif ($param_info['type'] != 'groups') {
// Replace the wildcard characters ('*' and '?') into MySQL ones.
$parameter = strtolower(strtr(Utils::htmlspecialchars($search_params[$param_name], ENT_QUOTES), ['%' => '\\%', '_' => '\\_', '*' => '%', '?' => '_']));
@@ -1427,7 +1426,6 @@ public static function searchMembers(): void
self::$obj->execute();
}
-
/******************
* Internal methods
******************/
diff --git a/Sources/Actions/Admin/Registration.php b/Sources/Actions/Admin/Registration.php
index b40df514c3..74e1fe9e76 100644
--- a/Sources/Actions/Admin/Registration.php
+++ b/Sources/Actions/Admin/Registration.php
@@ -598,7 +598,6 @@ public static function modifyRegistrationSettings($return_config = false)
self::$obj->execute();
}
-
/******************
* Internal methods
******************/
diff --git a/Sources/Actions/Admin/RepairBoards.php b/Sources/Actions/Admin/RepairBoards.php
index da64390cd1..59c772db49 100644
--- a/Sources/Actions/Admin/RepairBoards.php
+++ b/Sources/Actions/Admin/RepairBoards.php
@@ -1393,7 +1393,6 @@ protected function fixMissingTopics($row): void
);
}
-
/**
* Callback to remove all topics that have zero messages in the messages table.
*/
diff --git a/Sources/Actions/Admin/Search.php b/Sources/Actions/Admin/Search.php
index 0940f284ac..cfd7b60e06 100644
--- a/Sources/Actions/Admin/Search.php
+++ b/Sources/Actions/Admin/Search.php
@@ -675,9 +675,7 @@ public function createmsgindex()
break;
}
-
Config::updateModSettings(['search_custom_index_resume' => Utils::jsonEncode(array_merge(Utils::$context['index_settings'], ['resume_at' => Utils::$context['start']]))]);
-
}
// Since there are still two steps to go, 80% is the maximum here.
diff --git a/Sources/Actions/Admin/Smileys.php b/Sources/Actions/Admin/Smileys.php
index 4c317513f9..91153f920a 100644
--- a/Sources/Actions/Admin/Smileys.php
+++ b/Sources/Actions/Admin/Smileys.php
@@ -2369,14 +2369,10 @@ protected function __construct()
// If customized smileys is disabled don't show the setting page
if (empty(Config::$modSettings['smiley_enable'])) {
unset(self::$subactions['addsmiley'], self::$subactions['editsmileys'], self::$subactions['setorder'], self::$subactions['modifysmiley']);
-
-
-
}
if (empty(Config::$modSettings['messageIcons_enable'])) {
unset(self::$subactions['editicon'], self::$subactions['editicons']);
-
}
// Load up all the tabs...
diff --git a/Sources/Actions/Admin/Subscriptions.php b/Sources/Actions/Admin/Subscriptions.php
index c5312552e8..a2bd465adb 100644
--- a/Sources/Actions/Admin/Subscriptions.php
+++ b/Sources/Actions/Admin/Subscriptions.php
@@ -976,7 +976,6 @@ public function modifyUser(): void
],
['id_sublog'],
);
-
}
}
// Updating.
diff --git a/Sources/Actions/Admin/Tasks.php b/Sources/Actions/Admin/Tasks.php
index 678e83aa12..82e463ffa2 100644
--- a/Sources/Actions/Admin/Tasks.php
+++ b/Sources/Actions/Admin/Tasks.php
@@ -728,7 +728,6 @@ public static function taskSettings($return_config = false)
self::$obj->execute();
}
-
/******************
* Internal methods
******************/
diff --git a/Sources/Actions/Admin/Themes.php b/Sources/Actions/Admin/Themes.php
index 369def94a1..7be7665291 100644
--- a/Sources/Actions/Admin/Themes.php
+++ b/Sources/Actions/Admin/Themes.php
@@ -1089,7 +1089,6 @@ public function edit()
return;
}
-
if (substr($_REQUEST['filename'], 0, 1) == '.') {
$_REQUEST['filename'] = '';
} else {
@@ -1106,7 +1105,6 @@ public function edit()
ErrorHandler::fatalLang('theme_edit_missing', false);
}
-
if (isset($_POST['save'])) {
if (User::$me->checkSession('post', '', false) == '' && SecurityToken::validate('admin-te-' . md5($_GET['th'] . '-' . $_REQUEST['filename']), 'post', false) == true) {
if (is_array($_POST['entire_file'])) {
@@ -1578,9 +1576,7 @@ protected function installFile()
return Utils::$context['to_install'];
}
-
ErrorHandler::fatalLang('theme_install_error_title', false);
-
}
/**
diff --git a/Sources/Actions/Admin/Warnings.php b/Sources/Actions/Admin/Warnings.php
index 14668bb73f..e11dbb646b 100644
--- a/Sources/Actions/Admin/Warnings.php
+++ b/Sources/Actions/Admin/Warnings.php
@@ -244,7 +244,6 @@ public static function modifyWarningSettings($return_config = false)
*/
protected function __construct()
{
-
}
}
diff --git a/Sources/Actions/Announce.php b/Sources/Actions/Announce.php
index a9372d86d8..36726457f9 100644
--- a/Sources/Actions/Announce.php
+++ b/Sources/Actions/Announce.php
@@ -277,7 +277,6 @@ public function send(): void
Mail::send($member_email, $mail['subject'], $body, null, null, false, 5);
}
-
}
Utils::$context['percentage_done'] = round(100 * Utils::$context['start'] / Config::$modSettings['latestMember'], 1);
diff --git a/Sources/Actions/AttachmentUpload.php b/Sources/Actions/AttachmentUpload.php
index 31756f21e9..4dad251024 100644
--- a/Sources/Actions/AttachmentUpload.php
+++ b/Sources/Actions/AttachmentUpload.php
@@ -490,7 +490,6 @@ protected function createAttach(): void
// You don't need to know.
unset($attachmentOptions['tmp_name'], $attachmentOptions['destination']);
-
// Regardless of errors, pass the results.
$this->_attachResults[] = $attachmentOptions;
}
diff --git a/Sources/Actions/Calendar.php b/Sources/Actions/Calendar.php
index 581775cbf3..defd18264c 100644
--- a/Sources/Actions/Calendar.php
+++ b/Sources/Actions/Calendar.php
@@ -1457,7 +1457,6 @@ public static function loadDatePair($container, $date_class = '', $time_class =
Theme::addInlineJavaScript('
$("' . $container . '").datepair({' . $datepair_options . "\n\t});", true);
-
}
/**
diff --git a/Sources/Actions/Display.php b/Sources/Actions/Display.php
index 6dfd109f67..a13630554f 100644
--- a/Sources/Actions/Display.php
+++ b/Sources/Actions/Display.php
@@ -904,7 +904,6 @@ protected function setPaginationAndLinks(): void
Utils::$context['page_index'] .= sprintf(strtr(Theme::$current->settings['page_index']['page'], ['{URL}' => Config::$scripturl . '?topic=' . Topic::$info->id . '.0;all']), '', Lang::$txt['all']);
}
}
-
}
/**
diff --git a/Sources/Actions/FindMember.php b/Sources/Actions/FindMember.php
index 538093237a..ad826a359b 100644
--- a/Sources/Actions/FindMember.php
+++ b/Sources/Actions/FindMember.php
@@ -158,7 +158,6 @@ public static function call(): void
protected function __construct()
{
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/Groups.php b/Sources/Actions/Groups.php
index 5f128f76b3..0e743f524a 100644
--- a/Sources/Actions/Groups.php
+++ b/Sources/Actions/Groups.php
@@ -850,9 +850,7 @@ public static function listMembergroupMembers_Href(&$members, $membergroup, $lim
return true;
}
-
return false;
-
}
/**
diff --git a/Sources/Actions/Like.php b/Sources/Actions/Like.php
index e8d38c4df0..589cf1d400 100644
--- a/Sources/Actions/Like.php
+++ b/Sources/Actions/Like.php
@@ -766,8 +766,8 @@ protected function respond(): void
return;
}
- // A like operation.
+ // A like operation.
// Not an AJAX request so send the user back to the previous
// location or the main page.
@@ -788,7 +788,6 @@ protected function respond(): void
Utils::$context['sub_template'] = $this->subaction;
Utils::$context['data'] = $this->data;
}
-
}
/**
diff --git a/Sources/Actions/Login2.php b/Sources/Actions/Login2.php
index 819eef535f..cb4e5582ef 100644
--- a/Sources/Actions/Login2.php
+++ b/Sources/Actions/Login2.php
@@ -463,7 +463,6 @@ public static function validatePasswordFlood($id_member, $member_name, $password
// Otherwise set the members data. If they correct on their first attempt then we actually clear it, otherwise we set it!
User::updateMemberData($id_member, ['passwd_flood' => $was_correct && $number_tries == 1 ? '' : $time_stamp . '|' . $number_tries]);
-
}
/******************
@@ -836,7 +835,6 @@ protected function DoLogin()
Utils::redirectexit('action=logout;' . Utils::$context['session_var'] . '=' . Utils::$context['session_id'], Utils::$context['server']['needs_login_fix']);
}
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/MessageIndex.php b/Sources/Actions/MessageIndex.php
index b221886bb6..943887bf00 100644
--- a/Sources/Actions/MessageIndex.php
+++ b/Sources/Actions/MessageIndex.php
@@ -1109,7 +1109,6 @@ protected function buildButtons(): void
// Note: Utils::$context['normal_buttons'] is added for backward compatibility with 2.0, but is deprecated and should not be used
IntegrationHook::call('integrate_messageindex_buttons', [&Utils::$context['normal_buttons']]);
}
-
}
// Export public static functions to global namespace for backward compatibility.
diff --git a/Sources/Actions/Moderation/Logs.php b/Sources/Actions/Moderation/Logs.php
index 349473335a..731e2bf76f 100644
--- a/Sources/Actions/Moderation/Logs.php
+++ b/Sources/Actions/Moderation/Logs.php
@@ -999,7 +999,6 @@ protected function createList(): void
*************************/
// code...
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/Moderation/Warnings.php b/Sources/Actions/Moderation/Warnings.php
index 57efe313dd..f20667d5ed 100644
--- a/Sources/Actions/Moderation/Warnings.php
+++ b/Sources/Actions/Moderation/Warnings.php
@@ -818,7 +818,6 @@ protected function __construct()
*************************/
// code...
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/NotifyBoard.php b/Sources/Actions/NotifyBoard.php
index b3cc5b3224..cb0a7c573f 100644
--- a/Sources/Actions/NotifyBoard.php
+++ b/Sources/Actions/NotifyBoard.php
@@ -156,7 +156,6 @@ protected function getSuccessMsg()
*************************/
// code...
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/NotifyTopic.php b/Sources/Actions/NotifyTopic.php
index 83f9ebf8a3..9bfb667407 100644
--- a/Sources/Actions/NotifyTopic.php
+++ b/Sources/Actions/NotifyTopic.php
@@ -188,7 +188,6 @@ protected function getSuccessMsg()
{
return sprintf(Lang::$txt['notify_topic' . (!empty($this->alert_pref & parent::PREF_EMAIL) ? '_subscribed' : '_unsubscribed')], $this->member_info['email']);
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/Post.php b/Sources/Actions/Post.php
index 85ac21b295..da68715419 100644
--- a/Sources/Actions/Post.php
+++ b/Sources/Actions/Post.php
@@ -1512,7 +1512,6 @@ protected function showAttachments(): void
} elseif ($type == 'attachmentPostLimit' && Utils::$context['attachments']['total_size'] > 0) {
Utils::$context['attachment_restrictions'][$type] .= ' (' . sprintf(Lang::$txt['attach_available'], round(max(Config::$modSettings['attachmentPostLimit'] - (Utils::$context['attachments']['total_size'] / 1024), 0), 2)) . ')';
}
-
}
}
}
diff --git a/Sources/Actions/Post2.php b/Sources/Actions/Post2.php
index e21b71a378..329433895a 100644
--- a/Sources/Actions/Post2.php
+++ b/Sources/Actions/Post2.php
@@ -285,7 +285,6 @@ public function submit(): void
if (Utils::htmlTrim(strip_tags(BBCodeParser::load()->parse($_POST['message'], false), implode('', Utils::$context['allowed_html_tags']))) === '' && (!User::$me->allowedTo('bbc_html') || strpos($_POST['message'], '[html]') === false)) {
$this->errors[] = 'no_message';
}
-
}
if (isset($_POST['calendar']) && !isset($_REQUEST['deleteevent']) && Utils::htmlTrim($_POST['evtitle']) === '') {
@@ -1050,7 +1049,6 @@ protected function prepareEdit(): void
$searchAPI->postRemoved($_REQUEST['msg']);
}
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/Profile/Delete.php b/Sources/Actions/Profile/Delete.php
index 786e2b1b0f..9bb256b64a 100644
--- a/Sources/Actions/Profile/Delete.php
+++ b/Sources/Actions/Profile/Delete.php
@@ -96,7 +96,6 @@ public function show(): void
Utils::$context['page_title'] = Lang::$txt['deleteAccount'] . ': ' . Profile::$member->name;
}
-
/**
* Actually deletes the account.
*/
diff --git a/Sources/Actions/Profile/Main.php b/Sources/Actions/Profile/Main.php
index cd0568a03b..144677749a 100644
--- a/Sources/Actions/Profile/Main.php
+++ b/Sources/Actions/Profile/Main.php
@@ -826,7 +826,6 @@ function (&$value, $key) {
$this->profile_areas['info']['areas']['viewwarning']['enabled'] = Config::$modSettings['warning_settings'][0] == 1 && Profile::$member->warning;
-
$this->profile_areas['edit_profile']['areas']['account']['enabled'] = User::$me->is_admin || (Profile::$member->group_id != 1 && !in_array(1, Profile::$member->additional_groups));
$this->profile_areas['edit_profile']['areas']['tfasetup']['enabled'] = !empty(Config::$modSettings['tfa_mode']);
@@ -839,7 +838,6 @@ function (&$value, $key) {
$this->profile_areas['edit_profile']['areas']['groupmembership']['enabled'] = !empty(Config::$modSettings['show_group_membership']) && User::$me->is_owner;
-
$this->profile_areas['profile_action']['areas']['sendpm']['enabled'] = User::$me->allowedTo('profile_view');
$this->profile_areas['profile_action']['areas']['report']['enabled'] = User::$me->allowedTo('profile_view');
diff --git a/Sources/Actions/Profile/PaidSubs.php b/Sources/Actions/Profile/PaidSubs.php
index d34113ed06..ee8cd29073 100644
--- a/Sources/Actions/Profile/PaidSubs.php
+++ b/Sources/Actions/Profile/PaidSubs.php
@@ -339,9 +339,7 @@ public function execute(): void
return;
}
-
Utils::$context['sub_template'] = 'user_subscription';
-
}
/***********************
diff --git a/Sources/Actions/Profile/Popup.php b/Sources/Actions/Profile/Popup.php
index 3a8eea7f06..94383bd792 100644
--- a/Sources/Actions/Profile/Popup.php
+++ b/Sources/Actions/Profile/Popup.php
@@ -109,7 +109,6 @@ class Popup implements ActionInterface
],
];
-
/****************************
* Internal static properties
****************************/
diff --git a/Sources/Actions/Recent.php b/Sources/Actions/Recent.php
index 5ad130ec87..b4559a708a 100644
--- a/Sources/Actions/Recent.php
+++ b/Sources/Actions/Recent.php
@@ -111,7 +111,6 @@ class Recent implements ActionInterface
'any' => [],
];
-
/****************************
* Internal static properties
****************************/
diff --git a/Sources/Actions/Register2.php b/Sources/Actions/Register2.php
index e0e877cc88..624bca2ca7 100644
--- a/Sources/Actions/Register2.php
+++ b/Sources/Actions/Register2.php
@@ -923,7 +923,6 @@ public static function registerMember(&$reg_options, $return_errors = false)
*/
protected function __construct()
{
-
}
}
diff --git a/Sources/Actions/SendActivation.php b/Sources/Actions/SendActivation.php
index 4d44753f37..668d5a3a7b 100644
--- a/Sources/Actions/SendActivation.php
+++ b/Sources/Actions/SendActivation.php
@@ -108,7 +108,6 @@ public static function call(): void
*/
protected function __construct()
{
-
}
}
diff --git a/Sources/Actions/TopicMove.php b/Sources/Actions/TopicMove.php
index dd3a6887a5..e973d20e7f 100644
--- a/Sources/Actions/TopicMove.php
+++ b/Sources/Actions/TopicMove.php
@@ -161,7 +161,6 @@ public function execute(): void
// Register this form and get a sequence number in Utils::$context.
Security::checkSubmitOnce('register');
-
}
/***********************
diff --git a/Sources/Actions/TopicMove2.php b/Sources/Actions/TopicMove2.php
index 9ab430f937..625a093307 100644
--- a/Sources/Actions/TopicMove2.php
+++ b/Sources/Actions/TopicMove2.php
@@ -368,7 +368,6 @@ public static function moveTopicConcurrence()
return true;
}
-
$request = Db::$db->query(
'',
'SELECT m.subject, b.name
@@ -389,7 +388,6 @@ public static function moveTopicConcurrence()
$topic_link = '' . $topic_subject . '';
ErrorHandler::fatalLang('topic_already_moved', false, [$topic_link, $board_link]);
-
}
/******************
diff --git a/Sources/Actions/TopicRemove.php b/Sources/Actions/TopicRemove.php
index 899407c664..baf4ec45cb 100644
--- a/Sources/Actions/TopicRemove.php
+++ b/Sources/Actions/TopicRemove.php
@@ -279,7 +279,6 @@ protected function __construct()
/*************************
* Internal static methods
*************************/
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/TopicRestore.php b/Sources/Actions/TopicRestore.php
index 2c4d15d97d..c4941a394c 100644
--- a/Sources/Actions/TopicRestore.php
+++ b/Sources/Actions/TopicRestore.php
@@ -594,7 +594,6 @@ protected static function mergePosts($msgs, $from_topic, $target_topic)
Msg::updateLastMessages([$from_board, $target_board]);
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Actions/UnreadReplies.php b/Sources/Actions/UnreadReplies.php
index 2114f4919b..17bca06ece 100644
--- a/Sources/Actions/UnreadReplies.php
+++ b/Sources/Actions/UnreadReplies.php
@@ -395,7 +395,6 @@ protected function getTopicRequestWithoutTempTable()
],
);
}
-
}
?>
\ No newline at end of file
diff --git a/Sources/Actions/VerificationCode.php b/Sources/Actions/VerificationCode.php
index 940710beeb..206f901165 100644
--- a/Sources/Actions/VerificationCode.php
+++ b/Sources/Actions/VerificationCode.php
@@ -167,7 +167,6 @@ protected function __construct()
$this->verification_id = $_GET['vid'] ?? '';
$this->code = $this->verification_id && isset($_SESSION[$this->verification_id . '_vv']) ? $_SESSION[$this->verification_id . '_vv']['code'] : ($_SESSION['visual_verification_code'] ?? '');
-
}
/**
diff --git a/Sources/Actions/Who.php b/Sources/Actions/Who.php
index 738b229fb0..8d604b3cb7 100644
--- a/Sources/Actions/Who.php
+++ b/Sources/Actions/Who.php
@@ -674,9 +674,7 @@ public static function determineActions($urls, $preferred_prefix = false)
return $data[0] ?? false;
}
-
return $data;
-
}
/******************
diff --git a/Sources/Attachment.php b/Sources/Attachment.php
index 9936a89e9d..3fe877c45c 100644
--- a/Sources/Attachment.php
+++ b/Sources/Attachment.php
@@ -929,9 +929,7 @@ public static function automanageBySpace()
return true;
}
-
return false;
-
}
/**
@@ -1978,10 +1976,8 @@ public static function parseAttachBBC($attachID = 0)
return 'attachments_no_data_loaded';
}
-
$attachContext = $attachLoaded[$attachID];
-
// It's theoretically possible that prepareByMsg() changed the board id, so check again.
if ($check_board_perms && !in_array($attachContext['board'], $view_attachment_boards)) {
return 'attachments_not_allowed_to_see';
@@ -2531,7 +2527,6 @@ protected static function queryData(array $selects, array $params = [], string $
}
Db::$db->free_result($request);
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/BBCodeParser.php b/Sources/BBCodeParser.php
index 89b201b6e5..8e419d73e2 100644
--- a/Sources/BBCodeParser.php
+++ b/Sources/BBCodeParser.php
@@ -2919,9 +2919,7 @@ function ($matches) {
return '[email=' . $url->path . ']' . $url . '[/email]';
}
-
return $url;
-
}
// Are we linking a schemeless URL or naked domain name (e.g. "example.com")?
@@ -3562,9 +3560,7 @@ function ($matches) {
return Lang::$txt[substr($matches[1], 4)];
}
-
return $matches[0];
-
},
$string,
);
diff --git a/Sources/Board.php b/Sources/Board.php
index b272cc171b..523aa1e14e 100644
--- a/Sources/Board.php
+++ b/Sources/Board.php
@@ -2278,7 +2278,6 @@ function ($field) {
LIMIT ' . $limit : ''),
$params,
);
-
}
while ($row = Db::$db->fetch_assoc($request)) {
diff --git a/Sources/Cache/APIs/Apcu.php b/Sources/Cache/APIs/Apcu.php
index 99e6b76bc0..74642146fd 100644
--- a/Sources/Cache/APIs/Apcu.php
+++ b/Sources/Cache/APIs/Apcu.php
@@ -73,7 +73,6 @@ public function putData($key, $value, $ttl = null)
return apcu_delete($key . 'smf');
}
-
return apcu_store($key . 'smf', $value, $ttl !== null ? $ttl : $this->ttl);
}
diff --git a/Sources/Cache/APIs/FileBased.php b/Sources/Cache/APIs/FileBased.php
index c18533faad..e5c06f23e9 100644
--- a/Sources/Cache/APIs/FileBased.php
+++ b/Sources/Cache/APIs/FileBased.php
@@ -141,8 +141,6 @@ public function getData($key, $ttl = null)
@unlink($file);
}
-
-
}
/**
diff --git a/Sources/Cache/APIs/MemcacheImplementation.php b/Sources/Cache/APIs/MemcacheImplementation.php
index bdaf51b776..d50efce3cb 100644
--- a/Sources/Cache/APIs/MemcacheImplementation.php
+++ b/Sources/Cache/APIs/MemcacheImplementation.php
@@ -59,12 +59,9 @@ function ($server) {
return [$server, 0];
}
-
-
$server = explode(':', $server);
return [$server[0], isset($server[1]) ? (int) $server[1] : 11211];
-
},
array_map('trim', explode(',', Config::$cache_memcached)),
);
diff --git a/Sources/Cache/APIs/MemcachedImplementation.php b/Sources/Cache/APIs/MemcachedImplementation.php
index 14d32cf754..23552147ee 100644
--- a/Sources/Cache/APIs/MemcachedImplementation.php
+++ b/Sources/Cache/APIs/MemcachedImplementation.php
@@ -59,12 +59,9 @@ function ($server) {
return [$server, 0];
}
-
-
$server = explode(':', $server);
return [$server[0], isset($server[1]) ? (int) $server[1] : 11211];
-
},
explode(',', Config::$cache_memcached),
);
diff --git a/Sources/Cache/CacheApi.php b/Sources/Cache/CacheApi.php
index 707abd0148..efee95372f 100644
--- a/Sources/Cache/CacheApi.php
+++ b/Sources/Cache/CacheApi.php
@@ -326,7 +326,6 @@ public function getImplementationClassKeyName()
return substr($class_name, $position + 1);
}
-
return get_class($this);
}
diff --git a/Sources/Cache/CacheApiInterface.php b/Sources/Cache/CacheApiInterface.php
index 48bc4f9cf9..99d89d6a29 100644
--- a/Sources/Cache/CacheApiInterface.php
+++ b/Sources/Cache/CacheApiInterface.php
@@ -17,7 +17,6 @@
die('No direct access...');
}
-
interface CacheApiInterface
{
/**
diff --git a/Sources/Config.php b/Sources/Config.php
index b6d7d471e6..50c7fea52f 100644
--- a/Sources/Config.php
+++ b/Sources/Config.php
@@ -1796,9 +1796,7 @@ function ($a, $b) {
return 1;
}
-
return strcasecmp($b, $a);
-
},
);
@@ -2967,7 +2965,6 @@ public static function checkCron()
}
}
}
-
}
?>
\ No newline at end of file
diff --git a/Sources/Cookie.php b/Sources/Cookie.php
index 5453a60ebe..23fca97c50 100644
--- a/Sources/Cookie.php
+++ b/Sources/Cookie.php
@@ -316,9 +316,8 @@ public static function getCookie(string $name): ?object
return new self($name, [$member, $hash], $expires, $domain, $path);
}
- // Other cookies.
-
+ // Other cookies.
$data = Utils::jsonDecode($_COOKIE[$name], true, false);
if (json_last_error() !== JSON_ERROR_NONE) {
@@ -326,7 +325,6 @@ public static function getCookie(string $name): ?object
}
return new self($name, $data);
-
}
/**
diff --git a/Sources/Db/APIs/MySQL.php b/Sources/Db/APIs/MySQL.php
index 49cd8706e8..ad97579a38 100644
--- a/Sources/Db/APIs/MySQL.php
+++ b/Sources/Db/APIs/MySQL.php
@@ -1162,10 +1162,7 @@ public function allow_persistent()
{
$value = ini_get('mysqli.allow_persistent');
- return (bool) (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1')
-
-
- ;
+ return (bool) (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1');
}
/*****************************************
@@ -1223,7 +1220,6 @@ public function create_word_search($size)
*/
public function search_language()
{
-
}
/*******************************************
@@ -2281,7 +2277,6 @@ protected function replacement__callback($matches)
return implode(', ', $replacement);
}
-
$this->error_backtrace('Wrong value type sent to the database. Array of IPv4 or IPv6 expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__);
break;
diff --git a/Sources/Db/APIs/PostgreSQL.php b/Sources/Db/APIs/PostgreSQL.php
index de15e2e54e..20e6126513 100644
--- a/Sources/Db/APIs/PostgreSQL.php
+++ b/Sources/Db/APIs/PostgreSQL.php
@@ -1095,10 +1095,7 @@ public function allow_persistent()
{
$value = ini_get('pgsql.allow_persistent');
- return (bool) (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1')
-
-
- ;
+ return (bool) (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1');
}
/*****************************************
@@ -1295,7 +1292,6 @@ public function add_column($table_name, $column_info, $parameters = [], $if_exis
],
);
-
// If there's more attributes they need to be done via a change on PostgreSQL.
unset($column_info['type'], $column_info['size']);
@@ -1802,7 +1798,6 @@ public function create_table($table_name, $columns, $indexes = [], $parameters =
);
}
-
// And the indexes...
foreach ($index_queries as $query) {
$this->query(
diff --git a/Sources/DynamicPropertyHelper.php b/Sources/DynamicPropertyHelper.php
index caf0598303..0246202d20 100644
--- a/Sources/DynamicPropertyHelper.php
+++ b/Sources/DynamicPropertyHelper.php
@@ -234,9 +234,7 @@ protected function customPropertyGet(mixed $prop): mixed
return $this->{$prop} ?? null;
}
-
return $this->custom[$prop] ?? null;
-
}
/**
@@ -261,23 +259,17 @@ protected function customPropertyIsset(mixed $prop): bool
return isset($this->{$real_prop[0]}->{$real_prop[1]});
}
-
return isset($this->{$real_prop[0]}[$real_prop[1]]);
-
}
-
return isset($this->{$real_prop});
-
}
if (property_exists($this, $prop)) {
return isset($this->{$prop});
}
-
return isset($this->custom[$prop]);
-
}
/**
diff --git a/Sources/Event.php b/Sources/Event.php
index 0624046407..2ff5c16209 100644
--- a/Sources/Event.php
+++ b/Sources/Event.php
@@ -629,7 +629,6 @@ public function __get(string $prop): mixed
return $not ? !$value : $value;
}
-
if (in_array($prop, ['year', 'month', 'day', 'hour', 'minute', 'second'])) {
$prop = 'start_' . $prop;
}
@@ -767,7 +766,6 @@ public function __get(string $prop): mixed
}
return $value;
-
}
/**
@@ -790,12 +788,9 @@ public function __isset(string $prop): bool
return isset($this->{$real_prop[0]}[$real_prop[1]]);
}
-
return isset($this->{$real_prop});
-
}
-
if (in_array($prop, ['year', 'month', 'day', 'hour', 'minute', 'second'])) {
$prop = 'start_' . $prop;
}
@@ -856,7 +851,6 @@ public function __isset(string $prop): bool
default:
return isset($this->custom[$prop]);
}
-
}
/***********************
diff --git a/Sources/Forum.php b/Sources/Forum.php
index 63944d3305..6cff8f27d8 100644
--- a/Sources/Forum.php
+++ b/Sources/Forum.php
@@ -359,11 +359,9 @@ protected function main()
if (isset($_REQUEST['action']) && (in_array($_REQUEST['action'], ['login2', 'logintfa', 'logout']))) {
return self::$actions[$_REQUEST['action']][1];
}
- // Don't even try it, sonny.
-
+ // Don't even try it, sonny.
return __CLASS__ . '::inMaintenance';
-
}
// If guest access is off, a guest can only do one of the very few following actions.
diff --git a/Sources/Graphics/Gif/FileHeader.php b/Sources/Graphics/Gif/FileHeader.php
index 46e9cfa6f9..28d971423b 100644
--- a/Sources/Graphics/Gif/FileHeader.php
+++ b/Sources/Graphics/Gif/FileHeader.php
@@ -37,7 +37,6 @@ class FileHeader
public function __construct()
{
unset($this->m_lpVer, $this->m_nWidth, $this->m_nHeight, $this->m_bGlobalClr, $this->m_nColorRes, $this->m_bSorted, $this->m_nTableSize, $this->m_nBgColor, $this->m_nPixelRatio, $this->m_colorTable);
-
}
public function load($lpData, &$hdrLen)
diff --git a/Sources/Graphics/Gif/ImageHeader.php b/Sources/Graphics/Gif/ImageHeader.php
index f370c5b14b..6cfdd9c650 100644
--- a/Sources/Graphics/Gif/ImageHeader.php
+++ b/Sources/Graphics/Gif/ImageHeader.php
@@ -36,7 +36,6 @@ class ImageHeader
public function __construct()
{
unset($this->m_nLeft, $this->m_nTop, $this->m_nWidth, $this->m_nHeight, $this->m_bLocalClr, $this->m_bInterlace, $this->m_bSorted, $this->m_nTableSize, $this->m_colorTable);
-
}
public function load($lpData, &$hdrLen)
diff --git a/Sources/Graphics/Image.php b/Sources/Graphics/Image.php
index ca042aaf4f..3df8318382 100644
--- a/Sources/Graphics/Image.php
+++ b/Sources/Graphics/Image.php
@@ -538,10 +538,7 @@ function ($constant_name) {
return false;
}
- return !($constant_name === 'IMAGETYPE_UNKNOWN' || $constant_name === 'IMAGETYPE_COUNT')
-
-
- ;
+ return !($constant_name === 'IMAGETYPE_UNKNOWN' || $constant_name === 'IMAGETYPE_COUNT');
},
ARRAY_FILTER_USE_KEY,
);
@@ -1220,9 +1217,7 @@ protected function resizeUsingGD(string $destination, int $max_width, int $max_h
return imagejpeg($dst_img, $destination, !empty(Config::$modSettings['avatar_jpeg_quality']) ? Config::$modSettings['avatar_jpeg_quality'] : 82);
}
-
return $imagesave($dst_img, $destination);
-
}
/**
diff --git a/Sources/Lang.php b/Sources/Lang.php
index c8a24bfa0b..ead5f8331d 100644
--- a/Sources/Lang.php
+++ b/Sources/Lang.php
@@ -618,7 +618,6 @@ public static function numberFormat(int|float $number, ?int $decimals = null): s
self::$thousands_separator,
);
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Mail.php b/Sources/Mail.php
index 1b706b1729..f9ad4fde0d 100644
--- a/Sources/Mail.php
+++ b/Sources/Mail.php
@@ -555,7 +555,6 @@ public static function reduceQueue($number = false, $override_limit = false, $fo
}
}
-
// Any emails that didn't send?
if (!empty($failed_emails)) {
// Update the failed attempts check.
@@ -729,7 +728,6 @@ function ($m) {
return [$charset, $string, 'base64'];
}
-
return [$charset, $string, '7bit'];
}
diff --git a/Sources/Menu.php b/Sources/Menu.php
index 517f551fde..814e36b8d5 100644
--- a/Sources/Menu.php
+++ b/Sources/Menu.php
@@ -338,7 +338,6 @@ public function __construct(array $data, array $options = [])
unset(Utils::$context['max_menu_id'], $this->data, $this->options);
}
-
$this->include_data = [];
return;
@@ -461,10 +460,7 @@ protected function enabledAndAllowed($menu_item): bool
return false;
}
- return !(isset($menu_item['permission']) && !User::$me->allowedTo($menu_item['permission']))
-
-
- ;
+ return !(isset($menu_item['permission']) && !User::$me->allowedTo($menu_item['permission']));
}
/**
@@ -558,9 +554,8 @@ protected function buildArea($area): void
return;
}
- // Set which one is first, last, and selected in the group.
-
+ // Set which one is first, last, and selected in the group.
$first_sa = array_key_first($this_area['subsections']);
$last_sa = array_key_last($this_area['subsections']);
@@ -571,7 +566,6 @@ protected function buildArea($area): void
if ($this->current_area == $this->area_id && empty($this->current_subsection)) {
$this->current_subsection = $first_sa;
}
-
}
$this->setCurrentSectionAndArea();
@@ -750,7 +744,6 @@ protected function checkBaseUrl(): void
$this->sections[$section_id]['url'] = $first_area['url'] ?? $this->base_url . ';area=' . array_key_first($section['areas']);
}
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Msg.php b/Sources/Msg.php
index 9f0a072324..5067a7d745 100644
--- a/Sources/Msg.php
+++ b/Sources/Msg.php
@@ -1044,7 +1044,6 @@ function ($m) {
},
$message,
);
-
}
/**
@@ -2247,7 +2246,6 @@ public static function clearApprovalAlerts($content_ids, $content_action): void
],
true,
);
-
}
/**
@@ -2896,10 +2894,8 @@ public static function spell_init()
return $enchant_link;
}
-
// Free up any resources used...
@enchant_broker_free(Utils::$context['enchant_broker']);
-
}
// Fall through to pspell if enchant didn't work
@@ -2988,9 +2984,7 @@ public static function spell_suggest($dict, $word): array
return $suggestions;
}
-
return enchant_dict_suggest($dict, $word);
-
}
if (Utils::$context['provider'] == 'pspell') {
diff --git a/Sources/PackageManager/FtpConnection.php b/Sources/PackageManager/FtpConnection.php
index 02fe9594ef..46c8fe0a26 100644
--- a/Sources/PackageManager/FtpConnection.php
+++ b/Sources/PackageManager/FtpConnection.php
@@ -183,8 +183,6 @@ public function chmod($ftp_file, $chmod)
break;
}
-
-
// Convert the chmod value from octal (0777) to text ("777").
fwrite($this->connection, 'SITE CHMOD ' . decoct($val) . ' ' . $ftp_file . "\r\n");
@@ -192,7 +190,6 @@ public function chmod($ftp_file, $chmod)
$this->error = 'bad_file';
break;
}
-
}
return $is_writable;
diff --git a/Sources/PackageManager/SubsPackage.php b/Sources/PackageManager/SubsPackage.php
index 04cc2dddd4..f17212c88e 100644
--- a/Sources/PackageManager/SubsPackage.php
+++ b/Sources/PackageManager/SubsPackage.php
@@ -1705,8 +1705,8 @@ public static function compareVersions($version1, $version2)
if ($category == 'dev') {
return $versions[1]['dev'] ? ($versions[2]['type'] == 'stable' ? -1 : 0) : ($versions[1]['type'] == 'stable' ? 1 : 0);
}
- // Otherwise a simple comparison.
+ // Otherwise a simple comparison.
return $versions[1][$category] > $versions[2][$category] ? 1 : -1;
}
}
@@ -1879,7 +1879,6 @@ public static function mktree($strPath, $mode)
return false;
}
-
@mkdir($strPath, $mode);
$test = @opendir($strPath);
@@ -1890,7 +1889,6 @@ public static function mktree($strPath, $mode)
}
return false;
-
}
/**
diff --git a/Sources/PackageManager/XmlArray.php b/Sources/PackageManager/XmlArray.php
index 2fd4dc54ec..03fe5f4eae 100644
--- a/Sources/PackageManager/XmlArray.php
+++ b/Sources/PackageManager/XmlArray.php
@@ -164,7 +164,6 @@ public function path($path, $return_full = false)
return $array[$el];
}
-
$trace = debug_backtrace();
$i = 0;
@@ -180,7 +179,6 @@ public function path($path, $return_full = false)
}
return false;
-
} else {
$lvl = null;
}
@@ -462,10 +460,8 @@ protected function _parse($data)
break;
}
-
$last_tag_end = $next_tag_end;
$offset = $next_tag_start + 1;
-
}
// Parse the insides.
$inner_match = substr($data, 0, $last_tag_end);
@@ -763,8 +759,8 @@ protected function _path($array, $path, $level, $no_error = false)
if (count($results) == 1 || $level !== null) {
return $results[0];
}
- // Return the result set.
+ // Return the result set.
return $results + ['name' => $path . '[]'];
}
}
diff --git a/Sources/PersonalMessage/PM.php b/Sources/PersonalMessage/PM.php
index 1c4f01e8be..fb3bdf14dc 100644
--- a/Sources/PersonalMessage/PM.php
+++ b/Sources/PersonalMessage/PM.php
@@ -1368,7 +1368,6 @@ public static function send($recipients, $subject, $message, $store_outbox = fal
unset($all_to[array_search($row['id_member'], $all_to)]);
continue;
-
}
// Do they have any of the allowed groups?
@@ -1378,7 +1377,6 @@ public static function send($recipients, $subject, $message, $store_outbox = fal
unset($all_to[array_search($row['id_member'], $all_to)]);
continue;
-
}
}
@@ -1555,7 +1553,6 @@ public static function send($recipients, $subject, $message, $store_outbox = fal
$notification_texts[$lang]['body'] = '';
}
-
if ($lang != User::$me->language) {
Lang::load('index+Modifications', User::$me->language, false);
}
diff --git a/Sources/PersonalMessage/Received.php b/Sources/PersonalMessage/Received.php
index 975bdbff91..7f20c3b537 100644
--- a/Sources/PersonalMessage/Received.php
+++ b/Sources/PersonalMessage/Received.php
@@ -287,7 +287,6 @@ public function save(): void
$inserts,
[],
);
-
}
}
diff --git a/Sources/PersonalMessage/Rule.php b/Sources/PersonalMessage/Rule.php
index eeba6289b3..8650dc68cc 100644
--- a/Sources/PersonalMessage/Rule.php
+++ b/Sources/PersonalMessage/Rule.php
@@ -665,7 +665,6 @@ public static function manage(): void
Utils::redirectexit('action=pm;sa=manrules');
}
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/PersonalMessage/Search.php b/Sources/PersonalMessage/Search.php
index db29af6824..42bfacb343 100644
--- a/Sources/PersonalMessage/Search.php
+++ b/Sources/PersonalMessage/Search.php
@@ -187,7 +187,6 @@ public function __construct(int $inbox)
'url' => Config::$scripturl . '?action=pm;sa=search',
'name' => Lang::$txt['pm_search_bar_title'],
];
-
}
/**
@@ -694,7 +693,6 @@ protected function setSearchQuery(): void
$this->search_query = implode(!empty($this->params['searchtype']) && $this->params['searchtype'] == 2 ? ' OR ' : ' AND ', $andQueryParts);
}
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Profile.php b/Sources/Profile.php
index 615c9314dc..d3d5041bf8 100644
--- a/Sources/Profile.php
+++ b/Sources/Profile.php
@@ -414,11 +414,9 @@ public function loadStandardFields(bool $force_reload = false)
return true;
}
-
$value = empty($this->birthdate) ? '1004-01-01' : $this->birthdate;
return false;
-
},
],
'date_registered' => [
@@ -549,11 +547,9 @@ public function loadStandardFields(bool $force_reload = false)
return true;
}
-
$value = $this->language;
return false;
-
},
],
// The username is not always editable - so adjust it as such.
@@ -1795,7 +1791,6 @@ public function validateAvatarData(string &$value): bool|string
default:
$result = $this->setAvatarNone();
break;
-
}
if (is_string($result)) {
diff --git a/Sources/Punycode.php b/Sources/Punycode.php
index 554e1b8e37..e0355a235d 100755
--- a/Sources/Punycode.php
+++ b/Sources/Punycode.php
@@ -478,9 +478,7 @@ protected function charToCodePoint($char)
return (($code - 224) * 4096) + ((ord($char[1]) - 128) * 64) + (ord($char[2]) - 128);
}
-
return (($code - 240) * 262144) + ((ord($char[1]) - 128) * 4096) + ((ord($char[2]) - 128) * 64) + (ord($char[3]) - 128);
-
}
/**
@@ -503,9 +501,7 @@ protected function codePointToChar($code)
return chr(($code >> 12) + 224) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
}
-
return chr(($code >> 18) + 240) . chr((($code >> 12) & 63) + 128) . chr((($code >> 6) & 63) + 128) . chr(($code & 63) + 128);
-
}
/**
diff --git a/Sources/QueryString.php b/Sources/QueryString.php
index f6dded2852..dc1d73b071 100644
--- a/Sources/QueryString.php
+++ b/Sources/QueryString.php
@@ -60,7 +60,6 @@ public static function cleanRequest(): void
// Save some memory.. (since we don't use these anyway.)
unset($GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_VARS'], $GLOBALS['HTTP_POST_FILES'], $GLOBALS['HTTP_POST_FILES']);
-
// These keys shouldn't be set...ever.
if (isset($_REQUEST['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
die('Invalid request variable.');
@@ -555,7 +554,6 @@ public function matchIPtoCIDR(string $ip_address, string $cidr_address): bool
return (ip2long($ip_address) & (~((1 << (32 - $cidr_subnetmask)) - 1))) == ip2long($cidr_network);
}
-
}
// Export public static functions and properties to global namespace for backward compatibility.
diff --git a/Sources/Search/APIs/Custom.php b/Sources/Search/APIs/Custom.php
index 77e9800a4e..6cf163d6d5 100644
--- a/Sources/Search/APIs/Custom.php
+++ b/Sources/Search/APIs/Custom.php
@@ -135,7 +135,6 @@ public function prepareIndexes($word, array &$wordsSearch, array &$wordsExclude,
return;
}
-
foreach ($subwords as $subword) {
if (Utils::entityStrlen($subword) >= $this->min_word_length && !in_array($subword, $this->bannedWords)) {
$wordsSearch['indexed_words'][] = $subword;
@@ -145,7 +144,6 @@ public function prepareIndexes($word, array &$wordsSearch, array &$wordsExclude,
}
}
}
-
}
/**
diff --git a/Sources/Search/APIs/Standard.php b/Sources/Search/APIs/Standard.php
index 45e5527e6c..f4d1bed09d 100644
--- a/Sources/Search/APIs/Standard.php
+++ b/Sources/Search/APIs/Standard.php
@@ -42,7 +42,6 @@ public function __construct()
{
parent::__construct();
}
-
}
?>
\ No newline at end of file
diff --git a/Sources/Search/SearchApi.php b/Sources/Search/SearchApi.php
index 8b9646fd52..41f716b13d 100644
--- a/Sources/Search/SearchApi.php
+++ b/Sources/Search/SearchApi.php
@@ -1198,7 +1198,6 @@ protected function setSearchTerms(): void
$this->searchWords[$orIndex]['indexed_words'] = array_slice($this->searchWords[$orIndex]['indexed_words'], 0, 7);
$this->searchWords[$orIndex]['subject_words'] = array_slice($this->searchWords[$orIndex]['subject_words'], 0, 7);
$this->searchWords[$orIndex]['words'] = array_slice($this->searchWords[$orIndex]['words'], 0, 4);
-
}
}
diff --git a/Sources/Security.php b/Sources/Security.php
index 5c299c323b..3c18094912 100644
--- a/Sources/Security.php
+++ b/Sources/Security.php
@@ -108,13 +108,11 @@ public static function checkConfirm(string $action): bool|string
return true;
}
-
$token = bin2hex(Utils::randomBytes(16));
$_SESSION['confirm_' . $action] = hash_hmac('md5', $_SERVER['HTTP_USER_AGENT'], $token);
return $token;
-
}
/**
@@ -316,7 +314,6 @@ public static function secureDirectory(string|array $paths, bool $attachments =
continue;
}
-
$fh = @fopen($path . '/.htaccess', 'w');
if ($fh) {
@@ -326,7 +323,6 @@ public static function secureDirectory(string|array $paths, bool $attachments =
$errors[] = 'htaccess_cannot_create_file';
}
-
// Next, the index.php file
if (file_exists($path . '/index.php')) {
$errors[] = 'index-php_exists';
@@ -334,7 +330,6 @@ public static function secureDirectory(string|array $paths, bool $attachments =
continue;
}
-
$contents = <<
)*([^<">]+?)(?:
)*\\[/img\\]~i', $sig, $matches);
+ preg_match_all('~\[img(\s+width=([\d]+))?(\s+height=([\d]+))?(\s+width=([\d]+))?\s*\](?:
)*([^<">]+?)(?:
)*\[/img\]~i', $sig, $matches);
// ... and all HTML ones.
- preg_match_all('~<img\\s+src=(?:")?((?:http://|ftp://|https://|ftps://).+?)(?:")?(?:\\s+alt=(?:")?(.*?)(?:")?)?(?:\\s?/)?>~i', $sig, $matches2, PREG_PATTERN_ORDER);
+ preg_match_all('~<img\s+src=(?:")?((?:http://|ftp://|https://|ftps://).+?)(?:")?(?:\s+alt=(?:")?(.*?)(?:")?)?(?:\s?/)?>~i', $sig, $matches2, PREG_PATTERN_ORDER);
// And stick the HTML in the BBC.
if (!empty($matches2)) {
@@ -536,9 +536,9 @@ public function signature(): void
// Try to fix disabled tags.
if (!empty($disabledTags)) {
- $sig = preg_replace('~\\[(?:' . implode('|', $disabledTags) . ').+?\\]~i', '', $sig);
+ $sig = preg_replace('~\[(?:' . implode('|', $disabledTags) . ').+?\]~i', '', $sig);
- $sig = preg_replace('~\\[/(?:' . implode('|', $disabledTags) . ')\\]~i', '', $sig);
+ $sig = preg_replace('~\[/(?:' . implode('|', $disabledTags) . ')\]~i', '', $sig);
}
$sig = strtr($sig, ["\n" => '
']);
@@ -1172,7 +1172,7 @@ public function profileEdit()
if (empty(Utils::$context['fid'])) {
$col_name = Utils::normalize($_POST['field_name'], 'kc_casefold');
$col_name = Utils::sanitizeChars($col_name, 2, '-');
- $col_name = preg_replace('~[^\\w-]~u', '', $col_name);
+ $col_name = preg_replace('~[^\w-]~u', '', $col_name);
$col_name = trim($col_name, '-_');
$col_name = Utils::truncate($col_name, 6);
diff --git a/Sources/Actions/Admin/Find.php b/Sources/Actions/Admin/Find.php
index 1243e3f89f..2c19b9c9fb 100644
--- a/Sources/Actions/Admin/Find.php
+++ b/Sources/Actions/Admin/Find.php
@@ -292,7 +292,7 @@ public function internal()
// Format the name - and remove any descriptions the entry may have.
$name = Lang::$txt[$found] ?? (Lang::$txt['setting_' . $found] ?? (!empty($item['alttxt']) ? $item['alttxt'] : $found));
- $name = preg_replace('~<(?:div|span)\\sclass="smalltext">.+?(?:div|span)>~', '', $name);
+ $name = preg_replace('~<(?:div|span)\sclass="smalltext">.+?(?:div|span)>~', '', $name);
Utils::$context['search_results'][] = [
'url' => (substr($item[1], 0, 4) == 'area' ? Config::$scripturl . '?action=admin;' . $item[1] : $item[1]) . ';' . Utils::$context['session_var'] . '=' . Utils::$context['session_id'] . ((substr($item[1], 0, 4) == 'area' && $section == 'settings' ? '#' . $item[0][0] : '')),
@@ -344,7 +344,7 @@ public function online()
$search_results = WebFetchApi::fetch(Utils::$context['doc_apiurl'] . '?action=query&list=search&srprop=timestamp|snippet&format=xml&srwhat=text&srsearch=' . $postVars);
// If we didn't get any xml back we are in trouble - perhaps the doc site is overloaded?
- if (!$search_results || preg_match('~<' . '\\?xml\\sversion="\\d+\\.\\d+"\\?' . '>\\s*(
\\s*(?!<)~i', '
\s*(?!<)~i', '
~i' => function () { + '~~i' => function () { return '[pre]'; }, '~~i' => function () { return '[/pre]'; }, - '~~i' => function () { + '~~i' => function () { return '[sub]'; }, '~~i' => function () { return '[/sub]'; }, - '~~i' => function () { + '~~i' => function () { return '[sup]'; }, '~~i' => function () { return '[/sup]'; }, - '~~i' => function () { + '~~i' => function () { return '[tt]'; }, '~~i' => function () { return '[/tt]'; }, - '~~i' => function () { + '~
~i' => function () { return '[table]'; }, '~
~i' => function () { return '[/table]'; }, - '~~i' => function () { + '~ ~i' => function () { return '[tr]'; }, '~ ~i' => function () { return '[/tr]'; }, - '~<(td|th)\\s[^<>]*?colspan="?(\\d{1,2})"?.*?' . '>~i' => function ($matches) { + '~<(td|th)\s[^<>]*?colspan="?(\d{1,2})"?.*?' . '>~i' => function ($matches) { return str_repeat('[td][/td]', $matches[2] - 1) . '[td]'; }, - '~<(td|th)(\\s(.)*?)*?' . '>~i' => function () { + '~<(td|th)(\s(.)*?)*?' . '>~i' => function () { return '[td]'; }, '~(td|th)>~i' => function () { return '[/td]'; }, - '~
]*?)?' . '>~i' => function () { + '~
]*?)?' . '>~i' => function () { return "\n"; }, - '~
]*>(\\n)?~i' => function ($matches) { + '~
]*>(\n)?~i' => function ($matches) { return "[hr]\n" . $matches[0]; }, - '~(\\n)?\\[hr\\]~i' => function () { + '~(\n)?\[hr\]~i' => function () { return "\n[hr]"; }, - '~^\\n\\[hr\\]~i' => function () { + '~^\n\[hr\]~i' => function () { return '[hr]'; }, - '~~i' => function () { + '~~i' => function () { return '<blockquote>'; }, '~~i' => function () { return '</blockquote>'; }, - '~~i' => function () { + '~~i' => function () { return '<ins>'; }, '~~i' => function () { @@ -2066,7 +2066,7 @@ public function unparse(string $string): string } // What about URL's - the pain in the ass of the tag world. - while (preg_match('~]*)>([^<>]*)~i', $string, $matches) === 1) { + while (preg_match('~]*)>([^<>]*)~i', $string, $matches) === 1) { // Find the position of the URL. $start_pos = strpos($string, $matches[0]); @@ -2132,7 +2132,7 @@ public function unparse(string $string): string $string = strip_tags($string); // Some tags often end up as just dummy tags - remove those. - $string = preg_replace('~\\[[bisu]\\]\\s*\\[/[bisu]\\]~', '', $string); + $string = preg_replace('~\[[bisu]\]\s*\[/[bisu]\]~', '', $string); // Fix up entities. $string = preg_replace('~*38;~i', '&', $string); @@ -2233,7 +2233,7 @@ public static function highlightPhpCode(string $code): string error_reporting($oldlevel); // Yes, I know this is kludging it, but this is the best way to preserve tabs from PHP :P. - $buffer = preg_replace('~SMF_TAB(?:(?:font|span)><(?:font color|span style)="[^"]*?">)?\\(\\);~', '' . "\t" . '', $buffer); + $buffer = preg_replace('~SMF_TAB(?:(?:font|span)><(?:font color|span style)="[^"]*?">)?\(\);~', '' . "\t" . '', $buffer); return strtr($buffer, ['\'' => ''', '' => '', '
' => '']); } @@ -2460,7 +2460,7 @@ public static function codeValidate(&$tag, &$data, $disabled, $params): void if (!isset($disabled['code'])) { $code = is_array($data) ? $data[0] : $data; - $php_parts = preg_split('~(<\\?php|\\?>)~', $code, -1, PREG_SPLIT_DELIM_CAPTURE); + $php_parts = preg_split('~(<\?php|\?>)~', $code, -1, PREG_SPLIT_DELIM_CAPTURE); for ($php_i = 0, $php_n = count($php_parts); $php_i < $php_n; $php_i++) { // Do PHP code coloring? @@ -2540,7 +2540,7 @@ public static function floatValidate(&$tag, &$data, $disabled, $params): void { $class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"'; - if (preg_match('~\\bmax=(\\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)~', $data, $matches)) { + if (preg_match('~\bmax=(\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)~', $data, $matches)) { $css = ' style="max-width:' . $matches[1] . (is_numeric($matches[1]) ? 'px' : '') . '"'; } else { $css = ''; @@ -2653,7 +2653,7 @@ public static function phpValidate(&$tag, &$data, $disabled, $params): void $data = self::highlightPhpCode($add_begin ? '<?php ' . $data . '?>' : $data); if ($add_begin) { - $data = preg_replace(['~^(.+?)<\\?.{0,40}?php(?: |\\s)~', '~\\?>((?:(font|span)>)*)$~'], '$1', $data, 2); + $data = preg_replace(['~^(.+?)<\?.{0,40}?php(?: |\s)~', '~\?>((?:(font|span)>)*)$~'], '$1', $data, 2); } } } @@ -2729,7 +2729,7 @@ protected function parseMessage(): void while ($this->pos !== false) { $this->last_pos = isset($this->last_pos) ? max($this->pos, $this->last_pos) : $this->pos; - preg_match('~\\[/?(?=' . $this->alltags_regex . ')~i', $this->message, $matches, PREG_OFFSET_CAPTURE, $this->pos + 1); + preg_match('~\[/?(?=' . $this->alltags_regex . ')~i', $this->message, $matches, PREG_OFFSET_CAPTURE, $this->pos + 1); $this->pos = $matches[0][1] ?? false; @@ -3180,21 +3180,21 @@ protected function setUrlRegex(): void $pcre_subroutines = [ 'tlds' => $this->tld_regex, 'pct' => '%[0-9A-Fa-f]{2}', - 'space_lookahead' => '(?=$|\\s|
)', - 'space_lookbehind' => '(?<=^|\\s|
)', + 'space_lookahead' => '(?=$|\s|
)', + 'space_lookbehind' => '(?<=^|\s|
)', 'domain_label_char' => '[' . self::$domain_label_chars . ']', 'not_domain_label_char' => '[^' . self::$domain_label_chars . ']', - 'domain' => '(?:(?P>domain_label_char)+\\.)+(?P>tlds)(?!\\.(?P>domain_label_char))', + 'domain' => '(?:(?P>domain_label_char)+\.)+(?P>tlds)(?!\.(?P>domain_label_char))', 'no_domain' => '(?:(?P>domain_label_char)|[._\\~!$&\'()*+,;=:@]|(?P>pct))+', 'scheme_need_domain' => Utils::buildRegex(self::$schemes['need_domain'], '~'), 'scheme_empty_authority' => Utils::buildRegex(self::$schemes['empty_authority'], '~'), 'scheme_no_authority' => Utils::buildRegex(self::$schemes['no_authority'], '~'), - 'scheme_any' => '[A-Za-z][0-9A-Za-z+\\-.]*', + 'scheme_any' => '[A-Za-z][0-9A-Za-z+\-.]*', 'user_info' => '(?:(?P>domain_label_char)|[._\\~!$&\'()*+,;=:]|(?P>pct))+', - 'dec_octet' => '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)', + 'dec_octet' => '(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)', 'h16' => '[0-9A-Fa-f]{1,4}', - 'ipv4' => '(?:\\b(?:(?P>dec_octet)\\.){3}(?P>dec_octet)\\b)', - 'ipv6' => '\\[(?:' . implode('|', [ + 'ipv4' => '(?:\b(?:(?P>dec_octet)\.){3}(?P>dec_octet)\b)', + 'ipv6' => '\[(?:' . implode('|', [ '(?:(?P>h16):){7}(?P>h16)', '(?:(?P>h16):){1,7}:', '(?:(?P>h16):){1,6}(?::(?P>h16))', @@ -3207,14 +3207,14 @@ protected function setUrlRegex(): void 'fe80:(?::(?P>h16)){0,4}%[0-9A-Za-z]+', '::(ffff(:0{1,4})?:)?(?P>ipv4)', '(?:(?P>h16):){1,4}:(?P>ipv4)', - ]) . ')\\]', + ]) . ')\]', 'host' => '(?:' . implode('|', [ 'localhost', '(?P>domain)', '(?P>ipv4)', '(?P>ipv6)', ]) . ')', - 'authority' => '(?:(?P>user_info)@)?(?P>host)(?::\\d+)?', + 'authority' => '(?:(?P>user_info)@)?(?P>host)(?::\d+)?', ]; // Brackets and quotation marks are problematic at the end of an IRI. @@ -3263,7 +3263,7 @@ protected function setUrlRegex(): void } } } - $bracket_quote_chars = str_replace(['[', ']'], ['\\[', '\\]'], $bracket_quote_chars); + $bracket_quote_chars = str_replace(['[', ']'], ['\[', '\]'], $bracket_quote_chars); $pcre_subroutines['bracket_quote'] = '[' . $bracket_quote_chars . ']|&' . Utils::buildRegex($bracket_quote_entities, '~'); $pcre_subroutines['allowed_entities'] = '&(?!' . Utils::buildRegex(array_merge($bracket_quote_entities, ['lt;', 'gt;']), '~') . ')'; @@ -3272,17 +3272,17 @@ protected function setUrlRegex(): void foreach (['path', 'query', 'fragment'] as $part) { switch ($part) { case 'path': - $part_disallowed_chars = '\\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '/#&'; + $part_disallowed_chars = '\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '/#&'; $part_excluded_trailing_chars = str_replace('?', '', self::$excluded_trailing_chars); break; case 'query': - $part_disallowed_chars = '\\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '#&'; + $part_disallowed_chars = '\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '#&'; $part_excluded_trailing_chars = self::$excluded_trailing_chars; break; default: - $part_disallowed_chars = '\\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '&'; + $part_disallowed_chars = '\s<>' . $bracket_quote_chars . self::$excluded_trailing_chars . '&'; $part_excluded_trailing_chars = self::$excluded_trailing_chars; break; } @@ -3321,7 +3321,7 @@ protected function setUrlRegex(): void // URI scheme (or lack thereof for schemeless URLs) '(?' . '>' . // URI scheme and colon - '\\b' . + '\b' . '(?:' . // Either a scheme that need a domain in the authority // (Remember for later that we need a domain) @@ -3394,7 +3394,7 @@ protected function setUrlRegex(): void // A run of IRI characters '(?P>no_domain)' . // If scheme needs a domain, require a dot and a TLD - '(?()\\.(?P>tlds))' . + '(?( )\.(?P>tlds))' . // Followed by a non-domain character or end of line '(?=(?P>not_domain_label_char)|$)' . ')' . @@ -3457,7 +3457,7 @@ protected function setUrlRegex(): void // 2.b. Query component, if any. '(?:' . // Initial "?" that is not last character. - '\\?' . '(?=(?P>bracket_quote)*(?P>query_allowed))' . + '\?' . '(?=(?P>bracket_quote)*(?P>query_allowed))' . // Then a run of allowed query characters '(?P>query_segment)*+' . ')?' . @@ -3493,13 +3493,13 @@ protected function setEmailRegex(): void $this->setTldRegex(); // Preceded by a space or start of line - $this->email_regex = '(?<=^|\\s|
)' . + $this->email_regex = '(?<=^|\s|
)' . // An email address '[' . self::$domain_label_chars . '_.]{1,80}' . '@' . '[' . self::$domain_label_chars . '.]+' . - '\\.' . $this->tld_regex . + '\.' . $this->tld_regex . // Followed by a non-domain character or end of line '(?=[^' . self::$domain_label_chars . ']|$)'; @@ -3518,7 +3518,7 @@ protected function setAllTagsRegex(): void } } - $this->alltags_regex = '(?' . '>\\b' . Utils::buildRegex(array_unique($alltags)) . '\\b|' . Utils::buildRegex(array_keys(self::$itemcodes)) . ')'; + $this->alltags_regex = '(?' . '>\b' . Utils::buildRegex(array_unique($alltags)) . '\b|' . Utils::buildRegex(array_keys(self::$itemcodes)) . ')'; } /** @@ -3578,7 +3578,7 @@ protected function fixHtml(string $data): string return $data; } - $data = preg_replace('~<a\\s+href=((?:")?)((?:https?://|ftps?://|mailto:|tel:)\\S+?)\\1>(.*?)</a>~i', '[url="$2"]$3[/url]', $data); + $data = preg_replace('~<a\s+href=((?:")?)((?:https?://|ftps?://|mailto:|tel:)\S+?)\1>(.*?)</a>~i', '[url="$2"]$3[/url]', $data); //
should be empty. $empty_tags = ['br', 'hr']; @@ -3601,7 +3601,7 @@ protected function fixHtml(string $data): string } // Do - with security... action= -> action-. - preg_match_all('~<img\\s+src=((?:")?)((?:https?://|ftps?://)\\S+?)\\1(?:\\s+alt=(".*?"|\\S*?))?(?:\\s?/)?>~i', $data, $matches, PREG_PATTERN_ORDER); + preg_match_all('~<img\s+src=((?:")?)((?:https?://|ftps?://)\S+?)\1(?:\s+alt=(".*?"|\S*?))?(?:\s?/)?>~i', $data, $matches, PREG_PATTERN_ORDER); if (!empty($matches[0])) { $replaces = []; @@ -3717,12 +3717,12 @@ protected function closeTags(): void $whitespace_regex = ''; if (!empty($tag['block_level'])) { - $whitespace_regex .= '( |\\s)*(
)?'; + $whitespace_regex .= '( |\s)*(
)?'; } // Trim one line of whitespace after unnested tags, but all of it after nested ones if (!empty($tag['trim']) && $tag['trim'] != 'inside') { - $whitespace_regex .= empty($tag['require_parents']) ? '( |\\s)*' : '(
| |\\s)*'; + $whitespace_regex .= empty($tag['require_parents']) ? '( |\s)*' : '(
| |\s)*'; } if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($this->message, $this->pos), $matches) != 0) { @@ -3846,13 +3846,13 @@ protected function detectTag(string $tag_character): array $params_regexes[$regex_key] = ''; foreach ($possible['parameters'] as $p => $info) { - $params_regexes[$regex_key] .= '(\\s+' . $p . '=' . (empty($info['quoted']) ? '' : '"') . ($info['match'] ?? '(.+?)') . (empty($info['quoted']) ? '' : '"') . '\\s*)' . (empty($info['optional']) ? '' : '?'); + $params_regexes[$regex_key] .= '(\s+' . $p . '=' . (empty($info['quoted']) ? '' : '"') . ($info['match'] ?? '(.+?)') . (empty($info['quoted']) ? '' : '"') . '\s*)' . (empty($info['optional']) ? '' : '?'); } } // Extract the string that potentially holds our parameters. - $blob = preg_split('~\\[/?(?:' . $this->alltags_regex . ')~i', substr($this->message, $this->pos)); - $blobs = preg_split('~\\]~i', $blob[1]); + $blob = preg_split('~\[/?(?:' . $this->alltags_regex . ')~i', substr($this->message, $this->pos)); + $blobs = preg_split('~\]~i', $blob[1]); $splitters = implode('=|', array_keys($possible['parameters'])) . '='; @@ -3862,7 +3862,7 @@ protected function detectTag(string $tag_character): array while ($blob_counter <= count($blobs)) { $given_param_string = implode(']', array_slice($blobs, 0, $blob_counter++)); - $given_params = preg_split('~\\s(?=(' . $splitters . '))~i', $given_param_string); + $given_params = preg_split('~\s(?=(' . $splitters . '))~i', $given_param_string); sort($given_params, SORT_STRING); $match = preg_match('~^' . $params_regexes[$regex_key] . '$~i', implode(' ', $given_params), $matches) !== 0; @@ -3991,7 +3991,7 @@ protected function parseItemCode(): void $pos3 = strpos($this->message, '[/', $this->pos); if ($pos2 !== false && ($pos2 <= $pos3 || $pos3 === false)) { - preg_match('~^(
| |\\s|\\[)+~', substr($this->message, $pos2 + 4), $matches); + preg_match('~^(
| |\s|\[)+~', substr($this->message, $pos2 + 4), $matches); $this->message = substr($this->message, 0, $pos2) . (!empty($matches[0]) && substr($matches[0], -1) == '[' ? '[/li]' : '[/li][/list]') . substr($this->message, $pos2); @@ -4051,11 +4051,11 @@ protected function closeInlineTags(): void $whitespace_regex = ''; if (!empty($tag['block_level'])) { - $whitespace_regex .= '( |\\s)*(
)?'; + $whitespace_regex .= '( |\s)*(
)?'; } if (!empty($tag['trim']) && $tag['trim'] != 'inside') { - $whitespace_regex .= empty($tag['require_parents']) ? '( |\\s)*' : '(
| |\\s)*'; + $whitespace_regex .= empty($tag['require_parents']) ? '( |\s)*' : '(
| |\s)*'; } if (!empty($whitespace_regex) && preg_match('~' . $whitespace_regex . '~', substr($this->message, $this->pos), $matches) != 0) { @@ -4338,7 +4338,7 @@ protected function transformToHtml(array $tag, array $params): void } // Are we trimming outside this tag? - if (!empty($tag['trim']) && $tag['trim'] != 'outside' && preg_match('~(
| |\\s)*~', substr($this->message, $this->pos + 1), $matches) != 0) { + if (!empty($tag['trim']) && $tag['trim'] != 'outside' && preg_match('~(
| |\s)*~', substr($this->message, $this->pos + 1), $matches) != 0) { $this->message = substr($this->message, 0, $this->pos + 1) . substr($this->message, $this->pos + 1 + strlen($matches[0])); } } @@ -4444,7 +4444,7 @@ protected function legalise($string) $align_tags = array_intersect($align_tags, array_keys($valid_tags)); // These keep track of where we are! - if (!empty($align_tags) && count($matches = preg_split('~(\\[/?(?:' . implode('|', $align_tags) . ')\\])~', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) { + if (!empty($align_tags) && count($matches = preg_split('~(\[/?(?:' . implode('|', $align_tags) . ')\])~', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) { // The first one is never a tag. $is_tag = false; @@ -4485,7 +4485,7 @@ protected function legalise($string) } // Quickly remove any tags which are back to back. - $back_to_back_pattern = '~\\[(' . implode('|', array_diff(array_keys($valid_tags), ['td', 'anchor'])) . ')[^<>\\[\\]]*\\]\\s*\\[/\\1\\]~'; + $back_to_back_pattern = '~\[(' . implode('|', array_diff(array_keys($valid_tags), ['td', 'anchor'])) . ')[^<>\[\]]*\]\s*\[/\1\]~'; $lastlen = 0; @@ -4508,7 +4508,7 @@ function ($a, $b) { ]; // These keep track of where we are! - if (count($parts = preg_split(sprintf('~(\\[)(/?)(%1$s)((?:[\\s=][^\\]\\[]*)?\\])~', implode('|', array_keys($valid_tags))), $string, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) { + if (count($parts = preg_split(sprintf('~(\[)(/?)(%1$s)((?:[\s=][^\]\[]*)?\])~', implode('|', array_keys($valid_tags))), $string, -1, PREG_SPLIT_DELIM_CAPTURE)) > 1) { // Start outside [nobbc] or [code] blocks. $in_code = false; $in_nobbc = false; diff --git a/Sources/Board.php b/Sources/Board.php index 523aa1e14e..1c5df8864f 100644 --- a/Sources/Board.php +++ b/Sources/Board.php @@ -2199,7 +2199,7 @@ public static function queryData(array $selects, array $params = [], array $join // If we only want some child boards, use a CTE query for improved performance. if (!empty($params['id_parent']) && in_array('b.id_parent != 0', $where) && Db::$db->cte_support()) { // Ensure we include all the necessary fields for the CTE query. - preg_match_all('/\\bb\\.(\\w+)/', implode(', ', $selects), $matches); + preg_match_all('/\bb\.(\w+)/', implode(', ', $selects), $matches); $cte_fields = array_unique(array_merge( $matches[1], diff --git a/Sources/BrowserDetector.php b/Sources/BrowserDetector.php index d0773a0847..003a31e846 100644 --- a/Sources/BrowserDetector.php +++ b/Sources/BrowserDetector.php @@ -188,7 +188,7 @@ public function isIe() { // I'm IE, Yes I'm the real IE; All you other IEs are just imitating. if (!isset($this->_browsers['is_ie'])) { - $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && preg_match('~MSIE \\d+~', $_SERVER['HTTP_USER_AGENT']) === 1; + $this->_browsers['is_ie'] = !$this->isOpera() && !$this->isGecko() && !$this->isWebTv() && preg_match('~MSIE \d+~', $_SERVER['HTTP_USER_AGENT']) === 1; } return $this->_browsers['is_ie']; @@ -385,7 +385,7 @@ private function setupIe() $this->_browsers['is_ie_compat_view'] = false; // get the version of the browser from the msie tag - if (preg_match('~MSIE\\s?([0-9][0-9]?.[0-9])~i', $_SERVER['HTTP_USER_AGENT'], $msie_match) === 1) { + if (preg_match('~MSIE\s?([0-9][0-9]?.[0-9])~i', $_SERVER['HTTP_USER_AGENT'], $msie_match) === 1) { $msie_match[1] = trim($msie_match[1]); $msie_match[1] = (($msie_match[1] - (int) $msie_match[1]) == 0) ? (int) $msie_match[1] : $msie_match[1]; $this->_browsers['is_ie' . $msie_match[1]] = true; @@ -431,7 +431,7 @@ private function setupIe() */ private function setupFirefox() { - if (preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)[\\/ \\(]([^ ;\\)]+)~', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { + if (preg_match('~(?:Firefox|Ice[wW]easel|IceCat|Shiretoko|Minefield)[\/ \(]([^ ;\)]+)~', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { $this->_browsers['is_firefox' . (int) $match[1]] = true; } } @@ -444,11 +444,11 @@ private function setupFirefox() private function setupOpera() { // Opera 10+ uses the version tag at the end of the string - if (preg_match('~\\sVersion/([0-9]+)\\.[0-9]+(?:\\s*|$)~', $_SERVER['HTTP_USER_AGENT'], $match)) { + if (preg_match('~\sVersion/([0-9]+)\.[0-9]+(?:\s*|$)~', $_SERVER['HTTP_USER_AGENT'], $match)) { $this->_browsers['is_opera' . (int) $match[1]] = true; } // Opera pre 10 is supposed to uses the Opera tag alone, as do some spoofers - elseif (preg_match('~Opera[ /]([0-9]+)(?!\\.[89])~', $_SERVER['HTTP_USER_AGENT'], $match)) { + elseif (preg_match('~Opera[ /]([0-9]+)(?!\.[89])~', $_SERVER['HTTP_USER_AGENT'], $match)) { $this->_browsers['is_opera' . (int) $match[1]] = true; } @@ -461,7 +461,7 @@ private function setupOpera() */ private function setupEdge() { - if (preg_match('~Edge[\\/]([0-9][0-9]?[\\.][0-9][0-9])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { + if (preg_match('~Edge[\/]([0-9][0-9]?[\.][0-9][0-9])~i', $_SERVER['HTTP_USER_AGENT'], $match) === 1) { $this->_browsers['is_edge' . (int) $match[1]] = true; } } diff --git a/Sources/Config.php b/Sources/Config.php index 50c7fea52f..3af0bc8730 100644 --- a/Sources/Config.php +++ b/Sources/Config.php @@ -361,7 +361,7 @@ class Config ' * @version ' . SMF_VERSION . "\n" . ' */' . "\n" . '', - 'search_pattern' => '~/\\*\\*.*?@package\\h+SMF\\b.*?\\*/\\n{0,2}~s', + 'search_pattern' => '~/\*\*.*?@package\h+SMF\b.*?\*/\n{0,2}~s', ], 'maintenance' => [ 'text' => <<<'END' @@ -784,7 +784,7 @@ class Config if (!is_dir(realpath($cachedir)) && is_dir($boarddir . '/cache')) $cachedir = $boarddir . '/cache'; END, - 'search_pattern' => '~\\n?(#[^\\n]+)?(?:\\n\\h*if\\s*\\((?:\\!file_exists\\(\\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\\)|\\!is_dir\\(realpath\\(\\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\\)\\))[^;]+\\n\\h*\\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)[^\\n]+;)+~sm', + 'search_pattern' => '~\n?(#[^\n]+)?(?:\n\h*if\s*\((?:\!file_exists\(\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)|\!is_dir\(realpath\(\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)\)\))[^;]+\n\h*\$(?' . '>boarddir|sourcedir|tasksdir|packagesdir|cachedir)[^\n]+;)+~sm', ], 'db_character_set' => [ 'text' => <<<'END' @@ -829,7 +829,7 @@ class Config } END, // Designed to match both 2.0 and 2.1 versions of this code. - 'search_pattern' => '~\\n?#+ Error.Catching #+\\n[^\\n]*?settings\\.\\n(?:\\$db_last_error = \\d{1,11};|if \\(file_exists.*?\\$db_last_error = 0;(?' . '>\\s*}))(?=\\n|\\?' . '>|$)~s', + 'search_pattern' => '~\n?#+ Error.Catching #+\n[^\n]*?settings\.\n(?:\$db_last_error = \d{1,11};|if \(file_exists.*?\$db_last_error = 0;(?' . '>\s*}))(?=\n|\?' . '>|$)~s', ], // Temporary variable used during the upgrade process. 'upgradeData' => [ @@ -1118,7 +1118,7 @@ public static function reloadModSettings(): void if (!empty(self::$modSettings['load_average']) && preg_match('~^([^ ]+?) ([^ ]+?) ([^ ]+)~', self::$modSettings['load_average'], $matches) != 0) { self::$modSettings['load_average'] = (float) $matches[1]; - } elseif ((self::$modSettings['load_average'] = @shell_exec('uptime')) != null && preg_match('~load averages?: (\\d+\\.\\d+)~i', self::$modSettings['load_average'], $matches) != 0) { + } elseif ((self::$modSettings['load_average'] = @shell_exec('uptime')) != null && preg_match('~load averages?: (\d+\.\d+)~i', self::$modSettings['load_average'], $matches) != 0) { self::$modSettings['load_average'] = (float) $matches[1]; } else { unset(self::$modSettings['load_average']); @@ -1504,21 +1504,21 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes // match the opening quotation mark... '(["\'])' . // then any number of other characters or escaped quotation marks... - '(?:.(?!\\1)|\\\\(?=\\1))*.?' . + '(?:.(?!\\1)|\\\(?=\\1))*.?' . // then the closing quotation mark. '\\1' . // Maybe there's a second string concatenated to this one. - '(?:\\s*\\.\\s*)*' . + '(?:\s*\.\s*)*' . ')+', // Some numeric values might have been stored as strings. - 'integer' => '["\']?[+-]?\\d+["\']?', - 'double' => '["\']?[+-]?\\d+\\.\\d+([Ee][+-]\\d+)?["\']?', + 'integer' => '["\']?[+-]?\d+["\']?', + 'double' => '["\']?[+-]?\d+\.\d+([Ee][+-]\d+)?["\']?', // Some boolean values might have been stored as integers. - 'boolean' => '(?i:TRUE|FALSE|(["\']?)[01]\\b\\1)', + 'boolean' => '(?i:TRUE|FALSE|(["\']?)[01]\b\\1)', 'NULL' => '(?i:NULL)', // These use a PCRE subroutine to match nested arrays. - 'array' => 'array\\s*(\\((?' . '>[^()]|(?1))*\\))', - 'object' => '\\w+::__set_state\\(array\\s*(\\((?' . '>[^()]|(?1))*\\))\\)', + 'array' => 'array\s*(\((?' . '>[^()]|(?1))*\))', + 'object' => '\w+::__set_state\(array\s*(\((?' . '>[^()]|(?1))*\))\)', ]; /* @@ -1539,26 +1539,26 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $neg_index = -1; $substitutions = [ $neg_index-- => [ - 'search_pattern' => '~^\\s*<\\?(php\\b)?\\n?~', + 'search_pattern' => '~^\s*<\?(php\b)?\n?~', 'placeholder' => '', 'replace_pattern' => '~^~', 'replacement' => '<' . "?php\n", ], $neg_index-- => [ - 'search_pattern' => '~\\S\\K\\s*(\\?' . '>)?\\s*$~', + 'search_pattern' => '~\S\K\s*(\?' . '>)?\s*$~', 'placeholder' => "\n" . md5($prefix . '?' . '>'), 'replacement' => "\n\n?" . '>', ], // Remove the code that redirects to the installer. $neg_index-- => [ - 'search_pattern' => '~^if\\s*\\(file_exists\\(dirname\\(__FILE__\\)\\s*\\.\\s*\'/install\\.php\'\\)\\)\\s*(?:({(?' . '>[^{}]|(?1))*})\\h*|header(\\((?' . '>[^()]|(?2))*\\));\\n)~m', + 'search_pattern' => '~^if\s*\(file_exists\(dirname\(__FILE__\)\s*\.\s*\'/install\.php\'\)\)\s*(?:({(?' . '>[^{}]|(?1))*})\h*|header(\((?' . '>[^()]|(?2))*\));\n)~m', 'placeholder' => '', ], ]; if (defined('SMF_INSTALLING')) { $substitutions[$neg_index--] = [ - 'search_pattern' => '~/\\*.*?SMF\\s+1\\.\\d.*?\\*/~s', + 'search_pattern' => '~/\*.*?SMF\s+1\.\d.*?\*/~s', 'placeholder' => '', ]; } @@ -1673,7 +1673,7 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $var_pattern[] = @$type_regex[gettype($config_vars[$var])]; if (is_string($config_vars[$var]) && strpos($config_vars[$var], dirname($settingsFile)) === 0) { - $var_pattern[] = '(?:__DIR__|dirname\\(__FILE__\\)) . \'' . (preg_quote(str_replace(dirname($settingsFile), '', $config_vars[$var]), '~')) . '\''; + $var_pattern[] = '(?:__DIR__|dirname\(__FILE__\)) . \'' . (preg_quote(str_replace(dirname($settingsFile), '', $config_vars[$var]), '~')) . '\''; } } @@ -1681,19 +1681,19 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $var_pattern[] = @$type_regex[gettype($settings_vars[$var])]; if (is_string($settings_vars[$var]) && strpos($settings_vars[$var], dirname($settingsFile)) === 0) { - $var_pattern[] = '(?:__DIR__|dirname\\(__FILE__\\)) . \'' . (preg_quote(str_replace(dirname($settingsFile), '', $settings_vars[$var]), '~')) . '\''; + $var_pattern[] = '(?:__DIR__|dirname\(__FILE__\)) . \'' . (preg_quote(str_replace(dirname($settingsFile), '', $settings_vars[$var]), '~')) . '\''; } } if (!empty($setting_def['raw_default']) && $setting_def['default'] !== '') { - $var_pattern[] = preg_replace('/\\s+/', '\\s+', preg_quote($setting_def['default'], '~')); + $var_pattern[] = preg_replace('/\s+/', '\s+', preg_quote($setting_def['default'], '~')); if (strpos($setting_def['default'], 'dirname(__FILE__)') !== false) { - $var_pattern[] = preg_replace('/\\s+/', '\\s+', preg_quote(str_replace('dirname(__FILE__)', '__DIR__', $setting_def['default']), '~')); + $var_pattern[] = preg_replace('/\s+/', '\s+', preg_quote(str_replace('dirname(__FILE__)', '__DIR__', $setting_def['default']), '~')); } if (strpos($setting_def['default'], '__DIR__') !== false) { - $var_pattern[] = preg_replace('/\\s+/', '\\s+', preg_quote(str_replace('__DIR__', 'dirname(__FILE__)', $setting_def['default']), '~')); + $var_pattern[] = preg_replace('/\s+/', '\s+', preg_quote(str_replace('__DIR__', 'dirname(__FILE__)', $setting_def['default']), '~')); } } @@ -1701,7 +1701,7 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $var_pattern = count($var_pattern) > 1 ? '(?:' . (implode('|', $var_pattern)) . ')' : $var_pattern[0]; - $substitutions[$var]['search_pattern'] = '~(?<=^|\\s)\\h*\\$' . preg_quote($var, '~') . '\\s*=\\s*' . $var_pattern . ';~' . (!empty($utf8) ? 'u' : ''); + $substitutions[$var]['search_pattern'] = '~(?<=^|\s)\h*\$' . preg_quote($var, '~') . '\s*=\s*' . $var_pattern . ';~' . (!empty($utf8) ? 'u' : ''); } // Next create the placeholder or replace_pattern. @@ -1721,7 +1721,7 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $substitutions[$var]['placeholder'] = ''; // This is just for cosmetic purposes. Removes the blank line. - $substitutions[$var]['search_pattern'] = str_replace('(?<=^|\\s)', '\\n?', $substitutions[$var]['search_pattern']); + $substitutions[$var]['search_pattern'] = str_replace('(?<=^|\s)', '\n?', $substitutions[$var]['search_pattern']); } } // Add this setting's value. @@ -1762,20 +1762,20 @@ public static function updateSettingsFile(array $config_vars, ?bool $keep_quotes $placeholder = md5($prefix . $var); - $substitutions[$var]['search_pattern'] = '~(?<=^|\\s)\\h*\\$' . preg_quote($var, '~') . '\\s*=\\s*' . $var_pattern . ';~' . (!empty($utf8) ? 'u' : ''); + $substitutions[$var]['search_pattern'] = '~(?<=^|\s)\h*\$' . preg_quote($var, '~') . '\s*=\s*' . $var_pattern . ';~' . (!empty($utf8) ? 'u' : ''); $substitutions[$var]['placeholder'] = $placeholder; $substitutions[$var]['replacement'] = '$' . $var . ' = ' . self::varExport($val, true) . ';'; } // During an upgrade, some of the path variables may not have been declared yet. if (defined('SMF_INSTALLING') && empty($rebuild)) { - preg_match_all('~^\\h*\\$(\\w+)\\s*=\\s*~m', $substitutions[$pathcode_var]['replacement'], $matches); + preg_match_all('~^\h*\$(\w+)\s*=\s*~m', $substitutions[$pathcode_var]['replacement'], $matches); $missing_pathvars = array_diff($matches[1], array_keys($substitutions)); if (!empty($missing_pathvars)) { foreach ($missing_pathvars as $var) { - $substitutions[$pathcode_var]['replacement'] = preg_replace('~\\nif[^\\n]+\\$' . $var . '[^\\n]+\\n\\h*\\$' . $var . ' = [^\\n]+~', '', $substitutions[$pathcode_var]['replacement']); + $substitutions[$pathcode_var]['replacement'] = preg_replace('~\nif[^\n]+\$' . $var . '[^\n]+\n\h*\$' . $var . ' = [^\n]+~', '', $substitutions[$pathcode_var]['replacement']); } } } @@ -1834,7 +1834,7 @@ function ($a, $b) { } // Settings.php is unlikely to contain any heredocs, but just in case... - if (preg_match_all('/<<<([\'"]?)(\\w+)\\1\\R(.*?)\\R\\h*\\2;$/ms', $settingsText, $matches)) { + if (preg_match_all('/<<<([\'"]?)(\w+)\1\R(.*?)\R\h*\2;$/ms', $settingsText, $matches)) { foreach ($matches[0] as $mkey => $heredoc) { if (!empty($matches[1][$mkey]) && $matches[1][$mkey] === '\'') { $heredoc_replacements[$heredoc] = var_export($matches[3][$mkey], true) . ';'; @@ -1876,7 +1876,7 @@ function ($a, $b) { // Maybe we can try something more interesting? $sp = substr($substitution['search_pattern'], 1); - if (strpos($sp, '(?<=^|\\s)') === 0) { + if (strpos($sp, '(?<=^|\s)') === 0) { $sp = substr($sp, 9); } @@ -1886,7 +1886,7 @@ function ($a, $b) { // See if we can exclude `if` blocks, etc., to narrow down the matches. // @todo Multiple layers of nested brackets might confuse this. - $sp = '~(?:^|//[^\\n]+c\\n|\\*/|[;}]|' . implode('|', array_filter($placeholders)) . ')\\s*' . (strpos($sp, '\\K') === false ? '\\K' : '') . $sp; + $sp = '~(?:^|//[^\n]+c\n|\*/|[;}]|' . implode('|', array_filter($placeholders)) . ')\s*' . (strpos($sp, '\K') === false ? '\K' : '') . $sp; preg_match_all($sp, $settingsText, $matches); } else { @@ -1919,7 +1919,7 @@ function ($a, $b) { $in_s = in_array($var, array_keys($settings_vars)); // Is it in there at all? - if (!preg_match('~(^|\\s)\\$' . preg_quote($var, '~') . '\\s*=\\s*~', $bare_settingsText)) { + if (!preg_match('~(^|\s)\$' . preg_quote($var, '~') . '\s*=\s*~', $bare_settingsText)) { // It's defined by Settings.php, but not by code in the file. // Probably done via an include or something. Skip it. if ($in_s) { @@ -1953,8 +1953,8 @@ function ($a, $b) { $sp = $type_regex['array']; } - if (preg_match('~(^|\\s)\\$' . preg_quote($var, '~') . '\\s*=\\s*' . $sp . '~', $bare_settingsText, $derp)) { - $settingsText = preg_replace('~(^|\\s)\\$' . preg_quote($var, '~') . '\\s*=\\s*' . $sp . '~', $substitution['placeholder'], $settingsText); + if (preg_match('~(^|\s)\$' . preg_quote($var, '~') . '\s*=\s*' . $sp . '~', $bare_settingsText, $derp)) { + $settingsText = preg_replace('~(^|\s)\$' . preg_quote($var, '~') . '\s*=\s*' . $sp . '~', $substitution['placeholder'], $settingsText); $found = true; @@ -2004,7 +2004,7 @@ function ($a, $b) { $bare_settingsText = str_replace([$placeholder . "\n\n", $placeholder], $placeholder . "\n", $bare_settingsText); } - $bare_settingsText = preg_replace('/\\h+$/m', '', rtrim($bare_settingsText)); + $bare_settingsText = preg_replace('/\h+$/m', '', rtrim($bare_settingsText)); /* * Divide the existing content into sections. @@ -2172,7 +2172,7 @@ function ($a, $b) { // Make absolutely sure that the path correction code is included. if (strpos($settingsText, $substitutions[$pathcode_var]['replacement']) === false) { - $settingsText = preg_replace('~(?=\\n#+ Error.Catching #+)~', "\n" . $substitutions[$pathcode_var]['replacement'] . "\n", $settingsText); + $settingsText = preg_replace('~(?=\n#+ Error.Catching #+)~', "\n" . $substitutions[$pathcode_var]['replacement'] . "\n", $settingsText); } // If we did not rebuild, do just enough to make sure the thing is viable. @@ -2229,11 +2229,11 @@ function ($a, $b) { continue; } - $before = is_int($prev_var) ? preg_quote($settings_defs[$prev_var]['text'], '~') . '\\s*\\K' : ''; + $before = is_int($prev_var) ? preg_quote($settings_defs[$prev_var]['text'], '~') . '\s*\K' : ''; // If this setting's comment is immediately preceded by another // DocBlock comment, remove the preceding one. - $settingsText = preg_replace('~' . $before . '(#[^\\n]*\\s*)?/[*]{2}([^*]|[*](?!/))*[*]/\\s*' . preg_quote($setting_def['text'], '~') . '~', $setting_def['text'], $settingsText); + $settingsText = preg_replace('~' . $before . '(#[^\n]*\s*)?/[*]{2}([^*]|[*](?!/))*[*]/\s*' . preg_quote($setting_def['text'], '~') . '~', $setting_def['text'], $settingsText); $prev_var = $var; } @@ -2243,15 +2243,15 @@ function ($a, $b) { foreach ($new_settings_vars as $var => $val) { if (isset($substitutions[$var]) && !preg_match($substitutions[$var]['search_pattern'], $settingsText)) { if (!isset($settings_defs[$var]) && strpos($settingsText, '# Custom Settings #') === false) { - $settingsText = preg_replace('~(?=\\n#+ Error.Catching #+)~', "\n\n######### Custom Settings #########\n", $settingsText); + $settingsText = preg_replace('~(?=\n#+ Error.Catching #+)~', "\n\n######### Custom Settings #########\n", $settingsText); } - $settingsText = preg_replace('~(?=\\n#+ Error.Catching #+)~', $substitutions[$var]['replacement'] . "\n", $settingsText); + $settingsText = preg_replace('~(?=\n#+ Error.Catching #+)~', $substitutions[$var]['replacement'] . "\n", $settingsText); } } // This is just cosmetic. Get rid of extra lines of whitespace. - $settingsText = preg_replace('~\\n\\s*\\n~', "\n\n", $settingsText); + $settingsText = preg_replace('~\n\s*\n~', "\n\n", $settingsText); /************************************** * PART 4: Check syntax before saving * @@ -2341,7 +2341,7 @@ public static function getCurrentSettings(int|float|null $mtime = null, string $ // Prevents warnings about constants that are already defined. $settingsText = preg_replace_callback( - '~\\bdefine\\s*\\(\\s*(["\'])(\\w+)\\1~', + '~\bdefine\s*\(\s*(["\'])(\w+)\1~', function ($matches) { return 'define(\'' . md5(mt_rand()) . '\''; }, @@ -2535,9 +2535,9 @@ public static function varExport($var): string if (is_string($var) && (strpos($var, "\n") !== false || strpos($var, "\r") !== false)) { return strtr( preg_replace_callback( - '/[\\r\\n]+/', + '/[\r\n]+/', function ($m) { - return '\' . "' . strtr($m[0], ["\r" => '\\r', "\n" => '\\n']) . '" . \''; + return '\' . "' . strtr($m[0], ["\r" => '\r', "\n" => '\n']) . '" . \''; }, var_export($var, true), ), @@ -2611,7 +2611,7 @@ public static function stripPhpComments(string $code_str): string // If the tokenizer extension has been disabled, do the job manually. // Leave any heredocs alone. - if (preg_match_all('/<<<([\'"]?)(\\w+)\\1?\\R(.*?)\\R\\h*\\2;$/ms', $code_str, $matches)) { + if (preg_match_all('/<<<([\'"]?)(\w+)\1?\R(.*?)\R\h*\2;$/ms', $code_str, $matches)) { $heredoc_replacements = []; foreach ($matches[0] as $mkey => $heredoc) { @@ -2622,7 +2622,7 @@ public static function stripPhpComments(string $code_str): string } // Split before everything that could possibly delimit a comment or a string. - $parts = preg_split('~(?=#+|/(?=/|\\*)|\\*/|\\R|(? '\\%', - '_' => '\\_', + '%' => '\%', + '_' => '\_', '\\' => '\\\\', ]; @@ -822,7 +822,7 @@ public function backup_table($table, $backup_table) list(, $create) = $this->fetch_row($result); $this->free_result($result); - $create = preg_split('/[\\n\\r]/', $create); + $create = preg_split('/[\n\r]/', $create); $auto_inc = ''; // Default engine type. @@ -839,7 +839,7 @@ public function backup_table($table, $backup_table) // For the engine type, see if we can work out what it is. if (strpos($l, 'ENGINE') !== false || strpos($l, 'TYPE') !== false) { // Extract the engine type. - preg_match('~(ENGINE|TYPE)=(\\w+)(\\sDEFAULT)?(\\sCHARSET=(\\w+))?(\\sCOLLATE=(\\w+))?~', $l, $match); + preg_match('~(ENGINE|TYPE)=(\w+)(\sDEFAULT)?(\sCHARSET=(\w+))?(\sCOLLATE=(\w+))?~', $l, $match); if (!empty($match[1])) { $engine = $match[1]; @@ -890,7 +890,7 @@ public function backup_table($table, $backup_table) ); if ($auto_inc != '') { - if (preg_match('~\\`(.+?)\\`\\s~', $auto_inc, $match) != 0 && substr($auto_inc, -1, 1) == ',') { + if (preg_match('~\`(.+?)\`\s~', $auto_inc, $match) != 0 && substr($auto_inc, -1, 1) == ',') { $auto_inc = substr($auto_inc, 0, -1); } @@ -1311,7 +1311,7 @@ public function add_index($table_name, $index_info, $parameters = [], $if_exists if (isset($index_info['type']) && $index_info['type'] == 'primary') { $index_info['name'] = ''; } else { - $index_info['name'] = trim(implode('_', preg_replace('~(\\(\\d+\\))~', '', $index_info['columns']))); + $index_info['name'] = trim(implode('_', preg_replace('~(\(\d+\))~', '', $index_info['columns']))); } } @@ -1605,7 +1605,7 @@ public function create_table($table_name, $columns, $indexes = [], $parameters = $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; } else { if (empty($index['name'])) { - $index['name'] = trim(implode('_', preg_replace('~(\\(\\d+\\))~', '', $index['columns']))); + $index['name'] = trim(implode('_', preg_replace('~(\(\d+\))~', '', $index['columns']))); } $table_query .= "\n\t" . (isset($index['type']) && $index['type'] == 'unique' ? 'UNIQUE' : 'KEY') . ' ' . $index['name'] . ' (' . $idx_columns . '),'; @@ -1798,7 +1798,7 @@ public function list_columns($table_name, $detail = false, $parameters = []) $auto = strpos($row['Extra'], 'auto_increment') !== false ? true : false; // Can we split out the size? - if (preg_match('~(.+?)\\s*\\((\\d+)\\)(?:(?:\\s*)?(unsigned))?~i', $row['Type'], $matches) === 1) { + if (preg_match('~(.+?)\s*\((\d+)\)(?:(?:\s*)?(unsigned))?~i', $row['Type'], $matches) === 1) { $type = $matches[1]; $size = $matches[2]; @@ -2198,7 +2198,7 @@ protected function replacement__callback($matches) break; case 'date': - if (preg_match('~^(\\d{4})-([0-1]?\\d)-([0-3]?\\d)$~', $replacement, $date_matches) === 1) { + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) { return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]); } @@ -2207,7 +2207,7 @@ protected function replacement__callback($matches) break; case 'time': - if (preg_match('~^([0-1]?\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$~', $replacement, $time_matches) === 1) { + if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) { return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]); } @@ -2216,7 +2216,7 @@ protected function replacement__callback($matches) break; case 'datetime': - if (preg_match('~^(\\d{4})-([0-1]?\\d)-([0-3]?\\d) ([0-1]?\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$~', $replacement, $datetime_matches) === 1) { + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) { return 'str_to_date(' . sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . ',\'%Y-%m-%d %h:%i:%s\')'; diff --git a/Sources/Db/APIs/PostgreSQL.php b/Sources/Db/APIs/PostgreSQL.php index 20e6126513..9c3108e510 100644 --- a/Sources/Db/APIs/PostgreSQL.php +++ b/Sources/Db/APIs/PostgreSQL.php @@ -146,7 +146,7 @@ public function query($identifier, $db_string, $db_values = [], $connection = nu // Special queries that need processing. $replacements = [ 'profile_board_stats' => [ - '~COUNT\\(\\*\\) \\/ MAX\\(b.num_posts\\)~' => 'CAST(COUNT(*) AS DECIMAL) / CAST(b.num_posts AS DECIMAL)', + '~COUNT\(\*\) \/ MAX\(b.num_posts\)~' => 'CAST(COUNT(*) AS DECIMAL) / CAST(b.num_posts AS DECIMAL)', ], ]; @@ -165,7 +165,7 @@ public function query($identifier, $db_string, $db_values = [], $connection = nu } // Limits need to be a little different. - $db_string = preg_replace('~\\sLIMIT\\s(\\d+|{int:.+}),\\s*(\\d+|{int:.+})\\s*$~i', 'LIMIT $2 OFFSET $1', $db_string); + $db_string = preg_replace('~\sLIMIT\s(\d+|{int:.+}),\s*(\d+|{int:.+})\s*$~i', 'LIMIT $2 OFFSET $1', $db_string); if (trim($db_string) == '') { return false; @@ -173,10 +173,10 @@ public function query($identifier, $db_string, $db_values = [], $connection = nu // Comments that are allowed in a query are preg_removed. $allowed_comments_from = [ - '~\\s+~s', - '~/\\*!40001 SQL_NO_CACHE \\*/~', - '~/\\*!40000 USE INDEX \\([A-Za-z\\_]+?\\) \\*/~', - '~/\\*!40100 ON DUPLICATE KEY UPDATE id_msg = \\d+ \\*/~', + '~\s+~s', + '~/\*!40001 SQL_NO_CACHE \*/~', + '~/\*!40000 USE INDEX \([A-Za-z\_]+?\) \*/~', + '~/\*!40100 ON DUPLICATE KEY UPDATE id_msg = \d+ \*/~', ]; $allowed_comments_to = [ ' ', @@ -195,7 +195,7 @@ public function query($identifier, $db_string, $db_values = [], $connection = nu } // Use "ORDER BY null" to prevent Mysql doing filesorts for Group By clauses without an Order By - if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && preg_match('~^\\s+SELECT~i', $db_string)) { + if (strpos($db_string, 'GROUP BY') !== false && strpos($db_string, 'ORDER BY') === false && preg_match('~^\s+SELECT~i', $db_string)) { // Add before LIMIT if ($pos = strpos($db_string, 'LIMIT ')) { $db_string = substr($db_string, 0, $pos) . "\t\t\tORDER BY null\n" . substr($db_string, $pos, strlen($db_string)); @@ -663,8 +663,8 @@ public function select($database, $connection = null) public function escape_wildcard_string($string, $translate_human_wildcards = false) { $replacements = [ - '%' => '\\%', - '_' => '\\_', + '%' => '\%', + '_' => '\_', '\\' => '\\\\', ]; @@ -972,7 +972,7 @@ public function table_sql($tableName) $schema_create .= ' default ' . $row['column_default'] . ''; // Auto increment? - if (preg_match('~nextval\\(\'(.+?)\'(.+?)*\\)~i', $row['column_default'], $matches) != 0) { + if (preg_match('~nextval\(\'(.+?)\'(.+?)*\)~i', $row['column_default'], $matches) != 0) { // Get to find the next variable first! $count_req = $this->query( '', @@ -1115,26 +1115,26 @@ public function search_query($identifier, $db_string, $db_values = [], $connecti '~ENGINE=MEMORY~i' => '', ], 'insert_into_log_messages_fulltext' => [ - '/NOT\\sLIKE/' => 'NOT ILIKE', - '/\\bLIKE\\b/' => 'ILIKE', + '/NOT\sLIKE/' => 'NOT ILIKE', + '/\bLIKE\b/' => 'ILIKE', '/NOT RLIKE/' => '!~*', '/RLIKE/' => '~*', ], 'insert_log_search_results_subject' => [ - '/NOT\\sLIKE/' => 'NOT ILIKE', - '/\\bLIKE\\b/' => 'ILIKE', + '/NOT\sLIKE/' => 'NOT ILIKE', + '/\bLIKE\b/' => 'ILIKE', '/NOT RLIKE/' => '!~*', '/RLIKE/' => '~*', ], 'insert_log_search_topics' => [ - '/NOT\\sLIKE/' => 'NOT ILIKE', - '/\\bLIKE\\b/' => 'ILIKE', + '/NOT\sLIKE/' => 'NOT ILIKE', + '/\bLIKE\b/' => 'ILIKE', '/NOT RLIKE/' => '!~*', '/RLIKE/' => '~*', ], 'insert_log_search_results_no_index' => [ - '/NOT\\sLIKE/' => 'NOT ILIKE', - '/\\bLIKE\\b/' => 'ILIKE', + '/NOT\sLIKE/' => 'NOT ILIKE', + '/\bLIKE\b/' => 'ILIKE', '/NOT RLIKE/' => '!~*', '/RLIKE/' => '~*', ], @@ -1144,8 +1144,8 @@ public function search_query($identifier, $db_string, $db_values = [], $connecti $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); } - if (preg_match('~^\\s*INSERT\\s+IGNORE\\b~i', $db_string) != 0) { - $db_string = preg_replace('~^\\s*INSERT\\s+IGNORE\\b~i', 'INSERT', $db_string); + if (preg_match('~^\s*INSERT\s+IGNORE\b~i', $db_string) != 0) { + $db_string = preg_replace('~^\s*INSERT\s+IGNORE\b~i', 'INSERT', $db_string); if ($this->support_ignore) { // pg style "INSERT INTO.... ON CONFLICT DO NOTHING" @@ -1319,7 +1319,7 @@ public function add_index($table_name, $index_info, $parameters = [], $if_exists $cols = $this->list_columns($table_name, true); foreach ($index_info['columns'] as &$c) { - $c = preg_replace('~\\s+(\\(\\d+\\))~', '', $c); + $c = preg_replace('~\s+(\(\d+\))~', '', $c); } $columns = implode(',', $index_info['columns']); @@ -1330,7 +1330,7 @@ public function add_index($table_name, $index_info, $parameters = [], $if_exists if (isset($index_info['type']) && $index_info['type'] == 'primary') { $index_info['name'] = ''; } else { - $index_info['name'] = trim(implode('_', preg_replace('~(\\(\\d+\\))~', '', $index_info['columns']))); + $index_info['name'] = trim(implode('_', preg_replace('~(\(\d+\))~', '', $index_info['columns']))); } } @@ -1730,7 +1730,7 @@ public function create_table($table_name, $columns, $indexes = [], $parameters = foreach ($indexes as $index) { // MySQL you can do a "column_name (length)", postgresql does not allow this. Strip it. foreach ($index['columns'] as &$c) { - $c = preg_replace('~\\s+(\\(\\d+\\))~', '', $c); + $c = preg_replace('~\s+(\(\d+\))~', '', $c); } $idx_columns = implode(',', $index['columns']); @@ -1740,7 +1740,7 @@ public function create_table($table_name, $columns, $indexes = [], $parameters = $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; } else { if (empty($index['name'])) { - $index['name'] = trim(implode('_', preg_replace('~(\\(\\d+\\))~', '', $index['columns']))); + $index['name'] = trim(implode('_', preg_replace('~(\(\d+\))~', '', $index['columns']))); } $index_queries[] = 'CREATE ' . (isset($index['type']) && $index['type'] == 'unique' ? 'UNIQUE' : '') . ' INDEX ' . $short_table_name . '_' . $index['name'] . ' ON ' . $short_table_name . ' (' . $idx_columns . ')'; @@ -1923,7 +1923,7 @@ public function list_columns($table_name, $detail = false, $parameters = []) // What is the default? if ($row['column_default'] !== null) { - if (preg_match('~nextval\\(\'(.+?)\'(.+?)*\\)~i', $row['column_default'], $matches) != 0) { + if (preg_match('~nextval\(\'(.+?)\'(.+?)*\)~i', $row['column_default'], $matches) != 0) { $auto = true; } elseif (substr($row['column_default'], 0, 4) != 'NULL' && trim($row['column_default']) != '') { $pos = strpos($row['column_default'], '::'); @@ -1978,7 +1978,7 @@ public function list_indexes($table_name, $detail = false, $parameters = []) while ($row = $this->fetch_assoc($result)) { // Try get the columns that make it up. - if (preg_match('~\\(([^\\)]+?)\\)~i', $row['inddef'], $matches) == 0) { + if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) { continue; } @@ -2308,7 +2308,7 @@ protected function replacement__callback($matches) break; case 'date': - if (preg_match('~^(\\d{4})-([0-1]?\\d)-([0-3]?\\d)$~', $replacement, $date_matches) === 1) { + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) { return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]) . '::date'; } @@ -2317,7 +2317,7 @@ protected function replacement__callback($matches) break; case 'time': - if (preg_match('~^([0-1]?\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$~', $replacement, $time_matches) === 1) { + if (preg_match('~^([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $time_matches) === 1) { return sprintf('\'%02d:%02d:%02d\'', $time_matches[1], $time_matches[2], $time_matches[3]) . '::time'; } @@ -2326,7 +2326,7 @@ protected function replacement__callback($matches) break; case 'datetime': - if (preg_match('~^(\\d{4})-([0-1]?\\d)-([0-3]?\\d) ([0-1]?\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$~', $replacement, $datetime_matches) === 1) { + if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d) ([0-1]?\d|2[0-3]):([0-5]\d):([0-5]\d)$~', $replacement, $datetime_matches) === 1) { return 'to_timestamp(' . sprintf('\'%04d-%02d-%02d %02d:%02d:%02d\'', $datetime_matches[1], $datetime_matches[2], $datetime_matches[3], $datetime_matches[4], $datetime_matches[5], $datetime_matches[6]) . ',\'YYYY-MM-DD HH24:MI:SS\')'; diff --git a/Sources/Draft.php b/Sources/Draft.php index 25905b026f..086ded7397 100644 --- a/Sources/Draft.php +++ b/Sources/Draft.php @@ -644,7 +644,7 @@ protected function setProperties(array $recipientList = []): void } if (isset($_POST['subject'])) { - $this->subject = Utils::entitySubstr(trim(preg_replace('/(\\pZ| )+/u', ' ', Utils::htmlspecialchars($_POST['subject']))), 0, 100); + $this->subject = Utils::entitySubstr(trim(preg_replace('/(\pZ| )+/u', ' ', Utils::htmlspecialchars($_POST['subject']))), 0, 100); } if (empty($this->member)) { @@ -663,7 +663,7 @@ protected function setProperties(array $recipientList = []): void $this->locked = !empty($_POST['lock']); } - if (!empty($_POST['icon']) && preg_match('/^\\w+$/', $_POST['icon'])) { + if (!empty($_POST['icon']) && preg_match('/^\w+$/', $_POST['icon'])) { $this->icon = $_POST['icon']; } diff --git a/Sources/Event.php b/Sources/Event.php index 2ff5c16209..15f05b1288 100644 --- a/Sources/Event.php +++ b/Sources/Event.php @@ -710,7 +710,7 @@ public function __get(string $prop): mixed case 'start_iso_gmdate': case 'end_iso_gmdate': - $value = $this->allday ? preg_replace('/T\\d\\d:\\d\\d:\\d\\d/', 'T00:00:00', $this->{$start_end}->iso_gmdate) : $this->{$start_end}->iso_gmdate; + $value = $this->allday ? preg_replace('/T\d\d:\d\d:\d\d/', 'T00:00:00', $this->{$start_end}->iso_gmdate) : $this->{$start_end}->iso_gmdate; break; case 'tz': diff --git a/Sources/Graphics/Image.php b/Sources/Graphics/Image.php index 3df8318382..e754eb658d 100644 --- a/Sources/Graphics/Image.php +++ b/Sources/Graphics/Image.php @@ -898,7 +898,7 @@ protected function getDimensionsAndOrientation(): void */ protected function getSvgDimensions(): void { - preg_match('/