<?php
/**
*
* @author Benjamin Gillissen <hide@address.com>
*
* **************************************************************
Copyright (C) 2009 Benjamin Gillissen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details at:
http://www.gnu.org/copyleft/gpl.html
* **************************************************************
*/
class nzbdb extends dbobject {
public function __construct($cnf='nzb'){ parent::__construct($cnf); }
public function exists($nzbid){
$arg=Array('id' => $nzbid);
return $this->dbquery($arg, __FUNCTION__);
}
public function get_infos($nzbid){
$arg=Array('id' => $nzbid);
return $this->dbquery($arg, __FUNCTION__);
}
public function get_idbyfile($file){
$arg=Array('file' => $file);
return $this->dbquery($arg, __FUNCTION__, 'nzbid');
}
public function import_nzb($file, $catid){
$arg=Array('catid' => $catid, 'file' => $file);
return $this->dbquery($arg, __FUNCTION__);
}
public function remove_nzb($nzbid){
$arg=Array('id' => $nzbid);
return $this->dbquery($arg, __FUNCTION__);
}
public function list_all($start=NULL, $end=NULL){
if ( $start === NULL ){ $start = 0; }
if ( $end === NULL ){ $end = 100; }
$arg=Array('min' => $start, 'max' => $end);
return $this->dbquery($arg, __FUNCTION__, 'nzbid');
}
public function list_bycat($catid, $start=NULL, $end=NULL){
if ( $start === NULL ){ $start = 0; }
if ( $end === NULL ){ $end = 100; }
$arg=Array('id' => $catid, 'min' => $start, 'max' => $end);
return $this->dbquery($arg, __FUNCTION__, 'nzbid');
}
public function search_all($search, $start=NULL, $end=NULL){
if ( $start === NULL ){ $start = 0; }
if ( $end === NULL ){ $end = 100; }
$arg=Array('search' => $search, 'min' => $start, 'max' => $end);
return $this->dbquery($arg, __FUNCTION__, 'nzbid');
}
public function search_bycat($search, $catid, $start=NULL, $end=NULL){
if ( $start === NULL ){ $start = 0; }
if ( $end === NULL ){ $end = 100; }
$arg=Array('id' => $catid, 'search' => $search, 'min' => $start, 'max' => $end);
return $this->dbquery($arg, __FUNCTION__, 'nzbid');
}
public function count_all(){ return $this->dbquery(Array(), __FUNCTION__); }
public function count_bycat($catid){
$arg=Array('id' => $catid);
return $this->dbquery($arg, __FUNCTION__);
}
public function count_searchbycat($search, $catid){
$arg=Array('id' => $catid, 'search' => $search);
return $this->dbquery($arg, __FUNCTION__);
}
public function count_searchall($search){
$arg=Array('search' => $search);
return $this->dbquery($arg, __FUNCTION__);
}
}