mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 16:32:45 +00:00
Minor performance improvements / cleanup
This commit is contained in:
parent
33183b1db5
commit
8e33ed362c
@ -38,7 +38,7 @@ class Check {
|
||||
redirect($page->link("info.php?id=$name&type=$type"));
|
||||
return;
|
||||
}
|
||||
$name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
|
||||
$name = htmlspecialchars($name, ENT_QUOTES);
|
||||
$this->println(str_replace("{name}", $name, $page->t("error.name.unseen")));
|
||||
return;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
if ($error !== false) {
|
||||
// sanitize user input
|
||||
$error = htmlspecialchars($error, ENT_QUOTES, "UTF-8");
|
||||
$error = htmlspecialchars($error, ENT_QUOTES);
|
||||
|
||||
echo $error;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class History {
|
||||
if ($st->execute()) {
|
||||
while ($row = $st->fetch(PDO::FETCH_ASSOC)) {
|
||||
$row['__table__'] = $type;
|
||||
array_push($array, $row);
|
||||
$array[] = $row;
|
||||
}
|
||||
}
|
||||
$st->closeCursor();
|
||||
@ -173,7 +173,7 @@ try {
|
||||
foreach ($all as $row) {
|
||||
$i++;
|
||||
if ($i > $limit) break;
|
||||
array_push($trim, $row);
|
||||
$trim[] = $row;
|
||||
}
|
||||
$all = $trim;
|
||||
}
|
||||
|
17
inc/page.php
17
inc/page.php
@ -214,8 +214,8 @@ class Page {
|
||||
$bitColumns = array("active", "ipban");
|
||||
|
||||
if ($table === $this->settings->table['warnings']) {
|
||||
array_push($columns, "warned");
|
||||
array_push($bitColumns, "warned");
|
||||
$columns[] = "warned";
|
||||
$bitColumns[] = "warned";
|
||||
}
|
||||
|
||||
if ($table !== $this->settings->table['kicks']) {
|
||||
@ -228,7 +228,7 @@ class Page {
|
||||
if ($phpIsBroken === true) {
|
||||
foreach ($bitColumns as $column) {
|
||||
unset($columns[$column]);
|
||||
array_push($columns, "CAST($column AS UNSIGNED) AS $column");
|
||||
$columns[] = "CAST($column AS UNSIGNED) AS $column";
|
||||
}
|
||||
}
|
||||
return implode(",", $columns);
|
||||
@ -249,7 +249,7 @@ class Page {
|
||||
}
|
||||
|
||||
$uuid = $this->uuid_undashify($uuid);
|
||||
$src = str_replace('{name}', $name, str_replace('{uuid}', $uuid, $avatar_source));
|
||||
$src = str_replace(array('{uuid}', '{name}'), array($uuid, $name), $avatar_source);
|
||||
if (in_array($name, $this->settings->console_aliases) || $name === $this->settings->console_name) {
|
||||
$src = $this->resource($this->settings->console_image);
|
||||
$name = $this->settings->console_name;
|
||||
@ -324,7 +324,7 @@ class Page {
|
||||
if (strstr($text, "\xa7") || strstr($text, "&")) {
|
||||
$text = preg_replace("/(?i)(\x{00a7}|&)[0-9A-FK-OR]/u", "", $text);
|
||||
}
|
||||
$text = htmlspecialchars($text, ENT_QUOTES, "UTF-8");
|
||||
$text = htmlspecialchars($text, ENT_QUOTES);
|
||||
if (strstr($text, "\n")) {
|
||||
$text = preg_replace("/\n/", "<br>", $text);
|
||||
}
|
||||
@ -493,7 +493,7 @@ class Page {
|
||||
} else {
|
||||
$header = $this->t("table.$header");
|
||||
}
|
||||
array_push($headers_translated, $header);
|
||||
$headers_translated[] = $header;
|
||||
}
|
||||
$this->table_print_headers($headers_translated);
|
||||
$this->table_headers_printed = true;
|
||||
@ -663,10 +663,7 @@ class Page {
|
||||
public function where_append($where) {
|
||||
if ($where !== "") {
|
||||
return "$where AND ";
|
||||
} else {
|
||||
}
|
||||
return "WHERE ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ final class PageTest extends TestCase {
|
||||
public function testHistoryPagerHTML(): void {
|
||||
$page = new Page("test", false);
|
||||
foreach (explode("\n", file_get_contents("./inc/test/php/test_setup.sql")) as $query) {
|
||||
if (strlen($query) > 0) {
|
||||
if ($query !== '') {
|
||||
$page->conn->query($query);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user