mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
|
|
use newznab\db\Settings;
|
|
|
|
class UserSeries
|
|
{
|
|
public function addShow($uid, $rageid, $catid=array())
|
|
{
|
|
$db = new Settings();
|
|
|
|
$catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null";
|
|
|
|
$sql = sprintf("insert into userseries (userid, rageid, categoryid, createddate) values (%d, %d, %s, now())", $uid, $rageid, $catid);
|
|
return $db->queryInsert($sql);
|
|
}
|
|
|
|
public function getShows($uid)
|
|
{
|
|
$db = new Settings();
|
|
$sql = sprintf("select userseries.*, tvrage.releasetitle from userseries inner join (SELECT id, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageid = userseries.rageid where userid = %d order by tvrage.releasetitle asc", $uid);
|
|
return $db->query($sql);
|
|
}
|
|
|
|
public function delShow($uid, $rageid)
|
|
{
|
|
$db = new Settings();
|
|
$db->queryExec(sprintf("DELETE from userseries where userid = %d and rageid = %d ", $uid, $rageid));
|
|
}
|
|
|
|
public function getShow($uid, $rageid)
|
|
{
|
|
$db = new Settings();
|
|
$sql = sprintf("select userseries.*, tvrage.releasetitle from userseries left outer join (SELECT id, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageid = userseries.rageid where userseries.userid = %d and userseries.rageid = %d ", $uid, $rageid);
|
|
return $db->queryOneRow($sql);
|
|
}
|
|
|
|
public function delShowForUser($uid)
|
|
{
|
|
$db = new Settings();
|
|
$db->queryExec(sprintf("DELETE from userseries where userid = %d", $uid));
|
|
}
|
|
|
|
public function delShowForSeries($sid)
|
|
{
|
|
$db = new Settings();
|
|
$db->queryExec(sprintf("DELETE from userseries where rageid = %d", $sid));
|
|
}
|
|
|
|
public function updateShow($uid, $rageid, $catid=array())
|
|
{
|
|
$db = new Settings();
|
|
|
|
$catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null";
|
|
|
|
$sql = sprintf("update userseries set categoryid = %s where userid = %d and rageid = %d", $catid, $uid, $rageid);
|
|
$db->queryExec($sql);
|
|
}
|
|
} |