/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->check() && $this->auth->user()->isBanned()) { $this->auth->logout(); return ujs_redirect(route('users.disabled')); } return $next($request); }
public function store(HttpRequest $request, $forum_id) { $this->validate($request, ['title' => 'required', 'body' => 'required']); $forum = Forum::findOrFail($forum_id); $this->authorizePost($forum, null); $topic = Topic::createNew(['forum' => $forum, 'title' => $request->input('title'), 'poster' => Auth::user(), 'body' => $request->input('body'), 'notifyReplies' => false, 'cover' => TopicCover::findForUse(presence($request->input('cover_id')), Auth::user())]); Event::fire(new TopicWasCreated($topic, $topic->posts->last(), Auth::user())); return ujs_redirect(route('forum.topics.show', $topic)); }
public function store(HttpRequest $request, $forum_id) { $this->validate($request, ['title' => 'required', 'body' => 'required']); $forum = Forum::findOrFail($forum_id); $this->authorizePost($forum, null); $topic = Topic::createNew($forum, $request->input('title'), Auth::user(), $request->input('body'), false)->fresh(); Event::fire(new TopicWasCreated($topic, $topic->posts->last(), Auth::user())); return ujs_redirect(route('forum.topics.show', $topic)); }
public function ship() { $order = Store\Order::where('status', 'paid')->where('tracking_code', 'like', 'EJ%')->get(); foreach ($order as $o) { $o->status = 'shipped'; $o->save(); } return ujs_redirect(route('store.admin.orders.index')); }
public function register($id) { $tournament = Tournament::findOrFail($id); $user = Auth::user(); if (!$tournament->isRegistrationOpen()) { return error_popup('registrations are closed!'); } if (!$tournament->isValidRank($user)) { return error_popup('invalid rank!'); } $tournament->register($user); return ujs_redirect("/tournaments/{$id}"); }
public function index() { $host = Request::getHttpHost(); $subdomain = substr($host, 0, strpos($host, '.')); if ($subdomain === 'store') { return ujs_redirect(route('store.products.index')); } if (Auth::check()) { return ujs_redirect(route('forum.forums.index')); } $stats = BanchoStats::whereRaw('banchostats_id mod 10 = 0')->orderBy('banchostats_id', 'DESC')->limit(24 * 60 / 10)->get(); $totalUsers = Count::totalUsers(); $currentOnline = $stats->isEmpty() ? 0 : $stats->last()->users_osu; return view('home.landing', compact('stats', 'totalUsers', 'currentOnline')); }
public function destroy($id) { $post = Post::findOrFail($id); $this->authorizePost($post->forum, $post->topic); if (!$post->canBeDeletedBy(Auth::user())) { abort(403); } $deletedPostPosition = $post->topic->postPosition($post->post_id); $post->topic->removePost($post); $topic = Topic::find($post->topic_id); if ($topic === null) { $redirect = route('forum.forums.show', $post->forum); return ujs_redirect($redirect); } return ['postId' => $post->post_id, 'postPosition' => $deletedPostPosition]; }
public function postCheckout() { $order = $this->userCart(); if (!$order) { return response(["message" => "cart is empty"], 422); } $order->refreshCost(true); if ($order->getTotal() == 0 && Request::input("completed")) { file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}"); return ujs_redirect(action("StoreController@getInvoice", [$order->order_id]) . "?thanks=1"); } return js_view("store.order-create"); }
public function show($id) { $user = User::lookup($id); if ($user === null || !$user->hasProfile()) { abort(404); } if ((string) $user->user_id !== $id) { return ujs_redirect(route('users.show', $user)); } $achievements = json_collection(Achievement::achievable()->orderBy('grouping')->orderBy('ordering')->orderBy('progression')->get(), new AchievementTransformer()); $userArray = json_item($user, new UserTransformer(), ['userAchievements', 'allRankHistories', 'allScores', 'allScoresBest', 'allScoresFirst', 'allStatistics', 'beatmapPlaycounts', 'page', 'recentActivities', 'recentlyReceivedKudosu', 'rankedAndApprovedBeatmapsets.beatmaps', 'favouriteBeatmapsets.beatmaps']); return view('users.show', compact('user', 'userArray', 'achievements')); }
public function voteFeature($topicId) { $star = FeatureVote::createNew(['user_id' => Auth::user()->user_id, 'topic_id' => $topicId]); if ($star->getKey() !== null) { return ujs_redirect(route('forum.topics.show', $topicId)); } else { return error_popup(implode(' ', $star->validationErrors()->allMessages())); } }
public function show($id) { $post = Post::findOrFail($id); priv_check('ForumView', $post->forum)->ensureCan(); return ujs_redirect(post_url($post->topic_id, $post->post_id)); }
// community section (forum will end up being a section of its own) Route::get('/community/forum', function () { return Redirect::to('/forum'); }); Route::resource('livestreams', 'LivestreamsController', ['only' => ['index']]); Route::post('livestreams/promote', ['as' => 'livestreams.promote', 'uses' => 'LivestreamsController@promote']); Route::get('/community/chat', ['as' => 'chat', 'uses' => 'CommunityController@getChat']); Route::get('/community/profile/{id}', function ($id) { return Redirect::route('users.show', $id); }); Route::get('/community/slack', ['as' => 'slack', 'uses' => 'CommunityController@getSlack']); Route::post('/community/slack/agree', ['as' => 'slack.agree', 'uses' => 'CommunityController@postSlackAgree']); Route::resource('matches', 'MatchesController', ['only' => ['show']]); Route::get('/matches/{match}/history', ['as' => 'matches.history', 'uses' => 'MatchesController@history']); Route::get('/mp/{match}', function ($match) { return ujs_redirect(route('matches.show', ['match' => $match])); }); Route::post('users/check-username-availability', ['as' => 'users.check-username-availability', 'uses' => 'UsersController@checkUsernameAvailability']); Route::post('users/login', ['as' => 'users.login', 'uses' => 'UsersController@login']); Route::delete('users/logout', ['as' => 'users.logout', 'uses' => 'UsersController@logout']); Route::get('users/disabled', ['as' => 'users.disabled', 'uses' => 'UsersController@disabled']); // Authentication section (Temporarily set up as replacement/improvement of config("osu.urls.*")) Route::get('users/forgot-password', ['as' => 'users.forgot-password', function () { return Redirect::to('https://osu.ppy.sh/p/forgot'); }]); Route::get('users/register', ['as' => 'users.register', function () { return Redirect::to('https://osu.ppy.sh/p/register'); }]); Route::get('u/{user}', ['as' => 'users.show', 'uses' => 'UsersController@show']); // help section Route::get('/wiki', ['as' => 'wiki', function () {
public function show($id) { $beatmap = Beatmap::findOrFail($id); $set = $beatmap->beatmapset; return ujs_redirect(route('beatmapsets.show', ['beatmap' => $set->beatmapset_id]) . '#' . $beatmap->mode . '/' . $id); }
public function postCheckout() { $order = $this->userCart(); if (!$order) { return response(['message' => 'cart is empty'], 422); } $order->refreshCost(true); if ((double) $order->getTotal() === 0.0 && Request::input('completed')) { file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}"); return ujs_redirect(action('StoreController@getInvoice', [$order->order_id]) . '?thanks=1'); } return js_view('store.order-create'); }
public function postCheckout() { $order = $this->userCart(); if ($order->items()->count() === 0) { return error_popup('cart is empty'); } $order->checkout(); if ((double) $order->getTotal() === 0.0 && Request::input('completed')) { file_get_contents("https://osu.ppy.sh/web/ipn.php?mc_gross=0&item_number=store-{$order->user_id}-{$order->order_id}"); return ujs_redirect(action('StoreController@getInvoice', [$order->order_id]) . '?thanks=1'); } return js_view('store.order-create'); }
public function show($id) { $post = Post::findOrFail($id); $this->authorizeView($post->forum); return ujs_redirect(post_url($post->topic_id, $post->post_id)); }