Merge branch 'master' into Gallery-System

This commit is contained in:
HDVinnie
2018-06-06 21:59:55 -04:00
101 changed files with 2320 additions and 1678 deletions
+12 -11
View File
@@ -18,35 +18,35 @@ use App\Helpers\Bbcode;
class Article extends Model
{
/**
* Belongs to User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Has many Comment
* Has Many Comments
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function comments()
{
return $this->hasMany(\App\Comment::class);
return $this->hasMany(Comment::class);
}
/**
* Article Brief
* Article Trimming
*
* @access public
* @param $length
* @param ellipses
* @param strip_html Remove HTML tags from string
* @return string Formatted and cutted content
*
* @param $ellipses
* @param $strip_html
* @return string Formatted And Trimmed Content
*/
public function getBrief($length = 100, $ellipses = true, $strip_html = false)
{
@@ -74,8 +74,9 @@ class Article extends Model
}
/**
* Parse content and return valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getContentHtml()
{
+10 -3
View File
@@ -14,11 +14,13 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Class Ban.
*/
class Ban extends Model
{
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function banneduser()
{
return $this->belongsTo(\App\User::class, "owned_by")->withDefault([
@@ -27,6 +29,11 @@ class Ban extends Model
]);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function staffuser()
{
return $this->belongsTo(\App\User::class, "created_by")->withDefault([
+8 -9
View File
@@ -16,23 +16,22 @@ use Illuminate\Database\Eloquent\Model;
class BonExchange extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'bon_exchange';
/**
* Tells Laravel to not maintain the timestamp columns
* Indicates If The Model Should Be Timestamped
*
* @var boolean
* @var bool
*/
public $timestamps = false;
/**
* The attributes that should be casted to native types.
* The Attributes That Should Be Casted To Native Types
*
* @var array
*/
@@ -46,7 +45,7 @@ class BonExchange extends Model
/**
* @method getDownloadOptions
*
* @return array[][]
* @return array
*/
public function getDownloadOptions()
{
@@ -59,7 +58,7 @@ class BonExchange extends Model
/**
* @method getUploadOptions
*
* @return array[][]
* @return array
*/
public function getUploadOptions()
{
@@ -72,7 +71,7 @@ class BonExchange extends Model
/**
* @method getPersonalFreeleechOption
*
* @return array[][]
* @return array
*/
public function getPersonalFreeleechOption()
{
@@ -85,7 +84,7 @@ class BonExchange extends Model
/**
* @method getInviteOption
*
* @return array[][]
* @return array
*/
public function getInviteOption()
{
+15 -7
View File
@@ -16,31 +16,39 @@ use Illuminate\Database\Eloquent\Model;
class BonTransactions extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'bon_transactions';
/**
* Tells Laravel to not maintain the timestamp columns
* Indicates If The Model Should Be Timestamped
*
* @var boolean
* @var bool
*/
public $timestamps = false;
/**
* The storage format of the model's date columns.
* The Storage Format Of The Model's Date Columns.
*
* @var string
*/
protected $dateFormat = 'U';
/**
* Mass assignment fields
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = ['itemID', 'name', 'cost', 'sender', 'receiver', 'comment', 'torrent_id'];
protected $fillable = [
'itemID',
'name',
'cost',
'sender',
'receiver',
'comment',
'torrent_id'
];
}
+4 -9
View File
@@ -17,17 +17,12 @@ use Illuminate\Database\Eloquent\Model;
class Catalog extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = "catalogs";
/**
* Mass assignment fields
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'name', 'slug'
'name',
'slug'
];
}
+6 -3
View File
@@ -17,17 +17,20 @@ use Illuminate\Database\Eloquent\Model;
class CatalogTorrent extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = "catalog_torrent";
/**
* Mass assignment fields
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'imdb', 'tvdb', 'catalog_id'
'imdb',
'tvdb',
'catalog_id'
];
}
+9 -2
View File
@@ -16,11 +16,17 @@ use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
/**
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = false;
/**
* Has many torrents
* Has Many Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function torrents()
{
@@ -28,8 +34,9 @@ class Category extends Model
}
/**
* Has many requests
* Has Many Requests
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function requests()
{
+5
View File
@@ -6,6 +6,11 @@ use Illuminate\Database\Eloquent\Model;
class ChatStatus extends Model
{
/**
* A Status Has Many Users
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users()
{
return $this->hasMany(User::class, 'chat_status_id');
+4 -6
View File
@@ -19,10 +19,8 @@ class Chatroom extends Model
{
use Notifiable;
protected $table = 'chatrooms';
/**
* The attributes that are mass assignable.
* The Attributes That Are Mass Assignable
*
* @var array
*/
@@ -31,17 +29,17 @@ class Chatroom extends Model
];
/**
* A user can have many messages
* A User Has Many Messages
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function messages()
{
return $this->hasMany(\App\Message::class);
return $this->hasMany(Message::class);
}
/**
* A chatroom can have many users.
* A Chat Room Has Many Users
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
+1 -6
View File
@@ -16,10 +16,5 @@ use Illuminate\Database\Eloquent\Model;
class Client extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'clients';
//
}
+14 -10
View File
@@ -17,49 +17,53 @@ use App\Helpers\Bbcode;
class Comment extends Model
{
/**
* Belongs to Torrent
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrent()
{
return $this->belongsTo(\App\Torrent::class);
return $this->belongsTo(Torrent::class);
}
/**
* Belongs to Article
* Belongs To A Article
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function article()
{
return $this->belongsTo(\App\Article::class);
return $this->belongsTo(Article::class);
}
/**
* Belongs to Request
* Belongs To A Request
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function request()
{
return $this->belongsTo(\App\TorrentRequest::class);
return $this->belongsTo(TorrentRequest::class);
}
/**
* Belongs to User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Parse content and return valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getContentHtml()
{
+8 -1
View File
@@ -16,8 +16,15 @@ use Illuminate\Database\Eloquent\Model;
class FailedLoginAttempt extends Model
{
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'user_id', 'username', 'ip_address',
'user_id',
'username',
'ip_address'
];
public static function record($user = null, $username, $ip)
+6 -19
View File
@@ -17,35 +17,22 @@ use Illuminate\Database\Eloquent\Model;
class FeaturedTorrent extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'featured_torrents';
/**
* Mass assignment fields
*
*/
protected $fillable = ['user_id', 'torrent_id'];
/**
* Belongs to torrent
*
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrent()
{
return $this->belongsTo(\App\Torrent::class);
return $this->belongsTo(Torrent::class);
}
/**
* Belongs to user
*
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class);
return $this->belongsTo(User::class);
}
}
+12 -4
View File
@@ -16,19 +16,27 @@ use Illuminate\Database\Eloquent\Model;
class Follow extends Model
{
protected $fillable = ['target_id'];
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function target()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
+16 -11
View File
@@ -16,28 +16,30 @@ use Illuminate\Database\Eloquent\Model;
class Forum extends Model
{
/**
* Has many topics
* Has Many Topic
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function topics()
{
return $this->hasMany(\App\Topic::class);
return $this->hasMany(Topic::class);
}
/**
* Has many permissions
* Has Many Permissions
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function permissions()
{
return $this->hasMany(\App\Permission::class);
return $this->hasMany(Permission::class);
}
/**
* Returns a table with the forums in the category
* Returns A Table With The Forums In The Category
*
* @return string
*/
public function getForumsInCategory()
{
@@ -45,8 +47,9 @@ class Forum extends Model
}
/**
* Returns the category in which the forum is located
* Returns The Category Nn Which The Forum Is Located
*
* @return string
*/
public function getCategory()
{
@@ -54,9 +57,9 @@ class Forum extends Model
}
/**
* Count the number of posts in the forum
*
* Count The Number Of Posts In The Forum
*
* @return string
*/
public function getPostCount($forumId)
{
@@ -70,8 +73,9 @@ class Forum extends Model
}
/**
* Count the number of topics in the forum
* Count The Number Of Topics In The Forum
*
* @return string
*/
public function getTopicCount($forumId)
{
@@ -80,8 +84,9 @@ class Forum extends Model
}
/**
* Returns the permission field
* Returns The Permission Field
*
* @return string
*/
public function getPermission()
{
+1 -1
View File
@@ -14,7 +14,7 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
class freeleechToken extends Model
class FreeleechToken extends Model
{
//
}
+1 -1
View File
@@ -17,7 +17,7 @@ use Illuminate\Database\Eloquent\Model;
class Graveyard extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
+19 -7
View File
@@ -16,30 +16,42 @@ use Illuminate\Database\Eloquent\Model;
class Group extends Model
{
public $timestamps = false;
/**
* The Attributes That Aren't Mass Assignable
*
* @var array
*/
protected $guarded = ['id'];
/**
* Has many users
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = false;
/**
* Has Many Users
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users()
{
return $this->hasMany(\App\User::class);
return $this->hasMany(User::class);
}
/**
* Has many permissions
* Has Many Permissions
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function permissions()
{
return $this->hasMany(\App\Permission::class);
return $this->hasMany(Permission::class);
}
/**
* Returns the requested row from the permissions table
* Returns The Requested Row From The Permissions Table
*
*/
public function getPermissionsByForum($forum)
+45 -8
View File
@@ -19,30 +19,67 @@ class History extends Model
{
use Sortable;
public $sortable = ['id', 'agent', 'active', 'seeder', 'uploaded', 'downloaded', 'seedtime', 'created_at', 'updated_at', 'completed_at'];
//
/**
* The database table used by the model.
* The Columns That Are Sortable
*
* @var array
*/
public $sortable = [
'id',
'agent',
'active',
'seeder',
'uploaded',
'downloaded',
'seedtime',
'created_at',
'updated_at',
'completed_at'
];
/**
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'history';
protected $fillable = ['user_id', 'info_hash'];
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'user_id',
'info_hash'
];
/**
* The Attributes That Should Be Mutated To Dates
*
* @var array
*/
protected $dates = ['completed_at'];
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrent()
{
return $this->belongsTo(\App\Torrent::class, "info_hash", "info_hash");
return $this->belongsTo(Torrent::class, "info_hash", "info_hash");
}
}
@@ -14,12 +14,10 @@ namespace App\Http\Controllers;
class AchievementsController extends Controller
{
/**
* Show User Achievements
*
* @access public
* @return user.achievements
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
@@ -28,6 +26,11 @@ class AchievementsController extends Controller
$locked = $user->lockedAchievements();
$pending = $user->inProgressAchievements();
return view('user.achievements', ['user' => $user, 'achievements' => $achievements, 'locked' => $locked, 'pending' => $pending]);
return view('user.achievements', [
'user' => $user,
'achievements' => $achievements,
'locked' => $locked,
'pending' => $pending
]);
}
}
+2 -4
View File
@@ -24,12 +24,10 @@ use Illuminate\Http\Request;
class AnnounceController extends Controller
{
/**
* Announce code
* Announce Code
*
* @access public
* @param $Passkey User passkey
* @param $passkey
* @return Bencoded response for the torrent client
*/
public function announce(Request $request, $passkey)
@@ -22,7 +22,6 @@ use App\Http\Requests\ValidateSecretRequest;
use App\Jobs\SendActivationMail;
use App\UserActivation;
use App\User;
use App\Message;
use App\PrivateMessage;
use App\Group;
use App\Invite;
@@ -33,6 +32,9 @@ use Cache;
class RegisterController extends Controller
{
/**
* @var ChatRepository
*/
private $chat;
public function __construct(ChatRepository $chat)
@@ -40,85 +42,90 @@ class RegisterController extends Controller
$this->chat = $chat;
}
/**
* Registration Form
*
* @param $code
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function registrationForm($code = null)
{
return view('auth.register', ['code' => $code]);
}
public function register(Request $request, $code = null)
{
$current = Carbon::now();
$user = new User();
// Make sure open reg is off and ivite code is present
// Make sure open reg is off and invite code is present
if (config('other.invite-only') == true && $code == null) {
return view('auth.login')
->with(Toastr::error('Open Reg Closed! You Must Be Invited To Register! You Have Been Redirected To Login Page!', 'Whoops!', ['options']));
}
if ($request->isMethod('post')) {
// Make sure open reg is off and ivite code exsist and has not been used already
$key = Invite::where('code', '=', $code)->first();
if (config('other.invite-only') == true && (!$key || $key->accepted_by !== null)) {
return view('auth.register', ['code' => $code])
->with(Toastr::error('Invalid or Expired Invite Key!', 'Whoops!', ['options']));
}
$v = validator($request->all(), [
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6',
'g-recaptcha-response' => new Captcha()
]);
if ($v->fails()) {
return redirect()->route('register', ['code' => $code])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
// Create The User
$group = Group::where('slug', '=', 'validating')->first();
$user->username = $request->input('username');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->passkey = md5(uniqid() . time() . microtime());
$user->rsskey = md5(uniqid() . time() . microtime() . $user->password);
$user->uploaded = config('other.default_upload');
$user->downloaded = config('other.default_download');
$user->style = config('other.default_style', 0);
$user->group_id = $group->id;
$user->save();
if ($key) {
// Update The Invite Record
$key->accepted_by = $user->id;
$key->accepted_at = new Carbon();
$key->save();
}
// Handle The Activation System
$token = hash_hmac('sha256', $user->username . $user->email . str_random(16), config('app.key'));
UserActivation::create([
'user_id' => $user->id,
'token' => $token,
]);
$this->dispatch(new SendActivationMail($user, $token));
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"Welcome [url={$profile_url}]{$user->username}[/url] hope you enjoy the community :rocket:"
);
// Send Welcome PM
$pm = new PrivateMessage;
$pm->sender_id = 1;
$pm->receiver_id = $user->id;
$pm->subject = config('welcomepm.subject');
$pm->message = config('welcomepm.message');
$pm->save();
// Activity Log
\LogActivity::addToLog("Member " . $user->username . " has successfully registered to site.");
return redirect()->route('login')
->with(Toastr::success('Thanks for signing up! Please check your email to Validate your account', 'Yay!', ['options']));
}
// Make sure open reg is off and invite code exist and has not been used already
$key = Invite::where('code', '=', $code)->first();
if (config('other.invite-only') == true && (!$key || $key->accepted_by !== null)) {
return view('auth.register', ['code' => $code])
->with(Toastr::error('Invalid or Expired Invite Key!', 'Whoops!', ['options']));
}
$group = Group::where('slug', '=', 'validating')->first();
$user = new User();
$user->username = $request->input('username');
$user->email = $request->input('email');
$user->password = Hash::make($request->input('password'));
$user->passkey = md5(uniqid() . time() . microtime());
$user->rsskey = md5(uniqid() . time() . microtime() . $user->password);
$user->uploaded = config('other.default_upload');
$user->downloaded = config('other.default_download');
$user->style = config('other.default_style', 0);
$user->group_id = $group->id;
$v = validator($request->all(), [
'username' => 'required|alpha_dash|min:3|max:20|unique:users',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6',
'g-recaptcha-response' => new Captcha()
]);
if ($v->fails()) {
return redirect()->route('register', ['code' => $code])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$user->save();
if ($key) {
// Update The Invite Record
$key->accepted_by = $user->id;
$key->accepted_at = new Carbon();
$key->save();
}
// Handle The Activation System
$token = hash_hmac('sha256', $user->username . $user->email . str_random(16), config('app.key'));
$activation = new UserActivation();
$activation->user_id = $user->id;
$activation->token = $token;
$activation->save();
$this->dispatch(new SendActivationMail($user, $token));
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"Welcome [url={$profile_url}]{$user->username}[/url] hope you enjoy the community :rocket:"
);
// Send Welcome PM
$pm = new PrivateMessage;
$pm->sender_id = 1;
$pm->receiver_id = $user->id;
$pm->subject = config('welcomepm.subject');
$pm->message = config('welcomepm.message');
$pm->save();
// Activity Log
\LogActivity::addToLog("Member " . $user->username . " has successfully registered to site.");
return redirect()->route('login')
->with(Toastr::success('Thanks for signing up! Please check your email to Validate your account', 'Yay!', ['options']));
}
return view('auth.register', ['code' => $code]);
}
}
+2 -7
View File
@@ -12,17 +12,12 @@
namespace App\Http\Controllers;
use \Toastr;
class BookmarkController extends Controller
{
/**
* Bookmarks
* Get Torrent Bookmarks
*
*
* @access public
* @return view::make bookmark.bookmarks
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function bookmarks()
{
+16 -11
View File
@@ -20,26 +20,31 @@ use \Toastr;
class BugController extends Controller
{
/**
* Bug Report Form
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function bugForm()
{
return view('bug.bug');
}
/**
* Bug Report
* Send Bug Report
*
*
* @access public
* @return view::make bug.bug
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function bug(Request $request)
{
// Fetch owner account
$user = User::where('id', 3)->first();
$input = $request->all();
if ($request->isMethod('POST')) {
$input = $request->all();
Mail::to($user->email, $user->username)->send(new Bug($input));
Mail::to($user->email, $user->username)->send(new Bug($input));
Toastr::success('Your Bug Was Succefully Sent!', 'Yay!', ['options']);
}
return view('bug.bug');
return redirect()->route('home')
->with(Toastr::success('Your Bug Was Successfully Sent!', 'Yay!', ['options']));
}
}
+12 -13
View File
@@ -18,12 +18,10 @@ use App\Torrent;
class CatalogController extends Controller
{
/**
* Display catalogs list
* Show Catalogs
*
* @access public
* @return catalogs.catalogs View
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function catalogs()
{
@@ -33,12 +31,11 @@ class CatalogController extends Controller
}
/**
* Displays movies in catalog
* Show All Titles In A Catalog
*
* @access public
* @param $slug
* @param $id
* @return catalogs.catalog View
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function catalog($slug, $id)
{
@@ -46,16 +43,18 @@ class CatalogController extends Controller
$catalog = Catalog::findOrFail($id);
$records = CatalogTorrent::where('catalog_id', $id)->latest('imdb')->get();
return view('catalogs.catalog', ['user' => $user, 'catalog' => $catalog, 'records' => $records]);
return view('catalogs.catalog', [
'user' => $user,
'catalog' => $catalog,
'records' => $records
]);
}
/**
* Displays torrents
* Show All Torrents That Match Catalog Titles
*
* @access public
* @param $slug
* @param $id
* @return catalogs.torrents View
* @param $imdb
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function torrents($imdb)
{
+7 -3
View File
@@ -17,7 +17,7 @@ use App\Category;
class CategoryController extends Controller
{
/**
* Display Category List
* Show Categories
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
@@ -29,7 +29,7 @@ class CategoryController extends Controller
}
/**
* Displays torrents by category
* Show All Torrents Within A Category
*
* @param $slug
* @param $id
@@ -41,6 +41,10 @@ class CategoryController extends Controller
$category = Category::findOrFail($id);
$torrents = $category->torrents()->latest()->paginate(25);
return view('category.category', ['torrents' => $torrents, 'user' => $user, 'category' => $category]);
return view('category.category', [
'torrents' => $torrents,
'user' => $user,
'category' => $category
]);
}
}
+221 -223
View File
@@ -40,12 +40,14 @@ use \Toastr;
class CommentController extends Controller
{
/**
* @var TaggedUserRepository
*/
private $tag;
/**
* @var ChatRepository
*/
private $chat;
public function __construct(TaggedUserRepository $tag, ChatRepository $chat)
@@ -55,316 +57,313 @@ class CommentController extends Controller
}
/**
* Add a comment on a artical
* Add A Comment To A Article
*
* @param Request $request
* @param $slug
* @param $id
*
* @return Illuminate\Http\RedirectResponse
*/
public function article(Request $request, $slug, $id)
{
$article = Article::findOrFail($id);
$user = auth()->user();
$v = validator($request->all(), [
if ($user->can_comment == 0) {
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])
->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$comment = new Comment();
$comment->content = $request->input('content');
$comment->user_id = $user->id;
$comment->article_id = $article->id;
$v = validator($comment->toArray(), [
'content' => 'required',
'user_id' => 'required',
'article_id' => 'required'
]);
if ($v->failed()) {
return redirect()->route('article', [
'slug' => $article->slug,
'id' => $article->id])->with(Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Whoops!', ['options']));
}
if ($v->fails()) {
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$comment->save();
// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('article', [
'slug' => $article->slug,
'id' => $article->id
])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$article_url = hrefArticle($article);
$profile_url = hrefProfile($user);
$content = $request->input('content');
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on article [url={$article_url}]{$article->title}[/url]"
);
$comment = new Comment();
$comment->content = $content;
$comment->user_id = $user->id;
$comment->article_id = $article->id;
$comment->save();
if ($this->tag->hasTags($request->input('content'))) {
$article_url = hrefArticle($article);
$profile_url = hrefProfile($user);
$pm = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$article_url}]HERE[/url]";
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on article [url={$article_url}]{$article->title}[/url]"
);
if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) {
$users = collect([]);
if ($this->tag->hasTags($content)) {
$article->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$pm = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$article_url}]HERE[/url]";
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
$users = collect([]);
$article->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$pm
);
} else {
$this->tag->messageTaggedUsers($content,
"You have been tagged by {$user->username}",
$pm
);
$this->tag->messageUsers($users,
"You are being notified by staff!",
$pm
);
} else {
$this->tag->messageTaggedUsers($request->input('content'),
"You have been tagged by {$user->username}",
$pm
);
}
}
}
return redirect()->route('article', [
'slug' => $article->slug,
'id' => $article->id])->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])
->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
}
/**
* Add a comment on a torrent
* Add A Comment To A Torrent
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function torrent(Request $request, $slug, $id)
{
$torrent = Torrent::findOrFail($id);
$user = auth()->user();
$v = validator($request->all(), [
if ($user->can_comment == 0) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$comment = new Comment();
$comment->content = $request->input('content');;
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->torrent_id = $torrent->id;
$v = validator($comment->toArray(), [
'content' => 'required',
'user_id' => 'required',
'torrent_id' => 'required',
'anon' => 'required'
]);
if ($v->failed()) {
return redirect()->route('torrent', [
'slug' => $torrent->slug,
'id' => $torrent->id
])->with(Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']));
}
// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('torrent', [
'slug' => $torrent->slug,
'id' => $torrent->id
])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$content = $request->input('content');
$comment = new Comment();
$comment->content = $content;
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->torrent_id = $torrent->id;
$comment->save();
//Notification
if ($user->id != $torrent->user_id) {
User::find($torrent->user_id)->notify(new NewTorrentComment($comment));
}
$torrent_url = hrefTorrent($torrent);
$profile_url = hrefProfile($user);
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
);
if ($v->fails()) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on torrent [url={$torrent_url}]{$torrent->name}[/url]"
);
}
$comment->save();
if ($this->tag->hasTags($content)) {
//Notification
if ($user->id != $torrent->user_id) {
User::find($torrent->user_id)->notify(new NewTorrentComment($comment));
}
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$torrent_url}]HERE[/url]";
$torrent_url = hrefTorrent($torrent);
$profile_url = hrefProfile($user);
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
$users = collect([]);
$torrent->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
);
} else {
$this->tag->messageTaggedUsers($content,
"You have been tagged by {$user->username}",
$message
$this->chat->systemMessage(
"An anonymous user has left a comment on torrent [url={$torrent_url}]{$torrent->name}[/url]"
);
}
if ($this->tag->hasTags($request->input('content'))) {
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$torrent_url}]HERE[/url]";
if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) {
$users = collect([]);
$torrent->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
);
} else {
$this->tag->messageTaggedUsers($request->input('content'),
"You have been tagged by {$user->username}",
$message
);
}
}
// Achievements
$user->unlock(new UserMadeComment(), 1);
$user->addProgress(new UserMadeTenComments(), 1);
$user->addProgress(new UserMade50Comments(), 1);
$user->addProgress(new UserMade100Comments(), 1);
$user->addProgress(new UserMade200Comments(), 1);
$user->addProgress(new UserMade300Comments(), 1);
$user->addProgress(new UserMade400Comments(), 1);
$user->addProgress(new UserMade500Comments(), 1);
$user->addProgress(new UserMade600Comments(), 1);
$user->addProgress(new UserMade700Comments(), 1);
$user->addProgress(new UserMade800Comments(), 1);
$user->addProgress(new UserMade900Comments(), 1);
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
// Achievements
$user->unlock(new UserMadeComment(), 1);
$user->addProgress(new UserMadeTenComments(), 1);
$user->addProgress(new UserMade50Comments(), 1);
$user->addProgress(new UserMade100Comments(), 1);
$user->addProgress(new UserMade200Comments(), 1);
$user->addProgress(new UserMade300Comments(), 1);
$user->addProgress(new UserMade400Comments(), 1);
$user->addProgress(new UserMade500Comments(), 1);
$user->addProgress(new UserMade600Comments(), 1);
$user->addProgress(new UserMade700Comments(), 1);
$user->addProgress(new UserMade800Comments(), 1);
$user->addProgress(new UserMade900Comments(), 1);
return redirect()->route('torrent', [
'slug' => $torrent->slug,
'id' => $torrent->id
])->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
/**
* Add a comment on a request
* Add A Comment To A Request
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function request(Request $request, $id)
{
$tr = TorrentRequest::findOrFail($id);
$user = auth()->user();
if ($user->can_comment == 0) {
return redirect()->route('request', ['id' => $tr->id])
->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$comment = new Comment();
$comment->content = $request->input('content');
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->requests_id = $tr->id;
$v = validator($request->all(), [
'content' => 'required',
'user_id' => 'required',
'requests_id' => 'required'
]);
if ($v->failed()) {
return redirect()->route('request', [
'id' => $request->id
])->with(Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Sorry', ['options']));
}
// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('request', [
'id' => $request->id
])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$content = $request->input('content');
$comment = new Comment();
$comment->content = $content;
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->requests_id = $tr->id;
$comment->save();
$tr_url = hrefTorrentRequest($tr);
$profile_url = hrefProfile($user);
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
);
if ($v->fails()) {
return redirect()->route('request', ['id' => $tr->id])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
);
}
$comment->save();
if ($this->tag->hasTags($content)) {
$tr_url = hrefTorrentRequest($tr);
$profile_url = hrefProfile($user);
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$tr_url}] HERE [/url]";
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
$users = collect([]);
$tr->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
);
} else {
$this->tag->messageTaggedUsers($content,
"You have been tagged by {$user->username}",
$message
$this->chat->systemMessage(
"An anonymous user has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
);
}
if ($this->tag->hasTags($request->input('content'))) {
$message = "[url={$profile_url}]{$user->username}[/url] has tagged you in a comment. You can view it [url={$tr_url}] HERE [/url]";
if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) {
$users = collect([]);
$tr->comments()->get()->each(function ($c, $v) use ($users) {
$users->push($c->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
);
} else {
$this->tag->messageTaggedUsers($request->input('content'),
"You have been tagged by {$user->username}",
$message
);
}
}
// Achievements
$user->unlock(new UserMadeComment(), 1);
$user->addProgress(new UserMadeTenComments(), 1);
$user->addProgress(new UserMade50Comments(), 1);
$user->addProgress(new UserMade100Comments(), 1);
$user->addProgress(new UserMade200Comments(), 1);
$user->addProgress(new UserMade300Comments(), 1);
$user->addProgress(new UserMade400Comments(), 1);
$user->addProgress(new UserMade500Comments(), 1);
$user->addProgress(new UserMade600Comments(), 1);
$user->addProgress(new UserMade700Comments(), 1);
$user->addProgress(new UserMade800Comments(), 1);
$user->addProgress(new UserMade900Comments(), 1);
// Auto PM
if ($user->id != $request->user_id) {
$pm = new PrivateMessage;
$pm->sender_id = 1;
$pm->receiver_id = $tr->user_id;
$pm->subject = "Your Request " . $tr->name . " Has A New Comment!";
$pm->message = $comment->user->username . " Has Left A Comment On [url={$tr_url}]" . $tr->name . "[/url]";
$pm->save();
}
return redirect()->route('request', ['id' => $tr->id])
->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
// Achievements
$user->unlock(new UserMadeComment(), 1);
$user->addProgress(new UserMadeTenComments(), 1);
$user->addProgress(new UserMade50Comments(), 1);
$user->addProgress(new UserMade100Comments(), 1);
$user->addProgress(new UserMade200Comments(), 1);
$user->addProgress(new UserMade300Comments(), 1);
$user->addProgress(new UserMade400Comments(), 1);
$user->addProgress(new UserMade500Comments(), 1);
$user->addProgress(new UserMade600Comments(), 1);
$user->addProgress(new UserMade700Comments(), 1);
$user->addProgress(new UserMade800Comments(), 1);
$user->addProgress(new UserMade900Comments(), 1);
// Auto PM
if ($user->id != $request->user_id) {
$pm = new PrivateMessage;
$pm->sender_id = 1;
$pm->receiver_id = $tr->user_id;
$pm->subject = "Your Request " . $tr->name . " Has A New Comment!";
$pm->message = $comment->user->username . " Has Left A Comment On [url={$tr_url}]" . $tr->name . "[/url]";
$pm->save();
}
return redirect()->route('request', [
'id' => $tr->id
])->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
/**
* Add a comment on a torrent via quickthanks
* Add A Comment To A Torrent Via Quick Thanks
*
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function quickthanks($id)
{
$torrent = Torrent::findOrFail($id);
$user = auth()->user();
$uploader = $torrent->user;
// User's comment rights disbabled?
if ($user->can_comment == 0) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::error('Your Comment Rights Have Benn Revoked!!!', 'Whoops!', ['options']));
}
$comment = new Comment();
$thankArray = ["Thanks for the upload! :thumbsup_tone2:", "Time and effort is much appreciated :thumbsup_tone2:", "Great upload! :fire:", "Thankyou :smiley:"];
$thankArray = [
"Thanks for the upload! :thumbsup_tone2:",
"Time and effort is much appreciated :thumbsup_tone2:",
"Great upload! :fire:", "Thankyou :smiley:"
];
$selected = mt_rand(0, count($thankArray) - 1);
$comment->content = $thankArray[$selected];
$comment->user_id = $user->id;
$comment->torrent_id = $torrent->id;
$v = validator($comment->toArray(), ['content' => 'required', 'user_id' => 'required', 'torrent_id' => 'required']);
if ($v->passes()) {
$v = validator($comment->toArray(), [
'content' => 'required',
'user_id' => 'required',
'torrent_id' => 'required'
]);
if ($v->fails()) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$comment->save();
Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']);
// Achievements
$user->unlock(new UserMadeComment(), 1);
@@ -393,18 +392,17 @@ class CommentController extends Controller
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
);
} else {
Toastr::error('A Error Has Occured And Your Comment Was Not Posted!', 'Whoops!', ['options']);
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id]);
}
/**
* Edit a comment
*
* Edit A Comment
*
* @param Request $request
* @param $comment_id
* @return Illuminate\Http\RedirectResponse
*/
public function editComment(Request $request, $comment_id)
{
@@ -423,10 +421,10 @@ class CommentController extends Controller
}
/**
* Delete a comment on a torrent
*
* Delete A Comment
*
* @param $comment_id
* @return Illuminate\Http\RedirectResponse
*/
public function deleteComment($comment_id)
{
+3 -1
View File
@@ -21,6 +21,8 @@ use \Toastr;
class ContactController extends Controller
{
/**
* Contact Form
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
@@ -29,7 +31,7 @@ class ContactController extends Controller
}
/**
* Contact page, send an email to owner/first user
* Send A Contact Email To Owner/First User
*
* @access public
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+22 -15
View File
@@ -13,37 +13,42 @@
namespace App\Http\Controllers;
use App\User;
use App\Follow;
use \Toastr;
class FollowController extends Controller
{
/**
* Follow A User
*
*
* @param $user
* @param User $user
* @return Illuminate\Http\RedirectResponse
*/
public function follow(User $user)
{
if (auth()->user()->id == $user->id) {
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error("Nice try, but sadly you can not follow yourself.", 'Whoops!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::error("Nice try, but sadly you can not follow yourself.", 'Whoops!', ['options']));
} elseif (!auth()->user()->isFollowing($user->id)) {
// Create a new follow instance for the authenticated user
auth()->user()->follows()->create([
'target_id' => $user->id,
]);
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are now following ' . $user->username, 'Yay!', ['options']));
$follow = new Follow();
$follow->user_id = auth()->user()->id;
$follow->target_id = $user->id;
$follow->save();
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::success('You are now following ' . $user->username, 'Yay!', ['options']));
} else {
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are already following this user', 'Whoops!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::error('You are already following this user', 'Whoops!', ['options']));
}
}
/**
* Unfollow A User
* Un Follow A User
*
*
* @param $user
* @param User $user
* @return Illuminate\Http\RedirectResponse
*/
public function unfollow(User $user)
{
@@ -51,9 +56,11 @@ class FollowController extends Controller
$follow = auth()->user()->follows()->where('target_id', $user->id)->first();
$follow->delete();
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('You are no longer following ' . $user->username, 'Yay!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::success('You are no longer following ' . $user->username, 'Yay!', ['options']));
} else {
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::error('You are not following this user to begin with', 'Whoops!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::error('You are not following this user to begin with', 'Whoops!', ['options']));
}
}
}
+369 -256
View File
@@ -59,16 +59,14 @@ class ForumController extends Controller
}
/**
* Search for topics
*
* @access public
* @return View page.torrents
* Search For Topics
*
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function search(Request $request)
{
$user = auth()->user();
$search = $request->input('name');
$results = Topic::where([
['name', 'like', '%' . $request->input('name') . '%'],
])->latest()->paginate(25);
@@ -79,73 +77,88 @@ class ForumController extends Controller
}
/**
* Display the forum homepage
* Show All Forums
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
$categories = Forum::oldest('position')->get();
// Total Forums Count
$num_forums = Forum::all()->count();
// Total Posts Count
$num_posts = Post::all()->count();
// Total Topics Count
$num_topics = Topic::all()->count();
return view('forum.index', ['categories' => $categories, 'num_posts' => $num_posts, 'num_forums' => $num_forums, 'num_topics' => $num_topics]);
return view('forum.index', [
'categories' => $categories,
'num_posts' => $num_posts,
'num_forums' => $num_forums,
'num_topics' => $num_topics
]);
}
/**
* Displays the requested category
* Show The Forum Category
*
* @access public
* @param $slug
* @param $id
* @return void
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function category($slug, $id)
{
$category = Forum::findOrFail($id);
if ($category->getPermission()->show_forum != true) {
return redirect()->route('forum_index')->with(Toastr::error('You Do Not Have Access To This Category!', 'Whoops!', ['options']));
return redirect()->route('forum_index')
->with(Toastr::error('You Do Not Have Access To This Category!', 'Whoops!', ['options']));
}
return view('forum.category', ['c' => $category]);
}
/**
* Shows forums and topics inside
* Show Forums And Topics Inside
*
* @access public
* @param $slug
* @param $id
* @return View forum.display
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function display($slug, $id)
{
// Find the topic
$forum = Forum::findOrFail($id);
// Check if this is a category or forum
if ($forum->parent_id == 0) {
return redirect()->route('forum_category', ['slug' => $forum->slug, 'id' => $forum->id]);
}
$category = Forum::findOrFail($forum->parent_id);
// Check if the user has permission to view the forum
$category = Forum::findOrFail($forum->parent_id);
if ($category->getPermission()->show_forum != true) {
return redirect()->route('forum_index')->with(Toastr::error('You Do Not Have Access To This Forum!', 'Whoops!', ['options']));
return redirect()->route('forum_index')
->with(Toastr::error('You Do Not Have Access To This Forum!', 'Whoops!', ['options']));
}
// Fetch topics->posts in descending order
$topics = $forum->topics()->latest('pinned')->latest('last_reply_at')->latest()->paginate(25);
return view('forum.display', ['forum' => $forum, 'topics' => $topics, 'category' => $category]);
return view('forum.display', [
'forum' => $forum,
'topics' => $topics,
'category' => $category
]);
}
/**
* Show the topic
* Show The Topic
*
* @access public
* @param $slug
* @param $id
* @return forum.topic
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function topic($slug, $id)
{
@@ -167,21 +180,30 @@ class ForumController extends Controller
// The user can post a topic here ?
if ($category->getPermission()->read_topic != true) {
// Redirect him to the forum index
return redirect()->route('forum_index')->with(Toastr::error('You Do Not Have Access To Read This Topic!', 'Whoops!', ['options']));
return redirect()->route('forum_index')
->with(Toastr::error('You Do Not Have Access To Read This Topic!', 'Whoops!', ['options']));
}
// Increment view
$topic->views++;
$topic->save();
return view('forum.topic', ['topic' => $topic, 'forum' => $forum, 'category' => $category, 'posts' => $posts, 'firstPost' => $firstPost]);
return view('forum.topic', [
'topic' => $topic,
'forum' => $forum,
'category' => $category,
'posts' => $posts,
'firstPost' => $firstPost
]);
}
/**
* Add a reply to a topic
* Add A Post To A Topic
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function reply(Request $request, $slug, $id)
{
@@ -192,123 +214,147 @@ class ForumController extends Controller
// The user has the right to create a topic here?
if (!$category->getPermission()->reply_topic || ($topic->state == "close" && !auth()->user()->group->is_modo)) {
return redirect()->route('forum_index')->with(Toastr::error('You Cannot Reply To This Topic!', 'Whoops!', ['options']));
return redirect()->route('forum_index')
->with(Toastr::error('You Cannot Reply To This Topic!', 'Whoops!', ['options']));
}
$v = validator($request->all(), [
'content' => 'required',
$post = new Post();
$post->content = $request->input('content');
$post->user_id = $user->id;
$post->topic_id = $topic->id;
$v = validator($post->toArray(), [
'content' => 'required|min:1',
'user_id' => 'required',
'topic_id' => 'required'
]);
if ($v->failed()) {
return redirect()->route('forum_topic', [
'slug' => $topic->slug,
'id' => $topic->id
])->with(Toastr::error('You Cannot Reply To This Topic!', 'Whoops!', ['options']));
}
if ($v->fails()) {
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$post->save();
$content = $request->input('content');
$appurl = config('app.url');
$href = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$message = "{$user->username} has tagged you in a forum post. You can view it [url=$href] HERE [/url]";
$post = new Post();
$post->content = $content;
$post->user_id = $user->id;
$post->topic_id = $topic->id;
$post->save();
if ($this->tag->hasTags($request->input('content'))) {
$appurl = config('app.url');
$href = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$message = "{$user->username} has tagged you in a forum post. You can view it [url=$href] HERE [/url]";
//$this->tag->setDebug(true);
if ($this->tag->hasTags($content)) {
if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) {
$users = collect([]);
//$this->tag->setDebug(true);
$topic->posts()->get()->each(function ($p, $v) use ($users) {
$users->push($p->user);
});
if ($this->tag->contains($content, '@here') && $user->group->is_modo) {
$users = collect([]);
$topic->posts()->get()->each(function ($p, $v) use ($users) {
$users->push($p->user);
});
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
);
} else {
$this->tag->messageTaggedUsers($content,
"You have been tagged by {$user->username}",
$message
);
$this->tag->messageUsers($users,
"You are being notified by staff!",
$message
);
} else {
$this->tag->messageTaggedUsers($request->input('content'),
"You have been tagged by {$user->username}",
$message
);
}
}
// Save last post user data to topic table
$topic->last_post_user_id = $user->id;
$topic->last_post_user_username = $user->username;
// Count post in topic
$topic->num_post = Post::where('topic_id', $topic->id)->count();
// Update time
$topic->last_reply_at = $post->created_at;
// Save
$topic->save();
// Count posts
$forum->num_post = $forum->getPostCount($forum->id);
// Count topics
$forum->num_topic = $forum->getTopicCount($forum->id);
// Save last post user data to the forum table
$forum->last_post_user_id = $user->id;
$forum->last_post_user_username = $user->username;
// Save last topic data to the forum table
$forum->last_topic_id = $topic->id;
$forum->last_topic_name = $topic->name;
// Save
$forum->save();
// Find the user who initated the topic
$topicCreator = User::findOrFail($topic->first_post_user_id);
// Post To Chatbox
$appurl = config('app.url');
$postUrl = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$profileUrl = "{$appurl}/{$user->username}.{$user->id}";
$this->chat->systemMessage("[url=$profileUrl]{$user->username}[/url] has left a reply on topic [url={$postUrl}]{$topic->name}[/url]");
// Mail Topic Creator Of New Reply
if ($post->user_id != $topic->first_post_user_id) {
Mail::to($topicCreator->email)->send(new NewReply($user, $topic));
}
//Achievements
$user->unlock(new UserMadeFirstPost(), 1);
$user->addProgress(new UserMade25Posts(), 1);
$user->addProgress(new UserMade50Posts(), 1);
$user->addProgress(new UserMade100Posts(), 1);
$user->addProgress(new UserMade200Posts(), 1);
$user->addProgress(new UserMade300Posts(), 1);
$user->addProgress(new UserMade400Posts(), 1);
$user->addProgress(new UserMade500Posts(), 1);
$user->addProgress(new UserMade600Posts(), 1);
$user->addProgress(new UserMade700Posts(), 1);
$user->addProgress(new UserMade800Posts(), 1);
$user->addProgress(new UserMade900Posts(), 1);
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('Post Successfully Posted', 'Yay!', ['options']));
}
// Save last post user data to topic table
$topic->last_post_user_id = $user->id;
$topic->last_post_user_username = $user->username;
// Count post in topic
$topic->num_post = Post::where('topic_id', $topic->id)->count();
// Update time
$topic->last_reply_at = $post->created_at;
// Save
$topic->save();
// Count posts
$forum->num_post = $forum->getPostCount($forum->id);
// Count topics
$forum->num_topic = $forum->getTopicCount($forum->id);
// Save last post user data to the forum table
$forum->last_post_user_id = $user->id;
$forum->last_post_user_username = $user->username;
// Save last topic data to the forum table
$forum->last_topic_id = $topic->id;
$forum->last_topic_name = $topic->name;
// Save
$forum->save();
// Find the user who initated the topic
$topicCreator = User::findOrFail($topic->first_post_user_id);
// Post To Chatbox
$appurl = config('app.url');
$postUrl = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$profileUrl = "{$appurl}/{$user->username}.{$user->id}";
$this->chat->systemMessage("[url=$profileUrl]{$user->username}[/url] has left a reply on topic [url={$postUrl}]{$topic->name}[/url]");
// Mail Topic Creator Of New Reply
if ($post->user_id != $topic->first_post_user_id) {
Mail::to($topicCreator->email)->send(new NewReply($user, $topic));
}
//Achievements
$user->unlock(new UserMadeFirstPost(), 1);
$user->addProgress(new UserMade25Posts(), 1);
$user->addProgress(new UserMade50Posts(), 1);
$user->addProgress(new UserMade100Posts(), 1);
$user->addProgress(new UserMade200Posts(), 1);
$user->addProgress(new UserMade300Posts(), 1);
$user->addProgress(new UserMade400Posts(), 1);
$user->addProgress(new UserMade500Posts(), 1);
$user->addProgress(new UserMade600Posts(), 1);
$user->addProgress(new UserMade700Posts(), 1);
$user->addProgress(new UserMade800Posts(), 1);
$user->addProgress(new UserMade900Posts(), 1);
return redirect()->route('forum_topic', [
'slug' => $topic->slug,
'id' => $topic->id
])->with(Toastr::success('Post Successfully Posted', 'Yay!', ['options']));
}
/**
* Create a new topic in the forum
* Topic Add Form
*
* @param Request $request
* @param $slug
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function addForm(Request $request, $slug, $id)
{
$forum = Forum::findOrFail($id);
$category = $forum->getCategory();
// The user has the right to create a topic here?
if ($category->getPermission()->start_topic != true) {
return redirect()->route('forum_index')
->with(Toastr::error('You Cannot Start A New Topic Here!', 'Whoops!', ['options']));
}
return view('forum.new_topic', [
'forum' => $forum,
'category' => $category,
'title' => $request->input('title')
]);
}
/**
* Create A New Topic In The Forum
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function newTopic(Request $request, $slug, $id)
{
@@ -318,162 +364,198 @@ class ForumController extends Controller
// The user has the right to create a topic here?
if ($category->getPermission()->start_topic != true) {
return redirect()->route('forum_index')->with(Toastr::error('You Cannot Start A New Topic Here!', 'Whoops!', ['options']));
return redirect()->route('forum_index')
->with(Toastr::error('You Cannot Start A New Topic Here!', 'Whoops!', ['options']));
}
// Preview The Post
$parsedContent = null;
if ($request->isMethod('POST') && $request->input('preview') == true) {
$code = new Decoda($request->input('content'));
$code->defaults();
$code->setXhtml(false);
$code->setStrict(false);
$code->setLineBreaks(true);
$parsedContent = $code->parse();
}
// Create The Topic
$topic = new Topic();
$topic->name = $request->input('title');
$topic->slug = str_slug($request->input('title'));
$topic->state = 'open';
$topic->first_post_user_id = $topic->last_post_user_id = $user->id;
$topic->first_post_user_username = $topic->last_post_user_username = $user->username;
$topic->views = 0;
$topic->pinned = false;
$topic->forum_id = $forum->id;
if ($request->isMethod('POST') && $request->input('post') == true) {
// Create The Topic
$topic = new Topic();
$topic->name = $request->input('title');
$topic->slug = str_slug($request->input('title'));
$topic->state = 'open';
$topic->first_post_user_id = $topic->last_post_user_id = $user->id;
$topic->first_post_user_username = $topic->last_post_user_username = $user->username;
$topic->views = 0;
$topic->pinned = false;
$topic->forum_id = $forum->id;
$v = validator($topic->toArray(), $topic->rules);
if ($v->passes()) {
$topic->save();
$v = validator($topic->toArray(), [
'name' => 'required',
'slug' => 'required',
'state' => 'required',
'num_post' => '',
'first_post_user_id' => 'required',
'first_post_user_username' => 'required',
'last_post_user_id' => '',
'last_post_user_username' => '',
'views' => '',
'pinned' => '',
'forum_id' => 'required'
]);
$post = new Post();
$post->content = $request->input('content');
$post->user_id = $user->id;
$post->topic_id = $topic->id;
$v = validator($post->toArray(), $post->rules);
if ($v->passes()) {
$post->save();
$topic->num_post = 1;
$topic->last_reply_at = $post->created_at;
$topic->save();
$forum->num_topic = $forum->getTopicCount($forum->id);
$forum->num_post = $forum->getPostCount($forum->id);
$forum->last_topic_id = $topic->id;
$forum->last_topic_name = $topic->name;
$forum->last_topic_slug = $topic->slug;
$forum->last_post_user_id = $user->id;
$forum->last_post_user_username = $user->username;
$forum->save();
if ($v->fails()) {
return redirect()->route('forum_index')
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$topic->save();
// Post To ShoutBox
$appurl = config('app.url');
$topicUrl = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}";
$profileUrl = "{$appurl}/{$user->username}.{$user->id}";
$post = new Post();
$post->content = $request->input('content');
$post->user_id = $user->id;
$post->topic_id = $topic->id;
$this->chat->systemMessage("[url={$profileUrl}]{$user->username}[/url] has created a new topic [url={$topicUrl}]{$topic->name}[/url]");
$v = validator($post->toArray(), [
'content' => 'required',
'user_id' => 'required',
'topic_id' => 'required'
]);
//Achievements
$user->unlock(new UserMadeFirstPost(), 1);
$user->addProgress(new UserMade25Posts(), 1);
$user->addProgress(new UserMade50Posts(), 1);
$user->addProgress(new UserMade100Posts(), 1);
$user->addProgress(new UserMade200Posts(), 1);
$user->addProgress(new UserMade300Posts(), 1);
$user->addProgress(new UserMade400Posts(), 1);
$user->addProgress(new UserMade500Posts(), 1);
$user->addProgress(new UserMade600Posts(), 1);
$user->addProgress(new UserMade700Posts(), 1);
$user->addProgress(new UserMade800Posts(), 1);
$user->addProgress(new UserMade900Posts(), 1);
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id]);
} else {
// Unable to save the first post doc delete the topic
Toastr::error('You Did Not Meet All The Requirments For Creating A Yopic!', 'Whoops!', ['options']);
$topic->delete();
}
if ($v->fails()) {
return redirect()->route('forum_index')
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
Toastr::error('A Error Has Occured With This Topic! Please Try Again!', 'Whoops!', ['options']);
$post->save();
$topic->num_post = 1;
$topic->last_reply_at = $post->created_at;
$topic->save();
$forum->num_topic = $forum->getTopicCount($forum->id);
$forum->num_post = $forum->getPostCount($forum->id);
$forum->last_topic_id = $topic->id;
$forum->last_topic_name = $topic->name;
$forum->last_topic_slug = $topic->slug;
$forum->last_post_user_id = $user->id;
$forum->last_post_user_username = $user->username;
$forum->save();
// Post To ShoutBox
$appurl = config('app.url');
$topicUrl = "{$appurl}/forums/topic/{$topic->slug}.{$topic->id}";
$profileUrl = "{$appurl}/{$user->username}.{$user->id}";
$this->chat->systemMessage("[url={$profileUrl}]{$user->username}[/url] has created a new topic [url={$topicUrl}]{$topic->name}[/url]");
//Achievements
$user->unlock(new UserMadeFirstPost(), 1);
$user->addProgress(new UserMade25Posts(), 1);
$user->addProgress(new UserMade50Posts(), 1);
$user->addProgress(new UserMade100Posts(), 1);
$user->addProgress(new UserMade200Posts(), 1);
$user->addProgress(new UserMade300Posts(), 1);
$user->addProgress(new UserMade400Posts(), 1);
$user->addProgress(new UserMade500Posts(), 1);
$user->addProgress(new UserMade600Posts(), 1);
$user->addProgress(new UserMade700Posts(), 1);
$user->addProgress(new UserMade800Posts(), 1);
$user->addProgress(new UserMade900Posts(), 1);
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('Topic Created Successfully!', 'Yay!', ['options']));
}
}
return view('forum.new_topic', ['forum' => $forum, 'category' => $category, 'parsedContent' => $parsedContent, 'title' => $request->input('title'), 'content' => $request->input('content')]);
}
/**
* Edit topic in the forum
* Topic Edit Form
*
* @param $slug
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function editForm($slug, $id)
{
$topic = Topic::findOrFail($id);
$categories = Forum::where('parent_id', '!=', 0)->get();
return view('forum.edit_topic', ['topic' => $topic, 'categories' => $categories]);
}
/**
* Edit Topic In The Forum
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function editTopic(Request $request, $slug, $id)
{
$user = auth()->user();
$topic = Topic::findOrFail($id);
$categories = Forum::where('parent_id', '!=', 0)->get();
if ($user->group->is_modo) {
if ($request->isMethod('POST')) {
$name = $request->input('name');
$forum_id = $request->input('forum_id');
$name = $request->input('name');
$forum_id = $request->input('forum_id');
$topic->name = $name;
$topic->forum_id = $forum_id;
$topic->save();
$topic->name = $name;
$topic->forum_id = $forum_id;
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::success('Topic Successfully Edited', 'Yay!', ['options']));
} else {
return view('forum.edit_topic', ['topic' => $topic, 'categories' => $categories]);
}
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('Topic Successfully Edited', 'Yay!', ['options']));
} else {
abort(403, 'Unauthorized action.');
}
}
/**
* Edit user's post
* Edit Post Form
*
* @param $slug
* @param $id
* @param $postId
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function postEditForm($slug, $id, $postId)
{
$topic = Topic::findOrFail($id);
$forum = $topic->forum;
$category = $forum->getCategory();
$post = Post::findOrFail($postId);
return view('forum.post_edit', [
'topic' => $topic,
'forum' => $forum,
'post' => $post,
'category' => $category,
]);
}
/**
* Edit A Post In A Topic
*
* @param Request $request
* @param $slug
* @param $id
* @param $postId
* @return Illuminate\Http\RedirectResponse
*/
public function postEdit(Request $request, $slug, $id, $postId)
{
$user = auth()->user();
$topic = Topic::findOrFail($id);
$forum = $topic->forum;
$category = $forum->getCategory();
$post = Post::findOrFail($postId);
$parsedContent = null;
if ($user->group->is_modo == false) {
if ($post->user_id != $user->id) {
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::error('You Cannot Edit This!', 'Whoops!', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::error('You Cannot Edit This!', 'Whoops!', ['options']));
}
}
$post->content = $request->input('content');
$post->save();
// Post preview
if ($request->isMethod('POST') && $request->input('preview') == true) {
$post->content = $request->input('content');
$code = new Decoda($post->content);
$code->defaults();
$parsedContent = $code->parse();
}
if ($request->isMethod('POST') && $request->input('post') == true) {
$post->content = $request->input('content');
$post->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id]);
}
return view('forum.post_edit', ['user' => $user, 'topic' => $topic, 'forum' => $forum, 'post' => $post, 'category' => $category, 'parsedContent' => $parsedContent]);
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('Post Successfully Edited!', 'Yay!', ['options']));
}
/**
* Delete user's post
* Delete A Post
*
* @param $slug
* @param $id
* @param $postId
* @return Illuminate\Http\RedirectResponse
*/
public function postDelete($slug, $id, $postId)
{
@@ -483,21 +565,23 @@ class ForumController extends Controller
if ($user->group->is_modo == false) {
if ($post->user_id != $user->id) {
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::error('You Cannot Delete This!', 'Whoops!', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::error('You Cannot Delete This!', 'Whoops!', ['options']));
}
}
$post->delete();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::success('This Post Is Now Deleted!', 'Success', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('This Post Is Now Deleted!', 'Success', ['options']));
}
/**
* Close The Topic
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function closeTopic($slug, $id)
{
@@ -505,32 +589,33 @@ class ForumController extends Controller
$topic->state = "close";
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::error('This Topic Is Now Closed!', 'Warning', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::error('This Topic Is Now Closed!', 'Warning', ['options']));
}
/**
* Open The Topic
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function openTopic($slug, $id)
{
$topic = Topic::findOrFail($id);
$topic->state = "open";
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::success('This Topic Is Now Open!', 'Success', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('This Topic Is Now Open!', 'Success', ['options']));
}
/**
* Delete the topic and the posts
* Delete The Topic and The Posts
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function deleteTopic($slug, $id)
{
@@ -540,51 +625,54 @@ class ForumController extends Controller
$posts = $topic->posts();
$posts->delete();
$topic->delete();
return redirect()->route('forum_display', ['slug' => $topic->forum->slug, 'id' => $topic->forum->id])->with(Toastr::error('This Topic Is Now Deleted!', 'Warning', ['options']));
return redirect()->route('forum_display', ['slug' => $topic->forum->slug, 'id' => $topic->forum->id])
->with(Toastr::error('This Topic Is Now Deleted!', 'Warning', ['options']));
} else {
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::error('You Do Not Have Access To Perform This Function!', 'Warning', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::error('You Do Not Have Access To Perform This Function!', 'Warning', ['options']));
}
}
/**
* Pin The Topic
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function pinTopic($slug, $id)
{
$topic = Topic::findOrFail($id);
$topic->pinned = 1;
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::success('This Topic Is Now Pinned!', 'Success', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('This Topic Is Now Pinned!', 'Success', ['options']));
}
/**
* Unpin The Topic
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function unpinTopic($slug, $id)
{
$topic = Topic::findOrFail($id);
$topic->pinned = 0;
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::success('This Topic Is Now Unpinned!', 'Success', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::success('This Topic Is Now Unpinned!', 'Success', ['options']));
}
/**
* Forum Tag System
*
* @access public
* @param $slug
* @param $id
* @return Redirect to forum_topic
* @return Illuminate\Http\RedirectResponse
*/
public function approvedTopic($slug, $id)
{
@@ -596,7 +684,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function deniedTopic($slug, $id)
@@ -609,7 +698,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function solvedTopic($slug, $id)
@@ -622,7 +712,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function invalidTopic($slug, $id)
@@ -635,7 +726,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function bugTopic($slug, $id)
@@ -648,7 +740,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function suggestionTopic($slug, $id)
@@ -661,7 +754,8 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
public function implementedTopic($slug, $id)
@@ -674,9 +768,16 @@ class ForumController extends Controller
}
$topic->save();
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
return redirect()->route('forum_topic', ['slug' => $topic->slug, 'id' => $topic->id])
->with(Toastr::info('Label Change Has Been Applied', 'Info', ['options']));
}
/**
* Like A Post
*
* @param $postId
* @return Illuminate\Http\RedirectResponse
*/
public function likePost($postId)
{
$post = Post::findOrFail($postId);
@@ -685,9 +786,11 @@ class ForumController extends Controller
$dislike = $user->likes()->where('post_id', $post->id)->where('dislike', 1)->first();
if ($like || $dislike) {
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::error('You have already liked/disliked this post!', 'Bro', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::error('You have already liked/disliked this post!', 'Bro', ['options']));
} elseif ($user->id == $post->user_id) {
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::error('You cannot like your own post!', 'Umm', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::error('You cannot like your own post!', 'Umm', ['options']));
} else {
$new = new Like();
$new->user_id = $user->id;
@@ -695,10 +798,17 @@ class ForumController extends Controller
$new->like = 1;
$new->save();
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::success('Like Successfully Applied!', 'Yay', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::success('Like Successfully Applied!', 'Yay', ['options']));
}
}
/**
* Dislike A Post
*
* @param $postId
* @return Illuminate\Http\RedirectResponse
*/
public function dislikePost($postId)
{
$post = Post::findOrFail($postId);
@@ -707,9 +817,11 @@ class ForumController extends Controller
$dislike = $user->likes()->where('post_id', $post->id)->where('dislike', 1)->first();
if ($like || $dislike) {
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::error('You have already liked/disliked this post!', 'Bro', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::error('You have already liked/disliked this post!', 'Bro', ['options']));
} elseif ($user->id == $post->user_id) {
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::error('You cannot like your own post!', 'Umm', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::error('You cannot like your own post!', 'Umm', ['options']));
} else {
$new = new Like();
$new->user_id = $user->id;
@@ -717,7 +829,8 @@ class ForumController extends Controller
$new->dislike = 1;
$new->save();
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])->with(Toastr::success('Dislike Successfully Applied!', 'Yay', ['options']));
return redirect()->route('forum_topic', ['slug' => $post->topic->slug, 'id' => $post->topic->id])
->with(Toastr::success('Dislike Successfully Applied!', 'Yay', ['options']));
}
}
}
+21 -17
View File
@@ -27,11 +27,14 @@ class InviteController extends Controller
public function invite()
{
$user = auth()->user();
if (config('other.invite-only') == false) {
Toastr::error('Invitations Are Disabled Due To Open Registration!', 'Whoops!', ['options']);
return redirect()->route('home')
->with(Toastr::error('Invitations Are Disabled Due To Open Registration!', 'Whoops!', ['options']));
}
if ($user->can_invite == 0) {
Toastr::error('Your Invite Rights Have Been Revoked!!!', 'Whoops!', ['options']);
return redirect()->route('home')
->with(Toastr::error('Your Invite Rights Have Been Revoked!!!', 'Whoops!', ['options']));
}
return view('user.invite', ['user' => $user]);
}
@@ -42,32 +45,33 @@ class InviteController extends Controller
$user = auth()->user();
$invites_restricted = config('config.invites_restriced', false);
$invite_groups = config('config.invite_groups', []);
if ($invites_restricted && !in_array($user->group->name, $invite_groups)) {
return redirect()->route('invite')->with(Toastr::error('Invites are currently disabled for your userclass.', 'Whoops!', ['options']));
return redirect()->route('invite')
->with(Toastr::error('Invites are currently disabled for your group.', 'Whoops!', ['options']));
}
$exsist = Invite::where('email', $request->input('email'))->first();
$exist = Invite::where('email', $request->input('email'))->first();
$member = User::where('email', $request->input('email'))->first();
if ($exsist || $member) {
return redirect()->route('invite')->with(Toastr::error('The email address your trying to send a invite to has already been sent one or is a user already.', 'Whoops!', ['options']));
if ($exist || $member) {
return redirect()->route('invite')
->with(Toastr::error('The email address your trying to send a invite to has already been sent one or is a used already.', 'Whoops!', ['options']));
}
if ($user->invites > 0) {
// Generate a version 4, truly random, UUID
$code = Uuid::uuid4()->toString();
//create a new invite record
$invite = Invite::create([
'user_id' => $user->id,
'email' => $request->input('email'),
'code' => $code,
'expires_on' => $current->copy()->addDays(config('other.invite_expire')),
'custom' => $request->input('message'),
]);
$invite = new Invite();
$invite->user_id = $user->id;
$invite->email = $request->input('email');
$invite->code = $code;
$invite->expires_on = $current->copy()->addDays(config('other.invite_expire'));
$invite->custom = $request->input('message');
$invite->save();
// send the email
Mail::to($request->input('email'))->send(new InviteUser($invite));
// subtract 1 invite
$user->invites -= 1;
$user->save();
+1 -5
View File
@@ -17,11 +17,7 @@ use App\Rss;
use App\Torrent;
use App\User;
/**
* File upload management
*
*
*/
/*TODO Finish RSS System*/
class RssController extends Controller
{
private $userID = 0;
@@ -15,6 +15,7 @@ namespace App\Http\Controllers\Staff;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Article;
use Image;
use \Toastr;
class ArticleController extends Controller
@@ -55,18 +56,14 @@ class ArticleController extends Controller
$article->content = $request->input('content');
$article->user_id = auth()->user()->id;
if ($request->hasFile('image') && $request->file('image')->getError() == 0) {
if ($request->hasFile('image')) {
$image = $request->file('image');
if (in_array($image->getClientOriginalExtension(), ['jpg', 'JPG', 'jpeg', 'bmp', 'png', 'PNG', 'tiff', 'gif']) && preg_match('#image/*#', $image->getMimeType())) {
$filename = 'article-' . uniqid() . '.' . $image->getClientOriginalExtension();
$path = public_path('/files/img/' . $filename);
Image::make($image->getRealPath())->fit(100, 100)->encode('png', 100)->save($path);
} else {
// Image null or wrong format
$article->image = null;
}
$filename = 'article-' . uniqid() . '.' . $image->getClientOriginalExtension();
$path = public_path('/files/img/' . $filename);
Image::make($image->getRealPath())->fit(75, 75)->encode('png', 100)->save($path);
$article->image = $filename;
} else {
// Error on the image so null
// Use Default /public/img/missing-image.jpg
$article->image = null;
}
@@ -74,18 +71,15 @@ class ArticleController extends Controller
'title' => 'required',
'slug' => 'required',
'content' => 'required|min:100',
'user_id' => 'required'
'user_id' => 'required',
'image' => 'required'
]);
if ($v->fails()) {
// Delete the image because the validation failed
if (file_exists($request->file('image')->move(getcwd() . '/files/img/' . $article->image))) {
unlink($request->file('image')->move(getcwd() . '/files/img/' . $article->image));
}
return redirect()->route('staff_article_index')
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
auth()->user()->articles()->save($article);
$article->save();
return redirect()->route('staff_article_index')
->with(Toastr::success('Your article has successfully published!', 'Yay!', ['options']));
}
@@ -116,38 +110,30 @@ class ArticleController extends Controller
public function edit(Request $request, $slug, $id)
{
$article = Article::findOrFail($id);
$input = $request->all();
$article->title = $input['title'];
$article->title = $request->input('title');
$article->slug = str_slug($article->title);
$article->content = $input['content'];
$article->user_id = auth()->user()->id;
$article->content = $request->input('content');
// Verify that an image was upload
if ($request->hasFile('image') && $request->file('image')->getError() == 0) {
// The file is an image
if (in_array($request->file('image')->getClientOriginalExtension(), ['jpg', 'jpeg', 'bmp', 'png', 'tiff'])) {
// Move and add the name to the object that will be saved
$article->image = 'article-' . uniqid() . '.' . $request->file('image')->getClientOriginalExtension();
$request->file('image')->move(getcwd() . '/files/img/', $article->image);
} else {
// Image null or wrong format
$article->image = null;
}
if ($request->hasFile('image')) {
$image = $request->file('image');
$filename = 'article-' . uniqid() . '.' . $image->getClientOriginalExtension();
$path = public_path('/files/img/' . $filename);
Image::make($image->getRealPath())->fit(75, 75)->encode('png', 100)->save($path);
$article->image = $filename;
} else {
// Error on the image so null
// Use Default /public/img/missing-image.jpg
$article->image = null;
}
$v = validator($article->toArray(), [
'title' => 'required',
'slug' => 'required',
'content' => 'required|min:100',
'user_id' => 'required'
'content' => 'required|min:100'
]);
if ($v->fails()) {
return redirect()->route('staff_article_index')
->with(Toastr::error('Your article changes have failed to publish!', 'Whoops!', ['options']));
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$article->save();
return redirect()->route('staff_article_index')
@@ -21,6 +21,11 @@ use Exception;
class BackupController extends Controller
{
/**
* Display All Backups
*
* @return Illuminate\Http\RedirectResponse
*/
public function index()
{
if (!count(config('backup.backup.destination.disks'))) {
@@ -57,6 +62,11 @@ class BackupController extends Controller
return view('Staff.backup.backup', $this->data);
}
/**
* Create A Backup
*
* @return Illuminate\Http\RedirectResponse
*/
public function create()
{
try {
@@ -77,7 +87,10 @@ class BackupController extends Controller
}
/**
* Downloads a backup zip file.
* Download A Backup
*
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function download(Request $request)
{
@@ -99,7 +112,11 @@ class BackupController extends Controller
}
/**
* Deletes a backup file.
* Deletes A Backup
*
* @param Request $request
* @param $file_name
* @return Illuminate\Http\RedirectResponse
*/
public function delete(Request $request, $file_name)
{
+2 -2
View File
@@ -37,7 +37,7 @@ class BanController extends Controller
}
/**
* Ban the user (current_group -> banned)
* Ban A User (current_group -> banned)
*
* @param Request $request
* @param $username
@@ -91,7 +91,7 @@ class BanController extends Controller
/**
* Unban the user (banned -> new group)
* Unban A User (banned -> new_group)
*
* @param Request $request
* @param $username
@@ -21,9 +21,9 @@ use \Toastr;
class CatalogController extends Controller
{
/**
* Catalog Group System
*
* Get All Catalogs
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getCatalogs()
{
@@ -31,7 +31,12 @@ class CatalogController extends Controller
return view('Staff.catalog.catalogs', ['catalogs' => $catalogs]);
}
//Add New Catalog
/**
* Create A Catalog
*
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function postCatalog(Request $request)
{
$v = validator($request->all(), [
@@ -39,27 +44,25 @@ class CatalogController extends Controller
]);
$catalog = Catalog::where('name', $request->input('catalog'))->first();
if ($catalog) {
return redirect()->route('catalogs')->with(Toastr::error('Catalog ' . $catalog->name . ' is already in database', 'Whoops!', ['options']));
return redirect()->route('catalogs')
->with(Toastr::error('Catalog ' . $catalog->name . ' is already in database', 'Whoops!', ['options']));
}
$catalog = new Catalog();
$catalog->name = $request->input('catalog');
$catalog->slug = str_slug($request->input('catalog'));
$catalog->save();
return redirect()->route('getCatalog')->with(Toastr::success('Catalog ' . $request->input('catalog') . ' has been successfully added', 'Yay!', ['options']));
return redirect()->route('getCatalog')
->with(Toastr::success('Catalog ' . $request->input('catalog') . ' has been successfully added', 'Yay!', ['options']));
}
//Delete Catalog
public function deleteCatalog($catalog_id)
{
$catalog = Catalog::findOrFail($catalog_id);
if (!$catalog) {
return redirect()->route('getCatalog')->with(Toastr::error('That Catalog Is Not In Our DB!', 'Whoops!', ['options']));
}
$catalog->delete();
return redirect()->route('getCatalog')->with(Toastr::success('Catalog ' . $catalog->name . ' has been successfully deleted', 'Yay!', ['options']));
}
//Edit Catalog
/**
* Edit A Catalog
*
* @param Request $request
* @param $catalog_id
* @return Illuminate\Http\RedirectResponse
*/
public function editCatalog(Request $request, $catalog_id)
{
$v = validator($request->all(), [
@@ -67,13 +70,34 @@ class CatalogController extends Controller
]);
$catalog = Catalog::findOrFail($catalog_id);
if (!$catalog) {
return redirect()->route('getCatalog')->with(Toastr::error('Catalog ' . $request->input('catalog') . ' is not in our DB!', 'Whoops!', ['options']));
return redirect()->route('getCatalog')
->with(Toastr::error('Catalog ' . $request->input('catalog') . ' is not in our DB!', 'Whoops!', ['options']));
}
$catalog->name = $request->input('catalog');
$catalog->save();
return redirect()->route('getCatalog')->with(Toastr::success('Catalog ' . $request->input('catalog') . ' has been successfully edited', 'Yay!', ['options']));
return redirect()->route('getCatalog')
->with(Toastr::success('Catalog ' . $request->input('catalog') . ' has been successfully edited', 'Yay!', ['options']));
}
/**
* Delete A Catalog
*
* @param $catalog_id
* @return Illuminate\Http\RedirectResponse
*/
public function deleteCatalog($catalog_id)
{
$catalog = Catalog::findOrFail($catalog_id);
if (!$catalog) {
return redirect()->route('getCatalog')
->with(Toastr::error('That Catalog Is Not In Our DB!', 'Whoops!', ['options']));
}
$catalog->delete();
return redirect()->route('getCatalog')
->with(Toastr::success('Catalog ' . $catalog->name . ' has been successfully deleted', 'Yay!', ['options']));
}
/**
* Catalog Torrent System
*
@@ -19,7 +19,6 @@ use \Toastr;
class CategoryController extends Controller
{
/**
* Get The Categories
*
@@ -136,6 +135,6 @@ class CategoryController extends Controller
$category = Category::findOrFail($id);
$category->delete();
return redirect()->route('staff_category_index')
->with(Toastr::success('Category Sucessfully Deleted', 'Yay!', ['options']));
->with(Toastr::success('Category Successfully Deleted', 'Yay!', ['options']));
}
}
@@ -20,13 +20,12 @@ use \Toastr;
class FlushController extends Controller
{
/**
* Delete all old peers from database
* Delete All Old Peers From Database
*
* @return Illuminate\Http\RedirectResponse
*/
public function deleteOldPeers()
{
// Deleting old peers from the database
foreach (Peer::all() as $peer) {
if ((time() - strtotime($peer->updated_at)) > (60 * 60)) {
$history = History::where("info_hash", $peer->info_hash)->where("user_id", $peer->user_id)->first();
+53 -15
View File
@@ -25,6 +25,7 @@ class ForumController extends Controller
/**
* Show Forums
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
@@ -34,15 +35,29 @@ class ForumController extends Controller
}
/**
* Add A Forum
* Forum Add Form
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function add(Request $request)
public function addForm()
{
$categories = Forum::where('parent_id', 0)->get();
$groups = Group::all();
if ($request->isMethod('POST')) {
return view('Staff.forum.add', ['categories' => $categories, 'groups' => $groups]);
}
/**
* Add A Forum
*
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function add(Request $request)
{
$parentForum = Forum::findOrFail($request->input('parent_id'));
$groups = Group::all();
$forum = new Forum();
$forum->name = $request->input('title');
$forum->position = $request->input('position');
@@ -73,22 +88,43 @@ class ForumController extends Controller
$perm->save();
}
return redirect()->route('staff_forum_index')->with(Toastr::success('Forum has been created successfully', 'Yay!', ['options']));
}
return view('Staff.forum.add', ['categories' => $categories, 'groups' => $groups]);
return redirect()->route('staff_forum_index')
->with(Toastr::success('Forum has been created successfully', 'Yay!', ['options']));
}
/**
* Forum Edit Form
*
* @param $slug
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function editForm($slug, $id)
{
$forum = Forum::findOrFail($id);
$categories = Forum::where('parent_id', 0)->get();
$groups = Group::all();
return view('Staff.forum.edit', [
'categories' => $categories,
'groups' => $groups,
'forum' => $forum
]);
}
/**
* Edit A Forum
*
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function edit(Request $request, $slug, $id)
{
$categories = Forum::where('parent_id', 0)->get();
$groups = Group::all();
$forum = Forum::findOrFail($id);
if ($request->isMethod('POST')) {
$groups = Group::all();
$forum->name = $request->input('title');
$forum->position = $request->input('position');
$forum->slug = str_slug($request->input('title'));
@@ -119,15 +155,16 @@ class ForumController extends Controller
$perm->save();
}
return redirect()->route('staff_forum_index')->with(Toastr::success('Forum has been edited successfully', 'Yay!', ['options']));
}
return view('Staff.forum.edit', ['categories' => $categories, 'groups' => $groups, 'forum' => $forum]);
return redirect()->route('staff_forum_index')
->with(Toastr::success('Forum has been edited successfully', 'Yay!', ['options']));
}
/**
* Delete A Forum
*
*
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function delete($slug, $id)
{
@@ -176,6 +213,7 @@ class ForumController extends Controller
}
$forum->delete();
}
return redirect()->route('staff_forum_index')->with(Toastr::success('Forum has been deleted successfully', 'Yay!', ['options']));
return redirect()->route('staff_forum_index')
->with(Toastr::success('Forum has been deleted successfully', 'Yay!', ['options']));
}
}
@@ -19,7 +19,6 @@ use \Toastr;
class GiftController extends Controller
{
/**
* Send Gift Form
*
@@ -28,7 +27,8 @@ class GiftController extends Controller
public function index()
{
$users = User::oldest('username')->get();
return view('Staff.gift.index', compact('users'));
return view('Staff.gift.index', ['users' => $users]);
}
/**
@@ -61,7 +61,7 @@ class GiftController extends Controller
if (!$recipient) {
return redirect()->route('systemGift')
->with(Toastr::error('Unable to find specified user', 'Whoops!', ['options']));
->with(Toastr::error('Unable To Find Specified User', 'Whoops!', ['options']));
}
$recipient->seedbonus += $seedbonus;
@@ -21,7 +21,6 @@ use \Toastr;
class GroupsController extends Controller
{
/**
* Get All Groups
*
@@ -45,7 +44,7 @@ class GroupsController extends Controller
}
/**
* Add Group
* Add A Group
*
* @param Request $request
* @return Illuminate\Http\RedirectResponse
@@ -113,7 +112,7 @@ class GroupsController extends Controller
}
/**
* Edit Group
* Edit A Group
*
* @param Request $request
* @param $group
+19 -7
View File
@@ -19,12 +19,11 @@ use App\User;
use App\Client;
use App\Report;
use App\Poll;
use \Toastr;
class HomeController extends Controller
{
/**
* Staff dashboard
* Staff Dashboard Index
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
@@ -58,10 +57,23 @@ class HomeController extends Controller
//Polls
$pollCount = Poll::count();
return view('Staff.home.index', ['num_user' => $num_user, 'banned' => $banned, 'validating' => $validating,
'num_torrent' => $num_torrent, 'pending' => $pending, 'rejected' => $rejected, 'peers' => $peers,
'seeders' => $seeders, 'leechers' => $leechers, 'seedboxes' => $seedboxes,
'highspeed_users' => $highspeed_users, 'highspeed_torrents' => $highspeed_torrents, 'reports' => $reports,
'unsolved' => $unsolved, 'solved' => $solved, 'pollCount' => $pollCount]);
return view('Staff.home.index', [
'num_user' => $num_user,
'banned' => $banned,
'validating' => $validating,
'num_torrent' => $num_torrent,
'pending' => $pending,
'rejected' => $rejected,
'peers' => $peers,
'seeders' => $seeders,
'leechers' => $leechers,
'seedboxes' => $seedboxes,
'highspeed_users' => $highspeed_users,
'highspeed_torrents' => $highspeed_torrents,
'reports' => $reports,
'unsolved' => $unsolved,
'solved' => $solved,
'pollCount' => $pollCount
]);
}
}
@@ -20,7 +20,6 @@ use \Toastr;
class MassPMController extends Controller
{
/**
* Mass PM Form
*
@@ -24,8 +24,9 @@ use \Toastr;
class ModerationController extends Controller
{
/**
* Torrent Moderation.
* Torrent Moderation Panel
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function moderation()
{
@@ -35,28 +36,35 @@ class ModerationController extends Controller
$rejected = Torrent::rejected()->get();
$modder = Torrent::where('status', 0)->count();
return view('Staff.torrent.moderation', compact(['current', 'pending', 'postponed', 'rejected', 'modder']));
return view('Staff.torrent.moderation', [
'current' => $current,
'pending' => $pending,
'postponed' => $postponed,
'rejected' => $rejected,
'modder' => $modder
]);
}
/**
* Torrent Moderation -> approve
* Approve A Torrent
*
* @param $slug Slug of the torrent
* @param $id Id of the torrent
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function approve($slug, $id)
{
TorrentHelper::approveHelper($slug, $id);
return redirect()->route('moderation')->with(Toastr::success('Torrent Approved', 'Yay!', ['options']));
return redirect()->route('moderation')
->with(Toastr::success('Torrent Approved', 'Yay!', ['options']));
}
/**
* Torrent Moderation -> postpone
* Postpone A Torrent
*
* @param $request Request containing torrent's id, slug and rejection message
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function postpone(Request $request)
{
@@ -66,33 +74,31 @@ class ModerationController extends Controller
'message' => "required|alpha_dash"
]);
if ($v) {
if ($v->fails()) {
return redirect()->route('moderation')
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$user = auth()->user();
$torrent = Torrent::withAnyStatus()->where('id', $request->input('id'))->first();
$torrent->markPostponed();
PrivateMessage::create([
'sender_id' => $user->id,
'reciever_id' => $torrent->user_id,
'subject' => "Your upload has been postponed by {$user->username}",
'message' => "Greating user, \n\n Your upload {$torrent->username} has been postponed. Please see below the message from the staff member. \n\n{$request->input('message')}"]);
$pm = new PrivateMessage;
$pm->sender_id = $user->id;
$pm->receiver_id = $torrent->user_id;
$pm->subject = "Your upload has been postponed by {$user->username}";
$pm->message = "Greetings, \n\n Your upload {$torrent->username} has been postponed. Please see below the message from the staff member. \n\n{$request->input('message')}";
$pm->save();
return redirect()->route('moderation')->with(Toastr::success('Torrent Postpones', 'Postponed', ['options']));
} else {
$errors = "";
foreach ($v->errors()->all() as $error) {
$errors .= $error . "\n";
}
\Log::notice("Rejection of torrent failed due to: \n\n".$errors);
return redirect()->route('moderation')->with(Toastr::error('Unable to Reject torrent', 'Reject', ['options']));
return redirect()->route('moderation')
->with(Toastr::success('Torrent Postponed', 'Yay!', ['options']));
}
}
/**
* Torrent Moderation -> reject
* Reject A Torrent
*
* @param $request Request containing torrent's id, slug and rejection message
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function reject(Request $request)
{
@@ -102,33 +108,36 @@ class ModerationController extends Controller
'message' => "required|alpha_dash"
]);
if ($v) {
if ($v->fails()) {
return redirect()->route('moderation')
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$user = auth()->user();
$torrent = Torrent::withAnyStatus()->where('id', $request->input('id'))->first();
$torrent->markRejected();
PrivateMessage::create(['sender_id' => $user->id, 'reciever_id' => $torrent->user_id, 'subject' => "Your upload has been rejected by {$user->username}", 'message' => "Greating user, \n\n Your upload {$torrent->username} has been rejected. Please see below the message from the staff member. \n\n{$request->input('message')}"]);
$pm = new PrivateMessage;
$pm->sender_id = $user->id;
$pm->receiver_id = $torrent->user_id;
$pm->subject = "Your upload has been rejected by {$user->username}";
$pm->message = "Greetings, \n\n Your upload {$torrent->username} has been rejected. Please see below the message from the staff member. \n\n{$request->input('message')}";
$pm->save();
return redirect()->route('moderation')->with(Toastr::success('Torrent Rejected', 'Reject', ['options']));
} else {
$errors = "";
foreach ($v->errors()->all() as $error) {
$errors .= $error . "\n";
}
\Log::notice("Rejection of torrent failed due to: \n\n".$errors);
return redirect()->route('moderation')->with(Toastr::error('Unable to Reject torrent', 'Reject', ['options']));
return redirect()->route('moderation')
->with(Toastr::success('Torrent Rejected', 'Yay!', ['options']));
}
}
/**
* Resets the filled and approved attributes on a given request
* @method resetRequest
*
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function resetRequest($id)
{
$user = auth()->user();
// reset code here
if ($user->group->is_modo) {
$torrentRequest = TorrentRequest::findOrFail($id);
$torrentRequest->filled_by = null;
@@ -138,9 +147,11 @@ class ModerationController extends Controller
$torrentRequest->approved_when = null;
$torrentRequest->save();
return redirect()->route('request', ['id' => $id])->with(Toastr::success("The request has been reset!", 'Yay!', ['options']));
return redirect()->route('request', ['id' => $id])
->with(Toastr::success("The request has been reset!", 'Yay!', ['options']));
} else {
return redirect()->route('request', ['id' => $id])->with(Toastr::error("You don't have access to this operation!", 'Whoops!', ['options']));
return redirect()->route('request', ['id' => $id])
->with(Toastr::error("You don't have access to this operation!", 'Whoops!', ['options']));
}
}
}
@@ -19,7 +19,6 @@ use \Toastr;
class PageController extends Controller
{
/**
* Get All Pages
*
@@ -24,7 +24,9 @@ use \Toastr;
class PollController extends Controller
{
/**
* @var ChatRepository
*/
private $chat;
public function __construct(ChatRepository $chat)
@@ -47,7 +49,7 @@ class PollController extends Controller
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function create()
{
@@ -57,8 +59,8 @@ class PollController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param StorePoll $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function store(StorePoll $request)
{
@@ -21,7 +21,7 @@ use \Toastr;
class ReportController extends Controller
{
/**
* Reports System
* Get All Reports
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
@@ -33,6 +33,8 @@ class ReportController extends Controller
}
/**
* Get A Report
*
* @param $report_id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
@@ -46,6 +48,8 @@ class ReportController extends Controller
}
/**
* Solve A Report
*
* @param $report_id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
@@ -61,7 +65,8 @@ class ReportController extends Controller
$report = Report::findOrFail($report_id);
if ($report->solved == 1) {
return redirect()->route('getReports')->with(Toastr::error('This Report Has Already Been Solved', 'Whoops!', ['options']));
return redirect()->route('getReports')
->with(Toastr::error('This Report Has Already Been Solved', 'Whoops!', ['options']));
}
$report->verdict = $request->input('verdict');
@@ -77,6 +82,7 @@ class ReportController extends Controller
$pm->message = $report->verdict;
$pm->save();
return redirect()->route('getReports')->with(Toastr::success('Report has been successfully resolved', 'Yay!', ['options']));
return redirect()->route('getReports')
->with(Toastr::success('Report has been successfully resolved', 'Yay!', ['options']));
}
}
@@ -18,28 +18,26 @@ use App\Torrent;
class TorrentController extends Controller
{
/**
* Affiche la page d'administration des articles
* Get All Torrents
*
* @access public
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
$torrents = Torrent::latest()->paginate(25);
return view('Staff.torrent.index', ['torrents' => $torrents]);
}
/**
* Search for torrents
*
* @access public
* @return View page.torrents
* Search Torrents
*
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function search(Request $request)
{
$search = $request->input('name');
$torrents = Torrent::where([
['name', 'like', '%' . $request->input('name') . '%'],
])->latest()->paginate(25);
+29 -8
View File
@@ -19,7 +19,6 @@ use \Toastr;
class TypeController extends Controller
{
/**
* Get All Types
*
@@ -45,6 +44,8 @@ class TypeController extends Controller
/**
* Add A Type
*
* @param Request $request
* @return Illuminate\Http\RedirectResponse
*/
public function add(Request $request)
{
@@ -52,12 +53,20 @@ class TypeController extends Controller
$type->name = $request->input('name');
$type->slug = str_slug($type->name);
$type->position = $request->input('position');
$v = validator($type->toArray(), $type->rules);
$v = validator($type->toArray(), [
'title' => 'required',
'slug' => 'required',
'position' => 'required'
]);
if ($v->fails()) {
return redirect()->back()->with(Toastr::error('Something Went Wrong!', 'Whoops!', ['options']));
return redirect()->back()
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$type->save();
return redirect()->route('staff_type_index')->with(Toastr::success('Type Sucessfully Added', 'Yay!', ['options']));
return redirect()->route('staff_type_index')
->with(Toastr::success('Type Successfully Added', 'Yay!', ['options']));
}
}
@@ -78,8 +87,10 @@ class TypeController extends Controller
/**
* Edit A Type
*
* @param Request $request
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function edit(Request $request, $slug, $id)
{
@@ -87,12 +98,20 @@ class TypeController extends Controller
$type->name = $request->input('name');
$type->slug = str_slug($type->name);
$type->position = $request->input('position');
$v = validator($type->toArray(), $type->rules);
$v = validator($type->toArray(), [
'title' => 'required',
'slug' => 'required',
'position' => 'required'
]);
if ($v->fails()) {
return redirect()->back()->with(Toastr::error('Something Went Wrong!', 'Whoops!', ['options']));
return redirect()->back()
->with(Toastr::error($v->errors()->toJson(), 'Whoops!', ['options']));
} else {
$type->save();
return redirect()->route('staff_type_index')->with(Toastr::success('Type Sucessfully Modified', 'Yay!', ['options']));
return redirect()->route('staff_type_index')
->with(Toastr::success('Type Successfully Modified', 'Yay!', ['options']));
}
}
@@ -101,12 +120,14 @@ class TypeController extends Controller
*
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function delete($slug, $id)
{
$type = Type::findOrFail($id);
$type->delete();
return redirect()->route('staff_type_index')->with(Toastr::success('Type Sucessfully Deleted', 'Yay!', ['options']));
return redirect()->route('staff_type_index')
->with(Toastr::success('Type Successfully Deleted', 'Yay!', ['options']));
}
}
+56 -23
View File
@@ -32,7 +32,8 @@ use \Toastr;
class UserController extends Controller
{
/**
* Members List
* Users List
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function members()
@@ -42,30 +43,37 @@ class UserController extends Controller
$mods = User::where('group_id', 6)->latest()->paginate(25);
$admins = User::where('group_id', 4)->latest()->paginate(25);
$coders = User::where('group_id', 10)->latest()->paginate(25);
return view('Staff.user.user_search', ['users' => $users, 'uploaders' => $uploaders, 'mods' => $mods, 'admins' => $admins, 'coders' => $coders]);
return view('Staff.user.user_search', [
'users' => $users,
'uploaders' => $uploaders,
'mods' => $mods,
'admins' => $admins,
'coders' => $coders
]);
}
/**
* Search for members
* Search For A User
*
* @access public
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function userSearch(Request $request)
{
$search = $request->input('search');
$users = User::where([
['username', 'like', '%' . $request->input('username') . '%'],
])->paginate(25);
$users->setPath('?username=' . $request->input('username'));
return view('Staff.user.user_results')->with('users', $users);
return view('Staff.user.user_results', ['users' => $users]);
}
/**
* User Edit
* User Edit Form
*
* @access public
* @param $username
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function userSettings($username, $id)
@@ -73,19 +81,27 @@ class UserController extends Controller
$user = User::findOrFail($id);
$groups = Group::all();
$notes = Note::where('user_id', $id)->latest()->paginate(25);
return view('Staff.user.user_edit', ['user' => $user, 'groups' => $groups, 'notes' => $notes]);
return view('Staff.user.user_edit', [
'user' => $user,
'groups' => $groups,
'notes' => $notes
]);
}
/**
* Edit User
* Edit A User
*
* @access public
* @param Request $request
* @param $username
* @param $id
* @@return Illuminate\Http\RedirectResponse
*/
public function userEdit(Request $request, $username, $id)
{
$user = User::findOrFail($id);
$staff = auth()->user();
$groups = Group::all();
$user->username = $request->input('username');
$user->email = $request->input('email');
$user->uploaded = $request->input('uploaded');
@@ -97,18 +113,23 @@ class UserController extends Controller
// Activity Log
\LogActivity::addToLog("Staff Member {$staff->username} has edited {$user->username} account.");
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('Account Was Updated Successfully!', 'Yay!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::success('Account Was Updated Successfully!', 'Yay!', ['options']));
}
/**
* Edit User Permissions
* Edit A Users Permissions
*
* @access public
* @param Request $request
* @param $username
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function userPermissions(Request $request, $username, $id)
{
$user = User::findOrFail($id);
$staff = auth()->user();
$user->can_upload = $request->input('can_upload');
$user->can_download = $request->input('can_download');
$user->can_comment = $request->input('can_comment');
@@ -120,18 +141,23 @@ class UserController extends Controller
// Activity Log
\LogActivity::addToLog("Staff Member {$staff->username} has edited {$user->username} account permissions.");
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('Account Permissions Succesfully Edited', 'Yay!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::success('Account Permissions Succesfully Edited', 'Yay!', ['options']));
}
/**
* Edit User Password
* Edit A Users Password
*
* @access protected
* @param Request $request
* @param $username
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
protected function userPassword(Request $request, $username, $id)
{
$user = User::findOrFail($id);
$staff = auth()->user();
$new_password = $request->input('new_password');
$user->password = Hash::make($new_password);
$user->save();
@@ -139,20 +165,25 @@ class UserController extends Controller
// Activity Log
\LogActivity::addToLog("Staff Member {$staff->username} has changed {$user->username} password.");
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('Account Password Was Updated Successfully!', 'Yay!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])
->with(Toastr::success('Account Password Was Updated Successfully!', 'Yay!', ['options']));
}
/**
* Delete User
* Delete A User
*
* @access protected
* @param $username
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
protected function userDelete($username, $id)
{
$user = User::findOrFail($id);
$staff = auth()->user();
if ($user->group->is_modo || auth()->user()->id == $user->id) {
return redirect()->route('home')->with(Toastr::error('You Cannot Delete Yourself Or Other Staff', 'Whoops!', ['options']));
return redirect()->route('home')
->with(Toastr::error('You Cannot Delete Yourself Or Other Staff', 'Whoops!', ['options']));
} else {
// Removes UserID from Torrents if any and replaces with System UserID (0)
foreach (Torrent::where('user_id', $user->id)->get() as $tor) {
@@ -214,9 +245,11 @@ class UserController extends Controller
\LogActivity::addToLog("Staff Member {$staff->username} has deleted {$user->username} account.");
if ($user->delete()) {
return redirect('staff_dashboard')->with(Toastr::success('Account Has Been Removed', 'Yay!', ['options']));
return redirect('staff_dashboard')
->with(Toastr::success('Account Has Been Removed', 'Yay!', ['options']));
} else {
return redirect('staff_dashboard')->with(Toastr::error('Something Went Wrong!', 'Whoops!', ['options']));
return redirect('staff_dashboard')
->with(Toastr::error('Something Went Wrong!', 'Whoops!', ['options']));
}
}
}
@@ -17,6 +17,9 @@ use GuzzleHttp\Client;
class VersionController extends Controller
{
/**
* @var VersionController
*/
private $version;
public function __construct()
@@ -34,6 +37,7 @@ class VersionController extends Controller
$client = new Client();
$response = json_decode($client->get('//api.github.com/repos/HDInnovations/UNIT3D/releases')->getBody());
$lastestVersion = $response[0]->tag_name;
return response([
'updated' => version_compare($this->version, $lastestVersion, '<') ? false : true,
'latestversion' => $lastestVersion
@@ -20,7 +20,7 @@ class WarningController extends Controller
/**
* Warnings Log
*
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getWarnings()
{
+107 -15
View File
@@ -24,18 +24,13 @@ use Carbon\Carbon;
class StatsController extends Controller
{
/**
* Extra-Stats Manager
* Show Extra-Stats Index
*
*
* @access public
* @return view::make stats.index
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
// Site Stats Block
// Total Members Count
$num_user = cache()->remember('num_user', 60, function () {
return User::all()->count();
@@ -82,17 +77,36 @@ class StatsController extends Controller
$credited_download = cache()->remember('credited_download', 60, function () {
return History::all()->sum('downloaded');
});
$actual_up_down = $actual_upload + $actual_download; //Total Up/Down Traffic without perks
$credited_up_down = $credited_upload + $credited_download; //Total Up/Down Traffic with perks
//Total Up/Down Traffic without perks
$actual_up_down = $actual_upload + $actual_download;
//Total Up/Down Traffic with perks
$credited_up_down = $credited_upload + $credited_download;
return view('stats.index', ['num_user' => $num_user, 'num_torrent' => $num_torrent, 'categories' => $categories, 'num_hd' => $num_hd, 'num_sd' => $num_sd,
'num_seeders' => $num_seeders, 'num_leechers' => $num_leechers, 'num_peers' => $num_peers,
'actual_upload' => $actual_upload, 'actual_download' => $actual_download, 'actual_up_down' => $actual_up_down,
'credited_upload' => $credited_upload, 'credited_download' => $credited_download, 'credited_up_down' => $credited_up_down,
return view('stats.index', [
'num_user' => $num_user,
'num_torrent' => $num_torrent,
'categories' => $categories,
'num_hd' => $num_hd,
'num_sd' => $num_sd,
'num_seeders' => $num_seeders,
'num_leechers' => $num_leechers,
'num_peers' => $num_peers,
'actual_upload' => $actual_upload,
'actual_download' => $actual_download,
'actual_up_down' => $actual_up_down,
'credited_upload' => $credited_upload,
'credited_download' => $credited_download,
'credited_up_down' => $credited_up_down,
]);
}
// USER CATEGORY
//USER CATEGORY
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function uploaded()
{
// Fetch Top Uploaders
@@ -101,6 +115,11 @@ class StatsController extends Controller
return view('stats.users.uploaded', ['uploaded' => $uploaded]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function downloaded()
{
// Fetch Top Downloaders
@@ -109,6 +128,11 @@ class StatsController extends Controller
return view('stats.users.downloaded', ['downloaded' => $downloaded]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function seeders()
{
// Fetch Top Seeders
@@ -117,6 +141,11 @@ class StatsController extends Controller
return view('stats.users.seeders', ['seeders' => $seeders]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function leechers()
{
// Fetch Top Leechers
@@ -125,6 +154,11 @@ class StatsController extends Controller
return view('stats.users.leechers', ['leechers' => $leechers]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function uploaders()
{
// Fetch Top Uploaders
@@ -133,6 +167,11 @@ class StatsController extends Controller
return view('stats.users.uploaders', ['uploaders' => $uploaders]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function bankers()
{
// Fetch Top Bankers
@@ -141,6 +180,11 @@ class StatsController extends Controller
return view('stats.users.bankers', ['bankers' => $bankers]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function seedtime()
{
// Fetch Top Total Seedtime
@@ -149,6 +193,11 @@ class StatsController extends Controller
return view('stats.users.seedtime', ['seedtime' => $seedtime]);
}
/**
* Show Extra-Stats Users
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function seedsize()
{
// Fetch Top Total Seedsize Users
@@ -158,6 +207,12 @@ class StatsController extends Controller
}
//TORRENT CATEGORY
/**
* Show Extra-Stats Torrents
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function seeded()
{
// Fetch Top Seeded
@@ -166,6 +221,11 @@ class StatsController extends Controller
return view('stats.torrents.seeded', ['seeded' => $seeded]);
}
/**
* Show Extra-Stats Torrents
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function leeched()
{
// Fetch Top Leeched
@@ -174,6 +234,11 @@ class StatsController extends Controller
return view('stats.torrents.leeched', ['leeched' => $leeched]);
}
/**
* Show Extra-Stats Torrents
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function completed()
{
// Fetch Top Completed
@@ -182,6 +247,11 @@ class StatsController extends Controller
return view('stats.torrents.completed', ['completed' => $completed]);
}
/**
* Show Extra-Stats Torrents
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function dying()
{
// Fetch Top Dying
@@ -190,6 +260,11 @@ class StatsController extends Controller
return view('stats.torrents.dying', ['dying' => $dying]);
}
/**
* Show Extra-Stats Torrents
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function dead()
{
// Fetch Top Dead
@@ -198,7 +273,13 @@ class StatsController extends Controller
return view('stats.torrents.dead', ['dead' => $dead]);
}
//REQUEST CATEGORY
//TORRENT REQUEST CATEGORY
/**
* Show Extra-Stats Torrent Requests
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function bountied()
{
// Fetch Top Bountied
@@ -208,6 +289,12 @@ class StatsController extends Controller
}
//GROUPS CATEGORY
/**
* Show Extra-Stats Groups
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function groups()
{
// Fetch Groups User Counts
@@ -216,6 +303,11 @@ class StatsController extends Controller
return view('stats.groups.groups', ['groups' => $groups]);
}
/**
* Show Extra-Stats Groups
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function group($id)
{
// Fetch Users In Group
+7 -5
View File
@@ -21,9 +21,9 @@ class ThankController extends Controller
/**
* Thank A Torrent Uploader
*
* @access public
* @return back
*
* @param $slug
* @param $id
* @return Illuminate\Http\RedirectResponse
*/
public function torrentThank($slug, $id)
{
@@ -32,7 +32,8 @@ class ThankController extends Controller
$thank = Thank::where('user_id', $user->id)->where('torrent_id', $torrent->id)->first();
if ($thank) {
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::error('You Have Already Thanked On This Torrent!', 'Whoops!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::error('You Have Already Thanked On This Torrent!', 'Whoops!', ['options']));
}
$thank = new Thank();
@@ -40,6 +41,7 @@ class ThankController extends Controller
$thank->torrent_id = $torrent->id;
$thank->save();
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])->with(Toastr::success('Your Thank Was Successfully Applied!', 'Yay!', ['options']));
return redirect()->route('torrent', ['slug' => $torrent->slug, 'id' => $torrent->id])
->with(Toastr::success('Your Thank Was Successfully Applied!', 'Yay!', ['options']));
}
}
+69 -27
View File
@@ -62,7 +62,7 @@ class TorrentController extends Controller
/**
* Displays Torrent List View
*
* @return Illuminate\Http\RedirectResponse
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function torrents()
{
@@ -72,8 +72,12 @@ class TorrentController extends Controller
$dead = Torrent::where('seeders', 0)->count();
$repository = $this->faceted;
return view('torrent.torrents', ['repository' => $repository, 'torrents' => $torrents, 'user' => $user,
'alive' => $alive, 'dead' => $dead
return view('torrent.torrents', [
'repository' => $repository,
'torrents' => $torrents,
'user' => $user,
'alive' => $alive,
'dead' => $dead
]);
}
@@ -140,8 +144,12 @@ class TorrentController extends Controller
$category = Category::where('id', $category_id)->first();
$torrents = Torrent::where('category_id', $category_id)->where('imdb', $imdb)->latest()->get();
return view('torrent.grouping_results', ['user' => $user, 'torrents' => $torrents, 'imdb' => $imdb,
'category' => $category]);
return view('torrent.grouping_results', [
'user' => $user,
'torrents' => $torrents,
'imdb' => $imdb,
'category' => $category
]);
}
/**
@@ -291,7 +299,13 @@ class TorrentController extends Controller
$helper = new TorrentHelper();
$result = $helper->view($listings);
return ['result' => $result, 'rows' => $rows, 'qty' => $qty, 'active' => $active, 'count' => $count];
return [
'result' => $result,
'rows' => $rows,
'qty' => $qty,
'active' => $active,
'count' => $count
];
}
/**
@@ -375,7 +389,7 @@ class TorrentController extends Controller
$subtitle = null;
$subtitle_crumbs = null;
if ($torrent->mediainfo != null) {
$parser = new \App\Helpers\MediaInfo;
$parser = new MediaInfo;
$parsed = $parser->parse($torrent->mediainfo);
$view_crumbs = $parser->prepareViewCrumbs($parsed);
$general = $parsed['general'];
@@ -389,13 +403,30 @@ class TorrentController extends Controller
$text_crumbs = $view_crumbs['text'];
}
return view('torrent.torrent', ['torrent' => $torrent, 'comments' => $comments, 'thanks' => $thanks,
'user' => $user, 'personal_freeleech' => $personal_freeleech, 'freeleech_token' => $freeleech_token,
'movie' => $movie, 'total_tips' => $total_tips, 'user_tips' => $user_tips, 'client' => $client,
'featured' => $featured, 'general' => $general, 'general_crumbs' => $general_crumbs,
'video_crumbs' => $video_crumbs, 'audio_crumbs' => $audio_crumbs, 'text_crumbs' => $text_crumbs,
'video' => $video, 'audio' => $audio, 'subtitle' => $subtitle, 'settings' => $settings,
'uploader' => $uploader, 'last_seed_activity' => $last_seed_activity]);
return view('torrent.torrent', [
'torrent' => $torrent,
'comments' => $comments,
'thanks' => $thanks,
'user' => $user,
'personal_freeleech' => $personal_freeleech,
'freeleech_token' => $freeleech_token,
'movie' => $movie,
'total_tips' => $total_tips,
'user_tips' => $user_tips,
'client' => $client,
'featured' => $featured,
'general' => $general,
'general_crumbs' => $general_crumbs,
'video_crumbs' => $video_crumbs,
'audio_crumbs' => $audio_crumbs,
'text_crumbs' => $text_crumbs,
'video' => $video,
'audio' => $audio,
'subtitle' => $subtitle,
'settings' => $settings,
'uploader' => $uploader,
'last_seed_activity' => $last_seed_activity
]);
}
/**
@@ -411,8 +442,11 @@ class TorrentController extends Controller
$torrent = Torrent::withAnyStatus()->findOrFail($id);
if ($user->group->is_modo || $user->id == $torrent->user_id) {
return view('torrent.edit_torrent', ['categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'), 'torrent' => $torrent
return view('torrent.edit_torrent', [
'categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'),
'torrent' => $torrent
]);
} else {
abort(403, 'Unauthorized action.');
@@ -604,9 +638,13 @@ class TorrentController extends Controller
{
$user = auth()->user();
return view('torrent.upload', ['categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'), 'user' => $user, 'title' => $title,
'imdb' => str_replace('tt', '', $imdb), 'tmdb' => $tmdb
return view('torrent.upload', [
'categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'),
'user' => $user,
'title' => $title,
'imdb' => str_replace('tt', '', $imdb),
'tmdb' => $tmdb
]);
}
@@ -622,12 +660,16 @@ class TorrentController extends Controller
$requestFile = $request->file('torrent');
if ($request->hasFile('torrent') == false) {
return view('torrent.upload', ['categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'), 'user' => $user])
return view('torrent.upload', [
'categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'),
'user' => $user])
->with(Toastr::error('You Must Provide A Torrent File For Upload!', 'Whoops!', ['options']));
} elseif ($requestFile->getError() != 0 && $requestFile->getClientOriginalExtension() != 'torrent') {
return view('torrent.upload', ['categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'), 'user' => $user])
return view('torrent.upload', [
'categories' => Category::all()->sortBy('position'),
'types' => Type::all()->sortBy('position'),
'user' => $user])
->with(Toastr::error('A Error Has Occurred!', 'Whoops!', ['options']));
}
@@ -973,10 +1015,9 @@ class TorrentController extends Controller
$torrent->featured = "1";
$torrent->save();
$featured = new FeaturedTorrent([
'user_id' => auth()->user()->id,
'torrent_id' => $torrent->id,
]);
$featured = new FeaturedTorrent();
$featured->user_id = $user->id;
$featured->torrent_id = $torrent->id;
$featured->save();
$torrent_url = hrefTorrent($torrent);
@@ -1052,6 +1093,7 @@ class TorrentController extends Controller
$user = auth()->user();
$torrent = Torrent::findOrFail($id);
$reseed = History::where('info_hash', $torrent->info_hash)->where('active', 0)->get();
if ($torrent->seeders <= 2) {
// Send Private Messages
foreach ($reseed as $pm) {
+8 -7
View File
@@ -24,16 +24,11 @@ use App\PrivateMessage;
use App\Follow;
use App\History;
use App\Warning;
use App\BonTransactions;
use \Toastr;
use Image;
use Carbon\Carbon;
/**
* User Management
*
*
*
*/
class UserController extends Controller
{
/**
@@ -79,8 +74,14 @@ class UserController extends Controller
$history = $user->history;
$warnings = Warning::where('user_id', $id)->whereNotNull('torrent')->where('active', 1)->take(3)->get();
$hitrun = Warning::where('user_id', $id)->latest()->paginate(10);
$bonupload = BonTransactions::where('sender', $id)->where([['name', 'like', '%Upload%'],])->sum('cost');
$realupload = $user->uploaded - $bonupload;
$bondownload = BonTransactions::where('sender', $id)->where([['name', 'like', '%Download%'],])->sum('cost');
$realdownload = $user->downloaded - $bondownload;
return view('user.profile', ['user' => $user, 'groups' => $groups, 'followers' => $followers, 'history' => $history, 'warnings' => $warnings, 'hitrun' => $hitrun]);
return view('user.profile', ['user' => $user, 'groups' => $groups, 'followers' => $followers,
'history' => $history, 'warnings' => $warnings, 'hitrun' => $hitrun, 'bonupload' => $bonupload,
'realupload' => $realupload, 'bondownload' => $bondownload, 'realdownload' => $realdownload]);
}
/**
+7 -22
View File
@@ -17,41 +17,26 @@ use Illuminate\Database\Eloquent\Model;
class Invite extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = "invites";
/**
* Mass assignment fields
*
*/
protected $fillable = [
'user_id', 'email', 'code', 'expires_on', 'accepted_by', 'accepted_at', 'custom'
];
/**
* Belongs to User
*
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function sender()
{
return $this->belongsTo(\App\User::class, 'user_id')->withDefault([
return $this->belongsTo(User::class, 'user_id')->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs to User
*
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function reciever()
public function receiver()
{
return $this->belongsTo(\App\User::class, 'accepted_by')->withDefault([
return $this->belongsTo(User::class, 'accepted_by')->withDefault([
'username' => 'System',
'id' => '1'
]);
+12 -2
View File
@@ -16,16 +16,26 @@ use Illuminate\Database\Eloquent\Model;
class Like extends Model
{
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs To A Post
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function post()
{
return $this->belongsTo(\App\Post::class);
return $this->belongsTo(Post::class);
}
}
+7 -2
View File
@@ -17,11 +17,16 @@ use Illuminate\Database\Eloquent\Model;
class LogActivity extends Model
{
/**
* The attributes that are mass assignable.
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'subject', 'url', 'method', 'ip', 'agent', 'user_id'
'subject',
'url',
'method',
'ip',
'agent',
'user_id'
];
}
+12 -8
View File
@@ -17,12 +17,15 @@ use App\Helpers\Bbcode;
class Message extends Model
{
protected $table = 'messages';
/**
* The Attributes That Aren't Mass Assignable
*
* @var array
*/
protected $with = ['user'];
/**
* Fields that are mass assignable
* The Attributes That Are Mass Assignable
*
* @var array
*/
@@ -33,28 +36,29 @@ class Message extends Model
];
/**
* A message belongs to a user
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class);
return $this->belongsTo(User::class);
}
/**
* A message belongs to a chatroom
* Belongs To A Chat Room
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function chatroom()
{
return $this->belongsTo(\App\Chatroom::class);
return $this->belongsTo(Chatroom::class);
}
/**
* Parse content and return valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public static function getMessageHtml($message)
{
+9 -5
View File
@@ -17,29 +17,33 @@ use Illuminate\Database\Eloquent\Model;
class Note extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = "user_notes";
/**
* Belongs to User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function noteduser()
{
return $this->belongsTo(\App\User::class, "user_id")->withDefault([
return $this->belongsTo(User::class, "user_id")->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs to Staff User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function staffuser()
{
return $this->belongsTo(\App\User::class, "staff_id")->withDefault([
return $this->belongsTo(User::class, "staff_id")->withDefault([
'username' => 'System',
'id' => '1'
]);
+11 -1
View File
@@ -16,12 +16,22 @@ use Illuminate\Database\Eloquent\Model;
class Option extends Model
{
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'name'
];
/**
* Belongs To A Poll
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function poll()
{
return $this->belongsTo(\App\Poll::class);
return $this->belongsTo(Poll::class);
}
}
+3 -1
View File
@@ -18,7 +18,9 @@ use App\Helpers\Bbcode;
class Page extends Model
{
/**
* Parse content and return valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getContentHtml()
{
+20 -3
View File
@@ -19,10 +19,25 @@ class Peer extends Model
{
use Sortable;
public $sortable = ['id', 'agent', 'uploaded', 'downloaded', 'left', 'seeder', 'created_at'];
/**
* The Columns That Are Sortable
*
* @var array
*/
public $sortable = [
'id',
'agent',
'uploaded',
'downloaded',
'left',
'seeder',
'created_at'
];
/**
* Belongs to User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
@@ -33,7 +48,9 @@ class Peer extends Model
}
/**
* Belongs to torrent
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrent()
{
+11 -9
View File
@@ -14,30 +14,32 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* Permission of the forums
*
*/
class Permission extends Model
{
/**
* Tells Laravel To Not Maintain The Timestamp Columns
*
* @var boolean
*/
public $timestamps = false;
/**
* Belongs to group
* Belongs To A Group
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function group()
{
return $this->belongsTo(\App\Group::class);
return $this->belongsTo(Group::class);
}
/**
* Belongs to Forum
* Belongs To A Forum
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function forum()
{
return $this->belongsTo(\App\Forum::class);
return $this->belongsTo(Forum::class);
}
}
+1 -7
View File
@@ -17,15 +17,9 @@ use Illuminate\Database\Eloquent\Model;
class PersonalFreeleech extends Model
{
/**
* The database table used by the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'personal_freeleech';
/**
* Mass assignment fields
*
*/
protected $fillable = ['user_id'];
}
+47 -22
View File
@@ -16,6 +16,11 @@ use Illuminate\Database\Eloquent\Model;
class Poll extends Model
{
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'title',
'slug',
@@ -23,38 +28,43 @@ class Poll extends Model
'multiple_choice'
];
protected static function boot()
{
Poll::creating(function ($poll) {
if (empty($poll->slug)) {
$poll->slug = $poll->makeSlugFromTitle($poll->title);
}
return true;
});
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* A Poll Has Many Options
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function options()
{
return $this->hasMany(\App\Option::class);
}
public function voters()
{
return $this->hasMany(\App\Voter::class);
return $this->hasMany(Option::class);
}
/**
* Set the poll's title, adds ? if needed.
* A Poll Has Many Voters
*
* @param string $value
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function voters()
{
return $this->hasMany(Voter::class);
}
/**
* Set The Poll's Title, Adds A Question Mark (?) If Needed
*
* @param $title
* @return string
*/
public function setTitleAttribute($title)
@@ -67,19 +77,24 @@ class Poll extends Model
}
/**
* Create a title slug.
* Create A Poll Title Slug
*
* @param string $title
* @param $title
* @return string
*/
public function makeSlugFromTitle($title)
{
$slug = strlen($title) > 20 ? substr(str_slug($title), 0, 20) : str_slug($title);
$count = $this->where('slug', 'LIKE', "%$slug%")->count();
return $count ? "{$slug}-{$count}" : $slug;
}
/**
* Get Total Votes On A Poll Option
*
* @return string
*/
public function totalVotes()
{
$result = 0;
@@ -88,4 +103,14 @@ class Poll extends Model
}
return $result;
}
protected static function boot()
{
Poll::creating(function ($poll) {
if (empty($poll->slug)) {
$poll->slug = $poll->makeSlugFromTitle($poll->title);
}
return true;
});
}
}
+26 -29
View File
@@ -15,57 +15,45 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Helpers\Bbcode;
/**
* Post new topic Reply to topic
*
*
*/
class Post extends Model
{
/**
* Rules
*
*/
public $rules = [
'content' => 'required',
'user_id' => 'required',
'topic_id' => 'required'
];
/**
* Belongs to Topic
* Belongs To A Topic
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function topic()
{
return $this->belongsTo(\App\Topic::class);
return $this->belongsTo(Topic::class);
}
/**
* Belongs to User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* hasMany Likes
* A Post Has Many Likes
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function likes()
{
return $this->hasMany(\App\Like::class);
return $this->hasMany(Like::class);
}
/**
* Parse content and return valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getContentHtml()
{
@@ -73,14 +61,12 @@ class Post extends Model
}
/**
* Returns the cut content for the home page
* Post Trimming
*
* @access public
* @param $length
* @param ellipses
* @param strip_html Remove HTML tags from string
* @return string Formatted and cutted content
*
* @param $ellipses
* @param $strip_html
* @return string Formatted And Trimmed Content
*/
public function getBrief($length = 100, $ellipses = true, $strip_html = false)
{
@@ -107,15 +93,26 @@ class Post extends Model
return $trimmed_text;
}
/**
* Get A Post From A ID
*
* @return string
*/
public function getPostNumber()
{
return $this->topic->postNumberFromId($this->id);
}
/**
* Get A Posts Page Number
*
* @return string
*/
public function getPageNumber()
{
$result = ($this->getPostNumber() - 1) / 25 + 1;
$result = floor($result);
return $result;
}
}
+9 -3
View File
@@ -18,7 +18,9 @@ use App\Helpers\Bbcode;
class PrivateMessage extends Model
{
/**
* PM Belongs To User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function sender()
{
@@ -29,7 +31,9 @@ class PrivateMessage extends Model
}
/**
* PM Belongs To User
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function receiver()
{
@@ -40,7 +44,9 @@ class PrivateMessage extends Model
}
/**
* Parse Message And Return Valid HTML
* Parse Content And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getMessageHtml()
{
+22 -6
View File
@@ -17,23 +17,29 @@ use Illuminate\Database\Eloquent\Model;
class Report extends Model
{
/**
* The database table used by the model.
* The Attributes That Aren't Mass Assignable
*
* @var string
* @var array
*/
protected $table = "reports";
protected $guarded = [
'id'
];
/**
* Mass assignment fields
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
protected $guarded = ['id'];
public function torrent()
{
return $this->belongsTo(Torrent::class, 'torrent_id');
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function reporter()
{
return $this->belongsTo(User::class, 'reporter_id')->withDefault([
@@ -42,6 +48,11 @@ class Report extends Model
]);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function reported()
{
return $this->belongsTo(User::class, 'reported_user')->withDefault([
@@ -50,6 +61,11 @@ class Report extends Model
]);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function staff()
{
return $this->belongsTo(User::class, 'staff_id')->withDefault([
+8 -9
View File
@@ -16,21 +16,20 @@ use Illuminate\Database\Eloquent\Model;
class Tag extends Model
{
/**
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = false;
public $rules = [
'content' => 'required|unique:tags',
'slug' => 'required|unique:tags',
];
/**
* HABTM Torrent
*
* Belongs To Many Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function torrents()
{
return $this->belongsToMany(\App\Torrent::class);
return $this->belongsToMany(Torrent::class);
}
}
+1 -3
View File
@@ -16,7 +16,5 @@ use Illuminate\Database\Eloquent\Model;
class Thank extends Model
{
protected $fillable = [
'user_id', 'torrent_id'
];
//
}
+20 -19
View File
@@ -16,36 +16,31 @@ use Illuminate\Database\Eloquent\Model;
class Topic extends Model
{
public $rules = [
'name' => 'required',
'slug' => 'required',
'state' => 'required',
'num_post' => '',
'first_post_user_id' => 'required',
'first_post_user_username' => 'required',
'last_post_user_id' => '',
'last_post_user_username' => '',
'views' => '',
'pinned' => '',
'forum_id' => 'required',
];
/**
* Belongs to Forum
*
* Belongs To A Forum
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function forum()
{
return $this->belongsTo(\App\Forum::class);
return $this->belongsTo(Forum::class);
}
/**
* Has Many Posts
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function posts()
{
return $this->hasMany(\App\Post::class);
return $this->hasMany(Post::class);
}
/**
* Does User Have Permission To View Topic
*
* @return string
*/
public function viewable()
{
if (auth()->user()->group->is_modo) {
@@ -55,6 +50,12 @@ class Topic extends Model
return $this->forum->getPermission()->read_topic;
}
/**
* Get Post Number From ID
*
* @param $searchId
* @return string
*/
public function postNumberFromId($searchId)
{
$count = 0;
+130 -83
View File
@@ -15,7 +15,6 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
use Hootlex\Moderation\Moderatable;
use Kyslik\ColumnSortable\Sortable;
use App\Helpers\MediaInfo;
use App\Helpers\StringHelper;
use App\Helpers\Bbcode;
@@ -29,10 +28,25 @@ class Torrent extends Model
use Moderatable;
use Sortable;
public $sortable = ['id', 'name', 'size', 'seeders', 'leechers', 'times_completed', 'created_at'];
/**
* The Columns That Are Sortable
*
* @var array
*/
public $sortable = [
'id',
'name',
'size',
'seeders',
'leechers',
'times_completed',
'created_at'
];
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
@@ -44,6 +58,8 @@ class Torrent extends Model
/**
* Belongs To A Category
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function category()
{
@@ -52,54 +68,18 @@ class Torrent extends Model
/**
* Belongs To A Type
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function type()
{
return $this->belongsTo(Type::class);
}
/**
* Has Many Files
*/
public function files()
{
return $this->hasMany(TorrentFile::class);
}
/**
* Has Many Comments
*/
public function comments()
{
return $this->hasMany(Comment::class);
}
/**
* Has Many Peers
*/
public function peers()
{
return $this->hasMany(Peer::class);
}
/**
* Has Many Tags
*/
public function tags()
{
return $this->belongsToMany(Tag::class);
}
/**
* Relationship To A Single Request
*/
public function request()
{
return $this->hasOne(TorrentRequest::class, 'filled_hash', 'info_hash');
}
/**
* Torrent Has Been Moderated By
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function moderated()
{
@@ -110,7 +90,109 @@ class Torrent extends Model
}
/**
* Formats The Output Of The Description
* One Title Belongs To Many Catalogs
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function catalogs()
{
return $this->belongsToMany(Catalog::class)->withTimestamps();
}
/**
* Has Many Tags
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function tags()
{
return $this->belongsToMany(Tag::class);
}
/**
* Has Many History
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function history()
{
return $this->hasMany(History::class, "info_hash", "info_hash");
}
/**
* Has Many Thank
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function thanks()
{
return $this->hasMany(Thank::class);
}
/**
* Has Many HitRuns
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function hitrun()
{
return $this->hasMany(Warning::class, 'torrent');
}
/**
* Has Many Featured
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function featured()
{
return $this->hasMany(FeaturedTorrent::class);
}
/**
* Has Many Files
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function files()
{
return $this->hasMany(TorrentFile::class);
}
/**
* Has Many Comments
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function comments()
{
return $this->hasMany(Comment::class);
}
/**
* Has Many Peers
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function peers()
{
return $this->hasMany(Peer::class);
}
/**
* Relationship To A Single Request
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function request()
{
return $this->hasOne(TorrentRequest::class, 'filled_hash', 'info_hash');
}
/**
* Parse Description And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getDescriptionHtml()
{
@@ -119,6 +201,8 @@ class Torrent extends Model
/**
* Formats The Output Of The Media Info Dump
*
* @return array
*/
public function getMediaInfo()
{
@@ -129,6 +213,8 @@ class Torrent extends Model
/**
* Returns The Size In Human Format
*
* @return string
*/
public function getSize($bytes = null, $precision = 2)
{
@@ -146,52 +232,13 @@ class Torrent extends Model
->first() ? true : false;
}
/**
* One Title Belongs To Many Catalogs
*/
public function catalogs()
{
return $this->belongsToMany(Catalog::class)->withTimestamps();
}
/**
* Has Many History
*/
public function history()
{
return $this->hasMany(History::class, "info_hash", "info_hash");
}
/**
* Has Many Thank
*/
public function thanks()
{
return $this->hasMany(Thank::class);
}
/**
* Has Many HitRuns
*/
public function hitrun()
{
return $this->hasMany(Warning::class, 'torrent');
}
/**
* Has Many Featured
*/
public function featured()
{
return $this->hasMany(FeaturedTorrent::class);
}
/**
* Torrent Is Freeleech
*/
public function isFreeleech($user = null)
{
$pfree = $user ? $user->group->is_freeleech || PersonalFreeleech::where('user_id', '=', $user->id)->first() : false;
return $this->free || config('other.freeleech') || $pfree;
}
}
+15 -7
View File
@@ -17,19 +17,24 @@ use App\Helpers\StringHelper;
class TorrentFile extends Model
{
/**
* The Database Table Used By The Model
*/
protected $table = 'files';
/**
* Disable Dates
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = false;
/**
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'files';
/**
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrent()
{
@@ -38,10 +43,13 @@ class TorrentFile extends Model
/**
* Return Size In Human Format
*
* @return string
*/
public function getSize($bytes = null, $precision = 2)
{
$bytes = $this->size;
return StringHelper::formatBytes($bytes, 2);
}
}
+11 -6
View File
@@ -17,21 +17,21 @@ use Illuminate\Database\Eloquent\Model;
class TwoStepAuth extends Model
{
/**
* The table associated with the model.
* The Database Table Used By The Model
*
* @var string
*/
protected $table = 'twostep_auth';
/**
* Indicates if the model should be timestamped.
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = true;
/**
* The attributes that are not mass assignable.
* The Attributes That Are Not Mass Assignable.
*
* @var array
*/
@@ -40,7 +40,7 @@ class TwoStepAuth extends Model
];
/**
* The attributes that should be mutated to dates.
* The Attributes That Should Be Mutated To Dates
*
* @var array
*/
@@ -52,7 +52,7 @@ class TwoStepAuth extends Model
];
/**
* Fillable fields for a Profile.
* The Attributes That Are Mass Assignable
*
* @var array
*/
@@ -65,6 +65,11 @@ class TwoStepAuth extends Model
'authDate',
];
/**
* The Attributes That Should Be Casted To Native Types
*
* @var array
*/
protected $casts = [
'userId' => 'integer',
'authCode' => 'string',
@@ -75,7 +80,7 @@ class TwoStepAuth extends Model
/**
* Get a validator for an incoming Request.
*
* @param array $merge (rules to optionally merge)
* @param array $merge (rules to optionally merge)
*
* @return array
*/
+11 -15
View File
@@ -16,34 +16,30 @@ use Illuminate\Database\Eloquent\Model;
class Type extends Model
{
/**
* Indicates If The Model Should Be Timestamped
*
* @var bool
*/
public $timestamps = false;
/**
* Validation rules
*
*/
public $rules = [
'name' => 'required',
'slug' => 'required',
'position' => 'required'
];
/**
* Has many torrents
*
* Has Many Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function torrents()
{
return $this->hasMany(\App\Torrent::class);
return $this->hasMany(Torrent::class);
}
/**
* Has many requests
* Has Many Torrent Requests
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function requests()
{
return $this->hasMany(\App\TorrentRequest::class);
return $this->hasMany(TorrentRequest::class);
}
}
+287 -233
View File
@@ -20,91 +20,32 @@ use function theodorejb\polycast\to_int;
use App\Helpers\StringHelper;
use App\Helpers\Bbcode;
/**
* User-Related Template
*
*/
class User extends Authenticatable
{
use Notifiable;
use Achiever;
/**
* The attributes excluded from the model's JSON form.
* The Attributes Excluded From The Model's JSON Form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
protected $fillable = ['name', 'email', 'password'];
protected $hidden = [
'password',
'remember_token'
];
/**
* The Attributes That Should Be Mutated To Dates
*
* @var array
*/
protected $dates = ['last_login'];
/**
* A user can have many messages
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function messages()
{
return $this->hasMany(Message::class);
}
/**
* A user can have one chatroom at a time
*/
public function chatroom()
{
return $this->belongsTo(Chatroom::class);
}
/**
* A user has one chat status
*/
public function chatStatus()
{
return $this->belongsTo(ChatStatus::class);
}
/**
* Thanks Given
*
*/
public function thanksGiven()
{
return $this->hasMany(Thank::class, 'user_id', 'id');
}
/**
* Thanks Received
*
*/
public function thanksReceived()
{
return $this->hasManyThrough(Thank::class, Torrent::class);
}
/**
* Is Online?
*
*/
public function isOnline()
{
return cache()->has('user-is-online-' . $this->id);
}
/**
* Polls
*
*/
public function polls()
{
return $this->hasMany(Poll::class);
}
/**
* Belongs to group
* Belongs To A Group
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function group()
{
@@ -112,160 +53,29 @@ class User extends Authenticatable
}
/**
* Has many torrents
* Belongs To A Chatroom
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrents()
public function chatroom()
{
return $this->hasMany(Torrent::class);
return $this->belongsTo(Chatroom::class);
}
/**
* Has send many pms
* Belongs To A Chat Status
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function pm_sender()
public function chatStatus()
{
return $this->hasMany(PrivateMessage::class, "sender_id");
return $this->belongsTo(ChatStatus::class);
}
/**
* Has received many pms
* Belongs To Many Bookmarks
*
*/
public function pm_receiver()
{
return $this->hasMany(PrivateMessage::class, "receiver_id");
}
/**
* Has many peers
*
*/
public function peers()
{
return $this->hasMany(Peer::class);
}
/**
* Has many follow
*
*/
public function follows()
{
return $this->hasMany(Follow::class);
}
/**
* Has many articles
*
*/
public function articles()
{
return $this->hasMany(Article::class);
}
/**
* Has Many Topics
*
*/
public function topics()
{
return $this->hasMany(Topic::class, 'first_post_user_id', 'id');
}
/**
* Has many posts
*
*/
public function posts()
{
return $this->hasMany(Post::class);
}
/**
* Has many Comment
*
*/
public function comments()
{
return $this->hasMany(Comment::class);
}
/**
* Has many created requests
*
*/
public function requests()
{
return $this->hasMany(TorrentRequest::class);
}
/**
* Has approved many requests
*
*/
public function ApprovedRequests()
{
return $this->hasMany(TorrentRequest::class, 'approved_by');
}
/**
* Has filled many requests
*
*/
public function FilledRequests()
{
return $this->hasMany(TorrentRequest::class, 'filled_by');
}
/**
* Has many request Bounties
*
*/
public function requestBounty()
{
return $this->hasMany(TorrentRequestBounty::class);
}
/**
* Has moderated many torrents
*
*/
public function moderated()
{
return $this->hasMany(Torrent::class, 'moderated_by');
}
/**
* Has many Notes
*
*/
public function notes()
{
return $this->hasMany(Note::class, 'user_id');
}
/**
* Has many Reports
*
*/
public function reports()
{
return $this->hasMany(Report::class, 'reporter_id');
}
/**
* Has many solvedReports
*
*/
public function solvedReports()
{
return $this->hasMany(Report::class, 'staff_id');
}
/**
* Get all of bookmarks for the user.
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function bookmarks()
{
@@ -278,50 +88,279 @@ class User extends Authenticatable
}
/**
* Get all of follows for the user.
* Has Many Messages
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function isFollowing($target_id)
public function messages()
{
return (bool)$this->follows()->where('target_id', $target_id)->first(['id']);
return $this->hasMany(Message::class);
}
/*
* Get all history records for the user.
*/
/**
* Has Many Thanks Given
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function thanksGiven()
{
return $this->hasMany(Thank::class, 'user_id', 'id');
}
/**
* Has Many Wish's
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function wishes()
{
return $this->hasMany(Wish::class);
}
/**
* Has Many Thanks Received
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function thanksReceived()
{
return $this->hasManyThrough(Thank::class, Torrent::class);
}
/**
* Has Many Polls
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function polls()
{
return $this->hasMany(Poll::class);
}
/**
* Has Many Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function torrents()
{
return $this->hasMany(Torrent::class);
}
/**
* Has Many Sent PM's
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function pm_sender()
{
return $this->hasMany(PrivateMessage::class, "sender_id");
}
/**
* Has Many Received PM's
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function pm_receiver()
{
return $this->hasMany(PrivateMessage::class, "receiver_id");
}
/**
* Has Many Peers
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function peers()
{
return $this->hasMany(Peer::class);
}
/**
* Has Many Followers
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function follows()
{
return $this->hasMany(Follow::class);
}
/**
* Has Many Articles
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function articles()
{
return $this->hasMany(Article::class);
}
/**
* Has Many Topics
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function topics()
{
return $this->hasMany(Topic::class, 'first_post_user_id', 'id');
}
/**
* Has Many Posts
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function posts()
{
return $this->hasMany(Post::class);
}
/**
* Has Many Comments
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function comments()
{
return $this->hasMany(Comment::class);
}
/**
* Has Many Torrent Requests
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function requests()
{
return $this->hasMany(TorrentRequest::class);
}
/**
* Has Approved Many Torrent Requests
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function ApprovedRequests()
{
return $this->hasMany(TorrentRequest::class, 'approved_by');
}
/**
* Has Filled Many Torrent Requests
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function FilledRequests()
{
return $this->hasMany(TorrentRequest::class, 'filled_by');
}
/**
* Has Many Torrent Request BON Bounties
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function requestBounty()
{
return $this->hasMany(TorrentRequestBounty::class);
}
/**
* Has Moderated Many Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function moderated()
{
return $this->hasMany(Torrent::class, 'moderated_by');
}
/**
* Has Many Notes
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function notes()
{
return $this->hasMany(Note::class, 'user_id');
}
/**
* Has Many Reports
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function reports()
{
return $this->hasMany(Report::class, 'reporter_id');
}
/**
* Has Solved Many Reports
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function solvedReports()
{
return $this->hasMany(Report::class, 'staff_id');
}
/**
* Has Many Torrent History
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function history()
{
return $this->hasMany(History::class, "user_id");
}
/*
* Get all records of user bans.
*/
/**
* Has Many Bans
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function userban()
{
return $this->hasMany(Ban::class, "owned_by");
}
/*
* Get all the bans a staff member has actioned.
*/
/**
* Has Given Many Bans
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function staffban()
{
return $this->hasMany(Ban::class, "created_by");
}
/**
* Has Given Many Warnings
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function staffwarning()
{
return $this->hasMany(Warning::class, 'warned_by');
}
/**
* Has Many Warnings
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function userwarning()
{
return $this->hasMany(Warning::class, 'user_id');
}
/**
* Has many invites
* Has Given Many Invites
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function sentInvite()
{
@@ -329,8 +368,9 @@ class User extends Authenticatable
}
/**
* Has many invites
* Has Recieved Many Invites
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function recievedInvite()
{
@@ -338,8 +378,9 @@ class User extends Authenticatable
}
/**
* Has many featured
* Has Many Featured Torrents
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function featuredTorrent()
{
@@ -347,14 +388,26 @@ class User extends Authenticatable
}
/**
* Has many likes
* Has Many Post Likes
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function likes()
{
return $this->hasMany(Like::class);
}
/**
* Get All Followers Of A User
*
* @param $target_id
* @return string
*/
public function isFollowing($target_id)
{
return (bool)$this->follows()->where('target_id', $target_id)->first(['id']);
}
/**
* Return Upload In Human Format
*/
@@ -446,8 +499,9 @@ class User extends Authenticatable
}
/**
* Parse content and return valid HTML
* Parse About Me And Return Valid HTML
*
* @return string Parsed BBCODE To HTML
*/
public function getAboutHtml()
{
@@ -545,12 +599,12 @@ class User extends Authenticatable
}
/**
* Gets the users wishes
* Is A User Online?
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
* @return string
*/
public function wishes()
public function isOnline()
{
return $this->hasMany(Wish::class);
return cache()->has('user-is-online-' . $this->id);
}
}
+5 -5
View File
@@ -16,11 +16,11 @@ use Illuminate\Database\Eloquent\Model;
class UserActivation extends Model
{
protected $fillable = [
'user_id',
'token',
];
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id')->withDefault([
+17 -3
View File
@@ -16,21 +16,35 @@ use Illuminate\Database\Eloquent\Model;
class Voter extends Model
{
/**
* The Attributes That Are Mass Assignable
*
* @var array
*/
protected $fillable = [
'poll_id',
'user_id',
'ip_address'
];
/**
* Belongs To A Poll
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function poll()
{
return $this->belongsTo(\App\Poll::class);
return $this->belongsTo(Poll::class);
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(\App\User::class)->withDefault([
return $this->belongsTo(User::class)->withDefault([
'username' => 'System',
'id' => '1'
]);
+15 -19
View File
@@ -17,40 +17,36 @@ use Illuminate\Database\Eloquent\Model;
class Warning extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = "warnings";
/**
* Mass assignment fields
*
*/
protected $fillable = [
'user_id', 'warned_by', 'torrent', 'reason', 'expires_on', 'active'
];
/**
* Belongs to Torrent
* Belongs To A Torrent
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function torrenttitle()
{
return $this->belongsTo(\App\Torrent::class, 'torrent');
return $this->belongsTo(Torrent::class, 'torrent');
}
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function warneduser()
{
return $this->belongsTo(\App\User::class, 'user_id')->withDefault([
return $this->belongsTo(User::class, 'user_id')->withDefault([
'username' => 'System',
'id' => '1'
]);
}
/**
* Belongs To A USer
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function staffuser()
{
return $this->belongsTo(\App\User::class, 'warned_by')->withDefault([
return $this->belongsTo(User::class, 'warned_by')->withDefault([
'username' => 'System',
'id' => '1'
]);
+10
View File
@@ -16,8 +16,18 @@ use Illuminate\Database\Eloquent\Model;
class Wish extends Model
{
/**
* The Attributes That Aren't Mass Assignable
*
* @var array
*/
protected $guarded = [];
/**
* Belongs To A User
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class)->withDefault([
+1 -1
View File
@@ -25,7 +25,7 @@
@section('content')
<div class="container box">
<h2>Add A Article</h2>
<form role="form" method="POST" action="{{ route('staff_article_add') }}">
<form role="form" method="POST" action="{{ route('staff_article_add') }}" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="form-group">
<label for="title">Title</label>
+1 -1
View File
@@ -26,7 +26,7 @@
@section('content')
<div class="container box">
<h2>Add a post</h2>
<form role="form" method="POST"
<form role="form" method="POST" enctype="multipart/form-data"
action="{{ route('staff_article_edit',['slug' => $article->slug, 'id' => $article->id]) }}">
{{ csrf_field() }}
<div class="form-group">
+4 -3
View File
@@ -15,7 +15,7 @@
</a>
</li>
<li class="active">
<a href="{{ route('staff_forum_add') }}" itemprop="url" class="l-breadcrumb-item-link">
<a href="{{ route('staff_forum_add_form') }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">Add Forums</span>
</a>
</li>
@@ -25,7 +25,8 @@
<div class="container box">
<h2>Add a new Forum</h2>
{{ Form::open(array('route' => 'staff_forum_add')) }}
<form role="form" method="POST" action="{{ route('staff_forum_add') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="forum_type">Forum Type</label>
<select name="forum_type" class="form-control">
@@ -86,6 +87,6 @@
</table>
<button type="submit" class="btn btn-default">Save Forum</button>
{{ Form::close() }}
</form>
</div>
@endsection
+4 -3
View File
@@ -15,7 +15,7 @@
</a>
</li>
<li class="active">
<a href="{{ route('staff_dashboard') }}" itemprop="url" class="l-breadcrumb-item-link">
<a href="{{ route('staff_forum_edit_form', ['slug' => $forum->slug, 'id' => $forum->id]) }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">Edit Forums</span>
</a>
</li>
@@ -25,7 +25,8 @@
<div class="container box">
<h2>Edit: {{ $forum->name }}</h2>
{{ Form::open(array('route' => array('staff_forum_edit', 'slug' => $forum->slug, 'id' => $forum->id))) }}
<form role="form" method="POST" action="{{ route('staff_forum_edit', ['slug' => $forum->slug, 'id' => $forum->id]) }}">
{{ csrf_field() }}
<div class="form-group">
<label for="title">Title</label>
<input type="text" name="title" class="form-control" value="{{ $forum->name }}">
@@ -108,6 +109,6 @@
</table>
<button type="submit" class="btn btn-default">Save Forum</button>
{{ Form::close() }}
</form>
</div>
@endsection
@@ -67,9 +67,9 @@
</td>
<td>
@if($invite->accepted_by != null)
<a class="view-user" data-id="{{ $invite->reciever->id }}"
data-slug="{{ $invite->reciever->username }}"
href="{{ route('profile', ['username' => $invite->reciever->username, 'id' => $invite->reciever->id]) }}">{{ $invite->reciever->username }}</a>
<a class="view-user" data-id="{{ $invite->receiver->id }}"
data-slug="{{ $invite->receiver->username }}"
href="{{ route('profile', ['username' => $invite->receiver->username, 'id' => $invite->receiver->id]) }}">{{ $invite->receiver->username }}</a>
@else
N/A
@endif
+17 -28
View File
@@ -3,36 +3,30 @@
<head>
<meta charset="UTF-8">
<title>{{ trans('auth.login') }} - {{ config('other.title') }}</title>
<!-- Meta -->
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{{ config('other.title') }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- /Meta -->
@section('meta')
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{{ config('other.title') }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@show
<link rel="shortcut icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ mix('css/main/login.css') }}">
</head>
<body>
<div class="wrapper fadeInDown">
<svg viewBox="0 0 1320 100">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle"
x="50%" y="50%" dy=".35em">
{{ config('other.title') }}
</text>
</symbol>
<!-- Duplicate symbols -->
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
@@ -43,47 +37,41 @@
></use>
<use xlink:href="#s-text" class="text"
></use>
</svg>
<div id="formContent">
<!-- Tabs Titles -->
<a href="{{ route('login') }}"><h2 class="active">{{ trans('auth.login') }} </h2></a>
<a href="{{ route('register') }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }} </h2></a>
<a href="{{ route('registrationForm', ['code' => 'null']) }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }} </h2></a>
<!-- Icon -->
<div class="fadeIn first">
<img src="{{ url('/img/icon.svg') }}" id="icon" alt="{{ trans('auth.user-icon') }}"/>
</div>
<!-- Login Form -->
<form role="form" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<label for="username" class="col-md-4 control-label">{{ trans('auth.username') }}</label>
<div class="col-md-6">
<input id="username" type="text" class="form-control" name="username" value="{{ old('username') }}"
required autofocus>
@if ($errors->has('username'))
<br>
<span class="help-block text-red">
<strong>{{ $errors->first('username') }}</strong>
</span>
<strong>{{ $errors->first('username') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">{{ trans('auth.password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
@if ($errors->has('password'))
<br>
<span class="help-block text-red">
<strong>{{ $errors->first('password') }}</strong>
</span>
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
@@ -101,7 +89,6 @@
<button type="submit" class="fadeIn fourth" id="login-button">{{ trans('auth.login') }}</button>
</form>
<!-- Remind Passowrd -->
<div id="formFooter">
<a href="{{ route('password.request') }}"><h2
class="inactive underlineHover">{{ trans('auth.lost-password') }} </h2></a>
@@ -110,7 +97,9 @@
</div>
</div>
</div>
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
{!! Toastr::message() !!}
</body>
</html>
+10 -21
View File
@@ -1,9 +1,8 @@
<!DOCTYPE html>
<html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="UTF-8">
<title>{{ trans('auth.lost-password') }} - {{ config('other.title') }}</title>
<!-- Meta -->
@section('meta')
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
@@ -13,12 +12,9 @@
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@show
<!-- /Meta -->
@show
<link rel="shortcut icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ url('css/main/login.css?v=02') }}">
</head>
@@ -30,16 +26,12 @@
</div>
@endif
<svg viewBox="0 0 1320 100">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle"
x="50%" y="50%" dy=".35em">
{{ config('other.title') }}
</text>
</symbol>
<!-- Duplicate symbols -->
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
@@ -50,40 +42,37 @@
></use>
<use xlink:href="#s-text" class="text"
></use>
</svg>
<div id="formContent">
<!-- Tabs Titles -->
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }}</h2></a>
<a href="{{ route('register') }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }}</h2></a>
<!-- Icon -->
<div id="formContent">
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }}</h2></a>
<a href="{{ route('registrationForm', ['code' => 'null']) }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }}</h2></a>
<div class="fadeIn first">
<img src="{{ url('/img/icon.svg') }}" id="icon" alt="{{ trans('auth.user-icon') }}"/>
</div>
<!-- SignUp Form -->
<form class="form-horizontal" role="form" method="POST" action="{{ route('password.email') }}">
{{ csrf_field() }}
<input type="email" id="email" class="fadeIn third" name="email" placeholder="email" required autofocus>
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
<button type="submit" class="fadeIn fourth">{{ trans('common.submit') }}</button>
</form>
<!-- Remind Passowrd -->
<div id="formFooter">
<a href="{{ route('password.request') }}"><h2 class="active">{{ trans('auth.lost-password') }} </h2></a>
<a href="{{ route('username.request') }}"><h2
class="inactive underlineHover">{{ trans('auth.lost-username') }} </h2></a>
</div>
</div>
</div>
<script type="text/javascript" src="{{ url('js/vendor/app.js?v=04') }}"></script>
{!! Toastr::message() !!}
</body>
</html>
+8 -18
View File
@@ -1,9 +1,8 @@
<!DOCTYPE html>
<html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="UTF-8">
<title>{{ trans('auth.lost-password') }} - {{ config('other.title') }}</title>
<!-- Meta -->
@section('meta')
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
@@ -13,12 +12,9 @@
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@show
<!-- /Meta -->
@show
<link rel="shortcut icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ url('css/main/login.css?v=02') }}">
</head>
@@ -30,16 +26,12 @@
</div>
@endif
<svg viewBox="0 0 1320 100">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle"
x="50%" y="50%" dy=".35em">
{{ config('other.title') }}
</text>
</symbol>
<!-- Duplicate symbols -->
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
@@ -50,18 +42,16 @@
></use>
<use xlink:href="#s-text" class="text"
></use>
</svg>
<div id="formContent">
<!-- Tabs Titles -->
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }} </h2></a>
<a href="{{ route('register') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }} </h2></a>
<!-- Icon -->
<a href="{{ route('registrationForm', ['code' => 'null']) }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }} </h2></a>
<div class="fadeIn first">
<img src="{{ url('/img/icon.svg') }}" id="icon" alt="{{ trans('auth.user-icon') }}"/>
</div>
<!-- SignUp Form -->
<form class="form-horizontal" role="form" method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
@@ -87,13 +77,13 @@
<div id="formFooter">
<a href="{{ route('password.request') }}"><h2 class="active">{{ trans('auth.lost-password') }} </h2></a>
<a href="{{ route('username.request') }}"><h2
class="inactive underlineHover">{{ trans('auth.lost-username') }} </h2></a>
<a href="{{ route('username.request') }}"><h2 class="inactive underlineHover">{{ trans('auth.lost-username') }} </h2></a>
</div>
</div>
</div>
<script type="text/javascript" src="{{ url('js/app.js') }}"></script>
{!! Toastr::message() !!}
</body>
</html>
+26 -35
View File
@@ -1,22 +1,20 @@
<!DOCTYPE html>
<html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="UTF-8">
<title>{{ trans('auth.signup') }} - {{ config('other.title') }}</title>
<!-- Meta -->
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{{ config('other.title') }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- /Meta -->
@section('meta')
<meta name="description"
content="{{ trans('auth.login-now-on') }} {{ config('other.title') }} . {{ trans('auth.not-a-member') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{{ config('other.title') }}">
<meta property="og:type" content="website">
<meta property="og:image" content="{{ url('/img/rlm.png') }}">
<meta property="og:url" content="{{ url('/') }}">
<meta name="csrf-token" content="{{ csrf_token() }}">
@show
<link rel="shortcut icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url('/favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" href="{{ mix('css/main/login.css') }}">
</head>
@@ -28,16 +26,12 @@
</div>
@endif
<svg viewBox="0 0 1320 100">
<!-- Symbol -->
<symbol id="s-text">
<text text-anchor="middle"
x="50%" y="50%" dy=".35em">
{{ config('other.title') }}
</text>
</symbol>
<!-- Duplicate symbols -->
<use xlink:href="#s-text" class="text"
></use>
<use xlink:href="#s-text" class="text"
@@ -48,44 +42,41 @@
></use>
<use xlink:href="#s-text" class="text"
></use>
</svg>
<div id="formContent">
<!-- Tabs Titles -->
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }} </h2></a>
<a href="{{ route('register') }}"><h2 class="active">{{ trans('auth.signup') }} </h2></a>
<!-- Icon -->
<div id="formContent">
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }} </h2></a>
<a href="{{ route('registrationForm', ['code' => $code]) }}"><h2 class="active">{{ trans('auth.signup') }} </h2></a>
<div class="fadeIn first">
<img src="{{ url('/img/icon.svg') }}" id="icon" alt="{{ trans('auth.user-icon') }}"/>
</div>
<!-- SignUp Form -->
<form role="form" method="POST" action="{{ route('register',['code' => $code]) }}">
<form role="form" method="POST" action="{{ route('register', ['code' => $code]) }}">
{{ csrf_field() }}
<input type="text" id="username" class="fadeIn second" name="username"
placeholder="{{ trans('auth.username') }}" required autofocus>
@if ($errors->has('username'))
<br>
<span class="help-block text-red">
<strong>{{ $errors->first('username') }}</strong>
</span>
<strong>{{ $errors->first('username') }}</strong>
</span>
@endif
<input type="email" id="email" class="fadeIn third" name="email" placeholder="{{ trans('auth.email') }}"
required>
@if ($errors->has('email'))
<br>
<span class="help-block text-red">
<strong>{{ $errors->first('email') }}</strong>
</span>
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
<input type="password" id="password" class="fadeIn third" name="password"
placeholder="{{ trans('auth.password') }}" required>
@if ($errors->has('password'))
<br>
<span class="help-block text-red">
<strong>{{ $errors->first('password') }}</strong>
</span>
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
@if (config('captcha.enabled') == true)
<div class="text-center">
@@ -94,8 +85,8 @@
<div class="g-recaptcha" data-sitekey="{{ config('captcha.sitekey') }}"></div>
@if ($errors->has('g-recaptcha-response'))
<span class="invalid-feedback" style="display: block;">
<strong>{{ $errors->first('g-recaptcha-response') }}</strong>
</span>
<strong>{{ $errors->first('g-recaptcha-response') }}</strong>
</span>
@endif
</div>
</div>
@@ -104,18 +95,18 @@
<button type="submit" class="fadeIn fourth">{{ trans('auth.signup') }}</button>
</form>
<!-- Remind Passowrd -->
<div id="formFooter">
<a href="{{ route('password.request') }}"><h2
class="inactive underlineHover">{{ trans('auth.lost-password') }} </h2></a>
<a href="{{ route('username.request') }}"><h2
class="inactive underlineHover">{{ trans('auth.lost-username') }} </h2></a>
</div>
</div>
</div>
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
<script src="https://www.google.com/recaptcha/api.js"></script>
{!! Toastr::message() !!}
</body>
</html>
+2 -2
View File
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="UTF-8">
<title>{{ trans('auth.lost-username') }} - {{ config('other.title') }}</title>
@@ -55,7 +55,7 @@
<div id="formContent">
<!-- Tabs Titles -->
<a href="{{ route('login') }}"><h2 class="inactive underlineHover">{{ trans('auth.login') }}</h2></a>
<a href="{{ route('register') }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }}</h2></a>
<a href="{{ route('registrationForm', ['code' => 'null']) }}"><h2 class="inactive underlineHover">{{ trans('auth.signup') }}</h2></a>
<!-- Icon -->
<div class="fadeIn first">
+1 -1
View File
@@ -13,7 +13,7 @@
<div class="panel panel-primary">
<div class="panel-heading">
<h4 class="text-center">{{ trans('bug.bug-report-description') }}</h4></div>
<form role="form" method="POST" action="{{ route('bug') }}">
<form role="form" method="POST" action="{{ route('postBug') }}">
<table class="table table-bordered">
<tbody>
{{ csrf_field() }}
+1 -1
View File
@@ -29,7 +29,7 @@
<h1 class="f-display-info-title">{{ $forum->name }}</h1>
<p class="f-display-info-description">{{ $forum->description }}
@if($category->getPermission()->start_topic == true)
<a href="{{ route('forum_new_topic', array('slug' => $forum->slug, 'id' => $forum->id)) }}"
<a href="{{ route('forum_new_topic_form', ['slug' => $forum->slug, 'id' => $forum->id]) }}"
class="btn btn-primary" style="float:right;">{{ trans('forum.create-new-topic') }}</a>
@endif
</p>
+1 -1
View File
@@ -21,7 +21,7 @@
<div class="box container">
<span class="badge-user" style="float: right;"><strong>{{ trans('forum.forums') }}:</strong> {{ $num_forums }} | <strong>{{ trans('forum.topics') }}
:</strong> {{ $num_topics }} | <strong>{{ trans('forum.posts') }}:</strong> {{ $num_posts }}</span>
<form role="form" method="POST" action="{{ route('forum_search') }}">
<form role="form" method="GET" action="{{ route('forum_search') }}">
{{ csrf_field() }}
<input type="text" name="name" id="name" placeholder="{{ trans('forum.topic-quick-search') }}"
class="form-control">
+5 -13
View File
@@ -19,13 +19,13 @@
</a>
</li>
<li>
<a href="{{ route('forum_display', array('slug' => $forum->slug, 'id' => $forum->id)) }}" itemprop="url"
<a href="{{ route('forum_display', ['slug' => $forum->slug, 'id' => $forum->id]) }}" itemprop="url"
class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">{{ $forum->name }}</span>
</a>
</li>
<li>
<a href="{{ route('forum_new_topic', array('slug' => $forum->slug, 'id' => $forum->id)) }}" itemprop="url"
<a href="{{ route('forum_new_topic_form', ['slug' => $forum->slug, 'id' => $forum->id]) }}" itemprop="url"
class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">{{ trans('forum.create-new-topic') }}</span>
</a>
@@ -34,11 +34,6 @@
@section('content')
<div class="forum box container">
@if(isset($parsedContent))
<div id="content-preview" class="preview col-md-12">@emojione($parsedContent)</div>
<hr>
@endif
<div class="col-md-12">
<h2><span>{{ trans('forum.create-new-topic') }}</span><span id="thread-title">{{ $title }}</span></h2>
<form role="form" method="POST"
@@ -46,18 +41,15 @@
{{ csrf_field() }}
<div class="form-group">
<input id="input-thread-title" type="text" name="title" maxlength="75" class="form-control"
placeholder="{{ trans('forum.topic-title') }}" value="{{ $title }}">
placeholder="{{ trans('forum.topic-title') }}">
</div>
<div class="form-group">
<textarea id="new-thread-content" name="content" cols="30" rows="10"
class="form-control">{{ $content }}</textarea>
class="form-control"></textarea>
</div>
<button type="submit" name="post" value="true" id="post"
class="btn btn-primary">{{ trans('forum.send-new-topic') }}</button>
<button type="submit" name="preview" value="true" id="preview"
class="btn btn-default">{{ trans('common.preview') }}</button>
<button type="submit" class="btn btn-primary">{{ trans('forum.send-new-topic') }}</button>
</form>
</div>
</div>
+2 -16
View File
@@ -9,10 +9,6 @@
<meta name="description" content="{{ $forum->name . ' - ' . trans('forum.edit-post') }}">
@endsection
@section('stylesheets')
@endsection
@section('breadcrumb')
<li>
<a href="{{ route('forum_index') }}" itemprop="url" class="l-breadcrumb-item-link">
@@ -38,7 +34,7 @@
</a>
</li>
<li>
<a href="{{ route('forum_post_edit', array('slug' => $topic->slug, 'id' => $topic->id, 'postId' => $post->id)) }}"
<a href="{{ route('forum_post_edit_form', array('slug' => $topic->slug, 'id' => $topic->id, 'postId' => $post->id)) }}"
itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title"
class="l-breadcrumb-item-link-title">{{ trans('common.edit') }} {{ trans('forum.post') }}</span>
@@ -48,13 +44,6 @@
@section('content')
<div class="forum box container">
@if(isset($parsedContent))
<div class="preview col-md-12">
{{ $parsedContent }}
</div>
<hr>
@endif
<div class="col-md-12">
<h2>{{ trans('common.edit') }} {{ trans('forum.post') }} {{ strtolower(trans('forum.in')) }}
: {{ $forum->name }}</h2>
@@ -65,10 +54,7 @@
<textarea id="content" name="content" cols="30" rows="10"
class="form-control">{{ $post->content }}</textarea>
</div>
<button type="submit" name="post" value="true"
class="btn btn-primary">{{ trans('common.submit') }}</button>
<button type="submit" name="preview" value="true"
class="btn btn-default">{{ trans('common.preview') }}</button>
<button type="submit" class="btn btn-primary">{{ trans('common.submit') }}</button>
</form>
</div>
</div>
+2 -2
View File
@@ -90,7 +90,7 @@
class="btn btn-xs btn-xxs btn-info">{{ trans('forum.quote') }}</button>
@endif
@if(auth()->check() && (auth()->user()->group->is_modo || $p->user_id == auth()->user()->id) && $topic->state == 'open')
<a href="{{ route('forum_post_edit', ['slug' => $topic->slug, 'id' => $topic->id, 'postId' => $p->id]) }}"><button
<a href="{{ route('forum_post_edit_form', ['slug' => $topic->slug, 'id' => $topic->id, 'postId' => $p->id]) }}"><button
class="btn btn-xs btn-xxs btn-warning">{{ trans('common.edit') }}</button></a>
<a href="{{ route('forum_post_delete', ['slug' => $topic->slug, 'id' => $topic->id, 'postId' => $p->id]) }}"><button
class="btn btn-xs btn-xxs btn-danger">{{ trans('common.delete') }}</button></a>
@@ -195,7 +195,7 @@
@endif
@endif
@if(auth()->check() && auth()->user()->group->is_modo)
<a href="{{ route('forum_edit_topic', ['slug' => $topic->slug, 'id' => $topic->id]) }}"
<a href="{{ route('forum_edit_topic_form', ['slug' => $topic->slug, 'id' => $topic->id]) }}"
class="btn btn-warning">{{ trans('forum.edit-topic') }}</a>
<a href="{{ route('forum_delete_topic', ['slug' => $topic->slug, 'id' => $topic->id]) }}"
class="btn btn-danger">{{ trans('forum.delete-topic') }}</a>
+3 -4
View File
@@ -59,9 +59,9 @@
</td>
<td>
@if($record->accepted_by != null)
<a class="view-user" data-id="{{ $record->reciever->id }}"
data-slug="{{ $record->reciever->username }}"
href="{{ route('profile', ['username' => $record->reciever->username, 'id' => $record->reciever->id]) }}">{{ $record->reciever->username }}</a>
<a class="view-user" data-id="{{ $record->receiver->id }}"
data-slug="{{ $record->receiver->username }}"
href="{{ route('profile', ['username' => $record->receiver->username, 'id' => $record->receiver->id]) }}">{{ $record->receiver->username }}</a>
@else
N/A
@endif
@@ -80,7 +80,6 @@
</table>
</div>
</div>
</div>
</div>
@endsection
+6 -6
View File
@@ -194,20 +194,20 @@
<span class="badge-extra text-red" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.download-recorded') }}">{{ $user->getDownloaded() }}</span>
-
<span class="badge-extra text-yellow" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.download-bon') }}">N/A</span> =
<span class="badge-extra text-orange" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.download-true') }}">N/A</span></td>
data-original-title="{{ trans('user.download-bon') }}">{{ App\Helpers\StringHelper::formatBytes($bondownload , 2) }}</span> =
<span class="badge-extra text-blue" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.download-true') }}">{{ App\Helpers\StringHelper::formatBytes($realdownload , 2) }}</span></td>
</tr>
<tr>
<td>{{ trans('torrent.uploaded') }}</td>
<td>
<span class="badge-extra text-green" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.upload-recorded') }}">{{ $user->getUploaded() }}</span> -
<span class="badge-extra text-yellow" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.upload-bon') }}">N/A</span> =
<span class="badge-extra text-orange" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.upload-true') }}">N/A</span></td>
data-original-title="{{ trans('user.upload-bon') }}">{{ App\Helpers\StringHelper::formatBytes($bonupload , 2) }}</span> =
<span class="badge-extra text-blue" data-toggle="tooltip" title=""
data-original-title="{{ trans('user.upload-true') }}">{{ App\Helpers\StringHelper::formatBytes($realupload , 2) }}</span></td>
</tr>
<tr>
<td>{{ trans('common.ratio') }}</td>

Some files were not shown because too many files have changed in this diff Show More