Notice: file_put_contents(): Write of 109 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 125 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 186 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 175 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 173 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 174 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 177 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 177 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 178 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 178 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 185 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213
Errore fatale - Novaverse
Uncaught PDOException

SQLSTATE[HY000]: General error: 1021 Disk got full writing '.(temporary)' (Errcode: 28 "No space left on device")

/home/novaverse-web/website/forum/core/classes/Database/DB.php

https://novaverse.it/forum/
/home/novaverse-web/website/forum/core/classes/Database/DB.php
     * @return static This DB instance.
     */
    public function query(string $sql, array $params = [], bool $isSelect = null) {
        $this->_error = false;
        if ($this->_statement = $this->_pdo->prepare($sql)) {
            $x = 1;
            foreach ($params as $param) {
                // Convert "true" and "false" to 1 and 0 so that query params can be more fluent
                if (is_bool($param)) {
                    $param = $param ? 1 : 0;
                }
                $this->_statement->bindValue($x, $param, is_int($param)
                    ? PDO::PARAM_INT
                    : PDO::PARAM_STR
                );
                $x++;
            }

            $this->_query_recorder->pushQuery($sql, $params);

            if ($this->_statement->execute()) {
                // Only fetch the results if this is a SELECT query.
                if ($isSelect || str_starts_with(strtoupper(ltrim($sql)), 'SELECT')) {
                    $this->_results = $this->_statement->fetchAll(PDO::FETCH_OBJ);
                }
                $this->_count = $this->_statement->rowCount();
            } else {
                print_r($this->_pdo->errorInfo());
                $this->_error = true;
            }
        } else {
            $this->_results = [];
        }

        return $this;
    }

    /**
     * Execute some SQL action (which uses a where clause) on the database.
     *
     * @param string $action The action to perform (SELECT, DELETE).
/home/novaverse-web/website/forum/core/classes/Core/User.php
            'active' => 0
        ]);

        Session::delete($this->_admSessionName);
        Cookie::delete($this->_cookieName . '_adm');
    }

    /**
     * Get the user's groups.
     *
     * @return array<int, Group> Their groups.
     */
    public function getGroups(): array {
        if (isset($this->_groups)) {
            return $this->_groups;
        }

        if (isset(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()) {
                foreach ($groups_query->results() as $item) {
                    $this->_groups[$item->id] = new Group($item);
                }
            } else {
                $this->_groups = [];
            }

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

        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->addGroup($default_group_id);
        }

/home/novaverse-web/website/forum/core/classes/Core/User.php
            $data_obj->uuid = $integrationUser->data()->identifier;
        } else {
            $data_obj->uuid = '';
        }

        return AvatarSource::getAvatarFromUserData($data_obj, $this->hasPermission('usercp.gif_avatar'), $size, $full);
    }

    /**
     * Does the user have a specific permission in any of their groups?
     *
     * @param string $permission Permission node to check recursively for.
     *
     * @return bool Whether they inherit this permission or not.
     */
    public function hasPermission(string $permission): bool {
        if (!$this->exists()) {
            return false;
        }

        foreach ($this->getGroups() as $group) {
            $permissions = json_decode($group->permissions, true) ?? [];

            if (isset($permissions['administrator']) && $permissions['administrator'] == 1) {
                return true;
            }

            if (isset($permissions[$permission]) && $permissions[$permission] == 1) {
                return true;
            }
        }

        return false;
    }

    /**
     * Log the user out from all other sessions.
     */
    public function logoutAllOtherSessions(): void {
        DB::getInstance()->query('UPDATE nl2_users_session SET `active` = 0 WHERE user_id = ? AND hash != ?', [
            $this->data()->id,
/home/novaverse-web/website/forum/core/classes/Core/User.php
     *
     * @param int $size Size of image to render in pixels.
     * @param bool $full Whether to use full site URL or not, for external loading - ie discord webhooks.
     *
     * @return string URL to their avatar image.
     */
    public function getAvatar(int $size = 128, bool $full = false): string {
        $data_obj = new stdClass();
        // Convert UserData object to stdClass so we can dynamically add the 'uuid' property
        foreach (get_object_vars($this->data()) as $key => $value) {
            $data_obj->{$key} = $value;
        }

        $integrationUser = $this->getIntegration('Minecraft');
        if ($integrationUser != null) {
            $data_obj->uuid = $integrationUser->data()->identifier;
        } else {
            $data_obj->uuid = '';
        }

        return AvatarSource::getAvatarFromUserData($data_obj, $this->hasPermission('usercp.gif_avatar'), $size, $full);
    }

    /**
     * Does the user have a specific permission in any of their groups?
     *
     * @param string $permission Permission node to check recursively for.
     *
     * @return bool Whether they inherit this permission or not.
     */
    public function hasPermission(string $permission): bool {
        if (!$this->exists()) {
            return false;
        }

        foreach ($this->getGroups() as $group) {
            $permissions = json_decode($group->permissions, true) ?? [];

            if (isset($permissions['administrator']) && $permissions['administrator'] == 1) {
                return true;
            }
/home/novaverse-web/website/forum/modules/Ghost/module.php
            foreach($posts as $post){

				$post_multiplier += 1;
				if ($post_multiplier == "1" && $page_id == 1) {
					$post_size = "post-card-large";
				} else if (($post_multiplier == "2" || $post_multiplier == "3") && $page_id == 1) {
					$post_size = "post-card-medium";
				} else {
					$post_size = "post-card-small";
				}
				
				$post_author = new User($post->author);
   			   
                $posts_array[] = [
					'name' => Output::getClean($post->name),
					'date' => date("M jS\, Y", Output::getClean($post->date)),
					'author' => $post_author->getDisplayname(),
					'readtime' => str_replace("{x}", $post->readtime, $this->_ghost_language->get('ghost', 'minute_read')),
					'image' => Output::getClean($post->image),
					'content' => Ghost::purifyPostContent($post->content),
					'avatar' => $post_author->getAvatar('40'),
					'author_styles' => $post_author->getGroupStyle(),
					'author_profile' => $post_author->getProfileURL(),
					'author_groups' => $post_author->getMainGroup()->group_html,
                    'link' => URL::build('/post/' . $post->id . '-' . Ghost::purifyPostName($post->name)),
					'card_size' => $post_size
				];
            }
	
            $smarty->assign([
                'GHOST' => 'yes',
	            'GHOST_POSTS' => $posts_array
            ]);
  			
		}

		if(defined('BACK_END')){
			if($user->hasPermission('admincp.ghost')){
				$cache->setCache('panel_sidebar');
				if(!$cache->isCached('ghost_new_order')){
					$order = 12;
/home/novaverse-web/website/forum/core/classes/Core/Module.php
            $load_after[] = 'Core';
        }

        $this->_load_before = $load_before;
        $this->_load_after = $load_after;
    }

    /**
     * Call `onPageLoad()` function for all registered modules.
     *
     * @param User $user User viewing the page.
     * @param Pages $pages Instance of pages class.
     * @param Cache $cache Instance of cache to pass.
     * @param Smarty $smarty Instance of smarty to pass.
     * @param Navigation[] $navs Array of loaded navigation menus.
     * @param Widgets $widgets Instance of widget class to pass.
     * @param TemplateBase $template Template to pass.
     */
    public static function loadPage(User $user, Pages $pages, Cache $cache, Smarty $smarty, iterable $navs, Widgets $widgets, TemplateBase $template): void {
        foreach (self::getModules() as $module) {
            $module->onPageLoad($user, $pages, $cache, $smarty, $navs, $widgets, $template);
        }
    }

    /** @return Module[] */
    public static function getModules(): iterable {
        return self::$_modules;
    }

    /**
     * Handle page loading for this module.
     * Often used to register permissions, sitemaps, widgets, etc.
     *
     * @param User $user User viewing the page.
     * @param Pages $pages Instance of pages class.
     * @param Cache $cache Instance of cache to pass.
     * @param Smarty $smarty Instance of smarty to pass.
     * @param Navigation[] $navs Array of loaded navigation menus.
     * @param Widgets $widgets Instance of widget class to pass.
     * @param TemplateBase|null $template Active template to render.
     */
/home/novaverse-web/website/forum/modules/Core/pages/home.php
    $smarty->assign('HOME_SESSION_ERROR_FLASH', Session::flash('home_error'));
    $smarty->assign('ERROR_TITLE', $language->get('general', 'error'));
}

$home_type = Util::getSetting('home_type');

$smarty->assign('HOME_TYPE', $home_type);

if ($home_type === 'news') {
    foreach ($front_page_modules as $module) {
        require(ROOT_PATH . '/' . $module);
    }
} else if ($home_type === 'custom') {
    $smarty->assign('CUSTOM_HOME_CONTENT', Util::getSetting('home_custom_content'));
}

// Assign to Smarty variables
$smarty->assign('SOCIAL', $language->get('general', 'social'));

// Load modules + template
Module::loadPage($user, $pages, $cache, $smarty, [$navigation, $cc_nav, $staffcp_nav], $widgets, $template);

$template->onPageLoad();

$smarty->assign('WIDGETS_LEFT', $widgets->getWidgets('left'));
$smarty->assign('WIDGETS_RIGHT', $widgets->getWidgets('right'));

require(ROOT_PATH . '/core/templates/navbar.php');
require(ROOT_PATH . '/core/templates/footer.php');

// Display template
$template->displayTemplate('index.tpl', $smarty);
/home/novaverse-web/website/forum/modules/Core/pages/index.php
<?php
/*
 *  Made by Samerton
 *  https://github.com/NamelessMC/Nameless/
 *  NamelessMC version 2.0.0-pr13
 *
 *  License: MIT
 *
 *  Display either homepage (with news or custom content) or portal
 */

// Home page or portal?
if (Util::getSetting('home_type') === 'portal') {
    require('portal.php');
} else {
    require('home.php');
}
/home/novaverse-web/website/forum/index.php
}

ini_set('session.cookie_httponly', 1);
ini_set('open_basedir', ROOT_PATH . PATH_SEPARATOR . $tmp_dir . PATH_SEPARATOR . '/proc/stat');

// Get the directory the user is trying to access
$directory = $_SERVER['REQUEST_URI'];
$directories = explode('/', $directory);
$lim = count($directories);

// Start initialising the page
require(ROOT_PATH . '/core/init.php');

// Get page to load from URL
if (!isset($_GET['route']) || $_GET['route'] == '/') {
    if (((!isset($_GET['route']) || ($_GET['route'] != '/')) && count($directories) > 1)) {
        require(ROOT_PATH . '/404.php');
    } else {
        // Homepage
        $pages->setActivePage($pages->getPageByURL('/'));
        require(ROOT_PATH . '/modules/Core/pages/index.php');
    }
    die();
}

$route = rtrim(strtok($_GET['route'], '?'), '/');

$all_pages = $pages->returnPages();

if (array_key_exists($route, $all_pages)) {
    $pages->setActivePage($all_pages[$route]);
    if (isset($all_pages[$route]['custom'])) {
        require(implode(DIRECTORY_SEPARATOR, [ROOT_PATH, 'modules', 'Core', 'pages', 'custom.php']));
        die();
    }

    $path = implode(DIRECTORY_SEPARATOR, [ROOT_PATH, 'modules', $all_pages[$route]['module'], $all_pages[$route]['file']]);

    if (file_exists($path)) {
        require($path);
        die();
/home/novaverse-web/website/forum/core/classes/Core/User.php
SELECT nl2_groups.* FROM nl2_users_groups INNER JOIN nl2_groups ON group_id = nl2_groups.id WHERE user_id = '4' AND deleted = 0 ORDER BY `order`;
            'active' => 0
        ]);

        Session::delete($this->_admSessionName);
        Cookie::delete($this->_cookieName . '_adm');
    }

    /**
     * Get the user's groups.
     *
     * @return array<int, Group> Their groups.
     */
    public function getGroups(): array {
        if (isset($this->_groups)) {
            return $this->_groups;
        }

        if (isset(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()) {
                foreach ($groups_query->results() as $item) {
                    $this->_groups[$item->id] = new Group($item);
                }
            } else {
                $this->_groups = [];
            }

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

        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->addGroup($default_group_id);
        }

/home/novaverse-web/website/forum/core/classes/Core/User.php
SELECT nl2_users_integrations.*, nl2_integrations.name as integration_name FROM nl2_users_integrations LEFT JOIN nl2_integrations ON integration_id=nl2_integrations.id WHERE user_id = '4';
        }

        return $this->_groups;
    }

    /**
     * Get the user's integrations.
     *
     * @return IntegrationUser[] Their integrations.
     */
    public function getIntegrations(): array {
        if (isset($this->_integrations)) {
            return $this->_integrations;
        }

        $integrations = Integrations::getInstance();

        if (isset(self::$_integration_cache[$this->data()->id])) {
            $integrations_query = self::$_integration_cache[$this->data()->id];
        } else {
            $integrations_query = $this->_db->query('SELECT nl2_users_integrations.*, nl2_integrations.name as integration_name FROM nl2_users_integrations LEFT JOIN nl2_integrations ON integration_id=nl2_integrations.id WHERE user_id = ?', [$this->data()->id]);
            if ($integrations_query->count()) {
                $integrations_query = $integrations_query->results();
            } else {
                $integrations_query = [];
            }
            self::$_integration_cache[$this->data()->id] = $integrations_query;
        }

        $integrations_list = [];
        foreach ($integrations_query as $item) {
            $integration = $integrations->getIntegration($item->integration_name);
            if ($integration != null) {
                $integrationUser = new IntegrationUser($integration, $this->data()->id, 'user_id', $item);

                $integrations_list[$item->integration_name] = $integrationUser;
            }
        }

        return $this->_integrations = $integrations_list;
    }
/home/novaverse-web/website/forum/core/classes/Core/User.php
SELECT * FROM nl2_users WHERE `id` = '4';
            $this->find($user, $field);
        }
    }

    /**
     * Find a user by unique identifier (username, ID, email, etc).
     * Loads instance variables for this class.
     *
     * @param string $value Unique identifier.
     * @param string $field What column to check for their unique identifier in.
     *
     * @return bool True/false on success or failure respectfully.
     */
    private function find(string $value, string $field = 'id'): bool {
        if (isset(self::$_user_cache["$value.$field"])) {
            $this->_data = self::$_user_cache["$value.$field"];
            return true;
        }

        if ($field !== 'hash') {
            $data = $this->_db->get('users', [$field, $value]);
        } else {
            $data = $this->_db->query('SELECT nl2_users.* FROM nl2_users LEFT JOIN nl2_users_session ON nl2_users.id = user_id WHERE hash = ? AND nl2_users_session.active = 1', [$value]);
        }

        if ($data->count()) {
            $this->_data = new UserData($data->first());
            self::$_user_cache["$value.$field"] = $this->_data;
            return true;
        }

        return false;
    }

    /**
     * Add a group to this user.
     *
     * @param int $group_id ID of group to give.
     * @param int $expire Expiry in epoch time. If not supplied, group will never expire.
     *
     * @return bool True on success, false if they already have it.
/home/novaverse-web/website/forum/modules/Ghost/module.php
SELECT id FROM `nl2_ghost_posts` WHERE date < 1785136981 ORDER BY date DESC;
				if (!$page_id) {
					$page_id = 1;
				}
  			} else {
  			    $page_id = 1;
  			}

  			$offset = ($page_id * 6) - 6;
  			
			// Fetch posts
			$posts = DB::getInstance()->query("SELECT * FROM `nl2_ghost_posts` WHERE date < " . time() . " ORDER BY date DESC LIMIT 6 OFFSET " . $offset)->results();
            $posts_array = [];

			// Redirect to home if no posts
			if (empty($posts) && $page_id != 1) {
				Redirect::to(URL::build('/'));
			}
			
			// Pagination
			$paginator = new Paginator(($template_pagination ?? []));
			$paginator_posts = DB::getInstance()->query("SELECT id FROM `nl2_ghost_posts` WHERE date < " . time() . " ORDER BY date DESC")->results();
            $results = $paginator->getLimited($paginator_posts, 6, $page_id, count($paginator_posts));
            $pagination = $paginator->generate(5);
            $smarty->assign('PAGINATION', $pagination);
			
			$post_multiplier = 0;
            foreach($posts as $post){

				$post_multiplier += 1;
				if ($post_multiplier == "1" && $page_id == 1) {
					$post_size = "post-card-large";
				} else if (($post_multiplier == "2" || $post_multiplier == "3") && $page_id == 1) {
					$post_size = "post-card-medium";
				} else {
					$post_size = "post-card-small";
				}
				
				$post_author = new User($post->author);
   			   
                $posts_array[] = [
					'name' => Output::getClean($post->name),
/home/novaverse-web/website/forum/modules/Ghost/module.php
SELECT * FROM `nl2_ghost_posts` WHERE date < 1785136981 ORDER BY date DESC LIMIT 6 OFFSET 0;
		}

		if(defined('PAGE') && PAGE == 'index'){

  			// Timezone
			Ghost::setTimezone();
  			
  			// Page Query String Checker
  			if ($_SERVER['QUERY_STRING']) {
                $page_id = preg_replace("/[^0-9]/", "", $_SERVER['QUERY_STRING']);
				if (!$page_id) {
					$page_id = 1;
				}
  			} else {
  			    $page_id = 1;
  			}

  			$offset = ($page_id * 6) - 6;
  			
			// Fetch posts
			$posts = DB::getInstance()->query("SELECT * FROM `nl2_ghost_posts` WHERE date < " . time() . " ORDER BY date DESC LIMIT 6 OFFSET " . $offset)->results();
            $posts_array = [];

			// Redirect to home if no posts
			if (empty($posts) && $page_id != 1) {
				Redirect::to(URL::build('/'));
			}
			
			// Pagination
			$paginator = new Paginator(($template_pagination ?? []));
			$paginator_posts = DB::getInstance()->query("SELECT id FROM `nl2_ghost_posts` WHERE date < " . time() . " ORDER BY date DESC")->results();
            $results = $paginator->getLimited($paginator_posts, 6, $page_id, count($paginator_posts));
            $pagination = $paginator->generate(5);
            $smarty->assign('PAGINATION', $pagination);
			
			$post_multiplier = 0;
            foreach($posts as $post){

				$post_multiplier += 1;
				if ($post_multiplier == "1" && $page_id == 1) {
					$post_size = "post-card-large";
/home/novaverse-web/website/forum/modules/Ghost/classes/Ghost.php
SELECT * FROM nl2_settings WHERE `name` = 'timezone';
<?php
class Ghost {
   
    // Set correct timezone
    public static function setTimezone() {
  		$timezone = DB::getInstance()->get('settings', ['name', '=', 'timezone'])->results();
  		$timezone = $timezone[0]->value;
  		date_default_timezone_set($timezone);
    }

    // Purify post name (for post URL)
    public static function purifyPostName($name) {
        $name = preg_replace('/\s/u', '-', $name);
        $name = strtolower($name);
        return Output::getClean($name);
    }

    // Trim post content to 250 characters cleanly
    public static function purifyPostContent($content) {
        $content = Output::getPurified(Output::getDecoded($content));
        $content = strip_tags($content, '<br>');
        $content = preg_replace('/^(<br\s*\/?>)*|(<br\s*\/?>)*$/i', '', $content);
        $content = preg_replace("/<br\W*?\/>/", "➍", $content);
        //$content = Util::truncate($content, '250', array('exact' => false, 'html' => true));
        $content = Text::truncate($content, '250', array('exact' => false, 'html' => true));
        $content = preg_replace("/➍/", "<br/>", $content);
/home/novaverse-web/website/forum/modules/Ghost/widgets/latestNews.php
SELECT `location`, `order` FROM nl2_widgets WHERE `name` = 'Latest News';
 */
class latestNewsWidget extends WidgetBase {

    private $_language, 
            $_ghost_language,
            $_cache,
            $_user;

    public function __construct($user, $language, $ghost_language, $smarty, $cache) {

    	$this->_user = $user;
		$this->_language = $language;
		$this->_ghost_language = $ghost_language;
    	$this->_smarty = $smarty;
    	$this->_cache = $cache;
		
        $widget_query = self::getData('Latest News');
        parent::__construct(self::parsePages($widget_query));
        
        // Get widget
        $widget_query = DB::getInstance()->query('SELECT `location`, `order` FROM nl2_widgets WHERE `name` = ?', ['Latest News'])->first();

        // Set widget variables
        $this->_module = 'Ghost';
        $this->_name = 'Latest News';
        $this->_location = isset($widget_query->location) ? $widget_query->location : null;
        $this->_description = 'Display the latest ghost module posts';
        $this->_order = isset($widget_query->order) ? $widget_query->order : null;

    }

    public function initialise(): void {

        $this->_smarty->assign('GHOST_LATEST_NEWS', $this->_ghost_language->get('ghost', 'latest_news'));

        $posts = DB::getInstance()->query("SELECT * FROM `nl2_ghost_posts` WHERE date < " . time() . " ORDER BY date DESC LIMIT 3")->results();
        $latest_news_array = [];

        foreach($posts as $post){
            $post_author = new User($post->author);

/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Latest News';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/modules/Core/module.php
SELECT * FROM nl2_mc_servers WHERE `parent_server` = '1';
        // Check page type (frontend or backend)
        if (defined('FRONT_END')) {
            // Minecraft integration?
            if (Util::getSetting('mc_integration')) {
                // Query main server
                $cache->setCache('mc_default_server');

                // Already cached?
                if ($cache->isCached('default_query')) {
                    $result = $cache->retrieve('default_query');
                    $default = $cache->retrieve('default');
                } else {
                    if ($cache->isCached('default')) {
                        $default = $cache->retrieve('default');
                        $sub_servers = $cache->retrieve('default_sub');
                    } else {
                        // Get default server from database
                        $default = DB::getInstance()->get('mc_servers', ['is_default', true])->results();
                        if (count($default)) {
                            // Get sub-servers of default server
                            $sub_servers = DB::getInstance()->get('mc_servers', ['parent_server', $default[0]->id])->results();
                            if (count($sub_servers)) {
                                $cache->store('default_sub', $sub_servers);
                            } else {
                                $cache->store('default_sub', []);
                            }

                            $default = $default[0];

                            $cache->store('default', $default, 60);
                        } else {
                            $cache->store('default', null, 60);
                        }
                    }

                    if (!is_null($default) && isset($default->ip)) {
                        $full_ip = ['ip' => $default->ip . (is_null($default->port) ? '' : ':' . $default->port), 'pre' => $default->pre, 'name' => $default->name, 'id' => $default->id];

                        // Get query type
                        $query_type = Util::getSetting('query_type', 'internal');

/home/novaverse-web/website/forum/modules/Core/module.php
SELECT * FROM nl2_mc_servers WHERE `is_default` = '1';
            }
        }

        // Check page type (frontend or backend)
        if (defined('FRONT_END')) {
            // Minecraft integration?
            if (Util::getSetting('mc_integration')) {
                // Query main server
                $cache->setCache('mc_default_server');

                // Already cached?
                if ($cache->isCached('default_query')) {
                    $result = $cache->retrieve('default_query');
                    $default = $cache->retrieve('default');
                } else {
                    if ($cache->isCached('default')) {
                        $default = $cache->retrieve('default');
                        $sub_servers = $cache->retrieve('default_sub');
                    } else {
                        // Get default server from database
                        $default = DB::getInstance()->get('mc_servers', ['is_default', true])->results();
                        if (count($default)) {
                            // Get sub-servers of default server
                            $sub_servers = DB::getInstance()->get('mc_servers', ['parent_server', $default[0]->id])->results();
                            if (count($sub_servers)) {
                                $cache->store('default_sub', $sub_servers);
                            } else {
                                $cache->store('default_sub', []);
                            }

                            $default = $default[0];

                            $cache->store('default', $default, 60);
                        } else {
                            $cache->store('default', null, 60);
                        }
                    }

                    if (!is_null($default) && isset($default->ip)) {
                        $full_ip = ['ip' => $default->ip . (is_null($default->port) ? '' : ':' . $default->port), 'pre' => $default->pre, 'name' => $default->name, 'id' => $default->id];

/home/novaverse-web/website/forum/modules/Core/module.php
SELECT * FROM nl2_groups WHERE `default_group` = '1';
            $widgets->add(new StatsWidget($smarty, $language, $cache));
        }

        // Validate user hook
        $validate_action = Util::getSetting('validate_user_action');
        $validate_action = json_decode($validate_action, true);

        if ($validate_action['action'] == 'promote') {
            EventHandler::registerListener(UserValidatedEvent::class, ValidateHook::class);
            define('VALIDATED_DEFAULT', $validate_action['group']);
        }

        // Define default group pre validation
        $cache->setCache('pre_validation_default');
        $group_id = null;

        if ($cache->isCached('pre_validation_default')) {
            $group_id = $cache->retrieve('pre_validation_default');

        } else {
            $group_id = DB::getInstance()->get('groups', ['default_group', '1'])->results();
            $group_id = $group_id[0]->id;
        }

        define('PRE_VALIDATED_DEFAULT', $group_id);

        // Check for updates
        if ($user->isLoggedIn()) {
            if (!(defined('PANEL_PAGE') && PANEL_PAGE === 'update') && $user->hasPermission('admincp.update')) {
                $cache->setCache('update_check');
                if ($cache->isCached('update_check')) {
                    $update_check = $cache->retrieve('update_check');
                } else {
                    $update_check = Util::updateCheck();
                    $cache->store('update_check', $update_check, 3600);
                }

                if (!is_string($update_check) && $update_check->updateAvailable()) {
                    $smarty->assign([
                        'NEW_UPDATE' => $update_check->isUrgent()
                            ? $language->get('admin', 'new_urgent_update_available')
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Statistics';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Server Status';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Online Users';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Online Staff';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Latest Profile Posts';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/core/classes/Widgets/WidgetBase.php
SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = 'Twitter';
     * Get the display order of this widget.
     *
     * @return int Display order of widget.
     */
    public function getOrder(): ?int {
        return $this->_order;
    }

    /**
     * Generate this widget's `$_content`.
     */
    abstract public function initialise(): void;

    /**
     * Get the data (location, order, pages) for a widget.
     *
     * @param string $name The widget to get data for.
     * @return object|null Widgets data.
     */
    protected static function getData(string $name): ?object {
        return DB::getInstance()->query('SELECT `location`, `order`, `pages` FROM nl2_widgets WHERE `name` = ?', [$name])->first();
    }

    /**
     * Parse the widgets JSON pages string into an array.
     *
     * @param object|null $data The widget data to get pages from.
     * @return array The parsed pages array.
     */
    protected static function parsePages(?object $data): array {
        if (isset($data->pages)) {
            return json_decode($data->pages, true) ?? [];
        }
        return [];
    }
}
/home/novaverse-web/website/forum/modules/Forum/classes/Forum.php
SELECT
        id,
        labels,
        topic_creator,
        topic_title,
        topic_views
    FROM nl2_topics
    WHERE
        forum_id IN (
            SELECT
                id
            FROM nl2_forums
            WHERE news = 1
            AND id IN (
                SELECT p.forum_id
                FROM nl2_forums_permissions p
                WHERE p.group_id IN (?)
                AND p.view = 1
            )
        )
        AND deleted = 0
    ORDER BY topic_date
    DESC LIMIT '0';
            ];
        }
        return false;
    }

    /**
     * Get the latest news posts to display on homepage.
     *
     * TODO: can be optimised by including posts in the initial query?
     *
     * @param int $number The number of posts to get.
     * @param array $groups Array containing user's group IDs, default [0] for guests
     * @return array The latest news posts.
     */
    public function getLatestNews(int $number = 5, array $groups = [0]): array {
        $return = []; // Array to return containing news
        $labels_cache = []; // Array to contain labels

        $groups_in = implode(',', array_map(static fn () => '?', $groups));

        $news_items = $this->_db->query(
            <<<SQL
                SELECT
                    id,
                    labels,
                    topic_creator,
                    topic_title,
                    topic_views
                FROM nl2_topics
                WHERE
                    forum_id IN (
                        SELECT
                            id
                        FROM nl2_forums
                        WHERE news = 1
                        AND id IN (
                            SELECT p.forum_id
                            FROM nl2_forums_permissions p
                            WHERE p.group_id IN ($groups_in)
                            AND p.view = 1
                        )
/home/novaverse-web/website/forum/core/classes/Core/Settings.php
SELECT `name`, `value` FROM `nl2_settings` WHERE `module` = 'forum';
    private static function setSettingsCache(?string $module, array $cache): void {
        $cache_name = $module !== null ? $module : 'core';
        self::$_cached_settings[$cache_name] = $cache;
    }

    /**
     * Get a setting from the database table `nl2_settings`.
     *
     * @param string $setting Setting to check.
     * @param ?string $fallback Fallback to return if $setting is not set in DB. Defaults to null.
     * @param string $module Module name to keep settings separate from other modules. Set module
     *                       to 'Core' for global settings.
     * @return ?string Setting from DB or $fallback.
     */
    public static function get(string $setting, ?string $fallback = null, string $module = 'core'): ?string {
        if (!self::hasSettingsCache($module)) {
            // Load all settings for this module and store it as a dictionary
            if ($module === 'core') {
                $result = DB::getInstance()->query('SELECT `name`, `value` FROM `nl2_settings` WHERE `module` IS NULL')->results();
            } else {
                $result = DB::getInstance()->query('SELECT `name`, `value` FROM `nl2_settings` WHERE `module` = ?', [$module])->results();
            }

            $cache = [];
            foreach ($result as $row) {
                $cache[$row->name] = $row->value;
            }
            self::setSettingsCache($module, $cache);
        }

        $cache = &self::getSettingsCache($module);
        return $cache[$setting] ?? $fallback;
    }

    /**
     * Modify a setting in the database table `nl2_settings`.
     *
     * @param string $setting Setting name.
     * @param string|null $new_value New setting value, or null to delete
     * @param string $module Module name to keep settings separate from other modules. Set module
     *                       to 'Core' for global settings.
/home/novaverse-web/website/forum/core/templates/frontend_init.php
SELECT * FROM nl2_page_descriptions WHERE `page` = '/';
        $default_group = $cache->retrieve('default_group');
    } else {
        try {
            $default_group = Group::find(1, 'default_group')->id;
        } catch (Exception $e) {
            $default_group = 1;
        }

        $cache->store('default_group', $default_group);
    }
}

// Page metadata
if (isset($_GET['route']) && $_GET['route'] != '/') {
    $route = rtrim($_GET['route'], '/');
} else {
    $route = '/';
}

if (!defined('PAGE_DESCRIPTION')) {
    $page_metadata = DB::getInstance()->get('page_descriptions', ['page', $route]);
    if ($page_metadata->count()) {
        $page_metadata = $page_metadata->first();
        $smarty->assign([
            'PAGE_DESCRIPTION' => str_replace('{site}', Output::getClean(SITE_NAME), Output::getPurified($page_metadata->description)),
            'PAGE_KEYWORDS' => Output::getPurified($page_metadata->tags),
        ]);

        $og_image = $page_metadata->image;
        if ($og_image) {
            $smarty->assign('OG_IMAGE', rtrim(URL::getSelfURL(), '/') . $og_image);
        }
    }
} else {
    $smarty->assign([
        'PAGE_DESCRIPTION' => str_replace('{site}', Output::getClean(SITE_NAME), Output::getPurified(PAGE_DESCRIPTION)),
        'PAGE_KEYWORDS' => (defined('PAGE_KEYWORDS') ? Output::getPurified(PAGE_KEYWORDS) : '')
    ]);
}

$smarty->assign('TITLE', $page_title);
/home/novaverse-web/website/forum/core/init.php
UPDATE nl2_online_guests SET `last_seen` = '18805' WHERE `id` =;
            'user_title' => Output::getClean($user->data()->user_title),
            'avatar' => $user->getAvatar(),
            'integrations' => $user_integrations
        ]);

        // Panel access?
        if ($user->canViewStaffCP()) {
            $smarty->assign([
                'PANEL_LINK' => URL::build('/panel'),
                'PANEL' => $language->get('moderator', 'staff_cp')
            ]);
        }
    } else {
        // Perform tasks for guests
        if (!$_SESSION['checked'] || (isset($_SESSION['checked']) && $_SESSION['checked'] <= strtotime('-5 minutes'))) {
            $already_online = DB::getInstance()->get('online_guests', ['ip', $ip])->results();

            $date = date('U');

            if (count($already_online)) {
                DB::getInstance()->update('online_guests', $already_online[0]->id, ['last_seen' => $date]);
            } else {
                DB::getInstance()->insert('online_guests', ['ip' => $ip, 'last_seen' => $date]);
            }

            $_SESSION['checked'] = $date;
        }

        // Auto language enabled?
        if (Util::getSetting('auto_language_detection')) {
            $smarty->assign('AUTO_LANGUAGE', true);
        }
    }

    // Dark mode
    $cache->setCache('template_settings');
    $darkMode = $cache->isCached('darkMode') ? $cache->retrieve('darkMode') : '0';
    if ($user->isLoggedIn()) {
        $darkMode = $user->data()->night_mode !== null ? $user->data()->night_mode : $darkMode;
    } else {
        if (Cookie::exists('night_mode')) {
/home/novaverse-web/website/forum/core/init.php
SELECT * FROM nl2_online_guests WHERE `ip` = '216.73.217.81';
            'username' => $user->getDisplayname(true),
            'nickname' => $user->getDisplayname(),
            'profile' => $user->getProfileURL(),
            'panel_profile' => URL::build('/panel/user/' . urlencode($user->data()->id) . '-' . urlencode($user->data()->username)),
            'username_style' => $user->getGroupStyle(),
            'user_title' => Output::getClean($user->data()->user_title),
            'avatar' => $user->getAvatar(),
            'integrations' => $user_integrations
        ]);

        // Panel access?
        if ($user->canViewStaffCP()) {
            $smarty->assign([
                'PANEL_LINK' => URL::build('/panel'),
                'PANEL' => $language->get('moderator', 'staff_cp')
            ]);
        }
    } else {
        // Perform tasks for guests
        if (!$_SESSION['checked'] || (isset($_SESSION['checked']) && $_SESSION['checked'] <= strtotime('-5 minutes'))) {
            $already_online = DB::getInstance()->get('online_guests', ['ip', $ip])->results();

            $date = date('U');

            if (count($already_online)) {
                DB::getInstance()->update('online_guests', $already_online[0]->id, ['last_seen' => $date]);
            } else {
                DB::getInstance()->insert('online_guests', ['ip' => $ip, 'last_seen' => $date]);
            }

            $_SESSION['checked'] = $date;
        }

        // Auto language enabled?
        if (Util::getSetting('auto_language_detection')) {
            $smarty->assign('AUTO_LANGUAGE', true);
        }
    }

    // Dark mode
    $cache->setCache('template_settings');
/home/novaverse-web/website/forum/modules/Forms/module.php
SELECT id, link_location, url, icon, title, guest FROM nl2_forms;
        $pages->add('Forms', '/user/submissions', 'pages/user/submissions.php');

        // Check if module version changed
        $cache->setCache('forms_module_cache');
        if (!$cache->isCached('module_version')) {
            $cache->store('module_version', $module_version);
        } else {
            if ($module_version != $cache->retrieve('module_version')) {
                // Version have changed, Perform actions
                $this->initialiseUpdate($cache->retrieve('module_version'));

                $cache->store('module_version', $module_version);

                if ($cache->isCached('update_check')) {
                    $cache->erase('update_check');
                }
            }
        }

        try {
            $forms = $this->_db->query('SELECT id, link_location, url, icon, title, guest FROM nl2_forms')->results();
            if (count($forms)) {
                if ($user->isLoggedIn()) {
                    $group_ids = implode(',', $user->getAllGroupIds());
                } else {
                    $group_ids = implode(',', array(0));
                }

                foreach ($forms as $form) {
                    // Register form page
                    $pages->add('Forms', $form->url, 'pages/form.php', 'form-' . $form->id, true);

                    $perm = false;
                    if (!$user->isLoggedIn() && $form->guest == 1) {
                        $perm = true;
                    }

                    if (!$perm) {
                        $hasperm = $this->_db->query('SELECT form_id FROM nl2_forms_permissions WHERE form_id = ? AND post = 1 AND group_id IN(' . $group_ids . ')', array($form->id));
                        if ($hasperm->count()) {
                            $perm = true;
/home/novaverse-web/website/forum/core/classes/Integrations/IntegrationBase.php
SELECT * FROM nl2_integrations WHERE name = 'Discord';
 * @author Partydragen
 * @version 2.1.0
 * @license MIT
 */

abstract class IntegrationBase {

    private DB $_db;
    private IntegrationData $_data;
    protected string $_icon;
    private array $_errors = [];
    protected Language $_language;
    protected ?string $_settings = null;

    protected string $_name;
    protected ?int $_order;

    public function __construct() {
        $this->_db = DB::getInstance();

        $integration = $this->_db->query('SELECT * FROM nl2_integrations WHERE name = ?', [$this->_name]);
        if ($integration->count()) {
            $integration = $integration->first();

            $this->_data = new IntegrationData($integration);
            $this->_order = $integration->order;
        } else {
            // Register integration to database
            $this->_db->query('INSERT INTO nl2_integrations (name) VALUES (?)', [
                $this->_name
            ]);

            $integration = $this->_db->query('SELECT * FROM nl2_integrations WHERE name = ?', [$this->_name])->first();

            $this->_data = new IntegrationData($integration);
            $this->_order = $integration->order;
        }
    }

    /**
     * Get the name of this integration.
/home/novaverse-web/website/forum/core/classes/Integrations/IntegrationBase.php
SELECT * FROM nl2_integrations WHERE name = 'Minecraft';
 * @author Partydragen
 * @version 2.1.0
 * @license MIT
 */

abstract class IntegrationBase {

    private DB $_db;
    private IntegrationData $_data;
    protected string $_icon;
    private array $_errors = [];
    protected Language $_language;
    protected ?string $_settings = null;

    protected string $_name;
    protected ?int $_order;

    public function __construct() {
        $this->_db = DB::getInstance();

        $integration = $this->_db->query('SELECT * FROM nl2_integrations WHERE name = ?', [$this->_name]);
        if ($integration->count()) {
            $integration = $integration->first();

            $this->_data = new IntegrationData($integration);
            $this->_order = $integration->order;
        } else {
            // Register integration to database
            $this->_db->query('INSERT INTO nl2_integrations (name) VALUES (?)', [
                $this->_name
            ]);

            $integration = $this->_db->query('SELECT * FROM nl2_integrations WHERE name = ?', [$this->_name])->first();

            $this->_data = new IntegrationData($integration);
            $this->_order = $integration->order;
        }
    }

    /**
     * Get the name of this integration.
/home/novaverse-web/website/forum/modules/Core/module.php
SELECT * FROM nl2_custom_pages_permissions WHERE `group_id` = '0';
                                                $navigation->add(
                                                    $custom_page->id,
                                                    Output::getClean($custom_page->title),
                                                    (is_null($redirect)) ? URL::build(Output::urlEncodeAllowSlashes($custom_page->url)) : $redirect,
                                                    'footer', $custom_page->target ? '_blank' : null,
                                                    2000,
                                                    $custom_page->icon
                                                );
                                                break;
                                        }
                                        break 2;
                                    }

                                    break;
                                }
                            }
                        }
                    }
                }
            } else {
                $custom_page_permissions = DB::getInstance()->get('custom_pages_permissions', ['group_id', 0])->results();
                if (count($custom_page_permissions)) {
                    foreach ($custom_pages as $custom_page) {
                        $redirect = null;

                        if ($custom_page->redirect == 1) {
                            $redirect = Output::getClean($custom_page->link);
                        }

                        $pages->addCustom(Output::urlEncodeAllowSlashes($custom_page->url), Output::getClean($custom_page->title), !$custom_page->basic);

                        foreach ($custom_page_permissions as $permission) {
                            if ($permission->page_id == $custom_page->id) {
                                if ($permission->view == 1) {
                                    // Check cache for order
                                    if (!$cache->isCached($custom_page->id . '_order')) {
                                        // Create cache entry now
                                        $page_order = 200;
                                        $cache->store($custom_page->id . '_order', 200);
                                    } else {
                                        $page_order = $cache->retrieve($custom_page->id . '_order');
/home/novaverse-web/website/forum/modules/Core/module.php
SELECT * FROM nl2_custom_pages WHERE `id` <> '0';
        }

        // "More" dropdown
        $cache->setCache('navbar_icons');
        if ($cache->isCached('more_dropdown_icon')) {
            $icon = $cache->retrieve('more_dropdown_icon');
        } else {
            $icon = '';
        }

        $cache->setCache('navbar_order');
        if ($cache->isCached('more_dropdown_order')) {
            $order = $cache->retrieve('more_dropdown_order');
        } else {
            $order = 2500;
        }

        $navigation->addDropdown('more_dropdown', $language->get('general', 'more'), 'top', $order, $icon);

        // Custom pages
        $custom_pages = DB::getInstance()->get('custom_pages', ['id', '<>', 0])->results();
        if (count($custom_pages)) {
            $more = [];
            $cache->setCache('navbar_order');

            if ($user->isLoggedIn()) {
                // Check all groups
                $user_groups = $user->getAllGroupIds();

                foreach ($custom_pages as $custom_page) {
                    $redirect = null;

                    // Get redirect URL if enabled
                    if ($custom_page->redirect == 1) {
                        $redirect = $custom_page->link;
                    }

                    $pages->addCustom(Output::urlEncodeAllowSlashes($custom_page->url), Output::getClean($custom_page->title), !$custom_page->basic);

                    foreach ($user_groups as $user_group) {
                        $custom_page_permissions = DB::getInstance()->get('custom_pages_permissions', ['group_id', $user_group])->results();
/home/novaverse-web/website/forum/core/classes/Core/Settings.php
SELECT `name`, `value` FROM `nl2_settings` WHERE `module` IS NULL;
    }

    private static function setSettingsCache(?string $module, array $cache): void {
        $cache_name = $module !== null ? $module : 'core';
        self::$_cached_settings[$cache_name] = $cache;
    }

    /**
     * Get a setting from the database table `nl2_settings`.
     *
     * @param string $setting Setting to check.
     * @param ?string $fallback Fallback to return if $setting is not set in DB. Defaults to null.
     * @param string $module Module name to keep settings separate from other modules. Set module
     *                       to 'Core' for global settings.
     * @return ?string Setting from DB or $fallback.
     */
    public static function get(string $setting, ?string $fallback = null, string $module = 'core'): ?string {
        if (!self::hasSettingsCache($module)) {
            // Load all settings for this module and store it as a dictionary
            if ($module === 'core') {
                $result = DB::getInstance()->query('SELECT `name`, `value` FROM `nl2_settings` WHERE `module` IS NULL')->results();
            } else {
                $result = DB::getInstance()->query('SELECT `name`, `value` FROM `nl2_settings` WHERE `module` = ?', [$module])->results();
            }

            $cache = [];
            foreach ($result as $row) {
                $cache[$row->name] = $row->value;
            }
            self::setSettingsCache($module, $cache);
        }

        $cache = &self::getSettingsCache($module);
        return $cache[$setting] ?? $fallback;
    }

    /**
     * Modify a setting in the database table `nl2_settings`.
     *
     * @param string $setting Setting name.
     * @param string|null $new_value New setting value, or null to delete
/home/novaverse-web/website/forum/core/classes/Database/PhinxAdapter.php
SELECT version, migration_name FROM nl2_phinxlog;
     * Checks the number of existing migration files compared to executed migrations in the database.
     * Alternatively we could check the output of a Phinx command, but that takes ~8x as long to execute.
     *
     * @throws RuntimeException If these numbers don't match.
     */
    public static function ensureUpToDate(): void {
        $migration_files = array_map(
            static function ($file_name) {
                [$version, $migration_name] = explode('_', $file_name, 2);
                $migration_name = str_replace(['.php', '_'], '', ucwords($migration_name, '_'));
                return $version . '_' . $migration_name;
            },
            array_filter(scandir(__DIR__ . '/../../migrations'), static function ($file_name) {
                // Pattern that matches Phinx migration file names (eg: 20230403000000_create_stroopwafel_table.php)
                return preg_match('/^\d{14}_\w+\.php$/', $file_name);
            }),
        );

        $migration_database_entries = array_map(static function ($row) {
            return $row->version . '_' . $row->migration_name;
        }, DB::getInstance()->query('SELECT version, migration_name FROM nl2_phinxlog')->results());

        $missing = array_diff($migration_files, $migration_database_entries);
        $extra = array_diff($migration_database_entries, $migration_files);

        // Likely a pull from the repo dev branch or migrations
        // weren't run during an upgrade script.
        if (($missing_count = count($missing)) > 0) {
            echo "There are $missing_count migrations files which have not been executed:" . '<br>';
            foreach ($missing as $missing_migration) {
                echo " - $missing_migration" . '<br>';
            }
        }

        // Something went wonky, either they've deleted migration files,
        // or they've added stuff to the nl2_phinxlog table.
        if (($extra_count = count($extra)) > 0) {
            if ($missing_count > 0) {
                echo '<br>';
            }
            echo "There are $extra_count executed migrations which do not have migration files associated:" . '<br>';

Notice: file_put_contents(): Write of 102 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213

Notice: file_put_contents(): Write of 192 bytes failed with errno=28 No space left on device in /home/novaverse-web/website/forum/core/classes/Misc/ErrorHandler.php on line 213