mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:27:03 +02:00
added an option to limit message restores
This commit is contained in:
@ -171,6 +171,21 @@ class ModelAuditAudit extends Model {
|
||||
}
|
||||
|
||||
|
||||
public function can_restore() {
|
||||
|
||||
if(MAX_RESTORE_PER_HOUR <= 0 || Registry::get('auditor_user') == 1) { return 1; }
|
||||
|
||||
$session = Registry::get('session');
|
||||
|
||||
$email = $session->get("email");
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS num FROM " . TABLE_AUDIT . " WHERE email=? AND ts > ? AND action=?", array($email, NOW-3600, ACTION_RESTORE_MESSAGE));
|
||||
|
||||
if($query->row['num'] <= MAX_RESTORE_PER_HOUR) { return 1; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user