more
This commit is contained in:
		
							parent
							
								
									973a53c9bb
								
							
						
					
					
						commit
						06fffd6328
					
				| @ -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; | ||||
|     } | ||||
|  | ||||
| @ -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; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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"; | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user