From 06fffd6328bcf3230b78e07ccda3a73121fc1157 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 26 Jan 2020 17:39:55 +0000 Subject: [PATCH] more --- core/user.php | 12 ++++++------ ext/admin/main.php | 2 +- ext/comment/main.php | 4 ++-- ext/log_db/main.php | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/user.php b/core/user.php index c175026f..c0c21f3c 100644 --- a/core/user.php +++ b/core/user.php @@ -99,7 +99,7 @@ class User public static function by_name(string $name): ?User { global $database; - $row = $database->get_row($database->scoreql_to_sql("SELECT * FROM users WHERE LOWER(name) = LOWER(:name)"), ["name"=>$name]); + $row = $database->get_row("SELECT * FROM users WHERE LOWER(name) = LOWER(:name)", ["name"=>$name]); return is_null($row) ? null : new User($row); } @@ -107,7 +107,7 @@ class User { $u = User::by_name($name); if (is_null($u)) { - throw new ScoreException("Can't find any user named " . html_escape($name)); + throw new ScoreException("Can't find any user named $name"); } else { return $u->id; } @@ -121,17 +121,17 @@ class User } if ($my_user) { if ($my_user->passhash == md5(strtolower($name) . $pass)) { - log_info("core-user", "Migrating from md5 to bcrypt for ".html_escape($name)); + log_info("core-user", "Migrating from md5 to bcrypt for $name"); $my_user->set_password($pass); } if (password_verify($pass, $my_user->passhash)) { - log_info("core-user", "Logged in as ".html_escape($name)." ({$my_user->class->name})"); + log_info("core-user", "Logged in as $name ({$my_user->class->name})"); return $my_user; } else { - log_warning("core-user", "Failed to log in as ".html_escape($name)." (Invalid password)"); + log_warning("core-user", "Failed to log in as $name (Invalid password)"); } } else { - log_warning("core-user", "Failed to log in as ".html_escape($name)." (Invalid username)"); + log_warning("core-user", "Failed to log in as $name (Invalid username)"); } return null; } diff --git a/ext/admin/main.php b/ext/admin/main.php index 1677a397..78c51e88 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -145,7 +145,7 @@ class AdminPage extends Extension $database->execute($database->scoreql_to_sql( "UPDATE tags SET tag=:tag1 WHERE LOWER(tag) = LOWER(:tag2)" ), ["tag1" => $_POST['tag'], "tag2" => $_POST['tag']]); - log_info("admin", "Fixed the case of ".html_escape($_POST['tag']), "Fixed case"); + log_info("admin", "Fixed the case of {$_POST['tag']}", "Fixed case"); return true; } diff --git a/ext/comment/main.php b/ext/comment/main.php index a9f43896..45cea812 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -498,8 +498,8 @@ class CommentList extends Extension return false; } - $window = int_escape($config->get_int('comment_window')); - $max = int_escape($config->get_int('comment_limit')); + $window = $config->get_int('comment_window'); + $max = $config->get_int('comment_limit'); if ($database->get_driver_name() == DatabaseDriver::MYSQL) { $window_sql = "interval $window minute"; diff --git a/ext/log_db/main.php b/ext/log_db/main.php index b78e33eb..023d525d 100644 --- a/ext/log_db/main.php +++ b/ext/log_db/main.php @@ -98,7 +98,7 @@ class ActorColumn extends Column class MessageColumn extends Column { - public function __construct($name, $title) + public function __construct(string $name, string $title) { parent::__construct($name, $title); $this->sortable = false; @@ -109,7 +109,7 @@ class MessageColumn extends Column return "({$this->name} LIKE :{$this->name}_0 AND priority >= :{$this->name}_1)"; } - public function read_input($inputs) + public function read_input(array $inputs) { $ret = emptyHTML( INPUT([ @@ -167,7 +167,7 @@ class MessageColumn extends Column return SPAN(["style"=>"color: $c"], rawHTML($this->scan_entities($row[$this->name]))); } - protected function scan_entities($line) + protected function scan_entities(string $line) { return preg_replace_callback("/Image #(\d+)/s", [$this, "link_image"], $line); }