public function index() { $group = $this->config->item('admin_group', 'ion_auth'); $ia = new Ion_auth_model(); $limit = $this->config->config['users_on_page']; $page = !empty($_GET['page']) ? $_GET['page'] : 1; if ($page == 1) { $offset = ''; } else { $offset = $limit * ($page - 1); } $searchText = Arr::get($_GET, 'search', ''); $filter = Arr::get($_GET, 'filter', ''); $admins = $ia->getUsersByGroup($group); if ($searchText || $filter !== '') { $admins->search($searchText, $filter, null, $limit, $offset); JsSettings::instance()->add(array('search' => $searchText, 'filter' => $filter, 'group' => $group)); } else { if ($admins) { $admins->get($limit, $offset); } } $this->template->set('users', $admins); $this->template->set('group', $group); $this->template->set('limit', $limit); $this->template->set('page', $page); $this->template->set('c_user', $this->c_user); $this->template->render(); }
public function index() { $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean'); $this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean'); if ($this->input->post()) { $config = $this->config->config; if (!$config['change_settings']) { $this->addFlash(lang('demo_error')); } else { $data = array('first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name')); if ($this->input->post('old_password') || $this->c_user->password == 0) { $old_password = $this->input->post('old_password'); $ion_model = new Ion_auth_model(); if ($this->c_user->password == 0) { $valid_old = true; } else { $valid_old = $ion_model->hash_password_db($this->c_user->id, $old_password); } $password_min = $this->config->item('min_password_length', 'ion_auth'); $password_max = $this->config->item('max_password_length', 'ion_auth'); $this->form_validation->set_rules('new_password', lang('new_password'), 'required|min_length[' . $password_min . ']|max_length[' . $password_max . ']|matches[confirm_password]'); $this->form_validation->set_rules('confirm_password', lang('confirm_new_password'), 'required'); if ($valid_old) { $data['password'] = $this->input->post('new_password'); } else { $this->form_validation->create_error(lang('invalid_old_password_error')); } } if ($this->form_validation->run() === true) { $update = $this->ion_auth->update($this->c_user->id, $data); if ($update) { $this->addFlash(lang('personal_settings_updated'), 'success'); redirect('settings/personal'); } else { $this->addFlash($this->ion_auth->errors()); } } else { if (validation_errors()) { $this->addFlash(validation_errors()); } } } } $this->load->config('timezones'); $timezones = $this->config->item('timezones'); $this->template->set('timezones', $timezones); $current_timezone = User_timezone::get_user_timezone($this->c_user->id, true); $this->template->set('current_timezone', $current_timezone); $this->template->set('email', $this->c_user->email); $this->template->set('first_name', $this->form_validation->set_value('first_name', $this->c_user->first_name)); $this->template->set('last_name', $this->form_validation->set_value('last_name', $this->c_user->last_name)); CssJs::getInst()->add_js(array('controller/settings/index.js', 'controller/settings/personal/index.js')); $this->template->render(); }
public function __construct() { parent::__construct(); $this->tables = $this->config->item('tables_admins', 'ion_auth'); $this->columns = $this->config->item('columns_admins', 'ion_auth'); $this->_extra_where = array('user_type' => 'admin'); $this->_extra_set = array('user_type' => 'admin'); }
public function index() { $group = $this->config->item('manager_group', 'ion_auth'); $ia = new Ion_auth_model(); $limit = $this->config->config['users_on_page']; $page = !empty($_GET['page']) ? $_GET['page'] : 1; if ($page == 1) { $offset = ''; } else { $offset = $limit * ($page - 1); } $searchText = Arr::get($_GET, 'search', ''); $filter = Arr::get($_GET, 'filter', ''); $ownerId = $this->ion_auth->is_superadmin() ? null : $this->c_user->id; if ($searchText || $filter != '') { $managers = $ia->getUsersByGroup($group); if ($managers) { $managers->search($searchText, $filter, null, $limit, $offset, $ownerId); } $searchList = true; JsSettings::instance()->add(array('search' => $searchText, 'filter' => $filter, 'group' => $group)); } else { if ($this->ion_auth->is_superadmin()) { $managers = $ia->getUsersByGroup($group); if ($managers) { $managers->get($limit, $offset); } $searchList = true; } else { $managers = new User(); $managers->getManagerUsers($limit, $offset, $ownerId); $searchList = false; } } $this->template->set('searchList', $searchList); $this->template->set('users', $managers); $this->template->set('group', $group); $this->template->set('page', $page); $this->template->set('limit', $limit); $this->template->set('c_user', $this->c_user); $this->template->render(); }
function __construct() { parent::__construct(); $this->load->database(); $this->lang->load('ion_auth_acl'); $this->load->config('ion_auth_acl', TRUE); // initialize additional db tables data $this->tables = array_merge($this->tables, $this->config->item('tables', 'ion_auth_acl')); // initialize additional db join data $this->join = array_merge($this->join, $this->config->item('join', 'ion_auth_acl')); }
public function login($userId = null) { if (!$userId) { $userId = $this->getRequest()->request->get('user', ''); } $user = new User($userId); $code = $this->ion_auth->getManagerCode(); if ($code && ($manager = $this->ion_auth->codeManagerExist($code))) { if (!$manager->isManager($userId)->exists()) { $error[] = 'You are not a manager of this user'; } if ($this->get('core.status.system')->isPaymentEnabled() && !$user->hasActiveSubscription()) { $error[] = 'Selected customer do not have an active subscription'; } if ($this->ion_auth->is_admin($userId) || $this->ion_auth->is_manager($userId)) { $error[] = 'User is not a simple member'; } if (empty($error)) { $manager->manager_code = $this->ion_auth->createManagerCode(); $manager->manager_login_as = $userId; if ($manager->save()) { $ionAuth = new Ion_auth_model(); $ionAuth->loginForce($user->email); $this->addFlash('You are succesfully login as another user', 'success'); } } else { foreach ($error as $e) { $this->addFlash($e); } //$this->template->set('email', $manager->manager_user->get()->email); $this->template->render('manager'); return; } } redirect(); }
/** * Complete registration with invite */ public function invite($code = null) { $this->load->config('manage_users'); $timelimit = time() - $this->config->config['invite_timelimit']; $user = new User(); if ($post = $this->input->post()) { $password_min = $this->config->item('min_password_length', 'ion_auth'); $password_max = $this->config->item('max_password_length', 'ion_auth'); $this->form_validation->set_rules('password', 'Password', 'required|min_length[' . $password_min . ']|max_length[' . $password_max . ']|matches[confirm]'); if ($this->form_validation->run() === TRUE) { $user->getInviteUser($post['code'], $timelimit); if (!$user->exists()) { $this->addFlash('Params of your invitation are not valid'); redirect('auth'); } $ion_auth = new Ion_auth_model(); $result = $ion_auth->registerByInvite(array('id' => $user->id, 'password' => $post['password'])); if ($result) { $email = $user->email; $sender = $this->get('core.mail.sender'); $sender->sendRegistrationMail(array('user' => $user)); $this->addFlash('Registered', 'success'); $remember = TRUE; $logged = $this->ion_auth->login($email, $post['password'], $remember); if ($logged) { redirect('/dashboard'); } redirect('auth'); } else { redirect('auth'); } } else { if (validation_errors()) { $this->addFlash(validation_errors()); } $this->template->set('code', $post['code']); $this->template->render(); } } else { if ($code) { $user->getInviteUser($code, $timelimit); if (!$user->exists()) { $this->addFlash('Your inviting link is not valid'); redirect('auth'); } $newCode = $this->ion_auth->createInviteCode(); $user->invite_code = md5($newCode); if ($user->save()) { $this->template->set('code', $newCode); } $this->template->render(); } else { redirect('auth'); } } }
public function __construct() { parent::__construct(); }
function __construct() { parent::__construct(); $this->db = new Nyankod\JsonFileDB(SITE_PATH . 'db/'); }
public function index() { $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean'); $this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean'); if (isset($_POST) && !empty($_POST)) { $config = $this->config->config; if (!$config['change_settings']) { $this->addFlash('<span class="err_icon"></span>Demo version settings can\'t be changed'); } else { $data = array('first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name')); if ($this->input->post('old_password')) { $old_password = $this->input->post('old_password'); $ion_model = new Ion_auth_model(); $valid_old = $ion_model->hash_password_db($this->c_user->id, $old_password); $password_min = $this->config->item('min_password_length', 'ion_auth'); $password_max = $this->config->item('max_password_length', 'ion_auth'); $this->form_validation->set_rules('new_password', 'New Password', 'required|min_length[' . $password_min . ']|max_length[' . $password_max . ']|matches[confirm_password]'); $this->form_validation->set_rules('confirm_password', 'Confirm New Password', 'required'); if ($valid_old) { $data['password'] = $this->input->post('new_password'); } else { $this->form_validation->create_error('Invalid Old Password'); } } if ($this->form_validation->run() === TRUE) { $update = $this->ion_auth->update($this->c_user->id, $data); if ($update) { $this->addFlash('Personal Settings Updated', 'success'); redirect('settings/personal'); } else { $this->addFlash($this->ion_auth->errors()); } } else { if (validation_errors()) { $this->addFlash(validation_errors()); } } } } $this->template->set('email', $this->c_user->email); $this->template->set('first_name', $this->form_validation->set_value('first_name', $this->c_user->first_name)); $this->template->set('last_name', $this->form_validation->set_value('last_name', $this->c_user->last_name)); /*directories*/ $directories = DM_Directory::get_all_sorted(); $raw_dir_user = Directory_User::get_by_user($this->c_user->id); $user_directories = $raw_dir_user->to_dir_array(); $is_notified = $raw_dir_user->isNotified(); CssJs::getInst()->c_js(); JsSettings::instance()->add(array('autocomplete_directories_url' => site_url('settings/directories/google_autocomplete'))); $parsers = array(); foreach ($directories as $_dir) { try { $parsers[$_dir->id] = Directory_Parser::factory($_dir->type); } catch (Exception $e) { $parsers[$_dir->id] = new stdClass(); } } $receive_emails = $this->getAAC()->isGrantedPlan('email_notifications'); $this->template->set('is_notified', $is_notified); $this->template->set('parsers', $parsers); $this->template->set('directories', $directories); $this->template->set('user_directories', $user_directories); $this->template->set('receive_emails', $receive_emails); /*end directories*/ /*google keywords*/ $this->load->config('site_config', TRUE); $keywords_config = $this->config->item('keywords', 'site_config'); $keywords_count = isset($keywords_config['count']) && $keywords_config['count'] ? $keywords_config['count'] : 10; // get user additional info (address) $user_additional = User_additional::inst()->get_by_user_id($this->c_user->id); // get available keywords $keywords = Keyword::inst()->get_user_keywords($this->c_user->id); // escape keywords names and website name $address_name = isset($address_name) ? HTML::chars($address_name) : HTML::chars($user_additional->address); $keywords_names = isset($keywords_names) ? HTML::chars_arr($keywords_names) : HTML::chars_arr(array_values($keywords->all_to_single_array('keyword'))); JsSettings::instance()->add(array('autocomplete_keywords_url' => site_url('settings/keywords/google_autocomplete'))); CssJs::getInst()->c_js(); $this->template->set('address_id', $user_additional->address_id); $this->template->set('address_name', $address_name); $this->template->set('keywords_names', $keywords_names); $this->template->set('keywords_count', $keywords_count); /*end google keywords*/ /*socialmedia settings*/ $this->load->library('Socializer/socializer'); $this->load->config('timezones'); CssJs::getInst()->c_js('settings/socialmedia', 'index')->c_js('settings/socialmedia', 'twitter'); $tokens = new Access_token(); $linkedin_data = $tokens->get_linkedin_token($this->c_user->id); $this->template->set('linkedin_token', $linkedin_data->id); $facebook_data = $tokens->get_facebook_token($this->c_user->id); if ($facebook_data->id) { try { $facebook = Socializer::factory('Facebook', $this->c_user->id); $user_facebook_pages = $facebook->get_user_pages(); $this->template->set('fb_pages', $user_facebook_pages); $selected_fanpage = Facebook_Fanpage::inst()->get_selected_page($this->c_user->id); $this->template->set('selected_fanpage_id', $selected_fanpage->fanpage_id); } catch (Exception $e) { if ($e->getCode() !== Socializer::FBERRCODE) { $this->addFlash($e->getMessage()); } } } $this->template->set('facebook_token', $facebook_data->id); $twitter_data = $tokens->get_twitter_token($this->c_user->id); $this->template->set('twitter_token', $twitter_data->id); $youtube_data = $tokens->get_youtube_token($this->c_user->id); $this->template->set('youtube_token', $youtube_data->id); $google_data = $tokens->get_google_token($this->c_user->id); $this->template->set('google_token', $google_data->id); $instagram_data = $tokens->get_instagram_token($this->c_user->id); $this->template->set('instagram_token', $instagram_data->id); $timezones = $this->config->item('timezones'); $this->template->set('timezones', $timezones); $current_timezone = User_timezone::get_user_timezone($this->c_user->id, TRUE); $this->template->set('current_timezone', $current_timezone); /*end socialmedia settings*/ /*mention keywords*/ $this->load->config('site_config', TRUE); $keywords_config = $this->config->item('mention_keywords', 'site_config'); $config_count = isset($keywords_config['count']) && $keywords_config['count'] ? $keywords_config['count'] : 10; $availableKeywordsCount = $this->getAAC()->getPlanFeatureValue('brand_reputation_monitoring'); if ($availableKeywordsCount) { $config_count = $availableKeywordsCount; } $keywords = Mention_keyword::inst()->get_user_keywords($this->c_user->id); JsSettings::instance()->add(array('max_keywords' => $config_count)); CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js')); $this->template->set('keywords', $keywords); $this->template->set('config_count', $config_count); /*end mention keywords*/ /*analytics*/ $analyticsData = array(); if ($this->session->flashdata('ga_redirect_to_accounts')) { if (!$this->access_token->token1 or !$this->access_token->token2) { $analyticsData['error'] = 'Please, connect your Google Analytics account.'; } else { JsSettings::instance()->add(array('analytics' => array('get_accounts_url' => site_url('settings/analytics/get_accounts')))); CssJs::getInst()->c_js(); $analyticsData['account_info'] = $this->access_token->account_info(); } } else { JsSettings::instance()->add(array('analytics' => array('client_id' => $this->analytics_settings['client_id'], 'redirect_uri' => $this->analytics_settings['redirect_uri']))); CssJs::getInst()->c_js(); $analyticsData['access_token'] = $this->access_token; $analyticsData['account_info'] = $this->access_token->account_info(); } $this->template->set('analyticsData', $analyticsData); /*end analytics*/ CssJs::getInst()->add_js('controller/settings/index.js'); $this->template->render(); }
public function __construct() { parent::__construct(); $this->tables = $this->config->item('tables_users', 'ion_auth'); }
public function __construct() { parent::__construct(); $this->load->config('ion_auth', TRUE); $this->lang->load('ion_auth'); }