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
784 B
PHP
Raw Permalink 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 {
2014-01-26 13:22:04 +01:00
$this->expires_at = date('Y-m-d H:i:s', time() + ((int)$dur *60*60*24));
2013-10-27 01:06:58 +02:00
$duration = $dur;
}
$this->duration = $duration;
}
public function duration()
{
return $this->duration;
}
}