Skip to content

Commit

Permalink
Merge pull request #118 from UNIT3D/shift-5844
Browse files Browse the repository at this point in the history
Shift UNIT3D to Laravel 5.5
Tested and Working
  • Loading branch information
HDVinnie committed Jan 18, 2018
2 parents 72efd85 + 5f1fe24 commit 21e47ab
Show file tree
Hide file tree
Showing 150 changed files with 2,281 additions and 1,908 deletions.
2 changes: 0 additions & 2 deletions app/Achievements/UserMadeTenComments.php
Expand Up @@ -36,14 +36,12 @@ class UserMadeTenComments extends Achievement
*/
public function whenProgress($progress)
{

}

/*
* Triggers whenever an Achiever unlocks this achievement
*/
public function whenUnlocked($progress)
{

}
}
3 changes: 0 additions & 3 deletions app/BonExchange.php
Expand Up @@ -107,7 +107,4 @@ public function getItemCost($id)
->get()
->toArray()[0]['cost'];
}

}

?>
1 change: 0 additions & 1 deletion app/Category.php
Expand Up @@ -47,5 +47,4 @@ public function requests()
{
return $this->hasMany(\App\Requests::class);
}

}
1 change: 0 additions & 1 deletion app/Client.php
Expand Up @@ -14,7 +14,6 @@

use Illuminate\Database\Eloquent\Model;


class Client extends Model
{
/**
Expand Down
1 change: 0 additions & 1 deletion app/Comment.php
Expand Up @@ -62,5 +62,4 @@ public function getContentHtml()
{
return Bbcode::parse($this->content);
}

}
1 change: 0 additions & 1 deletion app/Console/Commands/autoGroup.php
Expand Up @@ -51,7 +51,6 @@ public function handle()
$users = User::whereIn('group_id', $groups)->get();

foreach ($users as $user) {

$hiscount = History::where('user_id', '=', $user->id)->count();

// Temp Hard Coding of Group Requirements (Config Files To Come) (Upload in Bytes!) (Seedtime in Seconds!)
Expand Down
30 changes: 14 additions & 16 deletions app/Console/Commands/autoPreWarning.php
Expand Up @@ -46,35 +46,33 @@ class autoPreWarning extends Command
public function handle()
{
if (config('hitrun.enabled') == true) {
$current = new Carbon();
$prewarn = History::with(['user', 'torrent'])
$current = new Carbon();
$prewarn = History::with(['user', 'torrent'])
->where('actual_downloaded', '>', 0)
->where('active', '=', 0)
->where('seedtime', '<=', config('hitrun.seedtime'))
->where('updated_at', '<', $current->copy()->subDays(config('hitrun.prewarn'))->toDateTimeString())
->get();

foreach ($prewarn as $pre) {
if (!$pre->user->group->is_immune) {
if ($pre->actual_downloaded > ($pre->torrent->size * (config('hitrun.buffer') / 100))) {
foreach ($prewarn as $pre) {
if (!$pre->user->group->is_immune) {
if ($pre->actual_downloaded > ($pre->torrent->size * (config('hitrun.buffer') / 100))) {
$exsist = Warning::where('torrent', '=', $pre->torrent->id)->where('user_id', '=', $pre->user->id)->first();

$exsist = Warning::where('torrent', '=', $pre->torrent->id)->where('user_id', '=', $pre->user->id)->first();
// Send Pre Warning PM If Actual Warning Doesnt Already Exsist
if (!$exsist) {
$timeleft = config('hitrun.grace') - config('hitrun.prewarn');

// Send Pre Warning PM If Actual Warning Doesnt Already Exsist
if (!$exsist) {

$timeleft = config('hitrun.grace') - config('hitrun.prewarn');

// Send Prewarning PM To The Offender
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $pre->user->id, 'subject' => "Hit and Run Warning Incoming", 'message' => "You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for " . config('hitrun.prewarn') . " days on Torrent " . $pre->torrent->name . "
// Send Prewarning PM To The Offender
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $pre->user->id, 'subject' => "Hit and Run Warning Incoming", 'message' => "You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for " . config('hitrun.prewarn') . " days on Torrent " . $pre->torrent->name . "
If you fail to seed it within " . $timeleft . " day(s) you will recieve a automated WARNING which will last " . config('hitrun.expire') ." days![/b]
[color=red][b] THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]"]);
}
}

unset($exist);
unset($exist);
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion app/Console/Commands/autoSeedbox.php
Expand Up @@ -14,7 +14,7 @@

use App\Torrent;
use App\Peer;
Use App\Client;
use App\Client;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
Expand Down
50 changes: 24 additions & 26 deletions app/Console/Commands/autoWarning.php
Expand Up @@ -46,45 +46,43 @@ class autoWarning extends Command
public function handle()
{
if (config('hitrun.enabled') == true) {
$current = new Carbon();
$hitrun = History::with(['user', 'torrent'])
$current = new Carbon();
$hitrun = History::with(['user', 'torrent'])
->where('actual_downloaded', '>', 0)
->where('active', '=', 0)
->where('seedtime', '<=', config('hitrun.seedtime'))
->where('updated_at', '<', $current->copy()->subDays(config('hitrun.grace'))->toDateTimeString())
->get();

foreach ($hitrun as $hr) {
if (!$hr->user->group->is_immune) {
if ($hr->actual_downloaded > ($hr->torrent->size * (config('hitrun.buffer') / 100))) {
foreach ($hitrun as $hr) {
if (!$hr->user->group->is_immune) {
if ($hr->actual_downloaded > ($hr->torrent->size * (config('hitrun.buffer') / 100))) {
$exsist = Warning::where('torrent', '=', $hr->torrent->id)->where('user_id', '=', $hr->user->id)->first();

$exsist = Warning::where('torrent', '=', $hr->torrent->id)->where('user_id', '=', $hr->user->id)->first();
// Insert Warning Into Warnings Table if doesnt already exsist
if (!$exsist) {
$warning = new Warning();
$warning->user_id = $hr->user->id;
$warning->warned_by = "1";
$warning->torrent = $hr->torrent->id;
$warning->reason = "Hit and Run Warning For Torrent {$hr->torrent->name}";
$warning->expires_on = $current->copy()->addDays(config('hitrun.expire'));
$warning->active = "1";
$warning->save();

// Insert Warning Into Warnings Table if doesnt already exsist
if (!$exsist) {
// Add +1 To Users Warnings Count In Users Table
$hr->user->hitandruns++;
$hr->user->save();

$warning = new Warning();
$warning->user_id = $hr->user->id;
$warning->warned_by = "1";
$warning->torrent = $hr->torrent->id;
$warning->reason = "Hit and Run Warning For Torrent {$hr->torrent->name}";
$warning->expires_on = $current->copy()->addDays(config('hitrun.expire'));
$warning->active = "1";
$warning->save();

// Add +1 To Users Warnings Count In Users Table
$hr->user->hitandruns++;
$hr->user->save();

// Send PM To The Offender
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $hr->user->id, 'subject' => "Hit and Run Warning Recieved", 'message' => "You have received a automated [b]WARNING[/b] from the system because [b]you failed to follow the Hit and Run rules in relation to Torrent " . $hr->torrent->name . "[/b]
// Send PM To The Offender
PrivateMessage::create(['sender_id' => "1", 'reciever_id' => $hr->user->id, 'subject' => "Hit and Run Warning Recieved", 'message' => "You have received a automated [b]WARNING[/b] from the system because [b]you failed to follow the Hit and Run rules in relation to Torrent " . $hr->torrent->name . "[/b]
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]"]);
}
}

unset($exist);
unset($exist);
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion app/Console/Commands/bonAllocation.php
Expand Up @@ -159,7 +159,7 @@ public function handle()

//Move data from SQL to array

$array = array();
$array = [];

foreach ($dying as $key => $value) {
if (array_key_exists($value->user_id, $array)) {
Expand Down
1 change: 1 addition & 0 deletions app/Console/Kernel.php
Expand Up @@ -59,6 +59,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
36 changes: 8 additions & 28 deletions app/Exceptions/Handler.php
Expand Up @@ -46,43 +46,23 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @param \Exception $exception
* @return void
*/
public function report(Exception $e)
public function report(Exception $exception)
{
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
return;
}

return parent::report($e);
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
return parent::render($request, $e);
}

/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $e
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $e)
public function render($request, Exception $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
return redirect()->guest('login');
}
return parent::render($request, $exception);
}
}
4 changes: 2 additions & 2 deletions app/Helpers/Bbcode.php
Expand Up @@ -18,10 +18,10 @@

use Config;

class Bbcode {
class Bbcode
{
private function __construct()
{

}

public static function decodaWithDefaults($data)
Expand Down
6 changes: 3 additions & 3 deletions app/Helpers/LanguageCensor.php
Expand Up @@ -22,13 +22,13 @@
*/
class LanguageCensor
{
static protected function isSpecial($c)
protected static function isSpecial($c)
{
$specialChars = "<>\n [].;,";
return strpos($specialChars, $c) !== false;
}

static protected function matchWordIndexes($string, $word)
protected static function matchWordIndexes($string, $word)
{
$result = [];
$length = strlen($word);
Expand All @@ -53,7 +53,7 @@ static protected function matchWordIndexes($string, $word)
*
* @return mixed
*/
static public function censor($source)
public static function censor($source)
{
$redactArray = Config::get('censor.redact', []);
foreach ($redactArray as $word) {
Expand Down
1 change: 0 additions & 1 deletion app/Helpers/LogActivity.php
Expand Up @@ -34,5 +34,4 @@ public static function logActivityLists()
{
return LogActivityModel::latest()->paginate(50);
}

}

0 comments on commit 21e47ab

Please sign in to comment.