Пример #1
1
 /**
  * @Post("/", as="lang.change")
  * @return Response
  */
 public function lang(Request $request, CookieJar $cookieJar)
 {
     $resp = JsonResponse::create();
     \Session::set('language', $request->get('language'));
     //$resp->withCookie(\Cookie::forever());
     return $resp;
     //
 }
Пример #2
0
 /**
  * @POST("/upload_vk_items")
  * @param Request $request
  */
 public function getAlbumId(Request $request)
 {
     \Session::set('album_id', $request->input('album_id'));
     \Session::set('user_id', $request->input('user_id'));
     \Session::set('access_token', $request->input('access_token'));
     //\Session::set('shop_id', $request->input('shop_id'));
 }
Пример #3
0
 public function store()
 {
     $rules = array('username' => 'required | unique:users', 'email' => 'required | unique:users', 'password' => 'required | min:6', 'password_repeat' => 'required | min:6', 'firstName' => 'required', 'lastName' => 'required', 'yourSocialSituation' => 'required', 'movies' => 'required', 'travel' => 'required', 'photo' => 'required', 'photoType' => 'required');
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('users/create')->withInput()->witherrors($validator->messages());
     }
     $filname = Input::file('photo')->getClientOriginalName();
     $imageName = Input::file('photo')->getClientOriginalExtension();
     Input::file('photo')->move(base_path() . '/public/images/users/' . Input::get('username') . '/', $filname);
     $movies = Input::get('movies');
     $travels = Input::get('travel');
     $socials = Input::get('yourSocialSituation');
     $movie = "";
     $travel = "";
     $social_sitatuion = "";
     //foreach ($movies as $movi ){$movie .= $movi.",";}
     //foreach ($travels as $travl ){$travel  .= $travl.",";}
     //foreach ($socials as $social ){$social_sitatuion .= $social.",";}
     $zipcode = 0;
     $query = @unserialize(file_get_contents('http://ip-api.com/php/'));
     if ($query && $query['status'] == 'success') {
         $zipcode = $query['zip'];
     } else {
         $zipcode = 0;
     }
     $email_key = str_random(40);
     $user = User::create(array('username' => Input::get('username'), 'password' => \Hash::make(Input::get('password')), 'email' => Input::get('email'), 'firstName' => Input::get('firstName'), 'lastName' => Input::get('lastName'), 'verified' => '0', 'profileType' => '0', 'photo' => $filname, 'photoType' => Input::get('photoType'), 'role' => '0', 'active' => '0', 'online' => '0', 'unsubscribe' => '0', 'relationshipGoal' => Input::get('relationshipGoal'), 'jobAndJobSchedule' => Input::get('jobAndJobSchedule'), 'yourSocialSituation' => $social_sitatuion, 'haveChildren' => Input::get('haveChildren'), 'howMany' => Input::get('howMany'), 'doYouOwnACar' => Input::get('doYouOwnACar'), 'areYouOnAnyMedication' => Input::get('areYouOnAnyMedication'), 'howAmbitiousAreYou' => Input::get('howAmbitiousAreYou'), 'whatIsTheLongestRelationshipYouHaveBeenIn' => Input::get('whatIsTheLongestRelationshipYouHaveBeenIn'), 'yourBirthFatherAndMotherAre' => Input::get('yourBirthFatherAndMotherAre'), 'partnerDependability' => Input::get('partnerDependability'), 'sexualCompatibility' => Input::get('sexualCompatibility'), 'friendshipBetweenPartners' => Input::get('friendshipBetweenPartners'), 'drugs' => Input::get('drugs'), 'hairColor' => Input::get('hairColor'), 'hairStyle' => Input::get('hairStyle'), 'eyeColor' => Input::get('eyeColor'), 'height' => Input::get('height'), 'bodyType' => Input::get('bodyType'), 'zodicSign' => Input::get('zodicSign'), 'smoke' => Input::get('smoke'), 'drink' => Input::get('drink'), 'excercise' => Input::get('excercise'), 'excerciseSchedule' => Input::get('excerciseSchedule'), 'educationLevel' => Input::get('educationLevel'), 'language' => Input::get('language'), 'ethnicity' => Input::get('ethnicity'), 'religiousBeliefs' => Input::get('religiousBeliefs'), 'occupation' => Input::get('occupation'), 'income' => Input::get('income'), 'movie' => $movie, 'travel' => $travel, 'gender' => Input::get('gender'), 'age' => Input::get('age'), 'zipcode' => $zipcode, 'tatoos' => Input::get('tatoos'), 'wantKids' => Input::get('wantKids'), 'relationshipStatus' => Input::get('relationshipStatus'), 'verify_key' => $email_key));
     $lastInsertedId = $user->id;
     \Session::set('verify_key', $email_key);
     return \Redirect::to('users/' . Input::get('username') . '/about_your_date')->with("verify_key", $email_key);
 }
 public function setLocale($language)
 {
     //Change language
     \Session::set('locale', $language);
     \App::setLocale($language);
     \Lang::setLocale($language);
     //
     return \Redirect::back();
 }
Пример #5
0
 public function index()
 {
     $builder = new CaptchaBuilder();
     $builder->build(150, 32);
     //session(['captcha'=>$builder->getPhrase()]);
     \Session::set('captcha', $builder->getPhrase());
     //存储验证码
     return response($builder->output())->header('Content-type', 'image/jpeg');
 }
Пример #6
0
 public function sessionFilter()
 {
     if (Session::has('account')) {
         if (Session::get('login-date') != date("Ymd")) {
             $this->export(413);
             die;
         }
     } else {
         Session::set('account', array('uid' => 1));
         Session::set('login-date', date("Ymd"));
     }
 }
Пример #7
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $redirect = \Session::get('redirect');
     \Session::set('redirect', null);
     if ($redirect) {
         return redirect($redirect);
     }
     //Categories
     $categorias = Category::all();
     $selectCategorias = array();
     foreach ($categorias as $category) {
         $selectCategorias[$category->id] = $category->name;
     }
     $negocios = Negocio::where('status', 1)->orderBy('updated_at', 'desc')->get();
     $ciudades = DB::table('negocios')->where('status', '=', 1)->orderBy('ciudad', 'asc')->distinct()->lists('ciudad');
     $ciudades_array = array();
     foreach ($ciudades as $ciudad => $value) {
         $ciudades_array[$value] = $value;
     }
     $banners_top = Banner::where('place', '=', 'home')->where('status', '=', 1)->get();
     return View('pages.index', compact('negocios', 'ciudades_array', 'selectCategorias', 'banners_top'));
 }
Пример #8
0
 /**
  * Get post from blog by slug
  *
  * @param $slug
  * @return mixed
  */
 public function getPost($slug)
 {
     $post = Post::whereSlug($slug)->first();
     if (!$post) {
         throw (new ModelNotFoundException())->setModel(get_class($post));
     } else {
         //TODO:: Move it from there and add some logic :)
         if ($viewed = \Session::get("viewed")) {
             if (!isset($viewed[$slug])) {
                 $viewed[$slug] = true;
                 \Session::set("viewed", $viewed);
                 $post->views++;
                 $post->save();
             }
         } else {
             $viewed[$slug] = true;
             \Session::set("viewed", $viewed);
             $post->views++;
             $post->save();
         }
         return view("pages.post")->withPost($post);
     }
 }
 public function show($slug)
 {
     $article = Article::with('tags')->where('slug', $slug)->first();
     if (!$article) {
         abort(404);
     } else {
         if (\Request::method() == 'GET') {
             return view('front.post', ['article' => $article, 'tags' => $this->tags, 'setting' => $this->setting, 'links' => $this->links]);
         } else {
             //判断密码
             $validator = \Validator::make(\Request::all(), ['password' => 'required|max:255'], [], ['password' => '密码']);
             //为错误信息添加id,防止前台多个密码区域显示错误
             $validator->after(function ($validator) use($article) {
                 if ($validator->errors()->has('password')) {
                     $validator->errors()->add('id', $article->id);
                 }
             });
             if ($validator->fails()) {
                 return redirect()->back()->withErrors($validator->errors());
             }
             $password = \Request::get('password');
             if (strstr($article->password, ',' . $password . ',') > -1) {
                 $ip = \Request::getClientIp();
                 $passed = new Passed();
                 $passed->ip = $ip;
                 $passed->article_id = $article->id;
                 $passed->save();
                 \Session::set('passed_' . $article->id, true);
                 return redirect()->action('IndexController@show', $article->slug);
             } else {
                 $validator->errors()->add('password', '密码不匹配!');
                 $validator->errors()->add('id', $article->id);
                 return redirect()->back()->withErrors($validator->errors());
             }
         }
     }
 }
 public function store()
 {
     $rules = array('username' => 'required | unique:users', 'email' => 'required | unique:users', 'password' => 'required | min:2', 'firstName' => 'required', 'lastName' => 'required', 'yourSocialSituation' => 'required', 'movies' => 'required', 'travel' => 'required', 'photoType' => 'required', 'photo' => 'required', 'relationshipStatus' => 'required', 'birthYear' => 'required', 'birthMonth' => 'required', 'birthDay' => 'required', 'gender' => 'required', 'tatoos' => 'required', 'wantKids' => 'required', 'relationshipGoal' => 'required', 'occupation' => 'required', 'income' => 'required', 'jobAndJobSchedule' => 'required', 'haveChildren' => 'required', 'doYouOwnACar' => 'required', 'fatherBorn' => 'required', 'areYouOnAnyMedication' => 'required', 'motherBorn' => 'required', 'howAmbitiousAreYou' => 'required', 'whatIsTheLongestRelationshipYouHaveBeenIn' => 'required', 'partnerDependability' => 'required', 'sexualCompatibility' => 'required', 'friendshipBetweenPartners' => 'required', 'drugs' => 'required', 'hairColor' => 'required', 'hairStyle' => 'required', 'eyeColor' => 'required', 'height' => 'required', 'bodyType' => 'required', 'zodicSign' => 'required', 'smoke' => 'required', 'drink' => 'required', 'excercise' => 'required', 'educationLevel' => 'required', 'language' => 'required', 'ethnicity' => 'required', 'religiousBeliefs' => 'required');
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         //return $validator->messages();
         \Session::flash('message', $validator->messages());
         // return \Redirect::back();
         /*
                     return \Redirect::to('users/create')
             				->withInput()
             				->witherrors($validator->messages());
         */
     }
     $filname = Input::file('photo')->getClientOriginalName();
     $imageName = Input::file('photo')->getClientOriginalExtension();
     Input::file('photo')->move(base_path() . '/public/images/users/' . Input::get('username') . '/', $filname);
     $movies = Input::get('movies');
     $travels = Input::get('travel');
     $socials = Input::get('yourSocialSituation');
     $movie = "";
     $travel = "";
     $social_sitatuion = "";
     foreach ($movies as $movi) {
         $movie .= $movi . ",";
     }
     foreach ($travels as $travl) {
         $travel .= $travl . ",";
     }
     foreach ($socials as $social) {
         $social_sitatuion .= $social . ",";
     }
     $zipcode = 0;
     $lati = 0;
     $longi = 0;
     $query = @unserialize(file_get_contents('http://ip-api.com/php/'));
     // dd($query);
     if ($query && $query['status'] == 'success') {
         $zipcode = $query['zip'];
         $lati = $query['lat'];
         $longi = $query['lon'];
     } else {
         $zipcode = 0;
         $lati = 0;
         $longi = 0;
     }
     //dd($lati." ".$longi);
     $email_key = str_random(40);
     $birthYear = Input::get('birthYear');
     $birthMonth = Input::get('birthMonth');
     $birthDay = Input::get('birthDay');
     $birthFrom = $birthYear . "-" . $birthMonth . "-" . $birthDay;
     $to = new \DateTime('today');
     $age = date_diff(date_create($birthFrom), date_create('today'))->y;
     if ($zipcode == "") {
         $zipcode = "85054";
     }
     // dd($zipcode);
     // dd($birthFrom);
     $user = User::create(array('username' => Input::get('username'), 'password' => \Hash::make(Input::get('password')), 'email' => Input::get('email'), 'firstName' => Input::get('firstName'), 'lastName' => Input::get('lastName'), 'verified' => '0', 'profileType' => '0', 'photo' => $filname, 'photoType' => Input::get('photoType'), 'role' => 'user', 'active' => '0', 'online' => '0', 'unsubscribe' => '1', 'relationshipGoal' => Input::get('relationshipGoal'), 'jobAndJobSchedule' => Input::get('jobAndJobSchedule'), 'yourSocialSituation' => $social_sitatuion, 'haveChildren' => Input::get('haveChildren'), 'howMany' => Input::get('howMany'), 'doYouOwnACar' => Input::get('doYouOwnACar'), 'areYouOnAnyMedication' => Input::get('areYouOnAnyMedication'), 'howAmbitiousAreYou' => Input::get('howAmbitiousAreYou'), 'whatIsTheLongestRelationshipYouHaveBeenIn' => Input::get('whatIsTheLongestRelationshipYouHaveBeenIn'), 'yourBirthFatherAndMotherAre' => '', 'partnerDependability' => Input::get('partnerDependability'), 'sexualCompatibility' => Input::get('sexualCompatibility'), 'friendshipBetweenPartners' => Input::get('friendshipBetweenPartners'), 'drugs' => Input::get('drugs'), 'hairColor' => Input::get('hairColor'), 'hairStyle' => Input::get('hairStyle'), 'eyeColor' => Input::get('eyeColor'), 'height' => Input::get('height'), 'bodyType' => Input::get('bodyType'), 'zodicSign' => Input::get('zodicSign'), 'smoke' => Input::get('smoke'), 'drink' => Input::get('drink'), 'excercise' => Input::get('excercise'), 'excerciseSchedule' => Input::get('excerciseSchedule'), 'educationLevel' => Input::get('educationLevel'), 'language' => Input::get('language'), 'ethnicity' => Input::get('ethnicity'), 'religiousBeliefs' => Input::get('religiousBeliefs'), 'occupation' => Input::get('occupation'), 'income' => Input::get('income'), 'movie' => $movie, 'travel' => $travel, 'gender' => Input::get('gender'), 'age' => $age, 'zipcode' => $zipcode, 'tatoos' => Input::get('tatoos'), 'wantKids' => Input::get('wantKids'), 'relationshipStatus' => Input::get('relationshipStatus'), 'verify_key' => $email_key, 'fatherBorn' => Input::get('fatherBorn'), 'motherBorn' => Input::get('motherBorn'), 'latitude' => $lati, 'longitude' => $longi));
     $lastInsertedId = $user->id;
     \Session::set('verify_key', $email_key);
     $id = \DB::table('role_user')->insertGetId(['user_id' => $lastInsertedId, 'role_id' => 3]);
     $cred = array('username' => Input::get('username'), 'password' => Input::get('password'));
     //dd($cred);
     if (\Auth::attempt($cred)) {
         return \Redirect::to('users/' . Input::get('username') . '/about_your_date')->with("verify_key", $email_key);
     }
 }
Пример #11
0
 public function undoState()
 {
     try {
         DB::beginTransaction();
         //$Temp = json_decode(Input::get('inputs'));
         $id = \Session::get('last_deleted_id');
         // check this guy exist or not
         if ($id != "") {
             DB::table('persons')->where('person_id', $id)->update(array('deleted_flag' => false));
             /* $patient = DB::table('patients')->where('person_id', '=', $id)->first();
                if (count($patient) > 0) {
                    $patients_disease_forms = DB::table('patients_disease_forms')
                        ->where('patient_id', '=', $patient->patient_id)->get();
                    if (count($patients_disease_forms) > 0) {
                        foreach ($patients_disease_forms as $pdf) {
                            DB::table('disease_1')->where('questions_id', '=', $pdf->question_id)->delete();
                        }
                        $patients_disease_forms->delete();
                    }
                    DB::table('patients')->where('person_id', '=', $id)->delete();
                    DB::table('doctors')->where('doctor_id', '=', $patient->doctor_id)->delete();
                }
                DB::table('relationship')->where('person_1_id', '=', $id)->delete();
                DB::table('relationship')->where('person_2_id', '=', $id)->delete();
                DB::table('persons')->where('person_id', '=', $id)->delete();*/
             DB::commit();
             \Session::set('last_deleted_id', '');
             $result['status'] = "Success";
             $result['message'] = "Undo delete id:" . $id;
             return response()->json($result, 200);
         } else {
             $result['status'] = "Nothing to undo";
             $result['message'] = "ID is null " . $id;
             return response()->json($result, 200);
         }
     } catch (Exception $e) {
         DB::rollback();
         $result['status'] = "Error";
         $result['message'] = $e->getMessage();
         return response()->json($result, 200);
     }
 }
Пример #12
0
 public function chooser()
 {
     \Session::set('locale', \Input::get('locale'));
     return \Redirect::back();
 }
Пример #13
0
 public function optimize()
 {
     if (\Auth::user()->is_superadmin) {
         if (!empty($_POST)) {
             if (\Request::get('formSubmit') == "Proceed") {
                 if (\Request::get('optimizationOption') == "clearCompiledAndOptimize") {
                     Artisan::call('clear-compiled');
                     Artisan::call('optimize', ['--force' => true]);
                     MessageManager::setSuccess("Optimized class loader generated");
                 } else {
                     if (\Request::get('optimizationOption') == "clearCompiled") {
                         Artisan::call('clear-compiled');
                         MessageManager::setSuccess("Compiled classes cleared");
                     }
                 }
             }
             return \Redirect::to("/admin");
         }
         $data = array('active' => false, 'modelConfig' => new ModelConfig());
         return \View::make("gtcms.admin.elements.optimizationOptions")->with($data);
     } else {
         \Session::set('accessDenied', true);
         return self::restricted();
     }
 }
Пример #14
0
 public function setProgress($type, $value)
 {
     \Session::set('progress_' . $type, $value);
 }
Пример #15
0
 public function campaignSwitch(Request $request)
 {
     $campaign = Campaign::find($request->get('campaign_id'));
     \Session::set('campaign', $campaign);
     //Check if we're an admin in the campaign
     $membership = CampaignMembership::where('user_id', \Auth::user()->id)->where('campaign_id', $campaign->id)->first();
     if ($membership->is_dm == 1) {
         \Session::set('dm', 1);
     } else {
         \Session::set('dm', 0);
     }
     return redirect(\URL::to('/'));
 }
Пример #16
0
 public function chooseLanguage(Request $request)
 {
     \Session::set('locale', $request->get("lang"));
     return redirect("/");
 }
Пример #17
0
 public function getEditLinks()
 {
     \Session::set('url.intended', act('user@getEdit'));
     //used in case the user tries to associate to a network
     return view('user.edit_links', ['user' => \Auth::user()]);
 }