Skip to content

Commit

Permalink
merge master + update contact form email
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Jan 28, 2016
2 parents aa863ae + 0ec4be4 commit 74aec1e
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 40 deletions.
75 changes: 42 additions & 33 deletions application/controllers/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = "[email protected]";
$config['smtp_pass'] = "pUOMLUusBKdoR604DpcOnQ";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";

$this->email->initialize($config);

$this->email->from('[email protected]', 'Toolwatch contact');
$this->email->to('[email protected]', 'Marc');
$this->email->reply_to($email, $name);

$this->email->subject('Contact Toolwatch from '.$name);

$bodyMessage = '<b>Name :</b> '.$name.'<br>';
$bodyMessage .= '<b>Email :</b> '.$email.'<br>';
$bodyMessage .= '<b>Message :</b> <br>';
$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' => '[email protected]',
'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;
Expand Down
5 changes: 4 additions & 1 deletion application/libraries/Auto_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions application/views/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<?php if(!$this->agent->is_mobile()){ ?>
<div id="publication_footer" class="publication">

<a href="http://www.fratellowatches.com/toolwatch-measure-the-accuracy-of-your-watch/"><img src="<?php echo img_url('fratello_logos_transparant.png'); ?>"></a>
<a href="http://wristreview.com/?p=16698"><img src="<?php echo img_url('wristreview.png'); ?>"></a>

<a href="http://www.fratellowatches.com/toolwatch-just-got-better/"><img src="<?php echo img_url('fratello_logos_transparant.png');?>"></a>
<a href="http://wristreview.com/?p=16698"><img src="<?php echo img_url('wristreview.png');?>"></a>
<a href="http://www.producthunt.com/tech/toolwatch"><img src="<?php echo img_url('product-hunt-logo-horizontal-black.png');?>"></a>
</div>
<?php } ?>
<div class="container container-fluid">
Expand Down
2 changes: 1 addition & 1 deletion application/views/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"https://plus.google.com/104724190750629608501/"]
}
</script>

<script type="text/javascript">CRISP_WEBSITE_ID = "-K4rBEcM_Qbt6JrISVzu";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.im/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();</script>
<meta name="p:domain_verify" content="9f4eefba8c49cf4a79b31c72a7e388a9"/>
<?php
foreach ($styleSheets as $css) {echo '<link rel="stylesheet" href="'.css_url($css).'?'.time().'">';}
Expand Down
2 changes: 1 addition & 1 deletion application/views/measure/new-watch.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
</div>
<div class="form-group">
<label for="yearOfBuy" class="col-sm-3 control-label">Year of buy</label>
<label for="yearOfBuy" class="col-sm-3 control-label">Year of purchase</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="yearOfBuy" placeholder="1998">
</div>
Expand Down
Binary file modified assets/img/logo-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Empty file added session/.gitkeep
Empty file.

0 comments on commit 74aec1e

Please sign in to comment.