function createProject() { $this->logger->debug("inside Create Project"); if (isset($_POST['title'], $_POST['description'], $_POST['type'], $_POST['tech_skills'], $_POST['my_role'], $_POST['team_size'], $_POST['start'], $_POST['end'], $_POST['status'])) { $newProject = new Project($this->userId, 0, $_POST['title'], $_POST['description'], $_POST['type'], 1, 0, date("Y-m-d H:i:s"), 0, 0, date("Y-m-d H:i:s"), $_POST['tech_skills'], $_POST['my_role'], $_POST['team_size'], date('Y-m-d', strtotime($_POST['start'])), date('Y-m-d', strtotime($_POST['end'])), $_POST['status'], null, null, null); $this->logger->debug("project"); try { $this->projectId = $this->projectsDAO->insert($newProject); $this->logger->debug("project id: " . $this->projectId); if ($_SERVER['HTTP_REFERER'] == $this->baseUrl . "completeProfile") { echo $this->projectId; } else { echo $this->baseUrl . "project/" . $this->projectId; } //header("location: " . ); $newMember = new Team($this->userId, $this->projectId, 'defaultteam', 0, date("Y-m-d H:i:s"), 1, 0, 1, null); $this->teamsDAO->insert($newMember); } catch (Exception $e) { echo "Failed to post"; } } if (isset($_POST['members']) && $_POST['members'] != '') { $subject = $this->firstName . " " . $this->lastName . " Added you as Collaborator"; $body = $this->firstName . " " . $this->lastName . "has Added you as collaborator for project \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br/>" . $_POST['title'] . "<br/><br/> View at http://collap.com/project/" . $this->projectId; $projectMembers = explode(',', $_POST['members']); foreach ($projectMembers as $key => $member) { //$emailController -> sendMail( $key, $temp->getSubject(), str_replace("{{ notification }}", $value, $temp->getBody())); EmailController::sendMail($member, $subject, $body); } } }
function forgetPassword() { if (isset($_POST['forget_email'])) { $emailRequest = $_POST['forget_email']; if ($emailRequest == "" || preg_replace("/\\s+/", "", $emailRequest) == "") { //header('Location: #'); //return false; echo "<span>Email cannot be empty</span>"; die; } elseif (!preg_match("/^[^@]+@[^@.]+\\.[^@]*\\w\\w\$/", $emailRequest)) { //header('Location: #'); //return false; echo "<span>Not a valid Email </span>"; die; } else { try { $isEmailExist = $this->userInfoDAO->queryByEmail($emailRequest); //echo "<span>" . var_dump($isEmailExist) . "</span>"; } catch (Exception $e) { $this->logger->error("Error occur : in queryByEmail " . json_encode($e)); } if ($isEmailExist) { try { $isAccessAidSet = $this->userAccessAidDAO->queryByUserIdStatus($isEmailExist[0]->getId()); //$already_sent_mail = mysqli_query($db_handle, "SELECT id, status, hash_key FROM user_access_aid WHERE user_id= '$user_id_access' AND status = '0';"); } catch (Exception $e) { $this->logger->error("Error occur : in queryByUserIdStatus " . json_encode($e)); } if ($isAccessAidSet) { $hashValue = $isAccessAidSet[0]->getHashKey() . "." . $isAccessAidSet[0]->getId(); $body = "Hi " . $isEmailExist[0]->getFirstName() . " " . $isEmailExist[0]->getLastName() . ", <br/>\n\t\t\t\t\t\t\tYou recently requested a password reset.<br/>\n\t\t\t\t\t\t\tTo change your Collap password,<br/>\n\t\t\t\t\t\t\tClick <a href='" . $this->baseUrl . "forgetPassword?hash_key={$hashValue}' target='_blank'> Reset Password </a> <br/>\n\t\t\t\t\t\t\tOr Copy the link and open in browser:" . $this->baseUrl . "forgetPassword?hash_key={$hashValue}\n\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\tThanks for using Collap! <br/>\n\t\t\t\t\t\t\tThe Collap Team"; EmailController::sendMail($isEmailExist[0]->getEmail(), "Password Recovery from Collap", $body); echo "<span>\n\t\t\t\t\t\t\t\t<div class='jumbotron' style='margin-top: 10px; color: rgb(46, 19, 19); margin-bottom: 10px; padding-top: 10px; padding-bottom: 10px'>\n\t\t\t\t\t\t\t\t\t<p align='center'> Please check your Email, shortly you get an email, Go through your email and change your password<br>\n\t\t\t\t\t\t\t\t\t<br><a data-dismiss='modal' href='#login'>Go Back</a></p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</span>"; die; } else { $hash_key = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 32); //mysqli_query($db_handle, "INSERT INTO user_access_aid (user_id, hash_key) VALUES ('$user_id_access', '$hash_key');"); $accessAidObj = new UserAccessAid($isEmailExist[0]->getId(), $hash_key, 0, date('Y-m-d G:i:s')); $accessAidId = $this->userAccessAidDAO->insert($accessAidObj); $hashValue = $hash_key . "." . $accessAidId; $body = "Hi " . $isEmailExist[0]->getFirstName() . " " . $isEmailExist[0]->getLastName() . "<br/>\n\t\t\t\t\t\t\tYou recently requested a password reset.<br/>\n\t\t\t\t\t\t\tTo change your Collap password,<br/>\n\t\t\t\t\t\t\tClick <a href='" . $this->baseUrl . "forgetPassword?hash_key={$hashValue}' target='_blank'> Reset Password </a> <br/>\n\t\t\t\t\t\t\tOr Copy the link and open in browser:" . $this->baseUrl . "forgetPassword?hash_key={$hashValue}\n\t\t\t\t\t\t\t<br/><br/>\n\t\t\t\t\t\t\tThanks for using Collap! <br/>\n\t\t\t\t\t\t\tThe Collap Team"; EmailController::sendMail($isEmailExist[0]->getEmail(), "Password Recovery from Collap", $body); echo "<span>\n\t\t\t\t\t\t\t\t\t<div class='jumbotron' style='margin-top: 10px; color: rgb(46, 19, 19); margin-bottom: 10px; padding-top: 10px; padding-bottom: 10px'>\n\t\t\t\t\t\t\t\t\t\t<p align='center'> Please check your Email, shortly you get an email, Go through your email and change your password<br>\n\t\t\t\t\t\t\t\t\t\t<br><a data-dismiss='modal' href='#login'>Go Back</a></p>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</span>"; die; } } else { echo "<span>No user is reistered with this Email.</span>"; die; } } } }