mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Blacklight;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BookInfo;
|
||||
use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
@@ -92,10 +93,7 @@ class Books
|
||||
return BookInfo::query()->where('id', $id)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function getBookInfoByName($title)
|
||||
public function getBookInfoByName($title): Model
|
||||
{
|
||||
//only used to get a count of words
|
||||
$searchWords = '';
|
||||
@@ -276,7 +274,7 @@ class Books
|
||||
Release::query()->where('nzbstatus', '=', NZB::NZB_ADDED)
|
||||
->whereNull('bookinfo_id')
|
||||
->whereIn('categories_id', [$iValue])
|
||||
->orderBy('postdate', 'desc')
|
||||
->orderByDesc('postdate')
|
||||
->limit($this->bookqty)
|
||||
->get(['searchname', 'id', 'categories_id']), $iValue
|
||||
);
|
||||
|
||||
+3
-10
@@ -121,11 +121,9 @@ class Console
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @param string $platform
|
||||
* @return false|\Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function getConsoleInfoByName($title, $platform)
|
||||
public function getConsoleInfoByName(string $title, string $platform)
|
||||
{
|
||||
//only used to get a count of words
|
||||
$searchWords = '';
|
||||
@@ -297,10 +295,7 @@ class Console
|
||||
return $browseBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $review
|
||||
*/
|
||||
public function update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genres_id, $review = 'review'): void
|
||||
public function update($id, $title, $asin, $url, $salesrank, $platform, $publisher, $releasedate, $esrb, $cover, $genres_id, string $review = 'review'): void
|
||||
{
|
||||
$releasedate = $releasedate !== '' ? $releasedate : 'null';
|
||||
$review = $review === 'review' ? $review : substr($review, 0, 3000);
|
||||
@@ -512,10 +507,8 @@ class Console
|
||||
/**
|
||||
* This function sets the platform retrieved
|
||||
* from the release to the Amazon equivalent.
|
||||
*
|
||||
* @param string $platform
|
||||
*/
|
||||
protected function _replacePlatform($platform): string
|
||||
protected function _replacePlatform(string $platform): string
|
||||
{
|
||||
switch (strtoupper($platform)) {
|
||||
case 'X360':
|
||||
|
||||
@@ -37,11 +37,9 @@ class Genres
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param bool $activeOnly
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getGenres($type = '', $activeOnly = false)
|
||||
public function getGenres(string $type = '', bool $activeOnly = false)
|
||||
{
|
||||
$sql = $this->getListQuery($type, $activeOnly);
|
||||
$genres = Cache::get(md5($sql));
|
||||
@@ -66,11 +64,7 @@ class Genres
|
||||
return $genresArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param bool $activeOnly
|
||||
*/
|
||||
private function getListQuery($type = '', $activeOnly = false): string
|
||||
private function getListQuery(string $type = '', bool $activeOnly = false): string
|
||||
{
|
||||
if (! empty($type)) {
|
||||
$typesql = sprintf(' AND g.type = %d', $type);
|
||||
|
||||
+14
-35
@@ -188,7 +188,7 @@ class IRCClient
|
||||
*
|
||||
* @param int $timeout Seconds.
|
||||
*/
|
||||
public function setSocketTimeout($timeout)
|
||||
public function setSocketTimeout(int $timeout)
|
||||
{
|
||||
if (! is_numeric($timeout)) {
|
||||
echo 'ERROR: IRC socket timeout must be a number!'.PHP_EOL;
|
||||
@@ -202,7 +202,7 @@ class IRCClient
|
||||
*
|
||||
* @param int $timeout Seconds.
|
||||
*/
|
||||
public function setConnectionTimeout($timeout)
|
||||
public function setConnectionTimeout(int $timeout)
|
||||
{
|
||||
if (! is_numeric($timeout)) {
|
||||
echo 'ERROR: IRC connection timeout must be a number!'.PHP_EOL;
|
||||
@@ -213,10 +213,8 @@ class IRCClient
|
||||
|
||||
/**
|
||||
* Amount of times to retry before giving up when connecting.
|
||||
*
|
||||
* @param int $retries
|
||||
*/
|
||||
public function setConnectionRetries($retries)
|
||||
public function setConnectionRetries(int $retries)
|
||||
{
|
||||
if (! is_numeric($retries)) {
|
||||
echo 'ERROR: IRC connection retries must be a number!'.PHP_EOL;
|
||||
@@ -230,7 +228,7 @@ class IRCClient
|
||||
*
|
||||
* @param int $delay Seconds.
|
||||
*/
|
||||
public function setReConnectDelay($delay)
|
||||
public function setReConnectDelay(int $delay)
|
||||
{
|
||||
if (! is_numeric($delay)) {
|
||||
echo 'ERROR: IRC reconnect delay must be a number!'.PHP_EOL;
|
||||
@@ -245,9 +243,8 @@ class IRCClient
|
||||
* @param string $hostname Host name of the IRC server (can be a IP or a name).
|
||||
* @param int $port Port number of the IRC server.
|
||||
* @param bool $tls Use encryption for the socket transport? (make sure the port is right).
|
||||
* @return bool
|
||||
*/
|
||||
public function connect($hostname, $port = 6667, $tls = false)
|
||||
public function connect(string $hostname, int $port = 6667, bool $tls = false): bool
|
||||
{
|
||||
$this->_alreadyLoggedIn = false;
|
||||
$transport = ($tls === true ? 'tls' : 'tcp');
|
||||
@@ -301,9 +298,8 @@ class IRCClient
|
||||
* @param string $userName The user name - visible in the host name.
|
||||
* @param string $realName The real name - visible in the WhoIs.
|
||||
* @param null $password The password - some servers require a password.
|
||||
* @return bool
|
||||
*/
|
||||
public function login($nickName, $userName, $realName, $password = null)
|
||||
public function login(string $nickName, string $userName, string $realName, $password = null): bool
|
||||
{
|
||||
if (! $this->_connected()) {
|
||||
echo 'ERROR: You must connect to IRC first!'.PHP_EOL;
|
||||
@@ -384,9 +380,8 @@ class IRCClient
|
||||
* Quit from IRC.
|
||||
*
|
||||
* @param string $message Optional disconnect message.
|
||||
* @return bool
|
||||
*/
|
||||
public function quit($message = null)
|
||||
public function quit(string $message = null): bool
|
||||
{
|
||||
if ($this->_connected()) {
|
||||
$this->_writeSocket('QUIT'.($message === null ? '' : ' :'.$message));
|
||||
@@ -439,9 +434,8 @@ class IRCClient
|
||||
*
|
||||
* @param array $channels Array of channels with their passwords (null if the channel doesn't need a password).
|
||||
* array( '#exampleChannel' => 'thePassword', '#exampleChan2' => null );
|
||||
* @return bool
|
||||
*/
|
||||
public function joinChannels($channels = [])
|
||||
public function joinChannels(array $channels = []): bool
|
||||
{
|
||||
$this->_channels = $channels;
|
||||
|
||||
@@ -470,21 +464,16 @@ class IRCClient
|
||||
|
||||
/**
|
||||
* Join a channel.
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $password
|
||||
*/
|
||||
protected function _joinChannel($channel, $password)
|
||||
protected function _joinChannel(string $channel, string $password)
|
||||
{
|
||||
$this->_writeSocket('JOIN '.$channel.(empty($password) ? '' : ' '.$password));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send PONG to a host.
|
||||
*
|
||||
* @param string $host
|
||||
*/
|
||||
protected function _pong($host)
|
||||
protected function _pong(string $host)
|
||||
{
|
||||
if ($this->_writeSocket('PONG '.$host) === false) {
|
||||
$this->_reconnect();
|
||||
@@ -498,10 +487,8 @@ class IRCClient
|
||||
|
||||
/**
|
||||
* Send PING to a host.
|
||||
*
|
||||
* @param string $host
|
||||
*/
|
||||
protected function _ping($host)
|
||||
protected function _ping(string $host)
|
||||
{
|
||||
$pong = $this->_writeSocket('PING '.$host);
|
||||
|
||||
@@ -553,11 +540,8 @@ class IRCClient
|
||||
|
||||
/**
|
||||
* Send a command to the IRC server.
|
||||
*
|
||||
* @param string $command
|
||||
* @return bool
|
||||
*/
|
||||
protected function _writeSocket($command)
|
||||
protected function _writeSocket(string $command): bool
|
||||
{
|
||||
$command .= "\r\n";
|
||||
for ($written = 0, $writtenMax = \strlen($command); $written < $writtenMax; $written += $fWrite) {
|
||||
@@ -629,21 +613,16 @@ class IRCClient
|
||||
|
||||
/**
|
||||
* Check if we are connected to the IRC server.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _connected()
|
||||
protected function _connected(): bool
|
||||
{
|
||||
return \is_resource($this->_socket) && ! feof($this->_socket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips control characters from a IRC message.
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
protected function _stripControlCharacters($text)
|
||||
protected function _stripControlCharacters(string $text): string
|
||||
{
|
||||
return preg_replace(
|
||||
[
|
||||
|
||||
@@ -403,10 +403,8 @@ class IRCScraper extends IRCClient
|
||||
|
||||
/**
|
||||
* Echo new or update pre to CLI.
|
||||
*
|
||||
* @param bool $new
|
||||
*/
|
||||
protected function _doEcho($new = true)
|
||||
protected function _doEcho(bool $new = true)
|
||||
{
|
||||
if (! $this->_silent) {
|
||||
$nukeString = '';
|
||||
@@ -460,10 +458,9 @@ class IRCScraper extends IRCClient
|
||||
/**
|
||||
* Get a group id for a group name.
|
||||
*
|
||||
* @param string $groupName
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _getGroupID($groupName)
|
||||
protected function _getGroupID(string $groupName)
|
||||
{
|
||||
if (! isset($this->_groupList[$groupName])) {
|
||||
$group = UsenetGroup::query()->where('name', $groupName)->first(['id']);
|
||||
|
||||
+9
-24
@@ -213,10 +213,9 @@ class Movie
|
||||
* Get movie releases with covers for movie browse page.
|
||||
*
|
||||
*
|
||||
* @param int $maxAge
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getMovieRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = [])
|
||||
public function getMovieRange($page, $cat, $start, $num, $orderBy, int $maxAge = -1, array $excludedCats = [])
|
||||
{
|
||||
$catsrch = '';
|
||||
if (\count($cat) > 0 && $cat[0] !== -1) {
|
||||
@@ -376,12 +375,11 @@ class Movie
|
||||
/**
|
||||
* Get trailer using IMDB Id.
|
||||
*
|
||||
* @param int $imdbId
|
||||
* @return bool|string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getTrailer($imdbId)
|
||||
public function getTrailer(int $imdbId)
|
||||
{
|
||||
$trailer = MovieInfo::query()->where('imdbid', $imdbId)->where('trailer', '<>', '')->first(['trailer']);
|
||||
if ($trailer !== null) {
|
||||
@@ -408,10 +406,9 @@ class Movie
|
||||
/**
|
||||
* Parse trakt info, insert into DB.
|
||||
*
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function parseTraktTv(&$data)
|
||||
public function parseTraktTv(array &$data)
|
||||
{
|
||||
if (empty($data['ids']['imdb'])) {
|
||||
return false;
|
||||
@@ -514,14 +511,9 @@ class Movie
|
||||
/**
|
||||
* Returns a tmdb, imdb or trakt variable, the one that is set. Empty string if both not set.
|
||||
*
|
||||
* @param string $variable1
|
||||
* @param string $variable2
|
||||
* @param string $variable3
|
||||
* @param string $variable4
|
||||
* @param string $variable5
|
||||
* @return array|string
|
||||
*/
|
||||
protected function setVariables($variable1, $variable2, $variable3, $variable4, $variable5)
|
||||
protected function setVariables(string $variable1, string $variable2, string $variable3, string $variable4, string $variable5)
|
||||
{
|
||||
if (! empty($variable1)) {
|
||||
return $variable1;
|
||||
@@ -741,10 +733,9 @@ class Movie
|
||||
* Fetch info for IMDB id from TMDB.
|
||||
*
|
||||
*
|
||||
* @param bool $text
|
||||
* @return array|false
|
||||
*/
|
||||
public function fetchTMDBProperties($imdbId, $text = false)
|
||||
public function fetchTMDBProperties($imdbId, bool $text = false)
|
||||
{
|
||||
$lookupId = $text === false && (\strlen($imdbId) === 7 || strlen($imdbId) === 8) ? 'tt'.$imdbId : $imdbId;
|
||||
|
||||
@@ -999,13 +990,12 @@ class Movie
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return array|bool
|
||||
*
|
||||
* @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function fetchItunesMovieProperties($title)
|
||||
public function fetchItunesMovieProperties(string $title)
|
||||
{
|
||||
$movie = true;
|
||||
try {
|
||||
@@ -1046,7 +1036,7 @@ class Movie
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function doMovieUpdate($buffer, $service, $id, $processImdb = 1): string
|
||||
public function doMovieUpdate(string $buffer, string $service, int $id, int $processImdb = 1): string
|
||||
{
|
||||
$imdbId = false;
|
||||
if (\is_string($buffer) && preg_match('/(?:imdb.*?)?(?:tt|Title\?)(?P<imdbid>\d{5,8})/i', $buffer, $hits)) {
|
||||
@@ -1086,13 +1076,10 @@ class Movie
|
||||
* Process releases with no IMDB id's.
|
||||
*
|
||||
*
|
||||
* @param string $groupID
|
||||
* @param string $guidChar
|
||||
* @param int $lookupIMDB
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function processMovieReleases($groupID = '', $guidChar = '', $lookupIMDB = 1): void
|
||||
public function processMovieReleases(string $groupID = '', string $guidChar = '', int $lookupIMDB = 1): void
|
||||
{
|
||||
if ($lookupIMDB === 0) {
|
||||
return;
|
||||
@@ -1277,10 +1264,8 @@ class Movie
|
||||
|
||||
/**
|
||||
* Parse a movie name from a release search name.
|
||||
*
|
||||
* @param string $releaseName
|
||||
*/
|
||||
protected function parseMovieSearchName($releaseName): bool
|
||||
protected function parseMovieSearchName(string $releaseName): bool
|
||||
{
|
||||
$name = $year = '';
|
||||
$followingList = '[^\w]((1080|480|720)p|AC3D|Directors([^\w]CUT)?|DD5\.1|(DVD|BD|BR)(Rip)?|BluRay|divx|HDTV|iNTERNAL|LiMiTED|(Real\.)?Proper|RE(pack|Rip)|Sub\.?(fix|pack)|Unrated|WEB-DL|(x|H)[ ._-]?264|xvid)[^\w]';
|
||||
|
||||
@@ -401,11 +401,10 @@ class Music
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $local
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function processMusicReleases($local = false)
|
||||
public function processMusicReleases(bool $local = false)
|
||||
{
|
||||
$res = DB::select(
|
||||
sprintf(
|
||||
@@ -481,10 +480,9 @@ class Music
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $releaseName
|
||||
* @return array|false
|
||||
*/
|
||||
public function parseArtist($releaseName)
|
||||
public function parseArtist(string $releaseName)
|
||||
{
|
||||
if (preg_match('/(.+?)(\d{1,2} \d{1,2} )?\(?(19\d{2}|20[0-1][\d])\b/', $releaseName, $name)) {
|
||||
$result = [];
|
||||
@@ -618,13 +616,12 @@ class Music
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
* @return array|bool
|
||||
*
|
||||
* @throws \DariusIII\ItunesApi\Exceptions\InvalidProviderException
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function fetchItunesMusicProperties($title)
|
||||
protected function fetchItunesMusicProperties(string $title)
|
||||
{
|
||||
$mus = true;
|
||||
// Load genres.
|
||||
|
||||
+4
-7
@@ -356,7 +356,7 @@ class NNTP extends \Net_NNTP_Client
|
||||
* @throws \Exception
|
||||
* On failure : (object) PEAR_Error.
|
||||
*/
|
||||
public function selectGroup($group, $articles = false, bool $force = false): mixed
|
||||
public function selectGroup(string $group, bool $articles = false, bool $force = false): mixed
|
||||
{
|
||||
$connected = $this->_checkConnection(false);
|
||||
if ($connected !== true) {
|
||||
@@ -376,15 +376,12 @@ class NNTP extends \Net_NNTP_Client
|
||||
/**
|
||||
* Fetch an overview of article(s) in the currently selected group.
|
||||
*
|
||||
* @param string $range
|
||||
* @param bool $names
|
||||
* @param bool $forceNames
|
||||
* @return mixed On success : (array) Multidimensional array with article headers.
|
||||
*
|
||||
* @throws \Exception
|
||||
* On failure : (object) PEAR_Error.
|
||||
*/
|
||||
public function getOverview($range = null, $names = true, $forceNames = true): mixed
|
||||
public function getOverview(string $range = null, bool $names = true, bool $forceNames = true): mixed
|
||||
{
|
||||
$connected = $this->_checkConnection();
|
||||
if ($connected !== true) {
|
||||
@@ -507,7 +504,7 @@ class NNTP extends \Net_NNTP_Client
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getGroups($wildMat = null)
|
||||
public function getGroups(string $wildMat = null)
|
||||
{
|
||||
// Enabled header compression if not enabled.
|
||||
$this->_enableCompression();
|
||||
@@ -1300,7 +1297,7 @@ class NNTP extends \Net_NNTP_Client
|
||||
* @return mixed (bool) On success: True when posting allowed, otherwise false.
|
||||
* (object) On failure: pear_error
|
||||
*/
|
||||
public function connect($host = null, $encryption = null, $port = null, $timeout = 15, int $socketTimeout = 120): mixed
|
||||
public function connect(string $host = null, $encryption = null, int $port = null, int $timeout = 15, int $socketTimeout = 120): mixed
|
||||
{
|
||||
if ($this->_isConnected()) {
|
||||
return $this->throwError('Already connected, disconnect first!', null);
|
||||
|
||||
@@ -139,12 +139,11 @@ class NZBContents
|
||||
* Gets the completion from the NZB, optionally looks if there is an NFO/PAR2 file.
|
||||
*
|
||||
*
|
||||
* @param bool $nfoCheck
|
||||
* @return array|false
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function parseNZB($guid, $relID, $groupID, $nfoCheck = false)
|
||||
public function parseNZB($guid, $relID, $groupID, bool $nfoCheck = false)
|
||||
{
|
||||
$nzbFile = $this->LoadNZB($guid);
|
||||
if ($nzbFile !== false) {
|
||||
@@ -243,15 +242,10 @@ class NZBContents
|
||||
/**
|
||||
* Attempts to get the releasename from a par2 file.
|
||||
*
|
||||
* @param string $guid
|
||||
* @param int $relID
|
||||
* @param int $groupID
|
||||
* @param int $nameStatus
|
||||
* @param int $show
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function checkPAR2($guid, $relID, $groupID, $nameStatus, $show): bool
|
||||
public function checkPAR2(string $guid, int $relID, int $groupID, int $nameStatus, int $show): bool
|
||||
{
|
||||
$nzbFile = $this->LoadNZB($guid);
|
||||
if ($nzbFile !== false) {
|
||||
|
||||
@@ -129,7 +129,7 @@ class NZBImport
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function beginImport($filesToProcess, $useNzbName = false, $delete = true, $deleteFailed = true)
|
||||
public function beginImport(array $filesToProcess, $useNzbName = false, bool $delete = true, bool $deleteFailed = true)
|
||||
{
|
||||
// Get all the groups in the DB.
|
||||
if (! $this->getAllGroups()) {
|
||||
@@ -241,11 +241,10 @@ class NZBImport
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $useNzbName
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function scanNZBFile(&$nzbXML, $useNzbName = false): bool
|
||||
protected function scanNZBFile(&$nzbXML, bool $useNzbName = false): bool
|
||||
{
|
||||
$binary_names = [];
|
||||
$totalFiles = $totalSize = $groupID = 0;
|
||||
@@ -456,10 +455,8 @@ class NZBImport
|
||||
|
||||
/**
|
||||
* Echo message to browser or CLI.
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
protected function echoOut($message): void
|
||||
protected function echoOut(string $message): void
|
||||
{
|
||||
if ($this->browser) {
|
||||
$this->retVal .= $message.'<br />';
|
||||
|
||||
@@ -1449,12 +1449,10 @@ class NameFixer
|
||||
/**
|
||||
* Look for a TV name.
|
||||
*
|
||||
* @param bool $echo
|
||||
* @param string $type
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function tvCheck($release, $echo, $type, $nameStatus, $show): void
|
||||
public function tvCheck($release, bool $echo, string $type, $nameStatus, $show): void
|
||||
{
|
||||
$result = [];
|
||||
|
||||
|
||||
+5
-5
@@ -88,7 +88,7 @@ class Nfo
|
||||
* @param string $str The string with a Show ID.
|
||||
* @return array|false Return array with show ID and site source or false on failure.
|
||||
*/
|
||||
public function parseShowId($str)
|
||||
public function parseShowId(string $str)
|
||||
{
|
||||
$return = false;
|
||||
|
||||
@@ -128,7 +128,7 @@ class Nfo
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function isNFO(&$possibleNFO, $guid): bool
|
||||
public function isNFO(&$possibleNFO, string $guid): bool
|
||||
{
|
||||
if ($possibleNFO === false) {
|
||||
return false;
|
||||
@@ -195,7 +195,7 @@ class Nfo
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addAlternateNfo(&$nfo, $release, $nntp): bool
|
||||
public function addAlternateNfo(string &$nfo, $release, NNTP $nntp): bool
|
||||
{
|
||||
if ($release->id > 0 && $this->isNFO($nfo, $release->guid)) {
|
||||
$check = ReleaseNfo::whereReleasesId($release->id)->first(['releases_id']);
|
||||
@@ -240,7 +240,7 @@ class Nfo
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function processNfoFiles($nntp, $groupID = '', $guidChar = '', $processImdb = 1, $processTv = 1): int
|
||||
public function processNfoFiles($nntp, string $groupID = '', string $guidChar = '', int $processImdb = 1, int $processTv = 1): int
|
||||
{
|
||||
$ret = 0;
|
||||
|
||||
@@ -265,7 +265,7 @@ class Nfo
|
||||
|
||||
$res = $qry
|
||||
->orderBy('nfostatus')
|
||||
->orderBy('postdate', 'desc')
|
||||
->orderByDesc('postdate')
|
||||
->limit($this->nzbs)
|
||||
->get(['id', 'guid', 'groups_id', 'name']);
|
||||
|
||||
|
||||
+7
-18
@@ -95,19 +95,16 @@ class Regexes
|
||||
|
||||
/**
|
||||
* Get a single regex using its id.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function getRegexByID($id): array
|
||||
public function getRegexByID(int $id): array
|
||||
{
|
||||
return (array) Arr::first(DB::select(sprintf('SELECT * FROM %s WHERE id = %d LIMIT 1', $this->tableName, $id)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $group_regex
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRegex($group_regex = '')
|
||||
public function getRegex(string $group_regex = '')
|
||||
{
|
||||
if ($this->tableName === 'collection_regexes') {
|
||||
$table = CollectionRegex::class;
|
||||
@@ -131,7 +128,7 @@ class Regexes
|
||||
*
|
||||
* @param string $group_regex Optional, keyword to find a group.
|
||||
*/
|
||||
public function getCount($group_regex = ''): int
|
||||
public function getCount(string $group_regex = ''): int
|
||||
{
|
||||
$query = DB::select(
|
||||
sprintf(
|
||||
@@ -147,11 +144,10 @@ class Regexes
|
||||
/**
|
||||
* Delete a regex using its id.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function deleteRegex($id): void
|
||||
public function deleteRegex(int $id): void
|
||||
{
|
||||
DB::transaction(function () use ($id) {
|
||||
DB::delete(sprintf('DELETE FROM %s WHERE id = %d', $this->tableName, $id));
|
||||
@@ -163,13 +159,10 @@ class Regexes
|
||||
*
|
||||
* Requires table per group to be on.
|
||||
*
|
||||
* @param string $groupName
|
||||
* @param string $regex
|
||||
* @param int $limit
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testCollectionRegex($groupName, $regex, $limit): array
|
||||
public function testCollectionRegex(string $groupName, string $regex, int $limit): array
|
||||
{
|
||||
$groupID = UsenetGroup::getIDByName($groupName);
|
||||
|
||||
@@ -326,12 +319,10 @@ class Regexes
|
||||
*
|
||||
* Requires at least 1 named captured group.
|
||||
*
|
||||
* @param string $regex
|
||||
* @param string $subject
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function _matchRegex($regex, $subject): string
|
||||
protected function _matchRegex(string $regex, string $subject): string
|
||||
{
|
||||
$returnString = '';
|
||||
if (preg_match($regex, $subject, $hits) && \count($hits) > 0) {
|
||||
@@ -359,10 +350,8 @@ class Regexes
|
||||
|
||||
/**
|
||||
* Format part of a query.
|
||||
*
|
||||
* @param string $group_regex
|
||||
*/
|
||||
protected function _groupQueryString($group_regex): string
|
||||
protected function _groupQueryString(string $group_regex): string
|
||||
{
|
||||
return $group_regex ? ('WHERE group_regex LIKE '.escapeString('%'.$group_regex.'%')) : '';
|
||||
}
|
||||
|
||||
@@ -97,12 +97,11 @@ class ReleaseCleaning
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $usePre
|
||||
* @return array|false|string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function releaseCleaner($subject, $fromName, $groupName, $usePre = false)
|
||||
public function releaseCleaner($subject, $fromName, $groupName, bool $usePre = false)
|
||||
{
|
||||
$hit = $hits = [];
|
||||
// Get pre style name from releases.name
|
||||
@@ -402,10 +401,7 @@ class ReleaseCleaning
|
||||
|
||||
// Run at the end because this can be dangerous. In the future it's better to make these per group. There should not be numbers after yEnc because we remove them as well before inserting (even when importing).
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function generic()
|
||||
public function generic(): array
|
||||
{
|
||||
// This regex gets almost all of the predb release names also keep in mind that not every subject ends with yEnc, some are truncated, because of the 255 character limit and some have extra charaters tacked onto the end, like (5/10).
|
||||
if (preg_match(
|
||||
|
||||
@@ -67,10 +67,7 @@ class ReleaseExtra
|
||||
return ReleaseSubtitle::query()->where('releases_id', $id)->select([DB::raw("GROUP_CONCAT(subslanguage SEPARATOR ', ') AS subs")])->orderBy('subsid')->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $guid
|
||||
*/
|
||||
public function getBriefByGuid($guid): array
|
||||
public function getBriefByGuid(string $guid): array
|
||||
{
|
||||
return DB::select(sprintf("SELECT containerformat, videocodec, videoduration, videoaspect,
|
||||
CONCAT(video_data.videowidth,'x',video_data.videoheight,' @',format(videoframerate,0),'fps') AS size,
|
||||
@@ -318,11 +315,7 @@ class ReleaseExtra
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $releaseID
|
||||
* @param string $uniqueId
|
||||
*/
|
||||
public function addUID($releaseID, $uniqueId): void
|
||||
public function addUID(int $releaseID, string $uniqueId): void
|
||||
{
|
||||
$dupecheck = ReleaseUnique::query()->where('releases_id', $releaseID)->orWhere([
|
||||
'releases_id' => $releaseID,
|
||||
|
||||
@@ -147,7 +147,7 @@ class ReleaseRemover
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function removeByCriteria($arguments)
|
||||
public function removeByCriteria(array $arguments)
|
||||
{
|
||||
$this->delete = true;
|
||||
$this->ignoreUserCheck = false;
|
||||
@@ -212,7 +212,7 @@ class ReleaseRemover
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function removeCrap($delete, $time, $type = '', $blacklistID = '')
|
||||
public function removeCrap(bool $delete, $time, string $type = '', $blacklistID = '')
|
||||
{
|
||||
$timeStart = now();
|
||||
$this->delete = $delete;
|
||||
@@ -1037,7 +1037,6 @@ class ReleaseRemover
|
||||
/**
|
||||
* Delete releases from the database.
|
||||
*
|
||||
* @return true
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
@@ -1089,7 +1088,7 @@ class ReleaseRemover
|
||||
* @param string $argument User argument.
|
||||
* @return string|false
|
||||
*/
|
||||
protected function formatCriteriaQuery($argument)
|
||||
protected function formatCriteriaQuery(string $argument)
|
||||
{
|
||||
// Check if the user wants to ignore the check.
|
||||
if ($argument === 'ignore') {
|
||||
@@ -1257,10 +1256,8 @@ class ReleaseRemover
|
||||
|
||||
/**
|
||||
* Check if the user wants to run the current query.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkUserResponse()
|
||||
protected function checkUserResponse(): bool
|
||||
{
|
||||
if ($this->ignoreUserCheck || $this->browser) {
|
||||
return true;
|
||||
@@ -1287,10 +1284,8 @@ class ReleaseRemover
|
||||
|
||||
/**
|
||||
* Remove multiple spaces and trim leading spaces.
|
||||
*
|
||||
* @param string $string
|
||||
*/
|
||||
protected function cleanSpaces($string): string
|
||||
protected function cleanSpaces(string $string): string
|
||||
{
|
||||
return trim(preg_replace('/\s{2,}/', ' ', $string));
|
||||
}
|
||||
@@ -1301,7 +1296,7 @@ class ReleaseRemover
|
||||
* @param string $string The string to format.
|
||||
* @param string $type The column name.
|
||||
*/
|
||||
protected function formatLike($string, $type): string
|
||||
protected function formatLike(string $string, string $type): string
|
||||
{
|
||||
$newString = explode(' ', $string);
|
||||
if (\count($newString) > 1) {
|
||||
@@ -1331,10 +1326,9 @@ class ReleaseRemover
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dbRegex
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
protected function extractSrchFromRegx($dbRegex = '')
|
||||
protected function extractSrchFromRegx(string $dbRegex = '')
|
||||
{
|
||||
$regexMatch = '';
|
||||
|
||||
|
||||
@@ -340,8 +340,6 @@ class Releases extends Release
|
||||
*
|
||||
* @param array $identifiers ['g' => Release GUID(mandatory), 'id => ReleaseID(optional, pass
|
||||
* false)]
|
||||
* @param \Blacklight\NZB $nzb
|
||||
* @param \Blacklight\ReleaseImage $releaseImage
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
||||
+3
-10
@@ -195,10 +195,7 @@ class Tmux
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function updateItem($setting, $value)
|
||||
public function updateItem($setting, $value): int
|
||||
{
|
||||
return Settings::query()->where('setting', '=', $setting)->update(['value' => $value]);
|
||||
}
|
||||
@@ -261,11 +258,10 @@ class Tmux
|
||||
* Returns random bool, weighted by $chance.
|
||||
*
|
||||
*
|
||||
* @param int $chance
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function rand_bool($loop, $chance = 60): bool
|
||||
public function rand_bool($loop, int $chance = 60): bool
|
||||
{
|
||||
$usecache = Settings::settingValue('site.tmux.usecache') ?? 0;
|
||||
if ($loop === 1 || $usecache === 0) {
|
||||
@@ -288,13 +284,10 @@ class Tmux
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $db_name
|
||||
* @param string $ppmax
|
||||
* @param string $ppmin
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function proc_query($qry, $bookreqids, $db_name, $ppmax = '', $ppmin = ''): bool|string
|
||||
public function proc_query($qry, $bookreqids, string $db_name, string $ppmax = '', string $ppmin = ''): bool|string
|
||||
{
|
||||
switch ((int) $qry) {
|
||||
case 1:
|
||||
|
||||
+1
-3
@@ -85,10 +85,8 @@ class XXX
|
||||
|
||||
/**
|
||||
* Get XXX releases with covers for xxx browse page.
|
||||
*
|
||||
* @param int $maxAge
|
||||
*/
|
||||
public function getXXXRange($page, $cat, $start, $num, $orderBy, $maxAge = -1, array $excludedCats = []): array
|
||||
public function getXXXRange($page, $cat, $start, $num, $orderBy, int $maxAge = -1, array $excludedCats = []): array
|
||||
{
|
||||
$catSrch = '';
|
||||
if (\count($cat) > 0 && $cat[0] !== -1) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class Geary
|
||||
* @param string $gateway_id Your API key obtained from https://admin.gear.mycelium.com/gateways
|
||||
* @param string $gateway_secret Your API secret obtained from https://admin.gear.mycelium.com/gateways
|
||||
*/
|
||||
public function __construct($gateway_id, $gateway_secret)
|
||||
public function __construct(string $gateway_id, string $gateway_secret)
|
||||
{
|
||||
$this->gateway_id = $gateway_id;
|
||||
$this->gateway_secret = $gateway_secret;
|
||||
@@ -66,7 +66,7 @@ class Geary
|
||||
* normally in satoshis
|
||||
* @return mixed
|
||||
*/
|
||||
public function create_order($amount, $keychain_id, $callback_data)
|
||||
public function create_order(float $amount, $keychain_id, $callback_data)
|
||||
{
|
||||
$request = $this->endpoint('orders');
|
||||
$params = [
|
||||
@@ -92,7 +92,7 @@ class Geary
|
||||
* @param int $id Id is an existing order ID or payment ID
|
||||
* @return mixed
|
||||
*/
|
||||
public function cancel_order($id)
|
||||
public function cancel_order(int $id)
|
||||
{
|
||||
$request = $this->endpoint('orders');
|
||||
|
||||
@@ -113,7 +113,7 @@ class Geary
|
||||
* @param int $payment_id Id is an existing payment ID
|
||||
* @return mixed
|
||||
*/
|
||||
public function check_order($payment_id)
|
||||
public function check_order(int $payment_id)
|
||||
{
|
||||
$request_uri = $this->endpoint('orders');
|
||||
|
||||
@@ -173,7 +173,7 @@ class Geary
|
||||
*
|
||||
* @param int $id Id is an existing order ID
|
||||
*/
|
||||
public function order_websocket_link($id): string
|
||||
public function order_websocket_link(int $id): string
|
||||
{
|
||||
return "wss://gateway.gear.mycelium.com/gateways/{$this->gateway_id}/orders/$id/websocket";
|
||||
}
|
||||
@@ -219,10 +219,8 @@ class Geary
|
||||
* Endpoint.
|
||||
*
|
||||
* Construct an endpoint URL
|
||||
*
|
||||
* @param string $method
|
||||
*/
|
||||
private function endpoint($method): string
|
||||
private function endpoint(string $method): string
|
||||
{
|
||||
return "/gateways/{$this->gateway_id}/$method";
|
||||
}
|
||||
@@ -255,10 +253,8 @@ class Geary
|
||||
* Get Header.
|
||||
*
|
||||
* Get single data from header
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
private function get_header($name): string
|
||||
private function get_header(string $name): string
|
||||
{
|
||||
$headers = getAllHeaders();
|
||||
|
||||
@@ -277,10 +273,8 @@ class Geary
|
||||
* Prepare Header.
|
||||
*
|
||||
* Add data to header for authentication purpose
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
private function prepare_header($data): array
|
||||
private function prepare_header(array $data): array
|
||||
{
|
||||
$params = $data['params'];
|
||||
$params_query = ! \is_array($params) ? "/$params" : '?'.http_build_query($params);
|
||||
@@ -304,10 +298,9 @@ class Geary
|
||||
*
|
||||
* Send a signed HTTP request
|
||||
*
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
private function send_signed_request($data)
|
||||
private function send_signed_request(array $data)
|
||||
{
|
||||
$ch = curl_init();
|
||||
$url = self::API_URL.$data['request_uri'];
|
||||
|
||||
@@ -68,7 +68,7 @@ class ADE extends AdultMovies
|
||||
*
|
||||
* @return array - url, streamid, basestreamingurl
|
||||
*/
|
||||
protected function trailers()
|
||||
protected function trailers(): array
|
||||
{
|
||||
$this->_response = getRawHtml(self::ADE.$this->_trailers.$this->_directUrl);
|
||||
$this->_html->loadHtml($this->_response);
|
||||
@@ -100,7 +100,7 @@ class ADE extends AdultMovies
|
||||
*
|
||||
* @return array - Boxcover and backcover
|
||||
*/
|
||||
protected function covers()
|
||||
protected function covers(): array
|
||||
{
|
||||
if ($ret = $this->_html->find('div#Boxcover, img[itemprop=image]', 1)) {
|
||||
$this->_res['boxcover'] = preg_replace('/m\.jpg/', 'h.jpg', $ret->src);
|
||||
@@ -115,7 +115,7 @@ class ADE extends AdultMovies
|
||||
*
|
||||
* @return array - plot
|
||||
*/
|
||||
protected function synopsis()
|
||||
protected function synopsis(): array
|
||||
{
|
||||
$ret = $this->_html->findOne('meta[name=og:description]')->content;
|
||||
if ($ret !== false) {
|
||||
@@ -165,10 +165,9 @@ class ADE extends AdultMovies
|
||||
/**
|
||||
* Gets Product Information and/or Features.
|
||||
*
|
||||
* @param bool $extras
|
||||
* @return array - ProductInfo/Extras = features
|
||||
*/
|
||||
protected function productInfo($extras = false)
|
||||
protected function productInfo(bool $extras = false): array
|
||||
{
|
||||
$dofeature = null;
|
||||
$this->_tmpResponse = str_ireplace('Section ProductInfo', 'spdinfo', $this->_response);
|
||||
@@ -202,10 +201,9 @@ class ADE extends AdultMovies
|
||||
/**
|
||||
* Searches xxx name.
|
||||
*
|
||||
* @param string $movie
|
||||
* @return bool - True if releases has 90% match, else false
|
||||
*/
|
||||
public function processSite($movie): bool
|
||||
public function processSite(string $movie): bool
|
||||
{
|
||||
if (empty($movie)) {
|
||||
return false;
|
||||
|
||||
@@ -74,7 +74,7 @@ class ADM extends AdultMovies
|
||||
*
|
||||
* @return array - boxcover,backcover
|
||||
*/
|
||||
protected function covers()
|
||||
protected function covers(): array
|
||||
{
|
||||
$baseUrl = 'http://www.adultdvdmarketplace.com/';
|
||||
if ($ret = $this->_html->find('a[rel=fancybox-button]', 0)) {
|
||||
@@ -108,11 +108,8 @@ class ADM extends AdultMovies
|
||||
|
||||
/**
|
||||
* Get Product Information and Director.
|
||||
*
|
||||
*
|
||||
* @param bool $extras
|
||||
*/
|
||||
protected function productInfo($extras = false): array
|
||||
protected function productInfo(bool $extras = false): array
|
||||
{
|
||||
foreach ($this->_html->find('ul.list-unstyled li') as $li) {
|
||||
$category = explode(':', $li->plaintext);
|
||||
|
||||
@@ -141,10 +141,8 @@ class AEBN extends AdultMovies
|
||||
|
||||
/**
|
||||
* Gets the product information.
|
||||
*
|
||||
* @param bool $extras
|
||||
*/
|
||||
protected function productInfo($extras = false): array
|
||||
protected function productInfo(bool $extras = false): array
|
||||
{
|
||||
if ($ret = $this->_html->find('div#md-detailsLeft', 0)) {
|
||||
foreach ($ret->find('div') as $div) {
|
||||
@@ -187,10 +185,8 @@ class AEBN extends AdultMovies
|
||||
|
||||
/**
|
||||
* Searches for a XXX name.
|
||||
*
|
||||
* @param string $movie
|
||||
*/
|
||||
public function processSite($movie): bool
|
||||
public function processSite(string $movie): bool
|
||||
{
|
||||
if (empty($movie)) {
|
||||
return false;
|
||||
|
||||
@@ -100,10 +100,8 @@ class Hotmovies extends AdultMovies
|
||||
|
||||
/**
|
||||
* Process ProductInfo.
|
||||
*
|
||||
* @param bool $extras
|
||||
*/
|
||||
protected function productInfo($extras = false): array
|
||||
protected function productInfo(bool $extras = false): array
|
||||
{
|
||||
$studio = false;
|
||||
$director = false;
|
||||
@@ -200,10 +198,9 @@ class Hotmovies extends AdultMovies
|
||||
/**
|
||||
* Searches for match against xxx movie name.
|
||||
*
|
||||
* @param string $movie
|
||||
* @return bool , true if search >= 90%
|
||||
*/
|
||||
public function processSite($movie): bool
|
||||
public function processSite(string $movie): bool
|
||||
{
|
||||
if (empty($movie)) {
|
||||
return false;
|
||||
|
||||
@@ -139,10 +139,9 @@ class Popporn extends AdultMovies
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $extras
|
||||
* @return array|mixed
|
||||
*/
|
||||
protected function productInfo($extras = false)
|
||||
protected function productInfo(bool $extras = false)
|
||||
{
|
||||
$country = false;
|
||||
if ($ret = $this->_html->findOne('div#lside')) {
|
||||
@@ -230,10 +229,8 @@ class Popporn extends AdultMovies
|
||||
|
||||
/**
|
||||
* Gets categories.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function genres()
|
||||
protected function genres(): array
|
||||
{
|
||||
$genres = [];
|
||||
if ($ret = $this->_html->find('div[id=thekeywords], p[class=keywords]', 1)) {
|
||||
@@ -249,10 +246,9 @@ class Popporn extends AdultMovies
|
||||
/**
|
||||
* Searches for match against searchterm.
|
||||
*
|
||||
* @param string $movie
|
||||
* @return bool , true if search >= 90%
|
||||
*/
|
||||
public function processSite($movie): bool
|
||||
public function processSite(string $movie): bool
|
||||
{
|
||||
if (! empty($movie)) {
|
||||
$this->_trailUrl = self::TRAILINGSEARCH.$movie;
|
||||
|
||||
@@ -119,10 +119,9 @@ class AniDB
|
||||
/**
|
||||
* Selects episode info for a local match.
|
||||
*
|
||||
* @param int $episode
|
||||
* @return \Illuminate\Database\Eloquent\Model|null|static
|
||||
*/
|
||||
private function checkAniDBInfo($anidbId, $episode = -1)
|
||||
private function checkAniDBInfo($anidbId, int $episode = -1)
|
||||
{
|
||||
return AnidbEpisode::query()->where(
|
||||
[
|
||||
@@ -153,10 +152,9 @@ class AniDB
|
||||
/**
|
||||
* Extracts anime title and episode info from release searchname.
|
||||
*
|
||||
* @param string $cleanName
|
||||
* @return array $hits
|
||||
*/
|
||||
private function extractTitleEpisode($cleanName = ''): array
|
||||
private function extractTitleEpisode(string $cleanName = ''): array
|
||||
{
|
||||
$cleanName = str_replace('_', ' ', $cleanName);
|
||||
|
||||
@@ -194,10 +192,9 @@ class AniDB
|
||||
* Retrieves AniDB Info using a cleaned name.
|
||||
*
|
||||
*
|
||||
* @param string $searchName
|
||||
* @return mixed
|
||||
*/
|
||||
private function getAnidbByName($searchName = '')
|
||||
private function getAnidbByName(string $searchName = '')
|
||||
{
|
||||
return DB::selectOne(
|
||||
sprintf(
|
||||
|
||||
@@ -41,10 +41,8 @@ class TMDB extends TV
|
||||
/**
|
||||
* Main processing director function for TMDB
|
||||
* Calls work query function and initiates processing.
|
||||
*
|
||||
* @param bool $local
|
||||
*/
|
||||
public function processSite($groupID, $guidChar, $process, $local = false): void
|
||||
public function processSite($groupID, $guidChar, $process, bool $local = false): void
|
||||
{
|
||||
$res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TMDB);
|
||||
|
||||
@@ -183,10 +181,9 @@ class TMDB extends TV
|
||||
* Calls the API to perform initial show name match to TMDB title
|
||||
* Returns a formatted array of show data or false if no match.
|
||||
*
|
||||
* @param string $cleanName
|
||||
* @return array|false
|
||||
*/
|
||||
protected function getShowInfo($cleanName): bool|array
|
||||
protected function getShowInfo(string $cleanName): bool|array
|
||||
{
|
||||
$return = $response = false;
|
||||
|
||||
@@ -261,7 +258,7 @@ class TMDB extends TV
|
||||
*
|
||||
* @param int $videoId -- the local Video ID
|
||||
*/
|
||||
public function getPoster($videoId): int
|
||||
public function getPoster(int $videoId): int
|
||||
{
|
||||
$ri = new ReleaseImage();
|
||||
|
||||
@@ -284,14 +281,9 @@ class TMDB extends TV
|
||||
* Gets the specific episode info for the parsed release after match
|
||||
* Returns a formatted array of episode data or false if no match.
|
||||
*
|
||||
* @param int $tmdbid
|
||||
* @param int $season
|
||||
* @param int $episode
|
||||
* @param string $airdate
|
||||
* @param int $videoId
|
||||
* @return array|false
|
||||
*/
|
||||
protected function getEpisodeInfo($tmdbid, $season, $episode, $airdate = '', $videoId = 0): bool|array
|
||||
protected function getEpisodeInfo(int $tmdbid, int $season, int $episode, string $airdate = '', int $videoId = 0): bool|array
|
||||
{
|
||||
$return = false;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ abstract class TV extends Videos
|
||||
->where('size', '>', 1048576)
|
||||
->whereBetween('categories_id', [Category::TV_ROOT, Category::TV_OTHER])
|
||||
->where('categories_id', '<>', Category::TV_ANIME)
|
||||
->orderBy('postdate', 'desc')
|
||||
->orderByDesc('postdate')
|
||||
->limit($this->tvqty);
|
||||
if ($groupID !== '') {
|
||||
$qry->where('groups_id', $groupID);
|
||||
|
||||
@@ -60,10 +60,8 @@ class TVDB extends TV
|
||||
/**
|
||||
* Main processing director function for scrapers
|
||||
* Calls work query function and initiates processing.
|
||||
*
|
||||
* @param bool $local
|
||||
*/
|
||||
public function processSite($groupID, $guidChar, $process, $local = false): void
|
||||
public function processSite($groupID, $guidChar, $process, bool $local = false): void
|
||||
{
|
||||
$res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TVDB);
|
||||
|
||||
@@ -273,7 +271,7 @@ class TVDB extends TV
|
||||
*
|
||||
* @param int $videoId -- the local Video ID
|
||||
*/
|
||||
public function getPoster($videoId): int
|
||||
public function getPoster(int $videoId): int
|
||||
{
|
||||
$ri = new ReleaseImage();
|
||||
|
||||
|
||||
@@ -49,10 +49,8 @@ class TVMaze extends TV
|
||||
/**
|
||||
* Main processing director function for scrapers
|
||||
* Calls work query function and initiates processing.
|
||||
*
|
||||
* @param bool $local
|
||||
*/
|
||||
public function processSite($groupID, $guidChar, $process, $local = false): void
|
||||
public function processSite($groupID, $guidChar, $process, bool $local = false): void
|
||||
{
|
||||
$res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TVMAZE);
|
||||
|
||||
@@ -213,10 +211,9 @@ class TVMaze extends TV
|
||||
* Returns a formatted array of show data or false if no match.
|
||||
*
|
||||
*
|
||||
* @param string $cleanName
|
||||
* @return array|false
|
||||
*/
|
||||
protected function getShowInfo($cleanName)
|
||||
protected function getShowInfo(string $cleanName)
|
||||
{
|
||||
$return = $response = false;
|
||||
|
||||
@@ -296,7 +293,7 @@ class TVMaze extends TV
|
||||
*
|
||||
* @param int $videoId -- the local Video ID
|
||||
*/
|
||||
public function getPoster($videoId): int
|
||||
public function getPoster(int $videoId): int
|
||||
{
|
||||
$ri = new ReleaseImage();
|
||||
|
||||
@@ -319,14 +316,9 @@ class TVMaze extends TV
|
||||
* Gets the specific episode info for the parsed release after match
|
||||
* Returns a formatted array of episode data or false if no match.
|
||||
*
|
||||
* @param int $tvMazeId
|
||||
* @param int $season
|
||||
* @param int $episode
|
||||
* @param string $airDate
|
||||
* @param int $videoId
|
||||
* @return array|false
|
||||
*/
|
||||
protected function getEpisodeInfo($tvMazeId, $season, $episode, $airDate = '', $videoId = 0)
|
||||
protected function getEpisodeInfo(int $tvMazeId, int $season, int $episode, string $airDate = '', int $videoId = 0)
|
||||
{
|
||||
$return = $response = false;
|
||||
|
||||
|
||||
@@ -64,10 +64,8 @@ class TraktTv extends TV
|
||||
/**
|
||||
* Main processing director function for scrapers
|
||||
* Calls work query function and initiates processing.
|
||||
*
|
||||
* @param bool $local
|
||||
*/
|
||||
public function processSite($groupID, $guidChar, $process, $local = false): void
|
||||
public function processSite($groupID, $guidChar, $process, bool $local = false): void
|
||||
{
|
||||
$res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TRAKT);
|
||||
|
||||
@@ -197,12 +195,9 @@ class TraktTv extends TV
|
||||
/**
|
||||
* Retrieve info of TV episode from site using its API.
|
||||
*
|
||||
* @param int $siteId
|
||||
* @param int $series
|
||||
* @param int $episode
|
||||
* @return array|false False on failure, an array of information fields otherwise.
|
||||
*/
|
||||
public function getEpisodeInfo($siteId, $series, $episode)
|
||||
public function getEpisodeInfo(int $siteId, int $series, int $episode)
|
||||
{
|
||||
$return = false;
|
||||
|
||||
@@ -228,7 +223,7 @@ class TraktTv extends TV
|
||||
*
|
||||
* @param int $videoId ID from videos table.
|
||||
*/
|
||||
public function getPoster($videoId): int
|
||||
public function getPoster(int $videoId): int
|
||||
{
|
||||
$hascover = 0;
|
||||
$ri = new ReleaseImage();
|
||||
|
||||
@@ -32,10 +32,9 @@ class Country
|
||||
/**
|
||||
* Get a country code for a country name.
|
||||
*
|
||||
* @param string $country
|
||||
* @return mixed
|
||||
*/
|
||||
public static function countryCode($country)
|
||||
public static function countryCode(string $country)
|
||||
{
|
||||
if (\strlen($country) > 2) {
|
||||
$code = CountryModel::whereFullName($country)->orWhere('name', $country)->first(['iso_3166_2']);
|
||||
|
||||
@@ -35,7 +35,7 @@ class InstallNntmux extends Command
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$error = false;
|
||||
|
||||
|
||||
@@ -33,10 +33,8 @@ class NntmuxDeleteUnVerifiedUsers extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$this->info('Deleting unverified users.');
|
||||
User::deleteUnVerified();
|
||||
|
||||
@@ -36,7 +36,7 @@ class NntmuxPopulateSearchIndexes extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
if ($this->option('releases') && $this->option('manticore')) {
|
||||
$this->manticoreReleases();
|
||||
@@ -143,10 +143,7 @@ class NntmuxPopulateSearchIndexes extends Command
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function elasticReleases()
|
||||
private function elasticReleases(): void
|
||||
{
|
||||
$elastic = new ElasticSearchSiteSearch();
|
||||
$total = Release::count();
|
||||
@@ -189,10 +186,7 @@ class NntmuxPopulateSearchIndexes extends Command
|
||||
$this->info('Done');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function elasticPreDB()
|
||||
private function elasticPreDB(): void
|
||||
{
|
||||
$elastic = new ElasticSearchSiteSearch();
|
||||
$total = Predb::count();
|
||||
|
||||
@@ -35,11 +35,10 @@ class NntmuxRemoveBadReleases extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
Release::query()->where('passwordstatus', '=', -2)->delete();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class NntmuxResetDb extends Command
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
if ($this->confirm('This script removes all releases, nzb files, samples, previews , nfos, truncates all article tables and resets all groups. Are you sure you want reset the DB?')) {
|
||||
$timestart = now();
|
||||
|
||||
@@ -48,10 +48,8 @@ class NntmuxResetPostProcessing extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
if (empty($this->option('category'))) {
|
||||
$qry = Release::query()->select(['id'])->get();
|
||||
|
||||
@@ -36,7 +36,7 @@ class NntmuxResetTruncate extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
UsenetGroup::query()->update(['first_record' => 0, 'first_record_postdate' => null, 'last_record' => 0, 'last_record_postdate' => null, 'last_updated' => null]);
|
||||
$this->info('Reseting all groups completed.');
|
||||
|
||||
@@ -33,10 +33,8 @@ class NntmuxUpdateExpiredRoles extends Command
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$this->info('Updating expired roles.');
|
||||
$this->info('Updating users that will have their roles expire or are already expired');
|
||||
|
||||
@@ -33,7 +33,7 @@ class TmuxUIRestart extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$this->call('tmux-ui:stop', ['--kill' => true]);
|
||||
$this->call('tmux-ui:start');
|
||||
|
||||
@@ -26,7 +26,7 @@ class TmuxUIStart extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$tmux = new Tmux();
|
||||
$tmux_session = Settings::settingValue('site.tmux.tmux_session') ?? 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ class TmuxUIStop extends Command
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$tmux = new Tmux();
|
||||
$tmux->stopIfRunning();
|
||||
|
||||
@@ -28,7 +28,7 @@ class UpdateNNTmuxDB extends Command
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
// also prevent web access.
|
||||
$this->output->writeln('<info>Updating database</info>');
|
||||
|
||||
@@ -19,10 +19,8 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->command('disposable:update')->weekly();
|
||||
$schedule->command('clean:directories')->hourly()->withoutOverlapping();
|
||||
@@ -40,10 +38,8 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
|
||||
@@ -28,10 +28,8 @@ class Handler extends ExceptionHandler
|
||||
|
||||
/**
|
||||
* Catch errors with Sentry.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
if (app()->bound('sentry')) {
|
||||
@@ -44,7 +42,6 @@ class Handler extends ExceptionHandler
|
||||
* Report or log an exception.
|
||||
*
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @return void
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
||||
@@ -25,10 +25,7 @@ namespace App\Extensions\util;
|
||||
*/
|
||||
class PhpYenc
|
||||
{
|
||||
/**
|
||||
* @param bool $ignore
|
||||
*/
|
||||
public static function decode(&$text, $ignore = false): bool|string
|
||||
public static function decode(&$text, bool $ignore = false): bool|string
|
||||
{
|
||||
$crc = '';
|
||||
// Extract the yEnc string itself.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\Release;
|
||||
use Blacklight\AniDB;
|
||||
@@ -11,7 +12,7 @@ class AdminAnidbController extends BasePageController
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(): void
|
||||
public function index(Request $request): void
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
@@ -19,8 +20,8 @@ class AdminAnidbController extends BasePageController
|
||||
$title = $meta_title = 'AniDB List';
|
||||
|
||||
$aname = '';
|
||||
if (request()->has('animetitle') && ! empty(request()->input('animetitle'))) {
|
||||
$aname = request()->input('animetitle');
|
||||
if ($request->has('animetitle') && ! empty($request->input('animetitle'))) {
|
||||
$aname = $request->input('animetitle');
|
||||
}
|
||||
|
||||
$this->smarty->assign('animetitle', $aname);
|
||||
@@ -38,36 +39,36 @@ class AdminAnidbController extends BasePageController
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(int $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
public function edit(Request $request, int $id): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
$AniDB = new AniDB();
|
||||
|
||||
// Set the current action.
|
||||
$action = request()->input('action') ?? 'view';
|
||||
$action = $request->input('action') ?? 'view';
|
||||
|
||||
switch ($action) {
|
||||
case 'submit':
|
||||
$AniDB->updateTitle(
|
||||
request()->input('anidbid'),
|
||||
request()->input('title'),
|
||||
request()->input('type'),
|
||||
request()->input('startdate'),
|
||||
request()->input('enddate'),
|
||||
request()->input('related'),
|
||||
request()->input('similar'),
|
||||
request()->input('creators'),
|
||||
request()->input('description'),
|
||||
request()->input('rating'),
|
||||
request()->input('categories'),
|
||||
request()->input('characters'),
|
||||
request()->input('epnos'),
|
||||
request()->input('airdates'),
|
||||
request()->input('episodetitles')
|
||||
$request->input('anidbid'),
|
||||
$request->input('title'),
|
||||
$request->input('type'),
|
||||
$request->input('startdate'),
|
||||
$request->input('enddate'),
|
||||
$request->input('related'),
|
||||
$request->input('similar'),
|
||||
$request->input('creators'),
|
||||
$request->input('description'),
|
||||
$request->input('rating'),
|
||||
$request->input('categories'),
|
||||
$request->input('characters'),
|
||||
$request->input('epnos'),
|
||||
$request->input('airdates'),
|
||||
$request->input('episodetitles')
|
||||
);
|
||||
|
||||
return redirect('admin/anidb-list');
|
||||
return redirect()->to('admin/anidb-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
@@ -94,13 +95,13 @@ class AdminAnidbController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(int $id): void
|
||||
public function destroy(Request $request, int $id): void
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
$success = false;
|
||||
|
||||
if (request()->has('id')) {
|
||||
if ($request->has('id')) {
|
||||
$success = Release::removeAnidbIdFromReleases($id);
|
||||
$this->smarty->assign('anidbid', $id);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class AdminBlacklistController extends BasePageController
|
||||
$binaries->updateBlacklist($request->all());
|
||||
}
|
||||
|
||||
return redirect('admin/binaryblacklist-list');
|
||||
return redirect()->to('admin/binaryblacklist-list');
|
||||
break;
|
||||
|
||||
case 'addtest':
|
||||
|
||||
@@ -67,7 +67,7 @@ class AdminBookController extends BasePageController
|
||||
$request->merge(['publishdate' => (empty($request->input('publishdate')) || ! strtotime($request->input('publishdate'))) ? $con['publishdate'] : Carbon::parse($request->input('publishdate'))->timestamp]);
|
||||
$book->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('author'), $request->input('publisher'), $request->input('publishdate'), $request->input('cover'));
|
||||
|
||||
return redirect('admin/book-list');
|
||||
return redirect()->to('admin/book-list');
|
||||
break;
|
||||
case 'view':
|
||||
default:
|
||||
|
||||
@@ -47,7 +47,7 @@ class AdminCategoryController extends BasePageController
|
||||
$request->input('maxsizetoformrelease')
|
||||
);
|
||||
|
||||
return redirect('admin/category-list');
|
||||
return redirect()->to('admin/category-list');
|
||||
break;
|
||||
case 'view':
|
||||
default:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\Category;
|
||||
use Blacklight\Regexes;
|
||||
@@ -41,7 +42,7 @@ class AdminCategoryRegexesController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
$regexes = new Regexes(['Settings' => null, 'Table_Name' => 'category_regexes']);
|
||||
@@ -83,7 +84,7 @@ class AdminCategoryRegexesController extends BasePageController
|
||||
$regexes->updateRegex($request->all());
|
||||
}
|
||||
|
||||
return redirect('admin/category_regexes-list');
|
||||
return redirect()->to('admin/category_regexes-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
|
||||
@@ -67,7 +67,7 @@ class AdminCollectionRegexesController extends BasePageController
|
||||
$regexes->updateRegex($request->all());
|
||||
}
|
||||
|
||||
return redirect('admin/collection_regexes-list');
|
||||
return redirect()->to('admin/collection_regexes-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
|
||||
@@ -69,7 +69,7 @@ class AdminConsoleController extends BasePageController
|
||||
|
||||
$console->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('salesrank'), $request->input('platform'), $request->input('publisher'), $request->input('releasedate'), $request->input('esrb'), $request->input('cover'), $request->input('genre'));
|
||||
|
||||
return redirect('admin/console-list.');
|
||||
return redirect()->to('admin/console-list.');
|
||||
break;
|
||||
case 'view':
|
||||
default:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\User;
|
||||
use Blacklight\Contents;
|
||||
@@ -32,7 +33,7 @@ class AdminContentController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
$contents = new Contents();
|
||||
@@ -117,6 +118,6 @@ class AdminContentController extends BasePageController
|
||||
|
||||
$referrer = $request->server('HTTP_REFERER');
|
||||
|
||||
return redirect($referrer);
|
||||
return redirect()->to($referrer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class AdminGameController extends BasePageController
|
||||
|
||||
$games->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('publisher'), $request->input('releasedate'), $request->input('esrb'), $request->input('cover'), $request->input('trailerurl'), $request->input('genre'));
|
||||
|
||||
return redirect('admin/game-list');
|
||||
return redirect()->to('admin/game-list');
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\UsenetGroup;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -67,7 +68,7 @@ class AdminGroupController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
@@ -100,7 +101,7 @@ class AdminGroupController extends BasePageController
|
||||
UsenetGroup::updateGroup($request->all());
|
||||
}
|
||||
|
||||
return redirect('admin/group-list');
|
||||
return redirect()->to('admin/group-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\MovieInfo;
|
||||
use App\Models\Release;
|
||||
@@ -35,7 +36,7 @@ class AdminMovieController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create(Request $request): RedirectResponse
|
||||
{
|
||||
if (! \defined('STDOUT')) {
|
||||
\define('STDOUT', fopen('php://stdout', 'wb'));
|
||||
@@ -61,13 +62,13 @@ class AdminMovieController extends BasePageController
|
||||
}
|
||||
}
|
||||
if (($request->has('update') && (int) $request->input('update') === 1)) {
|
||||
return back()->withInput();
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
return redirect('/admin/movie-list');
|
||||
return redirect()->to('/admin/movie-list');
|
||||
}
|
||||
|
||||
return redirect('/admin/movie-list');
|
||||
return redirect()->to('/admin/movie-list');
|
||||
}
|
||||
|
||||
$content = $this->smarty->fetch('movie-add.tpl');
|
||||
@@ -142,7 +143,7 @@ class AdminMovieController extends BasePageController
|
||||
Release::query()->where('imdbid', $id)->update(['movieinfo_id' => $movieInfo->id]);
|
||||
}
|
||||
|
||||
return redirect('admin/movie-list');
|
||||
return redirect()->to('admin/movie-list');
|
||||
break;
|
||||
case 'view':
|
||||
default:
|
||||
|
||||
@@ -68,7 +68,7 @@ class AdminMusicController extends BasePageController
|
||||
|
||||
$music->update($id, $request->input('title'), $request->input('asin'), $request->input('url'), $request->input('salesrank'), $request->input('artist'), $request->input('publisher'), $request->input('releasedate'), $request->input('year'), $request->input('tracks'), $request->input('cover'), $request->input('genre'));
|
||||
|
||||
return redirect('admin/music-list');
|
||||
return redirect()->to('admin/music-list');
|
||||
|
||||
break;
|
||||
case 'view':
|
||||
|
||||
@@ -69,7 +69,7 @@ class AdminReleaseNamingRegexesController extends BasePageController
|
||||
$regexes->updateRegex($request->all());
|
||||
}
|
||||
|
||||
return redirect('admin/release_naming_regexes-list');
|
||||
return redirect()->to('admin/release_naming_regexes-list');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\Category;
|
||||
use App\Models\Release;
|
||||
@@ -34,7 +35,7 @@ class AdminReleasesController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
$meta_title = $title = 'Release Edit';
|
||||
|
||||
@@ -239,6 +239,6 @@ class AdminRoleController extends BasePageController
|
||||
Role::query()->where('id', $request->input('id'))->delete();
|
||||
}
|
||||
|
||||
return redirect($request->server('HTTP_REFERER'));
|
||||
return redirect()->to($request->server('HTTP_REFERER'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class AdminSiteController extends BasePageController
|
||||
if ($error === '') {
|
||||
$site = $ret;
|
||||
|
||||
return redirect('admin/site-edit');
|
||||
return redirect()->to('admin/site-edit');
|
||||
}
|
||||
|
||||
$this->smarty->assign('error', $error);
|
||||
@@ -164,7 +164,7 @@ class AdminSiteController extends BasePageController
|
||||
|
||||
$this->smarty->assign('themelist', Utility::getThemesList());
|
||||
|
||||
if (! str_contains(env('NNTP_SERVER'), 'astra')) {
|
||||
if (! str_contains(config('settings.nntp_server'), 'astra')) {
|
||||
$this->smarty->assign('compress_headers_warning', 'compress_headers_warning');
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class AdminSiteController extends BasePageController
|
||||
$usersbymonth = User::getUsersByMonth();
|
||||
$this->smarty->assign('usersbymonth', $usersbymonth);
|
||||
|
||||
$usersbyrole = Role::query()->select(['name'])->withCount('users')->groupBy('name')->having('users_count', '>', 0)->orderBy('users_count', 'desc')->get();
|
||||
$usersbyrole = Role::query()->select(['name'])->withCount('users')->groupBy('name')->having('users_count', '>', 0)->orderByDesc('users_count')->get();
|
||||
$this->smarty->assign('usersbyrole', $usersbyrole);
|
||||
$this->smarty->assign('totusers', 0);
|
||||
$this->smarty->assign('totrusers', 0);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Jobs\SendAccountChangedEmail;
|
||||
use App\Models\Invitation;
|
||||
@@ -29,7 +30,7 @@ class AdminUserController extends BasePageController
|
||||
|
||||
$ordering = getUserBrowseOrdering();
|
||||
$orderBy = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
|
||||
$variables = [
|
||||
@@ -50,7 +51,7 @@ class AdminUserController extends BasePageController
|
||||
true
|
||||
);
|
||||
|
||||
$results = $this->paginate($rslt ?? [], User::getCount($variables['role'], $variables['username'], $variables['host'], $variables['email']) ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], User::getCount($variables['role'], $variables['username'], $variables['host'], $variables['email']) ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
@@ -79,7 +80,7 @@ class AdminUserController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
@@ -152,7 +153,7 @@ class AdminUserController extends BasePageController
|
||||
}
|
||||
|
||||
if ($ret >= 0) {
|
||||
return redirect('admin/user-list');
|
||||
return redirect()->to('admin/user-list');
|
||||
}
|
||||
|
||||
switch ($ret) {
|
||||
@@ -218,14 +219,14 @@ class AdminUserController extends BasePageController
|
||||
|
||||
$user->delete();
|
||||
|
||||
return redirect('admin/user-list');
|
||||
return redirect()->to('admin/user-list');
|
||||
}
|
||||
|
||||
if ($request->has('redir')) {
|
||||
return redirect($request->input('redir'));
|
||||
return redirect()->to($request->input('redir'));
|
||||
}
|
||||
|
||||
return redirect($request->server('HTTP_REFERER'));
|
||||
return redirect()->to($request->server('HTTP_REFERER'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -399,16 +399,16 @@ class ApiController extends BasePageController
|
||||
*
|
||||
* @return int $maxAge The maximum age of the release
|
||||
*/
|
||||
public function maxAge(): int
|
||||
public function maxAge(Request $request): int
|
||||
{
|
||||
$maxAge = -1;
|
||||
if (request()->has('maxage')) {
|
||||
if (! request()->filled('maxage')) {
|
||||
if ($request->has('maxage')) {
|
||||
if (! $request->filled('maxage')) {
|
||||
Utility::showApiError(201, 'Incorrect parameter (maxage must not be empty)');
|
||||
} elseif (! is_numeric(request()->input('maxage'))) {
|
||||
} elseif (! is_numeric($request->input('maxage'))) {
|
||||
Utility::showApiError(201, 'Incorrect parameter (maxage must be numeric)');
|
||||
} else {
|
||||
$maxAge = (int) request()->input('maxage');
|
||||
$maxAge = (int) $request->input('maxage');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,11 +418,11 @@ class ApiController extends BasePageController
|
||||
/**
|
||||
* Verify cat parameter.
|
||||
*/
|
||||
public function categoryID(): array
|
||||
public function categoryID(Request $request): array
|
||||
{
|
||||
$categoryID[] = -1;
|
||||
if (request()->has('cat')) {
|
||||
$categoryIDs = urldecode(request()->input('cat'));
|
||||
if ($request->has('cat')) {
|
||||
$categoryIDs = urldecode($request->input('cat'));
|
||||
// Append Web-DL category ID if HD present for SickBeard / Sonarr compatibility.
|
||||
if (str_contains($categoryIDs, (string) Category::TV_HD) && ! str_contains($categoryIDs, (string) Category::TV_WEBDL) && (int) Settings::settingValue('indexer.categorise.catwebdl') === 0) {
|
||||
$categoryIDs .= (','.Category::TV_WEBDL);
|
||||
@@ -439,11 +439,11 @@ class ApiController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function group(): string|int|bool
|
||||
public function group(Request $request): string|int|bool
|
||||
{
|
||||
$groupName = -1;
|
||||
if (request()->has('group')) {
|
||||
$group = UsenetGroup::isValidGroup(request()->input('group'));
|
||||
if ($request->has('group')) {
|
||||
$group = UsenetGroup::isValidGroup($request->input('group'));
|
||||
if ($group !== false) {
|
||||
$groupName = $group;
|
||||
}
|
||||
@@ -455,11 +455,11 @@ class ApiController extends BasePageController
|
||||
/**
|
||||
* Verify limit parameter.
|
||||
*/
|
||||
public function limit(): int
|
||||
public function limit(Request $request): int
|
||||
{
|
||||
$limit = 100;
|
||||
if (request()->has('limit') && is_numeric(request()->input('limit'))) {
|
||||
$limit = (int) request()->input('limit');
|
||||
if ($request->has('limit') && is_numeric($request->input('limit'))) {
|
||||
$limit = (int) $request->input('limit');
|
||||
}
|
||||
|
||||
return $limit;
|
||||
@@ -468,11 +468,11 @@ class ApiController extends BasePageController
|
||||
/**
|
||||
* Verify offset parameter.
|
||||
*/
|
||||
public function offset(): int
|
||||
public function offset(Request $request): int
|
||||
{
|
||||
$offset = 0;
|
||||
if (request()->has('offset') && is_numeric(request()->input('offset'))) {
|
||||
$offset = (int) request()->input('offset');
|
||||
if ($request->has('offset') && is_numeric($request->input('offset'))) {
|
||||
$offset = (int) $request->input('offset');
|
||||
}
|
||||
|
||||
return $offset;
|
||||
@@ -481,9 +481,9 @@ class ApiController extends BasePageController
|
||||
/**
|
||||
* Check if a parameter is empty.
|
||||
*/
|
||||
public function verifyEmptyParameter(string $parameter): void
|
||||
public function verifyEmptyParameter(Request $request, string $parameter): void
|
||||
{
|
||||
if (request()->has($parameter) && request()->isNotFilled($parameter)) {
|
||||
if ($request->has($parameter) && $request->isNotFilled($parameter)) {
|
||||
Utility::showApiError(201, 'Incorrect parameter ('.$parameter.' must not be empty)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Events\UserAccessedApi;
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\Category;
|
||||
@@ -245,7 +246,7 @@ class ApiV2Controller extends BasePageController
|
||||
/**
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void
|
||||
*/
|
||||
public function getNzb(Request $request)
|
||||
public function getNzb(Request $request): RedirectResponse
|
||||
{
|
||||
$user = User::query()->where('api_token', $request->input('api_token'))->first();
|
||||
event(new UserAccessedApi($user));
|
||||
|
||||
@@ -213,7 +213,7 @@ class RSS extends ApiController
|
||||
return DB::table($table)
|
||||
->select([$column])
|
||||
->where($column, '>', 0)
|
||||
->orderBy($order, 'asc')
|
||||
->orderBy($order)
|
||||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Requests\Auth\ShowLinkRequestFormForgotPasswordRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\SendPasswordForgottenEmail;
|
||||
use App\Models\Settings;
|
||||
@@ -38,18 +39,15 @@ class ForgotPasswordController extends Controller
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function showLinkRequestForm(Request $request): void
|
||||
public function showLinkRequestForm(ShowLinkRequestFormForgotPasswordRequest $request): void
|
||||
{
|
||||
$sent = '';
|
||||
$email = request()->input('email') ?? '';
|
||||
$rssToken = request()->input('apikey') ?? '';
|
||||
$email = $request->input('email') ?? '';
|
||||
$rssToken = $request->input('apikey') ?? '';
|
||||
if (empty($email) && empty($rssToken)) {
|
||||
app('smarty.view')->assign('error', 'Missing parameter(email and/or apikey to send password reset');
|
||||
} else {
|
||||
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
|
||||
$this->validate($request, [
|
||||
'g-recaptcha-response' => 'required|captcha',
|
||||
]);
|
||||
}
|
||||
//
|
||||
// Check users exists and send an email
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Requests\Auth\LoginLoginRequest;
|
||||
use App\Events\UserLoggedIn;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Settings;
|
||||
@@ -48,12 +50,11 @@ class LoginController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|null
|
||||
*
|
||||
* @throws \Illuminate\Auth\AuthenticationException
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function login(Request $request)
|
||||
public function login(LoginLoginRequest $request): RedirectResponse
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'username' => ['required'],
|
||||
@@ -68,7 +69,7 @@ class LoginController extends Controller
|
||||
|
||||
if ($this->hasTooManyLoginAttempts($request)) {
|
||||
$this->fireLockoutEvent($request);
|
||||
Session::flash('message', 'You have failed to login too many times.Try again in '.$this->decayMinutes().' minutes.');
|
||||
$request->session()->flash('message', 'You have failed to login too many times.Try again in '.$this->decayMinutes().' minutes.');
|
||||
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
@@ -81,21 +82,18 @@ class LoginController extends Controller
|
||||
|
||||
if ($user !== null) {
|
||||
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
|
||||
$this->validate($request, [
|
||||
'g-recaptcha-response' => ['required', 'captcha'],
|
||||
]);
|
||||
}
|
||||
|
||||
$rememberMe = $request->has('rememberme') && $request->input('rememberme') === 'on';
|
||||
|
||||
if (! $user->isVerified() || $user->isPendingVerification()) {
|
||||
Session::flash('message', 'You have not verified your email address!');
|
||||
$request->session()->flash('message', 'You have not verified your email address!');
|
||||
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
if (Auth::attempt($request->only($login_type, 'password'), $rememberMe)) {
|
||||
$userIp = (int) Settings::settingValue('..storeuserips') === 1 ? (request()->ip() ?? request()->getClientIp()) : '';
|
||||
$userIp = (int) Settings::settingValue('..storeuserips') === 1 ? ($request->ip() ?? $request->getClientIp()) : '';
|
||||
event(new UserLoggedIn($user, $userIp));
|
||||
|
||||
Auth::logoutOtherDevices($request->input('password'));
|
||||
@@ -105,17 +103,17 @@ class LoginController extends Controller
|
||||
}
|
||||
|
||||
$this->incrementLoginAttempts($request);
|
||||
Session::flash('message', 'Username or email and password combination used does not match our records!');
|
||||
$request->session()->flash('message', 'Username or email and password combination used does not match our records!');
|
||||
} else {
|
||||
$this->incrementLoginAttempts($request);
|
||||
Session::flash('message', 'Username or email used do not match our records!');
|
||||
$request->session()->flash('message', 'Username or email used do not match our records!');
|
||||
}
|
||||
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
|
||||
$this->incrementLoginAttempts($request);
|
||||
Session::flash('message', implode('', Arr::collapse($validator->errors()->toArray())));
|
||||
$request->session()->flash('message', implode('', Arr::collapse($validator->errors()->toArray())));
|
||||
|
||||
return $this->showLoginForm();
|
||||
}
|
||||
@@ -139,6 +137,6 @@ class LoginController extends Controller
|
||||
$request->session()->flush();
|
||||
$request->session()->regenerate();
|
||||
|
||||
return redirect('login')->with('message', 'You have been logged out successfully');
|
||||
return redirect()->to('login')->with('message', 'You have been logged out successfully');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Requests\Auth\RegisterRegisterRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Invitation;
|
||||
use App\Models\Settings;
|
||||
@@ -112,7 +113,7 @@ class RegisterController extends Controller
|
||||
*
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function register(Request $request)
|
||||
public function register(RegisterRegisterRequest $request)
|
||||
{
|
||||
$error = $userName = $password = $confirmPassword = $email = $inviteCode = '';
|
||||
$showRegister = 1;
|
||||
@@ -129,9 +130,6 @@ class RegisterController extends Controller
|
||||
]);
|
||||
|
||||
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
|
||||
$this->validate($request, [
|
||||
'g-recaptcha-response' => ['required', 'captcha'],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($validator->fails()) {
|
||||
@@ -170,7 +168,7 @@ class RegisterController extends Controller
|
||||
);
|
||||
Invite::consume($inviteCode);
|
||||
|
||||
return $this->registered($request, $user) ?: redirect($this->redirectPath())->with('info', 'Your Account has been created. You will receive a separate verification email shortly.');
|
||||
return $this->registered($request, $user) ?: redirect()->to($this->redirectPath())->with('info', 'Your Account has been created. You will receive a separate verification email shortly.');
|
||||
}
|
||||
break;
|
||||
case 'view':
|
||||
@@ -234,7 +232,7 @@ class RegisterController extends Controller
|
||||
app('smarty.view')->assign('invite_code_query', $this->inviteCodeQuery);
|
||||
$theme = Settings::settingValue('site.main.style');
|
||||
|
||||
$nocaptcha = env('NOCAPTCHA_ENABLED');
|
||||
$nocaptcha = config('settings.nocaptcha_enabled');
|
||||
|
||||
$meta_title = 'Register';
|
||||
$meta_keywords = 'register,signup,registration';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Events\UserLoggedIn;
|
||||
use App\Models\Category;
|
||||
use App\Models\Forumpost;
|
||||
@@ -107,9 +109,9 @@ class BasePageController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function isPostBack(): bool
|
||||
public function isPostBack(Request $request): bool
|
||||
{
|
||||
return \request()->isMethod('POST');
|
||||
return $request->isMethod('POST');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +119,7 @@ class BasePageController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show404($message = null)
|
||||
public function show404($message = null): View
|
||||
{
|
||||
if ($message !== null) {
|
||||
return view('errors.404')->with('Message', $message);
|
||||
@@ -129,7 +131,7 @@ class BasePageController extends Controller
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show403()
|
||||
public function show403(): View
|
||||
{
|
||||
return view('errors.403');
|
||||
}
|
||||
@@ -137,7 +139,7 @@ class BasePageController extends Controller
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show503()
|
||||
public function show503(): View
|
||||
{
|
||||
return view('errors.503')->with('Error', 'Service temporarily unavailable');
|
||||
}
|
||||
@@ -145,7 +147,7 @@ class BasePageController extends Controller
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function showBadBoy()
|
||||
public function showBadBoy(): View
|
||||
{
|
||||
return view('errors.badboy')->with('Message', 'This is not you account.');
|
||||
}
|
||||
@@ -153,7 +155,7 @@ class BasePageController extends Controller
|
||||
/**
|
||||
* Show maintenance page.
|
||||
*/
|
||||
public function showMaintenance()
|
||||
public function showMaintenance(): View
|
||||
{
|
||||
return view('errors.maintenance')->with('Message', 'We are performing an site maintenance.');
|
||||
}
|
||||
@@ -161,15 +163,12 @@ class BasePageController extends Controller
|
||||
/**
|
||||
* Show Security token mismatch page.
|
||||
*/
|
||||
public function showTokenError()
|
||||
public function showTokenError(): View
|
||||
{
|
||||
return view('errors.tokenError')->with('Error', 'Token mismatch');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $retry
|
||||
*/
|
||||
public function show429($retry = '')
|
||||
public function show429(string $retry = '')
|
||||
{
|
||||
abort(429, $retry);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class BrowseController extends BasePageController
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->setPreferences();
|
||||
$releases = new Releases();
|
||||
@@ -20,12 +20,12 @@ class BrowseController extends BasePageController
|
||||
$this->smarty->assign('category', -1);
|
||||
|
||||
$ordering = $releases->getBrowseOrdering();
|
||||
$orderBy = request()->has('ob') && ! empty(request()->input('ob')) ? request()->input('ob') : '';
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : '';
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), $orderBy, -1, $this->userdata->categoryexclusions, -1);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$this->smarty->assign('catname', 'All');
|
||||
|
||||
@@ -59,7 +59,7 @@ class BrowseController extends BasePageController
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show(string $parentCategory, string $id = 'All'): void
|
||||
public function show(Request $request, string $parentCategory, string $id = 'All'): void
|
||||
{
|
||||
$this->setPreferences();
|
||||
$releases = new Releases();
|
||||
@@ -83,12 +83,12 @@ class BrowseController extends BasePageController
|
||||
$this->smarty->assign('category', $category);
|
||||
|
||||
$ordering = $releases->getBrowseOrdering();
|
||||
$orderBy = request()->has('ob') && ! empty(request()->input('ob')) ? request()->input('ob') : '';
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$orderBy = $request->has('ob') && ! empty($request->input('ob')) ? $request->input('ob') : '';
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
|
||||
$rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderBy, -1, $this->userdata->categoryexclusions, $grp);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$browse = [];
|
||||
|
||||
@@ -159,10 +159,10 @@ class BrowseController extends BasePageController
|
||||
$releases = new Releases();
|
||||
if ($request->has('g')) {
|
||||
$group = $request->input('g');
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata->categoryexclusions, $group);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$browse = [];
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ class BtcPaymentController extends BasePageController
|
||||
public function show(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
$gateway_id = env('MYCELIUM_GATEWAY_ID');
|
||||
$gateway_secret = env('MYCELIUM_GATEWAY_SECRET');
|
||||
$gateway_id = config('settings.mycelium_gateway_id');
|
||||
$gateway_secret = config('settings.mycelium_gateway_secret');
|
||||
|
||||
$action = $request->input('action') ?? 'view';
|
||||
$donation = Role::query()->where('donation', '>', 0)->get(['id', 'name', 'donation', 'addyears']);
|
||||
@@ -39,7 +39,7 @@ class BtcPaymentController extends BasePageController
|
||||
// Redirect to a payment gateway
|
||||
$url = 'https://gateway.gear.mycelium.com/pay/'.$order->payment_id;
|
||||
|
||||
return redirect($url);
|
||||
return redirect()->to($url);
|
||||
}
|
||||
break;
|
||||
case 'view':
|
||||
@@ -63,8 +63,8 @@ class BtcPaymentController extends BasePageController
|
||||
*/
|
||||
public function callback(): void
|
||||
{
|
||||
$gateway_id = env('MYCELIUM_GATEWAY_ID');
|
||||
$gateway_secret = env('MYCELIUM_GATEWAY_SECRET');
|
||||
$gateway_id = config('settings.mycelium_gateway_id');
|
||||
$gateway_secret = config('settings.mycelium_gateway_secret');
|
||||
|
||||
$geary = new Geary($gateway_id, $gateway_secret);
|
||||
$order = $geary->check_order_callback();
|
||||
|
||||
@@ -38,7 +38,7 @@ class CartController extends BasePageController
|
||||
$data = Release::query()->whereIn('guid', $guids)->select(['id'])->get();
|
||||
|
||||
if (empty($data)) {
|
||||
return redirect('/cart/index');
|
||||
return redirect()->to('/cart/index');
|
||||
}
|
||||
|
||||
foreach ($data as $d) {
|
||||
@@ -48,7 +48,7 @@ class CartController extends BasePageController
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('/cart/index');
|
||||
return redirect()->to('/cart/index');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,13 +65,13 @@ class CartController extends BasePageController
|
||||
}
|
||||
|
||||
if (! empty($ids) && UsersRelease::delCartByGuid($ids, $this->userdata->id)) {
|
||||
return redirect('/cart/index');
|
||||
return redirect()->to('/cart/index');
|
||||
}
|
||||
|
||||
if (! $id) {
|
||||
return redirect('/cart/index');
|
||||
return redirect()->to('/cart/index');
|
||||
}
|
||||
|
||||
return redirect('/cart/index');
|
||||
return redirect()->to('/cart/index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\ContactContactURequest;
|
||||
use App\Jobs\SendContactUsEmail;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -10,13 +11,9 @@ class ContactUsController extends BasePageController
|
||||
/**
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function contact(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null
|
||||
public function contact(ContactContactURequest $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|null
|
||||
{
|
||||
$this->setPreferences();
|
||||
$this->validate($request, [
|
||||
'useremail' => 'required',
|
||||
'username' => 'required',
|
||||
]);
|
||||
|
||||
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
|
||||
$this->validate($request, [
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Blacklight\Contents;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -12,7 +13,7 @@ class ContentController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show(Request $request)
|
||||
public function show(Request $request): JsonResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
$contents = new Contents();
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\DnzbFailure;
|
||||
use App\Models\Predb;
|
||||
use App\Models\Release;
|
||||
@@ -29,7 +31,7 @@ class DetailsController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show(string $guid)
|
||||
public function show(Request $request, string $guid): RedirectResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
|
||||
@@ -49,7 +51,7 @@ class DetailsController extends BasePageController
|
||||
}
|
||||
|
||||
if ($this->isPostBack()) {
|
||||
ReleaseComment::addComment($data['id'], $data['gid'], \request()->input('txtAddComment'), $this->userdata->id, \request()->ip());
|
||||
ReleaseComment::addComment($data['id'], $data['gid'], $request->input('txtAddComment'), $this->userdata->id, $request->ip());
|
||||
}
|
||||
|
||||
$nfo = ReleaseNfo::getReleaseNfo($data['id']);
|
||||
|
||||
@@ -14,12 +14,12 @@ class FailedReleasesController extends BasePageController
|
||||
public function failed(Request $request): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Http\Response
|
||||
{
|
||||
if ($request->missing('api_token')) {
|
||||
return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => 400, 'X-DNZB-RText' => 'Bad request, please supply all parameters!']);
|
||||
return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Bad request, please supply all parameters!']);
|
||||
}
|
||||
|
||||
$res = User::getByRssToken($request->input('api_token'));
|
||||
if ($res === null) {
|
||||
return response('Unauthorised, wrong rss key!', 401)->withHeaders(['X-DNZB-RCode' => 401, 'X-DNZB-RText' => 'Unauthorised, wrong rss key!']);
|
||||
return response('Unauthorised, wrong rss key!', 401)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Unauthorised, wrong rss key!']);
|
||||
}
|
||||
|
||||
$uid = $res['id'];
|
||||
@@ -29,12 +29,12 @@ class FailedReleasesController extends BasePageController
|
||||
$alt = Release::getAlternate($request->input('guid'), $uid);
|
||||
|
||||
if (empty($alt)) {
|
||||
return response('No NZB found for alternate match!', 404)->withHeaders(['X-DNZB-RCode' => 404, 'X-DNZB-RText' => 'No NZB found for alternate match.']);
|
||||
return response('No NZB found for alternate match!', 404)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'No NZB found for alternate match.']);
|
||||
}
|
||||
|
||||
return response('Success', 200)->withHeaders(['Location' => url('/').'/getnzb?id='.$alt['guid'].'&r='.$rssToken]);
|
||||
return response('Success')->withHeaders(['Location' => url('/').'/getnzb?id='.$alt['guid'].'&r='.$rssToken]);
|
||||
}
|
||||
|
||||
return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => 400, 'X-DNZB-RText' => 'Bad request, please supply all parameters!']);
|
||||
return response('Bad request, please supply all parameters!', 400)->withHeaders(['X-DNZB-RCode' => , 'X-DNZB-RText' => 'Bad request, please supply all parameters!']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Models\Forumpost;
|
||||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -14,13 +15,13 @@ class ForumController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function forum(Request $request)
|
||||
public function forum(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
if ($this->isPostBack() && $request->has('addMessage') && $request->has('addSubject')) {
|
||||
Forumpost::add(0, $this->userdata->id, $request->input('addSubject'), $request->input('addMessage'));
|
||||
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
$lock = $unlock = null;
|
||||
@@ -36,13 +37,13 @@ class ForumController extends BasePageController
|
||||
if ($lock !== null) {
|
||||
Forumpost::lockUnlockTopic($lock, 1);
|
||||
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
if ($unlock !== null) {
|
||||
Forumpost::lockUnlockTopic($unlock, 0);
|
||||
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
$results = Forumpost::getBrowseRange();
|
||||
@@ -68,7 +69,7 @@ class ForumController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getPosts($id, Request $request)
|
||||
public function getPosts($id, Request $request): RedirectResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
|
||||
@@ -80,7 +81,7 @@ class ForumController extends BasePageController
|
||||
|
||||
$results = Forumpost::getPosts($id);
|
||||
if (\count($results) === 0) {
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
$meta_title = 'Forum Post';
|
||||
@@ -110,10 +111,10 @@ class ForumController extends BasePageController
|
||||
if ($id !== null) {
|
||||
Forumpost::deleteParent($id);
|
||||
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
return redirect('forum');
|
||||
return redirect()->to('forum');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ class GamesController extends BasePageController
|
||||
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$ordering = $games->getGamesOrdering();
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
$rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
|
||||
@@ -24,7 +24,7 @@ class GetNzbController extends BasePageController
|
||||
$this->setPreferences();
|
||||
|
||||
// Page is accessible only by the rss token, or logged in users.
|
||||
if (Auth::check()) {
|
||||
if ($request->user()) {
|
||||
$uid = $this->userdata->id;
|
||||
$maxDownloads = $this->userdata->role->downloadrequests;
|
||||
$rssToken = $this->userdata->api_token;
|
||||
|
||||
@@ -51,7 +51,7 @@ class MovieController extends BasePageController
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
|
||||
$ordering = $movie->getMovieOrdering();
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
|
||||
$movies = [];
|
||||
$rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata->categoryexclusions);
|
||||
|
||||
@@ -48,7 +48,7 @@ class MusicController extends BasePageController
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
$ordering = $music->getMusicOrdering();
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
|
||||
$musics = [];
|
||||
$rslt = $music->getMusicRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata->categoryexclusions);
|
||||
|
||||
@@ -32,13 +32,13 @@ class MyMoviesController extends BasePageController
|
||||
case 'delete':
|
||||
$movie = UserMovie::getMovie($this->userdata->id, $imdbid);
|
||||
if (! $movie) {
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
UserMovie::delMovie($this->userdata->id, $imdbid);
|
||||
if ($request->has('from')) {
|
||||
header('Location:'.url($request->input('from')));
|
||||
} else {
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -46,22 +46,22 @@ class MyMoviesController extends BasePageController
|
||||
case 'doadd':
|
||||
$movie = UserMovie::getMovie($this->userdata->id, $imdbid);
|
||||
if ($movie) {
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
|
||||
$movie = $mv->getMovieInfo($imdbid);
|
||||
if (! $movie) {
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
|
||||
if ($action === 'doadd') {
|
||||
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
|
||||
UserMovie::addMovie($this->userdata->id, $imdbid, $category);
|
||||
if ($request->has('from')) {
|
||||
return redirect($request->input('from'));
|
||||
return redirect()->to($request->input('from'));
|
||||
}
|
||||
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
|
||||
$tmpcats = Category::getChildren(Category::MOVIE_ROOT);
|
||||
@@ -88,17 +88,17 @@ class MyMoviesController extends BasePageController
|
||||
$movie = UserMovie::getMovie($this->userdata->id, $imdbid);
|
||||
|
||||
if (! $movie) {
|
||||
return redirect('/mymovies');
|
||||
return redirect()->to('/mymovies');
|
||||
}
|
||||
|
||||
if ($action === 'doedit') {
|
||||
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
|
||||
UserMovie::updateMovie($this->userdata->id, $imdbid, $category);
|
||||
if ($request->has('from')) {
|
||||
return redirect($request->input('from'));
|
||||
return redirect()->to($request->input('from'));
|
||||
}
|
||||
|
||||
return redirect('mymovies');
|
||||
return redirect()->to('mymovies');
|
||||
}
|
||||
|
||||
$tmpcats = Category::getChildren(Category::MOVIE_ROOT);
|
||||
|
||||
@@ -37,7 +37,7 @@ class MyShowsController extends BasePageController
|
||||
if ($request->has('from')) {
|
||||
header('Location:'.url($request->input('from')));
|
||||
} else {
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -45,22 +45,22 @@ class MyShowsController extends BasePageController
|
||||
case 'doadd':
|
||||
$show = UserSerie::getShow($this->userdata->id, $videoId);
|
||||
if ($show) {
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
$show = Video::getByVideoID($videoId);
|
||||
if (! $show) {
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
if ($action === 'doadd') {
|
||||
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
|
||||
UserSerie::addShow($this->userdata->id, $videoId, $category);
|
||||
if ($request->has('from')) {
|
||||
return redirect($request->input('from'));
|
||||
return redirect()->to($request->input('from'));
|
||||
}
|
||||
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
$tmpcats = Category::getChildren(Category::TV_ROOT);
|
||||
@@ -89,17 +89,17 @@ class MyShowsController extends BasePageController
|
||||
$show = UserSerie::getShow($this->userdata->id, $videoId);
|
||||
|
||||
if (! $show) {
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
if ($action === 'doedit') {
|
||||
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
|
||||
UserSerie::updateShow($this->userdata->id, $videoId, $category);
|
||||
if ($request->has('from')) {
|
||||
return redirect($request->input('from'));
|
||||
return redirect()->to($request->input('from'));
|
||||
}
|
||||
|
||||
return redirect('myshows');
|
||||
return redirect()->to('myshows');
|
||||
}
|
||||
|
||||
$tmpcats = Category::getChildren(Category::TV_ROOT);
|
||||
@@ -175,14 +175,14 @@ class MyShowsController extends BasePageController
|
||||
|
||||
$releases = new Releases();
|
||||
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
$ordering = $releases->getBrowseOrdering();
|
||||
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
$browseCount = $releases->getShowsCount($shows, -1, $this->userdata->categoryexclusions);
|
||||
|
||||
$rslt = $releases->getShowsRange($shows ?? [], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $browseCount, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $browseCount, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$this->smarty->assign('covgroup', '');
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\Disable2faPasswordSecurityRequest;
|
||||
use App\Models\PasswordSecurity;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -11,7 +12,7 @@ class PasswordSecurityController extends Controller
|
||||
{
|
||||
public function show2faForm(Request $request): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = $request->user();
|
||||
|
||||
$google2fa_url = '';
|
||||
if ($user->passwordSecurity()->exists()) {
|
||||
@@ -36,7 +37,7 @@ class PasswordSecurityController extends Controller
|
||||
*/
|
||||
public function generate2faSecret(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = $request->user();
|
||||
|
||||
// Add the secret key to the registration data
|
||||
PasswordSecurity::create(
|
||||
@@ -47,7 +48,7 @@ class PasswordSecurityController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
return redirect('2fa')->with('success', 'Secret Key is generated, Please verify Code to Enable 2FA');
|
||||
return redirect()->to('2fa')->with('success', 'Secret Key is generated, Please verify Code to Enable 2FA');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,33 +58,31 @@ class PasswordSecurityController extends Controller
|
||||
*/
|
||||
public function enable2fa(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = $request->user();
|
||||
$secret = $request->input('verify-code');
|
||||
$valid = \Google2FA::verifyKey($user->passwordSecurity->google2fa_secret, $secret);
|
||||
if ($valid) {
|
||||
$user->passwordSecurity->google2fa_enable = 1;
|
||||
$user->passwordSecurity->save();
|
||||
|
||||
return redirect('2fa')->with('success', '2FA is Enabled Successfully.');
|
||||
return redirect()->to('2fa')->with('success', '2FA is Enabled Successfully.');
|
||||
}
|
||||
|
||||
return redirect('2fa')->with('error', 'Invalid Verification Code, Please try again.');
|
||||
return redirect()->to('2fa')->with('error', 'Invalid Verification Code, Please try again.');
|
||||
}
|
||||
|
||||
public function disable2fa(Request $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application
|
||||
public function disable2fa(Disable2faPasswordSecurityRequest $request): \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application
|
||||
{
|
||||
if (! (Hash::check($request->get('current-password'), Auth::user()->password))) {
|
||||
if (! (Hash::check($request->get('current-password'), $request->user()->password))) {
|
||||
// The passwords matches
|
||||
return redirect()->back()->with('error', 'Your password does not match with your account password. Please try again.');
|
||||
}
|
||||
|
||||
$validatedData = $request->validate([
|
||||
'current-password' => 'required',
|
||||
]);
|
||||
$user = Auth::user();
|
||||
$validatedData = $request->validated();
|
||||
$user = $request->user();
|
||||
$user->passwordSecurity->google2fa_enable = 0;
|
||||
$user->passwordSecurity->save();
|
||||
|
||||
return redirect('2fa')->with('success', '2FA is now Disabled.');
|
||||
return redirect()->to('2fa')->with('success', '2FA is now Disabled.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Jobs\SendAccountDeletedEmail;
|
||||
use App\Models\ReleaseComment;
|
||||
use App\Models\Settings;
|
||||
@@ -103,7 +104,7 @@ class ProfileController extends BasePageController
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
public function edit(Request $request): RedirectResponse
|
||||
{
|
||||
$this->setPreferences();
|
||||
|
||||
@@ -120,9 +121,9 @@ class ProfileController extends BasePageController
|
||||
case 'newapikey':
|
||||
User::updateRssKey($userid);
|
||||
|
||||
return redirect('profile');
|
||||
return redirect()->to('profile');
|
||||
case 'clearcookies':
|
||||
return redirect('profileedit');
|
||||
return redirect()->to('profileedit');
|
||||
case 'submit':
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => ['nullable', 'string', 'email', 'max:255', 'unique:users', 'indisposable'],
|
||||
@@ -229,11 +230,11 @@ class ProfileController extends BasePageController
|
||||
|
||||
Auth::logout();
|
||||
|
||||
return redirect('login')->with('info', 'You will be able to login after you verify your new email address');
|
||||
return redirect()->to('login')->with('info', 'You will be able to login after you verify your new email address');
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('profile')->with('success', 'Profile changes saved');
|
||||
return redirect()->to('profile')->with('success', 'Profile changes saved');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -279,7 +280,7 @@ class ProfileController extends BasePageController
|
||||
}
|
||||
|
||||
if ($this->userdata->hasRole('Admin')) {
|
||||
return redirect('profile');
|
||||
return redirect()->to('profile');
|
||||
}
|
||||
|
||||
return view('errors.badboy')->with('warning', 'Dont try to delete another user account!');
|
||||
|
||||
@@ -81,7 +81,7 @@ class SearchController extends BasePageController
|
||||
'basic',
|
||||
$categoryID);
|
||||
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
@@ -155,7 +155,7 @@ class SearchController extends BasePageController
|
||||
[$searchVars['searchadvcat'] === '' ? -1 : $searchVars['searchadvcat']]
|
||||
);
|
||||
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalrows ?? 0, config('nntmux.items_per_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
protected function redirectTo(Request $request): string
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -10,14 +12,12 @@ class ClearanceMiddleware
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$user = Auth::user();
|
||||
$user = $request->user();
|
||||
|
||||
if ($user->hasAnyRole(['Admin', 'Moderator']) && ! $request->is(['Admin', 'Admin/*'])) {
|
||||
return $next($request);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Support\Google2FAAuthenticator;
|
||||
use Closure;
|
||||
|
||||
@@ -9,11 +11,8 @@ class Google2FAMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$authenticator = app(Google2FAAuthenticator::class)->boot($request);
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -9,15 +11,11 @@ class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
public function handle(Request $request, Closure $next, ?string $guard = null): Response
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/');
|
||||
return redirect()->to('/');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginLoginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'g-recaptcha-response' => [
|
||||
'required',
|
||||
'captcha',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RegisterRegisterRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'g-recaptcha-response' => [
|
||||
'required',
|
||||
'captcha',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowLinkRequestFormForgotPasswordRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return ['g-recaptcha-response' => [
|
||||
'required',
|
||||
'captcha',
|
||||
],];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ContactContactURequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return ['g-recaptcha-response' => [
|
||||
'required',
|
||||
'captcha',
|
||||
],];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Disable2faPasswordSecurityRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return ['current-password' => [
|
||||
'required',
|
||||
],];
|
||||
}
|
||||
}
|
||||
@@ -25,10 +25,8 @@ class RemoveInactiveAccounts implements ShouldQueue
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
User::query()->where('lastlogin', '<', now()->subMonths(6))->where('apiaccess', '<', now()->subMonths(6))->where('roles_id', '=', 1)->delete();
|
||||
User::query()->where('lastlogin', '<', now()->subMonths(6))->whereNull('apiaccess')->where('roles_id', '=', 1)->delete();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Mail\AccountChange;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@@ -21,20 +22,16 @@ class SendAccountChangedEmail implements ShouldQueue
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*/
|
||||
public function __construct($user)
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
Mail::to($this->user->email)->send(new AccountChange($this->user));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Mail\AccountDeleted;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@@ -21,20 +22,16 @@ class SendAccountDeletedEmail implements ShouldQueue
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*/
|
||||
public function __construct($user)
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
Mail::to(config('mail.from.address'))->send(new AccountDeleted($this->user));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user