Пример #1
0
 /**
  * *
  * * @return mixed
  * */
 function create_member()
 {
     $this->form_validation->set_rules('username', 'User name', 'trim|required|min_length[4]|is_unique[user.username]');
     $this->form_validation->set_rules('password', 'Password', 'required');
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|is_unique[user.primary_email]');
     $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div style="margin:1%" class="alert alert-error"><strong>', '</strong></div>');
     $this->form_validation->set_rules('membership', 'Membership', 'required');
     $this->form_validation->set_rules('term_condition', 'Terms & Condition', 'required');
     if ($this->form_validation->run() == TRUE) {
         $username = $this->input->post('username');
         $pass = generate_password();
         $email = $this->input->post('email');
         $color2 = $this->input->post('color2');
         $membership_amt = $this->input->post('membership');
         $data_to_store = array('date_of_registration' => date("Y-m-d H:i:s"), 'username' => $username, 'password' => md5($pass), 'firstname' => $this->input->post('username'), 'primary_email' => $email, 'color' => $this->input->post('color'), 'color2' => isset($color2) ? $color2 : "", 'term_condition' => $this->input->post('term_condition'), 'membership' => $membership_amt, 'status' => 'Inactive');
         $uid = $this->user_model->store_user($data_to_store);
         $this->load->helper('email');
         $this->load->library('email');
         if (valid_email($email)) {
             // compose email
             $this->email->clear(TRUE);
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Register Confirmation for StacksGuide Account!');
             $mail_data['url'] = site_url() . 'payment/payment_send/' . $uid . '/' . encrypt($membership_amt);
             $message = $this->load->view('mail_templates/stacks_signup_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('home');
             } else {
                 $msgadd = "<strong>Please check your Email</strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('home');
             }
         }
         //redirect("payment/payment_send/$uid/$membership_amt");
     }
     //        else {
     //
     //            $this->session->set_flashdata('validation_error_messages', validation_errors());
     //            redirect('signup');
     //        }
     $data['main_content'] = 'signup_view';
     $this->load->view('includes/template', $data);
 }
 /**
  * Sending out newsletter
  * @return void
  */
 public function process()
 {
     date_default_timezone_set('UTC');
     $start_day_hour = date("H:i");
     $current_date = strtotime(date('Y-m-d H:i:s'));
     $result_array = $this->write_add_model->get_posts_cron();
     if (!empty($result_array)) {
         for ($i = 0; $i < count($result_array); $i++) {
             $expire_date = strtotime($result_array[$i]['expire_date']);
             $posts_id = $result_array[$i]['posts_id'];
             $email = $result_array[$i]['email'];
             $uid = $result_array[$i]['uid'];
             if (!empty($expire_date)) {
                 if ($expire_date < $current_date) {
                     if (valid_email($email)) {
                         $title = "Expiration StacksClassifieds AD";
                         $get_admin_detail = get_admin_detail();
                         //common helper function for admin detail
                         $config['protocol'] = 'sendmail';
                         $config['mailpath'] = '/usr/sbin/sendmail';
                         $config['charset'] = 'iso-8859-1';
                         $config['mailtype'] = 'html';
                         $config['priority'] = 1;
                         $this->email->initialize($config);
                         $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
                         $this->email->to($email);
                         $this->email->set_mailtype("html");
                         $this->email->subject($title);
                         $where_uid = " AND user_id={$uid}";
                         $username = $this->common_model->getFieldData('user', 'username', $where_uid);
                         if (!empty($username)) {
                             $mail_data['username'] = $username;
                         } else {
                             $mail_data['username'] = '';
                         }
                         // $mail_data['url'] = base_url() . 'write_add/update/' . $posts_id;
                         $mail_data['title'] = $title;
                         $mail_data['url'] = base_url() . 'write_add/update/' . $posts_id . '/renew';
                         $mail_data['description'] = 'Your StacksClassifieds Post has been Expired';
                         $message = $this->load->view('mail_templates/expiration_post_ad', $mail_data, true);
                         $this->email->message($message);
                         if (!$this->email->send()) {
                             $msgadd = "<strong>E-mail not sent </strong>";
                             $data['flash_message'] = TRUE;
                             $this->session->set_flashdata('flash_class', 'alert-error');
                             $this->session->set_flashdata('flash_message', $msgadd);
                         } else {
                             $data_to_store = array('status' => 'Inactive');
                             $post_update = $this->write_add_model->update_posts($posts_id, $data_to_store);
                         }
                     }
                 }
             }
         }
     }
 }
 public function databsebackup()
 {
     $prefs = array('format' => 'zip', 'filename' => 'backup-on-' . date("Y-m-d-H-i-s") . '.sql');
     $backup =& $this->dbutil->backup($prefs);
     $db_name = 'backup-on-' . date("Y-m-d-H-i-s") . '.zip';
     $save = './uploads/database/' . $db_name;
     $this->load->helper('file');
     write_file($save, $backup);
     $this->load->helper('download');
     $this->load->helper('email');
     //load email library
     $config = array('protocol' => 'smtp', 'smtp_host' => 'ssl://secure146.inmotionhosting.com', 'smtp_port' => 465, 'smtp_user' => '*****@*****.**', 'smtp_pass' => 'G#-(6Z{!d)LJ', 'mailtype' => 'html', 'charset' => 'iso-8859-1');
     $this->load->library('email', $config);
     $this->email->set_newline("\r\n");
     if (valid_email('*****@*****.**')) {
         // compose email
         $get_admin_detail = get_admin_detail();
         //common helper function for admin detail
         $this->email->from("*****@*****.**", $get_admin_detail['name']);
         $this->email->to('*****@*****.**');
         //$this->email->to('*****@*****.**');
         //			$this->email->cc('*****@*****.**');
         $this->email->set_mailtype("html");
         $this->email->subject("knewdog database backup file " . date("Y-m-d"));
         $this->email->message("<p>Please Find the attached database backup file.</p><p>Regards,<br/>knewdog Team.</p>");
         $filename = FCPATH . "uploads/database/" . $db_name;
         $this->email->attach($filename);
         if ($this->email->send()) {
             //echo 'Your email was sent, successfully.';
         } else {
             //show_error($this->email->print_debugger());
         }
         @unlink($filename);
     }
     //force_download($db_name, $backup);
     //Update sitemap everyday
     sitemap_generator();
 }
Пример #4
0
 function set_pass_mail()
 {
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->form_validation->run()) {
         $email = $this->input->post('email');
         $this->has_match_email_exist($email);
         $this->form_validation->set_rules('email', 'Email Address', 'trim|required|callback_has_match_email_exist');
         $pass = $this->common_model->generatePassword();
         $new_password = md5($pass);
         if (valid_email($email)) {
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject("password reset:{$email}");
             $mail_data['email'] = $email;
             $mail_data['newPassword'] = $pass;
             $message = $this->load->view('mail_templates/reset_password_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect("home/set_pass_mail");
             } else {
                 $data_to_store = array('password' => $new_password);
                 $this->common_model->update_by_field('user', 'primary_email', $email, $data_to_store);
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-success');
                 $this->session->set_flashdata('flash_message', '<strong>please check your email!</strong>');
                 redirect("home");
             }
         }
     }
     $data['main_content'] = 'reset_pass_mail_view';
     $this->load->view('includes/template', $data);
 }
Пример #5
0
 function contactus_data()
 {
     //        echo "<pre>";
     //        print_r($_POST);
     //        exit;
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'User name', 'trim|required');
     $this->form_validation->set_rules('usermail', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('message', 'message', 'trim|required');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run()) {
         //$pass = generate_password();
         $username = $this->input->post('username');
         $usermail = $this->input->post('usermail');
         $message = $this->input->post('message');
         //            $data_to_store = array(
         //                'username' => $this->input->post('username'),
         //                'usermail' => $this->input->post('usermail'),
         //                'message' => $this->input->post('message')
         //            );
         $this->load->helper('email');
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($usermail)) {
             //echo "hiii";exit;
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($usermail);
             $this->email->to($get_admin_detail['email']);
             $this->email->set_mailtype("html");
             $this->email->subject('Contact Us');
             $mail_data['username'] = $this->input->post('username');
             $mail_data['usermail'] = $this->input->post('usermail');
             $mail_data['message'] = $this->input->post('message');
             $message = $this->load->view('mail_templates/contactus_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 //echo "hiii";exit;
                 $msgadd = "<strong> Email Not Sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('contactus');
             } else {
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-success');
                 $this->session->set_flashdata('flash_message', '<strong>Email Sent </strong>');
                 redirect('contactus');
             }
         } else {
             if ($redirect == 'home') {
                 $this->session->set_flashdata('validation_error_messages', validation_errors());
                 redirect('home');
             }
         }
     }
     $data['main_content'] = 'contactus_view';
     $this->load->view('includes/template', $data);
 }
Пример #6
0
 function increase_blacklist_index_for_administration_folder($subject, $newsletter_rand_id)
 {
     $ci =& get_instance();
     $ci->load->model('newsletter_model');
     $ci->load->helper('email');
     //load email library
     $ci->load->library('email');
     $ci->load->model('email_template_model');
     $where_field_1 = array("newsletter_rand_id", "newsletter_relation");
     $where_value_1 = array($newsletter_rand_id, "parent");
     $newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1, $where_value_1);
     //echo '<pre>'; print_r($newsletter_parent_data); die;
     if ($newsletter_parent_data[0]['blacklist_flag'] == 'NO') {
         $where_field = array("headline", "newsletter_rand_id", "newsletter_relation");
         $where_value = array($subject, $newsletter_rand_id, "child");
         $newsletter_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field, $where_value);
         //$newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1,$where_value_1);
         //$newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1,$where_value_1);
         if (stristr($subject, 'SPAM') !== FALSE) {
             //if (count($newsletter_data) > 0) {
             // if (stristr($subject, 'SPAM') !== FALSE) {
             //$where_field_1 = array("newsletter_rand_id","newsletter_relation");
             //$where_value_1 = array($newsletter_rand_id,"parent");
             //$newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1,$where_value_1);
             $incresebyone = (int) $newsletter_parent_data[0]['blacklist_index'] + 1;
             //update blacklist index by
             $ci->newsletter_model->update_newsletter($newsletter_parent_data[0]['newsletter_id'], array("blacklist_index" => $incresebyone));
             if ($incresebyone == 10) {
                 $ci->newsletter_model->update_newsletter($newsletter_parent_data[0]['newsletter_id'], array("blacklist_flag" => 'YES'));
             }
             //return with incresing blacklist index
             $newsletter_parent_data = array();
             $newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1, $where_value_1);
             //Bhushan changes
             //sent mail to
             $blacklist_index = $newsletter_parent_data[0]['blacklist_index'];
             $blacklist_flag = $newsletter_parent_data[0]['blacklist_flag'];
             $sn = $newsletter_parent_data[0]['sn'];
             $email = '*****@*****.**';
             //   $email = '*****@*****.**';
             /*
              bhushan changes
             */
             $ci->load->helper('email');
             //load email library
             $config = array('protocol' => 'smtp', 'smtp_host' => 'ssl://secure146.inmotionhosting.com', 'smtp_port' => 465, 'smtp_user' => '*****@*****.**', 'smtp_pass' => 'G#-(6Z{!d)LJ', 'mailtype' => 'html', 'charset' => 'iso-8859-1');
             $ci->load->library('email', $config);
             $ci->email->set_newline("\r\n");
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $ci->email->from("*****@*****.**", $get_admin_detail['name']);
             $ci->email->to($email);
             $ci->email->set_mailtype("html");
             $session_lang = $ci->session->userdata('language_shortcode');
             $replace = array('{blacklist_index}', '{blacklist_flag}', '{sn}');
             $with = array("{$blacklist_index}", "{$blacklist_flag}", "{$sn}");
             $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
                 $template_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $ci->email->message($content);
             } else {
                 $this->email->subject($email_template_content[0]['subject_en']);
                 $template_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $ci->email->message($content);
             }
             /*
              end bhushan changes
             */
             //                $get_admin_detail = get_admin_detail(); //common helper function for admin detail
             //                $ci->email->from($get_admin_detail['email']);
             //                //echo "admin->".$get_admin_detail['email'];
             //                $ci->email->to($email);
             //                $ci->email->set_mailtype("html");
             //                //$ci->email->subject('Your Black List flag and index for KnewDog!');
             //
             //                $session_lang = $ci->session->userdata('language_shortcode');
             //                $replace = array(
             //                    '{blacklist_index}',
             //                    '{blacklist_flag}',
             //                    '{sn}'
             //                );
             //                $with = array(
             //                    "{$blacklist_index}",
             //                    "{$blacklist_flag}",
             //                    "{$sn}");
             //                $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
             //                if (isset($email_template_content[0]['description_' . $session_lang]) &&
             //                        !empty($email_template_content[0]['description_' . $session_lang])) {
             //                    $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
             //                    $template_content = $email_template_content[0]['description_' . $session_lang];
             //                    $message = str_replace($replace, $with, $template_content);
             //                    $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>$message</div></body></html>";
             //                    $ci->email->message($content);
             //                } else {
             //                    $this->email->subject($email_template_content[0]['subject_en']);
             //                    $template_content = $email_template_content[0]['description_en'];
             //                    $message = str_replace($replace, $with, $template_content);
             //                    $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>$message</div></body></html>";
             //                    $ci->email->message($content);
             //                }
             $ci->email->send();
             return "-1";
         } else {
             //return without incresing blacklist index
             return true;
         }
     } else {
         //Bhushan changes
         //sent mail to
         $blacklist_index = $newsletter_parent_data[0]['blacklist_index'];
         $blacklist_flag = $newsletter_parent_data[0]['blacklist_flag'];
         $sn = $newsletter_parent_data[0]['sn'];
         $email = '*****@*****.**';
         //$message = "return false resut.. Your black list flag is " . $blacklist_flag . " and your black list index is " . $blacklist_index;
         //            $get_admin_detail = get_admin_detail(); //common helper function for admin detail
         //            $ci->email->from($get_admin_detail['email']);
         //            $ci->email->to($email);
         //            $ci->email->set_mailtype("html");
         //            //$ci->email->subject('Your Black List flag and index for KnewDog!');
         //
         //            $session_lang = $ci->session->userdata('language_shortcode');
         //            $replace = array(
         //                '{blacklist_index}',
         //                '{blacklist_flag}',
         //                '{sn}'
         //            );
         //            $with = array(
         //                "{$blacklist_index}",
         //                "{$blacklist_flag}",
         //                "{$sn}");
         //            $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
         //            if (isset($email_template_content[0]['description_' . $session_lang]) &&
         //                    !empty($email_template_content[0]['description_' . $session_lang])) {
         //                $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
         //                $template_content = $email_template_content[0]['description_' . $session_lang];
         //                $message = str_replace($replace, $with, $template_content);
         //                $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>$message</div></body></html>";
         //                $ci->email->message($content);
         //            } else {
         //                $this->email->subject($email_template_content[0]['subject_en']);
         //                $template_content = $email_template_content[0]['description_en'];
         //                $message = str_replace($replace, $with, $template_content);
         //                $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>$message</div></body></html>";
         //                $ci->email->message($content);
         //            }
         /*
          bhushan changes
         */
         $ci->load->helper('email');
         //load email library
         $config = array('protocol' => 'smtp', 'smtp_host' => 'ssl://secure146.inmotionhosting.com', 'smtp_port' => 465, 'smtp_user' => '*****@*****.**', 'smtp_pass' => 'G#-(6Z{!d)LJ', 'mailtype' => 'html', 'charset' => 'iso-8859-1');
         $ci->load->library('email', $config);
         $ci->email->set_newline("\r\n");
         $get_admin_detail = get_admin_detail();
         //common helper function for admin detail
         $ci->email->from("*****@*****.**", $get_admin_detail['name']);
         $ci->email->to($email);
         $ci->email->set_mailtype("html");
         $session_lang = $ci->session->userdata('language_shortcode');
         $replace = array('{blacklist_index}', '{blacklist_flag}', '{sn}');
         $with = array("{$blacklist_index}", "{$blacklist_flag}", "{$sn}");
         $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
         if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
             $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
             $template_content = $email_template_content[0]['description_' . $session_lang];
             $message = str_replace($replace, $with, $template_content);
             $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
             $ci->email->message($content);
         } else {
             $this->email->subject($email_template_content[0]['subject_en']);
             $template_content = $email_template_content[0]['description_en'];
             $message = str_replace($replace, $with, $template_content);
             $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
             $ci->email->message($content);
         }
         /*
          end bhushan changes
         */
         $ci->email->send();
         //end changes
         //            mail($email, "your blacklist warning from knewdog!", $message);
         return false;
     }
 }
Пример #7
0
 /**
  ** 
  ** @return mixed
  **/
 function create_member()
 {
     $this->load->library('form_validation');
     // field name, error message, validation rules
     //$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('username', 'User name', 'trim|required|min_length[4]|is_unique[user.username]');
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|is_unique[user.primary_email]');
     $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run()) {
         $pass = generate_password();
         $email = $this->input->post('email');
         $user_rand_id = $this->functions->get_user_rand_id();
         $data_to_store = array('user_rand_id' => $user_rand_id, 'username' => $this->input->post('username'), 'password' => md5($pass), 'primary_email' => $email, 'type_of_membership' => 'FREE', 'date_of_registration' => date("Y-m-d H:i:s"), 'status' => 'Inactive');
         //if the insert has returned true then we show the flash message
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($email)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Register confirmation for KnewDog!');
             $mail_data['url'] = site_url() . 'home/confirm/' . base64url_encode($email);
             $message = $this->load->view('mail_templates/signup_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('signup');
                 }
             } else {
                 if ($this->user_model->store_user($data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>Well done!</strong> We have sent you a link to confirm your subscription.');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('signup');
                     }
                     //redirect('kd2a2a0u1g4/user'.'');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>Oh snap!</strong> change a few things up and try submitting again.');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('signup');
                     }
                 }
             }
         }
     } else {
         if ($redirect == 'home') {
             $this->session->set_flashdata('validation_error_messages', validation_errors());
             redirect('home');
         }
     }
     $data['main_content'] = 'signup_view';
     $this->load->view('includes/template', $data);
 }
Пример #8
0
 function contactus_data()
 {
     $this->load->library('form_validation');
     $this->recaptcha->recaptcha_check_answer();
     //echo "captch->".$this->recaptcha->getIsValid(); die;
     // field name, error message, validation rules
     //$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('username', 'User name', 'trim|required');
     $this->form_validation->set_rules('usermail', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('usersite', 'usersite', 'trim');
     $this->form_validation->set_rules('subject', 'subject', 'trim');
     $this->form_validation->set_rules('message', 'message', 'trim|required');
     //$this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run() && $this->recaptcha->getIsValid()) {
         //$pass = generate_password();
         $username = $this->input->post('username');
         $usermail = $this->input->post('usermail');
         $usersite = $this->input->post('usersite');
         $subject = $this->input->post('subject');
         $message = $this->input->post('message');
         $user_rand_id = $this->functions->get_user_rand_id();
         $data_to_store = array('user_rand_id' => $user_rand_id, 'username' => $this->input->post('username'), 'usermail' => $this->input->post('usermail'), 'usersite' => $this->input->post('usersite'), 'subject' => $this->input->post('subject'), 'message' => $this->input->post('message'));
         //captcha validation
         //print_r($array); die;
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($usermail)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($usermail);
             $this->email->to($get_admin_detail['email']);
             $this->email->set_mailtype("html");
             //$mail_data['url'] = site_url().'home/confirm/'.base64url_encode($email);
             $mail_data['username'] = $this->input->post('username');
             $mail_data['usermail'] = $this->input->post('usermail');
             $mail_data['usersite'] = $this->input->post('usersite');
             $mail_data['subject'] = $this->input->post('subject');
             $mail_data['message'] = $this->input->post('message');
             //bhushan changes
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{user_name}', '{user_mail}', '{user_site}', '{user_message}', '{user_subject}');
             $with = array("{$mail_data['username']}", "{$mail_data['usermail']}", "{$mail_data['usersite']}", "{$mail_data['subject']}", "{$mail_data['message']}");
             $utf = "utf-8";
             $email_template_content = $this->email_template_model->get_email_template_by_id(2);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                 $contact_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $contact_content);
                 $content = "<html> <meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $this->email->subject($email_template_content[0]['subject_en']);
                 $contact_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $contact_content);
                 $content = "<html> <meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             //							$message = $this->load->view('mail_templates/contactus_mail', $mail_data,true);
             //							//echo $message; die;
             //						  	$this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>" . _clang(EMAIL_NOT_SENT) . " </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('contactus');
                 }
             } else {
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-success');
                 $this->session->set_flashdata('flash_message', '<strong>' . _clang(EMAIL_END) . '</strong>');
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('contactus');
                 }
             }
         } else {
             if ($redirect == 'home') {
                 $this->session->set_flashdata('validation_error_messages', validation_errors());
                 redirect('home');
             }
         }
         //redirect('contactus');
         //redirect('kd2a2a0u1g4/keyword/update/'.$id.'');
     } else {
         if (!$this->recaptcha->getIsValid()) {
             $this->session->set_flashdata('flash_message', '' . _clang(INCORRECT_CAPTCHA) . '');
             $this->session->set_flashdata('flash_class', 'alert-error');
         } else {
             $this->session->set_flashdata('flash_message', '' . _clang(INCORRECT_CREDENTIALS) . '');
             $this->session->set_flashdata('flash_class', 'alert-error');
         }
         $this->session->set_flashdata('validation_error_messages', validation_errors());
         redirect('contactus');
     }
     //captcha validation over
     //echo $data_to_store['usermail']; die;
     //if the insert has returned true then we show the flash message
     $data['main_content'] = 'contactus_view';
     $this->load->view('includes/template', $data);
 }
Пример #9
0
 public function success()
 {
     $this->load->model("invoice_model");
     $this->load->helper('email');
     //load email library
     $this->load->library('email');
     //        echo '<pre>'; print_r($_REQUEST); die;
     $id = $_POST['item_number'];
     $get_primary_email = $this->invoice_model->getPrimaryEmail($id);
     $usermail = $get_primary_email[0]['email'];
     $payment_date = date('Y-m-d H:i:s', strtotime($_POST['payment_date']));
     $data = array("status" => $_POST['payment_status'], "payment_date" => $payment_date, "txn_id" => $_POST["txn_id"]);
     if ($this->invoice_model->update_invoice_by_item_number($id, $data) == true) {
         $get_payment_type = $this->invoice_model->get_invoice_by_field(array("item_number"), array($id));
         $getmemebership_type = get_gopremium_price($get_payment_type[0]['payment_type']);
         $this->user_model->update_user($get_payment_type[0]['user_id'], array("type_of_membership" => $getmemebership_type['type_of_membership']));
         if ($this->session->userdata('is_logged_in')) {
             $this->session->unset_userdata(array('type_of_membership' => ''));
             $session = array('type_of_membership' => $getmemebership_type['type_of_membership']);
             //bhushan changes
             if (valid_email($usermail)) {
                 // compose email
                 $get_admin_detail = get_admin_detail();
                 //common helper function for admin detail
                 $this->email->from($get_admin_detail['email']);
                 $this->email->to($usermail);
                 $this->email->set_mailtype("html");
                 $this->email->subject('Account upgrade confirmation');
                 $session_lang = $this->session->userdata('language_shortcode');
                 $type_membership = get_type_of_membership_txt($session['type_of_membership']);
                 $user_name = $_POST['first_name'];
                 $replace = array('{upgrade_username}', '{type_of_membership}');
                 $with = array("{$user_name}", "{$type_membership}");
                 $email_template_content = $this->email_template_model->get_email_template_by_id(7);
                 if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                     $template_content = $email_template_content[0]['description_' . $session_lang];
                     $message = str_replace($replace, $with, $template_content);
                     $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                     $this->email->message($content);
                 } else {
                     $template_content = $email_template_content[0]['description_en'];
                     $message = str_replace($replace, $with, $template_content);
                     $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                     $this->email->message($content);
                 }
                 //echo "<pre>";print_r($session['type_of_membership']);
                 if (!$this->email->send()) {
                     //                    show_error($this->email->print_debugger());
                     $msgadd = "<strong>" . _clang(EMAIL_NOT_SENT) . " </strong>";
                     //.$this->email->print_debugger();
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', $msgadd);
                     redirect("home");
                 }
                 $this->session->set_userdata($session);
             } else {
                 if ($redirect == 'home') {
                     $this->session->set_flashdata('validation_error_messages', validation_errors());
                     redirect('home');
                 }
             }
             //end changes
         }
         $this->session->set_flashdata('flash_class', 'alert-success');
         $this->session->set_flashdata('flash_message', '<strong>' . _clang(WELL_DONE) . '</strong> ' . _clang(YOUR_PAYMENT_COMPLETE) . '');
         redirect("home");
     }
 }
Пример #10
0
 function email_ads()
 {
     $data['recaptcha_html'] = $this->recaptcha->recaptcha_get_html();
     $this->load->helper('email');
     $this->load->library('email');
     if ($this->input->server('REQUEST_METHOD') === 'POST') {
         $this->recaptcha->recaptcha_check_answer();
         $this->form_validation->set_rules('email', 'Your email Address', 'trim|required');
         $this->form_validation->set_rules('reciever_email', 'Recipients email address', 'trim|required');
         if ($this->form_validation->run() && $this->recaptcha->getIsValid()) {
             $title = $this->input->post('title');
             $post_description = $this->input->post('post_description');
             $posts_id = $this->input->post('posts_id');
             $parent_id = $this->input->post('parent_id');
             $email = $this->input->post('email');
             $reciever_email = $this->input->post('reciever_email');
             $description = $this->input->post('description');
             if (valid_email($reciever_email)) {
                 $config['protocol'] = 'sendmail';
                 $config['mailpath'] = '/usr/sbin/sendmail';
                 $config['charset'] = 'utf-8';
                 $config['mailtype'] = 'html';
                 $config['priority'] = 1;
                 $this->email->initialize($config);
                 $get_admin_detail = get_admin_detail();
                 //common helper function for admin detail
                 $this->email->from($email);
                 $this->email->to($reciever_email);
                 $this->email->set_mailtype("html");
                 $this->email->subject("StacksClassified Response:{$title}");
                 $mail_data['post_description'] = $post_description;
                 $mail_data['description'] = $description;
                 $mail_data['url'] = site_url() . 'post_detail/getPostdetails/' . $posts_id . '/' . $parent_id;
                 $message = $this->load->view('mail_templates/reply_to_email_this_ad', $mail_data, true);
                 $this->email->message($message);
                 // try send mail ant if not able print debug
                 if (!$this->email->send()) {
                     $msgadd = "<strong>E-mail not sent </strong>";
                     //.$this->email->print_debugger();
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', $msgadd);
                     redirect('reply/email_ads' . $posts_id . '/' . $parent_id);
                 } else {
                     //                        $data_to_store = array(
                     //                            'posts_id' => isset($posts_id) ? $posts_id : "",
                     //                            'email' => isset($email) ? $email : "",
                     //                            'description' => isset($description) ? $description : "",
                     //                            'title' => isset($title) ? $title : ""
                     //                        );
                     redirect("reply/email_ad_sent/{$posts_id}/{$parent_id}");
                 }
             }
         }
     }
     $data['main_content'] = 'email_ads_view';
     $this->load->view('includes/template', $data);
 }
Пример #11
0
 /**
  * * 
  * * @return mixed
  * */
 function create_member()
 {
     $this->load->library('form_validation');
     // field name, error message, validation rules
     //$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('username', 'User name', 'trim|required|min_length[4]|is_unique[user.username]');
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|is_unique[user.primary_email]');
     $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run()) {
         $pass = generate_password();
         $email = $this->input->post('email');
         $user_rand_id = $this->functions->get_user_rand_id();
         $data_to_store = array('user_rand_id' => $user_rand_id, 'username' => $this->input->post('username'), 'password' => md5($pass), 'primary_email' => $email, 'gender' => 'Neutral', 'type_of_membership' => 'FREE', 'date_of_registration' => date("Y-m-d H:i:s"), 'status' => 'Inactive');
         //if the insert has returned true then we show the flash message
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($email)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $session_lang = $this->session->userdata('language_shortcode');
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $mail_data['url'] = '<a href="' . site_url() . 'home/confirm/' . base64url_encode($email) . '">www.knewdog.com/confirm</a>';
             //bhushan changes
             $username = $this->input->post('username');
             $subscription_date = date("Y-m-d");
             $formated_subscription_date = date("jS F, Y", strtotime($subscription_date));
             $replace = array('{page_url}', '{subscription_date}', '{username}');
             $with = array("{$mail_data['url']}", "{$formated_subscription_date}", "{$username}");
             $utf = "utf-8";
             $email_template_content = $this->email_template_model->get_email_template_by_id(1);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                 $template_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $this->email->subject($email_template_content[0]['subject_en']);
                 $template_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             //
             //							$message = $this->load->view('mail_templates/signup_mail', $mail_data,true);
             //						  	$this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 //                    show_error($this->email->print_debugger());
                 $msgadd = "<strong>" . _clang(EMAIL_NOT_SENT_FOR_REGISTER) . " </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('signup');
                 }
             } else {
                 $store_data = array('from' => $get_admin_detail['email'], 'to' => $email, 'subject' => 'Please confirm your account on knewdog!', 'date' => date('Y-m-d'), 'compare_date' => date('Y-m-d'));
                 $this->user_model->store_reminder_email_data($store_data);
                 if ($this->user_model->store_user($data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(WELL_DONE) . '</strong> ' . _clang(WE_HAVE_SENT_YOU_A_LINK) . '');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('signup');
                     }
                     //redirect('kd2a2a0u1g4/user'.'');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(OH_SNAP) . '</strong> ' . _clang(CHANGE_A_FEW_THINGS_UP) . '');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('signup');
                     }
                 }
             }
         }
     } else {
         if ($redirect == 'home') {
             $this->session->set_flashdata('validation_error_messages', validation_errors());
             redirect('home');
         }
     }
     $data['main_content'] = 'signup_view';
     $this->load->view('includes/template', $data);
 }
    public function process()
    {
        //echo "stoped process";
        //die;
        $mailarray = $this->Imap_model->get_inboxlist();
        //echo "<pre>";print_r($mailarray);exit;
        $newarray = array();
        for ($c = 0; $c < count($mailarray); $c++) {
            $mraray = $mailarray[$c];
            //echo ''print_r($mraray); die;
            for ($m = 0; $m < count($mraray); $m++) {
                $newarray[] = $mraray[$m];
            }
        }
        ?>

        <?php 
        $array = json_decode(json_encode($newarray), true);
        /* function sortFunction( $a, $b ) {
            return strtotime($a['MailDate']) - strtotime($b['MailDate']);
            }
           */
        usort($array, "sortFunction");
        //Here You can use asort($data,"sortFunction")
        $rarray = array_reverse($array);
        //        echo '<pre>';
        //        print_r($rarray);
        //        exit;
        //echo "count->".count($rarray);
        $rarray = json_decode(json_encode($rarray), true);
        for ($r = 0; $r < count($rarray); $r++) {
            $id = trim($rarray[$r]['Msgno']);
            //$this->uri->segment(4);
            $raw_email = base64url_encode(decode_imap_text($rarray[$r]['to'][0]['mailbox']) . "@" . decode_imap_text($rarray[$r]['to'][0]['host']));
            //base64url_encode($rarray[$r]['toaddress']); //$this->uri->segment(5);
            //$email = $rarray[$r]['toaddress'];
            $email = decode_imap_text($rarray[$r]['to'][0]['mailbox']) . "@" . decode_imap_text($rarray[$r]['to'][0]['host']);
            //$rarray[$r]['to'][0]->['mailbox']."@".$rarray[$r]['to'][0]->['host'];
            $bodymail = $this->Imap_model->get_newsletter_email_by_email($email);
            //echo "<pre>";print_r($bodymail);exit;
            $this->load->config('imap');
            //echo '<pre>'; print_r($bodymail); die;
            $config['imap_server'] = $this->config->item('mailbox');
            $config['imap_user'] = $bodymail[0]['email'];
            $config['imap_pass'] = decrypt($bodymail[0]['password']);
            $config['imap_folder'] = 'INBOX';
            // Load the IMAP Library
            $this->Imap_model->imap($config);
            $mailarray = $this->Imap_model->imap_get_mail_array();
            $body = $this->Imap_model->imap_read_body($id);
            $mailarray = json_decode(json_encode($mailarray), true);
            //            echo '<pre>';
            //            print_r($mailarray);
            echo "body->" . $body;
            for ($i = 0; $i < count($mailarray); $i++) {
                if (in_array($id, $mailarray[$i])) {
                    $subject = decode_imap_text($mailarray[$i]['subject']);
                    $from = decode_imap_text($mailarray[$i]['from'][0]['mailbox']) . "@" . decode_imap_text($mailarray[$i]['from'][0]['host']);
                    $fromname = decode_imap_text($mailarray[$i]['from'][0]['personal']);
                    if ($fromname == "") {
                        $fromname = decode_imap_text($mailarray[$i]['from'][0]['mailbox']);
                    }
                }
                //echo "<br>->decode->".$subject = str_replace("_"," ", mb_decode_mimeheader($subject));;
            }
            //die;
            //die;
            //Start Removing Unsubscribe.
            /* $unsubscribe_text = $this->remove_unsubscribe_model->get_remove_unsubscribe_text();
               //echo '<pre>'; print_r($unsubscribe_text);
               for($i=0;$i<count($unsubscribe_text);$i++){
               $unsubscribe_text_array[] = $unsubscribe_text[$i]['unsubscribe_text'];
               }
               $unsubscribe_url = $this->remove_unsubscribe_model->get_remove_unsubscribe_url();
               //echo '<pre>'; print_r($unsubscribe_url);
               for($i=0;$i<count($unsubscribe_url);$i++){
               $unsubscribe_url_array[] = $unsubscribe_url[$i]['unsubscribe_url'];
               }
               $display_array = array_merge($unsubscribe_url_array,$unsubscribe_text_array); */
            //            echo '<pre>';
            //            print_r($bodymail);
            $check_subscribtion_email = check_subscribtion_email($from, $fromname);
            if ($check_subscribtion_email == true) {
                $check_blacklist_index = increase_blacklist_index($subject, $bodymail[0]['newsletter_rand_id']);
                //echo "check_blacklist_index->". $check_blacklist_index;
                if ($check_blacklist_index == true) {
                    $unsubscribes = $this->newsletter_model->get_newsletter_by_id($bodymail[0]['newsletter_id']);
                    //echo '<pre>'; print_r($unsubscribes); die;
                    $display_array = array();
                    $display_array = array($unsubscribes[0]['unsubscribe_url'], $unsubscribes[0]['unsubscribe_text']);
                    $return_html = remove_unsubscribe_list($body, $display_array);
                    if (count($return_html['count']) > 0) {
                        //echo $subject."<br>".$from;
                        echo "<br/>in news->" . $body;
                        $sn_id = $this->functions->get_newsletter_lsn_id();
                        $data_to_store = array('newsletter_rand_id' => $bodymail[0]['newsletter_rand_id'], 'sn' => $bodymail[0]['newsletter_rand_id'] . $sn_id, 'newsletter_relation' => 'child', 'newsletter_name' => $fromname, 'headline' => $subject, 'newsletter_email' => $from, 'description' => $return_html['html'], 'newsletter_sender_name' => $fromname, 'author_name' => $fromname, 'email' => $from, 'last_updated_date' => date("Y-m-d H:i:s"), 'added_date' => date("Y-m-d H:i:s"));
                        //echo '<pre>'; print_r($data_to_store);
                        //if the insert has returned true then we show the flash message
                        $this->newsletter_model->store_newsletter($data_to_store);
                        $this->Imap_model->imap_delete_mail($id);
                        //$data['flash_message'] = TRUE;
                        //$this->session->set_flashdata('flash_message', 'add');
                        $this->Imap_model->close_imap();
                        //redirect('kd2a2a0u1g4/emailinbox/inboxlist');
                        //$this->session->set_userdata('flash_message', 'add');
                        //$this->session->set_userdata('unsubscribe_count', count($return_html['count']));
                        //redirect('kd2a2a0u1g4/newsletter/');
                    } else {
                        $sn_id = $this->functions->get_newsletter_lsn_id();
                        $data_to_store = array('newsletter_rand_id' => $bodymail[0]['newsletter_rand_id'], 'sn' => $bodymail[0]['newsletter_rand_id'] . $sn_id, 'newsletter_relation' => 'child', 'newsletter_name' => $fromname, 'headline' => $subject, 'newsletter_email' => $from, 'description' => $return_html['html'], 'newsletter_sender_name' => $fromname, 'author_name' => $fromname, 'email' => $from, 'last_updated_date' => date("Y-m-d H:i:s"), 'added_date' => date("Y-m-d H:i:s"));
                        //echo '<pre>'; print_r($data_to_store);
                        //if the insert has returned true then we show the flash message
                        $this->newsletter_model->store_newsletter($data_to_store);
                        $last_newsletter_id = $this->db->insert_id();
                        $this->newsletter_clone_model->insert_one_row_by_id($last_newsletter_id);
                        $this->newsletter_model->delete_newsletter($last_newsletter_id);
                        $this->Imap_model->imap_delete_mail($id);
                        //$data['flash_message'] = TRUE;
                        //$this->session->set_flashdata('flash_message', 'add');
                        $this->Imap_model->close_imap();
                    }
                } else {
                    echo "<br/>in mail delete";
                    //Delete mail as its spam
                    $this->Imap_model->imap_delete_mail($id);
                    //$data['flash_message'] = TRUE;
                    //$this->session->set_flashdata('flash_message', 'add');
                    $this->Imap_model->close_imap();
                }
            } else {
                //$check_subscribtion_email flase clause move to administration folder
                $sn_id = $this->functions->get_newsletter_lsn_id();
                $data_to_store = array('newsletter_rand_id' => $bodymail[0]['newsletter_rand_id'], 'sn' => $bodymail[0]['newsletter_rand_id'] . $sn_id, 'newsletter_relation' => 'child', 'newsletter_name' => $fromname, 'headline' => $subject, 'newsletter_email' => $from, 'description' => $body, 'author_name' => $fromname, 'newsletter_sender_name' => $fromname, 'email' => $from, 'last_updated_date' => date("Y-m-d H:i:s"), 'added_date' => date("Y-m-d H:i:s"));
                //echo '<pre>'; print_r($data_to_store);
                //if the insert has returned true then we show the flash message
                $this->newsletter_model->store_newsletter($data_to_store);
                $last_newsletter_id = $this->db->insert_id();
                $this->administration_folder_model->insert_one_row_by_id($last_newsletter_id);
                $this->newsletter_model->delete_newsletter($last_newsletter_id);
                $this->Imap_model->imap_delete_mail($id);
                //$data['flash_message'] = TRUE;
                //$this->session->set_flashdata('flash_message', 'add');
                $this->Imap_model->close_imap();
            }
        }
        //**
        /* Blog schedule logic Start */
        $current_time_for_blog = strtotime(date("Y-m-d H:i:s"));
        $field_blog = array("set_schedule", "schedule_status", "status");
        $value_blog = array("YES", "Inactive", "Active");
        $get_data = $this->blog_model->get_blog_by_field_array($field_blog, $value_blog);
        //echo '<pre>'; print_r($get_data);
        for ($i = 0; $i < count($get_data); $i++) {
            $blog_update_array = array();
            if ($current_time_for_blog >= strtotime($get_data[$i]['published_date'])) {
                $blog_update_array = array("schedule_status" => "Active");
                $this->blog_model->update_blog($get_data[$i]['blog_id'], $blog_update_array);
            }
        }
        /*
                  //Blog shcedule logic ends */
        //bhushan changes
        //start code of  email reminder confirmation
        $this->load->model('user_model');
        $this->load->model('email_template_model');
        $this->load->model('invoice_model');
        $this->load->helper('email');
        $this->load->library('email');
        $reminder_mail_data = $this->user_model->get_email_reminder();
        //echo "<pre>";print_r($reminder_mail_data);exit;
        $reminder_mail_data_end_of_term = $this->invoice_model->get_email_reminder_for_end_of_term();
        //echo "<pre>";print_r($reminder_mail_data_end_of_term);exit;
        // echo "<pre>";print_r($reminder_mail_data_end_of_term);exit;
        $get_admin_detail = get_admin_detail();
        for ($c = 0; $c < count($reminder_mail_data_end_of_term); $c++) {
            $user_details = $this->user_model->get_username_by_id($reminder_mail_data_end_of_term[$c]['user_id']);
            for ($m = 0; $m < count($user_details); $m++) {
                $username = $user_details[$m]['username'];
                $account_type = $user_details[$m]['type_of_membership'];
                $current_date = date('Y-m-d');
                $reminder_date_end = date('Y-m-d', strtotime('-4 week', strtotime($reminder_mail_data_end_of_term[$c]['date_to'])));
                if ($reminder_mail_data_end_of_term[$c]['date_to'] == $current_date) {
                    if ($reminder_mail_data_end_of_term[$c]['on_that_date'] == "NO") {
                        $mail_data['end_term_msg'] = "Inform you that your account will be downgraded next day automatically 1 day before end of term";
                        $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
                        $this->email->to($reminder_mail_data_end_of_term[$i]["email"]);
                        $this->email->set_mailtype("html");
                        $session_lang = $this->session->userdata('language_shortcode');
                        $replace = array('{end_term_msg}', '{username}', '{account_type}');
                        $with = array("{$mail_data['end_term_msg']}", "{$username}", "{$account_type}");
                        $utf = "utf-8";
                        $email_template_content = $this->email_template_model->get_email_template_by_id(16);
                        if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                            $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                            $template_content = $email_template_content[0]['description_' . $session_lang];
                            $message = str_replace($replace, $with, $template_content);
                            $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                            $this->email->message($content);
                        } else {
                            $this->email->subject($email_template_content[0]['subject_en']);
                            $template_content = $email_template_content[0]['description_en'];
                            $message = str_replace($replace, $with, $template_content);
                            $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                            $this->email->message($content);
                        }
                        $this->email->send();
                    }
                    $content_data = array('on_that_date' => 'YES');
                    $this->invoice_model->update_flag($reminder_mail_data_end_of_term[$c]["invoice_id"], $content_data);
                }
                if ($reminder_mail_data_end_of_term[$c]['before_four_week'] == "NO" && $current_date == $reminder_date_end) {
                    $mail_data['end_term_date'] = $reminder_mail_data_end_of_term[$c]['date_to'];
                    $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
                    $this->email->to($reminder_mail_data_end_of_term[$i]["email"]);
                    $this->email->set_mailtype("html");
                    $session_lang = $this->session->userdata('language_shortcode');
                    $replace = array('{end_term_date},{username},{account_type}');
                    $with = array("{$mail_data['end_term_date']}", "{$username}", "{$account_type}");
                    $utf = "utf-8";
                    $email_template_content = $this->email_template_model->get_email_template_by_id(15);
                    //echo "<pre>";print_r($email_template_content);exit;
                    if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                        $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                        $template_content = $email_template_content[0]['description_' . $session_lang];
                        $message = str_replace($replace, $with, $template_content);
                        $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                        $this->email->message($content);
                    } else {
                        $this->email->subject($email_template_content[0]['subject_en']);
                        $template_content = $email_template_content[0]['description_en'];
                        $message = str_replace($replace, $with, $template_content);
                        $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                        $this->email->message($content);
                    }
                    $this->email->send();
                }
                $content_data = array('before_four_week' => 'YES');
                $this->invoice_model->update_flag($reminder_mail_data_end_of_term[$c]["invoice_id"], $content_data);
            }
        }
        foreach ($reminder_mail_data as $key => $value) {
            $date_content[] = $value['to'];
        }
        $get_users_details = $this->user_model->get_user_by_filed('primary_email', $date_content);
        $current_date = date('Y-m-d');
        for ($i = 0; $i < count($reminder_mail_data); $i++) {
            //echo "<pre>";print_r($reminder_mail_data);
            //date from reminder table
            $tbl_date = date('Y-m-d', strtotime($reminder_mail_data[$i]["date"]));
            //calculate 4week date
            $reminder_date = date('Y-m-d', strtotime('4 week', strtotime($tbl_date)));
            if ($reminder_date == $current_date) {
                if ($reminder_mail_data[$i]["compare_date"] != $current_date) {
                    $this->email->from($reminder_mail_data[$i]["from"]);
                    $this->email->to($reminder_mail_data[$i]["to"]);
                    $this->email->set_mailtype("html");
                    //$mail_data['url'] = site_url() . 'home/confirm/' . base64url_encode($reminder_mail_data[$i]["to"]);
                    $mail_data['url'] = '<a href="' . site_url() . 'home/confirm/' . base64url_encode($reminder_mail_data[$i]["to"]) . '">www.knewdog.com/confirm</a>';
                    $username = $get_users_details[0]['username'];
                    $subscription_date = $get_users_details[0]['date_of_registration'];
                    $formated_subscription_date = date("jS F, Y", strtotime($subscription_date));
                    $session_lang = $this->session->userdata('language_shortcode');
                    $replace = array('{page_url}', '{subscription_date}', '{username}');
                    $with = array("{$mail_data['url']}", "{$formated_subscription_date}", "{$username}");
                    $utf = "utf-8";
                    $email_template_content = $this->email_template_model->get_email_template_by_id(14);
                    //echo "<pre>";print_r($email_template_content);exit;
                    if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                        $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                        $template_content = $email_template_content[0]['description_' . $session_lang];
                        $message = str_replace($replace, $with, $template_content);
                        $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                        $this->email->message($content);
                    } else {
                        $this->email->subject($email_template_content[0]['subject_en']);
                        $template_content = $email_template_content[0]['description_en'];
                        $message = str_replace($replace, $with, $template_content);
                        $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                        $this->email->message($content);
                    }
                    $this->email->send();
                    $date_content = array('date' => date('Y-m-d'), 'compare_date' => date('Y-m-d'));
                    $reminder_mail_data = $this->user_model->update_compare_date($reminder_mail_data[$i]["reminder_email_id"], $date_content);
                }
            }
        }
        //end code email reminder confirmation
    }
Пример #13
0
    /**
     * Load the main view with all the current model model's data.
     * @return void
     */
    public function sent_mail()
    {
        $this->load->helper('email');
        //load email library
        $config = array('protocol' => 'smtp', 'smtp_host' => 'ssl://secure146.inmotionhosting.com', 'smtp_port' => 465, 'smtp_user' => '*****@*****.**', 'smtp_pass' => 'G#-(6Z{!d)LJ', 'mailtype' => 'html', 'charset' => 'iso-8859-1');
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");
        $get_admin_detail = get_admin_detail();
        //common helper function for admin detail
        $htmlcontent = '<meta charset="utf-8"><div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;"><table cellspacing="0" cellpadding="0" border="0" style="width:100%">
	<tbody>
		<tr>
			<td>
			<table cellspacing="0" cellpadding="10" border="0" style="background:none repeat scroll 0 0 #E46C0A; width:700px">
				<tbody>
					<tr>
						<td>
						<div style="background: none repeat scroll 0% 0% white; padding: 10px; position: relative; height:135px;"><a href="https://www.knewdog.com"><img style="float:left; margin-bottom:10px; margin-right:60px; width:191px" src="https://www.knewdog.com//assets/img/logo_inner.png" alt="knewdog - the worlds safest newsletter library"></a><span style="color:#e46c0a; font-size:xx-large"><strong>The Worlds Safest Newsletter Library</strong></span></div>
        </td>
        </tr>
        <tr>
        <td>
        <table cellspacing = "0" cellpadding = "0" border = "0" style = "width:700px">
        <tbody>
        <tr>
        <td colspan = "2"><span style = "font-size:x-large"><strong>Your newsletter(s) you subscribed to on knewdog!</strong></span></td>
        </tr>
        <tr>
        <td style = "background-color: #ffffff; text-align: left;">
        <p><a title = "Hide My Ass! Pro VPN" href = "http://hidemyass.com/vpn/r19334/"><img alt = "HideMyAss.com" src = "http://ddfnmo6ev4fd.cloudfront.net/img/banners2014/df/468x60.gif"></a></p>

        <p>Hi bhushan01, </p>

        <p>We are pleased to send you herewith the newsletters you subscribed to on your profile on knewdog.com.</p>

        <p><span style = "color:#e46c0a; font-size:large"><strong>Go Premium and ...</strong></span></p>

        <ul>
        <li>get <strong>all </strong>your favourite newsletters<strong> in one single e-mail</strong>, </li>
        <li><strong>choose date and time</strong> when you want to get your newsletters and</li>
        <li>select<strong> individual e-mail address</strong> for different newsletter topics (e.g. work e-mail address for work related topics)!</li>
        </ul>

        <p><strong>To manage your newsletter subscriptions, please go to your knewdog profile: </strong><a target = "_blank" style = "color: #444444; cursor: pointer;">https://www.knewdog.com/index.php?/signin/</a></p>

        <div style = "color: #e46c0a;"><strong>Have fun reading!<br>
        The knewdog Wouff</strong><br>
        &nbsp;
        </div>
        </td>
        </tr>
        </tbody>
        </table>
        </td>
        </tr>
        </tbody>
        </table>
        </td>
        </tr>
        </tbody>
        </table>

        <p>&nbsp;
        </p>
        </div>';
        /* $config['protocol'] = 'sendmail';
           $config['mailpath'] = '/usr/sbin/sendmail';
           $config['charset'] = 'iso-8859-1';
           $config['mailtype'] = 'html';
           $config['priority'] = 3;
           $this->email->initialize($config); */
        $this->email->from("*****@*****.**", $get_admin_detail['name']);
        $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**');
        $this->email->to($emails);
        //$this->email->to("*****@*****.**");
        $this->email->set_mailtype("html");
        $this->email->subject("Test newsletter for Advertisment");
        $this->email->message($htmlcontent);
        $filename = FCPATH . "uploads/database/newsletter_1107978815.html";
        $this->email->attach($filename);
        $this->email->send();
    }
Пример #14
0
 function confirm()
 {
     $email_encode = $this->uri->segment(3);
     if (!empty($email_encode)) {
         $email = base64url_decode($email_encode);
         $pass = generate_password();
         $data_to_store = array('password' => md5($pass), 'account_confirmed' => 'YES', 'status' => 'Active');
         $this->load->helper('email');
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($email)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Register confirmation and password for StacksGuide!');
             $users = $this->user_model->get_user_by_filed('primary_email', $email);
             $mail_data['password'] = $pass;
             $mail_data['username'] = $users[0]['username'];
             $message = $this->load->view('mail_templates/password_mail', $mail_data, true);
             $this->email->message($message);
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('signup');
             } else {
                 if ($this->user_model->update_user_by_email($email, $data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>Thank you for confirming your account. Please check your email for username and password.</strong>');
                     redirect('home');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>Oh snap! change a few things up and try submitting again.</strong>');
                     redirect('signup');
                 }
             }
         }
     }
     $data['main_content'] = 'reset_password_view';
     $this->load->view('includes/template', $data);
 }
Пример #15
0
 function set_pass_mail()
 {
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     if ($this->form_validation->run()) {
         $email = $this->input->post('email');
         $email_exist = $this->common_model->count_email_exist('user', 'primary_email', $email);
         if ($email_exist != '0') {
             if (valid_email($email)) {
                 $get_admin_detail = get_admin_detail();
                 //common helper function for admin detail
                 $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
                 $this->email->to($email);
                 $this->email->set_mailtype("html");
                 $this->email->subject("password reset:{$email}");
                 $mail_data['email'] = $email;
                 $mail_data['url'] = site_url() . 'home/set_password/' . base64url_encode($email);
                 $message = $this->load->view('mail_templates/reset_password_mail', $mail_data, true);
                 $this->email->message($message);
                 // try send mail ant if not able print debug
                 if (!$this->email->send()) {
                     $msgadd = "<strong>E-mail not sent </strong>";
                     //.$this->email->print_debugger();
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', $msgadd);
                     redirect("home/set_pass_mail");
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>please check your email!</strong>');
                     redirect("home");
                 }
             }
         } else {
             $msgadd = "<strong>You have not authorise to this Email please put correct Email </strong>";
             //.$this->email->print_debugger();
             $data['flash_message'] = TRUE;
             $this->session->set_flashdata('flash_class', 'alert-error');
             $this->session->set_flashdata('flash_message', $msgadd);
             redirect("home/set_pass_mail");
         }
     }
     $data['main_content'] = 'reset_pass_mail_view';
     $this->load->view('includes/template', $data);
 }
Пример #16
0
 function confirm()
 {
     $email_encode = $this->uri->segment(3);
     if (!empty($email_encode)) {
         $email = base64url_decode($email_encode);
         $pass = generate_password();
         //$affiliate_number = $this->session->userdata('affiliate_num');
         $data_to_store = array('password' => md5($pass), 'status' => 'Active');
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($email)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Register confirmation and password for StacksClassifieds');
             $users = $this->user_model->get_user_by_filed('primary_email', $email);
             $mail_data['password'] = $pass;
             $mail_data['username'] = $users[0]['username'];
             $message = $this->load->view('mail_templates/password_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('signup');
             } else {
                 $update_url = $this->user_model->update_user_by_email($email, $data_to_store);
                 $where_flag = " AND primary_email='{$email}'";
                 $affiliate_flag = $this->common_model->getFieldData('user', 'affiliate_flag', $where_flag);
                 if ($update_url) {
                     //
                     // $whereStr = "affiliate_user_email='{$email}'";
                     $affiliate_user_data = $this->common_model->getRow('affiliate', 'affiliate_user_email', $email);
                     $user_data = $this->common_model->get_content_by_field('user', 'affiliate_send_user_email', $affiliate_user_data->affiliate_send_user_email);
                     $affiliate_earn = $user_data[0]['affiliate_earn'];
                     $register_price = $user_data[0]['register_price'];
                     $affiliate_number = $user_data[0]['affiliate_number'];
                     $earn_price = $register_price + $affiliate_earn;
                     if ($affiliate_flag == '0') {
                         $flag_data_store = array('affiliate_flag' => '1');
                         $this->user_model->update_user_by_email($email, $flag_data_store);
                         $earn_price = $register_price + $affiliate_earn;
                         $data_store = array('affiliate_earn' => $earn_price);
                         $this->common_model->update_by_field('user', 'affiliate_number', $affiliate_number, $data_store);
                         $data['flash_message'] = TRUE;
                         $this->session->set_flashdata('flash_class', 'alert-success');
                         $this->session->set_flashdata('flash_message', '<strong>Thank you for confirming your account. Please check your email for username and password.</strong>');
                         redirect('home');
                     } else {
                         redirect('home');
                     }
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>Oh snap! change a few things up and try submitting again.</strong>');
                     redirect('signup');
                 }
             }
         }
     } else {
         redirect('home');
     }
     //$data['main_content'] = 'reset_password_view';
     //$this->load->view('includes/template', $data);
 }
Пример #17
0
 function forgot_password()
 {
     $this->load->helper('email');
     //load email library
     $this->load->library('email');
     $primary_email = $this->input->post('email');
     $password = generate_password();
     //$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
     $this->form_validation->set_rules('email', 'Email', 'trim|required');
     $this->load->model('Admin_model');
     if ($this->form_validation->run()) {
         $is_valid = $this->Admin_model->validate_email_front($primary_email);
         if ($is_valid) {
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($primary_email);
             $this->email->set_mailtype("html");
             //                    $this->email->subject('Your New Password for knewdog!');
             //bhushan changes
             //                $username = $this->input->post('username');
             //                $subscription_date = date("Y-m-d");
             //                $formated_subscription_date = date("jS F, Y", strtotime($subscription_date));
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{password}');
             $with = array("{$password}");
             $utf = "utf-8";
             $email_template_content = $this->email_template_model->get_email_template_by_id(13);
             //                echo "<pre>";print_r($email_template_content);exit;
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $this->email->subject($email_template_content[0]['subject_' . $session_lang]);
                 $template_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $this->email->subject($email_template_content[0]['subject_en']);
                 $template_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             if (!$this->email->send()) {
                 //                    show_error($this->email->print_debugger());
                 $msgadd = "<strong>Email not send </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('signup');
                 }
             } else {
                 $data_to_store = array('password' => md5($password));
                 if ($this->Admin_model->update_password($primary_email, $data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(WELL_DONE) . '</strong> ' . _clang(WE_SENT_YOU_PASSWORD) . '');
                     redirect('signup');
                     //redirect('kd2a2a0u1g4/user'.'');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(OH_SNAP) . '</strong> ' . _clang(CHANGE_A_FEW_THINGS_UP) . '');
                     redirect('signup');
                 }
             }
         } else {
             $data['flash_message'] = TRUE;
             $this->session->set_flashdata('flash_class', 'alert-error');
             $this->session->set_flashdata('flash_message', '<strong>ohh snap!</strong> Not Match your Email please Put correct email ');
             redirect('signin/forgot_password');
             //$this->load->view('home_view', $data);
         }
     }
     $data['main_content'] = 'forgot_password_view';
     $this->load->view('includes/template', $data);
 }
 function create_member()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'User name', 'trim|required|min_length[4]|is_unique[adv_user.username]');
     $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email|is_unique[adv_user.primary_email]');
     $this->form_validation->set_rules('confirm_email', 'Confirm Email Address', 'trim|required|matches[email]');
     $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]');
     $this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|required|matches[password]');
     $this->form_validation->set_rules('phone_number', 'Phone Number', 'required');
     $this->form_validation->set_rules('term_condition', 'Term Condition Not Checked', 'required');
     $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run() == TRUE) {
         $email = $this->input->post('email');
         $pass = $this->input->post('password');
         $data_to_store = array('date_of_registration' => date("Y-m-d H:i:s"), 'username' => $this->input->post('username'), 'password' => md5($pass), 'firstname' => $this->input->post('username'), 'primary_email' => $email, 'term_condition' => $this->input->post('term_condition'), 'status' => 'Inactive');
         //if the insert has returned true then we show the flash message
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($email)) {
             // compose email
             $this->email->clear(TRUE);
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Register confirmation for StacksGuide Advertisement Account!');
             $mail_data['url'] = site_url() . 'stacksguide_ads_signup/confirm_adervtisement_account/' . base64url_encode($email);
             $message = $this->load->view('mail_templates/signup_mail', $mail_data, true);
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('welcome_page');
                 } else {
                     redirect('stacksguide_ads_signup');
                 }
             } else {
                 if ($this->adv_user_model->store_user($data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>Well done!</strong> We have sent you a link to confirm your subscription.');
                     redirect('stacksguide_ads_signup');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>Oh snap!</strong> change a few things up and try submitting again.');
                     redirect('stacksguide_ads_signup');
                 }
             }
         }
     } else {
         if ($redirect == 'home') {
             $this->session->set_flashdata('validation_error_messages', validation_errors());
             redirect('stacksguide_ads_signup');
         }
     }
     $data['main_content'] = 'stacksguide_ads_signup_view';
     $this->load->view('includes/template', $data);
 }
 function posts_reported_ads()
 {
     $data['recaptcha_html'] = $this->recaptcha->recaptcha_get_html();
     if ($this->input->server('REQUEST_METHOD') === 'POST') {
         $this->recaptcha->recaptcha_check_answer();
         $this->form_validation->set_rules('recaptcha_response_field', 'Recaptcha', 'required|callback_check_captcha');
         $this->form_validation->set_message('check_captcha', 'Wrong Recaptcha');
         $this->form_validation->set_rules('repote_ad', 'category', 'trim|required');
         $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
         $repote_ad = $this->input->post('repote_ad');
         $posts_id = $this->input->post('posts_id');
         if ($this->form_validation->run() && $this->recaptcha->getIsValid()) {
             $data_to_store = array('posts_id' => isset($posts_id) ? $posts_id : "", 'repote_ad' => isset($repote_ad) ? $repote_ad : "");
             if ($this->post_detail_model->add_post_reported($data_to_store)) {
                 if ($this->session->userdata('is_logged_in')) {
                     $email = $this->session->userdata('primary_email');
                     $content = 'My email is ' . $email;
                 } else {
                     $email = "*****@*****.**";
                     $content = "";
                 }
                 $where_posts = " AND posts_id='{$posts_id}'";
                 $title = $this->common_model->getFieldData('posts', 'title', $where_posts);
                 if (valid_email($email)) {
                     $get_admin_detail = get_admin_detail();
                     //common helper function for admin detail
                     $config['protocol'] = 'sendmail';
                     $config['mailpath'] = '/usr/sbin/sendmail';
                     $config['charset'] = 'iso-8859-1';
                     $config['mailtype'] = 'html';
                     $config['priority'] = 1;
                     $this->email->initialize($config);
                     $this->email->from($email);
                     $this->email->to($email);
                     $this->email->set_mailtype("html");
                     $this->email->subject('Reported Ads');
                     $mail_data['to_email'] = $get_admin_detail['email'];
                     $mail_data['title'] = unserialize(base64_decode($title));
                     $mail_data['from_email'] = $content;
                     $mail_data['reason'] = $repote_ad;
                     $message = $this->load->view('mail_templates/repoted_ads_post', $mail_data, true);
                     $this->email->message($message);
                     if (!$this->email->send()) {
                         $msgadd = "<strong>E-mail not sent </strong>";
                         $data['flash_message'] = TRUE;
                         $this->session->set_flashdata('flash_class', 'alert-error');
                         $this->session->set_flashdata('flash_message', $msgadd);
                         redirect('home/home_page');
                     } else {
                         $this->email->send();
                         redirect("post_detail/repoted_ad_success/{$posts_id}");
                     }
                 }
             }
         } else {
             $data['posts_id'] = $posts_id;
             $data['recaptcha_html'] = $this->recaptcha->recaptcha_get_html();
             $data['main_content'] = 'repoted_ad_view';
             $this->load->view('includes/template', $data);
         }
     }
 }
 function cancle_account()
 {
     $redirect_to_home = FALSE;
     $user_id = $this->session->userdata("user_id");
     $type_of_membership = $this->session->userdata("type_of_membership");
     $answer = $this->input->post('ans');
     if ($answer == 'tell_us') {
         $answer = $this->input->post('tell_us');
     }
     $user_data = $this->user_model->get_user_by_id($user_id);
     $user_data = $this->user_model->get_user_by_id($user_id);
     if ($type_of_membership == 'FREE') {
         //Delete user
         $this->user_model->delete_user($user_id);
         //$this->session->set_flashdata('flash_mynl_tab', 'tab_4');
         //Delete all schedule
         $this->schedule_model->delete_schedule_with_userid($user_id);
         //delete all subscribe
         $this->subscribe_model->delete_subscribe_with_userid($user_id);
         //delete Newsletter review with process
         $get_newsletter_ids = $this->newsletter_model->get_newsletter_review('', '', '', '', '', '', array("join_user_id"), array($user_id), '');
         $this->newsletter_model->delete_newsletter_review_with_userid($user_id);
         for ($i = 0; $i < count($get_newsletter_ids); $i++) {
             $avg_rate = get_average_rate($get_newsletter_ids[$i]['join_newsletter_id']);
             $rate = array("ratings" => $avg_rate["avg_round"]);
             //add average rate
             $this->newsletter_model->update_newsletter($get_newsletter_ids[$i]['join_newsletter_id'], $rate);
         }
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         //First mail to user
         $user_email = $user_data[0]['primary_email'];
         $get_admin_detail = get_admin_detail();
         if (valid_email($user_email)) {
             // compose email
             //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($user_email);
             $this->email->set_mailtype("html");
             $this->email->subject('Your Free Account has been cancled from knewdog!');
             $free_cancle_username = $user_data[0]['username'];
             //bhushan changes
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{free_cancle_username}');
             $with = array("{$free_cancle_username}");
             $email_template_content_free_account = $this->email_template_model->get_email_template_by_id(8);
             if (isset($email_template_content_free_account[0]['description_' . $session_lang]) && !empty($email_template_content_free_account[0]['description_' . $session_lang])) {
                 $cancellation_email_content_for_free = $email_template_content_free_account[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $cancellation_email_content_for_free);
                 $utf = "utf-8";
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $cancellation_email_content_for_free = $email_template_content_free_account[0]['description_en'];
                 $message = str_replace($replace, $with, $cancellation_email_content_for_free);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             //							$message = $this->load->view('mail_templates/cancle_account_mail', $mail_data,true);
             //						  	$this->email->message($message);
             // try send mail ant if not able print debug
             $this->email->send();
         }
         $admin_email = $get_admin_detail['email'];
         if (valid_email($admin_email)) {
             // compose email
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($admin_email);
             $this->email->set_mailtype("html");
             $this->email->subject('One Account has been cancled from knewdog!');
             $mail_data['free_admin_cancle_account_type'] = get_type_of_membership_txt($type_of_membership);
             $mail_data['free_admin_cancle_answer'] = $answer;
             $mail_data['free_admin_cancle_user_email'] = $user_email;
             $mail_data['free_admin_cancle_username'] = $user_data[0]['username'];
             //bhushan changes
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{free_admin_cancle_account_type}', '{free_admin_cancle_answer}', '{free_admin_cancle_username}', '{free_admin_cancle_user_email}');
             $with = array("{$mail_data['free_admin_cancle_account_type']}", "{$mail_data['free_admin_cancle_answer']}", "{$mail_data['free_admin_cancle_username']}", "{$mail_data['free_admin_cancle_user_email']}");
             $email_template_content_cancle_admin = $this->email_template_model->get_email_template_by_id(9);
             if (isset($email_template_content_cancle_admin[0]['description_' . $session_lang]) && !empty($email_template_content_cancle_admin[0]['description_' . $session_lang])) {
                 $cancle_mail_free_account_admin = $email_template_content_cancle_admin[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $cancle_mail_free_account_admin);
                 $utf = "utf-8";
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $cancle_mail_free_account_admin = $email_template_content_cancle_admin[0]['description_en'];
                 $message = str_replace($replace, $with, $cancle_mail_free_account_admin);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             // try send mail ant if not able print debug
             $this->email->send();
         }
         //Delete additional email
         $this->additional_email_model->delete_additional_email_by_userid($user_id);
         //Delete Invoice
         //$this->invoice_model->delete_invoice_by_userid($user_id);
         //Loged out
         if ($this->session->userdata('is_logged_in')) {
             $reuired_sessiondata = array('session_id' => $this->session->userdata('session_id'), 'ip_address' => $this->session->userdata('ip_address'), 'user_agent' => $this->session->userdata('user_agent'), 'last_activity' => $this->session->userdata('last_activity'), 'language_shortcode' => $this->session->userdata('language_shortcode'));
             $array_items = array('username' => '', 'user_id' => '', 'type_of_membership' => '', 'is_logged_in' => false);
             $this->session->unset_userdata($array_items);
             //$this->session->sess_destroy();
             //set session required
             $this->session->set_userdata($reuired_sessiondata);
             $this->session->set_flashdata('flash_message', '<strong>' . _clang(WELL_DONE_YOUR_PROFILE) . '</strong>');
             $this->session->set_flashdata('flash_class', 'alert-success');
             $redirect_to_home = true;
             // redirect('home');
         }
     } else {
         if ($type_of_membership == 'PRE1') {
             $array = array("type_of_membership" => 'FREE');
             if (@$this->user_model->update_user($user_id, $array) == TRUE) {
                 $this->session->set_flashdata('flash_message', '<strong>' . _clang(YOUR_PROFILE_RESET_TO) . '</strong>');
                 $this->session->set_flashdata('flash_class', 'alert-success');
                 $this->session->set_flashdata('flash_mynl_tab', 'tab_4');
                 //Delete all schedule
                 //$this->schedule_model->delete_schedule_with_userid($user_id);
                 //delete all subscribe
                 //$this->subscribe_model->delete_subscribe_with_userid($user_id);
                 //Moved to free user
                 if ($this->session->userdata('is_logged_in')) {
                     $this->session->unset_userdata(array('type_of_membership' => ''));
                     $session = array('type_of_membership' => 'FREE');
                     //$this->session->set_userdata($session);
                 }
             } else {
                 $this->session->set_flashdata('flash_message', '<strong>' . _clang(OOPS_SOMETHING_WENT_WRONG) . '</strong>');
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_mynl_tab', 'tab_4');
             }
         } else {
             if ($type_of_membership == 'PRE2') {
                 $array = array("type_of_membership" => 'FREE');
                 if (@$this->user_model->update_user($user_id, $array) == TRUE) {
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(YOUR_PROFILE_RESET_TO) . '</strong>');
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_mynl_tab', 'tab_4');
                     //Delete all schedule
                     //$this->schedule_model->delete_schedule_with_userid($user_id);
                     //delete all subscribe
                     //$this->subscribe_model->delete_subscribe_with_userid($user_id);
                     //Moved to free user
                     if ($this->session->userdata('is_logged_in')) {
                         $this->session->unset_userdata(array('type_of_membership' => ''));
                         $session = array('type_of_membership' => 'FREE');
                         $this->session->set_userdata($session);
                     }
                 } else {
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(OOPS_SOMETHING_WENT_WRONG) . '</strong>');
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_mynl_tab', 'tab_4');
                 }
             }
         }
     }
     //Sending mail
     if ($type_of_membership != 'FREE') {
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         //First mail to user
         $email = $user_data[0]['primary_email'];
         if (valid_email($email)) {
             // compose email
             //                $get_admin_detail =
             //                        get_admin_detail(); //common helper function for admin detail
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('Your Account has been cancled from knewdog!');
             /* $message = '<style>p{margin-bottom:2px;}</style>
                <p>Your Password : '******'</p>
                <p>Thanks,<br/>KnewDog Team.</p>'; */
             $invoice_data = $this->invoice_model->get_invoice_custome_query("select * from invoice where user_id = '" . $user_id . "' and payment_type like '" . $type_of_membership . "%' and date_to > curdate()");
             $end_of_subscription = $invoice_data[0]["date_to"];
             $start_of_subsription = $invoice_data[0]["date_from"];
             $invoice_amount = $invoice_data[0]['amount'] * $invoice_data[0]['quantity'];
             $mail_data['cancle_amount'] = round(return_calculation($end_of_subscription, $start_of_subsription, $invoice_amount), 2);
             $mail_data['account_type'] = get_type_of_membership_txt($type_of_membership);
             $mail_data['cancle_username'] = $user_data[0]['username'];
             //bhushan changes
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{account_type}', '{cancle_username}', '{cancle_amount}');
             $with = array("{$mail_data['account_type']}", "{$mail_data['cancle_username']}", "{$mail_data['cancle_amount']}");
             $email_template_content = $this->email_template_model->get_email_template_by_id(4);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $cancellation_email_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $cancellation_email_content);
                 $utf = "utf-8";
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $cancellation_email_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $cancellation_email_content);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             //							$message = $this->load->view('mail_templates/cancle_account_mail', $mail_data,true);
             //						  	$this->email->message($message);
             // try send mail ant if not able print debug
             $this->email->send();
         }
         //second mail to admin
         $get_admin_detail = get_admin_detail();
         //common helper function for admin detail
         $email = $get_admin_detail['email'];
         if (valid_email($email)) {
             // compose email
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('One Account has been cancled from knewdog!');
             $mail_data['account_type'] = get_type_of_membership_txt($type_of_membership);
             $mail_data['answer'] = $answer;
             $mail_data['user'] = $user_data[0]['username'];
             $mail_data['user_email'] = $user_data[0]['primary_email'];
             //$type_of_membership = $user_data[0]['type_of_membership'];
             //echo "select * from invoice where user_id = '".$user_id."' and payment_type like '".$type_of_membership."%' and date_to > curdate()";
             $invoice_data = $this->invoice_model->get_invoice_custome_query("select * from invoice where user_id = '" . $user_id . "' and payment_type like '" . $type_of_membership . "%' and date_to > curdate()");
             $end_of_subscription = $invoice_data[0]["date_to"];
             $start_of_subsription = $invoice_data[0]["date_from"];
             $invoice_amount = $invoice_data[0]['amount'] * $invoice_data[0]['quantity'];
             $mail_data['amount'] = round(return_calculation($end_of_subscription, $start_of_subsription, $invoice_amount), 2);
             //bhushan changes
             $session_lang = $this->session->userdata('language_shortcode');
             $replace = array('{c_admin_account_type}', '{answer}', '{user}', '{user_email}', '{amount}');
             $with = array("{$mail_data['account_type']}", "{$mail_data['answer']}", "{$mail_data['user']}", "{$mail_data['user_email']}", "{$mail_data['amount']}");
             $email_template_content = $this->email_template_model->get_email_template_by_id(5);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $cancle_mail_account_admin = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $cancle_mail_account_admin);
                 $utf = "utf-8";
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             } else {
                 $cancle_mail_account_admin = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $cancle_mail_account_admin);
                 $content = "<html><meta charset='" . $utf . "'><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $this->email->message($content);
             }
             //end changes
             //echo '<pre>'; print_r($invoice_data);
             //echo print_r($mail_data);
             //die;
             //							$message = $this->load->view('mail_templates/cancle_account_mail_admin', $mail_data,true);
             //						  	$this->email->message($message);
             // try send mail ant if not able print debug
             $this->email->send();
         }
     }
     //sending mail end
     if ($redirect_to_home == TRUE) {
         redirect('home');
     } else {
         redirect('myknewdog');
     }
 }
Пример #21
0
 function create_member_site()
 {
     $this->load->library('form_validation');
     $this->form_validation->set_rules('username', 'User Name', 'required|is_unique[user.username]');
     $this->form_validation->set_rules('password', 'Password', 'required|matches[password_confirm]');
     $this->form_validation->set_rules('password_confirm', 'Password Confirmation', 'required');
     $this->form_validation->set_rules('create_email', 'Email Address', 'trim|required|valid_email|is_unique[user.primary_email]|matches[create_email_confirm]');
     $this->form_validation->set_rules('create_email_confirm', 'Email Address Confirmation', 'required');
     $this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->form_validation->run()) {
         $email = $this->input->post('create_email');
         if (valid_email($email)) {
             $get_admin_detail = get_admin_detail();
             $config['protocol'] = 'sendmail';
             $config['mailpath'] = '/usr/sbin/sendmail';
             $config['charset'] = 'iso-8859-1';
             $config['mailtype'] = 'html';
             $config['priority'] = 1;
             $this->email->initialize($config);
             $this->email->from($get_admin_detail['email'], $get_admin_detail['name']);
             $this->email->to($email);
             $this->email->set_mailtype("html");
             $this->email->subject('StacksClassifieds.com new account:' . $email);
             $mail_data['url'] = site_url() . 'affiliate/affiliate_confirm/' . base64url_encode($email);
             $mail_data['email'] = $email;
             $message = $this->load->view('mail_templates/affiliate_confirmation_user', $mail_data, true);
             $this->email->message($message);
             if (!$this->email->send()) {
                 $msgadd = "<strong>E-mail not sent </strong>";
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 redirect('affiliate/affiliate_singup_user');
             } else {
                 $affiliate_number = affiliate_number();
                 $pass = $this->input->post('password');
                 $data_to_store = array('username' => $this->input->post('username'), 'password' => md5($pass), 'firstname' => $this->input->post('username'), 'primary_email' => $email, 'type_of_membership' => 'Affilite', 'type' => $this->input->post('type'), 'affiliate_number' => $affiliate_number, 'status' => 'Inactive');
                 if ($this->user_model->store_user($data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>Well done!</strong> We have sent you a link to confirm your Account.');
                     redirect('home');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>Oh snap!</strong> change a few things up and try submitting again.');
                     redirect('affiliate/affiliate_singup_user');
                 }
             }
         }
     } else {
         $this->session->set_flashdata('validation_error_messages', validation_errors());
         redirect('affiliate/affiliate_singup_user');
     }
 }
Пример #22
0
                        <span class="to" style="text-align:center;" title="To">To</span>
                        <span  class="sender_name">Sender Name</span>
                        <span style="text-align:center;" class="date">Date</span>
                    </div>
                    <?php 
$nosub = "no subject";
for ($i = 0; $i < count($newsletter_clone); $i++) {
    @($subject = $newsletter_clone[$i]['headline'] != "" ? $newsletter_clone[$i]['headline'] : $nosub);
    ?>
                        <a target="_blank" href="<?php 
    echo site_url("kd2a2a0u1g4/admin-inbox/update/" . $newsletter_clone[$i]['newsletter_id']);
    ?>
">

                            <div class="email_item clearfix read"> <?php 
    $get_host = get_admin_detail();
    // add a different class for seperating read and unread e-mails
    ?>
                                <span class="subject" title="<?php 
    echo $subject;
    ?>
"><?php 
    echo $subject;
    ?>
</span>
                                <span class="from" title="<?php 
    echo $newsletter_clone[$i]['email'];
    ?>
"><?php 
    echo $newsletter_clone[$i]['email'];
    ?>
Пример #23
0
 function contactus_data()
 {
     $this->load->library('form_validation');
     $this->recaptcha->recaptcha_check_answer();
     //echo "captch->".$this->recaptcha->getIsValid(); die;
     // field name, error message, validation rules
     //$this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('username', 'User name', 'trim|required');
     $this->form_validation->set_rules('usermail', 'Email Address', 'trim|required|valid_email');
     $this->form_validation->set_rules('usersite', 'usersite', 'trim');
     $this->form_validation->set_rules('subject', 'subject', 'trim');
     $this->form_validation->set_rules('message', 'message', 'trim|required');
     //$this->form_validation->set_message('is_unique', 'The %s is already taken! Please choose another.');
     $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">&#215;</a><strong>', '</strong></div>');
     if ($this->input->post('redirect')) {
         $redirect = $this->input->post('redirect');
     } else {
         $redirect = '';
     }
     if ($this->form_validation->run() && $this->recaptcha->getIsValid()) {
         //$pass = generate_password();
         $username = $this->input->post('username');
         $usermail = $this->input->post('usermail');
         $usersite = $this->input->post('usersite');
         $subject = $this->input->post('subject');
         $message = $this->input->post('message');
         $user_rand_id = $this->functions->get_user_rand_id();
         $data_to_store = array('user_rand_id' => $user_rand_id, 'username' => $this->input->post('username'), 'usermail' => $this->input->post('usermail'), 'usersite' => $this->input->post('usersite'), 'subject' => $this->input->post('subject'), 'message' => $this->input->post('message'));
         //captcha validation
         //print_r($array); die;
         $this->load->helper('email');
         //load email library
         $this->load->library('email');
         //read parameters from $_POST using input class
         // check is email addrress valid or no
         if (valid_email($usermail)) {
             // compose email
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $this->email->from($usermail);
             $this->email->to($get_admin_detail['email']);
             $this->email->set_mailtype("html");
             $this->email->subject('Contact Us Detail');
             //$mail_data['url'] = site_url().'home/confirm/'.base64url_encode($email);
             $mail_data['username'] = $this->input->post('username');
             $mail_data['usermail'] = $this->input->post('usermail');
             $mail_data['usersite'] = $this->input->post('usersite');
             $mail_data['subject'] = $this->input->post('subject');
             $mail_data['message'] = $this->input->post('message');
             $message = $this->load->view('mail_templates/contactus_mail', $mail_data, true);
             //echo $message; die;
             $this->email->message($message);
             // try send mail ant if not able print debug
             if (!$this->email->send()) {
                 $msgadd = "<strong>" . _clang(EMAIL_NOT_SENT) . " </strong>";
                 //.$this->email->print_debugger();
                 $data['flash_message'] = TRUE;
                 $this->session->set_flashdata('flash_class', 'alert-error');
                 $this->session->set_flashdata('flash_message', $msgadd);
                 if ($redirect == 'home') {
                     redirect('home');
                 } else {
                     redirect('contactus');
                 }
             } else {
                 if ($this->user_model->store_user($data_to_store)) {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-success');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(WELL_DONE) . '</strong>' . _clang(EMAIL_END) . '');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('contactus');
                     }
                     //redirect('kd2a2a0u1g4/user'.'');
                 } else {
                     $data['flash_message'] = TRUE;
                     $this->session->set_flashdata('flash_class', 'alert-error');
                     $this->session->set_flashdata('flash_message', '<strong>' . _clang(OH_SNAP) . '</strong> ' . _clang(CHANGE_A_FEW_THINGS_UP) . '');
                     if ($redirect == 'home') {
                         redirect('home');
                     } else {
                         redirect('contactus');
                     }
                 }
             }
         } else {
             if ($redirect == 'home') {
                 $this->session->set_flashdata('validation_error_messages', validation_errors());
                 redirect('home');
             }
         }
         //redirect('contactus');
         //redirect('kd2a2a0u1g4/keyword/update/'.$id.'');
     } else {
         if (!$this->recaptcha->getIsValid()) {
             $this->session->set_flashdata('flash_message', '' . _clang(INCORRECT_CAPTCHA) . '');
             $this->session->set_flashdata('flash_class', 'alert-error');
         } else {
             $this->session->set_flashdata('flash_message', '' . _clang(INCORRECT_CREDENTIALS) . '');
             $this->session->set_flashdata('flash_class', 'alert-error');
         }
         $this->session->set_flashdata('validation_error_messages', validation_errors());
         redirect('contactus');
     }
     //captcha validation over
     //echo $data_to_store['usermail']; die;
     //if the insert has returned true then we show the flash message
     $data['main_content'] = 'contactus_view';
     $this->load->view('includes/template', $data);
 }
 function increase_blacklist_index($subject, $newsletter_rand_id)
 {
     $ci =& get_instance();
     $ci->load->model('newsletter_model');
     $ci->load->helper('email');
     //load email library
     $ci->load->library('email');
     $ci->load->model('email_template_model');
     $this->load->model('user_model');
     $session_user_id = $this->session->userdata('user_id');
     $user_interface = $this->user_model->get_username_by_id($session_user_id);
     $session_lang_shortcord = $this->user_model->get_language_shortcode_by_id($user_interface[0]['language_interface']);
     $session_lang1 = $session_lang_shortcord[0]['language_shortcode'];
     $session_lang = strtolower($session_lang1);
     $where_field_1 = array("newsletter_rand_id", "newsletter_relation");
     $where_value_1 = array($newsletter_rand_id, "parent");
     $newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1, $where_value_1);
     //echo '<pre>'; print_r($newsletter_parent_data); die;
     if ($newsletter_parent_data[0]['blacklist_flag'] == 'NO') {
         $where_field = array("headline", "newsletter_rand_id", "newsletter_relation");
         $where_value = array($subject, $newsletter_rand_id, "child");
         $newsletter_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field, $where_value);
         if (count($newsletter_data) > 0) {
             //$where_field_1 = array("newsletter_rand_id","newsletter_relation");
             //$where_value_1 = array($newsletter_rand_id,"parent");
             //$newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1,$where_value_1);
             $incresebyone = (int) $newsletter_parent_data[0]['blacklist_index'] + 1;
             //update blacklist index by
             $ci->newsletter_model->update_newsletter($newsletter_parent_data[0]['newsletter_id'], array("blacklist_index" => $incresebyone));
             if ($incresebyone == 10) {
                 $ci->newsletter_model->update_newsletter($newsletter_parent_data[0]['newsletter_id'], array("blacklist_flag" => 'YES'));
             }
             //return with incresing blacklist index
             $newsletter_parent_data = array();
             $newsletter_parent_data = $ci->newsletter_model->get_newsletter_by_field_array($where_field_1, $where_value_1);
             //Bhushan changes
             //sent mail to
             $blacklist_index = $newsletter_parent_data[0]['blacklist_index'];
             $blacklist_flag = $newsletter_parent_data[0]['blacklist_flag'];
             $email = $newsletter_parent_data[0]['newsletter_email'];
             //echo "email->".$email;
             $get_admin_detail = get_admin_detail();
             //common helper function for admin detail
             $ci->email->from($get_admin_detail['email']);
             //echo "admin->".$get_admin_detail['email'];
             $ci->email->to($email);
             $ci->email->set_mailtype("html");
             //$ci->email->subject('Your Black List flag and index for KnewDog!');
             //$session_lang = $ci->session->userdata('language_shortcode');
             $replace = array('{blacklist_index}', '{blacklist_flag}');
             $with = array("{$blacklist_index}", "{$blacklist_flag}");
             $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
             if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
                 $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
                 $template_content = $email_template_content[0]['description_' . $session_lang];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $ci->email->message($content);
             } else {
                 $this->email->subject($email_template_content[0]['subject_en']);
                 $template_content = $email_template_content[0]['description_en'];
                 $message = str_replace($replace, $with, $template_content);
                 $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
                 $ci->email->message($content);
             }
             $ci->email->send();
             return true;
         } else {
             //return without incresing blacklist index
             return true;
         }
     } else {
         //Bhushan changes
         //sent mail to
         $blacklist_index = $newsletter_parent_data[0]['blacklist_index'];
         $blacklist_flag = $newsletter_parent_data[0]['blacklist_flag'];
         $email = $newsletter_parent_data[0]['newsletter_email'];
         //$message = "return false resut.. Your black list flag is " . $blacklist_flag . " and your black list index is " . $blacklist_index;
         $get_admin_detail = get_admin_detail();
         //common helper function for admin detail
         $ci->email->from($get_admin_detail['email']);
         $ci->email->to($email);
         $ci->email->set_mailtype("html");
         //$ci->email->subject('Your Black List flag and index for KnewDog!');
         //$session_lang = $ci->session->userdata('language_shortcode');
         $replace = array('{blacklist_index}', '{blacklist_flag}');
         $with = array("{$blacklist_index}", "{$blacklist_flag}");
         $email_template_content = $ci->email_template_model->get_email_template_by_id(6);
         if (isset($email_template_content[0]['description_' . $session_lang]) && !empty($email_template_content[0]['description_' . $session_lang])) {
             $ci->email->subject($email_template_content[0]['subject_' . $session_lang]);
             $template_content = $email_template_content[0]['description_' . $session_lang];
             $message = str_replace($replace, $with, $template_content);
             $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
             $ci->email->message($content);
         } else {
             $this->email->subject($email_template_content[0]['subject_en']);
             $template_content = $email_template_content[0]['description_en'];
             $message = str_replace($replace, $with, $template_content);
             $content = "<html><body><div style='font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;'>{$message}</div></body></html>";
             $ci->email->message($content);
         }
         $ci->email->send();
         //end changes
         //            mail($email, "your blacklist warning from knewdog!", $message);
         return false;
     }
 }