本文整理汇总了PHP中newznab\db\Settings类的典型用法代码示例。如果您正苦于以下问题:PHP Settings类的具体用法?PHP Settings怎么用?PHP Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateMovie
public function updateMovie($uid, $imdbid, $catid = array())
{
$db = new Settings();
$catid = !empty($catid) ? $db->escapeString(implode('|', $catid)) : "null";
$sql = sprintf("update usermovies set categoryid = %s where userid = %d and imdbid = %d", $catid, $uid, $imdbid);
$db->queryExec($sql);
}
示例2: categorizeRelease
function categorizeRelease($update = true, $where, $echooutput = false)
{
$pdo = new Settings();
$cat = new Categorize();
$consoletools = new consoleTools();
$relcount = $chgcount = 0;
$c = new ColorCLI();
echo $c->primary("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
$resrel = $pdo->queryDirect("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
$total = $resrel->rowCount();
if ($total > 0) {
foreach ($resrel as $rowrel) {
$catId = $cat->determineCategory($rowrel['groupid'], $rowrel['searchname']);
if ($rowrel['categoryid'] != $catId) {
if ($update === true) {
$pdo->queryExec(sprintf("\n\t\t\t\t\t\t\tUPDATE releases\n\t\t\t\t\t\t\tSET iscategorized = 1,\n\t\t\t\t\t\t\t\trageid = -1,\n\t\t\t\t\t\t\t\tseriesfull = NULL,\n\t\t\t\t\t\t\t\tseason = NULL,\n\t\t\t\t\t\t\t\tepisode = NULL,\n\t\t\t\t\t\t\t\ttvtitle = NULL,\n\t\t\t\t\t\t\t\ttvairdate = NULL,\n\t\t\t\t\t\t\t\timdbid = NULL,\n\t\t\t\t\t\t\t\tmusicinfoid = NULL,\n\t\t\t\t\t\t\t\tconsoleinfoid = NULL,\n\t\t\t\t\t\t\t\tgamesinfo_id = 0,\n\t\t\t\t\t\t\t\txxxinfo_id = 0,\n\t\t\t\t\t\t\t\tbookinfoid = NULL,\n\t\t\t\t\t\t\t\tanidbid = NULL,\n\t\t\t\t\t\t\t\tcategoryid = %d\n\t\t\t\t\t\t\tWHERE id = %d", $catId, $rowrel['id']));
}
$chgcount++;
}
$relcount++;
if ($echooutput) {
$consoletools->overWritePrimary("Re-Categorized: [" . number_format($chgcount) . "] " . $consoletools->percentString($relcount, $total));
}
}
}
if ($echooutput !== false && $relcount > 0) {
echo "\n";
}
return $chgcount;
}
示例3: releases_rt
function releases_rt()
{
$pdo = new Settings();
$rows = $pdo->queryExec('SELECT id, guid, name, searchname, fromname FROM releases');
if ($rows !== false && $rows->rowCount()) {
$sphinx = new \SphinxSearch();
$total = $rows->rowCount();
$string = 'REPLACE INTO releases_rt (id, guid, name, searchname, fromname) VALUES ';
$tempString = '';
$i = 0;
echo '[Starting to populate sphinx RT indexes with ' . $total . ' releases.] ';
foreach ($rows as $row) {
$i++;
$tempString .= sprintf('(%d, %s, %s, %s, %s),', $row['id'], $sphinx->sphinxQL->escapeString($row['guid']), $sphinx->sphinxQL->escapeString($row['name']), $sphinx->sphinxQL->escapeString($row['searchname']), $sphinx->sphinxQL->escapeString($row['fromname']));
if ($i === 1000 || $i >= $total) {
$sphinx->sphinxQL->queryExec($string . rtrim($tempString, ','));
$tempString = '';
$total -= $i;
$i = 0;
echo '.';
}
}
echo ' [Done.]' . PHP_EOL;
} else {
echo 'No releases in your DB or an error occurred. This will need to be resolved before you can use the search.' . PHP_EOL;
}
}
示例4: 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);
}
}
}
示例5: updateName
/**
* update a release name
*
* @param Settings $pdo
* @param $id
* @param $oldname
* @param $newname
*/
private function updateName(Settings $pdo, $id, $oldname, $newname)
{
if ($this->verbose) {
echo sprintf("OLD : %s\nNEW : %s\n\n", $oldname, $newname);
}
if (!$this->echoonly) {
$this->pdo->queryExec(sprintf("update releases set name=%s, searchname = %s WHERE id = %d", $this->pdo->escapeString($newname), $this->pdo->escapeString($newname), $id));
}
}
示例6: insertNewComment
/**
* Fetch a comment and insert it.
*
* @param string $messageID Message-ID for the article.
* @param string $siteID id of the site.
*
* @return bool
*/
protected function insertNewComment(&$messageID, &$siteID)
{
// Get the article body.
$body = $this->nntp->getMessages(self::group, $messageID);
// Check if there's an error.
if ($this->nntp->isError($body)) {
return false;
}
// Decompress the body.
$body = @gzinflate($body);
if ($body === false) {
return false;
}
// JSON Decode the body.
$body = json_decode($body, true);
if ($body === false) {
return false;
}
// Just in case.
if (!isset($body['USER']) || !isset($body['SID']) || !isset($body['RID']) || !isset($body['TIME']) | !isset($body['BODY'])) {
return false;
}
$cid = md5($body['SID'] . $body['USER'] . $body['TIME'] . $siteID);
// Insert the comment.
if ($this->pdo->queryExec(sprintf('
INSERT IGNORE INTO releasecomment
(text, createddate, issynced, shareid, cid, gid, nzb_guid, siteid, username, userid, releaseid, shared, host, sourceID)
VALUES (%s, %s, 1, %s, %s, %s, %s, %s, %s, 0, 0, 2, "", 999)', $this->pdo->escapeString($body['BODY']), $this->pdo->from_unixtime($body['TIME'] > time() ? time() : $body['TIME']), $this->pdo->escapeString($body['SID']), $this->pdo->escapeString($cid), $this->pdo->escapeString($body['RID']), $this->pdo->escapeString($body['RID']), $this->pdo->escapeString($siteID), $this->pdo->escapeString(substr($body['USER'], 0, 3) === 'sn-' ? 'SH_ANON' : 'SH_' . $body['USER'])))) {
return true;
}
return false;
}
示例7: processGamesReleases
public function processGamesReleases()
{
$res = $this->pdo->queryDirect(sprintf('
SELECT searchname, id
FROM releases
WHERE nzbstatus = 1 %s
AND gamesinfo_id = 0
AND categoryid = 4050
ORDER BY postdate DESC
LIMIT %d', $this->renamed, $this->gameQty));
if ($res instanceof \Traversable && $res->rowCount() > 0) {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->header("Processing " . $res->rowCount() . ' games release(s).'));
}
foreach ($res as $arr) {
// Reset maxhitrequest
$this->maxHitRequest = false;
$startTime = microtime(true);
$usedgb = false;
$gameInfo = $this->parseTitle($arr['searchname']);
if ($gameInfo !== false) {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->headerOver('Looking up: ') . $this->pdo->log->primary($gameInfo['title'] . ' (PC)'));
}
// Check for existing games entry.
$gameCheck = $this->getGamesInfoByName($gameInfo['title']);
if ($gameCheck === false) {
$gameId = $this->updateGamesInfo($gameInfo);
$usedgb = true;
if ($gameId === false) {
$gameId = -2;
// Leave gamesinfo_id 0 to parse again
if ($this->maxHitRequest === true) {
$gameId = 0;
}
}
} else {
$gameId = $gameCheck['id'];
}
// Update release.
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', $gameId, $arr['id']));
} else {
// Could not parse release title.
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id']));
if ($this->echoOutput) {
echo '.';
}
}
// Sleep to not flood giantbomb.
$diff = floor((microtime(true) - $startTime) * 1000000);
if ($this->sleepTime * 1000 - $diff > 0 && $usedgb === true) {
usleep($this->sleepTime * 1000 - $diff);
}
}
} else {
if ($this->echoOutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No games releases to process.'));
}
}
}
示例8: startRunning
public function startRunning()
{
if (!$this->isRunning()) {
return $this->pdo->queryExec("UPDATE tmux SET value = '1' WHERE setting = 'running'");
}
return true;
}
示例9: insertGenre
/**
* Inserts Genre and returns last affected row (Genre id)
*
* @param $genre
*
* @return bool
*/
private function insertGenre($genre)
{
$res = '';
if (isset($genre)) {
$res = $this->pdo->queryInsert(sprintf("INSERT INTO genres (title, type, disabled) VALUES (%s ,%d ,%d)", $this->pdo->escapeString($genre), 6000, 0));
}
return $res;
}
示例10: getGenres
/**
* @param bool $activeOnly
*
* @return array
*/
public function getGenres($activeOnly = false)
{
if ($activeOnly) {
return $this->pdo->query("SELECT musicgenre.* FROM musicgenre INNER JOIN (SELECT DISTINCT musicgenreid FROM musicinfo) x ON x.musicgenreID = musicgenre.id ORDER BY title");
} else {
return $this->pdo->query("SELECT * FROM musicgenre ORDER BY title");
}
}
示例11: _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];
}
示例12: data_getForMenuByTypeAndRole
public function data_getForMenuByTypeAndRole($id, $role)
{
if ($role == Users::ROLE_ADMIN) {
$role = "";
} else {
$role = sprintf("AND (role = %d OR role = 0)", $role);
}
return $this->pdo->query(sprintf("SELECT * FROM content WHERE showinmenu = 1 AND status = 1 AND contenttype = %d %s ", $id, $role));
}
示例13: getCommentsForUserRange
/**
* Get comments for a user by limit.
*/
public function getCommentsForUserRange($uid, $start, $num)
{
if ($start === false) {
$limit = "";
} else {
$limit = " LIMIT " . $start . "," . $num;
}
return $this->pdo->query(sprintf("SELECT release_comments.*, r.guid, r.searchname, users.username FROM release_comments INNER JOIN releases r ON r.id = release_comments.releaseid LEFT OUTER JOIN users ON users.id = release_comments.userid WHERE userid = %d ORDER BY release_comments.createddate DESC " . $limit, $uid));
}
示例14: _updateSingleColumn
/** This function updates a single variable column in releases
* The first parameter is the column to update, the second is the value
* The final parameter is the id of the release to update
*
* @param string $column
* @param string|int $status
* @param int $id
**/
private function _updateSingleColumn($column = '', $status = 0, $id = 0)
{
if ($column !== '' && $id !== 0) {
$this->pdo->queryExec(sprintf('
UPDATE releases
SET %s = %s
WHERE id = %d', $column, is_numeric($status) ? $status : $this->pdo->escapeString($status), $id));
}
}
示例15: getForUserRange
/**
* Get forum posts for a user for paged list in profile.
*/
public function getForUserRange($uid, $start, $num)
{
if ($start === false) {
$limit = "";
} else {
$limit = " LIMIT " . $start . "," . $num;
}
return $this->pdo->query(sprintf(" SELECT forumpost.*, users.username FROM forumpost LEFT OUTER JOIN users ON users.id = forumpost.userid where userid = %d order by forumpost.createddate desc " . $limit, $uid));
}