public function executeLeave(HTTPRequest $request)
 {
     $this->authenticationRedirection();
     if (!$request->getExists('feedbackRequestId')) {
         $this->app->httpResponse()->redirect404();
         exit;
     }
     $feedbackRequestId = htmlspecialchars($request->getData('feedbackRequestId'));
     $feedbackRequest = $this->_feedbackRequestsManager->get($feedbackRequestId);
     if (is_null($feedbackRequest)) {
         $this->app->httpResponse()->redirect404();
         exit;
     }
     if ($request->postExists('submit-form')) {
         $feedback = new Feedback();
         $feedback->setAnnounceId($feedbackRequest->getAnnounceId());
         $feedback->setUserAuthorId($feedbackRequest->getUserAuthorId());
         $feedback->setUserOwnerId($feedbackRequest->getUserOwnerId());
         $feedback->setUserSubscriberId($feedbackRequest->getUserSubscriberId());
         $feedback->setReservationId($feedbackRequest->getReservationId());
         $mark = htmlspecialchars($request->postData('mark'));
         $comment = htmlspecialchars($request->postData('comment'));
         $feedback->setMark($mark);
         $feedback->setComment($comment);
         $this->_feedbacksManager->save($feedback);
         $this->_feedbackRequestsManager->delete($feedbackRequest->id());
         $this->app->user()->setFlash('feedback-saved');
         $this->app->httpResponse()->redirect('/feedback');
         exit;
     }
     $this->page->smarty()->assign('feedbackRequest', $feedbackRequest);
 }
 private function parseForm(HTTPRequest $request, Category $category)
 {
     $name = htmlspecialchars($request->postData('name'));
     $description = htmlspecialchars($request->postData('description'));
     $isRoot = !$request->postExists('parent-category');
     $category->setName($name);
     $category->setIsRoot($isRoot);
     $category->setDescription($description);
     if (!$isRoot) {
         $parentCategoryId = $request->postData('parent-category');
         $category->setParentCategoryId($parentCategoryId);
     }
 }
 private function parseSearch(HTTPRequest $request, AnnounceFilter $announceFilter)
 {
     $regionId = htmlspecialchars($request->postData('region'));
     $departmentId = htmlspecialchars($request->postData('department'));
     $categoryId = htmlspecialchars($request->postData('category'));
     $subCategoryId = htmlspecialchars($request->postData('subcategory'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $filterText = htmlspecialchars(urldecode($request->postData('filter')));
     $filterText = preg_replace('/(\\/|\\+)/', ' ', $filterText);
     //Supprime les espaces inutiles
     $filterText = preg_replace('/\\s\\s+/', ' ', $filterText);
     $previousFilterText = htmlspecialchars($request->postData('previous-filter-text'));
     $previousFilterText = preg_replace('/(\\/|\\+)/', ' ', $previousFilterText);
     //Supprime les espaces inutiles
     $previousFilterText = preg_replace('/\\s\\s+/', ' ', $previousFilterText);
     $inCommunity = htmlspecialchars($request->postData('community-filter'));
     if ($previousFilterText != $filterText) {
         $inCommunity = null;
     }
     if (!empty($inCommunity)) {
         $inCommunity = $this->app->user()->getAttribute('id');
     }
     $announceFilter->setRegionId($regionId);
     $announceFilter->setDepartmentId($departmentId);
     $announceFilter->setCategoryId($categoryId);
     $announceFilter->setSubCategoryId($subCategoryId);
     $announceFilter->setZipCode($zipCode);
     $announceFilter->setFilterText($filterText);
     $announceFilter->setInCommunity($inCommunity);
 }
 private function parseForm(HTTPRequest $request, Address $address)
 {
     $title = htmlspecialchars($request->postData('title'));
     $address1 = htmlspecialchars($request->postData('address-1'));
     $address2 = htmlspecialchars($request->postData('address-2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'France';
     $address->setTitle($title);
     $address->setAddress1($address1);
     $address->setAddress2($address2);
     $address->setZipCode($zipCode);
     $address->setCity($city);
     $address->setCountry($country);
     $address->setUserId($this->app->user()->getAttribute('id'));
 }
 public function executeIndex(HTTPRequest $request)
 {
     $this->init();
     if ($request->postExists('connect')) {
         $login = htmlspecialchars($request->postData('login'));
         $password = htmlspecialchars($request->postData('password'));
         $this->_user = $this->_userManager->authenticate($login, $password);
         if (!is_null($this->_user) && $this->_user->getRoleId() >= Role::ROLE_ADMINISTRATEUR && $this->_user->getIsActive()) {
             $this->app->user()->setAdminAuthenticated(true);
             $this->app->user()->setAttribute('admin-id', $this->_user->id());
             $this->authenticationRedirection();
         } else {
             $message = MessageBox::Error('L\'authentification a échoué !');
             $this->page->smarty()->assign('connexionMessage', $message);
         }
     }
 }
 public function executeFeedback(HTTPRequest $request)
 {
     $feedback = $this->_feedbacksManager->get(htmlspecialchars($request->getData('feedbackId')));
     if ($request->postExists('submit-form')) {
         $moderate = new Moderate();
         $moderate->setType(Moderate::TYPE_FEEDBACK);
         $moderate->setTypeId(htmlspecialchars($request->postData('feedback-id')));
         $moderate->setUserAuthorId(htmlspecialchars($request->postData('user-id')));
         $moderate->setMessage(htmlspecialchars($request->postData('message')));
         $this->_moderatesManager->save($moderate);
         //Envoyer un mail ici
         $messageMail = new Mail();
         $messageMail->sendModerationRequest();
         $this->page->smarty()->assign('messageSent', true);
         $this->app->user()->setFlash('message-sent');
         $this->displayInfoMessage();
     }
     $this->page->smarty()->assign('feedback', $feedback);
     $this->page->smarty()->assign('profilesManager', $this->_profilesManager);
     $this->page->smarty()->assign('usersManager', $this->_usersManager);
 }
 public function executeRefuse(HTTPRequest $request)
 {
     $announce = $this->_announcementsManager->get($request->getData('announceId'));
     $this->page->smarty()->assign('announce', $announce);
     if ($request->postExists('confirm')) {
         $announce->setStateId(AnnouncementStates::STATE_REFUSED);
         $announce->setAdminComment(htmlspecialchars($request->postData('admin-comment')));
         $this->_announcementsManager->save($announce);
         $this->app->user()->setFlash('announce-refused');
         //TODO : Envoyer un mail à l'utilistateur
         $this->app->httpResponse()->redirect('/admin/announcements');
         exit;
     }
 }
 private function parseIndisponibilities(HTTPRequest $request, Announcement $announce)
 {
     if ($request->postData('date-list') != '') {
         $unavailabilities = array();
         $dates = $request->postData('date-list');
         $dates = explode(',', $dates);
         foreach ($dates as $date) {
             $unavailability = new AnnouncementUnavailability();
             $unavailability->setDate($date);
             $unavailability->setDateOption($request->postData($date));
             $unavailability->setAnnouncementId($announce->id());
             $unavailabilities[] = $unavailability;
         }
         return $unavailabilities;
     }
     return null;
 }
 private function parsePostReservation(HTTPRequest $request, AnnouncementReservation $reservation)
 {
     $date = htmlspecialchars($request->postData('date'));
     $dateEnd = htmlspecialchars($request->postData('date-end'));
     $dateOption = htmlspecialchars($request->postData('date-option'));
     $announcementId = htmlspecialchars($request->postData('announcement-id'));
     $userOwnerId = htmlspecialchars($request->postData('user-owner-id'));
     $userSubscriberId = htmlspecialchars($request->postData('user-subscriber-id'));
     $contactGroupId = htmlspecialchars($request->postData('contact-group-id'));
     $price = htmlspecialchars($request->postData('price'));
     $paiementStateId = htmlspecialchars($request->postData('state-id'));
     $reservation->setAnnouncementId($announcementId);
     $reservation->setDate($date);
     if ($dateOption == 'period') {
         $reservation->setDateEnd($dateEnd);
     } else {
         $reservation->setDateEnd($date);
     }
     $reservation->setDateOption($dateOption);
     $reservation->setUserOwnerId($userOwnerId);
     $reservation->setUserSubscriberId($userSubscriberId);
     $reservation->setContactGroupId($contactGroupId);
     $reservation->setPrice($price);
     $reservation->setStateId($paiementStateId);
 }
 public function executeMember(HTTPRequest $request)
 {
     $announceId = htmlspecialchars($request->getData('announceId'));
     $announce = $this->_announcementsManager->get($announceId);
     if (!$this->announceIsValid($announce)) {
         $this->app->httpResponse()->redirect404();
         exit;
     }
     if ($this->app()->user()->isAdminAuthenticated()) {
         if ($request->postData('announce-id')) {
             $this->app->user()->setAuthenticated(true);
             $this->app->user()->setAttribute('id', $request->postData('user-id'));
             $this->app->httpResponse()->redirect('/announcements/edit/' . $request->postData('announce-id'));
             exit;
         }
     }
     $this->showAnnounceStateMessage($announce);
     $this->displayInfoMessage();
     $profile = $this->_profilesManager->getByUserId($announce->getUserId());
     $user = $this->_usersManager->get($announce->getUserId());
     $mainAddress = $this->_addressesManager->get($profile->getMainAddressId());
     $listOfContacts = $this->_contactsManager->getListOf($announce->getUserId());
     $listOfPrices = $this->_announcementPricesManager->getByAnnouncementId($announce->id());
     $listOfReservations = $this->_announcementReservationManager->getByAnnouncementId($announce->id());
     $this->_listOfUserAnnonces = $this->_announcementsManager->getListOf($announce->getUserId());
     $announcementUnavailabilities = $this->_announcementUnavailabilitiesManager->getByAnnouncementId($announce->id());
     $dateList = array();
     foreach ($announcementUnavailabilities as $unavailability) {
         $dateList[] = $unavailability->getDate();
     }
     //On récupère le code postal de la personne
     $postalCode = $mainAddress->getZipCode();
     //On récupère la liste des monnaies alternatives avec ce code postal
     $alternateCurrencyPostalCodeList = $this->_alternateCurrencyPostalCodeManager->getListByPostalCode($postalCode);
     //On test si l'utilisateur peut utiliser des monnaie alternative
     $canUseAlternateCurrency = count($alternateCurrencyPostalCodeList) > 0;
     //On crée un tableau pour récupérer la liste de nos monnaies alternative utilisable par cet utilisateur
     $listAlternateCurrenciesAvailable = array();
     //Si l'utilisteur peut utiliser des monnaies alternative
     if ($canUseAlternateCurrency) {
         //Pour chaque code postaux associé à une monnaie
         foreach ($alternateCurrencyPostalCodeList as $alternateCurrencyPostalCode) {
             //On ajoute l'entrée à notre tableau de liste de monnaie
             $listAlternateCurrenciesAvailable[] = $this->_alternateCurrencyManager->get($alternateCurrencyPostalCode->getAlternateCurrencyId());
         }
     }
     $listCurrencyUsed = explode(',', $profile->getAlternateCurrenciesUsed());
     $this->page->smarty()->assign('alternateCurrencyManager', $this->_alternateCurrencyManager);
     $this->page->smarty()->assign('listCurrencyUsed', $listCurrencyUsed);
     $this->page->smarty()->assign('canUseAlternateCurrency', $canUseAlternateCurrency);
     $this->page->smarty()->assign('listAlternateCurrenciesAvailable', $listAlternateCurrenciesAvailable);
     $this->assignVars($user);
     $this->page->smarty()->assign('dateList', implode(',', $dateList));
     $this->page->smarty()->assign('unavailabilities', $announcementUnavailabilities);
     $this->page->smarty()->assign('announce', $announce);
     $this->page->smarty()->assign('profile', $profile);
     $this->page->smarty()->assign('profilesManager', $this->_profilesManager);
     $this->page->smarty()->assign('user', $user);
     $this->page->smarty()->assign('categories', $this->_listOfCategories);
     $this->page->smarty()->assign('mainAddress', $mainAddress);
     $this->page->smarty()->assign('listOfUserAnnonces', $this->_listOfUserAnnonces);
     $this->page->smarty()->assign('listOfContacts', $listOfContacts);
     $this->page->smarty()->assign('listOfPrices', $listOfPrices);
     $this->page->smarty()->assign('listOfReservations', $listOfReservations);
     $this->page->smarty()->assign('contactsManager', $this->_contactsManager);
     $this->page->smarty()->assign('usersManager', $this->_usersManager);
     $this->page->smarty()->assign('feedbacksManager', $this->_feedbacksManager);
     $this->page->smarty()->assign('carrouselsManager', $this->_carrouselsManager);
     $this->page->smarty()->assign('departmentsManager', $this->_departmentsManager);
 }
 private function parseForm(HTTPRequest $request)
 {
     $username = htmlspecialchars($request->postData('username'));
     $mail = htmlspecialchars($request->postData('mail'));
     $mailConfirmation = htmlspecialchars($request->postData('mail-confirmation'));
     if ($request->postExists('generate-password')) {
         $password = $passwordConfirmation = Users::CreateNewPassword();
     } else {
         $password = htmlspecialchars($request->postData('password'));
         $passwordConfirmation = htmlspecialchars($request->postData('password-confirmation'));
     }
     $role = htmlspecialchars($request->postData('role'));
     if ($mail == $mailConfirmation && $password == $passwordConfirmation && strlen($username) >= 6 && strlen($password) >= 6) {
         $user = new Users();
         $user->setUsername($username);
         $user->setMail($mail);
         $user->setPassword($password, Tipkin\Config::get('secret-key'));
         $user->setRoleId($role);
         if (!$this->_userManager->isUsernameOrMailExist($username, $mail)) {
             $this->_userManager->save($user);
             $messageMail = new Mail();
             $messageMail->sendRegistrationInfo($user, $password);
             $this->app->user()->setFlash('new-user-added');
             $this->app->httpResponse()->redirect('/admin/users');
             exit;
         } else {
             $this->app->user()->setFlash('username-or-mail-exist');
             $this->app->httpResponse()->redirect('/admin/users');
             exit;
         }
     } else {
         $this->app->user()->setFlash('form-invalid');
         $this->app->httpResponse()->redirect('/admin/users');
         exit;
     }
 }
 private function parseForm(HTTPRequest $request, AnnouncementPro $announce)
 {
     $title = htmlspecialchars($request->postData('title'));
     $isPublished = $request->postExists('is-published');
     $description = htmlspecialchars($request->postData('description'));
     $pricePublic = htmlspecialchars($request->postData('price-public'));
     if ($request->postExists('has-tips')) {
         $tips = htmlspecialchars($request->postData('tips'));
     } else {
         $tips = '';
     }
     $rawMaterial = htmlspecialchars($request->postData('raw-material'));
     $address1 = htmlspecialchars($request->postData('address1'));
     $address2 = htmlspecialchars($request->postData('address2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'FRANCE';
     $departmentId = htmlspecialchars($request->postData('department'));
     $regionId = $this->_departmentsManager->get($departmentId)->getRegionId();
     $categoryId = htmlspecialchars($request->postData('category'));
     $subCategoryId = htmlspecialchars($request->postData('sub-category'));
     $userId = $this->_user->id();
     //Parsing
     $announce->setTitle($title);
     $announce->setIsPublished($isPublished);
     $announce->setDescription($description);
     $announce->setPricePublic($this->str2num($pricePublic));
     $announce->setTips($tips);
     $announce->setRawMaterial($rawMaterial);
     $announce->setAddress1($address1);
     $announce->setAddress2($address2);
     $announce->setZipCode($zipCode);
     $announce->setCity($city);
     $announce->setCountry($country);
     $announce->setDepartmentId($departmentId);
     $announce->setRegionId($regionId);
     $announce->setCategoryId($categoryId);
     $announce->setSubCategoryId($subCategoryId);
     $announce->setUserId($userId);
     $announce->setAdminComment('');
     // Demande de suppression de photo
     if ($request->postExists('delete-photo-main')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoMain());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoMain());
         $announce->setPhotoMain('');
     }
     if ($request->postExists('delete-photo-option-1')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption1());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption1());
         $announce->setPhotoOption1('');
     }
     if ($request->postExists('delete-photo-option-2')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption2());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption2());
         $announce->setPhotoOption2('');
     }
 }
示例#13
0
文件: modifier.php 项目: sdmg15/cmpj
include_once "C:\\wamp\\www\\CMPJ\\Controleurs\\HTTPRequest.php";
include_once "C:\\wamp\\www\\CMPJ\\Controleurs\\HTTPResponse.php";
include_once "C:\\wamp\\www\\CMPJ\\Model\\AdherentManagerPDO.php";
include_once "C:\\wamp\\www\\CMPJ\\Model\\PDOFactory.php";
$request = new HTTPRequest();
$manager = new AdherentManagerPDO(PDOFactory::getPdoInstance());
if (isset($_GET['modifier'])) {
    if (!$manager->Exists((int) $_GET['modifier'])) {
        $message = 'NOT FOUND.';
    } else {
        $adherent = $manager->getUnique((int) $_GET['modifier']);
    }
}
if ($request->postExists('nom')) {
    //on hydrate les  données
    $adherent = new Adherent(['nom' => $request->postData('nom'), 'prenom' => $request->postData('prenom'), 'dateNaissance' => $request->postData('date'), 'lieu' => $request->postData('lieuNaissance'), 'sexe' => $request->postData('sexe'), 'region' => $request->postData('region'), 'departement' => $request->postData('departement'), 'ethnie' => $request->postData('ethnie'), 'nationalite' => $request->postData('nationalite'), 'profession_mere_parrain' => $request->postData('profession'), 'situationMatrimoniale' => $request->postData('situation'), 'lieuResidence' => $request->postData('lieuResidence'), 'adresse' => $request->postData('addr'), 'telPerso' => $request->postData('telPerso'), 'sosTel' => $request->postData('sosTel'), 'sosName' => $request->postData('sosName'), 'diplomeEleve' => $request->postData('diplome'), 'dateObtentionPlace' => $request->postData('dateObtention'), 'speakLanguage' => $request->postData('speakLanguage'), 'filiere' => $request->postData('option')]);
    $adherent->setId((int) $_GET['modifier']);
    if ($adherent->isvalid()) {
        $manager->update($adherent);
        $message = 'Informations bien modifiées ';
    } else {
        $erreurs = $adherent->getErreurs();
    }
}
?>
<!DOCTYPE html>
<html>
	<head>
		<title>Formulaire d'inscription CMPJ MAYO-LOUTI</title>
		<meta charset="utf-8" content="text/html">
		<link rel="stylesheet" href="css/Envision.css" >
 public function executeBack(HTTPRequest $request)
 {
     error_reporting(E_ALL ^ E_NOTICE);
     header("Pragma: no-cache");
     header("Content-type: text/plain");
     // TPE Settings
     // Warning !! CMCIC_Config contains the key, you have to protect this file with all the mechanism available in your development environment.
     // You may for instance put this file in another directory and/or change its name. If so, don't forget to adapt the include path below.
     require_once dirname(__FILE__) . '/../../../../lib/paiement/CMCIC_Config.php';
     // --- PHP implementation of RFC2104 hmac sha1 ---
     require_once dirname(__FILE__) . '/../../../../lib/paiement/CMCIC_Tpe.inc.php';
     // Begin Main : Retrieve Variables posted by CMCIC Payment Server
     $CMCIC_bruteVars = getMethode();
     // TPE init variables
     $oTpe = new CMCIC_Tpe();
     $oHmac = new CMCIC_Hmac($oTpe);
     // Message Authentication
     $cgi2_fields = sprintf(CMCIC_CGI2_FIELDS, $oTpe->sNumero, $CMCIC_bruteVars["date"], $CMCIC_bruteVars['montant'], $CMCIC_bruteVars['reference'], $CMCIC_bruteVars['texte-libre'], $oTpe->sVersion, $CMCIC_bruteVars['code-retour'], $CMCIC_bruteVars['cvx'], $CMCIC_bruteVars['vld'], $CMCIC_bruteVars['brand'], $CMCIC_bruteVars['status3ds'], $CMCIC_bruteVars['numauto'], $CMCIC_bruteVars['motifrefus'], $CMCIC_bruteVars['originecb'], $CMCIC_bruteVars['bincb'], $CMCIC_bruteVars['hpancb'], $CMCIC_bruteVars['ipclient'], $CMCIC_bruteVars['originetr'], $CMCIC_bruteVars['veres'], $CMCIC_bruteVars['pares']);
     if ($oHmac->computeHmac($cgi2_fields) == strtolower($CMCIC_bruteVars['MAC'])) {
         switch ($CMCIC_bruteVars['code-retour']) {
             case "Annulation":
                 // Payment has been refused
                 // put your code here (email sending / Database update)
                 // Attention : an autorization may still be delivered for this payment
                 break;
             case "payetest":
                 // Payment has been accepeted on the test server
                 // put your code here (email sending / Database update)
                 $reservationId = $request->postData('reference');
                 $reservation = $this->_announcementReservationManager->get($reservationId);
                 if (!is_null($reservation)) {
                     $reservation->setStateId(PaiementStates::WAITING_VALIDATION);
                     $reservation->setTransactionRef($reservation->id());
                     $this->_announcementReservationManager->save($reservation);
                     $messageMail = new Mail();
                     $messageMail->sendReservationOwnerValidation($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()), $reservation);
                     $messageMail->sendReservationSubscriberRecap($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()));
                 }
                 break;
             case "paiement":
                 // Payment has been accepted on the productive server
                 // put your code here (email sending / Database update)
                 $reservationId = $request->postData('reference');
                 $reservation = $this->_announcementReservationManager->get($reservationId);
                 if (!is_null($reservation)) {
                     $reservation->setStateId(PaiementStates::WAITING_VALIDATION);
                     $reservation->setTransactionRef($reservation->id());
                     $this->_announcementReservationManager->save($reservation);
                     $messageMail = new Mail();
                     $messageMail->sendReservationOwnerValidation($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()), $reservation);
                     $messageMail->sendReservationSubscriberRecap($this->_usersManager->get($reservation->getUserOwnerId()), $this->_usersManager->get($reservation->getUserSubscriberId()), $this->_announcementManager->get($reservation->getAnnouncementId()));
                 }
                 break;
                 /*** ONLY FOR MULTIPART PAYMENT ***/
             /*** ONLY FOR MULTIPART PAYMENT ***/
             case "paiement_pf2":
             case "paiement_pf3":
             case "paiement_pf4":
                 // Payment has been accepted on the productive server for the part #N
                 // return code is like paiement_pf[#N]
                 // put your code here (email sending / Database update)
                 // You have the amount of the payment part in $CMCIC_bruteVars['montantech']
                 break;
             case "Annulation_pf2":
             case "Annulation_pf3":
             case "Annulation_pf4":
                 // Payment has been refused on the productive server for the part #N
                 // return code is like Annulation_pf[#N]
                 // put your code here (email sending / Database update)
                 // You have the amount of the payment part in $CMCIC_bruteVars['montantech']
                 break;
         }
         $receipt = CMCIC_CGI2_MACOK;
     } else {
         // your code if the HMAC doesn't match
         $receipt = CMCIC_CGI2_MACNOTOK . $cgi2_fields;
     }
     //-----------------------------------------------------------------------------
     // Send receipt to CMCIC server
     //-----------------------------------------------------------------------------
     printf(CMCIC_CGI2_RECEIPT, $receipt);
     // Copyright (c) 2009 Euro-Information ( mailto:centrecom@e-i.com )
     // All rights reserved. ---
 }
 public function executeAdd(HTTPRequest $request)
 {
     $userId = htmlspecialchars($request->getData('userId'));
     $user = $this->_usersManager->get($userId);
     $this->page->smarty()->assign('user', $user);
     if ($request->postExists('contact-group')) {
         $contactRequest = new ContactRequest();
         $contactRequest->setUserIdFrom($this->_user->id());
         $contactRequest->setUserIdTo(htmlspecialchars($request->postData('user-id-to')));
         $contactRequest->setContactGroupId(htmlspecialchars($request->postData('contact-group')));
         $this->_contactRequestsManager->save($contactRequest);
         //TODO envoyer un mail
         $userFrom = $this->_usersManager->get($contactRequest->getUserIdFrom());
         $userTo = $this->_usersManager->get($contactRequest->getUserIdTo());
         $messageMail = new Mail();
         $messageMail->sendContactRequest($userFrom, $userTo);
         $this->app->user()->setFlash('contact-request-sent');
         $this->app->httpResponse()->redirect('/contacts');
     }
 }
 private function parseForm(HTTPRequest $request, ProfilePro $profilePro, Address $address)
 {
     //PROFILE
     $companyName = htmlspecialchars($request->postData('company-name'));
     $lastname = htmlspecialchars($request->postData('lastname'));
     $firstname = htmlspecialchars($request->postData('firstname'));
     $description = htmlspecialchars($request->postData('description'));
     $phone = htmlspecialchars($request->postData('phone'));
     $mobilePhone = htmlspecialchars($request->postData('mobile-phone'));
     $officePhone = htmlspecialchars($request->postData('office-phone'));
     $website = htmlspecialchars($request->postData('website'));
     //ADDRESS
     $address1 = htmlspecialchars($request->postData('address-1'));
     $address2 = htmlspecialchars($request->postData('address-2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'France';
     $profilePro->setCompanyName($companyName);
     $profilePro->setLastname($lastname);
     $profilePro->setFirstname($firstname);
     $profilePro->setDescription($description);
     $profilePro->setPhone($phone);
     $profilePro->setMobilePhone($mobilePhone);
     $profilePro->setOfficePhone($officePhone);
     $profilePro->setWebsite($website);
     $profilePro->setUserId($this->app->user()->getAttribute('id'));
     $address->setAddress1($address1);
     $address->setAddress2($address2);
     $address->setZipCode($zipCode);
     $address->setCity($city);
     $address->setCountry($country);
     $address->setTitle($companyName);
     $address->setUserId($this->app->user()->getAttribute('id'));
 }
 public function executePopupConnect(HTTPRequest $request)
 {
     $this->init();
     $returnUrl = $request->getData('returnUrl');
     $this->page->smarty()->assign('returnUrl', $returnUrl);
     if ($request->postExists('connect')) {
         $login = htmlspecialchars($request->postData('login'));
         $password = htmlspecialchars($request->postData('password'));
         $createCookie = $request->postExists('create-cookie');
         $this->_user = $this->_userManager->authenticate($login, $password);
         if (!is_null($this->_user)) {
             if ($this->_user->getRoleId() >= Role::ROLE_MEMBER && $this->_user->getIsActive()) {
                 $this->app->user()->setAuthenticated(true);
                 $this->app->user()->setAttribute('id', $this->_user->id());
                 if ($createCookie) {
                     //On crée un cookie expirant dans un mois
                     $this->app->httpResponse()->setCookie('tipkin-id', $this->_user->id(), time() + 60 * 60 * 24 * 30);
                 }
                 $this->app->httpResponse()->redirect($returnUrl);
                 exit;
             } else {
                 $this->app->user()->setFlash('profile-disabled');
                 $this->app->httpResponse()->redirect('/login');
                 exit;
             }
         } else {
             $this->app->user()->setFlash('bad-login');
             $this->app->httpResponse()->redirect('/login');
             exit;
         }
     }
 }
 private function isContactMessageValid(HTTPRequest $request)
 {
     $subject = htmlspecialchars($request->postData('subject'));
     $email = htmlspecialchars($request->postData('email'));
     $message = htmlspecialchars($request->postData('message'));
     if (empty($email) || empty($subject) || empty($message)) {
         return false;
     } else {
         return true;
     }
 }