/** * see `post` * logs you in as anonymous if you are logged out * note: if using api and not logged in you will not be able to process captcha * * @param string $section_title * @return Illuminate\Http\JsonResponse */ public function createJson($section_title) { try { Route::callRouteFilter('auth.token', array(), Route::current(), Request::instance()); } catch (Tappleby\AuthToken\Exceptions\NotAuthorizedException $e) { $anon = $this->anon->make(Input::get('captcha')); if (!$anon->success) { return Response::json(['success' => false, 'errors' => [$anon->errorMessage()], 'item_id' => NULL]); } } $post = $this->post->make(Input::get('section', ''), Input::get('data', ''), Input::get('title', ''), Input::get('url', ''), Input::get('nsfw-tag', 0), Input::get('nsfl-tag', 0), $this->section); return Response::json(['success' => $post->success, 'errors' => $post->errors, 'item_id' => $post->data->item_id]); }
return View::make('404'); }); Route::filter('custom_csrf', function () { $token = Request::ajax() ? Request::header('X-CSRF-Token') : Input::get('_token'); if (Session::token() != $token) { throw new Illuminate\Session\TokenMismatchException(); } }); Route::filter('internal_only', function () { if ($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) { die(var_dump($_SERVER['REMOTE_ADDR'])); } }); App::before(function ($request) { if ($request->getMethod() === 'POST') { Route::callRouteFilter('custom_csrf', array(), '', $request); } }); $btc_price = Bitcoin::toUSD(); View::share('btc_price', $btc_price); $updated_at = strtotime(DB::table('price_hist')->orderBy('id', 'desc')->pluck('created_at')); View::share('updated_at', $updated_at); Bet::checkExpired(); Route::get('logout', function () { Auth::logout(); return Redirect::to('/'); }); Route::get('/', function () { $prices = DB::table('price_hist')->get(); $bets = Bet::available()->paginate(4); $server_time = date('H:i:s');