public function save() { $id = 0; if ($this->session->userdata('member_session')) { $id = $this->session->userdata('member_session')->id; } $dateTime = new DateTime(); $current_date = $dateTime->format("Y-m-d H:i:s"); /* if($_FILES['logo']['name']!="") { $userfile_name = $_FILES['logo']['name']; // file name $userfile_tmp = $_FILES['logo']['tmp_name']; // actual location $userfile_size = $_FILES['logo']['size']; // file size $userfile_type = $_FILES['logo']['type']; // mime type of file sent by browser. PHP doesn't check it. $userfile_error = $_FILES['logo']['error']; $extension = end(explode('.', $_FILES['logo']['name'])); //Add logo file, to solve conflict if i upload banner and logo as image, will take //same name. $name_file_timestamp=strtotime($current_date).'_logo'; $uplad_path_file=getcwd().'/added/uploads/logo/member/' . $name_file_timestamp.'.'.$extension; //if ($userfile_type!='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { if(move_uploaded_file($_FILES["logo"]["tmp_name"], $uplad_path_file)) { if($id==0) { $logo = '/added/uploads/logo/member/'.$name_file_timestamp.'.'.$extension; } else { if($_FILES['logo']['name']!='') { $logo=$this->Member_model->get_logo_by_id($this->table, $id); $logo_path=getcwd().$logo; if(isset($logo_path) && $logo_path!=getcwd()) { unlink($logo_path); } $logo = '/added/uploads/logo/member/'.$name_file_timestamp.'.'.$extension; } else { $logo = $this->Member_model->get_logo_by_id($this->table, $id);; } } } }else { if($id==0) { $logo = ''; } else { $logo = $this->Member_model->get_logo_by_id($this->table, $id); } } */ if ($id == 0) { $active_code = $this->randString(15); //$username = str_replace(' ', '', $_POST['firstname']); //$username=$username.$this->randString(3); $username = $_POST['email']; $password = $_POST['password']; $active = 0; } else { $current_row = $this->Member_model->get_by_id($this->table, $id); $active_code = $current_row->active_code; $username = $current_row->username; $password = $current_row->password; $active = 1; } if (isset($_POST['receive_newsletter'])) { $receive_newsletter = 1; } else { $receive_newsletter = 0; } $data['current_row'] = array('username' => $username, 'password' => $password, 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'gender' => $_POST['gender'], 'birthdate' => $_POST['birthdate'], 'email' => $_POST['email'], 'organization' => $_POST['organization'], 'address' => $_POST['address'], 'postal_code' => $_POST['postal_code'], 'city' => $_POST['city'], 'country_id' => $_POST['country_id'], 'phone' => $_POST['phone'], 'fax' => $_POST['fax'], 'receive_newsletter' => $receive_newsletter, 'registeration_datetime' => $current_date, 'active' => $active, 'active_code' => $active_code, 'approved' => 0, 'deleted' => 0); if ($id == 0) { $this->Member_model->insert($this->table, $data['current_row']); $id = $this->Member_model->get_max_id($this->table); /* * Send email to member */ //-------------------------------------------------------------------------------------- $email_template_row = $this->Email_template_model->get_by_purpose('member_signup'); $count_email_template_row = count($email_template_row); if ($count_email_template_row > 0) { $email_active = $email_template_row->active; $email_subject = $email_template_row->subject; //$email_body=$email_template_row->body; $email_body = $this->getEmailBody('registeration'); $email_body = str_replace('#@#@#@', $_POST['firstname'], $email_body); $email_body = str_replace('#&#&#&', $username, $email_body); $email_body = str_replace('#*#*#*', $password, $email_body); $email_body = str_replace('#!#!#!', "<a href='" . base_url() . $this->lang->lang() . '/member/login' . "'>" . lang('login') . "</a>", $email_body); $email_body = str_replace('#%#%#%', "<a href='" . base_url() . $this->lang->lang() . "/member/activate/{$active_code}'>" . lang('activate') . "</a>", $email_body); $email_body = str_replace('#^#^#^', 'http://www.nahdaislah.com', $email_body); if ($email_active == 1) { $email = $_POST['email']; $emailSetting = new EmailSetting(); $sending_email = $emailSetting->send_email($email, $email_subject, $email_body); } } //--------------------------------------------------------------------------------------- $this->session->set_userdata('message_session', lang('registered_successfully')); } else { $this->Member_model->update($this->table, $id, $data['current_row']); $this->session->set_userdata('message_session', lang('profile_saved_successfully')); $row_data = $this->Member_model->get_by_id($this->table, $id); $count = count($row_data); if ($count > 0) { $this->session->set_userdata('member_session', $row_data); } } redirect(base_url() . $this->lang->lang() . "/member/result"); }
function submit() { $dateTime = new DateTime(); $current_date = $dateTime->format("Y-m-d H:i:s"); $data['current_row'] = array('name' => $_POST['name'], 'email' => $_POST['email'], 'type' => $_POST['type'], 'message' => $_POST['message'], 'approved' => 0, 'deleted' => 0, 'last_modify_date' => $current_date); $this->Collaborate_model->insert($this->table, $data['current_row']); $id = $this->Collaborate_model->get_max_id($this->table); /* * Send email to partner */ //-------------------------------------------------------------------------------------- //$email_template_row=$this->Email_template_model->get_by_purpose('collaborate_client'); //$count_email_template_row=count($email_template_row); //if($count_email_template_row>0) { //$email_active=$email_template_row->active; $email_active = 1; $email_subject = lang('collaborate_with_us'); //$email_body=$email_template_row->body; $email_body = $_POST['message']; $email_body = $email_body . '<br/> from:' . $_POST['name'] . '<br/> email:' . $_POST['email'] . '<br/> type:' . $_POST['type']; /* $email_body= str_replace('#@#@#@',$_POST['contact_firstname'], $email_body); $email_body= str_replace('#&#&#&',$username, $email_body); $email_body= str_replace('#*#*#*',$password, $email_body); $email_body= str_replace('#!#!#!', "<a href='".base_url().$this->lang->lang().'/partner/login'."'>".lang('login')."</a>" , $email_body); $email_body= str_replace('#%#%#%', "<a href='".base_url().$this->lang->lang()."/partner/activate/$active_code'>".lang('activate')."</a>" , $email_body); $email_body= str_replace('#^#^#^','http://www.gizasystems.com', $email_body); */ if ($email_active == 1) { //$email=$_POST['email']; $email_settings = $this->Email_setting_model->get_all(); $website_mail = $email_settings[0]->website_mail; $emailSetting = new EmailSetting(); $sending_email = $emailSetting->send_email($website_mail, $email_subject, $email_body); } //} //--------------------------------------------------------------------------------------- $this->session->set_userdata('message_session', lang('message_sent_successfully')); redirect(base_url() . $this->lang->lang() . "/collaborate/result"); }
public function getEmail() { $email = EmailSetting::first(); $tpls = EmailTemplate::lists('name', 'id'); return View::make('admin.settings.email.notifications')->with('email', $email)->with('tpls', $tpls); }