function Check_User_Cart() { $Identifier = ''; if (!Sentry::check()) { return false; } else { $Identifier = Sentry::user()->id; if (Cookie::has('Anon_Cart_Extension')) { $AnonIdentifier = Cookie::get('Anon_Cart_Extension'); $dataAnon = Cache::get('user_cart.' . $AnonIdentifier); if (Cache::has('user_cart.' . $Identifier)) { $dataUser = Cache::get('user_cart.' . $Identifier); if ($dataAnon != null && $dataUser != null) { foreach ($dataAnon as $key => $value) { if (!isset($dataUser[$key])) { $dataUser[$key] = $value; } } Cache::forever('user_cart.' . $Identifier, $dataUser); Cache::forget('user_cart.' . $AnonIdentifier); } } else { if ($dataAnon != null) { Cache::forever('user_cart.' . $Identifier, $dataAnon); Cache::forget('user_cart.' . $AnonIdentifier); } } } } }
/** * @param none * @throws none * @returns void */ public function before() { $result = array(); // users need to be logged in to access this controller if (!\Sentry::check()) { $result = array('message' => 'You need to be logged in to access that page.', 'url' => '/admin/login'); // Don't show this message if url is just 'admin' if (\Uri::string() == 'admin/admin/index') { unset($result['message']); } \Session::set('redirect_to', \Uri::admin('current')); } else { if (!\Sentry::user()->is_admin()) { $result = array('message' => 'Access denied. You need to be a member of staff to access that page.', 'url' => '/admin/login'); \Session::set('redirect_to', \Uri::admin('current')); } } if (!empty($result)) { if (\Input::is_ajax()) { \Messages::error('You need to be logged in to complete this action.'); echo \Messages::display('left', false); exit; } else { if (isset($result['message'])) { \Messages::warning($result['message']); } \Response::redirect($result['url']); } } parent::before(); }
public function post_create() { $posts = Input::all(); $title = $posts['thread_name']; $contentRaw = $posts['inputarea']; if ($title != '' && strlen($contentRaw) > 10) { $alias = Str::slug($title, '-'); $exist = Thread::where('alias', '=', $alias)->first(); if ($exist != null) { return Redirect::to($exist->id); } $threadData = array('title' => $posts['thread_name'], 'alias' => $alias, 'type' => 0, 'poster_ip' => Request::ip(), 'dateline' => date("Y-m-d H:i:s"), 'last_message_at' => date("Y-m-d H:i:s")); $thread = Thread::create($threadData); if ($thread != null) { $content = static::replace_at(BBCode2Html(strip_tags_attributes($contentRaw)), $thread->id); $postData = array('thread_id' => $thread->id, 'entry' => $content, 'userip' => Request::ip(), 'user_id' => Sentry::user()->id, 'datetime' => date("Y-m-d H:i:s"), 'count' => 1, 'type' => 0); $pst = Post::create($postData); if ($pst != null) { return Redirect::to($thread->id); } } } else { return Redirect::to(URL::full()); } }
public function before() { $this->nocversion = 'none'; $path = $this->request->route->path; if ($path != 'auth/login') { $this->check_license($path); } parent::before(); //$auth = Auth::instance(); //Auth::instance()->login('hrvoje','hajduk81'); /* if(!$this->check_license()) \Response::redirect(\Config::get('base_url').'/ajax/license'); */ $uri_string = explode('/', Uri::string()); if (count($uri_string) > 1 and $uri_string[0] == 'auth' and $uri_string[1] == 'login') { return; } if ($path != '_root_') { if (\Sentry::check()) { $this->user = Sentry::user()->get('id'); $this->username = Sentry::user()->get('username'); return; } else { $this->user = false; $this->username = ''; \Response::redirect(\Config::get('base_url') . 'auth/login'); } } }
/** * Do register * * @return void */ public function post_register() { // data pass to the view $data = array(); // do valiation $rules = array('email' => 'required|email', 'password' => 'required|confirmed', 'password_confirmation' => 'required'); $input = Input::get(); $validation = Validator::make($input, $rules); if ($validation->fails()) { return Redirect::to('user/register')->with_input()->with_errors($validation); } // add user try { $user = Sentry::user()->register(array('email' => Input::get('email'), 'password' => Input::get('password'))); if (!$user) { $data['errors'] = 'There was an issue when add user to database'; } } catch (Sentry\SentryException $e) { $data['errors'] = $e->getMessage(); } if (array_key_exists('errors', $data)) { return Redirect::to('user/register')->with_input()->with('errors', $data['errors']); } else { return Redirect::to('user/login')->with('hash_link', URL::base() . '/user/activate/' . $user['hash']); } }
public function action_edit($id = null) { if (!Sentry::user()->has_access('groups_edit')) { self::no_access(); } $groups = Model_Group::access(intval($id)); $group['permissions'] = json_decode($groups[0]['permissions'], true); $group['groupName'] = $groups[0]['name']; if (Input::method() == 'POST') { if (!Input::post('groupName')) { Session::set_flash('error', 'Please choose a name for the group'); } else { $post = Input::post(); $groupName = $post['groupName']; unset($post['groupName']); // JSON_NUMERIC_CHECK to keep the int $permissions = json_encode($post, JSON_NUMERIC_CHECK); $updated = Model_Group::editGroup(intval($id), $groupName, $permissions); if ($updated) { Session::set_flash('success', 'The group ' . $groupName . ' has been successfully edited'); Response::redirect('groups'); } } } $var = self::access(); // all the access View::set_global('var', $var); // all the needed informations about the current group View::set_global('group', $group); $this->template->h2 = 'Edit Group'; $this->template->title = 'Groups » Edit'; $this->template->js .= Asset::js(array('mylibs/jquery.validate.js', 'script.js')); $this->template->content = View::forge('groups/edit'); }
public function action_to($id = null) { // redirect if no id if ($id == null) { Response::redirect('message'); } // redirect if no right access if (!Sentry::user()->has_access('message_send')) { Session::set_flash('error', "You are not allowed to send message"); Response::redirect(''); } $data['user'] = Sentry::user(intval($id)); $data['messages'] = Model_Message::messageWith($data['user'], $this->current_user); if (Input::method() == 'POST') { $message = Model_Message::forge(array('subject' => Input::post('subject'), 'content' => Input::post('content'), 'to' => $data['user']->id, 'from' => $this->current_user->id, 'parent_id' => '', 'read' => 0, 'from_delete' => 0, 'to_delete' => 0)); if ($message and $message->save()) { Session::set_flash('success', 'Message successfuly sent to ' . $data['user']->username); Response::redirect('message'); } else { Session::set_flash('error', 'Could not send the message.'); } } $this->template->h2 = 'Send Message to ' . $data['user']->username; $this->template->title = 'Message » to'; $this->template->content = View::forge('message/to', $data); }
public static function check_logged() { $logged = true; if (!(\Sentry::check() && !\Sentry::user()->is_admin())) { $logged = false; } return $logged; }
public function get_checkperm() { if (Sentry::user()->has_access('can_edit')) { return json_encode(array('result' => true)); } else { return json_encode(array('result' => false)); } }
public function action_index() { $view = View::make('dashboard'); $view->user = Sentry::user(); $view->title = 'Kullanıcı Paneli'; $count = DB::table('threads')->where('last_message_at', '=', DB::Raw('NOW()'))->count(); $view->count = $count; return $view; }
public function before() { parent::before(); $this->template->js = Asset::js(array('mylibs/jquery.jgrowl.js', 'mylibs/jquery.validate.js', 'plugins.js', 'script.js', 'mylibs/jquery.chosen.js', 'mylibs/jquery.ui.touch-punch.js')); if (!Sentry::user()->has_access('forms_index')) { Session::set_flash('error', "You cannot access that section"); Response::redirect(''); } }
public function before() { parent::before(); \Theme::instance()->active('admin'); \Theme::instance()->set_template($this->template); // Assign current_user to the instance so controllers can use it $this->current_user = \Sentry::check() ? \Sentry::user() : null; // Set a global variable so views can use it \View::set_global('current_user', $this->current_user); }
/** * Save users that commited insert/update operations * * @param $vars */ protected function prep_values($vars) { // Set user who is created/updated item if ($this->is_new()) { $vars['user_created'] = \Sentry::user()->id; } else { $vars['user_updated'] = \Sentry::user()->id; } return $vars; }
/** * After controller method has run, render the theme template * * @return mixed: false, user, guest */ public function check_logged_type() { if (!$this->check_logged()) { return false; } $user = \Sentry::user(); if (!empty($user['metadata']) && $user['metadata']['guest'] == 1) { return 'guest'; } return 'user'; }
private function locate($sub) { $this->user = \Sentry::user()->get('id'); $ips = \Basic\Model_Network_Ip::find()->where('addrint', '<=', $sub['range_to'])->where('addrint', '>=', $sub['range_from'])->get(); foreach ($ips as $ip) { $device = $ip->network->device; if ($this->user == $device->meta_update_user) { $this->update_device($ip); } } }
public function action_index() { if (!Sentry::user()->has_access('charts_monthly')) { Session::set_flash('error', 'You don\'t have access to the charts'); Response::redirect(''); } $data['id'] = ''; $this->template->js = Asset::js(array('plugins.js', 'mylibs/jquery.ba-resize.js', 'mylibs/jquery.easing.1.3.js', 'mylibs/jquery.ui.touch-punch.js', 'libs/date.js', 'script.js', 'mylibs/highcharts.js', 'mylibs/HighCharts/exporting.js', 'charts.js')); $this->template->css = Asset::css(array('plugin.charts.css')); $this->template->title = 'Charts'; $this->template->h2 = 'Monthly Subscription in all the forms'; $this->template->content = View::forge('charts/view'); }
/** * Get enabled payments * * @access public * @param string $get = Get payments that are: enabled | disabled | all * @param string $load_config = Load payments config * @param bool $allowed * @return array * */ public function action_get_payments($get = 'enabled', $load_config = true, $allowed = true) { if (!\Request::is_hmvc()) { die('Access is denied.'); } $user = \Sentry::user(); $out = array(); $path = APPPATH . "modules" . DS . "payment" . DS . "config" . DS; $config_files = \File::read_dir($path); if (!empty($config_files)) { foreach ($config_files as $file) { $file_parts = pathinfo($file); $payment_config = (include_once $path . $file); // Check allowed if ($allowed && isset($payment_config['allowed']) && is_array($payment_config['allowed'])) { foreach ($payment_config['allowed'] as $key => $value) { if (!isset($user['metadata'][$key]) || !in_array($user['metadata'][$key], $value)) { continue 2; } } } switch ($get) { case 'enabled': if ($payment_config['enabled']) { $out[$payment_config['code']] = $payment_config['name']; if ($load_config) { \Config::load('payment::' . $file_parts['filename'], $file_parts['filename']); } } break; case 'disabled': if (!$payment_config['enabled']) { $out[$payment_config['code']] = $payment_config['name']; if ($load_config) { \Config::load('payment::' . $file_parts['filename'], $file_parts['filename']); } } break; default: case 'all': $out[$payment_config['code']] = $payment_config['name']; if ($load_config) { \Config::load('payment::' . $file_parts['filename'], $file_parts['filename']); } } } } return $out; }
public function action_set() { if ($_POST) { /* 'eid':eid, 'num':num, 'did':CACTI.did, 'sour':$('#cacti_source').val(), 'graph':$('#cacti_graph').val() */ $this->user = \Sentry::user()->get('id'); $val = \Validation::forge(); $val->add_field('eid', 'Action', 'required|min_length[1]|max_length[20]'); $val->add_field('did', 'Action', 'required|min_length[1]|max_length[20]'); $val->add_field('sour', 'Value', 'required|min_length[1]'); $val->add_field('graph', 'Value', 'required|min_length[1]|max_length[200]'); $val->add_field('num', 'Value', 'required|max_length[200]'); $val->add_field('type', 'Value', 'required|max_length[200]'); $val->add_field('name', 'Value', 'required|max_length[200]'); if ($val->run()) { if ($val->validated('type') == 'custom') { $cacti = Model_Cacti::find($val->validated('eid')); if (!$cacti) { $query = array('sourceID' => $val->validated('sour'), 'name' => $val->validated('name'), 'num' => '0', 'macID' => '0', 'graphID' => $val->validated('graph'), 'meta_update_time' => time(), 'meta_update_user' => $this->user, 'deviceID' => $val->validated('did')); $cacti = new Model_Cacti($query); } else { $cacti->sourceID = $val->validated('sour'); $cacti->graphID = $val->validated('graph'); $cacti->meta_update_time = time(); $cacti->name = $val->validated('name'); } $cacti->save(); } elseif ($val->validated('type') == 'port') { $mac = \Basic\Model_Network_Mac::find($val->validated('eid')); $cacti = Model_Cacti::find()->where('macID', $mac->id)->get_one(); if (!$cacti) { $query = array('sourceID' => $val->validated('sour'), 'name' => $val->validated('name'), 'num' => $val->validated('num'), 'macID' => $val->validated('eid'), 'graphID' => $val->validated('graph'), 'meta_update_time' => time(), 'meta_update_user' => $this->user, 'deviceID' => $val->validated('did')); $cacti = new Model_Cacti($query); } else { $cacti->sourceID = $val->validated('sour'); $cacti->graphID = $val->validated('graph'); $cacti->meta_update_time = time(); } $cacti->save(); } echo json_encode(array('id' => $cacti->id, 'name' => $cacti->name, 's' => $cacti->sourceID, 'g' => $cacti->graphID)); } } }
/** * Admin dashboard view * * @access public * @return void */ public function action_dashboard($type = 'm') { $orders = \Dashboard::get_order($type); $visitors = \Dashboard::get_visits($type); $c_orders = \Dashboard::get_chart_order($type); $co_html = ''; foreach ($c_orders as $order) { $co_html .= '[' . (int) $order['MNTH'] . ', ' . (double) $order['total_price'] . ']'; $co_html .= ','; } $c_visits = \Dashboard::get_chart_visits(); $visits_html = ''; foreach ($c_visits as $order) { $visits_html .= '[' . (int) $order['MNTH'] . ', ' . (double) $order['visits'] . ']'; $visits_html .= ','; } if ($type == 'd') { $type = 'Today'; } elseif ($type == 'm') { $type = 'This Month'; } elseif ($type == 'y') { $type = 'This Year'; } else { $type = 'This Week'; } $users = \Sentry::user()->all('front'); // if(!empty($users)) // { // foreach($users as $key => $item) // { // $user_tmp = \Sentry::user((int)$item['id']); // if($user_tmp->get('metadata.guest') == 1) // unset($users[$key]); // else // $users[$key] = $user_tmp; // } // } $items['orders'] = $orders[0]['total_order']; $items['sales'] = $orders[0]['total_sales']; $items['visits'] = $visitors[0]['visits']; $items['users'] = count($users); $items['chart_orders'] = $co_html; $items['chart_visits'] = $visits_html; $items['type'] = $type; //\View::set_global('full_page', true); \View::set_global('title', 'Dashboard'); \Theme::instance()->set_partial('content', $this->view_dir . 'dashboard')->set('items', $items); }
public function post_setAddress() { $data = Input::all(); //get user cart cache $Cart = Cache::get("user_cart." . Sentry::user()->id); switch ($data['type']) { case 'delivery': $Cart['Addresses']['delivery'] = $data['addrID']; break; case 'billing': $Cart['Addresses']['billing'] = $data['addrID']; break; } Cache::forever("user_cart." . Sentry::user()->id, $Cart); $AddressInfo = Address::with(array('getCity', 'getTown'))->where('id', '=', $data['addrID'])->first(); return Response::eloquent($AddressInfo); }
private function parse_settings() { //when no user loged in, defualt background $a = array(array('name' => 'background', 'value' => '2'), array('name' => 'tutorials', 'value' => '0')); if (\Sentry::check()) { $a = array(); $user = \Sentry::user()->get('id'); $query = \Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); if ($query->count() == 0) { // user (demo) loged first time, make defualt settings $this->default_settings($user); $query = \Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); } foreach ($data as $s) { $m = array('name' => $s->name, 'value' => $s->value); array_push($a, $m); } /* $data=Model_Monitoring_Data::find()->where('meta_update_user',$user)->get_one(); $monitor=array( 'iconw'=>$data['iconw'], 'iconc'=>$data['iconc'], 'iconu'=>$data['iconu'], 'osdw'=>$data['osdw'], 'osdu'=>$data['osdu'], 'osdc'=>$data['osdc'], 'soundw'=>$data['soundw'], 'soundu'=>$data['soundu'], 'soundc'=>$data['soundc'] ); $m=array('name'=>'monitoring','value'=>$monitor); array_push($a, $m); } */ } return $a; }
/** * The module index * * @return Response */ public function action_index() { \View::set_global('full_page', true); $this->data['title'] = 'Login'; // create the form fieldset, do not add an {open}, a closing ul and a {close}, we have a custom form layout! $fieldset = \Fieldset::forge('login'); $fieldset->add('username', 'Username', array('maxlength' => 50), array(array('required')))->add('password', 'Password', array('type' => 'password', 'maxlength' => 255), array(array('required'), array('min_length', 8))); // was the login form posted? if (\Input::post()) { // run the form validation if (!$fieldset->validation()->run()) { // set any error messages we need to display foreach ($fieldset->validation()->error() as $error) { \Messages::error($error); } } else { try { if (\Sentry::user(\Input::param('username'))->is_admin()) { // check the credentials. $valid_login = \Sentry::login(\Input::param('username'), \Input::param('password'), true); if ($valid_login) { \Messages::success('You have logged in successfully'); if (\Session::get('redirect_to')) { $redirect = \Session::get('redirect_to'); \Session::delete('redirect_to'); } \Response::redirect(isset($redirect) ? $redirect : 'admin'); } else { \Messages::error('Username and/or password is incorrect'); } } else { \Messages::error('Username and/or password is incorrect'); } } catch (\SentryAuthException $e) { $errors = $e->getMessage(); \Messages::error($errors); } } } \Theme::instance()->set_partial('content', 'views/login')->set('fieldset', $fieldset, false); }
public function action_index() { $data['lang'] = array(); if (Sentry::user()->has_access('customers_en')) { $data['lang']['en'] = 'English'; } if (Sentry::user()->has_access('customers_ru')) { $data['lang']['ru'] = 'Russian'; } if (Sentry::user()->has_access('customers_tw')) { $data['lang']['tw'] = 'Taiwanese'; } if (Sentry::user()->has_access('customers_cn')) { $data['lang']['cn'] = 'Chinese'; } // $lang = array("en" => "English", "cn" => "Chinese", "ru" => "Russian", "tw" => "Taiwanese"); // $this->template->less = Asset::less('customic.less'); $this->template = \View::forge('dashboard'); $this->template->title = $data['data']['title'] = 'Welcome to IKON backoffice'; $this->template->content = View::forge('welcome/index', $data); }
private function parse_settings() { //when no user loged in, defualt background $a = array(array('name' => 'background', 'value' => '2'), array('name' => 'tutorials', 'value' => '0')); if (Sentry::check()) { $a = array(); $user = Sentry::user()->get('id'); $query = Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); if ($query->count() == 0) { // user (demo) loged first time, make defualt settings $this->default_settings($user); $query = Model_Settings::find()->where('meta_update_user', $user); $data = $query->get(); } foreach ($data as $s) { $m = array('name' => $s->name, 'value' => $s->value); array_push($a, $m); } } return $a; }
public function create_user($data, $is_admin) { Session::load(); Bundle::start('sentry'); try { $user_id = Sentry::user()->create($data); if ($user_id) { if ($is_admin) { $permissions = array('is_admin' => 1); if (Sentry::user($data['email'])->update_permissions($permissions)) { // all good } else { throw new \Exception('Error updation permission.'); } } } else { throw new \Exception('Error creating user.'); } } catch (Sentry\SentryException $e) { throw $e; } }
public function get_conversation($conHash) { $ajaxRequest = false; $thread = false; $numbered = false; if (Request::ajax()) { $ajaxRequest = true; } $userid = Sentry::user()->id; /*There should be some protection about sniffing other messages*/ /*Let check if this conversation exist*/ $conThread = Conversation::where('id', '=', $conHash)->first(); if (!$conThread) { return Redirect::to_action('messages@index'); } elseif ($conThread->user_id != $userid && $conThread->receiver_id != $userid) { /*now we are looking if this conversation is ours*/ return Redirect::to_action('messages@index'); } $conversation = Message::with('author')->where('conversation_id', '=', $conHash)->order_by('date', 'asc')->get(); if (!$ajaxRequest) { //This gets conversation that user started or we started.. $conversation2 = Conversation::with('Author')->where('receiver_id', '=', Sentry::user()->id)->or_where(function ($query) { $query->where('user_id', '=', Sentry::user()->id); })->order_by('date', 'desc')->get(); $view = View::make('messages.index'); $view->cons = $conversation2; $view->ifgetverb = true; $view->title = "Mesajlar"; $view->conversation = $conversation; $view->coninfo = $conThread; return $view; } else { $view = View::make('messages.ajaxrequest'); $view->conversation = $conversation; $view->coninfo = $conThread; return $view; } }
public function action_index() { Config::load('password', true); $reset = Config::get('password.reset'); $data['instaled'] = true; $data['errors'] = ''; if ($reset) { $data['pass1'] = ''; $data['pass2'] = ''; if ($_POST) { $data = $_POST; $data['errors'] = array(); $data['instaled'] = true; $val = Validation::forge('users'); $val->add_field('pass1', 'New Password', 'required|min_length[4]|max_length[40]'); $val->add_field('pass2', 'Repeat', 'required|min_length[4]|max_length[40]'); if ($val->run()) { if ($val->validated('pass1') != $val->validated('pass2')) { $data['errors'] = array('New password and confirmation password do not match!'); } else { Config::load('install', true); $name = Config::get('install.user'); $user = \Sentry::user($name); $update = $user->update(array('password' => $val->validated('pass2'))); Config::delete('password.reset'); Config::save('password', 'password'); return Response::forge(View::forge('install/newpass', $data)); } } else { $data['errors'] = $val->error(); } } return Response::forge(View::forge('install/reset', $data)); } else { return Response::forge(View::forge('noclayer/404'), 404); } }
/** * Save users that commited insert/update operations * * @param $vars */ protected function prep_values($vars) { // Set user who is created/updated item if ($this->is_new()) { $vars['user_created'] = \Sentry::user()->id; // Auto increment sort column $vars['sort'] = \DB::expr('(SELECT COALESCE(MAX(tmp.sort)+1, 1) FROM ' . static::$_table_name . ' tmp)'); } else { $vars['user_updated'] = \Sentry::user()->id; } return $vars; }
/** * Create user * * @access public * @return void */ public function action_signup() { $settings = \Config::load('autoresponder.db'); //if (!(\Sentry::check() && !\Sentry::user()->is_admin())) if ($this->check_logged_type() != 'user') { if (\Sentry::check()) { \Sentry::logout(); } \View::set_global('title', 'Registration'); if (\Input::post('signup')) { $val = \User\Controller_Validate::forge('create'); // $val->set_message('unique', 'It appears you have already registered using this email address.'); if ($val->run()) { // Get POST values $insert = \Input::post(); array_walk($insert, create_function('&$val', '$val = trim($val);')); try { $username = $insert['email']; $email = $insert['email']; $password = $insert['password']; $user_group = $insert['user_group']; unset($insert['signup'], $insert['user_group'], $insert['username'], $insert['email'], $insert['password'], $insert['confirm_password'], $insert['confirm_email'], $insert['terms']); // create the user - no activation required $vars = array('username' => $username, 'email' => $email, 'password' => $password, 'metadata' => $insert); $user_registration = \Sentry::user()->register($vars); $user = \Sentry::user($user_registration['id']); // Add user to 'customer' group (id = 3) if ($user_registration and $user->add_to_group($user_group)) { if (true) { $email_data = array('site_title' => \Config::get('site_title'), 'customer_name' => ucwords($insert['first_name']), 'phone' => $insert['phone'], 'activation_link' => \Uri::front_create('user/activate/' . $user_registration['hash'])); // Send email to user $email_sent = \App\Emailer::send_email_to_user($vars['email'], $email_data['customer_name'], 'Activate your account with ' . $settings['website'], '_email/user_register_confirm', $email_data); // Send email to admins \App\Emailer::send_email_to_group('register', 'Activate your account with ' . $settings['website'], '_email/user_register_confirm', $email_data); if ($email_sent) { // \Messages::success('Welcome ' . $email_data['customer_name'] . ' to ' . $email_data['site_title'] . ', thank you for registering with us. An email has been sent to ' . $vars['email'] . ' with your account information.'); \Messages::success('Thanks for registering with Evan Evans. We have sent an email to your nominated address with a link to activate your account. Sometimes inboxes can be a little overprotective so you may need to check your junk or spam folders.'); } // else // { // \Messages::error('An error occurred while sending email, please try again later.'); // } } \Response::redirect(\Input::referrer(\Uri::front_create('user/login'))); } } catch (\Sentry\SentryException $e) { // show validation errors //\Messages::error('<h4>There was an error while trying to create user</h4>'); $errors = $e->getMessage(); \Messages::error($errors); } } else { if ($val->error() != array()) { // show validation errors //\Messages::error('<h4>There was an error while trying to create user</h4>'); foreach ($val->error() as $e) { \Messages::error($e->get_message()); } } } } if (\Input::is_ajax()) { // We need to save an user inputs in database for advertising use if (\Input::post()) { // Get POST values $insert = \Input::post(); array_walk($insert, create_function('&$val', '$val = trim($val);')); if ($insert['first_name'] || $insert['last_name'] || $insert['email']) { $insert['created_at'] = time(); \DB::insert('users_tmp')->set($insert)->execute(); } } echo \Theme::instance()->view($this->view_dir . 'signup'); } else { \Theme::instance()->set_partial('content', $this->view_dir . 'single_signup'); } } else { //Keep existing messages \Messages::instance()->shutdown(); \Response::redirect(\Uri::front_create('user/account/dashboard')); } }
public function action_unblock() { if (!Sentry::user()->has_access('users_unblock')) { return; } $user_id = Input::post('user_id'); if ($user_id == null) { throw new Exception('user id cannot be empty'); } $data['json'] = Sentry::attempts($user_id)->clear(); $this->template->content = View::forge('ajax/view', $data); }