/** * Get the subdomain parameter value * * @return string|null subdomain parameter value */ private function getSubDomainParameter() { if (\Route::current()) { return \Route::input(config('tenant.subdomain')); } return null; }
/** * Returns the initial HTML view for the admin interface. * * @return Response Response object containing the generated output */ public function indexAction() { $site = \Route::input('site', 'default'); $lang = \Route::input('locale', 'en'); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false); $context = $this->setLocale($context, $site, $lang); $controller = new \Controller_ExtJS_JsonRpc($context, $cntlPaths); $cssFiles = $jsFiles = array(); foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; if (!is_file($jsbAbsPath)) { throw new Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); } $jsb2 = new \MW_Jsb2_Default($jsbAbsPath, dirname($path)); $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js')); } } $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); $adminUrl = route('aimeos_shop_admin', $params); $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token())); $vars = array('lang' => $lang, 'jsFiles' => $jsFiles, 'cssFiles' => $cssFiles, 'languages' => $this->getJsonLanguages($context), 'config' => $this->getJsonClientConfig($context), 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), 'searchSchemas' => $controller->getJsonSearchSchemas(), 'itemSchemas' => $controller->getJsonItemSchemas(), 'smd' => $controller->getJsonSmd($jsonUrl), 'urlTemplate' => urldecode($adminUrl), 'uploaddir' => \Config::get('shop::uploaddir'), 'activeTab' => \Input::get('tab', 0), 'version' => $this->getVersion()); return \View::make('shop::admin.index', $vars); }
public function image() { $key = strip_tags(\Route::input('key')); $key = str_replace('.png', '', $key); if (empty($key)) { return redirect('/'); } else { $result = \DB::table('post')->where('post_key', $key)->first(); if ($result->post_type == 3) { $text = $result->post_message; $text = $this->handleText($text); $image = $this->warpTextImage($text); ob_start(); imagepng($image, null, 9, null); $image = ob_get_contents(); ob_end_clean(); @imagedestroy($image); $response = \Response::make($image); $response->header('Content-Type', 'image/png'); return $response; } else { return redirect('/'); } } }
protected function handleRequest(Request $request) { $fid = \Route::input('id'); $this->forum = Forum::with('perms')->findOrFail($fid); $this->subject = $request->input('req_subject'); $this->message = $request->input('req_message'); }
protected function handleRequest(Request $request) { $fid = \Route::input('id'); $forum = Forum::with('perms')->findOrFail($fid); $this->data['forum'] = $forum; $this->data['action'] = trans('fluxbb::forum.post_topic'); }
/** * Get the subdomain parameter value * * @return string|null subdomain parameter value */ private function getSubDomainParameter() { if (\Route::current() && ($param = \Route::input(config('tenant.subdomain')))) { return $param; } return $this->extractSubdomainFromUrl(); }
protected function handleRequest(Request $request) { $pid = \Route::input('id'); // Fetch some info about the topic $topic = Post::with('author', 'topic')->findOrFail($pid); $this->data['post'] = $post; $this->data['action'] = trans('fluxbb::forum.edit_post'); }
protected function handleRequest(Request $request) { $tid = \Route::input('id'); // Fetch some info about the topic $topic = Topic::with('forum.perms')->findOrFail($tid); $this->data['topic'] = $topic; $this->data['action'] = trans('fluxbb::post.post_a_reply'); }
protected function handleRequest(Request $request) { $tid = \Route::input('id'); // Fetch some info about the topic $topic = Topic::findOrFail($tid); // Make sure post authors and their groups are all loaded $topic->posts->load('author.group'); $this->data['topic'] = $topic; }
protected function handleRequest(Request $request) { $pid = \Route::input('id'); // If a post ID is specified we determine topic ID and page number so we can show the correct message $this->post = Post::findOrFail($pid); // Determine on which page the post is located $numPosts = Post::where('topic_id', '=', $this->post->topic_id)->where('posted', '<', $this->post->posted)->count('id') + 1; $dispPosts = User::current()->dispPosts(); $this->page = ceil($numPosts / $dispPosts); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $taskId = \Route::input('task'); // verify user logged in if (!Auth::user()) { return false; } // // verify if task is user's // $task = Task::own()->first(); // if ($task) { // return true; // } return true; }
/** * Returns the routing parameters passed in the URL * * @return array Associative list of parameters with "site", "locale" and "currency" if available */ protected function getFixedParams() { $fixed = array(); if (($value = \Route::input('site')) !== null) { $fixed['site'] = $value; } if (($value = \Route::input('locale')) !== null) { $fixed['locale'] = $value; } if (($value = \Route::input('currency')) !== null) { $fixed['currency'] = $value; } return $fixed; }
public function __construct(PhoneInterface $phones, PhoneForm $phoneForm, FaxInterface $faxes, Users $users, GroupInterface $groups) { parent::__construct(); $this->users = $users; $this->phones = $phones; $this->faxes = $faxes; $this->phoneForm = $phoneForm; $this->groups = $groups; $id = Route::input('phones'); $resource = 'Faxbox\\Repositories\\Phone\\PhoneInterface'; $admin = Permissions::name($resource, 'admin', $id); $this->beforeFilter('auth'); $this->beforeFilter('accessResource:' . $admin, ['only' => ['delete']]); $this->beforeFilter('accessResource:purchase_numbers', ['except' => ['delete']]); }
/** * URLパラメータのidの存在をチェックする。 * * @return void */ public function existsFilter() { info(__METHOD__ . ' called.'); // URLにパラメータ'id'が存在したら $id = Route::input('id'); if ($id) { logger("todo id({$id}) checking..."); // 指定のIDがtodosテーブルに存在しなかったら if (!Todo::withTrashed()->exists($id)) { logger('Nothing!'); // Webブラウザに404 Not Foundを返す App::abort(404); } logger('Exists!'); } else { logger('url was not contained $id.'); } }
/** * Displays the view * */ public static function get_question() { /* if('name' === Route::currentRouteName()){ $id = 0; $form = 'forms/form2'; }*/ if (Route::input('id')) { $id = Route::input('id'); } elseif ('home' === Route::currentRouteName()) { $id = 1; } else { Log::error('Unable to get question. No question id was located.'); return Redirect::to('error'); } $form = 'forms/form1'; $question = self::$questions[$id]; $restart = route('home'); return View::make('survey', array('question' => $question, 'restart' => $restart))->nest('form', $form, array('url' => "question/{$id}")); }
function index() { $model = base64_decode(\Route::input('model')); dump($model); $r = new \ReflectionClass($model); dd($r->getTraits()); $methods = []; foreach ($r->getMethods() as $method) { if ($method->class == $model) { $methods[] = $this->sourceMethod($method); } } dump($methods); dump($methods = $r->getMethod('messageNotFound')); dump($methods = $r->getMethod('messageNotFound')->getDocComment()); dump($this->sourceMethod($r->getMethod('messageNotFound'))); dump($methods = $r->getMethod('messageNotFound')->class); // $models = rglob('*.php', 0, base_path('vendor/*/*/*/*/Models/')); // dd(111, $models); return $this->response(['rows' => CrudRow::$rows]); }
/** * This function is responsible for displaying the results page. * * It first sends data to the model for insertion into database. * If inserted correctly, displays the results page. */ public function get_results() { if (!($id = Route::input('id'))) { Log::error('Unable to display results. Route ID not found.'); return Redirect::to('error'); } if (!($answers = Session::get('answers'))) { Log::error('Unable to display results. Unable to retreive answers from session.'); return Redirect::to('error'); } if (!($restart = route('home'))) { Log::error('Unable to assign the restart button to a route.'); return Redirect::to('error'); } $responses = self::clean_results($answers); $submission = self::prepare_submission($id, $answers); if (Submission::create_submission($submission)) { return View::make('results', array('heading' => 'Thank you! Your outcome is provided below', 'outcome' => self::$outcomes[$id], 'responses' => $responses, 'restart' => $restart)); } Log::error('Unable to create submission. Database insertion failed'); return Redirect::to('error'); }
/** * Returns the locale item for the current request * * @param \MShop_Context_Item_Interface $context Context object * @return \MShop_Locale_Item_Interface Locale item object */ protected function getLocale(\MShop_Context_Item_Interface $context) { if ($this->locale === null) { $site = \Route::input('site', 'default'); $lang = \Route::input('locale', ''); $currency = \Route::input('currency', ''); $disableSites = $this->config->has('shop.disableSites'); $localeManager = \MShop_Locale_Manager_Factory::createManager($context); $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); } return $this->locale; }
function traitEntityHasMany_item() { if (\Request::method() == 'POST') { $this->traitEntityHasMany_save(); //переоткроем модель $model_name = $this->getClassModel(); if ($model_name::isSoftDelete()) { $model = $model_name::withTrashed()->with($this->relation)->find(\Route::input('id')); } else { $model = $model_name::with($this->relation)->find(\Route::input('id')); } $row_types = ManagerRowType::get(ManagerRowType::makeKey(static::getVendor(), static::getEntity())); $rows = []; foreach ($row_types as $row_type) { $rows[$row_type] = (string) Accessor::factory($model)->row($row_type); } $data = ['models' => [['rows' => $rows, 'model' => $model->toArray(), 'id' => $model->id]], 'vendor' => (string) static::getVendor(), 'entity' => \Str::snake(static::getEntity()), 'message' => sprintf($this->traitEntityHasMany_successMessage(), $model)]; Event::notify('larakit::model_edit-admin', $data); $this->traitAjax_set($data); return $this->traitAjax_response(); } $this->traitAjax_set('id', $this->model->id)->traitAjax_set('result', 'curtain')->traitAjax_set('vendor', (string) \Str::snake($this->getVendor()))->traitAjax_set('entity', (string) \Str::snake($this->getEntity()))->traitAjax_set('model', $this->model->toArray())->traitAjax_set('header', (string) $this->traitEntityHasMany_header())->traitAjax_set('body', (string) $this->traitEntityHasMany_body())->traitAjax_set('footer', (string) $this->traitEntityHasMany_footer()); return $this->traitAjax_response(); }
<?php // Redirect if does content not found if (!($content = App\Content::where('seo_slug', \Route::input('slug'))->first())) { header('Location: ' . url('page/404')); die; } // Save visit $request = \Request::instance(); $user = \Auth::user(); $visit = new App\Visit(['http_url' => $request->fullUrl(), 'http_method' => $request->method(), 'http_path' => $request->path(), 'ip' => $request->ip(), 'content_id' => $content->id, 'user_id' => empty($user) ? null : $user->id]); $visit->save(); return ['content' => App\Content::where('seo_slug', \Route::input('slug'))->first()];
public function canOperation($route, $request) { if (!(Auth::user()->is_admin or Auth::id() == Article::find(Route::input('article'))->user_id)) { return Redirect::to('/'); } }
if ($userId != Session::get('userId') && !$user->hasAccess($value)) { Session::flash('error', trans('Sentinel::users.noaccess')); return Redirect::route('home'); } } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { Session::flash('error', trans('Sentinel::users.notfound')); return Redirect::guest(Config::get('Sentinel::config.routes.login.route')); } }); Route::filter('Sentinel\\inGroup', function ($route, $request, $value) { if (!Sentry::check()) { return Redirect::guest(Config::get('Sentinel::config.routes.login.route')); } // we need to determine if a non admin user // is trying to access their own account. $userId = Route::input('id'); try { $user = Sentry::getUser(); $group = Sentry::findGroupByName($value); if ($userId != Session::get('userId') && !$user->inGroup($group)) { Session::flash('error', trans('Sentinel::users.noaccess')); return Redirect::route('home'); } } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { Session::flash('error', trans('Sentinel::users.notfound')); return Redirect::guest(Config::get('Sentinel::config.routes.login.route')); } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) { Session::flash('error', trans('Sentinel::groups.notfound')); return Redirect::guest(Config::get('Sentinel::config.routes.login.route')); } });
|-------------------------------------------------------------------------- | CSRF Protection Filter |-------------------------------------------------------------------------- | | The CSRF filter is responsible for protecting your application against | cross-site request forgery attacks. If this special token in a user | session does not match the one given in this request, we'll bail. | */ Route::filter('csrf', function () { if (Session::token() != Input::get('_token')) { throw new Illuminate\Session\TokenMismatchException(); } }); /* |-------------------------------------------------------------------------- | Roles & Permissions Filters |-------------------------------------------------------------------------- | */ Entrust::routeNeedsRole('admin', ['Administrator', 'Users Manager', 'Premium Author', 'Author', 'Eraser'], Redirect::to('/'), false); Entrust::routeNeedsPermission('admin/xcasts*', ['manage_premium_casts', 'manage_free_casts', 'delete_casts'], Redirect::to('admin'), false); Entrust::routeNeedsPermission('admin/series*', ['manage_series', 'delete_series'], Redirect::to('admin'), false); Entrust::routeNeedsPermission('admin/users*', ['manage_users', 'delete_users'], Redirect::to('admin'), false); Route::filter('can_manage_premium_casts', function () { if (Xcast::find(Route::input('xcasts'))->levels > 0) { if (!Entrust::can('manage_premium_casts') && !Entrust::can('delete_casts')) { return Redirect::to('admin'); } } });
Route::filter('session', function () { if (!Session::has('user_type')) { if (Request::ajax()) { return Response::make('Nice try', 403); } else { return Redirect::route('welcome'); } } if (TT\Auth\Authenticator::auth()) { return Redirect::route('home'); } }); Route::filter('auth', function () { if (!TT\Auth\Authenticator::auth()) { if (Route::input('user_type')) { $userType = Route::input('user_type'); Session::put('user_type', $userType); } if (Request::ajax()) { return Response::make('Not logged in.', 403); } else { return Redirect::route('login.get'); } } }); Route::filter('nocache', function ($route, $request, $response) { // No caching for pages, you can do some checks before $response->header("Pragma", "no-cache"); $response->header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0"); }); Route::filter('auth.basic', function () {
return Redirect::to('/meetingRequests/PendingArchived/' . $giver_id . '/' . $getmeeting->id); } if ($getmeeting->status == "accepted") { return Redirect::to('/meetingRequests/Accepted/' . $giver_id . '/' . $getmeeting->id); } } return; } } } return Redirect::to('/meetingRequests/groupOnly'); } }); Route::filter('QuestionGroupCheck', function ($route) { $Question_id = Route::input('id'); $question_url = Route::input('question_url'); $question_detail = Question::find($Question_id); if (empty($question_detail) || $question_detail->question_url != $question_url) { return Redirect::to('404'); } elseif ($question_detail->access == 'private') { if (Auth::check()) { if ($question_detail->user_id != Auth::user()->id) { return; } $CurrentUser_group = Auth::User()->Groups; $QuestionGroup = Question::find($Question_id)->Groupquestion; foreach ($CurrentUser_group as $key => $valueUsers) { foreach ($QuestionGroup as $key => $valueQuestion) { if ($valueUsers->id == $valueQuestion->group_id) { return; }
* * NOTES: * * $projectname needs to be passed as a route parameter: * * 'project/{projectname}/invitations' * * Alternatively it should be passed in as a GET/POST parameter * * $permission needs to be passed in as a filter parameter * * 'before' => 'permission:'.Permissions::PROJECT_ADMIN */ Route::filter('permission', function ($route, $request, $permission) { $thisUser = Auth::user(); $groupName = Route::input('projectname'); // Passed in as route parameter if (is_null($groupName)) { $groupName = Input::get('projectname'); // Passed in as parameter parameter } // Check permissions $hasPermission = PermissionHandler::checkProject($thisUser, $groupName, $permission); if (!$hasPermission) { return Redirect::back()->with('flashError', 'You do not have permission to perform selected action'); } }); /** * Require routes to have admin permissions. */ Route::filter('adminPermission', function () {
/** * Aplicar referencias. * * @param array $values * @param array $references * * @return array */ protected function loadReferences(array $values, array $references) { // Verificar referencias foreach ($references as $ref_campo => $ref_name) { $values[$ref_campo] = array_key_exists($ref_campo, $values) ? $values[$ref_campo] : \Route::input($ref_name); } return $values; }
/** * Returns the locale item for the current request * * @param \Aimeos\MShop\Context\Item\Iface $context Context object * @return \Aimeos\MShop\Locale\Item\Iface Locale item object */ protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) { if ($this->locale === null) { if (\Route::current() !== null) { $site = \Route::input('site', 'default'); $lang = \Route::input('locale', ''); $currency = \Route::input('currency', ''); } else { $site = 'default'; $lang = $currency = ''; } $disableSites = $this->config->has('shop.disableSites'); $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); } return $this->locale; }
| | The following filters are used to verify that the user of the current | session is logged into this application. The "basic" filter easily | integrates HTTP Basic authentication for quick, simple checking. | */ Route::filter('auth', function () { if (!Sentry::check()) { return Redirect::guest('login'); } }); Route::filter('hasAccess', function ($route, $request, $value) { if (!Sentry::check()) { return Redirect::guest('login'); } $userId = Route::input('users'); try { $user = Sentry::getUser(); if ($user->hasAccess($value) || $userId == $user->getId()) { return; } Session::flash('error', trans('users.noaccess')); return Redirect::route('home'); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { Session::flash('error', trans('users.notfound')); return Redirect::guest('login'); } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) { Session::flash('error', trans('groups.notfound')); return Redirect::guest('login'); } });
} }); /* |-------------------------------------------------------------------------- | CSRF Protection Filter |-------------------------------------------------------------------------- | | The CSRF filter is responsible for protecting your application against | cross-site request forgery attacks. If this special token in a user | session does not match the one given in this request, we'll bail. | */ Route::filter('csrf', function () { if (Session::token() !== Input::get('_token')) { throw new Illuminate\Session\TokenMismatchException(); } }); Route::filter('foo', function () { if (Route::input('age') >= 10) { return 'your age more than 10'; } }); Route::filter('Auth', function () { return 'hello hello ave not login'; }); Route::filter('auth', function () { $auth = Session::get('auth'); if (empty($auth)) { return Redirect::to('login'); } });