mirror of
https://github.com/twisterarmy/twister-phpbot.git
synced 2025-01-09 22:47:51 +00:00
31 lines
600 B
PHP
31 lines
600 B
PHP
<?php
|
|
|
|
class HabrRSSDb
|
|
{
|
|
protected $hDatabase = null;
|
|
|
|
public function __construct($dbFile)
|
|
{
|
|
fclose(fopen($dbFile, 'a')); // create file if not exists
|
|
$this->hDatabase = fopen($dbFile, 'r+');
|
|
}
|
|
|
|
public function __destruct()
|
|
{
|
|
fclose($this->hDatabase);
|
|
}
|
|
|
|
public function isPublished($id)
|
|
{
|
|
fseek($this->hDatabase, $id);
|
|
$status = fgetc($this->hDatabase);
|
|
return $status === '1';
|
|
}
|
|
|
|
public function setPublished($id)
|
|
{
|
|
fseek($this->hDatabase, $id);
|
|
fwrite($this->hDatabase, '1');
|
|
}
|
|
}
|