Skip to content

Commit

Permalink
Merge pull request #3443 from NamelessMC/release/2.1.2
Browse files Browse the repository at this point in the history
Release/2.1.2
  • Loading branch information
samerton authored Sep 30, 2023
2 parents 333726f + 3643a89 commit 3a43386
Show file tree
Hide file tree
Showing 36 changed files with 371 additions and 176 deletions.
3 changes: 1 addition & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,4 @@ After adding a new module to core, you need to do the following:

1. Ensure you have a clean copy of the source code without leftover files from testing. For example, clone the Nameless repository into a new directory
2. Run ./dev/scripts/release.sh. Release zip files are produced and placed in `./release`.
3. TODO: Add instructions for producing a zip only containing files changed since the last release
4. TODO: Add instructions for publishing a release
3. TODO: Add instructions for publishing a release
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
# NamelessMC v2 Changelog

## [Unreleased](https://github.com/NamelessMC/Nameless/compare/v2.1.1...v2)
> [Milestone](https://github.com/NamelessMC/Nameless/milestone/21)
## [Unreleased](https://github.com/NamelessMC/Nameless/compare/v2.1.2...develop)
> [Milestone](https://github.com/NamelessMC/Nameless/milestone/22)
## [2.1.2](https://github.com/NamelessMC/Nameless/compare/v2.1.1...v2.1.2) - 2023-09-30
### Added
- No additions this release

### Changed
- Small misc improvements [#3389](https://github.com/NamelessMC/Nameless/pull/3389)
- Add PHP_SAPI checks on scripts [#3403](https://github.com/NamelessMC/Nameless/pull/3403)
- Rewrite release script to fix checksums in upgrade package [#3414](https://github.com/NamelessMC/Nameless/pull/3414)
- Ignore group sync request instead of returning error [#3433](https://github.com/NamelessMC/Nameless/pull/3433)
- Limit logs & support group sync from modules [#3426](https://github.com/NamelessMC/Nameless/pull/3426)
- Ignore adding group if it's invalid [#3436](https://github.com/NamelessMC/Nameless/pull/3436)
- Updated translations

### Fixed
- Rework user group cache issue [#3398](https://github.com/NamelessMC/Nameless/pull/3398)
- Re-add deleted term + fix Discord OAuth link success message [#3403](https://github.com/NamelessMC/Nameless/pull/3403)
- Fix typo in en_US translation [#3412](https://github.com/NamelessMC/Nameless/pull/3412)
- Fix auto verify OAuth email [#3413](https://github.com/NamelessMC/Nameless/pull/3413)
- Fix forum index showing topics without view other topics permission [#3410](https://github.com/NamelessMC/Nameless/pull/3410)
- Fix phpdoc build, pin version [#3438](https://github.com/NamelessMC/Nameless/pull/3438)
- Fix single/double quote not working within member list username CSS [#3427](https://github.com/NamelessMC/Nameless/pull/3427)

## [2.1.1](https://github.com/NamelessMC/Nameless/compare/v2.1.0...v2.1.1) - 2023-06-18
### Added
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.phpdoc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM phpdoc/phpdoc as doc_builder
FROM phpdoc/phpdoc:3.4 as doc_builder

COPY . /source

WORKDIR /source

RUN mkdir /target && \
phpdoc \
phpdoc run \
-d 'core/classes' \
-d 'modules/Core/classes' \
-d 'modules/Discord Integration/classes' \
Expand Down
10 changes: 10 additions & 0 deletions core/classes/Core/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ private static function buildNonFriendly(string $url, string $params): string {
return (defined('CONFIG_PATH') ? CONFIG_PATH : '') . '/index.php?route=' . $url . ((substr($url, -1) == '/') ? '' : '/');
}

/**
* Build an asset path
*
* @param string $path Contains the asset path relative to the root Nameless directory
* @return string
*/
public static function buildAssetPath(string $path): string {
return (defined('CONFIG_PATH') ? CONFIG_PATH : '') . '/' . ltrim($path, '/');
}

/**
* Get the server name.
*
Expand Down
46 changes: 27 additions & 19 deletions core/classes/Core/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author Samerton
* @author Partydragen
* @author Aberdeener
* @version 2.1.1
* @version 2.1.2
* @license MIT
*/
class User {
Expand Down Expand Up @@ -134,17 +134,21 @@ public function addGroup(int $group_id, int $expire = 0): bool {
return false;
}

$group = Group::find($group_id);
if (!$group) {
ErrorHandler::logWarning('Could not add invalid group ' . $group_id . ' to user ' . $this->data()->id);
return false;
}

$this->_db->query('INSERT INTO `nl2_users_groups` (`user_id`, `group_id`, `received`, `expire`) VALUES (?, ?, ?, ?)', [
$this->data()->id,
$group_id,
date('U'),
$expire
]);

$group = Group::find($group_id);
if ($group) {
$this->_groups[$group_id] = $group;
}
$this->_groups[$group_id] = $group;
self::$_group_cache[$this->data()->id][$group_id] = $group;

EventHandler::executeEvent(new UserGroupAddedEvent(
$this,
Expand Down Expand Up @@ -524,28 +528,26 @@ public function getGroups(): array {
}

if (isset(self::$_group_cache[$this->data()->id])) {
$groups_query = self::$_group_cache[$this->data()->id];
$this->_groups = self::$_group_cache[$this->data()->id];
} else {
$groups_query = $this->_db->query('SELECT nl2_groups.* FROM nl2_users_groups INNER JOIN nl2_groups ON group_id = nl2_groups.id WHERE user_id = ? AND deleted = 0 ORDER BY `order`', [$this->data()->id]);
if ($groups_query->count()) {
$groups_query = $groups_query->results();
foreach ($groups_query->results() as $item) {
$this->_groups[$item->id] = new Group($item);
}
} else {
$groups_query = [];
$this->_groups = [];
}
self::$_group_cache[$this->data()->id] = $groups_query;

self::$_group_cache[$this->data()->id] = $this->_groups;
}

if ($groups_query) {
foreach ($groups_query as $item) {
$this->_groups[$item->id] = new Group($item);
}
} else {
if (!count($this->_groups)) {
// Get default group
// TODO: Use PRE_VALIDATED_DEFAULT ?
$default_group = Group::find(1, 'default_group');
$default_group_id = $default_group->id ?? 1;

$this->_groups = [];
$this->addGroup($default_group_id);
}

Expand Down Expand Up @@ -659,6 +661,12 @@ public function getMainGroup(): Group {
* @return false|void
*/
public function setGroup(int $group_id, int $expire = 0) {
$group = Group::find($group_id);
if (!$group) {
ErrorHandler::logWarning('Could not set invalid group ' . $group_id . ' to user ' . $this->data()->id);
return false;
}

if ($this->data()->id == 1) {
return false;
}
Expand All @@ -673,10 +681,9 @@ public function setGroup(int $group_id, int $expire = 0) {
]);

$this->_groups = [];
$group = Group::find($group_id);
if ($group) {
$this->_groups[$group_id] = $group;
}
$this->_groups[$group_id] = $group;
self::$_group_cache[$this->data()->id] = $this->_groups;

}

/**
Expand Down Expand Up @@ -706,6 +713,7 @@ public function removeGroup(?int $group_id): bool {
));

unset($this->_groups[$group_id]);
unset(self::$_group_cache[$this->data()->id][$group_id]);

return true;
}
Expand Down
6 changes: 3 additions & 3 deletions core/classes/Database/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ public function addColumn(string $table, string $column, string $attributes): bo
* column, operator (default =), value, and glue (default AND).
* @return array The where clause string, and parameters to bind.
*/
private function makeWhere(array $clauses): array {
public static function makeWhere(array $clauses): array {
if (count($clauses) === count($clauses, COUNT_RECURSIVE)) {
return $this->makeWhere([$clauses]);
return self::makeWhere([$clauses]);
}

$where_clauses = [];
Expand All @@ -486,7 +486,7 @@ private function makeWhere(array $clauses): array {
}

if (count($clause) !== count($clause, COUNT_RECURSIVE)) {
$this->makeWhere(...$clause);
self::makeWhere(...$clause);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion core/classes/Database/DatabaseInitialiser.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ private function initialiseSettings(): void {
Util::setSetting('recaptcha_type', 'Recaptcha3');
Util::setSetting('recaptcha_login', '0');
Util::setSetting('email_verification', '1');
Util::setSetting('nameless_version', '2.1.1');
Util::setSetting('nameless_version', '2.1.2');
Util::setSetting('version_checked', date('U'));
Util::setSetting('phpmailer', '0');
Util::setSetting('user_avatars', '0');
Expand Down
8 changes: 8 additions & 0 deletions core/includes/updates/211.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
return new class extends UpgradeScript {
public function run(): void {
$this->runMigrations();

$this->setVersion('2.1.2');
}
};
16 changes: 14 additions & 2 deletions custom/languages/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"admin/email_message_message": "Zpráva",
"admin/email_message_options": "Možnosti",
"admin/email_message_subject": "Předmět",
"admin/email_message_thanks": "Poděkování",
"admin/email_message_thanks": "Děkujeme",
"admin/email_password_hidden": "Heslo není z bezpečnostních důvodů zobrazeno.",
"admin/email_port_invalid": "Zadejte platný e-mailový port.",
"admin/email_preview_popup": "Náhled",
Expand Down Expand Up @@ -1320,5 +1320,17 @@
"admin/discord_hook": "Discord",
"admin/event_supports_discord": "Tato událost podporuje Discord webhooky a má vlastní vložení.",
"admin/event_supports_normal": "Tato událost podporuje normální webhooky.",
"general/registration_disabled_message_fallback": "Registrace jsou momentálně zakázány."
"general/registration_disabled_message_fallback": "Registrace jsou momentálně zakázány.",
"user/integration_linked": "Úspěšně jste připojili svůj účet {{integration}}.",
"user/profile_posts_score": "Skóre profilových příspěvků",
"admin/custom_score": "Vlastní skóre",
"admin/profile_widgets": "Profilové widgety",
"admin/reaction_added_event_info": "Reakce přidána",
"admin/reaction_deleted_event_info": "Reakce odstraněna",
"admin/site_widgets": "Webové widgety",
"general/on": "zapnuto",
"user/given": "Uděleno",
"user/minecraft_account": "Účet Minecraft",
"user/reaction_score": "Reakční skóre",
"user/received": "Obdrženo"
}
20 changes: 16 additions & 4 deletions custom/languages/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"admin/enable_player_list": "Spielerliste aktivieren?",
"admin/enable_registration": "Registrierung aktivieren?",
"admin/enable_status_query": "Aktiviere Status Abfrage?",
"admin/enable_username_sync": "Benutzername Synchronisation aktivieren?",
"admin/enable_username_sync": "Benutzernamen-Synchronisation aktivieren?",
"admin/enable_username_sync_info": "Wenn diese Option aktiviert ist, werden die Benutzernamen der Website aktualisiert, damit sie mit den Benutzernamen im Spiel übereinstimmen. Dies geschieht, wenn das In-Game-Plugin eine Liste von UUIDs und Benutzernamen für Online-Spieler an die Website sendet.",
"admin/enabled": "Aktiviert",
"admin/enter_authme_db_details": "Bitte gebe gültige Datenbank Informationen ein.",
Expand All @@ -200,7 +200,7 @@
"admin/force_tfa_alert": "Für Deine Gruppe muss die Zwei-Faktor-Authentifizierung aktiviert sein.",
"admin/force_tfa_warning": "Bitte vergewissere dich, dass du weißt, was das tut, sonst riskierst du, dich und alle Gruppenmitglieder auszusperren.",
"admin/force_www": "<b>www</b> erzwingen?",
"admin/forgot_password_email": "Password vergessen E-Mail",
"admin/forgot_password_email": "E-Mail Password vergessen",
"admin/forum_posts": "Anzeige im Forum",
"admin/forum_topic_reply_email": "Forum Thema Antwort",
"admin/general_settings": "Allgemeine Einstellungen",
Expand Down Expand Up @@ -436,7 +436,7 @@
"admin/select_default_avatar": "Wähle ein neues Standard Avatar:",
"admin/select_user_group": "Du musst eine Benutzergruppe auswählen.",
"admin/send": "Senden",
"admin/send_test_email": "Sende Test E-Mail",
"admin/send_test_email": "Test E-Mail senden",
"admin/send_test_email_info": "Die folgende Schaltfläche versucht, eine E-Mail an Deine E-Mail-Adresse zu senden, {{email}}. Falls Irgendwelche Fehler, die beim Senden der E-Mail enstehen, werden angezeigt.",
"admin/sending_mass_message": "Massennachricht senden",
"admin/seo": "SEO",
Expand Down Expand Up @@ -1320,5 +1320,17 @@
"admin/discord_hook": "Discord",
"admin/event_supports_discord": "Dieses Ereignis unterstützt Discord-Webhooks und hat eine eigene Einbettung.",
"admin/event_supports_normal": "Dieses Ereignis unterstützt normale Webhooks.",
"general/registration_disabled_message_fallback": "Die Registrierung ist derzeit deaktiviert."
"general/registration_disabled_message_fallback": "Die Registrierung ist derzeit deaktiviert.",
"admin/custom_score": "Benutzerdefinierte Punktzahl",
"admin/profile_widgets": "Profil Widgets",
"admin/reaction_added_event_info": "Reaktion hinzugefügt",
"admin/reaction_deleted_event_info": "Reaktion gelöscht",
"admin/site_widgets": "Website-Widgets",
"general/on": "an",
"user/given": "Gegeben",
"user/minecraft_account": "Minecraft Account",
"user/profile_posts_score": "Bewertung der Profilbeiträge",
"user/reaction_score": "Bewertung der Reaktion",
"user/received": "Empfangen",
"user/integration_linked": "Du hast dein {{integration}}-Konto erfolgreich verknüpft."
}
2 changes: 2 additions & 0 deletions custom/languages/en_UK.json
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@
"api/finish_registration_link": "Please click on the following link to complete registration:",
"api/group_updated": "Group updated successfully",
"api/groups_updates_successfully": "Groups updated successfully",
"api/groups_updates_ignored": "Group sync request ignored, because the Minecraft integration is disabled or the server is not configured as the group sync server in StaffCP.",
"api/integration_identifier_already_linked": "{{integration}} identifier is already linked to another user.",
"api/integration_username_already_linked": "{{integration}} username is already linked to another user.",
"api/report_created": "Report created successfully",
Expand Down Expand Up @@ -1174,6 +1175,7 @@
"user/incorrect_password": "Your password is incorrect.",
"user/integration_identifier_already_linked": "{{integration}} identifier is already linked to another user.",
"user/integration_required_to_continue": "Please connect and verify the required connections before continuing to use this website.",
"user/integration_linked": "You have successfully linked your {{integration}} account.",
"user/integration_unlinked": "You have successfully unlinked your {{integration}} account.",
"user/integration_username_already_linked": "{{integration}} username is already linked to another user.",
"user/invalid_email": "Your email is invalid.",
Expand Down
Loading

0 comments on commit 3a43386

Please sign in to comment.