Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Settings.php
- =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- <?php
- final class Settings {
- public static $TRUE = "1", $FALSE = "0";
- public function __construct($connect = true) {
- // Web interface language. Languages are stored in the "lang/" directory.
- $this->lang = 'en_US.utf8';
- // Database information
- $this->host = 'sql9.freemysqlhosting.net';
- $this->port = 3306;
- $database = 'sql9264839';
- $username = 'sql9264839';
- $password = 'WCT1If52yi';
- // If you set a table prefix in config.yml, set it here as well
- $this->table_prefix = "litebans_";
- // Supported drivers: mysql, pgsql
- $driver = 'mysql';
- // Server name, shown on the main page and on the header
- $this->name = 'LiteBans';
- // Clicking on the header name will send you to this address.
- // $this->name_link = 'https://example.com';
- $this->name_link = 'index.php';
- // Here you can customize colors for the Bootstrap 4 theme that you are using.
- // Bootstrap 4 themes have four sets of colors: primary, secondary, light and dark.
- // Navbar classes: navbar-light, navbar-dark, bg-primary, bg-secondary, bg-light, bg-dark
- // Badge (label) classes: badge, badge-pill, badge-primary, badge-secondary, badge-light, badge-dark
- $this->navbar_classes = 'navbar-dark bg-primary';
- $this->badge_classes = 'badge-pill badge-secondary';
- $this->info_badge_classes = 'badge';
- // Show server scope column?
- $this->show_server_scope = true;
- // Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
- $this->show_inactive_bans = true;
- // Show silent bans?
- $this->show_silent_bans = true;
- // Show pager? This allows users to page through the list of bans.
- $this->show_pager = true;
- // Amount of bans/mutes/warnings to show on each page
- $this->limit_per_page = 10;
- // The server console will be identified by any of these names.
- // It will be given a standard name and avatar image.
- $this->console_aliases = array(
- "CONSOLE", "Console",
- );
- $this->console_name = "Console";
- $this->console_image = "inc/img/console.png";
- // Avatar images for all players will be fetched from this URL.
- // Examples:
- // 'https://cravatar.eu/avatar/{uuid}/25'
- // 'https://crafatar.com/avatars/{uuid}?size=25'
- // 'https://minotar.net/avatar/{uuid}/25'
- $this->avatar_source = 'https://crafatar.com/avatars/{uuid}?size=25';
- // `avatar_source_offline_mode` controls where avatars for offline-mode players are fetched from.
- // Offline-mode UUIDs are substituted for player names unless the `avatar_allow_offline_mode_uuids` option is enabled.
- // (This is done because avatar sources generally serve the default "Steve" avatar for *all* offline-mode UUIDs, including those of premium players)
- // Crafatar no longer supports names, so it cannot be used as an offline-mode player-name avatar source as of 2018-02-16 (https://crafatar.com/#meta-usernames)
- // Since "skins.minecraft.net" is no longer available, this could pose a problem for other avatar sources as well.
- $this->avatar_source_offline_mode = 'https://minotar.net/avatar/{name}/25';
- // If enabled, names will be shown below avatars instead of being shown next to them.
- $this->avatar_names_below = true;
- // If enabled, offline-mode UUIDs will be requested from avatar_source instead of player names.
- $this->avatar_allow_offline_mode_uuids = false;
- // If enabled, the total amount of bans, mutes, warnings, and kicks will be shown next to the buttons in the header.
- $this->header_show_totals = true;
- // The date format can be changed here.
- // https://secure.php.net/manual/en/function.strftime.php
- // Example output of default format: July 2, 2015, 09:19; August 4, 2016, 18:37
- $this->date_format = '%B %d, %Y, %H:%M';
- // https://secure.php.net/manual/en/timezones.php
- $timezone = "UTC";
- // Enable PHP error reporting.
- $this->error_reporting = true;
- // Enable error pages.
- $this->error_pages = true;
- $this->date_month_translations = null;
- // If your system locale doesn't automatically translate month names, you can set them manually here.
- // Change "if (false)" to "if (true)" for this to take effect.
- // X=>Y, X is replaced with Y. E.g. "January"=>"Januari"
- if (false) {
- $this->date_month_translations = array(
- "January" => "Month 1",
- "February" => "Month 2",
- "March" => "Month 3",
- "April" => "Month 4",
- "May" => "Month 5",
- "June" => "Month 6",
- "July" => "Month 7",
- "August" => "Month 8",
- "September" => "Month 9",
- "October" => "Month 10",
- "November" => "Month 11",
- "December" => "Month 12",
- );
- }
- /*** End of configuration ***/
- /** Don't modify anything here unless you know what you're doing **/
- if ($this->error_reporting) {
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- }
- $this->active_query = "";
- if ($driver === "pgsql") {
- Settings::$TRUE = "B'1'";
- Settings::$FALSE = "B'0'";
- }
- if (!$this->show_inactive_bans) {
- $this->active_query = self::append_query($this->active_query, "active=" . Settings::$TRUE);
- }
- if (!$this->show_silent_bans) {
- $this->active_query = self::append_query($this->active_query, "silent=" . Settings::$FALSE);
- }
- $this->test_strftime();
- date_default_timezone_set($timezone); // set configured timezone
- $table_prefix = $this->table_prefix;
- // Internal table names, do not translate.
- $this->table = array(
- 'bans' => "${table_prefix}bans",
- 'mutes' => "${table_prefix}mutes",
- 'warnings' => "${table_prefix}warnings",
- 'kicks' => "${table_prefix}kicks",
- 'history' => "${table_prefix}history",
- 'servers' => "${table_prefix}servers",
- 'config' => "${table_prefix}config",
- );
- $this->driver = $driver;
- if ($connect) {
- if ($username === "" && $password === "") {
- redirect("error/unconfigured.php");
- }
- $host = $this->host;
- $port = $this->port;
- $dsn = "$driver:dbname=$database;host=$host;port=$port";
- if ($driver === 'mysql') {
- $dsn .= ';charset=utf8';
- }
- $options = array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_EMULATE_PREPARES => false,
- PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
- );
- try {
- $this->conn = new PDO($dsn, $username, $password, $options);
- $st = $this->conn->query("SELECT * FROM " . $this->table['config'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- Settings::handle_error($this, $e);
- }
- if ($driver === 'pgsql') {
- $this->conn->query("SET NAMES 'UTF8';");
- }
- }
- }
- static function append_query($existing, $new) {
- if ($existing !== "") {
- return "$existing AND $new";
- }
- return "WHERE $new";
- }
- /**
- * @param $settings Settings
- * @param $e Exception
- */
- static function handle_error($settings, $e) {
- $message = $e->getMessage();
- if ($settings->error_pages) {
- if (strstr($message, "Access denied for user")) {
- if ($settings->error_reporting) {
- redirect("error/access-denied.php?error=" . base64_encode($message));
- } else {
- redirect("error/access-denied.php");
- }
- }
- if (strstr($message, "Base table or view not found:")) {
- try {
- $st = $settings->conn->query("SELECT * FROM " . $settings->table['bans'] . " LIMIT 1;");
- $st->fetch();
- $st->closeCursor();
- } catch (PDOException $e) {
- redirect("error/tables-not-found.php");
- }
- redirect("error/outdated-plugin.php");
- }
- if (strstr($message, "Unknown column")) {
- redirect("error/outdated-plugin.php");
- }
- }
- if ($settings->error_reporting === false) {
- die("Database error");
- }
- die("Database error: $message");
- }
- private function test_strftime() {
- // If you modify this function, you may get an "Assertion failed" error.
- date_default_timezone_set("UTC"); // temporarily set UTC timezone for testing purposes
- $fail = false;
- $test = gmstrftime($this->date_format, 0);
- if ($test == false) {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Error: date_format test failed. gmstrftime(\"" . $this->date_format . "\",0) returned $testdump");
- $fail = true;
- }
- $test = gmstrftime("%Y-%m-%d %H:%M", 0);
- if ($test !== "1970-01-01 00:00") {
- ob_start();
- var_dump($test);
- $testdump = ob_get_clean();
- echo("Assertion failed: gmstrftime(\"%Y-%m-%d %H:%M\",0) != \"1970-01-01 00:00\"<br>");
- echo("Actual result: $testdump");
- $fail = true;
- }
- if ($fail === true) {
- die;
- }
- }
- }
- =x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=
- config.yml
- =x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=x=
- # LiteBans config.yml generated by version 2.2.5
- # If bungeecord is set to true, banned players will be kicked from BungeeCord itself.
- # (Players will not be kicked to the lobby when they are banned.)
- # This option has no effect if the plugin is running directly under BungeeCord.
- bungeecord: false
- # If this option is enabled and the server is connected to a remote database (e.g. MySQL),
- # LiteBans will synchronize across all servers connected to that database with sync enabled.
- sync: true
- # If enabled, broadcasts will be synchronized.
- sync_broadcasts: true
- # If enabled, notifications will be synchronized.
- sync_notifications: true
- # If enabled, dupeip notifications will be synchronized.
- # This will appear multiple times if a player joins multiple servers, so you might want to leave this disabled.
- sync_dupeip_notifications: false
- # The server name is an identifier used in cross-server synchronization.
- # It represents a single plugin instance (or group of instances) and can be updated at any time.
- # If you need per-server bans, you have to change server_name on all instances
- # The "$serverScope" and "$serverOrigin" variables can be used in messages.
- # Maximum length is 32 characters.
- server_name: 'litebans'
- # This option decides which server(s) will be affected in commands by default.
- default_server_scope: '*'
- sql:
- # H2, MySQL, MariaDB, and PostgreSQL are supported database drivers.
- driver: H2
- ## MySQL/PostgreSQL settings ##
- # If using H2, the database will be stored in the LiteBans plugin folder,
- # and most of these settings won't apply.
- # Database server address.
- address: 'sql9.freemysqlhosting.net'
- # Database name, username and password.
- database: 'sql9264839'
- username: 'sql9264839'
- password: 'WCT1If52yi'
- table_prefix: 'litebans_'
- # LiteBans utilizes connection pooling for extra performance and reliability.
- # min_connections: Minimum amount of pooled connections.
- # max_connections: Maximum amount of pooled connections. See: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
- # timeout: Connection timeout.
- # idle_timeout: Maximum amount of time a pooled connection can remain idle before it is closed for inactivity.
- pool:
- min_connections: 1
- max_connections: 10
- timeout: 30 seconds
- idle_timeout: 1 minute
- # Database engine. Only applies to MySQL.
- engine: InnoDB
- options: 'useSSL=false'
- # Format: <name>:<class>[:URL:version]
- # SQLite is only included here for backwards compatibility, it is no longer supported (use H2 instead).
- drivers:
- - version:1
- - 'h2:org.h2.Driver:https://repo1.maven.org/maven2/com/h2database/h2/{}/h2-{}.jar:1.4.196'
- durations:
- # Can be bypassed with the permission "litebans.unlimited.ban"
- tempban_max: 14 days
- # Can be bypassed with the permission "litebans.unlimited.mute"
- mute_max: 14 day
- # If true, players will not get an error when using a duration higher than the configured limit.
- # The duration will be rounded down to the maximum duration instead.
- round_down: true
- mutes:
- enabled: true
- # All of these commands can not be used while muted.
- command_blacklist:
- - /me
- - /say
- - /tell
- - /whisper
- - /reply
- - /pm
- - /message
- - /msg
- - /emsg
- - /epm
- - /etell
- - /ewhisper
- - /w
- - /m
- - /t
- - /r
- mutechat_command_blacklist:
- - /me
- - /say
- # If enabled, muted players cannot use commands containing ":", for example: "/minecraft:me".
- prevent_bypass: true
- # If set, a ban or mute reason must be provided, otherwise players will get an error.
- # When set to false, "default_ban_reason" and "default_mute_reason" in messages.yml are used as reasons when no reason is provided.
- require_ban_mute_reason: false
- warnings:
- # Warnings will expire after this duration has passed.
- expire_after: 7 days
- # Warning actions.
- # Format: <amount>[+]:<action>
- # If '+' is provided after the amount, the action will execute if the player has that amount of warnings or more.
- actions:
- - '3:/kick -s:$silent $player Final warning: $reason'
- - '4:/tempban -s:$silent $player 1 day Reached 4 warnings: $list'
- # If enabled, the console will execute warning actions.
- # Otherwise, the player who executes the last warning also executes the warning action.
- actions_execute_as_console: false
- # If enabled, all active warnings will be deactivated after a warning action is executed.
- delete_warnings_after_action: false
- notify:
- # If enabled, players with the permission 'litebans.notify' or 'litebans.notify.banned_join' will be notified when a banned player tries to join.
- banned_player_join: true
- # If enabled, /dupeip output will be shown on join if the player meets certain conditions.
- dupeip_on_join: true
- # Notify if the player has a banned account on the same IP.
- dupeip_on_banned_account: true
- # If enabled, muted accounts will be detected with /dupeip.
- # This is disabled by default since it can add quite a lot of query overhead on larger servers especially if dupeip_on_join is enabled.
- dupeip_show_muted_accounts: false
- # If you set this to a lower value, players with X accounts will send dupeip notifications.
- dupeip_on_join_threshold: 9999999
- # Log all notifications to the console?
- notify_console: true
- exempt:
- enable: true
- # By default, the first loaded world is used for permission checks.
- permission_world: default
- # Permission groups that are exempt from bans, mutes, warnings, and kicks.
- exempt_groups: []
- # Players who are exempt from bans, mutes, warnings, and kicks.
- # Format: <name/UUID>[:type]
- # Type can be ban, mute, warning, or kick.
- # Example:
- # exempt_players: ['Player', 'Player:kick', 'Player2']
- exempt_players: []
- geoip:
- enable: false
- # Anyone from these locations will not be able to join.
- # A full list of countries that can be blacklisted:
- # https://dev.maxmind.com/geoip/legacy/codes/iso3166/
- # Example:
- # blacklist: ['Australia', 'Brazil', 'Canada', 'Denmark']
- blacklist: []
- # If the whitelist is not empty, all countries which are not found in the list will be blocked.
- whitelist: []
- download:
- # Download links for the API and database. They are downloaded to the 'plugins/LiteBans/geoip' folder.
- # You shouldn't need to change these, but if it isn't working, you can search for these files.
- api:
- - https://repo1.maven.org/maven2/com/maxmind/geoip2/geoip2/2.1.0/geoip2-2.1.0.jar
- - https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.4.3/jackson-databind-2.4.3.jar
- - https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.4.3/jackson-core-2.4.3.jar
- - https://repo1.maven.org/maven2/com/maxmind/db/maxmind-db/1.0.0/maxmind-db-1.0.0.jar
- - https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.4.3/jackson-annotations-2.4.3.jar
- # Will be extracted and saved as 'GeoLite2-Country.mmdb'.
- db: https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz
- # After configuring import options, run "/litebans import start" to begin the import.
- # The import process occurs while the server is running, no downtime is required.
- import:
- # You can import from: MaxBans, Ultrabans, BanHammer, BanManagerv4, BanManagerv5, BungeeAdminTools, LiteBans, Vanilla.
- # Vanilla means importing from banned-players.json, which is also used by Essentials.
- from: maxbans
- # If enabled, importing will be done from a SQLite database instead of a MySQL database.
- # You can ignore this if importing from banned-players.json.
- # If importing from LiteBans, H2 will be used instead of SQLite.
- sqlite: true
- # SQLite file locations:
- # MaxBans: plugins/MaxBans/bans.db
- # Ultrabans: plugins/Ultrabans/banlist.db
- # BanHammer: plugins/BanHammer/BanHammer.db
- # LiteBans: plugins/LiteBans/litebans.sqlite (legacy)
- sqlite_file: plugins/MaxBans/bans.db
- import_ipbans: true
- ## MySQL import settings ##
- import_mysql_address: localhost:3306
- import_mysql_database: maxbans
- import_mysql_username: ''
- import_mysql_password: ''
- # Use display names?
- # This means that when moderators and punished players change their name using /nick,
- # this name will be used in broadcasts and other messages instead of their regular name.
- # The BungeeCord version of the plugin cannot detect Spigot-side display names.
- use_display_names: false
- # Instead of "CONSOLE", this name will be used to represent the console.
- console_sender_name: Console
- # Players in this list will not be shown in /dupeip or /alts output.
- # Names, UUIDs and IP addresses can be specified.
- hidden_dupeip_players: []
- # A player cannot be warned again while they are on cooldown.
- # This prevents two moderators from warning the same player for the same reason.
- warning_cooldown: 30
- # If enabled, online player names will be auto-completed.
- # Example: /ban Pl -> /ban Player
- autocomplete_online_player_names: false
- # This allows /dupeip and /ipreport to scan every single IP address that a player has ever joined with.
- # If set to false, it will only scan the last IP address.
- dupeip_scan_all_ips: false
- # /ipreport will not show accounts that have no other players attached by default.
- ipreport_minimum_accounts: 1
- # If disabled, all previous IP addresses will be recorded, allowing /iphistory to work.
- delete_previous_history: true
- # If enabled, all previous login history will be unbanned when unbanning a player.
- unban_all_history: false
- # This is the amount of bans shown on each page for /banlist.
- # Note that ban entries can span 2-3 lines.
- banlist_bans_per_page: 5
- # Only show active bans for /banlist?
- banlist_show_active_only: false
- # If enabled, AuthMe will be detected and IP history will only be added after a player has successfully logged in.
- # This option will only work under Spigot, since AuthMe is a Spigot plugin.
- support_authme: true
- lockdown:
- # If enabled, /lockdown will continue after restarts.
- persist_enabled: true
- debug_level: 0
- # If enabled, this performs an additional two database queries on each join
- # in order to provide case-insensitive name bans.
- ban_names: false
- # If a kick message contains any of these, it will not be added to the database.
- # You can set this list to [''] if you don't want any kicks to be added to the database.
- ignored_kick_messages: ['restarting']
- # This option controls how often notifications are sent from a single player.
- # When a player tries to join when banned or talk while muted,
- # you won't see any more messages from them for a short while.
- notification_throttle_ticks: 12000
- # If enabled, LiteBans will use the database server's time rather than the local system time.
- use_database_time: false
- # If enabled, the plugin will notify you when an update is available.
- update_check: true
- # If enabled, players will be checked for bans after they have joined. (Spigot only)
- check_after_join: false
- # If enabled, ProtocolLib will be detected and chat events will be cancelled before they can be processed by any other plugins.
- # This can help prevent plugin conflicts which allow muted players to chat.
- # This option will only work under Spigot, since ProtocolLib is a Spigot plugin.
- use_protocollib: true
- # This option controls the behaviour of the "-N" flag. This flag prevents active bans/mutes from being overridden.
- # If enabled, the "-N" flag will only prevent bans from being overridden if the active ban has a lower duration.
- override_lower_duration: true
- # This option allows you to disable recording IP history on specific servers under BungeeCord.
- # Example: ignored_history_servers: ['Lobby']
- ignored_history_servers: []
- # If enabled, the local system timezone will be used.
- # UTC time will be stored in the database, but dates will be formatted using the timezone offset.
- use_timezone: true
- # This option controls how often the database is polled for sync data (cross-server punishments, kicks, notifications).
- sync_poll_ticks: 20
- # If this is set above 0, the plugin will skip polling up to N times while no players are online.
- sync_poll_skip: 5
Add Comment
Please, Sign In to add comment