Made certain strings less ugly.

This commit is contained in:
flash 2025-02-09 16:41:09 +00:00
parent cc37b7cad3
commit 7bf9a7eedd
17 changed files with 273 additions and 249 deletions

View file

@ -22,7 +22,7 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
return; return;
} }
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_roles ( CREATE TABLE msz_roles (
role_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, role_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
role_hierarchy INT(11) NOT NULL DEFAULT 1, role_hierarchy INT(11) NOT NULL DEFAULT 1,
@ -37,9 +37,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
KEY roles_hierarchy_index (role_hierarchy), KEY roles_hierarchy_index (role_hierarchy),
KEY roles_hidden_index (role_hidden) KEY roles_hidden_index (role_hidden)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_users ( CREATE TABLE msz_users (
user_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, user_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL,
@ -48,7 +48,7 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
register_ip VARBINARY(16) NOT NULL, register_ip VARBINARY(16) NOT NULL,
last_ip VARBINARY(16) NOT NULL, last_ip VARBINARY(16) NOT NULL,
user_super TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, user_super TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
user_country CHAR(2) NOT NULL DEFAULT \'XX\', user_country CHAR(2) NOT NULL DEFAULT 'XX',
user_colour INT(11) DEFAULT NULL, user_colour INT(11) DEFAULT NULL,
user_created TIMESTAMP NOT NULL DEFAULT current_timestamp(), user_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
user_active TIMESTAMP NULL DEFAULT NULL, user_active TIMESTAMP NULL DEFAULT NULL,
@ -73,16 +73,16 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_audit_log ( CREATE TABLE msz_audit_log (
user_id INT(10) UNSIGNED DEFAULT NULL, user_id INT(10) UNSIGNED DEFAULT NULL,
log_action VARCHAR(50) NOT NULL, log_action VARCHAR(50) NOT NULL,
log_params TEXT NOT NULL, log_params TEXT NOT NULL,
log_created TIMESTAMP NOT NULL DEFAULT current_timestamp(), log_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
log_ip VARBINARY(16) DEFAULT NULL, log_ip VARBINARY(16) DEFAULT NULL,
log_country CHAR(2) NOT NULL DEFAULT \'XX\', log_country CHAR(2) NOT NULL DEFAULT 'XX',
KEY audit_log_user_id_foreign (user_id), KEY audit_log_user_id_foreign (user_id),
KEY audit_log_created_index (log_created), KEY audit_log_created_index (log_created),
CONSTRAINT audit_log_user_id_foreign CONSTRAINT audit_log_user_id_foreign
@ -91,9 +91,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_auth_tfa ( CREATE TABLE msz_auth_tfa (
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
tfa_token CHAR(32) NOT NULL, tfa_token CHAR(32) NOT NULL,
@ -107,9 +107,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_changelog_changes ( CREATE TABLE msz_changelog_changes (
change_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, change_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED DEFAULT NULL, user_id INT(10) UNSIGNED DEFAULT NULL,
@ -127,9 +127,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_changelog_tags ( CREATE TABLE msz_changelog_tags (
tag_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, tag_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
tag_name VARCHAR(255) NOT NULL, tag_name VARCHAR(255) NOT NULL,
@ -140,9 +140,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
UNIQUE KEY tag_name (tag_name), UNIQUE KEY tag_name (tag_name),
KEY tag_archived (tag_archived) KEY tag_archived (tag_archived)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_changelog_change_tags ( CREATE TABLE msz_changelog_change_tags (
change_id INT(10) UNSIGNED NOT NULL, change_id INT(10) UNSIGNED NOT NULL,
tag_id INT(10) UNSIGNED NOT NULL, tag_id INT(10) UNSIGNED NOT NULL,
@ -159,9 +159,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_comments_categories ( CREATE TABLE msz_comments_categories (
category_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, category_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_name VARCHAR(255) NOT NULL, category_name VARCHAR(255) NOT NULL,
@ -178,9 +178,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_comments_posts ( CREATE TABLE msz_comments_posts (
comment_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, comment_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_id INT(10) UNSIGNED NOT NULL, category_id INT(10) UNSIGNED NOT NULL,
@ -207,9 +207,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_comments_votes ( CREATE TABLE msz_comments_votes (
comment_id INT(10) UNSIGNED NOT NULL, comment_id INT(10) UNSIGNED NOT NULL,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -228,17 +228,17 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_config ( CREATE TABLE msz_config (
config_name varchar(100) NOT NULL, config_name varchar(100) NOT NULL,
config_value blob NOT NULL DEFAULT \'\', config_value blob NOT NULL DEFAULT '',
PRIMARY KEY (config_name) PRIMARY KEY (config_name)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_emoticons ( CREATE TABLE msz_emoticons (
emote_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, emote_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
emote_order MEDIUMINT(9) NOT NULL DEFAULT 0, emote_order MEDIUMINT(9) NOT NULL DEFAULT 0,
@ -249,9 +249,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
KEY emotes_order (emote_order), KEY emotes_order (emote_order),
KEY emotes_hierarchy (emote_hierarchy) KEY emotes_hierarchy (emote_hierarchy)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_emoticons_strings ( CREATE TABLE msz_emoticons_strings (
emote_id INT(10) UNSIGNED NOT NULL, emote_id INT(10) UNSIGNED NOT NULL,
emote_string_order MEDIUMINT(9) NOT NULL DEFAULT 0, emote_string_order MEDIUMINT(9) NOT NULL DEFAULT 0,
@ -265,9 +265,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_categories ( CREATE TABLE msz_forum_categories (
forum_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, forum_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
forum_order INT(10) UNSIGNED NOT NULL DEFAULT 1, forum_order INT(10) UNSIGNED NOT NULL DEFAULT 1,
@ -291,9 +291,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
KEY forum_link_clicks_index (forum_link_clicks), KEY forum_link_clicks_index (forum_link_clicks),
KEY forum_hidden_index (forum_hidden) KEY forum_hidden_index (forum_hidden)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_permissions ( CREATE TABLE msz_forum_permissions (
user_id INT(10) UNSIGNED DEFAULT NULL, user_id INT(10) UNSIGNED DEFAULT NULL,
role_id INT(10) UNSIGNED DEFAULT NULL, role_id INT(10) UNSIGNED DEFAULT NULL,
@ -319,9 +319,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_topics ( CREATE TABLE msz_forum_topics (
topic_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, topic_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
forum_id INT(10) UNSIGNED NOT NULL, forum_id INT(10) UNSIGNED NOT NULL,
@ -353,9 +353,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_topics_track ( CREATE TABLE msz_forum_topics_track (
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
topic_id INT(10) UNSIGNED NOT NULL, topic_id INT(10) UNSIGNED NOT NULL,
@ -382,9 +382,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_posts ( CREATE TABLE msz_forum_posts (
post_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, post_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
topic_id INT(10) UNSIGNED NOT NULL, topic_id INT(10) UNSIGNED NOT NULL,
@ -424,16 +424,16 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_login_attempts ( CREATE TABLE msz_login_attempts (
user_id INT(10) UNSIGNED DEFAULT NULL, user_id INT(10) UNSIGNED DEFAULT NULL,
attempt_success TINYINT(1) NOT NULL, attempt_success TINYINT(1) NOT NULL,
attempt_ip VARBINARY(16) NOT NULL, attempt_ip VARBINARY(16) NOT NULL,
attempt_country CHAR(2) NOT NULL DEFAULT \'XX\', attempt_country CHAR(2) NOT NULL DEFAULT 'XX',
attempt_created TIMESTAMP NOT NULL DEFAULT current_timestamp(), attempt_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
attempt_user_agent VARCHAR(255) NOT NULL DEFAULT \'\', attempt_user_agent VARCHAR(255) NOT NULL DEFAULT '',
KEY login_attempts_user_id_foreign (user_id), KEY login_attempts_user_id_foreign (user_id),
KEY login_attempts_created_index (attempt_created), KEY login_attempts_created_index (attempt_created),
KEY login_attempts_success_index (attempt_success), KEY login_attempts_success_index (attempt_success),
@ -444,9 +444,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_news_categories ( CREATE TABLE msz_news_categories (
category_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, category_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_name VARCHAR(255) NOT NULL, category_name VARCHAR(255) NOT NULL,
@ -456,9 +456,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
PRIMARY KEY (category_id), PRIMARY KEY (category_id),
KEY news_categories_is_hidden_index (category_is_hidden) KEY news_categories_is_hidden_index (category_is_hidden)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_news_posts ( CREATE TABLE msz_news_posts (
post_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, post_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_id INT(10) UNSIGNED NOT NULL, category_id INT(10) UNSIGNED NOT NULL,
@ -497,9 +497,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_permissions ( CREATE TABLE msz_permissions (
user_id INT(10) UNSIGNED DEFAULT NULL, user_id INT(10) UNSIGNED DEFAULT NULL,
role_id INT(10) UNSIGNED DEFAULT NULL, role_id INT(10) UNSIGNED DEFAULT NULL,
@ -528,9 +528,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_profile_fields ( CREATE TABLE msz_profile_fields (
field_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, field_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
field_order INT(11) NOT NULL DEFAULT 0, field_order INT(11) NOT NULL DEFAULT 0,
@ -541,15 +541,15 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
UNIQUE KEY profile_fields_key_unique (field_key), UNIQUE KEY profile_fields_key_unique (field_key),
KEY profile_fields_order_key (field_order) KEY profile_fields_order_key (field_order)
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_profile_fields_formats ( CREATE TABLE msz_profile_fields_formats (
format_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, format_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
field_id INT(10) UNSIGNED NOT NULL DEFAULT 0, field_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
format_regex VARCHAR(255) DEFAULT NULL, format_regex VARCHAR(255) DEFAULT NULL,
format_link VARCHAR(255) DEFAULT NULL, format_link VARCHAR(255) DEFAULT NULL,
format_display VARCHAR(255) NOT NULL DEFAULT \'%s\', format_display VARCHAR(255) NOT NULL DEFAULT '%s',
PRIMARY KEY (format_id), PRIMARY KEY (format_id),
KEY profile_field_format_field_foreign (field_id), KEY profile_field_format_field_foreign (field_id),
CONSTRAINT profile_field_format_field_foreign CONSTRAINT profile_field_format_field_foreign
@ -558,9 +558,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_profile_fields_values ( CREATE TABLE msz_profile_fields_values (
field_id INT(10) UNSIGNED NOT NULL, field_id INT(10) UNSIGNED NOT NULL,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -586,9 +586,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_sessions ( CREATE TABLE msz_sessions (
session_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, session_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -596,7 +596,7 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
session_ip VARBINARY(16) NOT NULL, session_ip VARBINARY(16) NOT NULL,
session_ip_last VARBINARY(16) DEFAULT NULL, session_ip_last VARBINARY(16) DEFAULT NULL,
session_user_agent VARCHAR(255) NOT NULL, session_user_agent VARCHAR(255) NOT NULL,
session_country CHAR(2) NOT NULL DEFAULT \'XX\', session_country CHAR(2) NOT NULL DEFAULT 'XX',
session_expires TIMESTAMP NOT NULL DEFAULT (current_timestamp() + INTERVAL 1 MONTH), session_expires TIMESTAMP NOT NULL DEFAULT (current_timestamp() + INTERVAL 1 MONTH),
session_expires_bump TINYINT(3) UNSIGNED NOT NULL DEFAULT 1, session_expires_bump TINYINT(3) UNSIGNED NOT NULL DEFAULT 1,
session_created TIMESTAMP NOT NULL DEFAULT current_timestamp(), session_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
@ -612,9 +612,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_users_password_resets ( CREATE TABLE msz_users_password_resets (
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
reset_ip VARBINARY(16) NOT NULL, reset_ip VARBINARY(16) NOT NULL,
@ -629,9 +629,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_user_roles ( CREATE TABLE msz_user_roles (
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
role_id INT(10) UNSIGNED NOT NULL, role_id INT(10) UNSIGNED NOT NULL,
@ -648,9 +648,9 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_user_warnings ( CREATE TABLE msz_user_warnings (
warning_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, warning_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -680,6 +680,6 @@ final class InitialStructureNdx_20230107_023235 implements DbMigration {
ON DELETE CASCADE ON DELETE CASCADE
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
} }
} }

View file

@ -4,7 +4,7 @@ use Index\Db\Migration\DbMigration;
final class CreateTopicRedirsTable_20230430_001226 implements DbMigration { final class CreateTopicRedirsTable_20230430_001226 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_forum_topics_redirects ( CREATE TABLE msz_forum_topics_redirects (
topic_id INT(10) UNSIGNED NOT NULL, topic_id INT(10) UNSIGNED NOT NULL,
user_id INT(10) UNSIGNED NULL DEFAULT NULL, user_id INT(10) UNSIGNED NULL DEFAULT NULL,
@ -18,6 +18,6 @@ final class CreateTopicRedirsTable_20230430_001226 implements DbMigration {
ON DELETE SET NULL ON DELETE SET NULL
ON UPDATE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
} }
} }

View file

@ -6,16 +6,16 @@ use Misuzu\ClientInfo;
final class UpdateUserAgentStorage_20230721_121854 implements DbMigration { final class UpdateUserAgentStorage_20230721_121854 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
// convert user agent fields to BLOB and add field for client info storage // convert user agent fields to BLOB and add field for client info storage
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_login_attempts ALTER TABLE msz_login_attempts
CHANGE COLUMN attempt_user_agent attempt_user_agent TEXT NOT NULL COLLATE "utf8mb4_bin" AFTER attempt_created, CHANGE COLUMN attempt_user_agent attempt_user_agent TEXT NOT NULL COLLATE 'utf8mb4_bin' AFTER attempt_created,
ADD COLUMN attempt_client_info TEXT NULL DEFAULT NULL AFTER attempt_user_agent ADD COLUMN attempt_client_info TEXT NULL DEFAULT NULL AFTER attempt_user_agent
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_sessions ALTER TABLE msz_sessions
CHANGE column session_user_agent session_user_agent TEXT NOT NULL COLLATE "utf8mb4_bin" AFTER session_ip_last, CHANGE column session_user_agent session_user_agent TEXT NOT NULL COLLATE 'utf8mb4_bin' AFTER session_ip_last,
ADD COLUMN session_client_info TEXT NULL DEFAULT NULL AFTER session_user_agent ADD COLUMN session_client_info TEXT NULL DEFAULT NULL AFTER session_user_agent
'); SQL);
// make sure all existing fields have client info fields filled // make sure all existing fields have client info fields filled
$updateLoginAttempts = $conn->prepare('UPDATE msz_login_attempts SET attempt_client_info = ? WHERE attempt_user_agent = ?'); $updateLoginAttempts = $conn->prepare('UPDATE msz_login_attempts SET attempt_client_info = ? WHERE attempt_user_agent = ?');
@ -39,13 +39,13 @@ final class UpdateUserAgentStorage_20230721_121854 implements DbMigration {
} }
// make client info fields NOT NULL // make client info fields NOT NULL
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_login_attempts ALTER TABLE msz_login_attempts
CHANGE COLUMN attempt_client_info attempt_client_info TEXT NOT NULL COLLATE "utf8mb4_bin" AFTER attempt_user_agent CHANGE COLUMN attempt_client_info attempt_client_info TEXT NOT NULL COLLATE 'utf8mb4_bin' AFTER attempt_user_agent
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_sessions ALTER TABLE msz_sessions
CHANGE COLUMN session_client_info session_client_info TEXT NOT NULL COLLATE "utf8mb4_bin" AFTER session_user_agent CHANGE COLUMN session_client_info session_client_info TEXT NOT NULL COLLATE 'utf8mb4_bin' AFTER session_user_agent
'); SQL);
} }
} }

View file

@ -4,7 +4,7 @@ use Index\Db\Migration\DbMigration;
final class AddModeratorNotesTable_20230724_201010 implements DbMigration { final class AddModeratorNotesTable_20230724_201010 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_users_modnotes ( CREATE TABLE msz_users_modnotes (
note_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, note_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -27,15 +27,15 @@ final class AddModeratorNotesTable_20230724_201010 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
// migrate existing notes // migrate existing notes
$conn->execute(' $conn->execute(<<<SQL
INSERT INTO msz_users_modnotes (user_id, author_id, note_created, note_title, note_body) INSERT INTO msz_users_modnotes (user_id, author_id, note_created, note_title, note_body)
SELECT user_id, issuer_id, warning_created, warning_note, COALESCE(warning_note_private, "") SELECT user_id, issuer_id, warning_created, warning_note, COALESCE(warning_note_private, '')
FROM msz_user_warnings FROM msz_user_warnings
WHERE warning_type = 0 WHERE warning_type = 0
'); SQL);
// delete notes from the warnings table // delete notes from the warnings table
$conn->execute('DELETE FROM msz_user_warnings WHERE warning_type = 0'); $conn->execute('DELETE FROM msz_user_warnings WHERE warning_type = 0');

View file

@ -4,7 +4,7 @@ use Index\Db\Migration\DbMigration;
final class AddNewBansTable_20230726_175936 implements DbMigration { final class AddNewBansTable_20230726_175936 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_users_bans ( CREATE TABLE msz_users_bans (
ban_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, ban_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -31,14 +31,14 @@ final class AddNewBansTable_20230726_175936 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
INSERT INTO msz_users_bans (user_id, mod_id, ban_severity, ban_reason_public, ban_reason_private, ban_created, ban_expires) INSERT INTO msz_users_bans (user_id, mod_id, ban_severity, ban_reason_public, ban_reason_private, ban_created, ban_expires)
SELECT user_id, issuer_id, 0, warning_note, COALESCE(warning_note_private, ""), warning_created, warning_duration SELECT user_id, issuer_id, 0, warning_note, COALESCE(warning_note_private, ""), warning_created, warning_duration
FROM msz_user_warnings FROM msz_user_warnings
WHERE warning_type = 3 WHERE warning_type = 3
'); SQL);
$conn->execute('DELETE FROM msz_user_warnings WHERE warning_type = 3'); $conn->execute('DELETE FROM msz_user_warnings WHERE warning_type = 3');
} }

View file

@ -4,7 +4,7 @@ use Index\Db\Migration\DbMigration;
final class RedoWarningsTable_20230726_210150 implements DbMigration { final class RedoWarningsTable_20230726_210150 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_users_warnings ( CREATE TABLE msz_users_warnings (
warn_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, warn_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_id INT(10) UNSIGNED NOT NULL, user_id INT(10) UNSIGNED NOT NULL,
@ -26,16 +26,16 @@ final class RedoWarningsTable_20230726_210150 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
// migrate existing warnings, public and private note have been merged but that's fine in prod // migrate existing warnings, public and private note have been merged but that's fine in prod
// still specifying type = 1 as well even though that should be the only type remaining // still specifying type = 1 as well even though that should be the only type remaining
$conn->execute(' $conn->execute(<<<SQL
INSERT INTO msz_users_warnings (user_id, mod_id, warn_body, warn_created) INSERT INTO msz_users_warnings (user_id, mod_id, warn_body, warn_created)
SELECT user_id, issuer_id, TRIM(CONCAT(COALESCE(warning_note, ""), "\n", COALESCE(warning_note_private, ""))), warning_created SELECT user_id, issuer_id, TRIM(CONCAT(COALESCE(warning_note, ''), "\n", COALESCE(warning_note_private, ''))), warning_created
FROM msz_user_warnings FROM msz_user_warnings
WHERE warning_type = 1 WHERE warning_type = 1
'); SQL);
// drop the old table with non-plural "user" // drop the old table with non-plural "user"
$conn->execute('DROP TABLE msz_user_warnings'); $conn->execute('DROP TABLE msz_user_warnings');

View file

@ -4,13 +4,13 @@ use Index\Db\Migration\DbMigration;
final class CreateCountersTable_20230728_212101 implements DbMigration { final class CreateCountersTable_20230728_212101 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_counters ( CREATE TABLE msz_counters (
counter_name VARBINARY(64) NOT NULL, counter_name VARBINARY(64) NOT NULL,
counter_value BIGINT(20) NOT NULL DEFAULT "0", counter_value BIGINT(20) NOT NULL DEFAULT '0',
counter_updated TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), counter_updated TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (counter_name) PRIMARY KEY (counter_name)
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
} }
} }

View file

@ -4,159 +4,159 @@ use Index\Db\Migration\DbMigration;
final class UpdateCollationsInVariousTables_20230803_114403 implements DbMigration { final class UpdateCollationsInVariousTables_20230803_114403 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_audit_log ALTER TABLE msz_audit_log
CHANGE COLUMN log_action log_action VARCHAR(50) NOT NULL COLLATE "ascii_general_ci" AFTER user_id, CHANGE COLUMN log_action log_action VARCHAR(50) NOT NULL COLLATE 'ascii_general_ci' AFTER user_id,
CHANGE COLUMN log_country log_country CHAR(2) NOT NULL DEFAULT "XX" COLLATE "ascii_general_ci" AFTER log_ip; CHANGE COLUMN log_country log_country CHAR(2) NOT NULL DEFAULT 'XX' COLLATE 'ascii_general_ci' AFTER log_ip;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_auth_tfa ALTER TABLE msz_auth_tfa
CHANGE COLUMN tfa_token tfa_token CHAR(32) NOT NULL COLLATE "ascii_bin" AFTER user_id; CHANGE COLUMN tfa_token tfa_token CHAR(32) NOT NULL COLLATE 'ascii_bin' AFTER user_id;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_changelog_changes ALTER TABLE msz_changelog_changes
CHANGE COLUMN change_log change_log VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER change_created, CHANGE COLUMN change_log change_log VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER change_created,
CHANGE COLUMN change_text change_text TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER change_log; CHANGE COLUMN change_text change_text TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER change_log;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_changelog_tags ALTER TABLE msz_changelog_tags
CHANGE COLUMN tag_name tag_name VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER tag_id, CHANGE COLUMN tag_name tag_name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER tag_id,
CHANGE COLUMN tag_description tag_description TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER tag_name; CHANGE COLUMN tag_description tag_description TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER tag_name;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_comments_categories ALTER TABLE msz_comments_categories
CHANGE COLUMN category_name category_name VARCHAR(255) NOT NULL COLLATE "ascii_bin" AFTER category_id; CHANGE COLUMN category_name category_name VARCHAR(255) NOT NULL COLLATE 'ascii_bin' AFTER category_id;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_comments_posts ALTER TABLE msz_comments_posts
CHANGE COLUMN comment_text comment_text TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER comment_reply_to; CHANGE COLUMN comment_text comment_text TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER comment_reply_to;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_config ALTER TABLE msz_config
CHANGE COLUMN config_name config_name VARCHAR(100) NOT NULL COLLATE "ascii_general_ci" FIRST; CHANGE COLUMN config_name config_name VARCHAR(100) NOT NULL COLLATE 'ascii_general_ci' FIRST;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_emoticons ALTER TABLE msz_emoticons
CHANGE COLUMN emote_url emote_url VARCHAR(255) NOT NULL COLLATE "ascii_bin" AFTER emote_hierarchy; CHANGE COLUMN emote_url emote_url VARCHAR(255) NOT NULL COLLATE 'ascii_bin' AFTER emote_hierarchy;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_emoticons_strings ALTER TABLE msz_emoticons_strings
CHANGE COLUMN emote_string emote_string VARCHAR(50) NOT NULL COLLATE "ascii_general_ci" AFTER emote_string_order; CHANGE COLUMN emote_string emote_string VARCHAR(50) NOT NULL COLLATE 'ascii_general_ci' AFTER emote_string_order;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_forum_categories ALTER TABLE msz_forum_categories
CHANGE COLUMN forum_name forum_name VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER forum_parent, CHANGE COLUMN forum_name forum_name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER forum_parent,
CHANGE COLUMN forum_description forum_description TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER forum_type, CHANGE COLUMN forum_description forum_description TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER forum_type,
CHANGE COLUMN forum_icon forum_icon VARCHAR(50) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER forum_description, CHANGE COLUMN forum_icon forum_icon VARCHAR(50) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER forum_description,
CHANGE COLUMN forum_link forum_link VARCHAR(255) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER forum_colour; CHANGE COLUMN forum_link forum_link VARCHAR(255) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER forum_colour;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_forum_posts ALTER TABLE msz_forum_posts
CHANGE COLUMN post_text post_text MEDIUMTEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER post_ip; CHANGE COLUMN post_text post_text MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER post_ip;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_forum_topics ALTER TABLE msz_forum_topics
CHANGE COLUMN topic_title topic_title VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER topic_type; CHANGE COLUMN topic_title topic_title VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER topic_type;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_forum_topics_redirects ALTER TABLE msz_forum_topics_redirects
CHANGE COLUMN topic_redir_url topic_redir_url VARCHAR(255) NOT NULL COLLATE "ascii_bin" AFTER user_id; CHANGE COLUMN topic_redir_url topic_redir_url VARCHAR(255) NOT NULL COLLATE 'ascii_bin' AFTER user_id;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_login_attempts ALTER TABLE msz_login_attempts
CHANGE COLUMN attempt_country attempt_country CHAR(2) NOT NULL DEFAULT "XX" COLLATE "ascii_general_ci" AFTER attempt_ip, CHANGE COLUMN attempt_country attempt_country CHAR(2) NOT NULL DEFAULT 'XX' COLLATE 'ascii_general_ci' AFTER attempt_ip,
CHANGE COLUMN attempt_user_agent attempt_user_agent TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER attempt_created; CHANGE COLUMN attempt_user_agent attempt_user_agent TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER attempt_created;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_news_categories ALTER TABLE msz_news_categories
CHANGE COLUMN category_name category_name VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER category_id, CHANGE COLUMN category_name category_name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER category_id,
CHANGE COLUMN category_description category_description TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER category_name; CHANGE COLUMN category_description category_description TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER category_name;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_news_posts ALTER TABLE msz_news_posts
CHANGE COLUMN post_title post_title VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER post_is_featured, CHANGE COLUMN post_title post_title VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER post_is_featured,
CHANGE COLUMN post_text post_text TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER post_title; CHANGE COLUMN post_text post_text TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER post_title;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_profile_fields ALTER TABLE msz_profile_fields
CHANGE COLUMN field_key field_key VARCHAR(50) NOT NULL COLLATE "ascii_general_ci" AFTER field_order, CHANGE COLUMN field_key field_key VARCHAR(50) NOT NULL COLLATE 'ascii_general_ci' AFTER field_order,
CHANGE COLUMN field_title field_title VARCHAR(50) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER field_key, CHANGE COLUMN field_title field_title VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER field_key,
CHANGE COLUMN field_regex field_regex VARCHAR(255) NOT NULL COLLATE "ascii_bin" AFTER field_title; CHANGE COLUMN field_regex field_regex VARCHAR(255) NOT NULL COLLATE 'ascii_bin' AFTER field_title;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_profile_fields_formats ALTER TABLE msz_profile_fields_formats
CHANGE COLUMN format_regex format_regex VARCHAR(255) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER field_id, CHANGE COLUMN format_regex format_regex VARCHAR(255) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER field_id,
CHANGE COLUMN format_link format_link VARCHAR(255) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER format_regex, CHANGE COLUMN format_link format_link VARCHAR(255) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER format_regex,
CHANGE COLUMN format_display format_display VARCHAR(255) NOT NULL DEFAULT "%s" COLLATE "utf8mb4_unicode_520_ci" AFTER format_link; CHANGE COLUMN format_display format_display VARCHAR(255) NOT NULL DEFAULT '%s' COLLATE 'utf8mb4_unicode_520_ci' AFTER format_link;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_profile_fields_values ALTER TABLE msz_profile_fields_values
CHANGE COLUMN field_value field_value VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER format_id; CHANGE COLUMN field_value field_value VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER format_id;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_roles ALTER TABLE msz_roles
CHANGE COLUMN role_name role_name VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER role_hierarchy, CHANGE COLUMN role_name role_name VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER role_hierarchy,
CHANGE COLUMN role_title role_title VARCHAR(64) NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER role_name, CHANGE COLUMN role_title role_title VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER role_name,
CHANGE COLUMN role_description role_description TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER role_title; CHANGE COLUMN role_description role_description TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER role_title;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_sessions ALTER TABLE msz_sessions
CHANGE COLUMN session_user_agent session_user_agent TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER session_ip_last, CHANGE COLUMN session_user_agent session_user_agent TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER session_ip_last,
CHANGE COLUMN session_country session_country CHAR(2) NOT NULL DEFAULT "XX" COLLATE "ascii_general_ci" AFTER session_client_info; CHANGE COLUMN session_country session_country CHAR(2) NOT NULL DEFAULT 'XX' COLLATE 'ascii_general_ci' AFTER session_client_info;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_users ALTER TABLE msz_users
CHANGE COLUMN username username VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER user_id, CHANGE COLUMN username username VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER user_id,
CHANGE COLUMN password password VARCHAR(255) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER username, CHANGE COLUMN password password VARCHAR(255) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER username,
CHANGE COLUMN email email VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER password, CHANGE COLUMN email email VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER password,
CHANGE COLUMN user_country user_country CHAR(2) NOT NULL DEFAULT "XX" COLLATE "ascii_general_ci" AFTER user_super, CHANGE COLUMN user_country user_country CHAR(2) NOT NULL DEFAULT 'XX' COLLATE 'ascii_general_ci' AFTER user_super,
CHANGE COLUMN user_totp_key user_totp_key CHAR(26) NULL DEFAULT NULL COLLATE "ascii_bin" AFTER display_role, CHANGE COLUMN user_totp_key user_totp_key CHAR(26) NULL DEFAULT NULL COLLATE 'ascii_bin' AFTER display_role,
CHANGE COLUMN user_about_content user_about_content TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER user_totp_key, CHANGE COLUMN user_about_content user_about_content TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER user_totp_key,
CHANGE COLUMN user_signature_content user_signature_content TEXT NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER user_about_parser, CHANGE COLUMN user_signature_content user_signature_content TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER user_about_parser,
CHANGE COLUMN user_title user_title VARCHAR(64) NULL DEFAULT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER user_background_settings; CHANGE COLUMN user_title user_title VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER user_background_settings;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_users_bans ALTER TABLE msz_users_bans
CHANGE COLUMN ban_reason_public ban_reason_public TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER ban_severity, CHANGE COLUMN ban_reason_public ban_reason_public TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER ban_severity,
CHANGE COLUMN ban_reason_private ban_reason_private TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER ban_reason_public; CHANGE COLUMN ban_reason_private ban_reason_private TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER ban_reason_public;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_users_modnotes ALTER TABLE msz_users_modnotes
CHANGE COLUMN note_title note_title VARCHAR(255) NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER note_created, CHANGE COLUMN note_title note_title VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER note_created,
CHANGE COLUMN note_body note_body TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER note_title; CHANGE COLUMN note_body note_body TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER note_title;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_users_password_resets ALTER TABLE msz_users_password_resets
CHANGE COLUMN verification_code verification_code CHAR(12) NULL DEFAULT NULL COLLATE "ascii_general_ci" AFTER reset_requested; CHANGE COLUMN verification_code verification_code CHAR(12) NULL DEFAULT NULL COLLATE 'ascii_general_ci' AFTER reset_requested;
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_users_warnings ALTER TABLE msz_users_warnings
CHANGE COLUMN warn_body warn_body TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci" AFTER mod_id; CHANGE COLUMN warn_body warn_body TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci' AFTER mod_id;
'); SQL);
} }
} }

View file

@ -7,7 +7,7 @@ final class NewPermissionsSystem_20230830_213930 implements DbMigration {
// make sure cron doesn't fuck us over // make sure cron doesn't fuck us over
$conn->execute('DELETE FROM msz_config WHERE config_name = "perms.needsRecalc"'); $conn->execute('DELETE FROM msz_config WHERE config_name = "perms.needsRecalc"');
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_perms ( CREATE TABLE msz_perms (
user_id INT(10) UNSIGNED NULL DEFAULT NULL, user_id INT(10) UNSIGNED NULL DEFAULT NULL,
role_id INT(10) UNSIGNED NULL DEFAULT NULL, role_id INT(10) UNSIGNED NULL DEFAULT NULL,
@ -36,15 +36,15 @@ final class NewPermissionsSystem_20230830_213930 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_perms ALTER TABLE msz_perms
ADD CONSTRAINT perms_53bit ADD CONSTRAINT perms_53bit
CHECK (perms_allow >= 0 AND perms_deny >= 0 AND perms_allow <= 9007199254740991 AND perms_deny <= 9007199254740991) CHECK (perms_allow >= 0 AND perms_deny >= 0 AND perms_allow <= 9007199254740991 AND perms_deny <= 9007199254740991)
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_perms_calculated ( CREATE TABLE msz_perms_calculated (
user_id INT(10) UNSIGNED NULL DEFAULT NULL, user_id INT(10) UNSIGNED NULL DEFAULT NULL,
forum_id INT(10) UNSIGNED NULL DEFAULT NULL, forum_id INT(10) UNSIGNED NULL DEFAULT NULL,
@ -65,21 +65,34 @@ final class NewPermissionsSystem_20230830_213930 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE CASCADE ON DELETE CASCADE
) ENGINE=InnoDB COLLATE=utf8mb4_bin ) ENGINE=InnoDB COLLATE=utf8mb4_bin
'); SQL);
$conn->execute(' $conn->execute(<<<SQL
ALTER TABLE msz_perms_calculated ALTER TABLE msz_perms_calculated
ADD CONSTRAINT perms_calculated_53bit ADD CONSTRAINT perms_calculated_53bit
CHECK (perms_calculated >= 0 AND perms_calculated <= 9007199254740991) CHECK (perms_calculated >= 0 AND perms_calculated <= 9007199254740991)
'); SQL);
$insert = $conn->prepare('INSERT INTO msz_perms (user_id, role_id, forum_id, perms_category, perms_allow, perms_deny) VALUES (?, ?, ?, ?, ?, ?)'); $insert = $conn->prepare(<<<SQL
INSERT INTO msz_perms (
user_id, role_id, forum_id, perms_category, perms_allow, perms_deny
) VALUES (?, ?, ?, ?, ?, ?)
SQL);
$result = $conn->query('SELECT user_id, role_id, general_perms_allow, general_perms_deny, user_perms_allow, user_perms_deny, changelog_perms_allow, changelog_perms_deny, news_perms_allow, news_perms_deny, forum_perms_allow, forum_perms_deny, comments_perms_allow, comments_perms_deny FROM msz_permissions'); $result = $conn->query(<<<SQL
SELECT user_id, role_id,
general_perms_allow, general_perms_deny,
user_perms_allow, user_perms_deny,
changelog_perms_allow, changelog_perms_deny,
news_perms_allow, news_perms_deny,
forum_perms_allow, forum_perms_deny,
comments_perms_allow, comments_perms_deny
FROM msz_permissions
SQL);
while($result->next()) { while($result->next()) {
$insert->reset(); $insert->reset();
$insert->nextParameter($result->isNull(0) ? null : $result->getString(0)); $insert->nextParameter($result->getStringOrNull(0));
$insert->nextParameter($result->isNull(1) ? null : $result->getString(1)); $insert->nextParameter($result->getStringOrNull(1));
$insert->nextParameter(null); $insert->nextParameter(null);
$insert->nextParameter('user'); $insert->nextParameter('user');
$insert->nextParameter($result->getInteger(4)); $insert->nextParameter($result->getInteger(4));
@ -104,11 +117,15 @@ final class NewPermissionsSystem_20230830_213930 implements DbMigration {
$insert->execute(); $insert->execute();
} }
$result = $conn->query('SELECT user_id, role_id, forum_id, forum_perms_allow, forum_perms_deny FROM msz_forum_permissions'); $result = $conn->query(<<<SQL
SELECT user_id, role_id, forum_id,
forum_perms_allow, forum_perms_deny
FROM msz_forum_permissions
SQL);
while($result->next()) { while($result->next()) {
$insert->reset(); $insert->reset();
$insert->nextParameter($result->isNull(0) ? null : $result->getString(0)); $insert->nextParameter($result->getStringOrNull(0));
$insert->nextParameter($result->isNull(1) ? null : $result->getString(1)); $insert->nextParameter($result->getStringOrNull(1));
$insert->nextParameter($result->getString(2)); $insert->nextParameter($result->getString(2));
$insert->nextParameter('forum'); $insert->nextParameter('forum');
$insert->nextParameter($result->getInteger(3)); $insert->nextParameter($result->getInteger(3));

View file

@ -4,20 +4,20 @@ use Index\Db\Migration\DbMigration;
final class CreateMessagesTable_20240130_233734 implements DbMigration { final class CreateMessagesTable_20240130_233734 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute(' $conn->execute(<<<SQL
CREATE TABLE msz_messages ( CREATE TABLE msz_messages (
msg_id BINARY(8) NOT NULL, msg_id BINARY(8) NOT NULL,
msg_owner_id INT(10) UNSIGNED NOT NULL, msg_owner_id INT(10) UNSIGNED NOT NULL,
msg_author_id INT(10) UNSIGNED NULL DEFAULT NULL, msg_author_id INT(10) UNSIGNED NULL DEFAULT NULL,
msg_recipient_id INT(10) UNSIGNED NULL DEFAULT NULL, msg_recipient_id INT(10) UNSIGNED NULL DEFAULT NULL,
msg_reply_to BINARY(8) NULL DEFAULT NULL, msg_reply_to BINARY(8) NULL DEFAULT NULL,
msg_title TINYTEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci", msg_title TINYTEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci',
msg_body TEXT NOT NULL COLLATE "utf8mb4_unicode_520_ci", msg_body TEXT NOT NULL COLLATE 'utf8mb4_unicode_520_ci',
msg_parser TINYINT(3) UNSIGNED NOT NULL, msg_parser TINYINT(3) UNSIGNED NOT NULL,
msg_created TIMESTAMP NOT NULL DEFAULT current_timestamp(), msg_created TIMESTAMP NOT NULL DEFAULT current_timestamp(),
msg_sent TIMESTAMP NULL DEFAULT NULL, msg_sent TIMESTAMP NULL DEFAULT NULL,
msg_read TIMESTAMP NULL DEFAULT NULL, msg_read TIMESTAMP NULL DEFAULT NULL,
msg_deleted TIMESTAMP NULL DEFAULT NULL, msg_deleted TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (msg_id, msg_owner_id), PRIMARY KEY (msg_id, msg_owner_id),
KEY messages_owner_foreign (msg_owner_id), KEY messages_owner_foreign (msg_owner_id),
KEY messages_author_foreign (msg_author_id), KEY messages_author_foreign (msg_author_id),
@ -43,6 +43,6 @@ final class CreateMessagesTable_20240130_233734 implements DbMigration {
ON UPDATE CASCADE ON UPDATE CASCADE
ON DELETE SET NULL ON DELETE SET NULL
) ENGINE=InnoDB COLLATE=utf8mb4_bin; ) ENGINE=InnoDB COLLATE=utf8mb4_bin;
'); SQL);
} }
} }

View file

@ -4,11 +4,15 @@ use Index\Db\Migration\DbMigration;
final class BaseSixtyFourEncodePmsInDb_20240602_194809 implements DbMigration { final class BaseSixtyFourEncodePmsInDb_20240602_194809 implements DbMigration {
public function migrate(DbConnection $conn): void { public function migrate(DbConnection $conn): void {
$conn->execute('UPDATE msz_messages SET msg_title = TO_BASE64(msg_title), msg_body = TO_BASE64(msg_body)'); $conn->execute(<<<SQL
$conn->execute(' UPDATE msz_messages
ALTER TABLE `msz_messages` SET msg_title = TO_BASE64(msg_title),
CHANGE COLUMN `msg_title` `msg_title` TINYBLOB NOT NULL AFTER `msg_reply_to`, msg_body = TO_BASE64(msg_body)
CHANGE COLUMN `msg_body` `msg_body` BLOB NOT NULL AFTER `msg_title`; SQL);
'); $conn->execute(<<<SQL
ALTER TABLE msz_messages
CHANGE COLUMN msg_title msg_title TINYBLOB NOT NULL AFTER msg_reply_to,
CHANGE COLUMN msg_body msg_body BLOB NOT NULL AFTER msg_title;
SQL);
} }
} }

View file

@ -38,7 +38,10 @@ if($env->hasValues('sentry:dsn'))
})($env->scopeTo('sentry')); })($env->scopeTo('sentry'));
$db = DbBackends::create($env->getString('database:dsn', 'null:')); $db = DbBackends::create($env->getString('database:dsn', 'null:'));
$db->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';'); $db->execute(<<<SQL
SET SESSION time_zone = '+00:00',
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
SQL);
$cfg = new DbConfig($db, 'msz_config'); $cfg = new DbConfig($db, 'msz_config');

View file

@ -157,7 +157,7 @@ switch($commentMode) {
: 0; : 0;
$categoryInfo = $msz->comments->getCategory(categoryId: (string)$categoryId); $categoryInfo = $msz->comments->getCategory(categoryId: (string)$categoryId);
} catch(RuntimeException $ex) { } catch(RuntimeException $ex) {
Template::displayInfo('This comment category doesn\'t exist.', 404); Template::displayInfo("This comment category doesn't exist.", 404);
} }
$canLock = $perms->check(Perm::G_COMMENTS_LOCK); $canLock = $perms->check(Perm::G_COMMENTS_LOCK);

View file

@ -36,7 +36,7 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
$userRank = $msz->usersCtx->users->getUserRank($currentUser); $userRank = $msz->usersCtx->users->getUserRank($currentUser);
if(!$isNew && !$currentUser->super && $roleInfo->rank >= $userRank) { if(!$isNew && !$currentUser->super && $roleInfo->rank >= $userRank) {
echo 'You aren\'t allowed to edit this role.'; echo "You aren't allowed to edit this role.";
break; break;
} }
@ -67,7 +67,7 @@ while($_SERVER['REQUEST_METHOD'] === 'POST' && CSRF::validateRequest()) {
]); ]);
if(!$currentUser->super && $roleRank >= $userRank) { if(!$currentUser->super && $roleRank >= $userRank) {
echo 'You aren\'t allowed to make a role with equal rank to your own.'; echo "You aren't allowed to make a role with equal rank to your own.";
break; break;
} }

View file

@ -52,7 +52,7 @@ if(CSRF::validateRequest() && $canEdit) {
if(!$canImpersonate) { if(!$canImpersonate) {
$notices[] = 'You must be a super user to do this.'; $notices[] = 'You must be a super user to do this.';
} elseif(!is_string($_POST['impersonate_user']) || $_POST['impersonate_user'] !== 'meow') { } elseif(!is_string($_POST['impersonate_user']) || $_POST['impersonate_user'] !== 'meow') {
$notices[] = 'You didn\'t say the magic word.'; $notices[] = "You didn't say the magic word!";
} else { } else {
$allowToImpersonate = $currentUser->super; $allowToImpersonate = $currentUser->super;
@ -71,7 +71,7 @@ if(CSRF::validateRequest() && $canEdit) {
AuthTokenCookie::apply($msz->authCtx->createAuthTokenPacker()->pack($tokenInfo)); AuthTokenCookie::apply($msz->authCtx->createAuthTokenPacker()->pack($tokenInfo));
Tools::redirect($msz->urls->format('index')); Tools::redirect($msz->urls->format('index'));
return; return;
} else $notices[] = 'You aren\'t allowed to impersonate this user.'; } else $notices[] = "You aren't allowed to impersonate this user.";
} }
} }
@ -147,7 +147,7 @@ if(CSRF::validateRequest() && $canEdit) {
$displayRole = (string)($_POST['user']['display_role'] ?? 0); $displayRole = (string)($_POST['user']['display_role'] ?? 0);
if(!$msz->usersCtx->users->hasRole($userInfo, $displayRole)) if(!$msz->usersCtx->users->hasRole($userInfo, $displayRole))
$notices[] = 'User does not have the role you\'re trying to assign as primary.'; $notices[] = "User does not have the role you're trying to assign as primary.";
$countryValidation = strlen($setCountry) === 2 $countryValidation = strlen($setCountry) === 2
&& ctype_alpha($setCountry) && ctype_alpha($setCountry)

View file

@ -109,13 +109,13 @@ if($isEditing) {
if(!empty($_POST)) { if(!empty($_POST)) {
if(!CSRF::validateRequest()) { if(!CSRF::validateRequest()) {
$notices[] = 'Couldn\'t verify you, please refresh the page and retry.'; $notices[] = "Couldn't verify you, please refresh the page and retry.";
} else { } else {
$profileFieldsSubmit = filter_input(INPUT_POST, 'profile', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY); $profileFieldsSubmit = filter_input(INPUT_POST, 'profile', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY);
if(!empty($profileFieldsSubmit)) { if(!empty($profileFieldsSubmit)) {
if(!$perms->edit_profile) { if(!$perms->edit_profile) {
$notices[] = 'You\'re not allowed to edit your profile'; $notices[] = "You're not allowed to edit your profile.";
} else { } else {
$profileFieldInfos = iterator_to_array($msz->profileCtx->fields->getFields()); $profileFieldInfos = iterator_to_array($msz->profileCtx->fields->getFields());
$profileFieldsSetInfos = []; $profileFieldsSetInfos = [];
@ -135,7 +135,7 @@ if($isEditing) {
$profileFieldsSetInfos[] = $fieldInfo; $profileFieldsSetInfos[] = $fieldInfo;
$profileFieldsSetValues[] = $fieldValue; $profileFieldsSetValues[] = $fieldValue;
} else } else
$notices[] = sprintf('%s isn\'t properly formatted.', $fieldInfo->title); $notices[] = sprintf("%s isn't properly formatted.", $fieldInfo->title);
unset($fieldName, $fieldValue, $fieldInfo); unset($fieldName, $fieldValue, $fieldInfo);
} }
@ -209,7 +209,7 @@ if($isEditing) {
$avatarAsset->delete(); $avatarAsset->delete();
} else { } else {
if(!$perms->edit_avatar) { if(!$perms->edit_avatar) {
$notices[] = 'You aren\'t allow to change your avatar.'; $notices[] = "You aren't allow to change your avatar.";
} elseif(!empty($_FILES['avatar']) } elseif(!empty($_FILES['avatar'])
&& is_array($_FILES['avatar']) && is_array($_FILES['avatar'])
&& !empty($_FILES['avatar']['name']['file'])) { && !empty($_FILES['avatar']['name']['file'])) {
@ -237,7 +237,7 @@ if($isEditing) {
$notices[] = match($exMessage) { $notices[] = match($exMessage) {
'$path is not a valid image.' => 'The file you uploaded was not an image!', '$path is not a valid image.' => 'The file you uploaded was not an image!',
'$path is not an allowed image file.' => 'This type of image is not supported, keep to PNG, JPG or GIF!', '$path is not an allowed image file.' => 'This type of image is not supported, keep to PNG, JPG or GIF!',
'Dimensions of $path are too large.' => sprintf('Your avatar can\'t be larger than %dx%d!', $avatarAsset->getMaxWidth(), $avatarAsset->getMaxHeight()), 'Dimensions of $path are too large.' => sprintf("Your avatar can't be larger than %dx%d!", $avatarAsset->getMaxWidth(), $avatarAsset->getMaxHeight()),
'File size of $path is too large.' => sprintf('Your avatar is not allowed to be larger in file size than %s!', ByteFormat::format($avatarAsset->getMaxBytes())), 'File size of $path is too large.' => sprintf('Your avatar is not allowed to be larger in file size than %s!', ByteFormat::format($avatarAsset->getMaxBytes())),
default => $exMessage, default => $exMessage,
}; };
@ -258,7 +258,7 @@ if($isEditing) {
$backgroundAsset = null; $backgroundAsset = null;
} else { } else {
if(!$perms->edit_background) { if(!$perms->edit_background) {
$notices[] = 'You aren\'t allow to change your background.'; $notices[] = "You aren't allow to change your background.";
} elseif(!empty($_FILES['bg_file']) && is_array($_FILES['bg_file'])) { } elseif(!empty($_FILES['bg_file']) && is_array($_FILES['bg_file'])) {
if(!empty($_FILES['bg_file']['name'])) { if(!empty($_FILES['bg_file']['name'])) {
if($_FILES['bg_file']['error'] !== UPLOAD_ERR_OK) { if($_FILES['bg_file']['error'] !== UPLOAD_ERR_OK) {
@ -285,7 +285,7 @@ if($isEditing) {
$notices[] = match($exMessage) { $notices[] = match($exMessage) {
'$path is not a valid image.' => 'The file you uploaded was not an image!', '$path is not a valid image.' => 'The file you uploaded was not an image!',
'$path is not an allowed image file.' => 'This type of image is not supported, keep to PNG, JPG or GIF!', '$path is not an allowed image file.' => 'This type of image is not supported, keep to PNG, JPG or GIF!',
'Dimensions of $path are too large.' => sprintf('Your background can\'t be larger than %dx%d!', $backgroundAsset->getMaxWidth(), $backgroundAsset->getMaxHeight()), 'Dimensions of $path are too large.' => sprintf("Your background can't be larger than %dx%d!", $backgroundAsset->getMaxWidth(), $backgroundAsset->getMaxHeight()),
'File size of $path is too large.' => sprintf('Your background is not allowed to be larger in file size than %s!', ByteFormat::format($backgroundAsset->getMaxBytes())), 'File size of $path is too large.' => sprintf('Your background is not allowed to be larger in file size than %s!', ByteFormat::format($backgroundAsset->getMaxBytes())),
default => $exMessage, default => $exMessage,
}; };

View file

@ -362,7 +362,7 @@ final class Perm {
//self::C_USER_SILENCE => 'Can silence other users.', //self::C_USER_SILENCE => 'Can silence other users.',
self::C_MESSAGE_BROADCAST => 'Can broadcast messages across all channels.', self::C_MESSAGE_BROADCAST => 'Can broadcast messages across all channels.',
self::C_NICK_SET_OWN => 'Can change own nickname.', self::C_NICK_SET_OWN => 'Can change own nickname.',
self::C_NICK_SET_ANY => 'Can change ANYONE\'s nickname.', self::C_NICK_SET_ANY => "Can change ANYONE's nickname.",
self::C_CHANNEL_CREATE => 'Can create channels.', self::C_CHANNEL_CREATE => 'Can create channels.',
self::C_CHANNEL_SET_PERSIST => 'Can set channels to persist after all users leave it.', self::C_CHANNEL_SET_PERSIST => 'Can set channels to persist after all users leave it.',
self::C_CHANNEL_SET_PASSWORD => 'Can set passwords for own channel.', self::C_CHANNEL_SET_PASSWORD => 'Can set passwords for own channel.',