diff --git a/application/controllers/Ajax.php b/application/controllers/Ajax.php index caf16816..598d54a6 100644 --- a/application/controllers/Ajax.php +++ b/application/controllers/Ajax.php @@ -312,39 +312,48 @@ function contact() { $email = $this->input->post('email'); $message = $this->input->post('message'); - $this->load->library('email'); - - //FIXME: This has to go in a config file. - //Futhermore, password must be loaded throught env - //variables. - // - //We could even do it with the mandrillapp api that - //we added for #34 - $config['protocol'] = "smtp"; - $config['smtp_host'] = "smtp.mandrillapp.com"; - $config['smtp_port'] = "587"; - $config['smtp_user'] = "marc@toolwatch.io"; - $config['smtp_pass'] = "pUOMLUusBKdoR604DpcOnQ"; - $config['charset'] = "utf-8"; - $config['mailtype'] = "html"; - $config['newline'] = "\r\n"; - - $this->email->initialize($config); - - $this->email->from('contact@toolwatch.io', 'Toolwatch contact'); - $this->email->to('marc@toolwatch.io', 'Marc'); - $this->email->reply_to($email, $name); - - $this->email->subject('Contact Toolwatch from '.$name); - - $bodyMessage = 'Name : '.$name.'
'; - $bodyMessage .= 'Email : '.$email.'
'; - $bodyMessage .= 'Message :
'; - $bodyMessage .= $message; - - $this->email->message($bodyMessage); - - if ($this->email->send()) { + $this->load->library('mandrill'); + + $messageMandrill = array( + 'html' => $message, + 'subject' => $subject, + 'from_email' => $email, + 'from_name' => $name, + 'to' => array( + array( + 'email' => 'marc@toolwatch.io', + 'name' => 'Marc', + 'type' => 'to', + ) + ), + 'headers' => array( + 'Reply-To' => $email, + ), + 'important' => false, + 'track_opens' => true, + 'track_clicks' => true, + 'tags' => array($tags), + 'google_analytics_campaign' => $tags, + 'google_analytics_domains' => array('toolwatch.io'), + 'metadata' => array( + 'website' => 'toolwatch.io', + ) + ); + + $async = false; + $ip_pool = 'Main Pool'; + + $scheduleTime = time(); + + $send_at = date('Y-', $scheduleTime).date('m-', $scheduleTime) + .(date('d', $scheduleTime)).' '.(date('H', $scheduleTime)-1).':' + .(date('i', $scheduleTime)).date(':s', $scheduleTime); + + $mandrillResponse = $this->mandrill->messages->send($messageMandrill, $async, $ip_pool, $send_at); + log_message('info', 'Mandrill email: ' . print_r($mandrillResponse, true)); + + + if ($mandrillResponse[0]['status'] === 'sent') { $result['success'] = true; } else { $result['success'] = false; diff --git a/application/libraries/Auto_email.php b/application/libraries/Auto_email.php index dd082709..e61fc1df 100644 --- a/application/libraries/Auto_email.php +++ b/application/libraries/Auto_email.php @@ -293,9 +293,12 @@ private function sendAtString($scheduleTime) { //order to send emails right away when exploring //computation in the future / past $scheduleTime = $scheduleTime - $this->timeOffset; - return date('Y-', $scheduleTime).date('m-', $scheduleTime) + + $returnValue = date('Y-', $scheduleTime).date('m-', $scheduleTime) .(date('d', $scheduleTime)).' '.(date('H', $scheduleTime)-1).':' .(date('i', $scheduleTime)).date(':s', $scheduleTime); + + return $returnValue; } /** diff --git a/application/views/footer.php b/application/views/footer.php index f7fbe157..bf516ed5 100644 --- a/application/views/footer.php +++ b/application/views/footer.php @@ -2,9 +2,9 @@ agent->is_mobile()){ ?>
diff --git a/application/views/header.php b/application/views/header.php index b000c76c..3418ef5b 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -81,7 +81,7 @@ "https://plus.google.com/104724190750629608501/"] } - + ';} diff --git a/application/views/measure/new-watch.php b/application/views/measure/new-watch.php index 3da1389a..29387297 100644 --- a/application/views/measure/new-watch.php +++ b/application/views/measure/new-watch.php @@ -25,7 +25,7 @@
- +
diff --git a/assets/img/logo-sm.png b/assets/img/logo-sm.png index 1761c531..244a9e8c 100644 Binary files a/assets/img/logo-sm.png and b/assets/img/logo-sm.png differ diff --git a/assets/img/product-hunt-logo-horizontal-black.png b/assets/img/product-hunt-logo-horizontal-black.png new file mode 100644 index 00000000..8b0b6ced Binary files /dev/null and b/assets/img/product-hunt-logo-horizontal-black.png differ diff --git a/index.php b/index.php index 9b309211..abfb75b1 100644 --- a/index.php +++ b/index.php @@ -71,7 +71,10 @@ case 'testing': case 'production': - ini_set('display_errors', 0); + //error_reporting(-1); + // error_reporting(E_ALL&~E_NOTICE&~E_DEPRECATED&~E_STRICT&~E_USER_NOTICE&~E_USER_DEPRECATED); + // ini_set('display_errors', 1); + // ini_set('display_errors', 0); if (version_compare(PHP_VERSION, '5.3', '>=')) { error_reporting(E_ALL&~E_NOTICE&~E_DEPRECATED&~E_STRICT&~E_USER_NOTICE&~E_USER_DEPRECATED); } else { diff --git a/session/.gitkeep b/session/.gitkeep new file mode 100644 index 00000000..e69de29b