本文整理汇总了PHP中maintain_ssl函数的典型用法代码示例。如果您正苦于以下问题:PHP maintain_ssl函数的具体用法?PHP maintain_ssl怎么用?PHP maintain_ssl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了maintain_ssl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Index
/**
* Authenticate
*/
function Index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect signed in users to homepage
if ($this->config->item('account_email_validation_required')) {
if ($this->authentication->is_signed_in()) {
redirect('');
}
}
//redirect invalid entries to homepage
if ($this->input->get('user_id', TRUE) == NULL && $this->input->get('token', TRUE) == NULL) {
redirect('');
}
$account = $this->Account_model->get_by_id($this->input->get('user_id', TRUE));
//check for valid token
if ($this->input->get('token', TRUE) == sha1($account->id . $account->createdon . $this->config->item('password_reset_secret'))) {
//activate
$this->Account_model->verify($account->id);
//load the confirmation page
$this->load->view('account/account_authentication', isset($data) ? $data : NULL);
} else {
echo "FALSE";
//redirect('');
}
}
示例2: vote
function vote()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
$userId = (int) $this->input->get('code', TRUE);
$securecode = $this->input->get('securecode', TRUE);
$hash = $this->session->userdata('securecode');
$done = $this->session->userdata($hash . $userId);
if ($done) {
$this->data['error'] = array('code' => 2, 'type' => 'AuthLimitError', 'msg' => lang('services_auth_error'));
} else {
if ($hash == $securecode) {
$trainer = $this->trainers_model->get_one_by_id($userId);
// Create a3m account
$this->data['data'] = array('votes' => sprintf("%06d", 0), 'msg' => 'Voto no registrado correctamente.', 'user' => true);
if ($trainer) {
$this->trainers_model->update_by_id($userId, array('votes' => $trainer['votes'] + 1));
$this->session->set_userdata($hash . $userId, '1');
// Create a3m account
$this->data['data'] = array('votes' => sprintf("%06d", $trainer['votes'] + 1), 'msg' => 'Voto registrado correctamente.', 'user' => true);
}
} else {
$this->data['error'] = array('code' => 1, 'type' => 'AuthError', 'msg' => lang('services_auth_error'));
}
}
$this->shapeResponse();
}
示例3: index
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Get user by username / email
if (!($user = $this->account_model->get_by_username_email($this->input->post('email', true)))) {
// Username / email doesn't exist
$this->data['error'] = array('code' => 10, 'type' => 'NotFoundError', 'msg' => lang('sign_in_username_email_does_not_exist'));
} else {
// Check password
if (!$this->authentication->check_password($user->password, $this->input->post('password', true))) {
// Increment sign in failed attempts
//$this->session->set_userdata( 'sign_in_failed_attempts', (int) $this->session->userdata( 'sign_in_failed_attempts' ) + 1 );
$this->data['error'] = array('code' => 20, 'type' => 'AuthError', 'msg' => lang('sign_in_combination_incorrect'));
} else {
// Clear sign in fail counter
$this->session->unset_userdata('sign_in_failed_attempts');
// Run sign in routine
$this->session->set_userdata('account_id', $user->id);
$this->account_model->update_last_signed_in_datetime($user->id);
$account_details = $this->account_details_model->get_by_account_id($this->session->userdata('account_id'));
$this->data['data']['user']['fullname'] = $account_details->fullname;
$this->data['data']['user']['firstname'] = $account_details->firstname;
$this->data['data']['user']['lastname'] = $account_details->lastname;
$this->data['data']['user']['gender'] = $account_details->gender;
$this->data['data']['user']['picture'] = $account_details->picture;
}
}
$this->shapeResponse();
}
示例4: index
function index()
{
maintain_ssl();
if ($this->authentication->is_signed_in()) {
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
$highest_role = 100;
//$all_user_role=$this->site_model->get_all_user_role($data['account']->id);
$all_user_role = $this->general->get_all_table_info_by_id_asc_desc('a3m_rel_account_role', 'account_id', $data['account']->id, 'role_id', 'asc');
foreach ($all_user_role as $user_role) {
if ($user_role->role_id < $highest_role) {
$highest_role = $user_role->role_id;
}
}
if ($highest_role == 6) {
// 6= customer
$this->load->view('dashboard_drt_customer', isset($data) ? $data : NULL);
} else {
$this->load->view('dashboard', isset($data) ? $data : NULL);
}
//Admin Dashboard
//$this->load->view('dashboard', isset($data) ? $data : NULL);
//$this->load->view('dashboard_drt_customer', isset($data) ? $data : NULL);
} else {
//$this->load->view('dashboard', isset($data) ? $data : NULL);
redirect(base_url());
}
}
示例5: index
/**
* Account sign up
*
* @access public
* @return void
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect signed in users to homepage
if ($this->authentication->is_signed_in()) {
redirect('');
}
// Check recaptcha
$recaptcha_result = $this->recaptcha->check();
// Store recaptcha pass in session so that users only needs to complete captcha once
if ($recaptcha_result === TRUE) {
$this->session->set_userdata('sign_up_recaptcha_pass', TRUE);
}
// Setup form validation
$this->form_validation->set_error_delimiters('<span class="field_error">', '</span>');
$this->form_validation->set_rules(array(array('field' => 'sign_up_username', 'label' => 'lang:sign_up_username', 'rules' => 'trim|required|alpha_dash|min_length[2]|max_length[24]'), array('field' => 'sign_up_password', 'label' => 'lang:sign_up_password', 'rules' => 'trim|required|min_length[6]'), array('field' => 'sign_up_email', 'label' => 'lang:sign_up_email', 'rules' => 'trim|required|valid_email|max_length[160]')));
// Run form validation
if ($this->form_validation->run() === TRUE && $this->config->item("sign_up_enabled")) {
// Check if user name is taken
if ($this->username_check($this->input->post('sign_up_username')) === TRUE) {
$data['sign_up_username_error'] = lang('sign_up_username_taken');
} elseif ($this->email_check($this->input->post('sign_up_email')) === TRUE) {
$data['sign_up_email_error'] = lang('sign_up_email_exist');
} elseif (!($this->session->userdata('sign_up_recaptcha_pass') == TRUE || $recaptcha_result === TRUE) && $this->config->item("sign_up_recaptcha_enabled") === TRUE) {
$data['sign_up_recaptcha_error'] = $this->input->post('recaptcha_response_field') ? lang('sign_up_recaptcha_incorrect') : lang('sign_up_recaptcha_required');
} else {
// Remove recaptcha pass
$this->session->unset_userdata('sign_up_recaptcha_pass');
// Create user
$user_id = $this->account_model->create($this->input->post('sign_up_username', TRUE), $this->input->post('sign_up_email', TRUE), $this->input->post('sign_up_password', TRUE));
// Add user details (auto detected country, language, timezone)
$this->account_details_model->update($user_id);
// Create folder for specific user if not found
if (!file_exists(RES_DIR . "/user/" . $user_id)) {
mkdir(RES_DIR . "/user/" . $user_id);
copy(RES_DIR . "/user/index.html", RES_DIR . "/user/" . $user_id . "/index.html");
}
// Generate QR Code
if (!file_exists(RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png")) {
include RES_DIR . '/adminlte/plugins/qrcode/phpqrcode/qrlib.php';
QRcode::png("#" . $user_id . "#" . $this->input->post('sign_up_username', TRUE) . "#" . $this->input->post('sign_up_email', TRUE), RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png", "H", 10, 2);
}
// Auto sign in?
if ($this->config->item("sign_up_auto_sign_in")) {
// Run sign in routine
$this->authentication->sign_in($user_id);
}
redirect('account/sign_in');
}
}
// Load recaptcha code
if ($this->config->item("sign_up_recaptcha_enabled") === TRUE) {
if ($this->session->userdata('sign_up_recaptcha_pass') != TRUE) {
$data['recaptcha'] = $this->recaptcha->load($recaptcha_result, $this->config->item("ssl_enabled"));
}
}
// Load sign up view
$this->load->view('sign_up', isset($data) ? $data : NULL);
}
示例6: index
/**
* Account password
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect unauthenticated users to signin page
if (!$this->authentication->is_signed_in()) {
redirect('account/sign_in/?continue=' . urlencode(base_url() . 'account/account_password'));
}
// Retrieve sign in user
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
// No access to users without a password
if (!$data['account']->password) {
redirect('');
}
### Setup form validation
$this->form_validation->set_error_delimiters('<span class="field_error">', '</span>');
$this->form_validation->set_rules(array(array('field' => 'password_new_password', 'label' => 'lang:password_new_password', 'rules' => 'trim|required|min_length[6]'), array('field' => 'password_retype_new_password', 'label' => 'lang:password_retype_new_password', 'rules' => 'trim|required|matches[password_new_password]')));
### Run form validation
if ($this->form_validation->run()) {
// Change user's password
$this->account_model->update_password($data['account']->id, $this->input->post('password_new_password', TRUE));
$this->session->set_flashdata('password_info', lang('password_password_has_been_changed'));
redirect('account/account_password');
}
$this->load->view('account/account_password', $data);
}
示例7: index
/**
* Account settings
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect unauthenticated users to signin page
if (!$this->authentication->is_signed_in()) {
redirect('account/sign_in/?continue=' . urlencode(base_url() . 'account/account_settings'));
}
// Active Sidebar_L Menu
$data['accountinfo'] = true;
$data['accountsettings'] = true;
// Retrieve sign in user
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
$data['account_details'] = $this->account_details_model->get_by_account_id($this->session->userdata('account_id'));
if ($this->authorization->is_permitted('manage_mailbox')) {
$this->load->helper('mailbox');
$data['mailinfo'] = mailInfo();
}
// Retrieve countries, languages and timezones
$data['countries'] = $this->ref_country_model->get_all();
$data['languages'] = $this->ref_language_model->get_all();
$data['zoneinfos'] = $this->ref_zoneinfo_model->get_all();
// Split date of birth into month, day and year
if ($data['account_details'] && $data['account_details']->dateofbirth) {
$dateofbirth = strtotime($data['account_details']->dateofbirth);
$data['account_details']->dob_month = mdate('%m', $dateofbirth);
$data['account_details']->dob_day = mdate('%d', $dateofbirth);
$data['account_details']->dob_year = mdate('%Y', $dateofbirth);
}
// Setup form validation
$this->form_validation->set_error_delimiters('<div class="field_error">', '</div>');
$this->form_validation->set_rules(array(array('field' => 'settings_email', 'label' => 'lang:settings_email', 'rules' => 'trim|required|valid_email|max_length[160]'), array('field' => 'settings_fullname', 'label' => 'lang:settings_fullname', 'rules' => 'trim|max_length[160]'), array('field' => 'settings_firstname', 'label' => 'lang:settings_firstname', 'rules' => 'trim|max_length[80]'), array('field' => 'settings_lastname', 'label' => 'lang:settings_lastname', 'rules' => 'trim|max_length[80]'), array('field' => 'settings_postalcode', 'label' => 'lang:settings_postalcode', 'rules' => 'trim|max_length[40]')));
// Run form validation
if ($this->form_validation->run()) {
// If user is changing email and new email is already taken
if (strtolower($this->input->post('settings_email', TRUE)) != strtolower($data['account']->email) && $this->email_check($this->input->post('settings_email', TRUE)) === TRUE) {
$data['settings_email_error'] = lang('settings_email_exist');
} elseif (!($this->input->post('settings_dob_month') && $this->input->post('settings_dob_day') && $this->input->post('settings_dob_year') || !$this->input->post('settings_dob_month') && !$this->input->post('settings_dob_day') && !$this->input->post('settings_dob_year'))) {
$data['settings_dob_error'] = lang('settings_dateofbirth_incomplete');
} else {
// Update account email
$this->account_model->update_email($data['account']->id, $this->input->post('settings_email', TRUE) ? $this->input->post('settings_email', TRUE) : NULL);
// Update account details
if ($this->input->post('settings_dob_month', TRUE) && $this->input->post('settings_dob_day', TRUE) && $this->input->post('settings_dob_year', TRUE)) {
$attributes['dateofbirth'] = mdate('%Y-%m-%d', strtotime($this->input->post('settings_dob_day', TRUE) . '-' . $this->input->post('settings_dob_month', TRUE) . '-' . $this->input->post('settings_dob_year', TRUE)));
}
$attributes['fullname'] = $this->input->post('settings_fullname', TRUE) ? $this->input->post('settings_fullname', TRUE) : NULL;
$attributes['firstname'] = $this->input->post('settings_firstname', TRUE) ? $this->input->post('settings_firstname', TRUE) : NULL;
$attributes['lastname'] = $this->input->post('settings_lastname', TRUE) ? $this->input->post('settings_lastname', TRUE) : NULL;
$attributes['gender'] = $this->input->post('settings_gender', TRUE) ? $this->input->post('settings_gender', TRUE) : NULL;
$attributes['postalcode'] = $this->input->post('settings_postalcode', TRUE) ? $this->input->post('settings_postalcode', TRUE) : NULL;
$attributes['country'] = $this->input->post('settings_country', TRUE) ? $this->input->post('settings_country', TRUE) : NULL;
$attributes['language'] = $this->input->post('settings_language', TRUE) ? $this->input->post('settings_language', TRUE) : NULL;
$attributes['timezone'] = $this->input->post('settings_timezone', TRUE) ? $this->input->post('settings_timezone', TRUE) : NULL;
$this->account_details_model->update($data['account']->id, $attributes);
$data['settings_info'] = lang('settings_details_updated');
}
}
$this->load->view('account/account_settings', $data);
}
示例8: index
/**
* Linked accounts
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect unauthenticated users to signin page
if (!$this->authentication->is_signed_in()) {
redirect('account/sign_in/?continue=' . urlencode(base_url() . 'account/account_linked'));
}
// Retrieve sign in user
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
$data['account_details'] = $this->account_details_model->get_by_account_id($this->session->userdata('account_id'));
// Delete a linked account
if ($this->input->post('facebook_id') || $this->input->post('twitter_id') || $this->input->post('openid')) {
if ($this->input->post('facebook_id')) {
$this->account_facebook_model->delete($this->input->post('facebook_id', TRUE));
} elseif ($this->input->post('twitter_id')) {
$this->account_twitter_model->delete($this->input->post('twitter_id', TRUE));
} elseif ($this->input->post('openid')) {
$this->account_openid_model->delete($this->input->post('openid', TRUE));
}
$this->session->set_flashdata('linked_info', lang('linked_linked_account_deleted'));
redirect('account/account_linked');
}
// Check for linked accounts
$data['num_of_linked_accounts'] = 0;
// Get Facebook accounts
if ($data['facebook_links'] = $this->account_facebook_model->get_by_account_id($this->session->userdata('account_id'))) {
foreach ($data['facebook_links'] as $index => $facebook_link) {
$data['num_of_linked_accounts']++;
}
}
// Get Twitter accounts
if ($data['twitter_links'] = $this->account_twitter_model->get_by_account_id($this->session->userdata('account_id'))) {
$this->load->config('account/twitter');
$this->load->helper('account/twitter');
foreach ($data['twitter_links'] as $index => $twitter_link) {
$data['num_of_linked_accounts']++;
$epiTwitter = new EpiTwitter($this->config->item('twitter_consumer_key'), $this->config->item('twitter_consumer_secret'), $twitter_link->oauth_token, $twitter_link->oauth_token_secret);
$data['twitter_links'][$index]->twitter = $epiTwitter->get_usersShow(array('user_id' => $twitter_link->twitter_id));
}
}
// Get OpenID accounts
if ($data['openid_links'] = $this->account_openid_model->get_by_account_id($this->session->userdata('account_id'))) {
foreach ($data['openid_links'] as $index => $openid_link) {
if (strpos($openid_link->openid, 'google.com')) {
$data['openid_links'][$index]->provider = 'google';
} elseif (strpos($openid_link->openid, 'yahoo.com')) {
$data['openid_links'][$index]->provider = 'yahoo';
} elseif (strpos($openid_link->openid, 'myspace.com')) {
$data['openid_links'][$index]->provider = 'myspace';
} elseif (strpos($openid_link->openid, 'aol.com')) {
$data['openid_links'][$index]->provider = 'aol';
} else {
$data['openid_links'][$index]->provider = 'openid';
}
$data['num_of_linked_accounts']++;
}
}
$this->load->view('account/account_linked', $data);
}
示例9: index
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Check if user is signed in on facebook
if ($this->facebook_lib->user) {
// Check if user has connect facebook to a3m
if ($user = $this->account_facebook_model->get_by_facebook_id($this->facebook_lib->user['id'])) {
// Check if user is not signed in on a3m
if (!$this->authentication->is_signed_in()) {
// Run sign in routine
$this->authentication->sign_in($user->account_id);
}
$user->account_id === $this->session->userdata('account_id') ? $this->session->set_flashdata('linked_error', sprintf(lang('linked_linked_with_this_account'), lang('connect_facebook'))) : $this->session->set_flashdata('linked_error', sprintf(lang('linked_linked_with_another_account'), lang('connect_facebook')));
redirect('account/account_linked');
} else {
// Check if user is signed in on a3m
if (!$this->authentication->is_signed_in()) {
// Store user's facebook data in session
$this->session->set_userdata('connect_create', array(array('provider' => 'facebook', 'provider_id' => $this->facebook_lib->user['id']), array('fullname' => $this->facebook_lib->user['name'], 'firstname' => $this->facebook_lib->user['first_name'], 'lastname' => $this->facebook_lib->user['last_name'], 'gender' => $this->facebook_lib->user['gender'], 'picture' => 'http://graph.facebook.com/' . $this->facebook_lib->user['id'] . '/picture/?type=large')));
// Create a3m account
redirect('account/connect_create');
} else {
// Connect facebook to a3m
$this->account_facebook_model->insert($this->session->userdata('account_id'), $this->facebook_lib->user['id']);
$this->session->set_flashdata('linked_info', sprintf(lang('linked_linked_with_your_account'), lang('connect_facebook')));
redirect('account/account_linked');
}
}
}
// Load facebook redirect view
$this->load->view("account/redirect_fb");
}
示例10: index
function index()
{
maintain_ssl();
if ($this->authentication->is_signed_in()) {
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
}
$this->load->view('home', isset($data) ? $data : NULL);
}
示例11: index
/**
* Forgot password
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect signed in users to homepage
if ($this->authentication->is_signed_in()) {
redirect('');
}
// Check recaptcha
$recaptcha_result = $this->recaptcha->check();
// Store recaptcha pass in session so that users only needs to complete captcha once
if ($recaptcha_result === TRUE) {
$this->session->set_userdata('forget_password_recaptcha_pass', TRUE);
}
// Setup form validation
$this->form_validation->set_error_delimiters('<span class="field_error">', '</span>');
$this->form_validation->set_rules(array(array('field' => 'forgot_password_username_email', 'label' => 'lang:forgot_password_username_email', 'rules' => 'trim|required')));
// Run form validation
if ($this->form_validation->run()) {
// User has neither already passed recaptcha nor just passed recaptcha
if ($this->session->userdata('forget_password_recaptcha_pass') != TRUE && $recaptcha_result !== TRUE) {
$data['forgot_password_recaptcha_error'] = $this->input->post('recaptcha_response_field') ? lang('forgot_password_recaptcha_incorrect') : lang('forgot_password_recaptcha_required');
} else {
// Remove recaptcha pass
$this->session->unset_userdata('forget_password_recaptcha_pass');
// Username does not exist
if (!($account = $this->account_model->get_by_username_email($this->input->post('forgot_password_username_email')))) {
$data['forgot_password_username_email_error'] = lang('forgot_password_username_email_does_not_exist');
} elseif (!$account->password) {
$data['forgot_password_username_email_error'] = lang('forgot_password_does_not_manage_password');
} else {
// Set reset datetime
$time = $this->account_model->update_reset_sent_datetime($account->id);
// Load email library
$this->load->library('email');
// Generate reset password url
$password_reset_url = site_url('account/reset_password?id=' . $account->id . '&token=' . sha1($account->id . $time . $this->config->item('password_reset_secret')));
// Send reset password email
$this->email->from($this->config->item('password_reset_email'), lang('reset_password_email_sender'));
$this->email->to($account->email);
$this->email->subject(lang('reset_password_email_subject'));
$this->email->message($this->load->view('reset_password_email', array('username' => $account->username, 'password_reset_url' => anchor($password_reset_url, $password_reset_url)), TRUE));
echo $this->load->view('reset_password_email', array('username' => $account->username, 'password_reset_url' => anchor($password_reset_url, $password_reset_url)), TRUE);
@$this->email->send();
// Load reset password sent view
$this->load->view('reset_password_sent', isset($data) ? $data : NULL);
return;
}
}
}
// Load recaptcha code
if ($this->session->userdata('forget_password_recaptcha_pass') != TRUE) {
$data['recaptcha'] = $this->recaptcha->load($recaptcha_result, $this->config->item("ssl_enabled"));
}
// Load forgot password view
$this->load->view('forgot_password', isset($data) ? $data : NULL);
}
示例12: index
public function index()
{
maintain_ssl();
if ($this->authentication->is_signed_in()) {
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
redirect('social_goods/social_goods/view_product_list');
} else {
redirect('account/sign_in');
}
}
示例13: index
function index()
{
maintain_ssl();
if ($this->authentication->is_signed_in()) {
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
$this->load->view('dashboard', isset($data) ? $data : NULL);
} else {
//$this->load->view('dashboard', isset($data) ? $data : NULL);
redirect(base_url());
}
}
示例14: index
function index()
{
maintain_ssl();
if ($this->authentication->is_signed_in()) {
$data['account'] = $this->account_model->get_by_id($this->session->userdata('account_id'));
$data['account_details'] = $this->account_details_model->get_by_account_id($this->session->userdata('account_id'));
$this->load->view('admin', isset($data) ? $data : NULL);
} else {
redirect('/account/sign_in', 'refresh');
}
}
示例15: index
/**
* Complete facebook's authentication process
*
* @access public
* @return void
*/
function index()
{
// Enable SSL?
maintain_ssl($this->config->item("ssl_enabled"));
// Redirect user to home if 'connect_create' session data doesn't exist
if (!$this->session->userdata('connect_create')) {
redirect('');
}
$data['connect_create'] = $this->session->userdata('connect_create');
// Setup form validation
$this->form_validation->set_error_delimiters('<span class="field_error">', '</span>');
$this->form_validation->set_rules(array(array('field' => 'connect_create_username', 'label' => 'lang:connect_create_username', 'rules' => 'trim|required|alpha_numeric|min_length[2]|max_length[16]'), array('field' => 'connect_create_email', 'label' => 'lang:connect_create_email', 'rules' => 'trim|required|valid_email|max_length[160]')));
// Run form validation
if ($this->form_validation->run()) {
// Check if username already exist
if ($this->username_check($this->input->post('connect_create_username')) === TRUE) {
$data['connect_create_username_error'] = lang('connect_create_username_taken');
} elseif ($this->email_check($this->input->post('connect_create_email')) === TRUE) {
$data['connect_create_email_error'] = lang('connect_create_email_exist');
} else {
// Destroy 'connect_create' session data
$this->session->unset_userdata('connect_create');
// Create user
$user_id = $this->account_model->create($this->input->post('connect_create_username'), $this->input->post('connect_create_email'));
// Add user details
$this->account_details_model->update($user_id, $data['connect_create'][1]);
// Load email library
$this->load->library('email');
// Send user creation email
$this->email->from($this->config->item('password_reset_email'), lang('new_account_email_sender'));
$this->email->to($this->input->post('connect_create_email'));
$this->email->subject(lang('new_account_email_subject'));
$this->email->message($this->load->view('new_account_email', array('username' => $this->input->post('connect_create_username')), TRUE));
//echo $this->load->view('new_account_email', array('username' => $this->input->post('connect_create_username')), TRUE);
@$this->email->send();
// Connect third party account to user
switch ($data['connect_create'][0]['provider']) {
case 'facebook':
$this->account_facebook_model->insert($user_id, $data['connect_create'][0]['provider_id']);
break;
case 'twitter':
$this->account_twitter_model->insert($user_id, $data['connect_create'][0]['provider_id'], $data['connect_create'][0]['token'], $data['connect_create'][0]['secret']);
break;
case 'openid':
$this->account_openid_model->insert($data['connect_create'][0]['provider_id'], $user_id);
break;
}
// Run sign in routine
$this->authentication->sign_in($user_id);
}
}
$this->load->view('connect_create', isset($data) ? $data : NULL);
}