diff --git a/application/config/email.php b/application/config/email.php index 22d3efe..6207905 100644 --- a/application/config/email.php +++ b/application/config/email.php @@ -24,4 +24,6 @@ $config['smtp_host'] = $_ENV['MAIL']['HOST']; $config['smtp_user'] = $_ENV['MAIL']['SMTP_USER']; $config['smtp_pass'] = $_ENV['MAIL']['SMTP_PASS']; $config['smtp_port'] = $_ENV['MAIL']['SMTP_PORT']; - +$config['mailtype']='html'; +$config['crlf']="\r\n"; +$config['newline']="\r\n"; diff --git a/application/controllers/shared/Organisaties.php b/application/controllers/shared/Organisaties.php index c375077..6e11c63 100644 --- a/application/controllers/shared/Organisaties.php +++ b/application/controllers/shared/Organisaties.php @@ -463,13 +463,12 @@ class Organisaties extends MY_Controller{ $orgID = $_POST['orgID']; $filename = $_FILES['file']['name']; - + $this->deleteOldBijlage($orgID); if ( ! $this->upload->do_upload('file')) $error = $this->upload->display_errors(); else { $error = FALSE; - $randomname = $this->upload->data('file_name')['file_name']; - $this->deleteOldBijlage($orgID); + $randomname = $this->upload->data('file_name'); $this->setNieuweBijlage($orgID, $randomname, $filename); } $this->json($error); diff --git a/application/controllers/shared/Users.php b/application/controllers/shared/Users.php index 67c9254..eaaa1f7 100644 --- a/application/controllers/shared/Users.php +++ b/application/controllers/shared/Users.php @@ -309,24 +309,27 @@ class Users extends MY_Controller{ } function SendNewWW(){ //TODO sanitize input - $userid = $this->uri->segment(4); - $ok = true; + $userid = $this->clean_input('userid'); + $orgid = $this->clean_input('orgid'); + $ok = true; $errortekst = ''; $user = $this->Users_model->get_record_by_id($userid); - $ww = random_string('alnum', 8); + $ww = random_string('alnum', 8); $saltedww = md5($user->zout.$ww); // update user $this->Users_model->update_record(array('wachtwoord'=>$saltedww),$userid); $data = array('username'=>$user->gnaam, 'password'=>$ww, 'fullname'=>$this->Users_model->get_fullname($userid)); - $html = $this->load->view( 'emails/newpassword_mail', $data, TRUE ); - if( $_ENV['ENVIRONMENT'] == 'production') + $html = $this->load->view( 'emails/newpassword_mail', $data, TRUE ); + $org = $this->getBijlage($orgid); + + if( $_ENV['ENVIRONMENT'] == 'production') { //Deze code wordt alleen op produktie gebruikt en stuurt de mail //naar Mailgun via een API (Codeigniter email library wordt niet gebruikt $mg = Mailgun::create( $_ENV['MAIL']['APIKEY'] ); - $mg->messages()->send( $_ENV['MAIL']['DOMAIN'], [ + $mailData = [ 'from' => 'info@monpas.nl', 'to' => $user->email, 'cc' => 'rfranke@framework-ed.nl', @@ -337,7 +340,12 @@ class Users extends MY_Controller{ 'filename' => 'monpasklein.png', 'filePath' => FCPATH . 'css/images/monpasklein.png'] ] - ] ); + ]; + if( $org->randomname ) $mailData['attachment'][0] = [ + 'filename' => $org->bijlagefile, + 'filePath' => MYROOTPATH. 'docs/'.$org->randomname ]; + + $mg->messages()->send( $_ENV['MAIL']['DOMAIN'], $mailData ); }else { $this->load->library( 'email' ); @@ -347,7 +355,10 @@ class Users extends MY_Controller{ $this->email->subject( 'Inloggegevens MonPas' ); $this->email->message( $html ); $this->email->bcc( "rfranke@framework-ed.nl" ); - $this->email->send(); + + $this->email->attach(MYROOTPATH. 'docs/'.$org->randomname,'attachment', $org->bijlagefile); + $this->email->send(); + $result = $this->email->print_debugger(); } echo json_encode(array('ok'=>$ok, 'errortekst'=>$errortekst)); diff --git a/application/views/monpas/pages/monitor.php b/application/views/monpas/pages/monitor.php index 5bfb7a2..45b6a2e 100644 --- a/application/views/monpas/pages/monitor.php +++ b/application/views/monpas/pages/monitor.php @@ -48,52 +48,55 @@
| nr - | -indicator - | -score - | -|
|---|---|---|---|
+
+ | nr
+ |
+
+ |
+ score
+ |
+ |
| + style: {color: $parent.disabled()? '#d9d9d9' : '#262626' }" style="vertical-align:top; padding-top: 5px;"> | -
-
-
+
+
+
-
- |
-
-
-
-
+
+
+
%
-
-
+
+
@@ -103,7 +106,7 @@
event:{click: $root.fUpdateScoretypeVanaf3.bind($data, $parent.id)},
attr: {'name': $parent.id , 'value': value, 'checked': value == $parent.score()},
enable: $root.editok() " />
-
+
@@ -113,10 +116,11 @@
-
+
+
|