2022-05-31 11:29:47 -06:00
< ? php
2024-03-09 03:19:55 -08:00
class DatabaseInitialiser
{
2022-06-01 21:28:51 +02:00
private DB $_db ;
2022-05-31 11:29:47 -06:00
private Cache $_cache ;
2024-03-09 03:19:55 -08:00
private function __construct ()
{
2022-06-01 21:28:51 +02:00
$this -> _db = DB :: getInstance ();
2023-05-09 20:05:29 +02:00
$this -> _cache = new Cache ([ 'name' => 'nameless' , 'extension' => '.cache' , 'path' => ROOT_PATH . '/cache/' ]);
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
public static function runPreUser ()
{
2022-06-13 02:21:21 +00:00
$instance = new self ();
2022-05-31 19:13:00 +01:00
$instance -> initialiseGroups ();
$instance -> initialiseLanguages ();
$instance -> initialiseModules ();
$instance -> initialiseIntegrations ();
$instance -> initialiseReactions ();
$instance -> initialiseSettings ();
2023-05-01 11:45:22 +01:00
$instance -> initialiseTasks ();
2022-05-31 19:13:00 +01:00
$instance -> initialiseTemplates ();
$instance -> initialiseWidgets ();
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
public static function runPostUser ()
{
2022-05-31 11:29:47 -06:00
$instance = new self ();
2022-05-31 19:13:00 +01:00
$instance -> initialiseForum ();
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
private function initialiseGroups () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'groups' , [
2022-05-31 11:29:47 -06:00
'name' => 'Member' ,
'group_html' => '<span class="badge badge-success">Member</span>' ,
2025-06-04 21:18:14 -07:00
'permissions' => '{"usercp.messaging":1,"usercp.signature":1,"usercp.nickname":1,"usercp.title":1,"usercp.private_profile":1,"usercp.profile_banner":1,"profile.post":1}' ,
2024-03-09 03:19:55 -08:00
'order' => 3 ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'groups' , [
2022-05-31 11:29:47 -06:00
'name' => 'Admin' ,
'group_html' => '<span class="badge badge-danger">Admin</span>' ,
'group_username_color' => '#ff0000' ,
'group_username_css' => '' ,
'admin_cp' => true ,
2025-06-04 21:18:14 -07:00
'permissions' => '{"administrator":1,"admincp.core":1,"admincp.core.api":1,"admincp.core.seo":1,"admincp.core.general":1,"admincp.core.avatars":1,"admincp.core.fields":1,"admincp.core.debugging":1,"admincp.core.emails":1,"admincp.core.queue":1,"admincp.core.navigation":1,"admincp.core.announcements":1,"admincp.core.reactions":1,"admincp.core.registration":1,"admincp.core.social_media":1,"admincp.core.terms":1,"admincp.errors":1,"admincp.core.placeholders":1,"admincp.members":1,"admincp.integrations":1,"admincp.integrations.edit":1,"admincp.discord":1,"admincp.minecraft":1,"admincp.minecraft.authme":1,"admincp.minecraft.servers":1,"admincp.minecraft.query_errors":1,"admincp.minecraft.banners":1,"admincp.modules":1,"admincp.pages":1,"admincp.security":1,"admincp.security.acp_logins":1,"admincp.security.template":1,"admincp.styles":1,"admincp.styles.panel_templates":1,"admincp.styles.templates":1,"admincp.styles.templates.edit":1,"admincp.styles.images":1,"admincp.update":1,"admincp.users":1,"admincp.users.edit":1,"admincp.groups":1,"admincp.groups.self":1,"admincp.widgets":1,"modcp.ip_lookup":1,"modcp.punishments":1,"modcp.punishments.warn":1,"modcp.punishments.ban":1,"modcp.punishments.banip":1,"modcp.punishments.revoke":1,"modcp.reports":1,"modcp.profile_banner_reset":1,"usercp.messaging":1,"usercp.signature":1,"admincp.forums":1,"usercp.private_profile":1,"usercp.nickname":1,"usercp.title":1,"usercp.profile_banner":1,"profile.private.bypass":1, "admincp.security.all":1,"admincp.core.hooks":1,"admincp.security.group_sync":1,"admincp.core.emails_mass_message":1,"modcp.punishments.reset_avatar":1,"usercp.gif_avatar":1,"profile.post":1}' ,
2022-05-31 11:29:47 -06:00
'order' => 1 ,
'staff' => true ,
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'groups' , [
2022-05-31 11:29:47 -06:00
'name' => 'Moderator' ,
'group_html' => '<span class="badge badge-primary">Moderator</span>' ,
'admin_cp' => true ,
2025-06-04 21:18:14 -07:00
'permissions' => '{"modcp.ip_lookup":1,"modcp.punishments":1,"modcp.punishments.warn":1,"modcp.punishments.ban":1,"modcp.punishments.banip":1,"modcp.punishments.revoke":1,"modcp.reports":1,"admincp.users":1,"modcp.profile_banner_reset":1,"usercp.messaging":1,"usercp.signature":1,"usercp.private_profile":1,"usercp.nickname":1,"usercp.title":1,"usercp.profile_banner":1,"profile.private.bypass":1,"profile.post":1}' ,
2022-05-31 11:29:47 -06:00
'order' => 2 ,
'staff' => true ,
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'groups' , [
2022-05-31 11:29:47 -06:00
'name' => 'Unconfirmed Member' ,
'group_html' => '<span class="badge badge-secondary">Unconfirmed Member</span>' ,
'group_username_color' => '#6c757d' ,
2022-06-02 23:40:36 -06:00
'permissions' => '{}' ,
2023-03-23 07:35:33 -07:00
'default_group' => true ,
2024-03-09 03:19:55 -08:00
'order' => 4 ,
2022-05-31 11:29:47 -06:00
]);
2023-03-07 08:26:53 -08:00
2023-06-12 10:30:49 -06:00
Settings :: set ( 'member_list_viewable_groups' , json_encode ([ 1 , 2 , 3 , 4 ]), 'Members' );
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
private function initialiseLanguages () : void
{
2022-05-31 11:29:47 -06:00
foreach ( Language :: LANGUAGES as $short_code => $meta ) {
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'languages' , [
2022-05-31 11:29:47 -06:00
'name' => $meta [ 'name' ],
'short_code' => $short_code ,
2024-03-09 03:19:55 -08:00
'is_default' => ( Session :: get ( 'default_language' ) == $short_code ) ? 1 : 0 ,
2022-05-31 11:29:47 -06:00
]);
}
$this -> _cache -> setCache ( 'languagecache' );
$this -> _cache -> store ( 'language' , Session :: get ( 'default_language' ));
}
2024-03-09 03:19:55 -08:00
private function initialiseModules () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'modules' , [
2022-05-31 11:29:47 -06:00
'name' => 'Core' ,
'enabled' => true ,
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'modules' , [
2022-05-31 11:29:47 -06:00
'name' => 'Forum' ,
'enabled' => true ,
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'modules' , [
2022-05-31 11:29:47 -06:00
'name' => 'Discord Integration' ,
'enabled' => true ,
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'modules' , [
2022-05-31 11:29:47 -06:00
'name' => 'Cookie Consent' ,
'enabled' => true ,
]);
2023-03-07 08:26:53 -08:00
$this -> _db -> insert ( 'modules' , [
'name' => 'Members' ,
'enabled' => true ,
]);
2022-05-31 11:29:47 -06:00
$this -> _cache -> setCache ( 'modulescache' );
$this -> _cache -> store ( 'enabled_modules' , [
[
'name' => 'Core' ,
2024-03-09 03:19:55 -08:00
'priority' => 1 ,
2022-05-31 11:29:47 -06:00
],
[
'name' => 'Forum' ,
2024-03-09 03:19:55 -08:00
'priority' => 4 ,
2022-05-31 11:29:47 -06:00
],
[
'name' => 'Discord Integration' ,
2024-03-09 03:19:55 -08:00
'priority' => 7 ,
2022-05-31 11:29:47 -06:00
],
[
'name' => 'Cookie Consent' ,
2024-03-09 03:19:55 -08:00
'priority' => 10 ,
2022-05-31 11:29:47 -06:00
],
2023-03-07 08:26:53 -08:00
[
'name' => 'Members' ,
2024-03-09 03:19:55 -08:00
'priority' => 13 ,
2023-03-07 08:26:53 -08:00
],
2022-05-31 11:29:47 -06:00
]);
$this -> _cache -> store ( 'module_core' , true );
$this -> _cache -> store ( 'module_forum' , true );
}
2024-03-09 03:19:55 -08:00
private function initialiseIntegrations () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'integrations' , [
2022-05-31 11:29:47 -06:00
'name' => 'Minecraft' ,
'enabled' => true ,
'can_unlink' => false ,
'required' => false ,
]);
// TODO: should this be in the DiscordIntegration module...?
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'integrations' , [
2022-05-31 11:29:47 -06:00
'name' => 'Discord' ,
'enabled' => true ,
'can_unlink' => true ,
2024-03-09 03:19:55 -08:00
'required' => false ,
2022-05-31 11:29:47 -06:00
]);
}
2024-03-09 03:19:55 -08:00
private function initialiseReactions () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'reactions' , [
2022-05-31 11:29:47 -06:00
'name' => 'Like' ,
2023-06-21 10:19:46 -07:00
'html' => '👍' ,
2022-05-31 11:29:47 -06:00
'enabled' => true ,
2023-06-21 10:19:46 -07:00
'type' => Reaction :: TYPE_POSITIVE ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'reactions' , [
2022-05-31 11:29:47 -06:00
'name' => 'Dislike' ,
2023-06-21 10:19:46 -07:00
'html' => '👎' ,
2022-05-31 11:29:47 -06:00
'enabled' => true ,
2023-06-21 10:19:46 -07:00
'type' => Reaction :: TYPE_NEGATIVE ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'reactions' , [
2022-05-31 11:29:47 -06:00
'name' => 'Meh' ,
2023-06-21 10:19:46 -07:00
'html' => '😐' ,
2022-05-31 11:29:47 -06:00
'enabled' => true ,
2023-06-21 10:19:46 -07:00
'type' => Reaction :: TYPE_NEUTRAL ,
]);
$this -> _db -> insert ( 'reactions' , [
'name' => 'Helpful' ,
'html' => '🛠️' ,
'enabled' => true ,
'type' => Reaction :: TYPE_POSITIVE ,
]);
$this -> _db -> insert ( 'reactions' , [
'name' => 'Creative' ,
'html' => '🌈' ,
'enabled' => true ,
'type' => Reaction :: TYPE_POSITIVE ,
]);
$this -> _db -> insert ( 'reactions' , [
'name' => 'Amazing' ,
'html' => '⭐' ,
'enabled' => true ,
'type' => Reaction :: TYPE_CUSTOM ,
'custom_score' => 5 ,
2022-05-31 11:29:47 -06:00
]);
}
2024-03-09 03:19:55 -08:00
private function initialiseSettings () : void
{
2023-06-12 10:30:49 -06:00
Settings :: set ( 'registration_enabled' , '1' );
Settings :: set ( 'displaynames' , '0' );
Settings :: set ( 'uuid_linking' , '1' );
Settings :: set ( 'recaptcha' , '0' );
Settings :: set ( 'recaptcha_type' , 'Recaptcha3' );
Settings :: set ( 'recaptcha_login' , '0' );
Settings :: set ( 'email_verification' , '1' );
2026-04-19 09:44:29 +01:00
Settings :: set ( 'nameless_version' , '2.2.5' );
2023-06-12 10:30:49 -06:00
Settings :: set ( 'version_checked' , date ( 'U' ));
Settings :: set ( 'phpmailer' , '0' );
2025-05-23 16:55:55 -07:00
Settings :: set ( 'custom_avatars' , '0' );
Settings :: set ( 'default_avatar_type' , 'minecraft' );
Settings :: set ( 'default_avatar_source' , 'cravatar' );
Settings :: set ( 'default_avatar_perspective' , 'face' );
Settings :: set ( 'default_avatar_image' , '' );
2023-06-12 10:30:49 -06:00
Settings :: set ( Settings :: MINECRAFT_INTEGRATION , '1' );
Settings :: set ( 'discord_integration' , '0' );
Settings :: set ( 'home_type' , 'news' );
Settings :: set ( 'forum_reactions' , '1' );
Settings :: set ( 'error_reporting' , '0' );
Settings :: set ( 'page_loading' , '0' );
Settings :: set ( 'unique_id' , substr ( str_shuffle ( '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ), 0 , 62 ));
Settings :: set ( 'use_api' , 0 );
Settings :: set ( 'mc_api_key' , SecureRandom :: alphanumeric ());
Settings :: set ( 'query_type' , 'internal' );
Settings :: set ( 'player_list_limit' , '20' );
Settings :: set ( 'timezone' , $_SESSION [ 'install_timezone' ]);
Settings :: set ( 'maintenance' , '0' );
Settings :: set ( 'maintenance_message' , 'This website is currently in maintenance mode.' );
Settings :: set ( 'private_profile' , '1' );
Settings :: set ( 'validate_user_action' , '{"action":"promote","group":1}' );
Settings :: set ( 'login_method' , 'email' );
Settings :: set ( 'username_sync' , '1' );
Settings :: set ( 'status_page' , '0' );
Settings :: set ( 'placeholders' , '0' );
2022-05-31 11:29:47 -06:00
2022-06-01 21:40:53 +02:00
$this -> _db -> insert ( 'privacy_terms' , [
'name' => 'terms' ,
2024-03-09 03:19:55 -08:00
'value' => '<p>You agree to be bound by our website rules and any laws which may apply to this website and your participation.</p><p>The website administration have the right to terminate your account at any time, delete any content you may have posted, and your IP address and any data you input to the website is recorded to assist the site staff with their moderation duties.</p><p>The site administration have the right to change these terms and conditions, and any site rules, at any point without warning. Whilst you may be informed of any changes, it is your responsibility to check these terms and the rules at any point.</p>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:40:53 +02:00
$this -> _db -> insert ( 'privacy_terms' , [
'name' => 'cookies' ,
2024-03-09 03:19:55 -08:00
'value' => '<span style="font-size:18px"><strong>What are cookies?</strong></span><br />Cookies are small files which are stored on your device by a website, unique to your web browser. The web browser will send these files to the website each time it communicates with the website.<br />Cookies are used by this website for a variety of reasons which are outlined below.<br /><br /><strong>Necessary cookies</strong><br />Necessary cookies are required for this website to function. These are used by the website to maintain your session, allowing for you to submit any forms, log into the website amongst other essential behaviour. It is not possible to disable these within the website, however you can disable cookies altogether via your browser.<br /><br /><strong>Functional cookies</strong><br />Functional cookies allow for the website to work as you choose. For example, enabling the "Remember Me" option as you log in will create a functional cookie to automatically log you in on future visits.<br /><br /><strong>Analytical cookies</strong><br />Analytical cookies allow both this website, and any third party services used by this website, to collect non-personally identifiable data about the user. This allows us (the website staff) to continue to improve the user experience and understand how the website is used.<br /><br />Further information about cookies can be found online, including the <a rel="nofollow noopener" target="_blank" href="https://ico.org.uk/your-data-matters/online/cookies/">ICO's website</a> which contains useful links to further documentation about configuring your browser.<br /><br /><span style="font-size:18px"><strong>Configuring cookie use</strong></span><br />By default, only necessary cookies are used by this website. However, some website functionality may be unavailable until the use of cookies has been opted into.<br />You can opt into, or continue to disallow, the use of cookies using the cookie notice popup on this website. If you would like to update your preference, the cookie notice popup can be re-enabled by clicking the button below.' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'privacy_terms' , [
2022-05-31 11:29:47 -06:00
'name' => 'privacy' ,
2024-03-09 03:19:55 -08:00
'value' => 'The following privacy policy outlines how your data is used on our website.<br /><br /><strong>Data</strong><br />Basic non-identifiable information about your user on the website is collected; the majority of which is provided during registration, such as email addresses and usernames.<br />In addition to this, IP addresses for registered users are stored within the system to aid with moderation duties. This includes spam prevention, and detecting alternative accounts.<br /><br />Accounts can be deleted by a site administrator upon request, which will remove all data relating to your user from our system.<br /><br /><strong>Cookies</strong><br />Cookies are used to store small pieces of non-identifiable information with your consent. In order to consent to the use of cookies, you must either close the cookie notice (as explained within the notice) or register on our website.<br />Data stored by cookies include any recently viewed topic IDs, along with a unique, unidentifiable hash upon logging in and selecting "Remember Me" to automatically log you in next time you visit.' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:40:53 +02:00
$nameless_terms = 'This website uses "Nameless" website software. The ' .
'"Nameless" software creators will not be held responsible for any content ' .
'that may be experienced whilst browsing this site, nor are they responsible ' .
'for any loss of data which may come about, for example a hacking attempt. ' .
'The website is run independently from the software creators, and any content' .
' is the responsibility of the website administration.' ;
2023-06-12 10:30:49 -06:00
Settings :: set ( 't_and_c' , 'By registering on our website, you agree to the following:<p>' . $nameless_terms . '</p>' );
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
private function initialiseTasks () : void
{
2023-05-01 11:45:22 +01:00
GenerateSitemap :: schedule ( new Language ( 'core' , 'en_UK' ));
2024-10-17 23:21:27 -07:00
PurgeExpiredSessions :: schedule ( new Language ( 'core' , 'en_UK' ));
2024-12-14 13:03:39 +01:00
PurgeInactiveUsers :: schedule ( new Language ( 'core' , 'en_UK' ));
2023-05-01 11:45:22 +01:00
}
2024-03-09 03:19:55 -08:00
private function initialiseTemplates () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'templates' , [
2022-05-31 11:29:47 -06:00
'name' => 'DefaultRevamp' ,
'enabled' => true ,
]);
2025-06-04 21:45:50 -07:00
Settings :: set ( 'default_template' , 'DefaultRevamp' );
2022-05-31 11:29:47 -06:00
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'panel_templates' , [
2022-05-31 11:29:47 -06:00
'name' => 'Default' ,
'enabled' => true ,
]);
2025-06-04 21:45:50 -07:00
Settings :: set ( 'default_panel_template' , 'Default' );
2022-05-31 11:29:47 -06:00
2022-06-12 20:35:45 -06:00
$config_path = Config :: get ( 'core.path' );
2022-06-13 02:21:21 +00:00
if ( ! empty ( $config_path )) {
$config_path = '/' . trim ( $config_path , '/' );
}
2022-05-31 11:29:47 -06:00
2025-06-04 13:31:51 -07:00
Settings :: set ( 'banner_image_path' , $config_path . '/uploads/template_banners/homepage_bg_trimmed.jpg' );
2022-05-31 11:29:47 -06:00
}
2024-03-09 03:19:55 -08:00
private function initialiseWidgets () : void
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'widgets' , [
2022-05-31 11:29:47 -06:00
'name' => 'Online Staff' ,
'enabled' => true ,
2024-03-09 03:19:55 -08:00
'pages' => '["index","forum"]' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'widgets' , [
2022-05-31 11:29:47 -06:00
'name' => 'Online Users' ,
'enabled' => true ,
2024-03-09 03:19:55 -08:00
'pages' => '["index","forum"]' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'widgets' , [
2022-05-31 11:29:47 -06:00
'name' => 'Statistics' ,
'enabled' => true ,
2024-03-09 03:19:55 -08:00
'pages' => '["index","forum"]' ,
2022-05-31 11:29:47 -06:00
]);
$this -> _cache -> setCache ( 'Core-widgets' );
$this -> _cache -> store ( 'enabled' , [
'Online Staff' => 1 ,
'Online Users' => 1 ,
2024-03-09 03:19:55 -08:00
'Statistics' => 1 ,
2022-05-31 11:29:47 -06:00
]);
}
2024-03-09 03:19:55 -08:00
private function initialiseForum ()
{
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums' , [
2022-05-31 11:29:47 -06:00
'forum_title' => 'Category' ,
'forum_description' => 'The first forum category!' ,
'forum_order' => 1 ,
2024-03-09 03:19:55 -08:00
'forum_type' => 'category' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums' , [
2022-05-31 11:29:47 -06:00
'forum_title' => 'Forum' ,
'forum_description' => 'The first discussion forum!' ,
'forum_order' => 2 ,
'parent' => 1 ,
'forum_type' => 'forum' ,
2024-03-09 03:19:55 -08:00
'news' => 1 ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'topics' , [
2022-05-31 11:29:47 -06:00
'forum_id' => 2 ,
'topic_title' => 'Welcome to NamelessMC!' ,
'topic_creator' => 1 ,
'topic_last_user' => 1 ,
'topic_date' => date ( 'U' ),
'topic_reply_date' => date ( 'U' ),
2024-03-09 03:19:55 -08:00
'label' => null ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'posts' , [
2022-05-31 11:29:47 -06:00
'forum_id' => 2 ,
'topic_id' => 1 ,
'post_creator' => 1 ,
2024-03-09 03:19:55 -08:00
'post_content' => <<< 'POST'
2023-04-16 10:46:51 +01:00
< p > Welcome !</ p >
< p > To get started with NamelessMC , visit your StaffCP using the blue gear icon in the top right of your screen .</ p >
< p > If you need support , visit our Discord server : < a href = " https://discord.gg/nameless " target = " _blank " rel = " noopener " > https :// discord . gg / nameless </ a ></ p >
< p > Thank you and enjoy , </ p >
< p > The NamelessMC Development team .</ p >
POST ,
2022-05-31 11:29:47 -06:00
'post_date' => date ( 'Y-m-d H:i:s' ),
'created' => date ( 'U' ),
]);
2023-04-16 10:46:51 +01:00
// Must be updated afterwards due to foreign key
2022-06-02 18:38:25 +02:00
$this -> _db -> update ( 'forums' , 2 , [
'last_post_date' => date ( 'U' ),
'last_user_posted' => 1 ,
'last_topic_posted' => 1 ,
]);
2022-05-31 11:29:47 -06:00
// Permissions
for ( $i = 0 ; $i < 4 ; $i ++ ) {
for ( $n = 1 ; $n < 3 ; $n ++ ) {
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_permissions' , [
2022-05-31 11:29:47 -06:00
'group_id' => $i ,
'forum_id' => $n ,
'view' => true ,
'create_topic' => ( $i == 0 ? 0 : 1 ),
'edit_topic' => ( $i == 0 ? 0 : 1 ),
'create_post' => ( $i == 0 ? 0 : 1 ),
'view_other_topics' => true ,
2024-03-09 03:19:55 -08:00
'moderate' => (( $i == 2 || $i == 3 ) ? 1 : 0 ),
2022-05-31 11:29:47 -06:00
]);
}
}
// Forum Labels
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Default' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-default">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Primary' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-primary">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Success' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-success">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Info' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-info">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Warning' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-warning">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
2022-06-01 21:28:51 +02:00
$this -> _db -> insert ( 'forums_labels' , [
2022-05-31 11:29:47 -06:00
'name' => 'Danger' ,
2024-03-09 03:19:55 -08:00
'html' => '<span class="badge badge-danger">{x}</span>' ,
2022-05-31 11:29:47 -06:00
]);
}
}