mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-07-09 15:27:32 +00:00
Add configurable console aliases, name, and image
This commit is contained in:
parent
e4de92b925
commit
82a6dcbff0
BIN
includes/img/console.png
Normal file
BIN
includes/img/console.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 288 B |
@ -91,7 +91,12 @@ class Page {
|
||||
* @return string
|
||||
*/
|
||||
function get_avatar($name) {
|
||||
return "<img class='avatar noselect' src='https://cravatar.eu/avatar/$name/25'/>$name";
|
||||
$src = "https://cravatar.eu/avatar/$name/25";
|
||||
if (in_array($name, $this->settings->console_aliases)) {
|
||||
$src = $this->settings->console_image;
|
||||
$name = $this->settings->console_name;
|
||||
}
|
||||
return "<img class='avatar noselect' src='$src'/>$name";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,12 +125,16 @@ class Page {
|
||||
*/
|
||||
function get_banner_name($row) {
|
||||
$uuid = $row['banned_by_uuid'];
|
||||
$display_name = $row['banned_by_name'];
|
||||
$console_aliases = $this->settings->console_aliases;
|
||||
if (in_array($uuid, $console_aliases) || in_array($row['banned_by_name'], $console_aliases)) {
|
||||
return $this->settings->console_name;
|
||||
}
|
||||
$name = $this->get_name($uuid);
|
||||
if ($name !== null) {
|
||||
return $name;
|
||||
}
|
||||
$name = $row['banned_by_name'];
|
||||
return $this->clean($name);
|
||||
return $this->clean($display_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace litebans;
|
||||
|
||||
use PDO, PDOException;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
|
||||
final class Settings {
|
||||
public static $TRUE = "1", $FALSE = "0";
|
||||
@ -22,6 +23,9 @@ final class Settings {
|
||||
$username = 'root';
|
||||
$password = 'password';
|
||||
|
||||
// Supported drivers: mysql, pgsql
|
||||
$driver = 'mysql';
|
||||
|
||||
// Show inactive bans? Removed bans will show (Unbanned), mutes will show (Unmuted), warnings will show (Expired).
|
||||
$this->show_inactive_bans = true;
|
||||
|
||||
@ -34,14 +38,20 @@ final class Settings {
|
||||
// If you set a table prefix in config.yml, set it here as well
|
||||
$table_prefix = "";
|
||||
|
||||
// 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 = "includes/img/console.png";
|
||||
|
||||
// The date format can be changed here.
|
||||
// https://secure.php.net/manual/en/function.date.php
|
||||
// Example of default: July 2, 2015, 9:19 PM
|
||||
$this->date_format = 'F j, Y, g:i A';
|
||||
date_default_timezone_set("UTC");
|
||||
|
||||
// Supported drivers: mysql, pgsql
|
||||
$driver = 'mysql';
|
||||
|
||||
/*** End of configuration ***/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user