public function create_complaint() { $validator = Validator::make(array(varlang('numele-prenume') => Input::get('name'), varlang('email') => Input::get('email'), varlang('subiect-1') => Input::get('subject'), varlang('cod-de-verificare') => \SimpleCapcha::valid('complaint', Input::get('capcha')) ? 1 : null), array(varlang('numele-prenume') => 'required', varlang('email') => 'email|required', varlang('subiect-1') => 'required', varlang('cod-de-verificare') => 'required')); $return = array('message' => '', 'error' => 0); if ($validator->fails()) { $return['message'] = implode(' ', $validator->messages()->all('<p>:message</p>')); $return['error'] = 1; } else { $complaint = new SComplaintsModel(); $complaint->post_id = Input::get('post_id'); $complaint->username = Input::get('name'); $complaint->email = Input::get('email'); $complaint->address = Input::get('address'); $complaint->title = Input::get('subject'); $complaint->text = Input::get('message'); $complaint->is_private = Input::get('private'); $complaint->save(); Template::viewModule($this->module_name, function () use($complaint) { $sendToUsers = \User::withRole('user-getemails'); $data['complaint'] = $complaint; foreach ($sendToUsers as $user) { $data['user'] = $user; \Mail::send('views.complaint_email', $data, function ($message) use($user) { $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA'); $message->subject("New message"); $message->to($user->email); }); } }); } return $return; }
public function postTake() { $capcha = Input::get('capcha'); if (SimpleCapcha::valid('login_admin', $capcha) === false) { return Redirect::intended('auth/index')->with('auth_error', 'Invalid Capcha'); } if (Auth::attempt(array('username' => Input::get('username'), 'password' => Input::get('password')))) { Log::info('User login'); return Redirect::intended('/'); } else { return Redirect::intended('auth/index')->with('auth_error', 'Invalid Username or Password'); } }
public static function contactTopSubmit() { $data = array(varlang('name-last-name') => Input::get('name'), varlang('email') => Input::get('email'), varlang('message') => Input::get('message'), varlang('cod-verificare') => SimpleCapcha::valid('contact_top', Input::get('capcha')) ? 1 : null); $validator = Validator::make($data, array(varlang('name-last-name') => 'required', varlang('email') => 'email|required', varlang('message') => 'required', varlang('cod-verificare') => 'required')); $return = array('message' => '', 'error' => 0); if ($validator->fails()) { $return['message'] = implode(' ', $validator->messages()->all('<p>:message</p>')); $return['error'] = 1; } else { SimpleCapcha::destroy('contact_top'); EmailModel::sendToAdmins("Contact form", 'email.contact', $data); $return['html'] = "Mesajul dvs a fost receptionat"; } return $return; }