本文整理匯總了PHP中nzedb\db\Settings::getSetting方法的典型用法代碼示例。如果您正苦於以下問題:PHP Settings::getSetting方法的具體用法?PHP Settings::getSetting怎麽用?PHP Settings::getSetting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nzedb\db\Settings
的用法示例。
在下文中一共展示了Settings::getSetting方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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' => '']]];
}
示例2: __construct
/**
* @param array $options Class instances / Echo to CLI.
*/
public function __construct(array $options = array())
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->rageqty = $this->pdo->getSetting('maxrageprocessed') != '' ? $this->pdo->getSetting('maxrageprocessed') : 75;
$this->echooutput = $options['Echo'] && nZEDb_ECHOCLI;
$this->xmlEpisodeInfoUrl = "http://services.tvrage.com/myfeeds/episodeinfo.php?key=" . TvRage::APIKEY;
}
示例3: __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->status = 'NULL';
}
示例4: addComment
public function addComment($id, $text, $userid, $host)
{
if ($this->pdo->getSetting('storeuserips') != "1") {
$host = "";
}
$username = $this->pdo->queryOneRow(sprintf('SELECT username FROM users WHERE id = %d', $userid));
$username = $username === false ? 'ANON' : $username['username'];
$comid = $this->pdo->queryInsert(sprintf("\n\t\t\t\tINSERT INTO release_comments (releaseid, text, user_id, createddate, host, username)\n\t\t\t\tVALUES (%d, %s, %d, NOW(), %s, %s)", $id, $this->pdo->escapeString($text), $userid, $this->pdo->escapeString($host), $this->pdo->escapeString($username)));
$this->updateReleaseCommentCount($id);
return $comid;
}
示例5: __construct
/**
* @var array $options Class instances.
*/
public function __construct(array $options = [])
{
$defaults = ['Settings' => null, 'Groups' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->groups = $options['Groups'] instanceof Groups ? $options['Groups'] : new Groups(['Settings' => $this->pdo]);
$this->updategrabs = $this->pdo->getSetting('grabstatus') == '0' ? false : true;
$this->passwordStatus = $this->pdo->getSetting('checkpasswordedrar') == 1 ? -1 : 0;
$this->sphinxSearch = new SphinxSearch();
$this->releaseSearch = new ReleaseSearch($this->pdo, $this->sphinxSearch);
}
示例6: __construct
/**
* Default constructor.
*
* @param \nzedb\db\Settings $pdo
*
* @access public
*/
public function __construct(&$pdo = null)
{
$this->pdo = $pdo instanceof \nzedb\db\Settings ? $pdo : new \nzedb\db\Settings();
$this->tablePerGroup = $this->pdo->getSetting('tablepergroup') == 0 ? false : true;
$nzbSplitLevel = $this->pdo->getSetting('nzbsplitlevel');
$this->nzbSplitLevel = empty($nzbSplitLevel) ? 1 : $nzbSplitLevel;
$this->siteNzbPath = (string) $this->pdo->getSetting('nzbpath');
if (substr($this->siteNzbPath, -1) !== DS) {
$this->siteNzbPath .= DS;
}
}
示例7: __construct
/**
* Construct.
*
* @param array $options
* array(
* 'Echo' => bool ; To echo to CLI or not.
* 'NNTP' => NNTP ; Class NNTP.
* 'Nfo' => Nfo ; Class Nfo.
* 'NZB' => NZB ; Class NZB.
* 'Settings' => DB ; Class nzedb\db\Settings.
* 'PostProcess' => PostProcess ; Class PostProcess.
* )
*
* @access public
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'NNTP' => null, 'Nfo' => null, 'NZB' => null, 'Settings' => null, 'PostProcess' => null];
$options += $defaults;
$this->echooutput = $options['Echo'] && nZEDb_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->nntp = $options['NNTP'] instanceof NNTP ? $options['NNTP'] : new NNTP(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$this->nfo = $options['Nfo'] instanceof Nfo ? $options['Nfo'] : new Nfo(['Echo' => $this->echooutput, 'Settings' => $this->pdo]);
$this->pp = $options['PostProcess'] instanceof PostProcess ? $options['PostProcess'] : new PostProcess(['Echo' => $this->echooutput, 'Nfo' => $this->nfo, 'Settings' => $this->pdo]);
$this->nzb = $options['NZB'] instanceof NZB ? $options['NZB'] : new NZB($this->pdo);
$this->lookuppar2 = $this->pdo->getSetting('lookuppar2') == 1 ? true : false;
$this->alternateNNTP = $this->pdo->getSetting('alternate_nntp') == 1 ? true : false;
}
示例8: _getMediaInfo
/**
* Try to get media info xml from a video file.
*
* @param string $fileLocation
*
* @return bool
*/
protected function _getMediaInfo($fileLocation)
{
if (!$this->_processMediaInfo) {
return false;
}
// Look for the video file.
if (is_file($fileLocation)) {
// Run media info on it.
$xmlArray = Misc::runCmd($this->_killString . $this->pdo->getSetting('mediainfopath') . '" --Output=XML "' . $fileLocation . '"');
// Check if we got it.
if (is_array($xmlArray)) {
// Convert it to string.
$xmlArray = implode("\n", $xmlArray);
if (!preg_match('/<track type="(Audio|Video)">/i', $xmlArray)) {
return false;
}
// Insert it into the DB.
$this->_releaseExtra->addFull($this->_release['id'], $xmlArray);
$this->_releaseExtra->addFromXml($this->_release['id'], $xmlArray);
if ($this->_echoCLI) {
$this->_echo('m', 'primaryOver', false);
}
return true;
}
}
return false;
}
示例9: __construct
/**
* Constructor.
*
* @param array $options Class instances / echo to CLI?
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => true, 'CollectionsCleaning' => null, 'ColorCLI' => null, 'Logger' => null, 'Groups' => null, 'NNTP' => null, 'Settings' => null];
$options += $defaults;
$this->_echoCLI = $options['Echo'] && nZEDb_ECHOCLI;
$this->_pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->_groups = $options['Groups'] instanceof Groups ? $options['Groups'] : new Groups(['Settings' => $this->_pdo]);
$this->_colorCLI = $options['ColorCLI'] instanceof ColorCLI ? $options['ColorCLI'] : new ColorCLI();
$this->_nntp = $options['NNTP'] instanceof NNTP ? $options['NNTP'] : new NNTP(['Echo' => $this->_colorCLI, 'Settings' => $this->_pdo, 'ColorCLI' => $this->_colorCLI]);
$this->_collectionsCleaning = $options['CollectionsCleaning'] instanceof CollectionsCleaning ? $options['CollectionsCleaning'] : new CollectionsCleaning(['Settings' => $this->_pdo]);
$this->_debug = nZEDb_DEBUG || nZEDb_LOGGING;
if ($this->_debug) {
try {
$this->_debugging = $options['Logger'] instanceof Logger ? $options['Logger'] : new Logger(['ColorCLI' => $this->_colorCLI]);
} catch (LoggerException $error) {
$this->_debug = false;
}
}
$this->messageBuffer = $this->_pdo->getSetting('maxmssgs') != '' ? $this->_pdo->getSetting('maxmssgs') : 20000;
$this->_compressedHeaders = $this->_pdo->getSetting('compressedheaders') == 1 ? true : false;
$this->_partRepair = $this->_pdo->getSetting('partrepair') == 0 ? false : true;
$this->_newGroupScanByDays = $this->_pdo->getSetting('newgroupscanmethod') == 1 ? true : false;
$this->_newGroupMessagesToScan = $this->_pdo->getSetting('newgroupmsgstoscan') != '' ? $this->_pdo->getSetting('newgroupmsgstoscan') : 50000;
$this->_newGroupDaysToScan = $this->_pdo->getSetting('newgroupdaystoscan') != '' ? (int) $this->_pdo->getSetting('newgroupdaystoscan') : 3;
$this->_partRepairLimit = $this->_pdo->getSetting('maxpartrepair') != '' ? (int) $this->_pdo->getSetting('maxpartrepair') : 15000;
$this->_partRepairMaxTries = $this->_pdo->getSetting('partrepairmaxtries') != '' ? (int) $this->_pdo->getSetting('partrepairmaxtries') : 3;
$this->_showDroppedYEncParts = $this->_pdo->getSetting('showdroppedyencparts') == 1 ? true : false;
$this->_tablePerGroup = $this->_pdo->getSetting('tablepergroup') == 1 ? true : false;
$this->blackList = $this->whiteList = [];
}
示例10: 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');
}
}
示例11: __construct
/**
* Default constructor.
*
* @param array $options Class instance / echo to cli.
*
* @access public
*/
public function __construct(array $options = [])
{
$defaults = ['Echo' => false, 'Settings' => null];
$options += $defaults;
$this->echo = $options['Echo'] && nZEDb_ECHOCLI;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->nzbs = $this->pdo->getSetting('maxnfoprocessed') != '' ? (int) $this->pdo->getSetting('maxnfoprocessed') : 100;
$this->maxsize = $this->pdo->getSetting('maxsizetoprocessnfo') != '' ? (int) $this->pdo->getSetting('maxsizetoprocessnfo') : 100;
$this->maxsize = $this->maxsize > 0 ? 'AND size < ' . $this->maxsize * 1073741824 : '';
$this->minsize = $this->pdo->getSetting('minsizetoprocessnfo') != '' ? (int) $this->pdo->getSetting('minsizetoprocessnfo') : 100;
$this->minsize = $this->minsize > 0 ? 'AND size > ' . $this->minsize * 1048576 : '';
$this->maxRetries = (int) ($this->pdo->getSetting('maxnforetries') >= 0 ? -((int) $this->pdo->getSetting('maxnforetries') + 1) : self::NFO_UNPROC);
$this->maxRetries = $this->maxRetries < -8 ? -8 : $this->maxRetries;
$this->tmpPath = (string) $this->pdo->getSetting('tmpunrarpath');
if (!preg_match('/[\\/\\\\]$/', $this->tmpPath)) {
$this->tmpPath .= DS;
}
}
示例12: getAniDbAPI
/**
* Retrieves supplemental anime info from the AniDB API
*
* @return array|bool
*/
private function getAniDbAPI()
{
$timestamp = $this->pdo->getSetting('APIs.AniDB.banned') + 90000;
if ($timestamp > time()) {
echo "Banned from AniDB lookups until " . date('Y-m-d H:i:s', $timestamp) . "\n";
return false;
}
$apiresponse = $this->getAniDbResponse();
$AniDBAPIArray = [];
if (!$apiresponse) {
echo "AniDB: Error getting response." . PHP_EOL;
} elseif (preg_match("/\\<error\\>Banned\\<\\/error\\>/", $apiresponse)) {
$this->banned = true;
$this->pdo->setSetting(['APIs.AniDB.banned' => time()]);
} elseif (preg_match("/\\<error\\>Anime not found\\<\\/error\\>/", $apiresponse)) {
echo "AniDB : Anime not yet on site. Remove until next update.\n";
} elseif ($AniDBAPIXML = new \SimpleXMLElement($apiresponse)) {
$AniDBAPIArray['similar'] = $this->processAPIResponceElement($AniDBAPIXML->similaranime, 'anime');
$AniDBAPIArray['related'] = $this->processAPIResponceElement($AniDBAPIXML->relatedanime, 'anime');
$AniDBAPIArray['creators'] = $this->processAPIResponceElement($AniDBAPIXML->creators);
$AniDBAPIArray['characters'] = $this->processAPIResponceElement($AniDBAPIXML->characters);
$AniDBAPIArray['categories'] = $this->processAPIResponceElement($AniDBAPIXML->categories);
$episodeArray = [];
if ($AniDBAPIXML->episodes && $AniDBAPIXML->episodes[0]->attributes()) {
$i = 1;
foreach ($AniDBAPIXML->episodes->episode as $episode) {
$titleArray = [];
$episodeArray[$i]['episode_id'] = (int) $episode->attributes()->id[0];
$episodeArray[$i]['episode_no'] = (int) $episode->epno;
$episodeArray[$i]['airdate'] = (string) $episode->airdate;
if ($AniDBAPIXML->title && $AniDBAPIXML->title[0]->attributes()) {
foreach ($AniDBAPIXML->title->children() as $title) {
$xmlAttribs = $title->attributes('xml', true);
// only english, x-jat imploded episode titles for now
if (in_array($xmlAttribs->lang, ['en', 'x-jat'])) {
$titleArray[] = $title[0];
}
}
}
$episodeArray[$i]['episode_title'] = empty($titleArray) ? '' : implode(', ', $titleArray);
$i++;
}
}
//start and end date come from AniDB API as date strings -- no manipulation needed
$AniDBAPIArray['startdate'] = isset($AniDBAPIXML->startdate) ? $AniDBAPIXML->startdate : '0000-00-00';
$AniDBAPIArray['enddate'] = isset($AniDBAPIXML->enddate) ? $AniDBAPIXML->enddate : '0000-00-00';
if (isset($AniDBAPIXML->ratings->permanent)) {
$AniDBAPIArray['rating'] = $AniDBAPIXML->ratings->permanent;
} else {
$AniDBAPIArray['rating'] = isset($AniDBAPIXML->ratings->temporary) ? $AniDBAPIXML->ratings->temporary : ($AniDBAPIArray['rating'] = '');
}
$AniDBAPIArray += ['type' => isset($AniDBAPIXML->type[0]) ? (string) $AniDBAPIXML->type : '', 'description' => isset($AniDBAPIXML->description) ? (string) $AniDBAPIXML->description : '', 'picture' => isset($AniDBAPIXML->picture[0]) ? (string) $AniDBAPIXML->picture : '', 'epsarr' => $episodeArray];
return $AniDBAPIArray;
}
return false;
}
示例13: login
/**
* Log in a user.
*
* @param int $userID ID of the user.
* @param string $host
* @param string $remember Save the user in cookies to keep them logged in.
*/
public function login($userID, $host = '', $remember = '')
{
$_SESSION['uid'] = $userID;
if ($this->pdo->getSetting('storeuserips') != 1) {
$host = '';
}
$this->updateSiteAccessed($userID, $host);
if ($remember == 1) {
$this->setCookies($userID);
}
}
示例14: __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();
$this->pubkey = $this->pdo->getSetting('amazonpubkey');
$this->privkey = $this->pdo->getSetting('amazonprivkey');
$this->asstag = $this->pdo->getSetting('amazonassociatetag');
$this->musicqty = $this->pdo->getSetting('maxmusicprocessed') != '' ? $this->pdo->getSetting('maxmusicprocessed') : 150;
$this->sleeptime = $this->pdo->getSetting('amazonsleep') != '' ? $this->pdo->getSetting('amazonsleep') : 1000;
$this->imgSavePath = nZEDb_COVERS . 'music' . DS;
$this->renamed = '';
if ($this->pdo->getSetting('lookupmusic') == 2) {
$this->renamed = 'AND isrenamed = 1';
}
}
示例15: __construct
/**
* @param array $options Echo to cli / Class instances.
*/
public function __construct(array $options = array())
{
$defaults = ['Echo' => false, 'ReleaseImage' => null, 'Settings' => null];
$options += $defaults;
$this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
$this->releaseImage = $options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo);
$this->movieqty = $this->pdo->getSetting('maxxxxprocessed') != '' ? $this->pdo->getSetting('maxxxxprocessed') : 100;
$this->showPasswords = $this->pdo->getSetting('showpasswordedrelease') != '' ? $this->pdo->getSetting('showpasswordedrelease') : 0;
$this->debug = nZEDb_DEBUG;
$this->echooutput = $options['Echo'] && nZEDb_ECHOCLI;
$this->imgSavePath = nZEDb_COVERS . 'xxx' . DS;
$this->cookie = nZEDb_TMP . 'xxx.cookie';
if (nZEDb_DEBUG || nZEDb_LOGGING) {
$this->debug = true;
try {
$this->debugging = new \Logger();
} catch (\LoggerException $error) {
$this->_debug = false;
}
}
}