當前位置: 首頁>>代碼示例>>PHP>>正文


PHP db\Settings類代碼示例

本文整理匯總了PHP中nzedb\db\Settings的典型用法代碼示例。如果您正苦於以下問題:PHP Settings類的具體用法?PHP Settings怎麽用?PHP Settings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Settings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的nzedb\db\Settings類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。