public function __construct()
 {
     parent::__construct();
     $this->load->language('email');
     $this->email = \cmsemail\email::getInstance();
     $lang = new MY_Lang();
     $lang->load('cmsemail');
 }
Пример #2
0
 /**
  * create wish list
  *
  * @param $listName
  * @param $user_id
  * @return boolean
  */
 public function createWishList($listName, $user_id, $access = 'shared', $description)
 {
     $this->createUserIfNotExist($user_id);
     $data = array('title' => $listName, 'user_id' => $user_id, 'description' => $description, 'hash' => random_string('alpha', 16), 'access' => $access);
     \cmsemail\email::getInstance()->sendEmail($this->dx_auth->get_user_email(), 'wish_list', array('wishListViews' => '', 'userName' => $this->dx_auth->get_username(), 'wishName' => $listName, 'wishLink' => site_url('wishlist/show') . '/' . $data['hash']));
     return $this->db->insert('mod_wish_list', $data);
 }
 function change_password($old_pass, $new_pass)
 {
     // Load Models
     $this->ci->load->model('dx_auth/users', 'users');
     // Default return value
     $result = FAlSE;
     // Search current logged in user in database
     if ($query = $this->ci->users->get_user_by_id($this->ci->session->userdata('DX_user_id')) and $query->num_rows() > 0) {
         // Get current logged in user
         $row = $query->row();
         $pass = $this->_encode($old_pass);
         // Check if old password correct
         if (crypt($pass, $row->password) === $row->password) {
             // Crypt and encode new password
             $new_pass_for_user = $new_pass;
             $new_pass = crypt($this->_encode($new_pass));
             // Replace old password with new password
             $this->ci->users->change_password($this->ci->session->userdata('DX_user_id'), $new_pass);
             // Trigger event
             $this->ci->dx_auth_event->user_changed_password($this->ci->session->userdata('DX_user_id'), $new_pass);
             $replaceData = array('user_name' => $row->username, 'password' => $new_pass_for_user);
             \cmsemail\email::getInstance()->sendEmail($row->email, 'change_password', $replaceData);
             $result = TRUE;
         } else {
             $this->_auth_error = lang('auth incorrect old password');
         }
     }
     return $result;
 }
Пример #4
0
 /**
  * send email
  */
 public function send_email($wish_list_id, $email)
 {
     $user = $this->wishlist_model->getUserByID($this->dx_auth->get_user_id());
     $wish_list = $this->db->where('id', $wish_list_id)->get('mod_wish_list');
     if ($wish_list) {
         $wish_list = $wish_list->row_array();
     } else {
         $wish_list = array();
     }
     $db_user = $this->db->where('id', $this->dx_auth->get_user_id())->get('users')->row_array();
     if ($user) {
         $name = $user['user_name'] ? $user['user_name'] : $this->dx_auth->get_username();
         $phone = $db_user['phone'] ? $db_user['phone'] : '(---) --- --- --- ';
         $user_variables = array('userName' => $name, 'userPhone' => $phone, 'wishName' => $wish_list['title'], 'wishLink' => site_url('wishlist/show/' . $wish_list['hash']), 'wishListViews' => $wish_list['hash']['review_count']);
         \cmsemail\email::getInstance()->sendEmail($email, 'wish_list', $user_variables);
         return TRUE;
     } else {
         return FALSE;
     }
 }