current() public static method

Get the current URL for the request.
public static current ( ) : string
return string
示例#1
1
 public function __construct($id = false)
 {
     parent::__construct();
     $this->add("products");
     $this->name = "form_slider";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $this->products = ProductDB::getAdminShow();
     if (!$id) {
         $this->text("title", "Название:");
         $this->textarea("description", "Описание:");
         $this->submit("insert_slider", "Сохранить");
     } else {
         $this->add("img");
         $this->add("product_id");
         $this->hidden("id", $id);
         $obj = new SliderDB();
         $obj->load($id);
         $this->text("title", "Название:", $obj->title);
         $img = ProductDB::getCellOnID($obj->product_id, "img");
         $view = new View(Config::DIR_TMPL);
         $this->img = $view->render("img", array("src" => Config::DIR_IMG_PRODUCT . $img), true);
         $this->textarea("description", "Описание:", $obj->description);
         $this->submit("update_slider", "Сохранить");
         $this->product_id = $obj->product_id;
     }
 }
示例#2
0
 /**
  * Report or log an exception.
  *
  * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
  *
  * @param  \Exception  $e
  * @return void
  */
 public function report(Exception $e)
 {
     if ($e instanceof VerifyCsrfToken) {
         Log::error('CSRF Error', ['exception' => $e, 'url' => URL::current()]);
     }
     return parent::report($e);
 }
示例#3
0
 public function __construct($view, $param)
 {
     parent::__construct();
     $this->add("hornav");
     $this->add("n");
     $this->name = "form_viewgallery";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $viewgallery_obj = new ViewgalleryDB();
     $viewgallery_obj->load($param["view_id"]);
     $gallery_obj = new GalleryDB();
     $gallery_obj->load($param["gallery_id"]);
     $this->hornav = new Hornav();
     $this->hornav->addData("Админпанель", URL::get("menu", "admin"));
     $this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
     $this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
     $this->hornav->addData($gallery_obj->title, URL::get("listimg", "admin", array("view_id" => $param["view_id"], "gallery_id" => $param["gallery_id"])));
     if (!$param["img_id"]) {
         $this->hornav->addData("Добавить");
         $this->file("img", "Картинка:");
         $this->submit("insert_imggallery", "Сохранить");
     } else {
         $this->hidden("id", $param["img_id"]);
         $gallery_obj = new GalleryDB();
         $gallery_obj->load($param["img_id"]);
         $this->hornav->addData("Изменить");
         $this->file("img", "Картинка:");
         $this->submit("update_imggallery", "Сохранить");
     }
 }
示例#4
0
 protected function download(Path $path)
 {
     // check basic auth headers as well, so if specified,
     // client doesn't have to go through the login and cookie dance.
     Auth::onceBasic("username");
     // check we're logged in
     if (!Auth::check()) {
         Session::flash('redirect', URL::current());
         return Redirect::route('login');
     }
     // record the download in the db
     $record = $path->loadCreateRecord($path);
     $record->downloaded_at = $record->freshTimestamp();
     $record->increment('downloads');
     $record->save();
     $isMisc = strpos($path->getRelative(), '/Misc/') === 0;
     if ($isMisc || $path->isSafeExtension()) {
         // check if the extension is safe to download
         $file = new AsciiSafeDownloadFile($path->getPathname());
         // see comments in AsciiSafeDownloadFile class
         $baseName = $path->getBasename();
         $baseName = str_replace('%', '', $baseName);
         try {
             return Response::download($file, $baseName);
         } catch (InvalidArgumentException $e) {
             App::abort(500, 'This file has a malformed filename. Please contact an admin.');
         }
     } else {
         App::abort(403, sprintf('File type "%s" not allowed', $path->getExtension()));
     }
 }
示例#5
0
 public function __construct($id = false)
 {
     parent::__construct();
     $this->name = "form_section";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     if (!$id) {
         $this->text("title", "Название:", FormProcessor::getSessionData("title"));
         $this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
         $this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
         $this->textarea("full_text", "Длинное описание:", FormProcessor::getSessionData("full_text"));
         $this->text("alias", "ЧПУ ссылка", FormProcessor::getSessionData("alias"));
         $this->submit("insert_section", "Сохранить");
     } else {
         $this->hidden("id", $id);
         $obj = new SectionDB();
         $obj->load($id);
         $this->text("title", "Название:", $obj->title);
         $this->textarea("meta_desc", "Описание:", $obj->meta_desc);
         $this->textarea("meta_key", "Ключевые слова:", $obj->meta_key);
         $this->textarea("full_text", "Длинное описание:", $obj->full_text);
         $link = URL::get("section", "", array("id" => $id), true, "", false);
         $alias = SefDB::getAliasOnLink($link);
         $this->text("alias", "ЧПУ ссылка", $alias);
         $this->submit("update_section", "Сохранить");
     }
 }
示例#6
0
 public function image()
 {
     if (!Auth::check()) {
         Session::flash('redirect', URL::current());
         return Redirect::route('login');
     }
     $relativePath = Input::get('path');
     $filePath = Input::get('file');
     $path = Path::fromRelative($relativePath);
     if (!$path->exists()) {
         App::abort(404, 'Archive not found');
     }
     $archive = Archive\Factory::open($path);
     $imageStream = $archive->getEntryStream($filePath);
     $imageData = stream_get_contents($imageStream);
     $response = Response::make($imageData);
     $ext = pathinfo($filePath, PATHINFO_EXTENSION);
     switch ($ext) {
         case 'jpg':
         case 'jpeg':
             $response->header('Content-Type', 'image/jpeg');
             break;
         case 'png':
             $response->header('Content-Type', 'image/png');
             break;
     }
     $response->header('Last-Modified', gmdate('D, d M Y H:i:s', $path->getMTime()) . ' GMT');
     $response->header('Expires', gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT');
     $response->header('Cache-Control', 'public');
     return $response;
 }
示例#7
0
 public function __construct($id = false)
 {
     parent::__construct();
     $this->add("sections");
     $this->name = "form_category";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $this->sections = SectionDB::getAll();
     if (!$id) {
         $this->text("title", "Название:", FormProcessor::getSessionData("title"));
         $this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
         $this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
         $this->text("alias", "ЧПУ ссылка", FormProcessor::getSessionData("alias"));
         $this->checkbox("show", "Показывать:", "1");
         $this->submit("insert_category", "Сохранить");
     } else {
         $this->add("section_id");
         $this->hidden("id", $id);
         $obj = new CategoryDB();
         $obj->load($id);
         $this->text("title", "Название:", $obj->title);
         $this->textarea("meta_desc", "Описание:", $obj->meta_desc);
         $this->textarea("meta_key", "Ключевые слова:", $obj->meta_key);
         $link = URL::get("category", "", array("id" => $id), true, "", false);
         $alias = SefDB::getAliasOnLink($link);
         $this->text("alias", "ЧПУ ссылка", $alias);
         $this->checkbox("show", "Показывать:", "1", "", (int) $obj->show);
         $this->submit("update_category", "Сохранить");
         $this->section_id = $obj->section_id;
     }
 }
 /**
  * Handles authentication
  *
  * @param  string  $slug
  * @return mixed
  */
 public function getCallback($slug)
 {
     try {
         $user = Social::authenticate($slug, URL::current(), function ($link, $provider, $token, $slug) {
             if ($slug == 'facebook') {
                 // Retrieve the user in question for modificiation
                 $user = $link->getUser();
                 // Get user details
                 $data = $provider->getUserDetails($token)->getArrayCopy();
                 // Update user details
                 $user->facebook_uid = $data['uid'];
                 $user->save();
             } else {
                 if ($slug == 'twitter') {
                     // Retrieve the user in question for modificiation
                     $user = $link->getUser();
                     // Get user details
                     $data = $provider->getUserDetails($token);
                     // Update user details
                     $user->twitter_nickname = $data->nickname;
                     $user->twitter_image_url = $data->imageUrl;
                     $user->save();
                 }
             }
         });
         return Redirect::to('oauth/authenticated');
     } catch (Exception $e) {
         return Redirect::to('oauth')->withErrors($e->getMessage());
     }
 }
示例#9
0
 public function __construct($view, $param)
 {
     parent::__construct();
     $this->add("hornav");
     $this->add("n");
     $this->name = "form_viewgallery";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $viewgallery_obj = new ViewgalleryDB();
     $viewgallery_obj->load($param["view_id"]);
     $this->hornav = new Hornav();
     $this->hornav->addData("Админпанель", URL::get("menu", "admin"));
     $this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
     $this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
     if (!$param["gallery_id"]) {
         $this->hornav->addData("Добавить");
         $this->text("title", "Название:", FormProcessor::getSessionData("title"));
         $this->file("img", "Картинка:");
         $this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
         $this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
         $this->submit("insert_listgallery", "Сохранить");
     } else {
         $this->hidden("id", $param["gallery_id"]);
         $gallery_obj = new GalleryDB();
         $gallery_obj->load($param["gallery_id"]);
         $this->hornav->addData("Изменить");
         $this->text("title", "Название:", $gallery_obj->title);
         $this->file("img", "Картинка:");
         $this->textarea("meta_desc", "Описание:", $gallery_obj->meta_desc);
         $this->textarea("meta_key", "Ключевые слова:", $gallery_obj->meta_key);
         $this->submit("update_listgallery", "Сохранить");
     }
 }
示例#10
0
 public function oauth($tokenid)
 {
     $successURL = isset($_GET['returnurl']) ? $_GET['returnurl'] : new URL('auth', 'invalidReturn');
     $failureURL = isset($_GET['cancelurl']) ? $_GET['cancelurl'] : $successURL;
     $grant = isset($_GET['grant']) ? (int) $_GET['grant'] === 1 : null;
     $session = Session::getInstance();
     $token = db()->table('token')->get('token', $tokenid)->fetch();
     #No token, no access
     if (!$token) {
         throw new PublicException('No token', 404);
     }
     $this->view->set('token', $token);
     $this->view->set('cancelURL', $failureURL);
     $this->view->set('continue', (string) new URL('auth', 'oauth', $tokenid, array_merge($_GET->getRaw(), array('grant' => 1))));
     if (!$session->getUser()) {
         return $this->response->getHeaders()->redirect(new URL('user', 'login', array('returnto' => (string) URL::current())));
     }
     if ($grant === false) {
         return $this->response->getHeaders()->redirect($failureURL);
     }
     if ($grant === true) {
         $token->user = $this->user;
         $token->store();
         return $this->response->getHeaders()->redirect($successURL);
     }
 }
 public function do_help()
 {
     $user = Sentry::getUser();
     $subject = "Newsletter Help: " . Input::get('subject');
     $emailbody = Input::get('message');
     $from_name = $user->first_name . ' ' . $user->last_name;
     $from_email = $user->email;
     $admin = User::first();
     $to_name = $admin->first_name . ' ' . $admin->last_name;
     $to_email = $admin->email;
     $rules = array('subject' => 'required|max:128', 'message' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('dashboard/help')->withErrors($validator);
     } else {
         $browser = new Browser();
         $userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion();
         $userplatform = $browser->getPlatform();
         $userIP = $_SERVER["REMOTE_ADDR"];
         $page = URL::current();
         $data = array('emailbody' => $emailbody, 'userbrowser' => $userbrowser, 'userplatform' => $userplatform, 'userIP' => $userIP, 'page' => $page);
         $issent = Mail::send('emails.help-email', $data, function ($message) use($from_email, $from_name, $subject, $to_name, $to_email) {
             $message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject);
         });
         if ($issent) {
             return Redirect::to('dashboard/help')->with('success', 'Success! You will be contacted soon regarding your issue.');
         } else {
             return Redirect::to('dashboard/help')->with('error', 'An error was encountered sending the email. Please try again.');
         }
     }
 }
示例#12
0
 public static function current($stripPages = true)
 {
     $url = str_replace(URL::to('/'), '', URL::current());
     if ($stripPages === true) {
         $url = str_replace('/pages/', '', $url);
     }
     return $url;
 }
示例#13
0
 public function edit()
 {
     $post = $this->request->post();
     $post['author'] = $_SESSION['user']['username'];
     $post['sesuatu'] = 'Powered by Xinix';
     $this->get($this->request->getPathInfo())->save($post);
     $this->app->redirect(\URL::current());
 }
示例#14
0
 public function __construct()
 {
     $uri = str_replace(\URL::route('admin.index'), '', \URL::current());
     $parts = explode('/', $uri);
     $route_name = $parts[1];
     $this->entity = \EntityDriver::findByRouteName($route_name);
     $this->driver = new \EntityCrudDriver($this->entity->model_name);
 }
示例#15
0
 public function __construct($options = null, $initialize = true, $error_messages = null)
 {
     $this->options = ['csrf_token' => ['name' => '_token', 'value' => csrf_token()], 'script_url' => \URL::current(), 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')) . '/files/', 'upload_url' => $this->get_full_url() . '/files/'];
     if ($options) {
         $this->options = $options + $this->options;
     }
     parent::__construct($this->options, $initialize, $error_messages);
 }
示例#16
0
function setBroadcasterActive($path, $active = "active")
{
    if ($path == "/") {
        return URL::route('broadcasterHome') === URL::current() ? $active : "";
    }
    $path = "broadcaster" . $path;
    return Request::is($path . '*') ? $active : "";
}
示例#17
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!\Auth::check()) {
         \Session::put('attemptUrl', \URL::current());
         return \Redirect::route('admin.get.login');
     }
     return $next($request);
 }
 public function postResourceSet()
 {
     $url = URL::current();
     $name = Input::get('name');
     $icon = Input::get('icon');
     $scopes = Input::get('scopes');
     $result = $this->uma_resource_set($url, $name, $icon, $scopes);
     return $result;
 }
示例#19
0
 public function action_edit()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Translation')));
     $this->template->title = __('Edit Translation');
     $this->template->bind('content', $content);
     $content = View::factory('oc-panel/pages/translations/edit');
     $this->template->scripts['footer'][] = 'js/oc-panel/translations.js';
     $language = $this->language_fix($this->request->param('id'));
     //get the translated ad not translated.
     list($translation_array, $untranslated_array) = $this->get_translation($language);
     //watch out at any standard php installation there's a limit of 1000 posts....edit php.ini max_input_vars = 10000 to amend it.
     if ($this->request->post() and is_array(Core::post('translations'))) {
         $data_translated = Core::post('translations');
         if ($this->save_translation($language, $translation_array, $data_translated)) {
             Alert::set(Alert::SUCCESS, $language . ' ' . __('Language saved'));
         } else {
             Alert::set(Alert::ALERT, $language);
         }
         $this->redirect(URL::current());
     }
     //add filters to search
     $translation_array_filtered = $translation_array;
     //only display not translated
     if (core::get('translated') == 1) {
         $translation_array_filtered_aux = array();
         foreach ($untranslated_array as $key => $value) {
             $translation_array_filtered_aux[] = $translation_array_filtered[$value];
         }
         $translation_array_filtered = $translation_array_filtered_aux;
     } elseif (core::get('search') !== NULL) {
         $translation_array_filtered_aux = array();
         foreach ($translation_array as $key => $value) {
             if (strpos($value['original'], core::get('search')) !== FALSE or strpos($value['translated'], core::get('search')) !== FALSE) {
                 $translation_array_filtered_aux[] = $value;
             }
         }
         $translation_array_filtered = $translation_array_filtered_aux;
     }
     //how many translated items we have?
     $total_items = count($translation_array_filtered);
     //get elements for current page
     $pagination = Pagination::factory(array('view' => 'oc-panel/crud/pagination', 'total_items' => $total_items, 'items_per_page' => 20))->route_params(array('controller' => $this->request->controller(), 'action' => $this->request->action(), 'id' => $language));
     $trans_array_paginated = array();
     $from = $pagination->offset;
     $to = $from + $pagination->items_per_page;
     for ($key = $from; $key < $to; $key++) {
         if (isset($translation_array_filtered[$key])) {
             $trans_array_paginated[$key] = $translation_array_filtered[$key];
         }
     }
     $content->edit_language = $language;
     $content->translation_array = $trans_array_paginated;
     $content->cont_untranslated = count($untranslated_array);
     $content->total_items = count($translation_array);
     $content->pagination = $pagination->render();
 }
 /**
  * @return mixed
  */
 public function rss()
 {
     $feed = Rss::feed('2.0', 'UTF-8');
     $feed->channel(array('title' => \Config::get('laravel-blog.meta.rss_feed.title'), 'description' => \Config::get('laravel-blog.meta.rss_feed.description'), 'link' => \URL::current()));
     $posts = $this->post->live()->where($this->post->getTable() . '.in_rss', '=', true)->orderBy($this->post->getTable() . '.published_date', 'desc')->take(10)->get();
     foreach ($posts as $post) {
         $feed->item(array('title' => $post->title, 'description' => $post->summary, 'link' => \URL::action('\\Fbf\\LaravelBlog\\PostsController@view', array('slug' => $post->slug))));
     }
     return \Response::make($feed, 200, array('Content-Type', 'application/rss+xml'));
 }
示例#21
0
 public function initDynamicItem()
 {
     if (in_array(\URL::current(), self::$dynamic_item_config['table']['routes']['pages'])) {
         $dynamic_table_view = view('pxl::layouts/partials/dynamic_item/table/table_container');
         $dynamic_table_view->add_url = self::$dynamic_item_config['item']['routes']['add'];
         $dynamic_table_view->identifier = self::$dynamic_item_config['identifier'];
         $this->assign('dynamic_table', $dynamic_table_view->render());
         $this->assign('dynamic_item', ['config' => self::$dynamic_item_config, 'current_page' => 'table'], self::SECTION_JS);
     }
 }
示例#22
0
文件: LaraForm.php 项目: larakit/lk
 public function __construct($id = null, $method = 'post', $attributes = null, $trackSubmit = true)
 {
     $attributes['action'] = Arr::get($attributes, 'action', \URL::current());
     parent::__construct($id, $method, $attributes, $trackSubmit);
     if (method_exists($this, 'build')) {
         $this->build();
     }
     $this->initValidator();
     $this->addHidden('_token', ['value' => csrf_token()]);
 }
示例#23
0
 /**
  *
  * Contruct that checks you are loged in before nothing else happens!
  */
 function __construct(Request $request, Response $response)
 {
     //setting the user
     $this->user = Auth::instance()->get_user();
     parent::__construct($request, $response);
     //check 2 step
     if (strtolower($this->request->controller()) != 'auth' and Auth::instance()->logged_in() and core::config('general.google_authenticator') == TRUE and Auth::instance()->get_user()->google_authenticator != '' and Cookie::get('google_authenticator') != Auth::instance()->get_user()->id_user) {
         //redirect to 2step page
         $url = Route::url('oc-panel', array('controller' => 'auth', 'action' => '2step')) . '?auth_redirect=' . URL::current();
         $this->redirect($url);
     }
 }
示例#24
0
 /**
  * Set the active class to the current opened menu
  *
  * @param  string|array $route
  * @param  string $className
  * @return string
  */
 function is_active($route, $className = 'active')
 {
     if (is_array($route)) {
         return in_array(Route::currentRouteName(), $route) ? $className : '';
     }
     if (Route::currentRouteName() == $route) {
         return $className;
     }
     if (strpos(URL::current(), $route)) {
         return $className;
     }
 }
 public function action_view()
 {
     $uri = $this->request->detect_uri();
     if ($uri == '') {
         $this->redirect(URL::to('page@view:home'));
     }
     $id = $this->request->param('id');
     $query = $this->request->query();
     $username = $this->request->post('username');
     $password = $this->request->post('password');
     $login = $this->request->post('login');
     $identity = Identity::instance();
     $info = ORM::factory('Page')->filter('alias', $id)->load();
     if ($info->loaded()) {
         //downloads
         if ($id == 'download') {
             $downloads = true;
         }
         //contact
         if ($id == 'contact') {
             $form = Form::factory('Contact');
             //$form = Form::
             if ($form->valid()) {
                 //var_dump($form->values());
                 $this->redirect(URL::to('page@view:contact') . '?form=sent');
             }
         } else {
             $form = FALSE;
         }
         //login mechanism
         if (empty($username) && $login == 'Login') {
             $this->redirect(URL::current() . '?auth=nameError');
         } elseif (empty($password) && $login == 'Login') {
             $this->redirect(URL::current() . '?auth=false');
         } elseif (!empty($username) && !empty($password) && $login == 'Login') {
             $auth = $identity->authenticate($username, $password);
             if ($auth) {
                 $this->redirect(URL::current());
             } else {
                 $this->redirect(URL::current() . '?auth=false');
             }
         }
         //logout mechanism
         if ($login == 'Logout') {
             $identity->destroy();
             $this->redirect(URL::current());
         }
         $view = View::factory('page/item', array('item' => Viewer::factory($info), 'form' => $form, 'query' => $query, 'downloads' => isset($downloads) ? $downloads : null));
         $this->response->body($view->render());
     } else {
         throw HTTP_Exception::factory(404, 'Page not found');
     }
 }
 /**
  * Publish vendor files when app is ready.
  */
 protected function autoPublish()
 {
     \Artisan::call('vendor:publish', ['--provider' => self::class]);
     /*
      * Little "hack" because we are not in a Controller so we can not use Redirect.
      *
      * We have to refresh (we won't have files ready for this request)
      */
     sleep(1);
     header('Location: ' . \URL::current());
     die;
 }
 public function __construct()
 {
     if (Config::get('app.production')) {
         echo "Something cool is going to be here soon.";
         die;
     }
     $this->beforeFilter(function () {
         if (!Session::has('user_id')) {
             Session::put('pre_login_url', URL::current());
             return Redirect::to('/user/signin');
         } else {
             $user_id = Session::get('user_id');
             $owner = Owner::where('id', $user_id)->first();
             Session::put('user_name', $owner->first_name . " " . $owner->last_name);
             Session::put('user_pic', $owner->picture);
         }
     }, array('except' => array('userLogin', 'userVerify', 'userForgotPassword', 'userRegister', 'userSave', 'surroundingCars')));
     $date = date("Y-m-d H:i:s");
     $time_limit = date("Y-m-d H:i:s", strtotime($date) - 3 * 60 * 60);
     $owner_id = Session::get('user_id');
     $current_request = Requests::where('owner_id', $owner_id)->where('is_cancelled', 0)->where('created_at', '>', $time_limit)->orderBy('created_at', 'desc')->where(function ($query) {
         $query->where('status', 0)->orWhere(function ($query_inner) {
             $query_inner->where('status', 1)->where('is_walker_rated', 0);
         });
     })->first();
     $this->status = 0;
     if ($current_request) {
         if ($current_request->confirmed_walker) {
             $walker = Walker::find($current_request->confirmed_walker);
         }
         if ($current_request->is_completed) {
             $this->status = 5;
         } elseif ($current_request->is_started) {
             $this->status = 4;
         } elseif ($current_request->is_walker_arrived) {
             $this->status = 3;
         } elseif ($current_request->is_walker_started) {
             $this->status = 2;
         } elseif ($current_request->confirmed_walker) {
             $this->status = 1;
         } else {
             if ($current_request->status == 1) {
                 $this->status = 6;
             }
         }
         Session::put('status', $this->status);
         Session::put('request_id', $current_request->id);
     }
     $paypal_conf = Config::get('paypal');
     $this->_api_context = new ApiContext(new OAuthTokenCredential($paypal_conf['client_id'], $paypal_conf['secret']));
     $this->_api_context->setConfig($paypal_conf['settings']);
 }
 public function __construct()
 {
     $this->beforeFilter(function () {
         if (!Auth::check()) {
             $url = URL::current();
             $routeName = Route::currentRouteName();
             Log::info('current route =' . print_r(Route::currentRouteName(), true));
             if ($routeName != "AdminLogin" && $routeName != 'admin') {
                 Session::put('pre_admin_login_url', $url);
             }
             return Redirect::to('/admin/login');
         }
     }, array('except' => array('login', 'verify', 'add', 'walker_xml')));
 }
示例#29
0
文件: URL.php 项目: HappyKennyD/teest
 public static function canonical()
 {
     $link = explode("/", URL::current(true));
     $i = 0;
     $uri = '';
     for ($i = 0; $i <= count($link) - 2; $i++) {
         if ($i != count($link) - 2) {
             $uri .= $link[$i] . '/';
         } else {
             $uri .= $link[$i];
         }
     }
     return $uri;
 }
示例#30
0
 public function Content($path)
 {
     $slug = str_contains(\URL::current(), '/eng/') ? 'eng_slug' : 'slug';
     $menu = Menu::where($slug, '/' . $path)->first();
     if ($menu != null) {
         view()->share('content', $menu);
         view()->share('custom_header', $menu->header);
         $lang = \Request::segment(1) == 'eng' ? 'Eng' : null;
         \Activity::log('Ziyaret: ' . $menu->title . ($lang ? ' | Dil: Eng' : null));
         return view('content')->with(['menu' => $menu]);
     } else {
         return \Redirect::action('SiteController@index');
     }
 }