Ejemplo n.º 1
1
 public function handleCallback($driver, Request $req)
 {
     $socialuser = \Socialize::with($driver)->user();
     $user = User::where('email', $socialuser->email)->first();
     if (count($user) < 1) {
         $user = new User();
         $user->id = (string) Uuid::generate();
         $user->email = $socialuser->email;
         $user->name = $socialuser->name;
         $user->avatar = $socialuser->avatar;
         $user->save();
     }
     $user = \Auth::loginUsingId($user->id);
     $authcookie = \Cookie::queue('authenticated', true, 20, null, "www.thinkmerit.in", false, false);
     $username = \Cookie::queue('name', $user->name, 20, null, "www.thinkmerit.in", false, false);
     $avatar = \Cookie::queue('avatar', $user->avatar, 20, null, "www.thinkmerit.in", false, false);
     $email = \Cookie::queue('email', $user->email, 20, null, "www.thinkmerit.in", false, false);
     if (app()->environment() == "production") {
         return \Redirect::to("http://www.thinkmerit.in");
     } else {
         return \Redirect::to("http://www.dev.thinkmerit.in");
     }
     /* ->withCookie($authcookie)
        ->withCookie($username)
        ->withCookie($avatar)
        ->withCookie($email);*/
     // ;
 }
Ejemplo n.º 2
0
 /**
  * [showRefLink description]
  * Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
  *
  * @param [text] $link [referral link]
  *
  * @return [json] [all info abou the link]
  */
 public function showRefLink($link = null)
 {
     //  // If it has a Sponsor Cookie
     if (\Cookie::has('sponsor')) {
         return Redirect::to('/');
         // Load Referral Link View
     }
     if (is_null($link)) {
         return Redirect::to('/');
         // Redirect To HomePage
     }
     try {
         // If has $Link then Look in Database if Exist
         $link = Link::findByLink($link)->load('user.profile');
         $link = $link->toArray();
         // Note Cookie Wont Be Created if Exceeded More than 4kb
         \Cookie::queue('sponsor', $link, 2628000);
         // Return Referral View with Variable Link
         return Redirect::to('/')->with('link', $link);
         // If No Record Found Throw Exception!
     } catch (ModelNotFoundException $e) {
         // Return Back to Home
         return Redirect::to('/');
         // return view('nosponsor');
     }
 }
Ejemplo n.º 3
0
 public function showHome()
 {
     if (Auth::check()) {
         $user = Auth::user();
         $data['username'] = preg_replace('/@.*?$/', '', $user->email);
         $data['user'] = $user;
         if (!is_null($user->provider()->first()) && $user->provider()->first()->provider == 'facebook') {
             $data['avatar'] = '<img src="http://graph.facebook.com/' . $user->provider()->first()->provider_id . '/picture?type=small" alt="avatar" />';
         }
     }
     $items = ['home-bg-1.jpg', 'home-bg-2.jpg', 'home-bg-3.jpg', 'home-bg-4.jpg', 'home-bg-5.jpg', 'home-bg-6.jpg', 'home-bg-7.jpg', 'home-bg-8.jpg', 'home-bg-9.jpg', 'home-bg-10.jpg', 'home-bg-12.jpg', 'home-bg-13.jpg', 'home-bg-14.jpg', 'home-bg-15.jpg', 'home-bg-16.jpg', 'home-bg-17.jpg', 'home-bg-18.jpg', 'home-bg-19.jpg', 'home-bg-20.jpg', 'home-bg-21.jpg', 'home-bg-22.jpg', 'home-bg-23.jpg', 'home-bg-24.jpg', 'home-bg-25.jpg', 'home-bg-26.jpg', 'home-bg-27.jpg', 'home-bg-28.jpg', 'home-bg-29.jpg', 'home-bg-30.jpg', 'home-bg-32.jpg', 'home-bg-33.jpg', 'home-bg-34.jpg'];
     $data['introImg'] = $items[array_rand($items)];
     $lastMonth = Carbon::now()->subMonth();
     $popular = Stat::where('created_at', '>=', $lastMonth)->orderBy('hits', 'desc')->take(3)->get();
     $data['popularHashtags'] = [];
     foreach ($popular as $post) {
         $hashtag = $post->board()->first()->hashtag;
         if ($post->board()->first()->config()->first()->user_id == 0) {
             $url = $hashtag . '/szukaj';
         } else {
             $url = $hashtag . '/' . $post->board()->first()->id;
         }
         $href = '<a class="hashtag" href="' . URL::to('/') . '/' . $url . '">#' . $hashtag . '</a>';
         array_push($data['popularHashtags'], $href);
     }
     $data['title'] = $this->layout->title = null;
     $cookie = Cookie::queue('cookie_accept', 'yes', 2628000);
     $this->layout->content = View::make('front.home', $data);
 }
Ejemplo n.º 4
0
 public function getIndex()
 {
     // ref
     \Cookie::queue('referrer', Input::get('ref'));
     // abtesting
     $this->data['abFirstStepForm'] = Input::get('v') == 2 ? true : \Config::get('unflare.abtesting.firstStepForm');
     return $this->render('web.root');
 }
 public function doChangeLocale()
 {
     $locale = Input::get('locale');
     LaravelLocalization::setLocale($locale);
     App::setLocale($locale);
     Cookie::queue('locale', $locale);
     return Response::json(array('status' => true, 'link' => geturl(Input::get('url'))));
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('hardywen/cookie-csrf');
     $config = $this->app->config->get('cookie-csrf::config');
     //根据config配置哪些route及提交方法需要调用cookie-csrf
     $this->app->router->when('*', 'cookie-csrf', $config['method']);
     //将csrf token 放进 cookie里
     \Cookie::queue('cookie_csrf_token', csrf_token());
 }
Ejemplo n.º 7
0
 /**
  * 文章瀏覽數
  *
  */
 public static function views_cookie($type, $id)
 {
     $key = $type . '_' . $id;
     if (Cookie::get($key)) {
         return false;
     }
     Cookie::queue($key, 1, 5);
     return true;
 }
 public function index()
 {
     if (\Input::get('theme')) {
         \Cookie::queue('theme', \Input::get('theme'), 100);
         return Redirect::to('/')->withCookie(cookie('theme', \Input::get('theme'), 100));
     }
     $data = array('videos' => Video::where('active', '=', '1')->orderBy('created_at', 'DESC')->simplePaginate($this->videos_per_page), 'current_page' => 1, 'menu' => Menu::orderBy('order', 'ASC')->get(), 'pagination_url' => '/videos', 'video_categories' => VideoCategory::all(), 'post_categories' => PostCategory::all(), 'theme_settings' => ThemeHelper::getThemeSettings(), 'pages' => Page::all());
     //dd($data['videos']);
     return View::make('Theme::home', $data);
 }
Ejemplo n.º 9
0
 public function getLogin($id)
 {
     $curl = new Acme\Repositories\Curl();
     $result = json_decode($curl->postToken($id, 1234, 'http://app' . $id . '.dev/login/' . $id, Input::get('code')));
     if (isset($result->access_token)) {
         Cookie::queue('access_token', $result->access_token, $result->expires_in / 60);
     } else {
         Cookie::queue('access_token', null);
     }
     return Redirect::to('/')->with(Input::all());
 }
Ejemplo n.º 10
0
 /**
  * View Login page
  * @return [type] [description]
  */
 public function create()
 {
     if (Auth::check()) {
         return Redirect::intended('/');
     }
     $cookies = Cookie::get();
     foreach ($cookies as $name => $cookie) {
         Cookie::queue(Cookie::forget($name));
     }
     return View::make('login');
 }
Ejemplo n.º 11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Requests\Frontend\StoreCommentRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\Frontend\StoreCommentRequest $request)
 {
     if ($comment = Comment::create($request->all())) {
         \Session::flash('comment.success', '评论发布成功, 审核通过即可显示');
         \Cookie::queue('comment_url', $comment->url);
         \Cookie::queue('comment_email', $comment->email);
         \Cookie::queue('comment_nickname', $comment->nickname);
         return back();
     }
     \Session::flash('comment.fail', '评论发布失败');
     return back()->withInput();
 }
 public function postIndex()
 {
     $vars = array('class' => 'CRP', 'level' => 5, 'craftable_only' => 0, 'slim_mode' => 0, 'rewardable_too' => 0);
     $values = array();
     foreach ($vars as $var => $default) {
         $values[] = Input::has($var) ? Input::get($var) : $default;
     }
     $url = '/equipment/list?' . implode(':', $values);
     // Queueing the cookie, we won't need it right away, so it'll save for the next Response::
     Cookie::queue('previous_equipment_load', $url, 525600);
     // 1 year's worth of minutes
     return Redirect::to($url);
 }
 public function removeTTN()
 {
     $id = Input::get('id');
     if (!$id) {
         throw new RuntimeException();
     }
     $idsCookie = Cookie::get('zd_ttn_numbers');
     if (($key = array_search($id, $idsCookie)) !== false) {
         unset($idsCookie[$key]);
     }
     Cookie::queue('zd_ttn_numbers', $idsCookie, Settings::get('cookie_save_time'));
     return Response::json(array('status' => true));
 }
Ejemplo n.º 14
0
 public function index()
 {
     $map_units = array();
     //$map_units[] = (new MapUnit('53.076455,82.357315'))->getLatLon();
     //$map_units[] = (new GPRMCUnit('$GPRMC,123347.000,A,4313.7477,N,02752.4516,E,0.00,284.40,080811,,,D*63'))->getLatLon();
     $comet_token = Auth::user()->createCometToken();
     Cookie::queue('comet_token', $comet_token);
     $map_units = MapUnit::all()->toArray();
     View::share('page_key', 'home');
     View::share('page_title', 'Test');
     $this->layout->header = View::make('header');
     $this->layout->map_part = View::make('show-map');
     $this->layout->map_part->map_units = $map_units;
 }
Ejemplo n.º 15
0
 public function postProjectsSort($param)
 {
     $lang = Cookie::get('lang', 'ru');
     $sort = Cookie::get("sort_{$param}", 'ASC');
     $load = Input::get('load');
     $projects = Project::select('project_id', 'project_alias', "project_keywords_{$lang}", "project_description_{$lang}", "project_name_{$lang}", "project_text_{$lang}", "project_image_preview", "project_date_start", "project_date_stop", "updated_at")->orderBy($param, $sort)->limit($load)->get();
     $projects_count = Project::count();
     if ($sort == 'ASC') {
         Cookie::queue("sort_{$param}", 'DESC');
     } else {
         Cookie::queue("sort_{$param}", 'ASC');
     }
     $tpl = View::make('layouts.projects')->with(array('projects' => $projects, 'projects_count' => $projects_count, 'lang' => $lang))->render();
     return Response::json(array('success' => true, 'status' => 200, 'tpl' => $tpl, 'param' => $param, 'sort' => $sort));
 }
 public function postIndex()
 {
     $vars = array('class' => 'CRP', 'start' => 1, 'end' => 5, 'self_sufficient' => 0, 'misc_items' => 0);
     $values = array();
     foreach ($vars as $var => $default) {
         $values[] = Input::has($var) ? Input::get($var) : $default;
     }
     // Overwrite Class var
     if (Input::has('multi') && Input::has('classes')) {
         $values[0] = implode(',', Input::get('classes'));
     }
     $url = '/crafting/list?' . implode(':', $values);
     // Queueing the cookie, we won't need it right away, so it'll save for the next Response::
     Cookie::queue('previous_crafting_load', $url, 525600);
     // 1 year's worth of minutes
     return Redirect::to($url);
 }
Ejemplo n.º 17
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getAdd()
 {
     if (PhoneNumber::where('user_id', Auth::user()->id)->count() >= Config::get('settings.phone_number_limit')) {
         return Output::push(array('path' => 'phone_number', 'messages' => array('fail' => _('You have reached limit phone number'))));
     }
     $data['global_prefix'] = Config::get('settings.global_prefix');
     $data['domain'] = Request::segment(2) == "manage" ? Domain::find(Request::segment(3)) : Domain::find(Auth::user()->domain_id);
     $data['extension'] = Cookie::get('rndext') ? Cookie::get('rndext') : $this->generate_extension();
     $data['users'] = array();
     if (Request::segment(2) == "manage") {
         foreach (User::whereDomainId(Request::segment(3))->get() as $row) {
             $data['users'][$row['id']] = $row['username'];
         }
     }
     Cookie::queue('rndext', $data['extension'], 60);
     return View::make('phone_number.create')->with('data', $data);
 }
Ejemplo n.º 18
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $locale = \Cookie::get('locale');
     if (array_key_exists($locale, $this->app->config->get('app.locales'))) {
         $this->app->setLocale($locale);
     } else {
         \Cookie::queue('locale', 'el', 60 * 24 * 365);
     }
     $locale = $request->segment(1);
     if (array_key_exists($locale, $this->app->config->get('app.locales'))) {
         $cookie = \Cookie::make('locale', $locale, 60 * 24 * 365);
         $this->app->setLocale($locale);
         $segments = $request->segments();
         unset($segments[0]);
         return $this->redirector->to(implode('/', $segments))->withCookie($cookie);
     }
     return $next($request);
 }
Ejemplo n.º 19
0
 /**
  * Will store the current query, if there is no query it will look up in cookies and redirect if found.
  *
  * @author cr@nodes.dk
  * @param array $params
  * @return bool|string
  */
 function query_restorer($params = [], $blacklist = [])
 {
     // Store and return
     if (!empty(\Request::all())) {
         \Cookie::queue(\Cookie::make(md5(\Request::url() . '?' . http_build_query($params)), \Request::all(), 5));
         return false;
     }
     // Retrieve
     $query = \Cookie::get(md5(\Request::url() . '?' . http_build_query($params)));
     foreach ($blacklist as $key) {
         unset($query[$key]);
     }
     // Redirect with queries
     if (!empty($query) && is_array($query)) {
         return \Request::url() . '?' . http_build_query($query);
     }
     return false;
 }
Ejemplo n.º 20
0
 public function addToCart($id, $number = 1)
 {
     if (\Request::cookie('shoppingCart')) {
         $cartData = shoppingCart::getCart();
         $cart = unserialize($cartData->data);
         $cart->addToCart($id, $number);
         $sCart = serialize($cart);
         $cartData->data = $sCart;
         $cartData->save();
     } else {
         $cart = new shoppingCart();
         $cart->addToCart($id, $number);
         $sCart = serialize($cart);
         $ip = $_SERVER['REMOTE_ADDR'];
         $now = \Carbon\Carbon::now()->toDateTimeString();
         $token = md5($ip . $now);
         \Cookie::queue('shoppingCart', $token);
         \App\Cart::create(['key' => $token, 'data' => $sCart]);
     }
     return redirect()->back();
 }
Ejemplo n.º 21
0
 /**
  * [showRefLink description]
  * Route::get('{link?}', ['as' => 'reflink', 'uses' => 'LinkController@showRefLink']);
  *
  * @param [text] $link [referral link]
  *
  * @return [json] [all info about the link]
  */
 public function showRefLink($link = null)
 {
     //  // If it has a Sponsor Cookie
     if (\Cookie::has('sponsor')) {
         $cookie = \Cookie::get('sponsor');
         $link = $cookie['link'];
         $link = Link::findByLink($link)->load('user.profile');
         $product = Product::find(1);
         return view('pages.referralLink')->with(compact('link', 'product'));
     }
     // Check if the Provided Link is Valid  Redirect to Home if Invalid Link!
     try {
         $link = Link::findByLink($link);
         $sp_lid = $link->id;
         // If Sponsor is Not Active LeapFrog to ActiveSponsor
         if (!$link->active) {
             $sp_lid = $link->activeSponsor($sp_lid);
         }
         // Load User Profile
         $link = Link::find($sp_lid)->load('user.profile');
         $splink = [];
         $splink['id'] = $link->id;
         $splink['user_id'] = $link->user_id;
         $splink['link'] = $link->link;
         // Load Product
         $product = Product::find(1);
         // Assign $splink to the cookie
         // Note Cookie Wont Be Created if Exceeded More than 4kb
         // Cookie set Forever / 5 Years or until Cache Clear
         // No Needed To Return With Cookie if it is Queue
         $cookie = \Cookie::queue('sponsor', $splink, 2628000);
         // Return Referral View with Variable Link
         return view('pages.referralLink')->with(compact('link', 'product'));
         // LINK PROVIDED IS INVALID REDIRECT HOME
     } catch (ModelNotFoundException $e) {
         return Redirect::to('/');
     }
 }
Ejemplo n.º 22
0
 public function postAuthenticate()
 {
     $login = $_REQUEST['user_email'];
     $pass = $_REQUEST['user_password'];
     $Validate = new Validate();
     $rules = array('user_email' => array('reqd' => 'Please provide a user name'), 'user_password' => array('reqd' => 'Please provide a password'));
     $validation = $Validate->run($_REQUEST, $rules);
     if (is_array($validation)) {
         return Redirect::route('login')->with('validation', $validation);
     }
     $md5pass = md5($pass);
     $authed = User::authenticateUser($login, $md5pass);
     if (is_object($authed)) {
         if (isset($_REQUEST['remember'])) {
             Cookie::queue('_user_remember', Crypt::encrypt($login . ':' . $md5pass), 9999999);
         }
         Session::put('user', $authed);
         return Redirect::action('PortalController@getIndex');
     } else {
         logr(array('data' => $_REQUEST, 'time' => date('Y-m-d H:i:s')), 'failed-logins');
         return Redirect::route('login')->with('validation', array('authentication' => 'There seems to be a problem with your email or password'));
     }
 }
Ejemplo n.º 23
0
 /**
  * Show an individual snippet
  * GET /snippets/{slug}
  * @param $slug
  * @return
  */
 public function getShow($slug)
 {
     $snippet = $this->snippet->bySlug($slug);
     if (!$snippet) {
         return App::abort(404);
     }
     $user = Auth::user();
     $has_starred = !empty($user) ? $user->hasStarred($snippet->id) : false;
     # check cookie readlist
     $cookieName = md5('snippet.readlist');
     $cookieJson = Cookie::get($cookieName);
     $cookieArray = json_decode($cookieJson);
     if (is_null($cookieArray) or !in_array($snippet->id, $cookieArray)) {
         # increment hit count if snippet id not exist cookie
         $snippet->incrementHits();
         # put cookie the snippet id
         $cookieArray[] = $snippet->id;
         # attached all cookies for one week.
         Cookie::queue($cookieName, json_encode($cookieArray), 10080);
     }
     $tags = $this->tag->all();
     $topSnippetContributors = $this->user->getTopSnippetContributors();
     return View::make('snippets.show', compact('snippet', 'has_starred', 'tags', 'topSnippetContributors'));
 }
Ejemplo n.º 24
0
 * Documentation Routes...
 */
Route::get('docs/dev', function () {
    Cookie::queue('docs_version', 'master', 525600);
    return Redirect::back();
});
Route::get('docs/4-0', function () {
    Cookie::queue('docs_version', '4.0', 525600);
    return Redirect::back();
});
Route::get('docs/4-1', function () {
    Cookie::queue('docs_version', '4.1', 525600);
    return Redirect::back();
});
Route::get('docs/4-2', function () {
    Cookie::queue('docs_version', '4.2', 525600);
    return Redirect::back();
});
/**
 * Main Documentation Route...
 */
Route::get('docs/{page?}', function ($page = null) {
    if (is_null($page)) {
        $page = 'introduction';
    }
    $index = Cache::remember('docs.' . DOCS_VERSION . '.index', 5, function () {
        return markdown(file_get_contents(base_path() . '/docs/' . DOCS_VERSION . '/documentation.md'));
    });
    $contents = Cache::remember('docs.' . DOCS_VERSION . '.' . $page, 5, function () use($page) {
        if (file_exists($path = base_path() . '/docs/' . DOCS_VERSION . '/' . $page . '.md')) {
            return markdown(file_get_contents($path));
Ejemplo n.º 25
0
 public function loginapi()
 {
     // $input = Input::all();
     //$member = '{"username": "******", "token": "attr"}';
     // $model = json_decode($string);
     $model = new Member();
     $model->first_name = "haloo";
     $model->last_name = "ajah";
     Cookie::queue('model', $model, 60 * 24);
     // 30 days
     Cookie::queue('loginname', $model->first_name, 60 * 24);
     // 30 days
     return 'true';
 }
Ejemplo n.º 26
0
            return '<br/>DONE SCRAPING';
        }
        return 'must be super user';
    }
    return 'not logged in.';
});
/*Update & manage routes*/
Route::post('/anime/managelistaccount', function () {
    if (Request::ajax()) {
        return MasterAnime::manageListAccount(Input::get("site"), Input::get("username"), Input::get("password"));
    }
    return 'AJAX requests only';
});
Route::get('/disable/announcement', function () {
    if (Request::ajax()) {
        Cookie::queue('masterani_announcement', '1', 1440);
        return 'Announcement has been disabled for a day!';
    }
    return 'AJAX requests only';
});
Route::post('/anime/recent', function () {
    if (Request::ajax()) {
        if (Input::has('type')) {
            $gallery = Input::get('type') === 'gallery';
            MasterAnime::createRecentLayoutCookie($gallery);
            return Latest::getLatest(array("start" => 0, "end" => 12), $gallery);
        }
    }
    return 'AJAX requests only';
});
Route::post('/anime/search', function () {
Ejemplo n.º 27
0
 public function setCurrency($currency)
 {
     $this->code = $currency;
     if (Session::get('currency') != $currency) {
         Session::set('currency', $currency);
     }
     if (Cookie::get($this->app['config']['currency.cookie_name']) != $currency) {
         $cookie = Cookie::make($this->app['config']['currency.cookie_name'], $currency, $this->app['config']['currency.cookie_days'] * 24 * 60);
         // Queues the cookie so it's automatically added to the next response
         \Cookie::queue($cookie);
     }
 }
@if(!Cookie::get('popup'))
    <div class="overlay overlay-counter open" data-js="openpopup">
        <div class="overlay-close overlay-close-layout"></div>
        <div class="overlay-box">
            <div class="counter-inner">
                <h4 class="overlay-title">До старту Закону<br/>"Про Публічні Закупівлі"<br/>залишилося</h4>
                <div class="counter-box clearfix">
                    <?php 
$now = new DateTime();
$day = new DateTime('2016-04-01 00:00:00');
$interval = $now->diff($day);
$n = $interval->format('%a');
$type = $n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2);
Cookie::queue('popup', '1', ($n + 1) * 60 * 24);
?>
                    @foreach(str_split($n) as $num)
                        <div class="counter-number">{{$num}}</div>
                    @endforeach
                </div>
                <div class="counter-days">
                    {{trans('interface.days.'.$type)}}
                </div>
                <a href="{{href('news/shhodo-zakonu-ukrayiny-pro-publichni-zakupivli')}}" class="counter-more">Докладніше</a>
            </div>
            <div class="overlay-close"></div>
        </div>
    </div>
@endif
Ejemplo n.º 29
0
 public function deleteRememberTokenCookie()
 {
     \Cookie::queue('remember_token', '', -1);
 }
Ejemplo n.º 30
0
<?php

Route::get('/{video_id?}', ['as' => 'index', 'uses' => function ($video_id = null) {
    if (isset($video_id)) {
        $video_cookie = Cookie::get('video_id');
        if ($video_cookie == $video_id) {
            Cookie::queue(Cookie::forget('video_id'));
            return Redirect::route('index');
        }
        return view('video', ['video_id' => $video_id]);
    } else {
        if (Cookie::get('video_id')) {
            Cookie::queue(Cookie::forget('video_id'));
        }
        return view('index');
    }
}]);