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

PHP db\Settings类代码示例

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

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



在下文中一共展示了Settings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param array $options Class instances / Echo to cli.
  */
 public function __construct(array $options = array())
 {
     $defaults = ['Echo' => false, 'Settings' => null];
     $options += $defaults;
     $this->echooutput = $options['Echo'] && nZEDb_ECHOCLI;
     $this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
     $qty = $this->pdo->getSetting('maxanidbprocessed');
     $this->aniqty = !empty($qty) ? $qty : 100;
     $this->imgSavePath = nZEDb_COVERS . 'anime' . DS;
 }
开发者ID:Jay204,项目名称:nZEDb,代码行数:13,代码来源:AniDB.php


示例2: updateRelease

    /**
     * Update Sphinx Relases index for given releaseid.
     *
     * @param int $releaseID
     * @param \nzedb\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 release_files rf ON (r.id=rf.releaseid)
							WHERE r.id = %d
							GROUP BY r.id LIMIT 1', $releaseID));
            if ($new !== false) {
                $this->insertRelease($new);
            }
        }
    }
开发者ID:zetas,项目名称:nZEDb,代码行数:20,代码来源:SphinxSearch.php


示例3: deleteRelease

 /**
  * Delete release from Sphinx RT table.
  * @param array $identifiers ['g' => Release GUID(mandatory), 'id => ReleaseID(optional, pass false)]
  * @param \nzedb\db\Settings $pdo
  */
 public function deleteRelease($identifiers, Settings $pdo)
 {
     if (!is_null($this->sphinxQL)) {
         if ($identifiers['i'] === false) {
             $identifiers['i'] = $pdo->queryOneRow(sprintf('SELECT id FROM releases WHERE guid = %s', $pdo->escapeString($identifiers['g'])));
             if ($identifiers['i'] !== false) {
                 $identifiers['i'] = $identifiers['i']['id'];
             }
         }
         if ($identifiers['i'] !== false) {
             $this->sphinxQL->queryExec(sprintf('DELETE FROM releases_rt WHERE id = %s', $identifiers['i']));
         }
     }
 }
开发者ID:EeGgSs,项目名称:nZEDb,代码行数:19,代码来源:SphinxSearch.php


示例4: 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;
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:16,代码来源:Videos.php


示例5: 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, '');
        }
    }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:13,代码来源:DnzbFailures.php


示例6: getForMenu

 /**
  * Collect and return various capability information for usage in API
  *
  * @return array
  */
 public function getForMenu()
 {
     $serverroot = '';
     $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
     if (isset($_SERVER['SERVER_NAME'])) {
         $serverroot = ($https === true ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' && $_SERVER['SERVER_PORT'] != '443' ? ':' . $_SERVER['SERVER_PORT'] : '') . WWW_TOP . '/';
     }
     return ['server' => ['appversion' => (new Versions())->getTagVersion(), 'version' => '0.1', 'title' => $this->pdo->getSetting('title'), 'strapline' => $this->pdo->getSetting('strapline'), 'email' => $this->pdo->getSetting('email'), 'url' => $serverroot, 'image' => $serverroot . 'themes/shared/images/logo.png'], 'limits' => ['max' => 100, 'default' => 100], 'registration' => ['available' => 'yes', 'open' => $this->pdo->getSetting('registerstatus') == 0 ? 'yes' : 'no'], 'searching' => ['search' => ['available' => 'yes', 'supportedParams' => 'q'], 'tv-search' => ['available' => 'yes', 'supportedParams' => 'q,vid,tvdbid,traktid,rid,tvmazeid,imdbid,tmdbid,season,ep'], 'movie-search' => ['available' => 'yes', 'supportedParams' => 'q,imdbid'], 'audio-search' => ['available' => 'no', 'supportedParams' => '']]];
 }
开发者ID:zetas,项目名称:nZEDb,代码行数:14,代码来源:Capabilities.php


示例7: startRunning

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


示例8: processStuckCollections

 /**
  * If a collection has been stuck for $this->collectionTimeout hours, delete it, it's bad.
  *
  * @param array $group
  * @param string $where
  *
  * @void
  * @access private
  */
 private function processStuckCollections(array $group, $where)
 {
     $obj = $this->pdo->queryExec(sprintf("\n\t\t\t\tDELETE c, b, p FROM %s c\n\t\t\t\tLEFT JOIN %s b ON (c.id=b.collection_id)\n\t\t\t\tLEFT JOIN %s p ON (b.id=p.binaryid)\n\t\t\t\tWHERE\n\t\t\t\t\tc.added <\n\t\t\t\t\tDATE_SUB((SELECT value FROM settings WHERE setting = 'last_run_time'), INTERVAL %d HOUR)\n\t\t\t\t%s", $group['cname'], $group['bname'], $group['pname'], $this->collectionTimeout, $where));
     if ($this->echoCLI && is_object($obj) && $obj->rowCount()) {
         $this->pdo->log->doEcho($this->pdo->log->primary('Deleted ' . $obj->rowCount() . ' broken/stuck collections.'));
     }
 }
开发者ID:zetas,项目名称:nZEDb,代码行数:16,代码来源:ProcessReleases.php


示例9: insertNewComment

    /**
     * Fetch a comment and insert it.
     *
     * @param string $messageID Message-ID for the article.
     * @param string $siteID    ID of the site.
     *
     * @return bool
     *
     * @access protected
     */
    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;
        }
        // Insert the comment.
        if ($this->pdo->queryExec(sprintf('
				INSERT INTO release_comments
				(text, createddate, shareid, nzb_guid, siteid, username, user_id, releaseid, shared, host)
				VALUES (%s, %s, %s, UNHEX(%s), %s, %s, 0, 0, 2, "")', $this->pdo->escapeString($body['BODY']), $this->pdo->from_unixtime($body['TIME'] > time() ? time() : $body['TIME']), $this->pdo->escapeString($body['SID']), $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:kaibosh,项目名称:nZEDb,代码行数:41,代码来源:Sharing.php


示例10: insertGenre

 /**
  * Inserts Genre and returns last affected row (Genre ID)
  *
  * @param $genre
  *
  * @return bool
  */
 private function insertGenre($genre)
 {
     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:Jay204,项目名称:nZEDb,代码行数:14,代码来源:XXX.php


示例11: 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)));
     }
 }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:7,代码来源:ReleaseExtra.php


示例12: 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:sebst3r,项目名称:nZEDb,代码行数:60,代码来源:Games.php


示例13: setUserPreferences

 protected function setUserPreferences()
 {
     $this->userdata = $this->users->getById($this->users->currentUserId());
     $this->userdata['categoryexclusions'] = $this->users->getCategoryExclusion($this->users->currentUserId());
     // Change to the user's selected theme, if they selected one, else use the admin set one.
     $this->theme = isset($this->userdata['style']) ? $this->userdata['style'] : 'None';
     if ($this->theme == 'None') {
         $this->theme = $this->settings->getSetting('site.main.style');
     }
     if (lcfirst($this->theme) === $this->theme) {
         // TODO add redirect to error page telling the user their theme name is invalid (after SQL patch to update current users is added).
         $this->theme = ucfirst($this->theme);
     }
     // Update last login every 15 mins.
     if (strtotime($this->userdata['now']) - 900 > strtotime($this->userdata['lastlogin'])) {
         $this->users->updateSiteAccessed($this->userdata['id']);
     }
     $this->smarty->assign('userdata', $this->userdata);
     $this->smarty->assign('loggedin', 'true');
     $sab = new SABnzbd($this);
     $this->smarty->assign('sabintegrated', $sab->integratedBool);
     if ($sab->integratedBool !== false && $sab->url != '' && $sab->apikey != '') {
         $this->smarty->assign('sabapikeytype', $sab->apikeytype);
     }
     switch ((int) $this->userdata['role']) {
         case Users::ROLE_ADMIN:
             $this->smarty->assign('isadmin', 'true');
             break;
         case Users::ROLE_MODERATOR:
             $this->smarty->assign('ismod', 'true');
     }
 }
开发者ID:zetas,项目名称:nZEDb,代码行数:32,代码来源:BasePage.php


示例14: 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:sebst3r,项目名称:nZEDb,代码行数:13,代码来源:Music.php


示例15: _requestIdNotFound

    /**
     * No request ID was found, update the release.
     *
     * @param int $releaseID
     * @param int $status
     */
    protected function _requestIdNotFound($releaseID, $status)
    {
        if ($releaseID == 0) {
            return;
        }
        $this->pdo->queryExec(sprintf('
				UPDATE releases SET reqidstatus = %d WHERE id = %d', $status, $releaseID));
    }
开发者ID:kaibosh,项目名称:nZEDb,代码行数:14,代码来源:RequestID.php


示例16: getAnimeInfo

    /**
     * Retrieves all info for a specific AniDB ID
     *
     * @param int $anidbID
     * @return array|boolean
     */
    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, ai.similar
				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:kaibosh,项目名称:nZEDb,代码行数:15,代码来源:AniDB.php


示例17: _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 integer $status
     * @param integer $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:Atmos01,项目名称:nZEDb,代码行数:17,代码来源:NameFixer.php


示例18: getCommentsForUserRange

 public function getCommentsForUserRange($uid, $start, $num)
 {
     if ($start === false) {
         $limit = '';
     } else {
         $limit = " LIMIT {$num} OFFSET {$start}";
     }
     return $this->pdo->query(sprintf("\n\t\t\t\tSELECT release_comments.*\n\t\t\t\tFROM release_comments\n\t\t\t\tWHERE user_id = %d\n\t\t\t\tORDER BY release_comments.createddate DESC %s", $uid, $limit));
 }
开发者ID:sebst3r,项目名称:nZEDb,代码行数:9,代码来源:ReleaseComments.php


示例19: 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:Jay204,项目名称:nZEDb,代码行数:9,代码来源:Contents.php


示例20: processConsoleReleases

    public function processConsoleReleases()
    {
        $res = $this->pdo->queryDirect(sprintf('
							SELECT searchname, id
							FROM releases
							WHERE nzbstatus = %d %s
							AND consoleinfoid IS NULL
							AND categoryid BETWEEN 1000 AND 1999
							ORDER BY postdate DESC
							LIMIT %d', NZB::NZB_ADDED, $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() . ' console release(s).'));
            }
            foreach ($res as $arr) {
                $startTime = microtime(true);
                $usedAmazon = false;
                $gameId = self::CONS_NTFND;
                $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'] . ' (' . $gameInfo['platform'] . ')'));
                    }
                    // Check for existing console entry.
                    $gameCheck = $this->getConsoleInfoByName($gameInfo['title'], $gameInfo['platform']);
                    if ($gameCheck === false) {
                        $gameId = $this->updateConsoleInfo($gameInfo);
                        $usedAmazon = true;
                    } else {
                        if ($this->echooutput) {
                            $this->pdo->log->doEcho($this->pdo->log->headerOver("Found Local: ") . $this->pdo->log->primary("{$gameCheck['title']} - {$gameCheck['platform']}") . PHP_EOL);
                        }
                        $gameId = $gameCheck['id'];
                    }
                } elseif ($this->echooutput) {
                    echo '.';
                }
                // Update release.
                $this->pdo->queryExec(sprintf('
								UPDATE releases
								SET consoleinfoid = %d
								WHERE id = %d', $gameId, $arr['id']));
                // Sleep to not flood amazon.
                $diff = floor((microtime(true) - $startTime) * 1000000);
                if ($this->sleeptime * 1000 - $diff > 0 && $usedAmazon === true) {
                    usleep($this->sleeptime * 1000 - $diff);
                }
            }
        } else {
            if ($this->echooutput) {
                $this->pdo->log->doEcho($this->pdo->log->header('No console releases to process.'));
            }
        }
    }
开发者ID:Jay204,项目名称:nZEDb,代码行数:54,代码来源:Console.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP utility\Misc类代码示例发布时间:2022-05-23
下一篇:
PHP Library\ObjectConfig类代码示例发布时间: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