本文整理匯總了PHP中nzedb\db\Settings::queryOneRow方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::queryOneRow方法的具體用法?PHP Settings::queryOneRow怎麽用?PHP Settings::queryOneRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nzedb\db\Settings
的用法示例。
在下文中一共展示了Settings::queryOneRow方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAlternate
/**
* Retrieve alternate release with same or similar searchname
*
* @param string $guid
* @param string $userid
* @return string
*/
public function getAlternate($guid, $userid)
{
$rel = $this->pdo->queryOneRow(sprintf('
SELECT id, searchname, categoryid
FROM releases
WHERE guid = %s', $this->pdo->escapeString($guid)));
if ($rel === false) {
return false;
}
$insert = $this->pdo->queryInsert(sprintf('
INSERT IGNORE INTO dnzb_failures (release_id, userid, failed)
VALUES (%d, %d, 1)', $rel['id'], $userid));
// If we didn't actually insert the row, don't add a comment
if (is_numeric($insert) && $insert > 0) {
$this->postComment($rel['id'], $userid);
}
$alternate = $this->pdo->queryOneRow(sprintf('
SELECT r.guid
FROM releases r
LEFT JOIN dnzb_failures df ON r.id = df.release_id
WHERE r.searchname %s
AND df.release_id IS NULL
AND r.categoryid = %d
AND r.id != %d
ORDER BY r.postdate DESC', $this->pdo->likeString($rel['searchname'], true, true), $rel['categoryid'], $rel['id']));
return $alternate;
}
示例2: 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)
{
$rel = $this->pdo->queryOneRow(sprintf('
SELECT id, categoryid
FROM releases
WHERE guid = %s', $this->pdo->escapeString($guid)));
// Specifying LAST_INSERT_ID on releaseid will return the releaseid
// if the row was actually inserted and not updated
$insert = $this->pdo->queryInsert(sprintf('
INSERT INTO dnzb_failures (release_id, userid, failed)
VALUES (LAST_INSERT_ID(%d), %d, 1)
ON DUPLICATE KEY UPDATE failed = failed + 1', $rel['id'], $userid));
// If we didn't actually insert the row, don't add a comment
if ((int) $insert > 0) {
$this->postComment($rel['id'], $userid);
}
$alternate = $this->pdo->queryOneRow(sprintf('
SELECT r.*
FROM releases r
LEFT JOIN dnzb_failures df ON r.id = df.release_id
WHERE r.searchname %s
AND df.release_id IS NULL
AND r.categoryid = %d', $this->pdo->likeString($searchname, true, true), $rel['categoryid'], $userid));
return $alternate;
}
示例3: getVideoIDFromSiteID
/**
* Get video info from a Site ID and column.
*
* @param string $siteColumn
* @param integer $siteID
*
* @return array|false False if invalid site, or ID not found; video.id value otherwise.
*/
protected function getVideoIDFromSiteID($siteColumn, $siteID)
{
if (in_array($siteColumn, $this->sites)) {
$result = $this->pdo->queryOneRow("SELECT id FROM videos WHERE {$siteColumn} = {$siteID}");
return isset($result['id']) ? $result['id'] : false;
}
return false;
}
示例4: postComment
/**
* @param $relid
* @param $uid
*/
public function postComment($relid, $uid)
{
$text = 'This release has failed to download properly. It might fail for other users too.
This comment is automatically generated.';
$dbl = $this->pdo->queryOneRow(sprintf('SELECT text FROM release_comments WHERE releaseid = %d AND userid = %d', $relid, $uid));
if ($dbl['text'] != $text) {
$this->rc->addComment($relid, $text, $uid, '');
}
}
示例5: 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)
{
$duplicateCheck = $this->pdo->queryOneRow(sprintf('
SELECT id
FROM release_files
WHERE releaseid = %d AND name = %s', $id, $this->pdo->escapeString(utf8_encode($name))));
if ($duplicateCheck === false) {
return $this->pdo->queryInsert(sprintf("\n\t\t\t\t\tINSERT INTO release_files\n\t\t\t\t\t(releaseid, name, size, createddate, passworded)\n\t\t\t\t\tVALUES\n\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 0;
}
示例6: addBulk
/**
* Update the list of newsgroups and return an array of messages.
*
* @param string $groupList
* @param int $active
* @param int $backfill
*
* @return array
*/
public function addBulk($groupList, $active = 1, $backfill = 1)
{
if (preg_match('/^\\s*$/m', $groupList)) {
$ret = "No group list provided.";
} else {
$nntp = new NNTP(['Echo' => false]);
if ($nntp->doConnect() !== true) {
return 'Problem connecting to usenet.';
}
$groups = $nntp->getGroups();
$nntp->doQuit();
if ($nntp->isError($groups)) {
return 'Problem fetching groups from usenet.';
}
$regFilter = '/' . $groupList . '/i';
$ret = [];
foreach ($groups as $group) {
if (preg_match($regFilter, $group['group']) > 0) {
$res = $this->pdo->queryOneRow(sprintf('SELECT id FROM groups WHERE name = %s', $this->pdo->escapeString($group['group'])));
if ($res === false) {
$this->pdo->queryInsert(sprintf('INSERT INTO groups (name, active, backfill) VALUES (%s, %d, %d)', $this->pdo->escapeString($group['group']), $active, $backfill));
$ret[] = ['group' => $group['group'], 'msg' => 'Created'];
}
}
}
if (count($ret) === 0) {
$ret = 'No groups found with your regex, try again!';
}
}
return $ret;
}
示例7: addFull
public function addFull($id, $xml)
{
$ckid = $this->pdo->queryOneRow(sprintf('SELECT releaseid FROM releaseextrafull WHERE releaseid = %s', $id));
if (!isset($ckid['releaseid'])) {
return $this->pdo->queryExec(sprintf('INSERT INTO releaseextrafull (releaseid, mediainfo) VALUES (%d, %s)', $id, $this->pdo->escapeString($xml)));
}
}
示例8: getTitleLoose
/**
* Supplementary function for getByTitle that queries for a like match
*
* @param $title
* @param $type
* @param int $source
*
* @return array|false
*/
public function getTitleLoose($title, $type, $source = 0)
{
$return = false;
if (!empty($title)) {
$return = $this->pdo->queryOneRow(sprintf("\n\t\t\t\t\tSELECT v.id\n\t\t\t\t\tFROM videos v\n\t\t\t\t\tLEFT JOIN videos_aliases va ON v.id = va.videos_id\n\t\t\t\t\tWHERE (v.title %1\$s\n\t\t\t\t\tOR va.title %1\$s)\n\t\t\t\t\tAND type = %2\$d %3\$s", $this->pdo->likeString(rtrim($title, '%'), false, false), $type, $source > 0 ? 'AND v.source = ' . $source : ''));
}
return $return;
}
示例9: getCount
public function getCount($ragename = "")
{
$rsql = '';
if ($ragename != "") {
$rsql .= sprintf("AND tvrage.releasetitle LIKE %s ", $this->pdo->escapeString("%" . $ragename . "%"));
}
$res = $this->pdo->queryOneRow(sprintf("SELECT COUNT(id) AS num FROM tvrage WHERE 1=1 %s", $rsql));
return $res["num"];
}
示例10: getUpcoming
/**
* Get upcoming movies.
*
* @param $type
* @param string $source
*
* @return array|bool
*/
public function getUpcoming($type, $source = 'rottentomato')
{
$list = $this->pdo->queryOneRow(sprintf('SELECT * FROM upcoming_releases WHERE source = %s AND typeid = %d', $this->pdo->escapeString($source), $type));
if ($list === false) {
$this->updateUpcoming();
$list = $this->pdo->queryOneRow(sprintf('SELECT * FROM upcoming_releases WHERE source = %s AND typeid = %d', $this->pdo->escapeString($source), $type));
}
return $list;
}
示例11: minMaxQueryFormulator
/**
* Formulate part of a query to prevent deletion of currently inserting parts / binaries / collections.
*
* @param string $groupName
* @param int $difference
*
* @return string
* @access private
*/
private function minMaxQueryFormulator($groupName, $difference)
{
$minMaxId = $this->pdo->queryOneRow(sprintf('SELECT MIN(id) AS min, MAX(id) AS max FROM %s', $groupName));
if ($minMaxId === false) {
$minMaxId = '';
} else {
$minMaxId = ' AND id < ' . ($minMaxId['max'] - $minMaxId['min'] >= $difference ? $minMaxId['max'] - $difference : 1);
}
return $minMaxId;
}
示例12: 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'];
}
示例13: 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;
}
示例14: checkName
/**
* Check the array using regex for a clean name.
*
* @param $release
* @param boolean $echo
* @param string $type
* @param $namestatus
* @param $show
* @param boolean $preid
*
* @return boolean
*/
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 predb 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;
}
示例15: _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 (nZEDb_RENAME_PAR2 && $releaseInfo['proc_pp'] == 0 && in_array((int) $this->_release['categoryid'], [Category::CAT_BOOKS_OTHER, Category::CAT_GAME_OTHER, Category::CAT_MOVIE_OTHER, Category::CAT_MUSIC_OTHER, Category::CAT_PC_PHONE_OTHER, Category::CAT_TV_OTHER, Category::CAT_OTHER_HASHED, Category::CAT_XXX_OTHER, Category::CAT_MISC])) {
$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 release_files 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 ? true : false, '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;
}