• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP db\Settings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中newznab\db\Settings的典型用法代码示例。如果您正苦于以下问题:PHP Settings类的具体用法?PHP Settings怎么用?PHP Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Settings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:7,代码来源:UserMovies.php


示例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;
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:30,代码来源:recategorize.php


示例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;
    }
}
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:27,代码来源:populate_rt_indexes.php


示例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);
            }
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:20,代码来源:SphinxSearch.php


示例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));
     }
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:17,代码来源:Parsing.php


示例6: 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));
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:18,代码来源:Episode.php


示例7: 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;
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:40,代码来源:Sharing.php


示例8: 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.'));
            }
        }
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:60,代码来源:Games.php


示例9: startRunning

 public function startRunning()
 {
     if (!$this->isRunning()) {
         return $this->pdo->queryExec("UPDATE tmux SET value = '1' WHERE setting = 'running'");
     }
     return true;
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:7,代码来源:Tmux.php


示例10: 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;
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:15,代码来源:XXX.php


示例11: 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");
     }
 }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:13,代码来源:Musik.php


示例12: _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];
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:17,代码来源:IRCScraper.php


示例13: 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));
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:9,代码来源:Contents.php


示例14: 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));
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:12,代码来源:ReleaseComments.php


示例15: _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));
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:17,代码来源:NameFixer.php


示例16: 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));
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:12,代码来源:Forum.php


示例17: getAnimeInfo

    /**
     * Retrieves all info for a specific AniDB id
     *
     * @param int $anidbID
     * @return
     */
    public function getAnimeInfo($anidbID)
    {
        $animeInfo = $this->pdo->query(sprintf('SELECT at.anidbid, at.lang, at.title,
				ai.startdate, ai.enddate, ai.updated, ai.related, ai.creators, ai.description,
				ai.rating, ai.picture, ai.categories, ai.characters, ai.type
				FROM anidb_titles AS at LEFT JOIN anidb_info ai USING (anidbid)
				WHERE at.anidbid = %d', $anidbID));
        return isset($animeInfo[0]) ? $animeInfo[0] : false;
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:15,代码来源:AniDB.php


示例18: nzpreUpdate

 /**
  * Get nzpre data from usenet and parse.
  */
 public function nzpreUpdate()
 {
     if (empty($this->pdo->getSetting('nzpregroup')) || empty($this->pdo->getSetting('nzpresubject')) || empty($this->pdo->getSetting('nzpreposter')) || empty($this->pdo->getSetting('nzprefield')) || empty($this->pdo->getSetting('nzprekey'))) {
         return false;
     }
     if ($this->echooutput) {
         echo "Predb   : Checking for new pre data ";
     }
     $nntp = new NNTP();
     if (!$nntp->doConnect()) {
         echo "Failed to get NNTP connection\n";
         return false;
     }
     $ret = $groupData = $nntp->selectGroup($this->pdo->getSetting('nzpregroup'));
     if ($nntp->isError($ret)) {
         echo "Predb   : Error " . $ret->getMessage() . "\n";
         return false;
     }
     $ret = $groupMsgs = $nntp->getOverview($groupData['last'] - (!empty($this->pdo->getSetting('nzprearticles')) ? $this->pdo->getSetting('nzprearticles') : 500) . '-' . $groupData['last']);
     if ($nntp->isError($ret)) {
         echo "Predb   : Error " . $ret->getMessage() . "\n";
         return false;
     }
     $added_updated = 0;
     $nzprekey = $this->pdo->getSetting('nzprekey');
     while (strlen($nzprekey) < 1024) {
         $nzprekey = $nzprekey . $nzprekey;
     }
     $cnt = !empty($this->pdo->getSetting('nzprearticles')) ? $this->pdo->getSetting('nzprearticles') : 500;
     foreach ($groupMsgs as $groupMsg) {
         if ($cnt % 50 == 0 && $cnt != 0 && $this->echooutput) {
             echo $cnt . "..";
         }
         $cnt--;
         if (preg_match('/^' . $this->pdo->getSetting('nzpresubject') . '$/', $groupMsg['Subject']) && preg_match('/^' . $this->pdo->getSetting('nzpreposter') . '/', $groupMsg['From'])) {
             $ret = $msgHeader = $nntp->getHeader($groupMsg['Message-ID']);
             if ($nntp->isError($ret)) {
                 continue;
             }
             for ($i = 0; $i < count($msgHeader); $i++) {
                 if (preg_match('/^' . $this->pdo->getSetting('nzprefield') . ': /', $msgHeader[$i])) {
                     if ($nzpreParse = $this->nzpreParse(str_replace($this->pdo->getSetting('nzprefield') . ': ', '', $msgHeader[$i]), $nzprekey)) {
                         if ($this->updatePreDB($this->pdo, $nzpreParse)) {
                             $added_updated++;
                         }
                     }
                     break;
                 }
             }
         }
     }
     $nntp->disconnect();
     if ($this->echooutput) {
         echo "\nPredb   : Added/Updated " . $added_updated . " records\n";
     }
 }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:59,代码来源:PreDB.php


示例19: setRageNotFound

    private function setRageNotFound($Id)
    {
        if ($Id) {
            $this->pdo->queryExec(sprintf('
						UPDATE releases
						SET rageid = -2
						WHERE %s
						AND id = %d', $this->catWhere, $Id));
        }
    }
开发者ID:RickDB,项目名称:newznab-tmux,代码行数:10,代码来源:TvRage.php


示例20: 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;
    }
开发者ID:engine9-,项目名称:newznab-tmux,代码行数:19,代码来源:Releases.php



注:本文中的newznab\db\Settings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Library\ObjectConfig类代码示例发布时间:2022-05-23
下一篇:
PHP Utils\Validators类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap