This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/app/models/IpBans.php

38 lines
773 B
PHP
Raw Normal View History

2013-10-27 01:06:58 +02:00
<?php
class IpBans extends Rails\ActiveRecord\Base
{
protected $duration;
static public function tableName()
{
return 'ip_bans';
}
protected function associations()
{
return array(
'belongs_to' => array(
'user' => array('foreign_key' => 'banned_by')
)
);
}
public function setDuration($dur)
{
if (!$dur) {
$this->expires_at = '00-00-00 00:00:00';
$duration = null;
} else {
$this->expires_at = date('Y-m-d H:i:s', strtotime('-1 day'));
$duration = $dur;
}
$this->duration = $duration;
}
public function duration()
{
return $this->duration;
}
}