本文整理汇总了PHP中Releases类的典型用法代码示例。如果您正苦于以下问题:PHP Releases类的具体用法?PHP Releases怎么用?PHP Releases使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Releases类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendToNZBGet
public function sendToNZBGet($guid)
{
$releases = new Releases();
$reldata = $releases->getByGuid($guid);
$url = "{$this->serverurl}getnzb/{$guid}&i={$this->uid}&r={$this->rsstoken}";
$header = <<<NZBGet_URL
<?xml version="1.0"?>
<methodCall>
\t<methodName>appendurl</methodName>
\t<params>
\t\t<param>
\t\t\t<value><string>{$reldata['searchname']}.nzb</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><string>{$reldata['category_name']}</string></value>
\t\t</param>
\t\t<param>
\t\t\t<value><i4>0</i4></value>
\t\t</param>
\t\t<param>
\t\t\t<value><boolean>>False</boolean></value>
\t\t</param>
\t\t<param>
\t\t\t<value>
\t\t\t\t<string>{$url}</string>
\t\t\t</value>
\t\t</param>
\t</params>
</methodCall>
NZBGet_URL;
getUrl($this->fullurl() . "appendurl", "POST", $header);
}
示例2: delete
public function delete($id)
{
$db = new DB();
$this->delCartForUser($id);
$this->delUserCategoryExclusions($id);
$releases = new Releases();
$releases->deleteCommentsForUser($id);
$forum = new Forum();
$forum->deleteUser($id);
$db->query(sprintf("delete from users where ID = %d", $id));
}
示例3: sendURLToNZBGet
/**
* Send a NZB URL to NZBGet.
*
* @param string $guid Release identifier.
*
* @return bool|mixed
*
* @access public
*/
public function sendURLToNZBGet($guid)
{
$reldata = $this->Releases->getByGuid($guid);
$header = '<?xml version="1.0"?>
<methodCall>
<methodName>appendurl</methodName>
<params>
<param>
<value><string>' . $reldata['searchname'] . '.nzb' . '</string></value>
</param>
<param>
<value><string>' . $reldata['category_name'] . '</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>' . $this->serverurl . 'getnzb/' . $guid . '%26i%3D' . $this->uid . '%26r%3D' . $this->rsstoken . '</string>
</value>
</param>
</params>
</methodCall>';
nzedb\utility\getUrl($this->fullURL . 'appendurl', 'post', $header);
}
示例4: sendURLToNZBGet
/**
* Send a NZB URL to NZBGet.
*
* @param string $guid Release identifier.
*
* @return bool|mixed
*
* @access public
*/
public function sendURLToNZBGet($guid)
{
$reldata = $this->Releases->getByGuid($guid);
$url = "{$this->serverurl}getnzb/{$guid}&i={$this->uid}&r={$this->rsstoken}";
$header = '<?xml version="1.0"?>
<methodCall>
<methodName>appendurl</methodName>
<params>
<param>
<value><string>' . $reldata['searchname'] . '.nzb' . '</string></value>
</param>
<param>
<value><string>' . $reldata['category_name'] . '</string></value>
</param>
<param>
<value><i4>0</i4></value>
</param>
<param>
<value><boolean>>False</boolean></value>
</param>
<param>
<value>
<string>' . $url . '</string>
</value>
</param>
</params>
</methodCall>';
Utility::getUrl(['url' => $this->fullURL . 'appendurl', 'method' => 'post', 'postdata' => $header, 'verifycert' => false]);
}
示例5: getInstance
public static function getInstance()
{
if (!self::$releases_instance) {
self::$releases_instance = new Releases();
}
return self::$releases_instance;
}
示例6: purge
public function purge($id)
{
$db = new DB();
$releases = new Releases();
$binaries = new Binaries();
$this->reset($id);
$rels = $db->query(sprintf("select ID from releases where groupID = %d", $id));
foreach ($rels as $rel) {
$releases->delete($rel["ID"]);
}
$bins = $db->query(sprintf("select ID from binaries where groupID = %d", $id));
foreach ($bins as $bin) {
$binaries->delete($bin["ID"]);
}
}
示例7: deleteReleases
/**
* Delete releases from the database.
*/
protected function deleteReleases()
{
$deletedCount = 0;
foreach ($this->result as $release) {
if ($this->delete) {
$this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage);
if ($this->echoCLI) {
echo $this->pdo->log->primary('Deleting: ' . $this->method . ': ' . $release['searchname']);
}
} elseif ($this->echoCLI) {
echo $this->pdo->log->primary('Would be deleting: ' . $this->method . ': ' . $release['searchname']);
}
$deletedCount++;
}
$this->deletedCount += $deletedCount;
return true;
}
示例8: __construct
/**
* @param array $options Echo to cli / Class instances.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'ReleaseImage' => null, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo);
$this->movieqty = $this->pdo->getSetting('maxxxxprocessed') != '' ? $this->pdo->getSetting('maxxxxprocessed') : 100;
$this->showPasswords = Releases::showPasswords($this->pdo);
$this->debug = NN_DEBUG;
$this->echooutput = $options['Echo'] && NN_ECHOCLI;
$this->imgSavePath = NN_COVERS . 'xxx' . DS;
$this->cookie = NN_TMP . 'xxx.cookie';
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}
示例9: downloadPage
function downloadPage()
{
global $app;
try {
$releases = new Releases();
$winstable = [$releases->latestWin32Asset(), $releases->latestWin64Asset()];
$winpre = [$releases->latestWin32Asset(false), $releases->latestWin64Asset(false)];
$osxstable = $releases->latestOSXAsset();
$osxpre = $releases->latestOSXAsset(false);
if ($winpre[0]['created_at'] < $winstable[0]['created_at']) {
$winpre = null;
}
if ($osxpre['created_at'] < $osxstable['created_at']) {
$osxpre = null;
}
$vars = ['winstable' => $winstable, 'winpre' => $winpre, 'osxstable' => $osxstable, 'osxpre' => $osxpre];
} catch (Exception $e) {
error_log($e);
return $app['twig']->render('download/error.twig');
}
return $app['twig']->render('download/index.twig', $vars);
}
示例10: dirname
<?php
include dirname(__FILE__) . '/autoload.php';
Releases::get('alfred-spotify-controls', '2.2.10');
示例11: Releases
$page->smarty->assign('rid', $rid);
$page->smarty->assign('show', $show);
if (isset($_REQUEST['from'])) {
$page->smarty->assign('from', $_REQUEST['from']);
}
$page->content = $page->smarty->fetch('myshows-add.tpl');
$page->render();
}
break;
case 'browse':
$page->title = "Browse My Shows";
$page->meta_title = "My Shows";
$page->meta_keywords = "search,add,to,cart,nzb,description,details";
$page->meta_description = "Browse Your Shows";
$shows = $us->getShows($users->currentUserId());
$releases = new Releases();
$browsecount = $releases->getShowsCount($shows, -1, $page->userdata["categoryexclusions"]);
$offset = isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
$ordering = $releases->getBrowseOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$results = array();
$results = $releases->getShowsRange($shows, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
$page->smarty->assign('pagertotalitems', $browsecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/myshows/browse?ob=" . $orderby . "&offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch($page->getCommonTemplate("pager.tpl"));
$page->smarty->assign('pager', $pager);
foreach ($ordering as $ordertype) {
$page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/myshows/browse?ob=" . $ordertype . "&offset=0");
示例12: __construct
/**
* @param array $options Class instances / Echo to CLI.
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Logger' => null, 'ReleaseImage' => null, 'Settings' => null, 'TMDb' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo);
$this->lookuplanguage = $this->pdo->getSetting('lookuplanguage') != '' ? (string) $this->pdo->getSetting('lookuplanguage') : 'en';
$this->fanartapikey = $this->pdo->getSetting('fanarttvkey');
$this->imdburl = $this->pdo->getSetting('imdburl') == 0 ? false : true;
$this->movieqty = $this->pdo->getSetting('maximdbprocessed') != '' ? $this->pdo->getSetting('maximdbprocessed') : 100;
$this->searchEngines = true;
$this->showPasswords = Releases::showPasswords($this->pdo);
$this->debug = NN_DEBUG;
$this->echooutput = $options['Echo'] && NN_ECHOCLI && $this->pdo->cli;
$this->imgSavePath = NN_COVERS . 'movies' . DS;
$this->service = '';
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}
示例13: AdminPage
<?php
require_once "config.php";
$page = new AdminPage();
$users = new Users();
$releases = new Releases();
$page->title = "Site Stats";
$topgrabs = $users->getTopGrabbers();
$page->smarty->assign('topgrabs', $topgrabs);
$topdownloads = $releases->getTopDownloads();
$page->smarty->assign('topdownloads', $topdownloads);
$topcomments = $releases->getTopComments();
$page->smarty->assign('topcomments', $topcomments);
$recent = $releases->getRecentlyAdded();
$page->smarty->assign('recent', $recent);
$usersbymonth = $users->getUsersByMonth();
$page->smarty->assign('usersbymonth', $usersbymonth);
$usersbyrole = $users->getUsersByRole();
$page->smarty->assign('usersbyrole', $usersbyrole);
$usersbyhosthash = $users->getUsersByHostHash();
$page->smarty->assign('usersbyhosthash', $usersbyhosthash);
$loginsbymonth = $users->getLoginCountsByMonth();
$page->smarty->assign('loginsbymonth', $loginsbymonth);
$page->content = $page->smarty->fetch('site-stats.tpl');
$page->render();
示例14: NZB
<?php
use newznab\db\Settings;
$nzb = new NZB($page->settings);
$rel = new Releases(['Settings' => $page->settings]);
$uid = 0;
// Page is accessible only by the rss token, or logged in users.
if ($page->users->isLoggedIn()) {
$uid = $page->users->currentUserId();
$maxdls = $page->userdata["downloadrequests"];
$rsstoken = $page->userdata['rsstoken'];
} else {
if ($page->settings->getSetting('registerstatus') == Settings::REGISTER_STATUS_API_ONLY) {
$res = $page->users->getById(0);
} else {
if (!isset($_GET["i"]) || !isset($_GET["r"])) {
header("X-DNZB-RCode: 400");
header("X-DNZB-RText: Bad request, please supply all parameters!");
$page->show403();
}
$res = $page->users->getByIdAndRssToken($_GET["i"], $_GET["r"]);
if (!$res) {
header("X-DNZB-RCode: 401");
header("X-DNZB-RText: Unauthorised, wrong user ID or rss key!");
$page->show403();
}
}
$uid = $res["id"];
$rsstoken = $res['rsstoken'];
$maxdls = $res["downloadrequests"];
}
示例15: processGID
public function processGID($limit = 500, $batch = 5000, $delete_broken_releases = false)
{
// Process until someone presses cntrl-c
$db = new Settings();
$nzb = new NZB();
$processed = 0;
// We need an offset for tracking unhandled issues
$offset = 0;
$fsql = 'SELECT id, name, guid FROM releases ' . 'WHERE gid IS NULL ORDER BY adddate DESC LIMIT %d,%d';
$usql = "UPDATE releases SET gid = '%s' WHERE id = %d";
while (1) {
// finish
if ($limit > 0 && $processed >= $limit) {
break;
}
$batch = $limit > 0 && $batch > $limit ? $limit : $batch;
$res = $db->query(sprintf($fsql, $offset, $batch));
if (!$res) {
break;
}
if (count($res) <= 0) {
break;
}
$offset += $batch;
foreach ($res as $r) {
$nzbfile = $nzb->getNZBPath($r["guid"]);
if ($nzbfile === Null) {
continue;
}
$nzbInfo = new NZBInfo();
if (!$nzbInfo->loadFromFile($nzbfile)) {
if ($delete_broken_releases) {
$release = new Releases();
$release->deleteSingle(['g' => $r['guid'], 'i' => $r['id']], $this->nzb, $this->releaseImage);
// Free the variable in an attempt to recover memory
unset($release);
echo '-';
} else {
// Skip over this one for future fetches
$offset++;
}
continue;
}
$gid = false;
if (!empty($nzbInfo->gid)) {
$gid = $nzbInfo->gid;
}
// Free the variable in an attempt to recover memory
unset($nzbInfo);
if (!$gid) {
if ($delete_broken_releases) {
$release = new Releases();
$release->{$release}->deleteSingle(['g' => $r['guid'], 'i' => $r['id']], $this->nzb, $this->releaseImage);
unset($release);
echo '-';
} else {
// Skip over this one for future fetches
$offset++;
}
continue;
}
// Update DB With Global Identifer
$ures = $db->queryExec(sprintf("UPDATE releases SET gid = %s WHERE id = %d", $db->escapeString($gid), $r['id']));
if ($ures->rowCount() == 0) {
printf("\nPostPrc : Failed to update: %s\n", $r['name']);
}
// make noise...
echo '.';
$processed += 1;
}
}
# Batch update for comment table
/*$usql = 'UPDATE release_comments, releases '
.'SET release_comments.gid = releases.gid, '
.'release_comments.nzb_guid = releases.nzb_guid '
.'WHERE releases.id = release_comments.releaseid '
.'AND release_comments.gid IS NULL '
.'AND release_comments.nzb_guid = "" '
.'AND releases.nzb_guid IS NOT NULL '
.'AND releases.gid IS NOT NULL ';*/
$affected = $db->queryExec(sprintf('UPDATE release_comments, releases SET release_comments.gid = releases.gid,
release_comments.nzb_guid = releases.nzb_guid
WHERE releases.id = release_comments.releaseid
AND release_comments.gid IS NULL
AND release_comments.nzb_guid = ""
AND releases.nzb_guid IS NOT NULL
AND releases.gid IS NOT NULL '));
$rows = $affected->rowCount();
if ($rows > 0) {
$processed += $rows;
}
return $processed;
}