本文整理汇总了PHP中newznab\db\Settings::queryOneRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::queryOneRow方法的具体用法?PHP Settings::queryOneRow怎么用?PHP Settings::queryOneRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类newznab\db\Settings
的用法示例。
在下文中一共展示了Settings::queryOneRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBookCount
/**
* Get count of all bookinfo rows for browse list.
*/
public function getBookCount($maxage = -1)
{
$browseby = $this->getBrowseBy();
if ($maxage > 0) {
$maxage = sprintf(" and r.postdate > now() - interval %d day ", $maxage);
} else {
$maxage = "";
}
$sql = sprintf("select count(distinct r.bookinfoid) as num from releases r inner join bookinfo b on b.id = r.bookinfoid and b.title != '' where r.passwordstatus <= (select value from settings where setting='showpasswordedrelease') %s %s", $browseby, $maxage);
$res = $this->pdo->queryOneRow($sql, true);
return $res["num"];
}
示例2: add
/**
* Add new files for a release ID.
*
* @param int $id The ID of the release.
* @param string $name Name of the file.
* @param int $size Size of the file.
* @param int $createdTime Unix time the file was created.
* @param int $hasPassword Does it have a password (see Releases class constants)?
*
* @return mixed
*/
public function add($id, $name, $size, $createdTime, $hasPassword)
{
$insert = 0;
$duplicateCheck = $this->pdo->queryOneRow(sprintf('
SELECT id
FROM releasefiles
WHERE releaseid = %d AND name = %s', $id, $this->pdo->escapeString(utf8_encode($name))));
if ($duplicateCheck === false) {
$insert = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\t\tINSERT INTO releasefiles\n\t\t\t\t\t\t(releaseid, name, size, createddate, passworded)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(%d, %s, %s, %s, %d)", $id, $this->pdo->escapeString(utf8_encode($name)), $this->pdo->escapeString($size), $this->pdo->from_unixtime($createdTime), $hasPassword));
}
return $insert;
}
示例3: _getGroupID
/**
* Get a group id for a group name.
*
* @param string $groupName
*
* @return mixed
*
* @access protected
*/
protected function _getGroupID($groupName)
{
if (!isset($this->_groupList[$groupName])) {
$group = $this->_pdo->queryOneRow(sprintf('SELECT id FROM groups WHERE name = %s', $this->_pdo->escapeString($groupName)));
$this->_groupList[$groupName] = $group['id'];
}
return $this->_groupList[$groupName];
}
示例4: getCount
public function getCount($ragename = "")
{
$rsql = '';
if ($ragename != "") {
$rsql .= sprintf("AND tvrage.releasetitle LIKE %s ", $this->pdo->escapeString("%" . $ragename . "%"));
}
$res = $this->pdo->queryOneRow(sprintf("\n\t\t\t\t\t\tSELECT COUNT(id) AS num\n\t\t\t\t\t\tFROM tvrage\n\t\t\t\t\t\tWHERE 1=1 %s", $rsql));
return $res["num"];
}
示例5: getAlternate
/**
* Retrieve alternate release with same or similar searchname
*
* @param string $guid
* @param string $searchname
* @param string $userid
* @return string
*/
public function getAlternate($guid, $searchname, $userid)
{
//status values
// 0/false = successfully downloaded
// 1/true = failed download
$this->pdo->queryInsert(sprintf("INSERT IGNORE INTO dnzb_failures (userid, guid) VALUES (%d, %s)", $userid, $this->pdo->escapeString($guid)));
$alternate = $this->pdo->queryOneRow(sprintf('SELECT * FROM releases r
WHERE r.searchname %s
AND r.guid NOT IN (SELECT guid FROM failed_downloads WHERE userid = %d)', $this->pdo->likeString($searchname), $userid));
return $alternate;
}
示例6: getAnimeCount
/**
* Retrives the count of Anime titles for pager functions optionally filtered by title
*
* @param string $animetitle
* @return int
*/
public function getAnimeCount($animetitle = '')
{
$rsql = '';
if ($animetitle != '') {
$rsql .= sprintf('AND at.title %s', $this->pdo->likeString($animetitle, true, true));
}
$res = $this->pdo->queryOneRow(sprintf('SELECT COUNT(at.anidbid) AS num
FROM anidb_titles AS at LEFT JOIN anidb_info AS ai USING (anidbid)
WHERE 1=1 %s', $rsql));
return $res['num'];
}
示例7: checkName
public function checkName($release, $echo, $type, $namestatus, $show, $preid = false)
{
// Get pre style name from releases.name
if (preg_match_all(self::PREDB_REGEX, $release['textstring'], $matches) && !preg_match('/Source\\s\\:/i', $release['textstring'])) {
foreach ($matches as $match) {
foreach ($match as $val) {
$title = $this->pdo->queryOneRow("SELECT title, id from prehash WHERE title = " . $this->pdo->escapeString(trim($val)));
if ($title !== false) {
$this->updateRelease($release, $title['title'], $method = "preDB: Match", $echo, $type, $namestatus, $show, $title['id']);
$preid = true;
}
}
}
}
// if only processing for PreDB match skip to return
if ($preid !== true) {
switch ($type) {
case "PAR2, ":
$this->fileCheck($release, $echo, $type, $namestatus, $show);
break;
case "NFO, ":
$this->nfoCheckTV($release, $echo, $type, $namestatus, $show);
$this->nfoCheckMov($release, $echo, $type, $namestatus, $show);
$this->nfoCheckMus($release, $echo, $type, $namestatus, $show);
$this->nfoCheckTY($release, $echo, $type, $namestatus, $show);
$this->nfoCheckG($release, $echo, $type, $namestatus, $show);
continue;
case "Filenames, ":
$this->fileCheck($release, $echo, $type, $namestatus, $show);
continue;
default:
$this->tvCheck($release, $echo, $type, $namestatus, $show);
$this->movieCheck($release, $echo, $type, $namestatus, $show);
$this->gameCheck($release, $echo, $type, $namestatus, $show);
$this->appCheck($release, $echo, $type, $namestatus, $show);
}
// set NameFixer process flags after run
if ($namestatus == 1 && $this->matched === false) {
switch ($type) {
case "NFO, ":
$this->_updateSingleColumn('proc_nfo', self::PROC_NFO_DONE, $release['releaseid']);
break;
case "Filenames, ":
$this->_updateSingleColumn('proc_files', self::PROC_FILES_DONE, $release['releaseid']);
break;
case "PAR2, ":
$this->_updateSingleColumn('proc_par2', self::PROC_FILES_DONE, $release['releaseid']);
break;
}
}
}
return $this->matched;
}
示例8: _siftPAR2Info
/**
* Get file info from inside PAR2, store it in DB, attempt to get a release name.
*
* @param string $fileLocation
*/
protected function _siftPAR2Info($fileLocation)
{
$this->_par2Info->open($fileLocation);
if ($this->_par2Info->error) {
return;
}
$releaseInfo = $this->pdo->queryOneRow(sprintf('
SELECT UNIX_TIMESTAMP(postdate) AS postdate, proc_pp
FROM releases
WHERE id = %d', $this->_release['id']));
if ($releaseInfo === false) {
return;
}
// Only get a new name if the category is OTHER.
$foundName = true;
if (NN_RENAME_PAR2 && $releaseInfo['proc_pp'] == 0 && in_array((int) $this->_release['categoryid'], [\Category::CAT_BOOK_OTHER, \Category::CAT_GAME_OTHER, \Category::CAT_MOVIE_OTHER, \Category::CAT_MUSIC_OTHER, \Category::CAT_PC_MOBILEOTHER, \Category::CAT_TV_OTHER, \Category::CAT_MISC_HASHED, \Category::CAT_XXX_OTHER, \Category::CAT_MISC_OTHER])) {
$foundName = false;
}
$filesAdded = 0;
$files = $this->_par2Info->getFileList();
foreach ($files as $file) {
if (!isset($file['name'])) {
continue;
}
// If we found a name and added 10 files, stop.
if ($foundName === true && $filesAdded > 10) {
break;
}
// Add to release files.
if ($this->_addPAR2Files) {
if ($filesAdded < 11 && $this->pdo->queryOneRow(sprintf('SELECT id FROM releasefiles WHERE releaseid = %d AND name = %s', $this->_release['id'], $this->pdo->escapeString($file['name']))) === false) {
// Try to add the files to the DB.
if ($this->_releaseFiles->add($this->_release['id'], $file['name'], $file['size'], $releaseInfo['postdate'], 0)) {
$filesAdded++;
}
}
} else {
$filesAdded++;
}
// Try to get a new name.
if ($foundName === false) {
$this->_release['textstring'] = $file['name'];
$this->_release['releaseid'] = $this->_release['id'];
if ($this->_nameFixer->checkName($this->_release, $this->_echoCLI ? 1 : 0, 'PAR2, ', 1, 1) === true) {
$foundName = true;
}
}
}
// Update the file count with the new file count + old file count.
$this->pdo->queryExec(sprintf('UPDATE releases SET rarinnerfilecount = rarinnerfilecount + %d WHERE id = %d', $filesAdded, $this->_release['id']));
$this->_foundPAR2Info = true;
}
示例9: updateRelease
/**
* Update Sphinx Relases index for given releaseid.
*
* @param int $releaseID
* @param \newznab\db\Settings $pdo
*/
public function updateRelease($releaseID, Settings $pdo)
{
if (!is_null($this->sphinxQL)) {
$new = $pdo->queryOneRow(sprintf('
SELECT r.id, r.name, r.searchname, r.fromname, IFNULL(GROUP_CONCAT(rf.name SEPARATOR " "),"") filename
FROM releases r
LEFT JOIN releasefiles rf ON (r.id=rf.releaseid)
WHERE r.id = %d
GROUP BY r.id LIMIT 1', $releaseID));
if ($new !== false) {
$this->insertRelease($new);
}
}
}
示例10: getEpisodeInfoByName
/**
* Get an episodeinfo row by name.
*/
public function getEpisodeInfoByName($showtitle, $fullep, $epabsolute = '0')
{
$db = new Settings();
if ($epabsolute == '0') {
//as string - not int.
if (!preg_match('/[21]\\d{3}\\/\\d{2}\\/\\d{2}/', $fullep)) {
$additionalSql = sprintf('AND fullep = %s', $db->escapeString($fullep));
} else {
$additionalSql = sprintf('AND airdate LIKE %s', $db->escapeString($fullep . ' %'));
}
} else {
$additionalSql = sprintf('AND epabsolute = %s', $db->escapeString($epabsolute));
}
return $db->queryOneRow(sprintf('SELECT * FROM episodeinfo WHERE showtitle = %s %s', $db->escapeString($showtitle), $additionalSql));
}
示例11: updateAniChildTables
/**
* Directs flow for updating child AniDB tables
*
* @param array $AniDBInfoArray
*/
private function updateAniChildTables($AniDBInfoArray = array())
{
$check = $this->pdo->queryOneRow(sprintf('
SELECT ai.anidbid AS info
FROM anidb_info ai
WHERE ai.anidbid = %d', $this->anidbId));
if ($check === false) {
$picture = $this->insertAniDBInfoEps($AniDBInfoArray);
} else {
$picture = $this->updateAniDBInfoEps($AniDBInfoArray);
}
if (!empty($picture) && !file_exists($this->imgSavePath . $this->anidbId . ".jpg")) {
(new \ReleaseImage($this->pdo))->saveImage($this->anidbId, 'http://img7.anidb.net/pics/anime/' . $picture, $this->imgSavePath);
}
}
示例12: safeBackfill
/**
* Safe backfill using posts. Going back to a date specified by the user on the site settings.
* This does 1 group for x amount of parts until it reaches the date.
*
* @param string $articles
*
* @return void
*/
public function safeBackfill($articles = '')
{
$groupname = $this->pdo->queryOneRow(sprintf('
SELECT name FROM groups
WHERE first_record_postdate BETWEEN %s AND NOW()
AND backfill = 1
ORDER BY name ASC', $this->pdo->escapeString($this->_safeBackFillDate)));
if (!$groupname) {
$dMessage = 'No groups to backfill, they are all at the target date ' . $this->_safeBackFillDate . ", or you have not enabled them to be backfilled in the groups page.\n";
if ($this->_debug) {
$this->_debugging->log(get_class(), __FUNCTION__, $dMessage, Logger::LOG_FATAL);
}
exit($dMessage);
} else {
$this->backfillAllGroups($groupname['name'], $articles);
}
}
示例13: processReleases
/**
* Process all untagged releases to see if they are found in predb.
*/
public function processReleases($daysback = 3)
{
if ($this->echooutput) {
echo "Predb : Updating releases with pre data\n";
}
$matched = 0;
$releasesQuery = $this->pdo->queryDirect(sprintf('SELECT id, searchname FROM releases WHERE preid IS NULL AND adddate > DATE_SUB(NOW(), INTERVAL %d DAY)', $daysback));
while ($arr = $this->pdo->getAssocArray($releasesQuery)) {
$arr['searchname'] = str_replace(' ', '_', $arr['searchname']);
$sql = sprintf("SELECT id FROM predb WHERE dirname = %s LIMIT 1", $this->pdo->escapeString($arr['searchname']));
$predbQuery = $this->pdo->queryOneRow($sql);
if ($predbQuery) {
$this->pdo->queryExec(sprintf('UPDATE releases SET preid = %d WHERE id = %d', $predbQuery['id'], $arr['id']));
$matched++;
}
}
if ($this->echooutput) {
echo "Predb : Matched pre data to " . $matched . " releases\n";
}
}
示例14: getGenreID
/**
* Get Genre id's Of the title
*
* @param $arr - Array or String
*
* @return string - If array .. 1,2,3,4 if string .. 1
*/
private function getGenreID($arr)
{
$ret = null;
if (!is_array($arr)) {
$res = $this->pdo->queryOneRow("SELECT id FROM genres WHERE title = " . $this->pdo->escapeString($arr));
if ($res !== false) {
return $res["id"];
}
}
foreach ($arr as $key => $value) {
$res = $this->pdo->queryOneRow("SELECT id FROM genres WHERE title = " . $this->pdo->escapeString($value));
if ($res !== false) {
$ret .= "," . $res["id"];
} else {
$ret .= "," . $this->insertGenre($value);
}
}
$ret = ltrim($ret, ",");
return $ret;
}
示例15: _updateConsoleTable
protected function _updateConsoleTable($con = [])
{
$ri = new \ReleaseImage($this->pdo);
$check = $this->pdo->queryOneRow(sprintf('
SELECT id
FROM consoleinfo
WHERE asin = %s', $this->pdo->escapeString($con['asin'])));
if ($check === false) {
$consoleId = $this->pdo->queryInsert(sprintf("INSERT INTO consoleinfo (title, asin, url, salesrank, platform, publisher, genreid, esrb, releasedate, review, cover, createddate, updateddate)\n\t\t\t\t\tVALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, NOW(), NOW())", $this->pdo->escapeString($con['title']), $this->pdo->escapeString($con['asin']), $this->pdo->escapeString($con['url']), $con['salesrank'], $this->pdo->escapeString($con['platform']), $this->pdo->escapeString($con['publisher']), $con['consolegenreid'] == -1 ? "null" : $con['consolegenreid'], $this->pdo->escapeString($con['esrb']), $con['releasedate'] != "" ? $this->pdo->escapeString($con['releasedate']) : "null", $this->pdo->escapeString(substr($con['review'], 0, 3000)), $con['cover']));
if ($con['cover'] === 1) {
$con['cover'] = $ri->saveImage($consoleId, $con['coverurl'], $this->imgSavePath, 250, 250);
}
} else {
$consoleId = $check['id'];
if ($con['cover'] === 1) {
$con['cover'] = $ri->saveImage($consoleId, $con['coverurl'], $this->imgSavePath, 250, 250);
}
$this->update($consoleId, $con['title'], $con['asin'], $con['url'], $con['salesrank'], $con['platform'], $con['publisher'], isset($con['releasedate']) ? $con['releasedate'] : null, $con['esrb'], $con['cover'], $con['consolegenreid'], isset($con['review']) ? $con['review'] : null);
}
return $consoleId;
}