-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1377bc8
commit 02776fb
Showing
28 changed files
with
4,244 additions
and
3,576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
CREATE TABLE `tw_ci`.`email_user` ( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`userId` INT NOT NULL, | ||
`sentTime` INT NOT NULL, | ||
`emailType` INT NOT NULL, | ||
PRIMARY KEY (`id`)); | ||
|
||
ALTER TABLE `tw_ci`.`email_user` | ||
ADD INDEX `fk_email_user_1_idx` (`userId` ASC); | ||
ALTER TABLE `tw_ci`.`email_user` | ||
ADD CONSTRAINT `fk_email_user_1` | ||
FOREIGN KEY (`userId`) | ||
REFERENCES `tw_ci`.`user` (`userId`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION; | ||
|
||
CREATE TABLE `tw_ci`.`email_measure` ( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`measureId` INT NOT NULL, | ||
`sentTime` INT NOT NULL, | ||
`emailType` INT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `fk_email_measure_1_idx` (`measureId` ASC), | ||
CONSTRAINT `fk_email_measure_1` | ||
FOREIGN KEY (`measureId`) | ||
REFERENCES `tw_ci`.`measure` (`id`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION); | ||
|
||
CREATE TABLE `tw_ci`.`email_watch` ( | ||
`id` INT NOT NULL AUTO_INCREMENT, | ||
`watchId` INT NOT NULL, | ||
`sentTime` INT NOT NULL, | ||
`emailType` INT NOT NULL, | ||
PRIMARY KEY (`id`), | ||
INDEX `fk_email_watch_1_idx` (`watchId` ASC), | ||
CONSTRAINT `fk_email_watch_1` | ||
FOREIGN KEY (`watchId`) | ||
REFERENCES `tw_ci`.`watch` (`watchId`) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ | |
$db['default']['password'] = ''; | ||
$db['default']['database'] = 'toolwatch'; | ||
} else { | ||
$url = parse_url(getenv("TW_DB_URL")); | ||
$url = parse_url('mysql://travis:[email protected]/tw_ci?reconnect=true'); | ||
$db['default']['hostname'] = $url["host"]; | ||
$db['default']['username'] = $url["user"]; | ||
$db['default']['password'] = $url["pass"]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,8 @@ function login() { | |
$email = $this->input->post('email'); | ||
$password = $this->input->post('password'); | ||
if ($this->user->login($email, $password)) { | ||
$this->event->add($this->event->LOGIN_EMAIL); | ||
$result['success'] = true; | ||
} else { | ||
$this->event->add($this->event->LOGIN_FAIL); | ||
$result['success'] = false; | ||
} | ||
|
||
|
@@ -58,45 +56,13 @@ function facebookSignup() { | |
|
||
if ($this->user->signup($email, $password, $name, $firstname, $timezone, $country)) { | ||
|
||
$this->event->add($this->event->SIGN_UP_FB); | ||
|
||
$this->load->helper('mcapi'); | ||
$api = new MCAPI('eff18c4c882e5dc9b4c708a733239c82-us9'); | ||
$api->listSubscribe('7f94c4aa71', $email, ''); | ||
|
||
$this->load->library('email'); | ||
|
||
$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'); | ||
$this->email->to($email, $name.' '.$firstname); | ||
$this->email->reply_to('[email protected]', 'Toolwatch'); | ||
|
||
$this->email->subject('Welcome to Toolwatch!'); | ||
|
||
$message = $this->load->view('email/signup', '', true); | ||
$this->email->message($message); | ||
|
||
if ($this->email->send()) { | ||
$result['success'] = "signup"; | ||
$this->user->login($email, $password); | ||
} | ||
$result['success'] = "signup"; | ||
$this->user->login($email, $password); | ||
|
||
} | ||
|
||
} else if ($this->user->login($email, $password)) { | ||
|
||
$this->event->add($this->event->LOGIN_FB); | ||
|
||
$result['success'] = "signin"; | ||
|
||
} else { | ||
|
@@ -130,47 +96,11 @@ function signup() { | |
$email, $password, $name, $firstname, | ||
$timezone, $country)) { | ||
|
||
$this->event->add($this->event->SIGN_UP); | ||
|
||
if ('true' == $mailingList) { | ||
$this->load->helper('mcapi'); | ||
|
||
$api = new MCAPI('eff18c4c882e5dc9b4c708a733239c82-us9'); | ||
$api->listSubscribe('7f94c4aa71', $email, ''); | ||
} | ||
|
||
$this->load->library('email'); | ||
|
||
$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'); | ||
$this->email->to($email, $name.' '.$firstname); | ||
$this->email->reply_to('[email protected]', 'Toolwatch'); | ||
|
||
$this->email->subject('Welcome to Toolwatch!'); | ||
|
||
$message = $this->load->view('email/signup', '', true); | ||
$this->email->message($message); | ||
$result['success'] = true; | ||
$this->user->login($email, $password); | ||
|
||
if ($this->email->send()) { | ||
$result['success'] = true; | ||
$this->user->login($email, $password); | ||
} else { | ||
$result['success'] = false; | ||
} | ||
} else { | ||
|
||
$this->event->add($this->event->SIGN_UP_FAIL); | ||
|
||
$result['success'] = false; | ||
} | ||
} else { | ||
|
@@ -188,42 +118,13 @@ function askResetPassword() { | |
$email = $this->input->post('email'); | ||
|
||
$result = array(); | ||
$data = array(); | ||
|
||
$resetToken = $this->user->askResetPassword($email); | ||
|
||
if ($resetToken != '') { | ||
$this->event->add($this->event->RESET_PASSWORD); | ||
|
||
$this->load->library('email'); | ||
|
||
$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'); | ||
$this->email->to($email, ''); | ||
$this->email->reply_to('[email protected]', 'Toolwatch'); | ||
if ($resetToken !== '') { | ||
|
||
$this->email->subject('Your Toolwatch password'); | ||
|
||
$data['resetToken'] = $resetToken; | ||
|
||
$message = $this->load->view('email/reset-password', $data, true); | ||
$this->email->message($message); | ||
$result['success'] = true; | ||
|
||
if ($this->email->send()) { | ||
$result['success'] = true; | ||
} else { | ||
$result['success'] = false; | ||
} | ||
} else { | ||
$result['success'] = false; | ||
} | ||
|
@@ -235,8 +136,6 @@ function askResetPassword() { | |
function resetPassword() { | ||
if ($this->input->post('resetToken')) { | ||
|
||
$this->event->add($this->event->RESET_PASSWORD_USE); | ||
|
||
$result = array(); | ||
|
||
$resetToken = $this->input->post('resetToken'); | ||
|
@@ -259,8 +158,6 @@ function getReferenceTime() { | |
function accuracyMeasure() { | ||
if ($this->input->post('measureId')) { | ||
|
||
$this->event->add($this->event->NEW_ACCURACY); | ||
|
||
$referenceTime = $this->session->userdata('referenceTime'); | ||
$userTimezone = $this->input->post('userTimezone'); | ||
|
||
|
@@ -286,7 +183,6 @@ function accuracyMeasure() { | |
|
||
function baseMeasure() { | ||
if ($this->input->post('watchId')) { | ||
$this->event->add($this->event->NEW_MEASURE); | ||
|
||
$result = array(); | ||
|
||
|
@@ -302,42 +198,8 @@ function baseMeasure() { | |
|
||
if ($this->measure->addBaseMesure($watchId, $referenceTime, $userTime)) { | ||
|
||
$user = $this->user->getUserFromWatchId($watchId); | ||
|
||
$this->load->library('email'); | ||
|
||
$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'); | ||
$this->email->to($user->email, $user->name.' '.$user->firstname); | ||
$this->email->reply_to('[email protected]', 'Toolwatch'); | ||
|
||
$scheduleTime = time()+86400; | ||
$sentAt = date('Y-', $scheduleTime).date('m-', $scheduleTime).(date('d', $scheduleTime)).' '.(date('H', $scheduleTime)-1).':'.(date('i', $scheduleTime)).date(':s', $scheduleTime); | ||
$this->email->set_header('X-MC-SendAt', $sentAt); | ||
|
||
$this->email->subject('It\'s time to check your watch\'s accuracy !'); | ||
|
||
$data['watchBrand'] = $user->brand; | ||
$data['watchName'] = $user->name; | ||
|
||
$message = $this->load->view('email/remind-check-accuracy', $data, true); | ||
$this->email->message($message); | ||
$result['success'] = true; | ||
|
||
if ($this->email->send()) { | ||
$result['success'] = true; | ||
} else { | ||
$result['success'] = false; | ||
} | ||
} else { | ||
$result['success'] = false; | ||
} | ||
|
Oops, something went wrong.