fixed notifying non-existent user
This commit is contained in:
parent
60501428ce
commit
45b778484a
@ -1,6 +1,12 @@
|
||||
<?php
|
||||
function cavern_notify_user($username, $message="你有新的通知!", $url="", $type="") {
|
||||
global $SQL;
|
||||
try {
|
||||
// do not notify the user that doesn't exist
|
||||
$user = new User($username);
|
||||
} catch (NoUserException $e) {
|
||||
return $e;
|
||||
}
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$SQL->query("INSERT INTO `notification` (`username`, `message`, `url`, `type`, `time`) VALUES ('%s', '%s', '%s', '%s', '%s')", array($username, $message, $url, $type, $time));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user