/** * Création d'un utilisateur */ public function create() { function securise($string) { if (ctype_digit($string)) { $string = intval($string); } else { $string = mysql_real_escape_string($string); $string = addcslashes($string, '%_'); $string = htmlspecialchars($string); } return $string; } if (isset($_POST['page_name']) && isset($_POST['passwrd']) && isset($_POST['mail']) && !empty($_POST['page_name']) && !empty($_POST['passwrd']) && !empty($_POST['mail'])) { // Si on a toutes les infos $pagename = securise($_POST['page_name']); $passwrd = securise($_POST['passwrd']); $mail = securise($_POST['mail']); $usersManager = new \Manager\UsersManager(); $usersManager->insert(['page_name' => $pagename, 'passwrd' => password_hash($passwrd, PASSWORD_DEFAULT), 'mail' => $mail]); $userSession = new \W\Security\AuthentificationManager(); $userSession->logUserIn($user); $usersManager = new \Manager\UsersManager(); $user = $usersManager->find($userId); unset($user['password']); // on instancie les datas de base en DB $userID = $user['id']; $name = 'avatar_1'; $value = 'gergregegregergegregregregrege'; $initdata = new \Manager\OptionsManager(); $initdata->insertInit($userID, $name, $value); } $this->redirectToRoute('backoffice'); }
/** * Acces en BDD, Table Options * @return array : Contenu Table Options **/ public function getOptions() { $optionsManager = new \Manager\OptionsManager(); $options = $optionsManager->findAll(); $options[0]['copyrights'] = explode(';', $options[0]['copyrights']); return $options[0]['copyrights']; //a garder }
/** * Va chercher les options (enregistrements uniques) dans la BDD * Pour les intégrer au Layout de la FrontPage **/ public function presentation() { $data = array(); $data['options'] = $this->getOptions(); $optionsmanager = new \Manager\OptionsManager(); $options = $optionsmanager->findAll(); $layout = array('name' => 'presentation', 'opengraph' => array('title' => 'CrescendO Joeuf: Présentation', 'type' => 'website', 'image' => $data['options'][0]["url_logo"], 'url' => 'http://www.crescendo.site/presentation', 'description' => 'Présentation de la chorale Pop-Rock CrescendO, de Joeuf(54), Actus, Concerts, Vidéos...', 'locale' => 'fr_FR', 'site_name' => 'CrescendO'), 'tags' => array('link' => array('css/home.css', 'css/presentation.css'), 'script' => array())); $this->show('default/presentation', ['data' => $data, 'layout' => $layout]); }
private function mailer($name, $email, $message) { $optionManager = new \Manager\OptionsManager(); $mailrecipe = $optionManager->getMail(); $mail = new \PHPMailer(); // $email and $message are the data that is being // posted to this page from our html contact form //$email = '' ; $completeMessage = 'Vous avez recu un mail de ' . $email; //$mail->SMTPDebug = 2; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom($email); // below we want to set the email address we will be sending our email to. $mail->AddAddress($mailrecipe); $mail->addReplyTo(''); $mail->addCC(''); $mail->addBCC(''); $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Message recu depuis votre site OVE.'; $mail->Body = $message . "<br><br>" . $completeMessage; $mail->AltBody = $message; if (!$mail->send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; $this->redirectToRoute('onepage'); }