get('/mail', function () use ($app){ $message = ' Template mailing Alsacreations

TEXTE

Bonjour MaGueule,
Vous avez effectué une demande de changement de mot de passe.

A bientôt,
L\'equipe Drive U Safe

Aller sur Drive U Safe
'; echo $message; }); $app->get('/:langue/paiement_devis/:idTransaction', function ($langue, $idTransaction) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $returnCheckIdIti = $General->checkItineraireExist($idTransaction); if($returnCheckIdIti->type_trajet == 'excursion'){ $return = $General->checkItineraireExistExcursion($idTransaction,$langue); $returnCheckIdIti->adresse_arrivee = $return->title; } $voitures = $General->getCar($langue_code, $returnCheckIdIti->type_voiture); if(isset($_SESSION["idUser"])){ $user = $General->getUserById($_SESSION["idUser"]); } $obj = new stdClass(); if(isset($_SESSION["idUser"])){ $obj->user = $user; } $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; $amount = number_format($returnCheckIdIti->prix, 2, '', ' '); $parm="$parm amount=$amount"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $customerId = $returnCheckIdIti->id_user; $parm="$parm customer_id=$customerId"; $userMail = $returnCheckIdIti->mail; $parm="$parm customer_email=$userMail"; $parm="$parm order_id=$idTransaction"; $path_bin = "api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } $obj->departAdresse = $returnCheckIdIti->adresse_depart; $obj->arriverAdresse = $returnCheckIdIti->adresse_arrivee;; $obj->place = $returnCheckIdIti->passagers; $obj->voitures = $voitures; $obj->day = date('d', strtotime(str_replace('-','/', $returnCheckIdIti->dateTrajet)));; $obj->month = date('m', strtotime(str_replace('-','/', $returnCheckIdIti->dateTrajet))); $obj->year = date('Y', strtotime(str_replace('-','/', $returnCheckIdIti->dateTrajet))); $obj->heure = date('G', strtotime(str_replace('-','/', $returnCheckIdIti->dateTrajet))); $obj->min = date('i', strtotime(str_replace('-','/', $returnCheckIdIti->dateTrajet))); $obj->distance = $returnCheckIdIti->distance; $obj->duree = $returnCheckIdIti->duree; $obj->prix = $returnCheckIdIti->prix; $obj->idTransaction = $idTransaction; $obj->trad = $trad; $obj->paiementMessage = $message; $optn = ''; Render::renderer($app, "paiement_devis.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/call_request', function () use ($app){ $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; $parm="$parm amount=100"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $path_bin = "api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } if (( $code == "" ) && ( $error == "" ) ) { //erreur appel request }else if($code != 0){ //Erreur appel API de paiement }else{ //OK print ($message); } }); $app->post('/call_autoresponse', function () use ($app){ $logfile="/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/logSuccessFirst.txt"; $fp = fopen($logfile, 'w'); fwrite($fp, 'RESPONSE'); fclose($fp); $message="message=$_POST[DATA]"; $pathfile="pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $path_bin = "/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/response"; // Appel du binaire response $message = escapeshellcmd($message); $result=exec("$path_bin $pathfile $message"); $tableau = explode ("!", $result); $code = $tableau[1]; $error = $tableau[2]; $merchant_id = $tableau[3]; $merchant_country = $tableau[4]; $amount = $tableau[5]; $transaction_id = $tableau[6]; $payment_means = $tableau[7]; $transmission_date = $tableau[8]; $payment_time = $tableau[9]; $payment_date = $tableau[10]; $response_code = $tableau[11]; $payment_certificate = $tableau[12]; $authorisation_id = $tableau[13]; $currency_code = $tableau[14]; $card_number = $tableau[15]; $cvv_flag = $tableau[16]; $cvv_response_code = $tableau[17]; $bank_response_code = $tableau[18]; $complementary_code = $tableau[19]; $complementary_info = $tableau[20]; $return_context = $tableau[21]; $caddie = $tableau[22]; $receipt_complement = $tableau[23]; $merchant_language = $tableau[24]; $language = $tableau[25]; $customer_id = $tableau[26]; $order_id = $tableau[27]; $customer_email = $tableau[28]; $customer_ip_address = $tableau[29]; $capture_day = $tableau[30]; $capture_mode = $tableau[31]; $data = $tableau[32]; $order_validity = $tableau[33]; $transaction_condition = $tableau[34]; $statement_reference = $tableau[35]; $card_validity = $tableau[36]; $score_value = $tableau[37]; $score_color = $tableau[38]; $score_info = $tableau[39]; $score_threshold = $tableau[40]; $score_profile = $tableau[41]; //$merchant_id == 080521781700016; //$amount == 300; //$transaction_id == 144852; //$payment_means == CB //$transmission_date == aaaammjjhhmmss //$payment_time == hhmmss //$payment_date == aaaammjj //$response_code == 00 == good //$payment_certificate == e88b88551c67 //$authorisation_id == 144912 //$card_number == 4974.00 //$customer_id == ID DU USER EN BASE //$order_id == ID TRANSACTION EN BASE //$customer_email == quentin.mangin... if($response_code == '00'){ $logfile="/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/TESTLOL.txt"; $fp = fopen($logfile, 'w'); fwrite($fp, 'RESPONSE CODE 0'); $General = new General(); $prix_ht = null; $tva = null; $buyerFistName = null; $buyerLastName = null; $payer_status = null; $return = $General->insertPaiement($transaction_id, $prix_ht, $tva, $amount, $amount, $customer_id, $merchant_id, $customer_email, $merchant_id, $authorisation_id, $authorisation_id, $order_id, $buyerFistName, $buyerLastName, $payer_status, $payment_means, $order_id); fwrite($fp, 'ORDER == ' . $order_id); $getItineraire = $General->checkItineraireExist($order_id); fwrite($fp, 'id USER== ' . $getItineraire->id_user); if(isset($getItineraire->id_user)){ $kilometre = $getItineraire->distance; fwrite($fp, 'KILOMETRE == ' . $kilometre); $points = abs(floor($kilometre / KLM_POINT)); $General->addPointFidelisation($getItineraire->id_user,$points); } $General->payé($order_id); fclose($fp); }else{ $General = new General(); $General->nonPayé($order_id); } }); $app->post('/call_cancel', function () use ($app){ $message="message=$_POST[DATA]"; $pathfile="pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $path_bin = "/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/response"; // Appel du binaire response $message = escapeshellcmd($message); $result=exec("$path_bin $pathfile $message"); $tableau = explode ("!", $result); $code = $tableau[1]; $error = $tableau[2]; $merchant_id = $tableau[3]; $merchant_country = $tableau[4]; $amount = $tableau[5]; $transaction_id = $tableau[6]; $payment_means = $tableau[7]; $transmission_date = $tableau[8]; $payment_time = $tableau[9]; $payment_date = $tableau[10]; $response_code = $tableau[11]; $payment_certificate = $tableau[12]; $authorisation_id = $tableau[13]; $currency_code = $tableau[14]; $card_number = $tableau[15]; $cvv_flag = $tableau[16]; $cvv_response_code = $tableau[17]; $bank_response_code = $tableau[18]; $complementary_code = $tableau[19]; $complementary_info = $tableau[20]; $return_context = $tableau[21]; $caddie = $tableau[22]; $receipt_complement = $tableau[23]; $merchant_language = $tableau[24]; $language = $tableau[25]; $customer_id = $tableau[26]; $order_id = $tableau[27]; $customer_email = $tableau[28]; $customer_ip_address = $tableau[29]; $capture_day = $tableau[30]; $capture_mode = $tableau[31]; $data = $tableau[32]; $order_validity = $tableau[33]; $transaction_condition = $tableau[34]; $statement_reference = $tableau[35]; $card_validity = $tableau[36]; $score_value = $tableau[37]; $score_color = $tableau[38]; $score_info = $tableau[39]; $score_threshold = $tableau[40]; $score_profile = $tableau[41]; //$merchant_id == 080521781700016; //$amount == 300; //$transaction_id == 144852; //$payment_means == CB //$transmission_date == aaaammjjhhmmss //$payment_time == hhmmss //$payment_date == aaaammjj //$response_code == 00 == good //$payment_certificate == e88b88551c67 //$authorisation_id == 144912 //$card_number == 4974.00 //$customer_id == ID DU USER EN BASE //$order_id == ID TRANSACTION EN BASE //$customer_email == quentin.mangin... if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"])){ $app->redirect('/'.PATH_PROJET.$_SESSION["langue"].'/reserver/navette_prive/etape_1'); } $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$_SESSION["langue"].'.json'); $trad = json_decode($trad); $voitures = $General->getCar($langue_code, $_SESSION["car"]); $itineraire = $General->getItineraire($order_id); $user = $General->getUserByIdTransaction($order_id); if($user->type == "temp"){ $_SESSION["temp"] = $user; } $params = array( 'origin' => $itineraire->adresse_depart, 'destination' => $itineraire->adresse_arrivee, 'sensor' => 'true' ); $params_string = ''; foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } $dates = explode(" ", $itineraire->dateTrajet); $heures = explode(":", $dates[1]); $dates = explode("-", $dates[0]); $obj = new stdClass(); $obj->voitures = $voitures; $obj->departAdresse = $itineraire->adresse_depart; $obj->arriverAdresse = $itineraire->adresse_arrivee; $obj->place = $itineraire->passagers; $obj->day = $dates[2]; $obj->month = $dates[1]; $obj->year = $dates[0]; $obj->heure = $heures[0]; $obj->min = $heures[1]; $obj->distance = $_SESSION["distance"]; $obj->prix = $itineraire->prix; $obj->idTransaction = $order_id; $obj->trad = $trad; $obj->user = $user; $optn = ''; Render::renderer($app, "commande_error.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->post('/call_response', function () use ($app){ $message="message=$_POST[DATA]"; $pathfile="pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $path_bin = "/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/response"; // Appel du binaire response $message = escapeshellcmd($message); $result=exec("$path_bin $pathfile $message"); $tableau = explode ("!", $result); $code = $tableau[1]; $error = $tableau[2]; $merchant_id = $tableau[3]; $merchant_country = $tableau[4]; $amount = $tableau[5]; $transaction_id = $tableau[6]; $payment_means = $tableau[7]; $transmission_date = $tableau[8]; $payment_time = $tableau[9]; $payment_date = $tableau[10]; $response_code = $tableau[11]; $payment_certificate = $tableau[12]; $authorisation_id = $tableau[13]; $currency_code = $tableau[14]; $card_number = $tableau[15]; $cvv_flag = $tableau[16]; $cvv_response_code = $tableau[17]; $bank_response_code = $tableau[18]; $complementary_code = $tableau[19]; $complementary_info = $tableau[20]; $return_context = $tableau[21]; $caddie = $tableau[22]; $receipt_complement = $tableau[23]; $merchant_language = $tableau[24]; $language = $tableau[25]; $customer_id = $tableau[26]; $order_id = $tableau[27]; $customer_email = $tableau[28]; $customer_ip_address = $tableau[29]; $capture_day = $tableau[30]; $capture_mode = $tableau[31]; $data = $tableau[32]; $order_validity = $tableau[33]; $transaction_condition = $tableau[34]; $statement_reference = $tableau[35]; $card_validity = $tableau[36]; $score_value = $tableau[37]; $score_color = $tableau[38]; $score_info = $tableau[39]; $score_threshold = $tableau[40]; $score_profile = $tableau[41]; $General = new General(); $langue = ''; $cookie_name = 'langue'; if(!isset($_COOKIE[$cookie_name])){ $langue = 'fr'; }else{ if($_COOKIE[$cookie_name] != 'fr' || $_COOKIE[$cookie_name] != 'en' || $_COOKIE[$cookie_name] != 'es'){ $langue = 'fr'; }else{ $langue = $_COOKIE[$cookie_name]; } } $langue_code = $General->getLangueCode($langue); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $returnCheckIdIti = $General->checkItineraireExist($order_id); if($returnCheckIdIti->type_trajet == 'excursion'){ $return = $General->checkItineraireExistExcursion($order_id,$langue); $returnCheckIdIti->adresse_arrivee = $return->title; } $voitures = $General->getCar($langue_code, $returnCheckIdIti->type_voiture); $user = $General->getUserByIdTransaction($order_id); if($user->type == "temp"){ $_SESSION["temp"] = $user; } $dates = explode(" ", $returnCheckIdIti->dateTrajet); $heures = explode(":", $dates[1]); $dates = explode("-", $dates[0]); $day = $dates[2]; $month = $dates[1]; $year = $dates[0]; $heure = $heures[0]; $min = $heures[1]; $to = $user->mail; $subject = 'Drive U Safe - Commande validée'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre réservation.

Bonjour '.$user->prenom.' '.$user->nom.',
Votre commande a bien été validée.

  • N° facture: '.$returnCheckIdIti->id_itineraire.'
  • Depart : '.$returnCheckIdIti->adresse_depart.'
  • Arrivé : '.$returnCheckIdIti->adresse_arrivee.'
  • Date : '.$day.'/'.$month.'/'.$year.'
  • Heure : '.$heure.'h'.$min.'
  • Passager : '.$returnCheckIdIti->passagers.'
  • Prix : '.$returnCheckIdIti->prix.'€

A bientôt,
L\'equipe Drive U Safe

Si vous n\'avez pas fait cette demande sur le site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; //$message .= 'Pour valider votre inscription sur le site Drive Safe Paris veuillez cliquer sur ce lien : lien'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $obj = new stdClass(); $obj->voitures = $voitures; $obj->departAdresse = $returnCheckIdIti->adresse_depart; $obj->arriverAdresse = $returnCheckIdIti->adresse_arrivee; $obj->place = $returnCheckIdIti->passagers; $obj->day = $dates[2]; $obj->month = $dates[1]; $obj->year = $dates[0]; $obj->heure = $heures[0]; $obj->min = $heures[1]; $obj->distance = $returnCheckIdIti->distance; $obj->prix = $returnCheckIdIti->prix; $obj->idTransaction = $order_id; $obj->trad = $trad; $obj->user = $user; $optn = ''; Render::renderer($app, "commande_valide.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); /* * PAIEMENT * */ $app->get('/', function () use ($app){ $cookie_name = 'langue'; if(!isset($_COOKIE[$cookie_name])){ $app->redirect('fr'); }else{ if($_COOKIE[$cookie_name] != 'fr' && $_COOKIE[$cookie_name] != 'en' && $_COOKIE[$cookie_name] != 'es' && $_COOKIE[$cookie_name] != 'it' && $_COOKIE[$cookie_name] != 'ch' && $_COOKIE[$cookie_name] != 'gr' && $_COOKIE[$cookie_name] != 'pt' && $_COOKIE[$cookie_name] != 'all'){ $Utils = new Utils(); $countryCode = $Utils->ipToCountry($_SERVER['REMOTE_ADDR']); if($countryCode != 'fr' && $countryCode != 'en' && $countryCode != 'es' && $countryCode != 'it' && $countryCode != 'ch' && $countryCode != 'gr' && $countryCode != 'pt' && $countryCode != 'all'){ $app->redirect('fr'); }else{ $app->redirect($countryCode); } }else{ $app->redirect($_COOKIE[$cookie_name].'/home'); } } }); $app->get('/:langue', function ($langue) use ($app){ if(isset($_SERVER["HTTP_REFERER"])){ if($langue != 'fr' || $langue != 'en' || $langue != 'es'){ $uri = substr(str_replace(URL_PROJET, "", $_SERVER["HTTP_REFERER"]), 3); }else{ $langue = 'fr'; $uri = substr(str_replace(URL_PROJET, "", $_SERVER["HTTP_REFERER"]), 3); } $uri= ltrim ($uri, '/'); $uri = $langue.'/'.$uri; }else{ if($langue != 'fr' || $langue != 'en' || $langue != 'es'){ $langue = 'fr'; } $uri = $langue.'/home'; } $Utils = new Utils(); $Utils->cookieLangue($langue); $_SESSION["langue"] = $langue; $app->redirect($uri); }); $app->get('/confirm/:token', function ($token) use ($app){ $General = new General(); $return = $General->confirmInscription($token); $user = $General->selectUserToken($token); $_SESSION["isLog"] = true; $_SESSION["idUser"] = $user->id_user; $_SESSION["prenom"] = $user->prenom; $_SESSION["nom"] = $user->nom; if($return == true){ $app->redirect('/'.PATH_PROJET.'fr/moncompte/infos'); }else{ $app->redirect('/'.PATH_PROJET.'fr/home'); } }); $app->get('/:langue/reset_password/:token', function ($langue,$token) use ($app){ $General = new General(); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->trad = $trad; $obj->token = $token; $obj->langue = $langue; $optn = ''; Render::renderer($app, "resetPassword.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/home/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 5); $Utils = new Utils(); $Utils->cookieLangue($langue); $slider = $General->getHomeSlider(); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->trad = $trad; //$obj->content = $contentPage->content; $obj->slider = $slider; $obj->app = $app; $optn = ''; Render::renderer($app, "home.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); })->name('home'); $app->get('/:langue/actualites/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $contentPage = $General->getActualites($langue_code); $obj = new stdClass(); $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "actualites.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/actualites/:id', function ($langue, $id) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $contentPage = $General->getActualite($langue_code, $id); $obj = new stdClass(); $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "actualites_detail.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/avis/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $avis = $General->getAvis($langue_code); $obj = new stdClass(); $obj->avis = $avis; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "avis.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/faq/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $faq = $General->getFAQ($langue_code); if(empty($faq)){ $faq = $General->getFAQ(2); } $obj = new stdClass(); $obj->faq = $faq; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "faq.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/excursion/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage; $obj->trad = $trad; $optn = ''; Render::renderer($app, "excursion.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/excursion/etape_1/:id', function ($langue,$id) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursionsById($langue_code,$id); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); $_SESSION["excursion_id"] = $id; $_SESSION["idTransaction"] = Utils::randomMdp(); $_SESSION["type_reserve"] = 'excursion'; $obj = new stdClass(); $obj->trad = $trad; $obj->content = $contentPage; $optn = ''; Render::renderer($app, "excursion_etape_1.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/excursion/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'excursion'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $contentPage = $General->getExcursionsById($langue_code,$_SESSION["excursion_id"]); $_SESSION["adresseLatitude"] = $_GET["adresseLatitude"]; $_SESSION["adresseLongitude"] = $_GET["adresseLongitude"]; $_SESSION["Adresse"] = $_GET["Adresse"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["duree"] = $_GET["duree"]; $_SESSION["remarque"] = $_GET["remarque"]; $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); if(!isset($returnCheckIdIti->id_itineraire) && empty($returnCheckIdIti->id_itineraire)){ if(isset($_SESSION["idUser"])){ $user_id = $_SESSION["idUser"]; }else{ $user_id = NULL; } $bagage = NULL; $duree = NULL; $car = NULL; $etatCourse = 0; $numeroVolTrain = NULL; $distance = NULL; if(isset($_SESSION["prix"])){ $prix = $_SESSION["prix"]; }else{ $prix = NULL; } $return = $General->insertItineraire($_SESSION["Adresse"], $_SESSION["excursion_id"], $itineraireDate, $prix, $langue_code, $_SESSION["place"], 'excursion', $user_id, $_SESSION["idTransaction"],$bagage,$_SESSION["duree"],$etatCourse,$car,$numeroVolTrain,$distance,$_SESSION["remarque"]); } $obj = new stdClass(); $obj->trad = $trad; $obj->content = $contentPage; $obj->adresseLatitude = $_GET["adresseLatitude"]; $obj->adresseLongitude = $_GET["adresseLongitude"]; $obj->Adresse = $_GET["Adresse"]; $obj->place = $_GET["place"]; $obj->day = $_GET["day"]; $obj->month = $_GET["month"]; $obj->year = $_GET["year"]; $obj->heure = $_GET["heure"]; $obj->min = $_GET["min"]; $obj->duree = $_GET["duree"]; $obj->excursion = $contentPage->title; $obj->photo = $contentPage->photo; $optn = ''; Render::renderer($app, "excursion_etape_2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/excursion/etape_3', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'excursion'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $contentPage = $General->getExcursionsById($langue_code,$_SESSION["excursion_id"]); //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; $obj = new stdClass(); $obj->trad = $trad; Render::renderer($app, "excursion_etape_2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); $voitures = $General->getCars($langue_code); $contentPage = $General->getPageContent($langue_code, 8); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->subtitle = $contentPage->content; $obj->titre = $contentPage->title; $obj->voitures = $voitures; $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "mise_dispo.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/duree', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); $voitures = $General->getCars($langue_code); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->voitures = $voitures; $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "mise_dispo_duree.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/duree/etape_1', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $voitures = $General->getCarsPlace($langue_code,$_GET["place"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $_SESSION["idTransaction"] = Utils::randomMdp(); $_SESSION["type_reserve"] = 'mise_dispo_duree'; $_SESSION["adresseLatitude"] = $_GET["adresseLatitude"]; $_SESSION["adresseLongitude"] = $_GET["adresseLongitude"]; $_SESSION["Adresse"] = $_GET["Adresse"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["duree"] = $_GET["duree"]; $_SESSION["remarque"] = $_GET["remarque"]; if($_GET["duree"] < 9){ if($_GET["duree"] < 4){ $_SESSION["prix_duree_berline"] = $_GET["duree"]*PRIX_HEURE_BERLINE; $_SESSION["prix_duree_luxe"] = $_GET["duree"]*PRIX_HEURE_LUXE; $_SESSION["prix_duree_prestige"] = $_GET["duree"]*PRIX_HEURE_PRESTIGE; $_SESSION["autorise_duree"] = true; }else if($_GET["duree"] == 4){ $_SESSION["prix_duree_berline"] = FORFAIT_4_BERLINE; $_SESSION["prix_duree_luxe"] = FORFAIT_4_LUXE; $_SESSION["prix_duree_prestige"] = FORFAIT_4_PRESTIGE; $_SESSION["autorise_duree"] = true; }else if($_GET["duree"] > 4 && $_GET["duree"] < 8){ $heureApres4 = $_GET["duree"] - 4; $prixApres4Berline = $heureApres4 * PRIX_HEURE_BERLINE; $prixApres4Luxe = $heureApres4 * PRIX_HEURE_LUXE; $prixApres4Prestige = $heureApres4 * PRIX_HEURE_PRESTIGE; $_SESSION["prix_duree_berline"] = FORFAIT_4_BERLINE + $prixApres4Berline; $_SESSION["prix_duree_luxe"] = FORFAIT_4_LUXE + $prixApres4Luxe; $_SESSION["prix_duree_prestige"] = FORFAIT_4_PRESTIGE + $prixApres4Prestige; $_SESSION["autorise_duree"] = true; }else if($_GET["duree"] == 8){ $_SESSION["prix_duree_berline"] = FORFAIT_8_BERLINE; $_SESSION["prix_duree_luxe"] = FORFAIT_8_LUXE; $_SESSION["prix_duree_prestige"] = FORFAIT_8_PRESTIGE; $_SESSION["autorise_duree"] = true; }else if($_GET["duree"] > 8){ $heureApres8 = $_GET["duree"] - 8; $prixApres4Berline = $heureApres8 * HEURE_SUP_BERLINE; $prixApres4Luxe = $heureApres8 * HEURE_SUP_LUXE; $prixApres4Prestige = $heureApres8 * HEURE_SUP_PRESTIGE; $_SESSION["prix_duree_berline"] = FORFAIT_8_BERLINE + $prixApres4Berline; $_SESSION["prix_duree_luxe"] = FORFAIT_8_LUXE + $prixApres4Luxe; $_SESSION["prix_duree_prestige"] = FORFAIT_8_PRESTIGE + $prixApres4Prestige; $_SESSION["autorise_duree"] = false; } }else{ $_SESSION["autorise_duree"] = false; } $obj = new stdClass(); $obj->voitures = $voitures; $obj->trad = $trad; $obj->numbre_car = count($voitures); $optn = ''; Render::renderer($app, "mise_dispo_duree_etape_1.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/duree/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'mise_dispo_duree'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $_SESSION["car"] = $_GET["car"]; $voitures = $General->getCar($langue_code, $_GET["car"]); if($_SESSION["autorise_duree"] == true){ if($voitures->type == "luxe"){ $_SESSION["prix"] = $_SESSION["prix_duree_luxe"]; }else if($voitures->type == "prestige"){ $_SESSION["prix"] = $_SESSION["prix_duree_prestige"]; }else if($voitures->type == "berline"){ $_SESSION["prix"] = $_SESSION["prix_duree_berline"]; } }else{ $_SESSION["prix"] = null; } if(isset($_SESSION["idUser"])){ $user = $General->getUserById($_SESSION["idUser"]); } $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); if(!isset($returnCheckIdIti->id_itineraire) && empty($returnCheckIdIti->id_itineraire)){ if(isset($_SESSION["idUser"])){ $user_id = $_SESSION["idUser"]; }else{ $user_id = NULL; } $bagage = NULL; $duree = NULL; $etatCourse = 0; $numeroVolTrain = NULL; $distance = NULL; if(isset($_SESSION["prix"])){ $prix = $_SESSION["prix"]; }else{ $prix = NULL; } $returnItineraire = $General->insertItineraire($_SESSION["Adresse"], NULL, $itineraireDate, $prix, $langue_code, $_SESSION["place"], 'dispo_duree', $user_id, $_SESSION["idTransaction"],$bagage,$_SESSION["duree"],$etatCourse,$_SESSION["car"],$numeroVolTrain,$distance,$_SESSION["remarque"]); $idTransactionActif = $_SESSION["idTransaction"]; }else{ $idTransactionActif = $returnCheckIdIti->id_transaction; } $obj = new stdClass(); if(isset($_SESSION["idUser"])){ $obj->user = $user; } $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; $amount = number_format($_SESSION["prix"], 2, '', ' '); $parm="$parm amount=$amount"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $idTransaction = $_SESSION["idTransaction"]; $parm="$parm order_id=$idTransaction"; if(isset($_SESSION["idUser"])){ $customerId = $_SESSION["idUser"]; $parm="$parm customer_id=$customerId"; $userMail = $user->mail; $parm="$parm customer_email=$userMail"; $isLogPaiementAuth = true; }else{ $isLogPaiementAuth = false; } $parm="$parm order_id=$idTransactionActif"; $path_bin = "api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } if (( $code == "" ) && ( $error == "" ) ) { //erreur appel request }else if($code != 0){ //Erreur appel API de paiement }else{ //OK } $obj->adresseLatitude = $_SESSION["adresseLatitude"]; $obj->adresseLongitude = $_SESSION["adresseLongitude"]; $obj->Adresse = $_SESSION["Adresse"]; $obj->place = $_SESSION["place"]; $obj->day = $_SESSION["day"]; $obj->month = $_SESSION["month"]; $obj->year = $_SESSION["year"]; $obj->heure = $_SESSION["heure"]; $obj->min = $_SESSION["min"]; $obj->duree = $_SESSION["duree"]; $obj->prix = $_SESSION["prix"]; $obj->voitures = $voitures; $obj->typeCar = $voitures->libelle; $obj->trad = $trad; $obj->paiementMessage = $message; $obj->isLogPaiementAuth = $isLogPaiementAuth; $obj->autorise_duree = $_SESSION["autorise_duree"]; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "mise_dispo_duree_etape_2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/trajet', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); $voitures = $General->getCars($langue_code); if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $Utils = new Utils(); $_SESSION["idTransaction"] = $Utils->randomMdp(); $_SESSION["type_reserve"] = 'mise_dispo_trajet'; $obj = new stdClass(); $obj->voitures = $voitures; $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "mise_dispo_trajet.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/trajet/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'mise_dispo_trajet'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); $_SESSION["departLat"] = $_GET["adresseDepartLatitude"]; $_SESSION["departLong"] = $_GET["adresseDepartLongitude"]; $_SESSION["departAdresse"] = $_GET["AdresseDepart"]; $_SESSION["arriverLat"] = $_GET["adresseArriverLatitude"]; $_SESSION["arriverLong"] = $_GET["adresseArriverLongitude"]; $_SESSION["arriverAdresse"] = $_GET["AdresseArriver"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["remarque"] = $_GET["remarque"]; function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } do { $params = array( 'origin' => $_SESSION["departAdresse"], 'destination' => $_SESSION["arriverAdresse"], 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $_SESSION["distance"] = $directions->routes[0]->legs[0]->distance->text; do { //DISTANCE DEPART CENTRE PARIS $params = array( 'origin' => $_SESSION["departAdresse"], 'destination' => 'Parvis Notre-Dame - Pl. Jean-Paul II, 75004 Paris, France', 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $distanceParisDepart = $directions->routes[0]->legs[0]->distance->text; do { //DISTANCE DEPART CENTRE PARIS $params = array( 'origin' => $_SESSION["arriverAdresse"], 'destination' => 'Parvis Notre-Dame - Pl. Jean-Paul II, 75004 Paris, France', 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $distanceParisArriver = $directions->routes[0]->legs[0]->distance->text; //CHECK SI KILOMETRAGE > x7 $lastNumber = substr($_SESSION["distance"], -1); if($lastNumber > 6){ $_SESSION["distance"] = ceil($_SESSION["distance"]); } $_SESSION["pvk_berline"] = round(($_SESSION["distance"]*PVK_BERLINE) + (($_SESSION["distance"]/2)*PVK_BERLINE) + 2); $_SESSION["pvk_luxe"] = round(($_SESSION["distance"]*PVK_LUXE) + (($_SESSION["distance"]/2)*PVK_LUXE) + 2); $_SESSION["pvk_prestige"] = round(($_SESSION["distance"]*PVK_PRESTIGE) + (($_SESSION["distance"]/2)*PVK_PRESTIGE) +2); $obj = new stdClass(); $obj->adresseDepartLatitude = $_GET["adresseDepartLatitude"]; $obj->adresseDepartLongitude = $_GET["adresseDepartLongitude"]; $obj->AdresseDepart = $_GET["AdresseDepart"]; $obj->adresseArriverLatitude = $_GET["adresseArriverLatitude"]; $obj->adresseArriverLongitude = $_GET["adresseArriverLongitude"]; $obj->AdresseArriver = $_GET["AdresseArriver"]; $obj->place = $_GET["place"]; $obj->day = $_GET["day"]; $obj->month = $_GET["month"]; $obj->year = $_GET["year"]; $obj->heure = $_GET["heure"]; $obj->min = $_GET["min"]; $obj->trad = $trad; $optn = ''; Render::renderer($app, "mise_dispo_trajet_etape_2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/trajet/etape_3', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'mise_dispo_trajet'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $voitures = $General->getCars($langue_code); $obj = new stdClass(); $obj->voitures = $voitures; $obj->trad = $trad; $obj->numbre_car = count($voitures); $optn = ''; Render::renderer($app, "mise_dispo_trajet_etape_3.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/mise_disposition/trajet/etape_4', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'mise_dispo_trajet'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $_SESSION["car"] = $_GET["car"]; $voitures = $General->getCar($langue_code, $_GET["car"]); if($voitures->type == "luxe"){ $_SESSION["prix"] = $_SESSION["pvk_luxe"]; $_SESSION["type_car"] = $voitures->type; }else if($voitures->type == "prestige"){ $_SESSION["prix"] = $_SESSION["pvk_prestige"]; $_SESSION["type_car"] = $voitures->type; }else if($voitures->type == "berline"){ $_SESSION["prix"] = $_SESSION["pvk_berline"]; $_SESSION["type_car"] = $voitures->type; } $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); if(!isset($returnCheckIdIti->id_itineraire) && empty($returnCheckIdIti->id_itineraire)){ if(isset($_SESSION["idUser"])){ $user_id = $_SESSION["idUser"]; }else{ $user_id = NULL; } $bagage = NULL; $duree = NULL; $etatCourse = 0; $numeroVolTrain = NULL; $distance = floatval($_SESSION["distance"]); $return = $General->insertItineraire($_SESSION["departAdresse"], $_SESSION["arriverAdresse"], $itineraireDate, $_SESSION["prix"], $langue_code, $_SESSION["place"], 'dispo_trajet', $user_id, $_SESSION["idTransaction"],$bagage,$duree,$etatCourse,$_SESSION["car"],$numeroVolTrain,$distance,$_SESSION["remarque"]); $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); $idTransactionActif = $_SESSION["idTransaction"]; }else{ $idTransactionActif = $returnCheckIdIti->id_transaction; } if(isset($_SESSION["idUser"])){ $checkFide = $General->checkFideUser($_SESSION["idUser"], $_SESSION["idTransaction"]); foreach($checkFide as $checkFideUser){ if($checkFideUser->is_reduction == 1){ $General->updatePrixFide($checkFideUser->id_transaction); $General->UpdateUserRegainFide($checkFideUser->id_user); } } $user = $General->getUserById($_SESSION["idUser"]); } $obj = new stdClass(); $obj->voitures = $voitures; if(isset($_SESSION["idUser"])){ $obj->user = $user; } $isReduction = false; if(isset($user) && $user->point_fidelisation >= 30){ $isReduction = true; }else if($returnCheckIdIti->is_reduction == true){ $isReduction = true; } $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; //$amount = number_format($_SESSION["prix"], 2, '', ' '); $amount = number_format($returnCheckIdIti->prix, 2, '', ' '); $parm="$parm amount=$amount"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $idTransaction = $_SESSION["idTransaction"]; $parm="$parm order_id=$idTransaction"; if(isset($_SESSION["idUser"])){ $customerId = $_SESSION["idUser"]; $parm="$parm customer_id=$customerId"; $userMail = $user->mail; $parm="$parm customer_email=$userMail"; $isLogPaiementAuth = true; }else{ $isLogPaiementAuth = false; } $parm="$parm order_id=$idTransactionActif"; $path_bin = "/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } if (( $code == "" ) && ( $error == "" ) ) { //erreur appel request }else if($code != 0){ //Erreur appel API de paiement }else{ //OK } $obj->departAdresse = $_SESSION["departAdresse"]; $obj->arriverAdresse = $_SESSION["arriverAdresse"]; $obj->place = $_SESSION["place"]; $obj->day = $_SESSION["day"]; $obj->month = $_SESSION["month"]; $obj->year = $_SESSION["year"]; $obj->heure = $_SESSION["heure"]; $obj->min = $_SESSION["min"]; $obj->distance = $_SESSION["distance"]; $obj->prix = $returnCheckIdIti->prix; $obj->idTransaction = $_SESSION["idTransaction"]; $obj->trad = $trad; $obj->paiementMessage = $message; $obj->isLogPaiementAuth = $isLogPaiementAuth; $obj->isReduction = $isReduction; $obj->alreadyReduc = $returnCheckIdIti->is_reduction; $optn = ''; Render::renderer($app, "mise_dispo_trajet_etape_4.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/who/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 1); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->title = $contentPage->title; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "who.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/nos-vehicules/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); $voitures = $General->getCars($langue_code); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->voitures = $voitures; $obj->content = $contentPage; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "nos-vehicule.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/location/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "location.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/cgv/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 2); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "cgv.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/mentions/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 3); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "mentions.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/points/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 4); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $optn = ''; Render::renderer($app, "points.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/moncompte/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; if(empty($_SESSION["isLog"]) || !isset($_SESSION["isLog"])){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); }else{ $app->redirect('moncompte/infos'); } }); $app->get('/:langue/deconexion/', function ($langue) use ($app){ session_destroy(); $_SESSION["langue"] = $langue; $app->redirect('/'.PATH_PROJET.$langue.'/home'); }); $app->get('/:langue/moncompte/infos', function ($langue) use ($app){ $_SESSION["langue"] = $langue; if(isset($_SESSION["isLog"])){ $General = new General(); $userInfo = $General->getUserById($_SESSION["idUser"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->user = $userInfo; $obj->trad = $trad; $optn = ''; Render::renderer($app, "moncompte.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->get('/:langue/moncompte/facturation', function ($langue) use ($app){ $_SESSION["langue"] = $langue; if(isset($_SESSION["isLog"])){ $General = new General(); $userInfo = $General->getUserById($_SESSION["idUser"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->user = $userInfo; $obj->trad = $trad; $optn = ''; Render::renderer($app, "facturation.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->get('/:langue/moncompte/historique', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(isset($_SESSION["isLog"])){ $userInfo = $General->getUserById($_SESSION["idUser"]); $userTransaction = $General->getUserTransaction($_SESSION["idUser"],$langue_code); echo '
';
        print_r($userTransaction);
        echo '
'; foreach($userTransaction as $transaction){ if($transaction->type_trajet == "excursion"){ $getExcursion = $General->getExcursionsById($langue_code,$transaction->adresse_arrivee); $transaction->message = 'Excursion pour : ' . $getExcursion->title; }else if($transaction->type_trajet == "dispo_duree"){ $transaction->message = 'Pour une durée de '.$transaction->duree.' heures'; }else{ $transaction->message = $transaction->adresse_arrivee; } } $obj = new stdClass(); $obj->user = $userInfo; $obj->transaction = $userTransaction; $obj->trad = $trad; $optn = ''; Render::renderer($app, "historique.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->post('/:langue/moncompte/historique', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(isset($_SESSION["isLog"])){ $userInfo = $General->getUserById($_SESSION["idUser"]); $userTransaction = $General->getUserTransaction($_SESSION["idUser"],$langue_code); foreach($userTransaction as $transaction){ if($transaction->type_trajet == "excursion"){ $getExcursion = $General->getExcursionsById($langue_code,$transaction->adresse_arrivee); $transaction->message = 'Excursion pour : ' . $getExcursion->title; }else if($transaction->type_trajet == "dispo_duree"){ $transaction->message = 'Pour une durée de '.$transaction->duree.' heures'; }else{ $transaction->message = $transaction->adresse_arrivee; } } if(isset($_POST["downloadFacture"])){ global $commandes; $commandes = $General->detailItineraire($_POST["downloadFacture"]); if($commandes->type_trajet == 'excursion'){ $commandes = $General->detailItineraireFacture($_POST["downloadFacture"],$_SESSION["langue"]); } if(isset($commandes) && !empty($commandes)){ ob_start(); class PDF extends FPDF { function Header(){ global $commandes; $this->SetFont('Arial','B',17); // Titre $this->Ln(10); $this->Cell(40,5,'Drive U Safe',0,1,'L'); $this->Ln(5); $this->SetFont('Arial','B',10); $this->Cell(40,5,utf8_decode('Facture en euro n°'.$commandes->id_itineraire),0,1,'L'); $this->Cell(40,5,utf8_decode(date("Y/m/d", strtotime($commandes->dateTrajet))),0,1,'L'); $this->Ln(15); $this->SetFont('Arial','B',8); $this->Cell(40,4,utf8_decode('SAS Drive U Safe'),0,1,'L'); $this->SetFont('Arial','',8); $this->Cell(40,4,utf8_decode('15, rue de l\'esturgeon'),0,1,'L'); $this->Cell(40,4,utf8_decode('67000 Strasbourg'),0,1,'L'); $this->Cell(40,4,utf8_decode('www.drive-u-safe.com'),0,1,'L'); $this->Cell(40,4,utf8_decode('Email : contact@drive-u-safe.com'),0,1,'L'); $this->Cell(40,4,utf8_decode('SIREN : '.SIREN.''),0,1,'L'); //$this->Cell(40,4,utf8_decode('Code APE : XXXXX'),0,1,'L'); $this->Cell(40,4,utf8_decode('N°TVA intracommunautaire : '.TVA.''),0,1,'L'); $this->Ln(5); $this->SetFont('Arial','B',8); $this->Cell(0,4,utf8_decode($commandes->prenom . ' ' .$commandes->nom),0,1,'R'); if(isset($commandes->adresse) && !empty($commandes->adresse)){ $this->Cell(0,4,utf8_decode($commandes->adresse . ' ' .$commandes->code_postal . ' ' . $commandes->ville),0,1,'R'); } $this->Cell(0,4,utf8_decode($commandes->mail),0,1,'R'); $this->Ln(15); if($commandes->type_trajet == 'excursion'): $this->Cell(0,4,utf8_decode('Prestation:'.$commandes->adresse_depart .' à '.$commandes->title),0,1,'L'); else: $this->Cell(0,4,utf8_decode('Prestation:'.$commandes->adresse_depart .' à '.$commandes->adresse_arrivee),0,1,'L'); endif; // Saut de ligne $this->Image(IMG_DIR.'logo_dsp.jpg',170,10,30); $this->Ln(0); // Police Arial gras 15 } function Footer(){ // Positionnement à 1,5 cm du bas $this->SetY(-15); // Police Arial italique 8 $this->SetFont('Arial','I',8); // Numéro de page $this->Cell(0,10,'Drive U Safe - Page '.$this->PageNo().'/{nb}',0,0,'C'); } function BasicTable($header, $data,$footer,$obj2){ // En-tête foreach($header as $col){ if($col == 'Objet'){ $this->SetFillColor('105','105','105'); $this->Cell(105,7,utf8_decode($col),0,0,'C','true'); }else{ $this->SetFillColor('105','105','105'); $this->Cell(30,7,utf8_decode($col),0,0,'C','true'); } } $this->Ln(); // Données for($i = 0 ; $i < count($data); $i++){ for($j = 0 ; $j < count($data[$i]); $j++){ if($j == 0){ $this->Cell(105,6,utf8_decode($data[$i][$j]),0); }else{ $this->Cell(30,6,utf8_decode($data[$i][$j]),0,0,'C'); } } $this->Ln(); } for($g = 0 ; $g < count($footer); $g++){ $this->Cell(105,8); if($g == 1){ $this->Cell(60,8,utf8_decode($footer[$g]),0,0,'C'); $this->Cell(30,8,utf8_decode($obj2[$g]),0,0,'C'); }else{ $this->Cell(60,8,utf8_decode($footer[$g]),0,0,'C','true'); $this->Cell(30,8,utf8_decode($obj2[$g]),0,0,'C','true'); } $this->Ln(); } } } // Instanciation de la classe dérivée $header = array("Objet","Nbr Passagers","P.U.H.T","Montant H.T"); $data = array(); if($commandes->type_trajet == 'privée'){ $type_trajet = 'Navette privée'; }else if($commandes->type_trajet == 'partagée'){ $type_trajet = 'Navette partagée'; }else if($commandes->type_trajet == 'dispo_duree'){ $type_trajet = 'Mise à disposition par durée'; }else if($commandes->type_trajet == 'excursion'){ $type_trajet = 'Excursion touristique'; }else if($commandes->type_trajet == 'dispo_trajet'){ $type_trajet = 'Mise à disposition par trajet'; } $euro = ' euros'; $obj1 = array($type_trajet, $commandes->passagers,($commandes->prix-(($commandes->prix*20)/100)).$euro,($commandes->prix-(($commandes->prix*20)/100))); $obj2 = array(($commandes->prix-(($commandes->prix*20)/100)), (($commandes->prix*20)/100).$euro,($commandes->prix).$euro); $footer = array('TOTAL H.T','MONTANT TVA (20%)','TOTAL T.T.C'); array_push($data,$obj1); $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->Ln(5); //$pdf->Header($commandes); $pdf->SetLineWidth(10); $pdf->BasicTable($header,$data,$footer,$obj2); $pdf->Output('facture.pdf','D'); ob_end_flush(); } } $obj = new stdClass(); $obj->user = $userInfo; $obj->transaction = $userTransaction; $obj->trad = $trad; $optn = ''; Render::renderer($app, "historique.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->get('/:langue/moncompte/moncompte-edit/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; if(isset($_SESSION["isLog"])){ $General = new General(); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $userInfo = $General->getUserById($_SESSION["idUser"]); $obj = new stdClass(); $obj->user = $userInfo; $obj->trad = $trad; $optn = ''; Render::renderer($app, "moncompte-edit.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->get('/:langue/moncompte/facturation-edit/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; if(isset($_SESSION["isLog"])){ $General = new General(); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $userInfo = $General->getUserById($_SESSION["idUser"]); $obj = new stdClass(); $obj->user = $userInfo; $obj->trad = $trad; $optn = ''; Render::renderer($app, "facturation-edit.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }else{ $app->redirect('home'); } }); $app->get('/:langue/reserver/navette_prive/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 6); if(empty($contentPage)){ $contentPage = $General->getPageContent(2, 6); } global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->title = $contentPage->title; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_prive.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 7); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->content = $contentPage->content; $obj->title = $contentPage->title; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_partagee.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_prive/etape_1', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 2); if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $Utils = new Utils(); $_SESSION["idTransaction"] = $Utils->randomMdp(); $_SESSION["type_reserve"] = 'navette_prive'; $tarifs = file_get_contents('tarifs.json'); $tarifs = json_decode($tarifs); $navettes = file_get_contents('navette_'.$langue.'.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; $lieu = $navette->destination[2]->lieu; $paris = $navette->departs[0]->paris; $essonne = $navette->departs[0]->essonne; $haut_de_seine = $navette->departs[0]->haut_de_seine; $seine_saint_denis = $navette->departs[0]->seine_saint_denis; $val_de_marne = $navette->departs[0]->val_de_marne; $seine_et_marne = $navette->departs[0]->seine_et_marne; $yvelines = $navette->departs[0]->yvelines; $obj = new stdClass(); $obj->content = $contentPage->content; $obj->aeroports = $aeroports; $obj->gares = $gares; $obj->lieux = $lieu; $obj->paris = $paris; $obj->essonne = $essonne; $obj->haut_de_seine = $haut_de_seine; $obj->seine_saint_denis = $seine_saint_denis; $obj->val_de_marne = $val_de_marne; $obj->seine_et_marne = $seine_et_marne; $obj->yvelines = $yvelines; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_prive_etape1.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->post('/getHoraireNavettePartagee',function() use ($app){ $tarifs = file_get_contents('tarifs.json'); $tarifs = json_decode($tarifs); $navettes = file_get_contents('navette.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_POST["lieu"]){ $destination = $aeroport->destination; } } foreach($gares as $gare){ if($gare->id_gares == $_POST["lieu"]){ $destination = $gare->destination; } } $navettePartagee = file_get_contents('navette_partagee.json'); $navettePartagee = json_decode($navettePartagee); foreach($navettePartagee->trajets as $trajets){ if($trajets->lieu[0]->name == $destination){ $horaires = explode(",", $trajets->lieu[0]->horaires); } } $json['result'] = true; $json['horaires'] = $horaires; echo json_encode($json); }); $app->get('/:langue/reserver/navette_partagee/etape_1', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getPageContent($langue_code, 2); if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $Utils = new Utils(); $_SESSION["idTransaction"] = $Utils->randomMdp(); $_SESSION["type_reserve"] = 'navette_partage'; $navettePartagee = file_get_contents('navette_partagee.json'); $navettePartagee = json_decode($navettePartagee); $navettes = file_get_contents('navette.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; $lieu = $navette->destination[2]->lieu; $paris = $navette->departs[0]->paris; $essonne = $navette->departs[0]->essonne; $haut_de_seine = $navette->departs[0]->haut_de_seine; $seine_saint_denis = $navette->departs[0]->seine_saint_denis; $val_de_marne = $navette->departs[0]->val_de_marne; $seine_et_marne = $navette->departs[0]->seine_et_marne; $yvelines = $navette->departs[0]->yvelines; $obj = new stdClass(); $obj->content = $contentPage->content; $obj->aeroports = $aeroports; $obj->gares = $gares; $obj->lieux = $lieu; $obj->paris = $paris; $obj->essonne = $essonne; $obj->haut_de_seine = $haut_de_seine; $obj->seine_saint_denis = $seine_saint_denis; $obj->val_de_marne = $val_de_marne; $obj->seine_et_marne = $seine_et_marne; $obj->yvelines = $yvelines; $obj->navettePartagee = $navettePartagee; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_partagee_etape1.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_prive/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_prive'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $contentPage = $General->getPageContent($langue_code, 2); $navettes = file_get_contents('navette.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; $lieux = $navette->destination[2]->lieu; if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); if(isset($_GET["type"]) && $_GET["type"] == 'lieuTolieu'){ $_SESSION["idPlaceDepart"] = $_GET["idPlaceDepart"]; $_SESSION["idPlaceArriver"] = $_GET["idPlaceArriver"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["numeroVolTrain"] = $_GET["numeroVolTrain"]; $_SESSION["bagages"] = $_GET["bagages"]; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_SESSION["idPlaceDepart"]){ $depart = $aeroport->destination; $_SESSION["DepartLatitude"] = $aeroport->latitude; $_SESSION["DepartLongitude"] = $aeroport->longitude; } if($aeroport->id_aeroports == $_SESSION["idPlaceArriver"]){ $arriver = $aeroport->destination; $_SESSION["ArriverLatitude"] = $aeroport->latitude; $_SESSION["ArriverLongitude"] = $aeroport->longitude; } } foreach($gares as $gare){ if($gare->id_gares == $_SESSION["idPlaceDepart"]){ $depart = $gare->map; $_SESSION["DepartLatitude"] = $gare->latitude; $_SESSION["DepartLongitude"] = $gare->longitude; } if($gare->id_gares == $_SESSION["idPlaceArriver"]){ $arriver = $gare->map; $_SESSION["ArriverLatitude"] = $gare->latitude; $_SESSION["ArriverLongitude"] = $gare->longitude; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_SESSION["idPlaceDepart"]){ $depart = $lieu->destination; $_SESSION["DepartLatitude"] = $lieu->latitude; $_SESSION["DepartLongitude"] = $lieu->longitude; } if($lieu->id_lieu == $_SESSION["idPlaceArriver"]){ $arriver = $lieu->destination; $_SESSION["ArriverLatitude"] = $lieu->latitude; $_SESSION["ArriverLongitude"] = $lieu->longitude; } } }else{ if(isset($_GET["idPlaceDepart"])){ $_SESSION["idPlaceDepart"] = $_GET["idPlaceDepart"]; $_SESSION["ArriverLatitude"] = $_GET["adresseLatitude"]; $_SESSION["ArriverLongitude"] = $_GET["adresseLongitude"]; $arriver = $_GET["Adresse"]; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_GET["idPlaceDepart"]){ $depart = $aeroport->destination; $_SESSION["DepartLatitude"] = $aeroport->latitude; $_SESSION["DepartLongitude"] = $aeroport->longitude; } } foreach($gares as $gare){ if($gare->id_gares == $_GET["idPlaceDepart"]){ $depart = $gare->map; $_SESSION["DepartLatitude"] = $gare->latitude; $_SESSION["DepartLongitude"] = $gare->longitude; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_GET["idPlaceDepart"]){ $depart = $lieu->destination; $_SESSION["DepartLatitude"] = $lieu->latitude; $_SESSION["DepartLongitude"] = $lieu->longitude; } } }else{ $_SESSION["idPlaceArriver"] = $_GET["idPlaceArriver"]; $_SESSION["DepartLatitude"] = $_GET["adresseLatitude"]; $_SESSION["DepartLongitude"] = $_GET["adresseLongitude"]; $depart = $_GET["Adresse"]; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_GET["idPlaceArriver"]){ $arriver = $aeroport->destination; $_SESSION["ArriverLatitude"] = $aeroport->latitude; $_SESSION["ArriverLongitude"] = $aeroport->longitude; } } foreach($gares as $gare){ if($gare->id_gares == $_GET["idPlaceArriver"]){ $arriver = $gare->map; $_SESSION["ArriverLatitude"] = $gare->latitude; $_SESSION["ArriverLongitude"] = $gare->longitude; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_GET["idPlaceArriver"]){ $arriver = $lieu->destination; $_SESSION["ArriverLatitude"] = $lieu->latitude; $_SESSION["ArriverLongitude"] = $lieu->longitude; } } } $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["type"] = 'prive'; $_SESSION["numeroVolTrain"] = $_GET["numeroVolTrain"]; $_SESSION["bagages"] = $_GET["bagages"]; } $_SESSION["depart"] = $depart; $_SESSION["arriver"] = $arriver; function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } do { $params = array( 'origin' => $depart, 'destination' => $arriver, 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $_SESSION["distance"] = $directions->routes[0]->legs[0]->distance->text; //CHECK SI KILOMETRAGE > x7 $lastNumber = substr($_SESSION["distance"], -1); if($lastNumber > 6){ $_SESSION["distance"] = ceil($_SESSION["distance"]); } $_SESSION["pvk_berline"] = round(($_SESSION["distance"]*PVK_BERLINE) + (($_SESSION["distance"]/2)*PVK_BERLINE) + 2); $_SESSION["pvk_luxe"] = round(($_SESSION["distance"]*PVK_LUXE) + (($_SESSION["distance"]/2)*PVK_LUXE) + 2); $_SESSION["pvk_prestige"] = round(($_SESSION["distance"]*PVK_PRESTIGE) + (($_SESSION["distance"]/2)*PVK_PRESTIGE) + 2); //PRIX FIXE CHARLE DE GAULE if(isset($_SESSION["idPlaceDepart"]) && $_SESSION["idPlaceDepart"] == 0 || isset($_SESSION["idPlaceArriver"]) && $_SESSION["idPlaceArriver"] == 0){ if($_SESSION["pvk_berline"] < 40){ $_SESSION["pvk_luxe"] = $_SESSION["pvk_luxe"] - $_SESSION["pvk_berline"] + 40; $_SESSION["pvk_prestige"] = $_SESSION["pvk_prestige"] - $_SESSION["pvk_berline"] + 40; $_SESSION["pvk_berline"] = 40; } }else if(isset($_SESSION["idPlaceDepart"]) && $_SESSION["idPlaceDepart"] == 1 || isset($_SESSION["idPlaceArriver"]) && $_SESSION["idPlaceArriver"] == 1){ if($_SESSION["pvk_berline"] < 35){ $_SESSION["pvk_luxe"] = $_SESSION["pvk_luxe"] - $_SESSION["pvk_berline"] + 35; $_SESSION["pvk_prestige"] = $_SESSION["pvk_prestige"] - $_SESSION["pvk_berline"] + 35; $_SESSION["pvk_berline"] = 35; } }else if(isset($_SESSION["idPlaceDepart"]) && $_SESSION["idPlaceDepart"] == 2 || isset($_SESSION["idPlaceArriver"]) && $_SESSION["idPlaceArriver"] == 2){ if($_SESSION["pvk_berline"] < 30){ $_SESSION["pvk_luxe"] = $_SESSION["pvk_luxe"] - $_SESSION["pvk_berline"] + 30; $_SESSION["pvk_prestige"] = $_SESSION["pvk_prestige"] - $_SESSION["pvk_berline"] + 30; $_SESSION["pvk_berline"] = 30; } } if(isset($_GET["type"]) && $_GET["type"] == 'lieuTolieu'){ $_SESSION["autorise_course"] = true; }else{ if(isset($_GET["idPlaceArriver"])){ $depart = $depart; $arriver = 'Parvis Notre-Dame - Pl. Jean-Paul II, 75004 Paris, France'; }else{ $depart = 'Parvis Notre-Dame - Pl. Jean-Paul II, 75004 Paris, France'; $arriver = $arriver; } do { $params = array( 'origin' => $depart, 'destination' => $arriver, 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $_SESSION["distance_centre_paris"] = $directions->routes[0]->legs[0]->distance->text; if($_SESSION["distance_centre_paris"] > MAX_KLM ){ //ON PREND PAS LA COURSE $_SESSION["autorise_course"] = false; }else{ //ON PREND LA COURSE $_SESSION["autorise_course"] = true; } } $_SESSION["remarque"] = $_GET["remarque"]; $obj = new stdClass(); $obj->content = $contentPage->content; $obj->ArriverLatitude = $_SESSION["ArriverLatitude"]; $obj->ArriverLongitude = $_SESSION["ArriverLongitude"]; $obj->DepartLatitude = $_SESSION["DepartLatitude"]; $obj->DepartLongitude = $_SESSION["DepartLongitude"]; $obj->place = $_GET["place"]; $obj->day = $_GET["day"]; $obj->month = $_GET["month"]; $obj->year = $_GET["year"]; $obj->heure = $_GET["heure"]; $obj->min = $_GET["min"]; $obj->trad = $trad; if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"]) && !isset($_SESSION["prixLuxe"]) && empty($_SESSION["prixLuxe"])&& !isset($_SESSION["prixStandard"]) && empty($_SESSION["prixStandard"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_prive/etape_1'); } $optn = ''; Render::renderer($app, "navette_prive_etape2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_partage'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $contentPage = $General->getPageContent($langue_code, 2); $navettes = file_get_contents('navette.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; $lieux = $navette->destination[2]->lieu; if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == 1){ unset($_SESSION['idUser']); } if(!isset($_SESSION["idUser"])){ unset($_SESSION["isLog"]); } unset($_SESSION['idPlaceDepart']); unset($_SESSION['idPlaceArriver']); unset($_SESSION["place"]); unset($_SESSION["day"]); unset($_SESSION["month"]); unset($_SESSION["year"]); unset($_SESSION["heure"]); unset($_SESSION["min"]); unset($_SESSION["numeroVolTrain"]); unset($_SESSION["bagages"]); unset($_SESSION["DepartLatitude"]); unset($_SESSION["DepartLongitude"]); unset($_SESSION["ArriverLatitude"]); unset($_SESSION["ArriverLongitude"]); unset($_SESSION["depart"]); unset($_SESSION["arriver"]); unset($_SESSION["remarque"]); unset($_SESSION["adresseLatitude"]); unset($_SESSION["adresseLongitude"]); unset($_SESSION["Adresse"]); unset($_SESSION["isTemp"]); unset($_SESSION["temp"]); unset($_SESSION["car"]); unset($_SESSION["distance"]); unset($_SESSION["excursion"]); unset($_SESSION["excursion_id"]); unset($_SESSION["prix"]); unset($_SESSION["pvk_berline"]); unset($_SESSION["pvk_luxe"]); unset($_SESSION["pvk_prestige"]); unset($_SESSION["autorise_course"]); unset($_SESSION["typeLieuDepart"]); unset($_SESSION["typeLieuArriver"]); unset($_SESSION["prix_partage"]); unset($_SESSION["checked"]); $codePostal = substr($_GET["codePostal"], 0, 2); if(isset($_GET["type"]) && $_GET["type"] == 'lieuTolieu'){ //LIEU JUSQU'A LIEU $_SESSION["idPlaceDepart"] = $_GET["idPlaceDepart"]; $_SESSION["idPlaceArriver"] = $_GET["idPlaceArriver"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["numeroVolTrain"] = $_GET["numeroVolTrain"]; $_SESSION["bagages"] = $_GET["bagages"]; $_SESSION["typeLieuDepart"] = null; $_SESSION["typeLieuArriver"]= null; $_SESSION["prix_partage"] = null; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_SESSION["idPlaceDepart"]){ $depart = $aeroport->destination; $_SESSION["DepartLatitude"] = $aeroport->latitude; $_SESSION["DepartLongitude"] = $aeroport->longitude; $_SESSION["typeLieuDepart"] = 'aero'; } if($aeroport->id_aeroports == $_SESSION["idPlaceArriver"]){ $arriver = $aeroport->destination; $_SESSION["ArriverLatitude"] = $aeroport->latitude; $_SESSION["ArriverLongitude"] = $aeroport->longitude; $_SESSION["typeLieuArriver"] = 'aero'; } } foreach($gares as $gare){ if($gare->id_gares == $_SESSION["idPlaceDepart"]){ $depart = $gare->destination; $_SESSION["DepartLatitude"] = $gare->latitude; $_SESSION["DepartLongitude"] = $gare->longitude; $_SESSION["typeLieuDepart"] = 'gare'; } if($gare->id_gares == $_SESSION["idPlaceArriver"]){ $arriver = $gare->destination; $_SESSION["ArriverLatitude"] = $gare->latitude; $_SESSION["ArriverLongitude"] = $gare->longitude; $_SESSION["typeLieuArriver"] = 'gare'; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_SESSION["idPlaceDepart"]){ $depart = $lieu->destination; $_SESSION["DepartLatitude"] = $lieu->latitude; $_SESSION["DepartLongitude"] = $lieu->longitude; $_SESSION["typeLieuDepart"] = 'lieu'; } if($lieu->id_lieu == $_SESSION["idPlaceArriver"]){ $arriver = $lieu->destination; $_SESSION["ArriverLatitude"] = $lieu->latitude; $_SESSION["ArriverLongitude"] = $lieu->longitude; $_SESSION["typeLieuArriver"] = 'lieu'; } } if($_SESSION["typeLieuArriver"] == 'aero' && $_SESSION["typeLieuDepart"] == 'aero'){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; }else if($_SESSION["typeLieuArriver"] == 'gare' && $_SESSION["typeLieuDepart"] == 'gare'){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 15; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 12; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else{ if(isset($_GET["idPlaceDepart"])){ //LIEU == ADRESSE $_SESSION["idPlaceDepart"] = $_GET["idPlaceDepart"]; $_SESSION["ArriverLatitude"] = $_GET["adresseLatitude"]; $_SESSION["ArriverLongitude"] = $_GET["adresseLongitude"]; $arriver = $_GET["Adresse"]; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_GET["idPlaceDepart"]){ $depart = $aeroport->destination; $_SESSION["DepartLatitude"] = $aeroport->latitude; $_SESSION["DepartLongitude"] = $aeroport->longitude; $_SESSION["typeLieuDepart"] = 'aero'; } } foreach($gares as $gare){ if($gare->id_gares == $_GET["idPlaceDepart"]){ $depart = $gare->destination; $_SESSION["DepartLatitude"] = $gare->latitude; $_SESSION["DepartLongitude"] = $gare->longitude; $_SESSION["typeLieuDepart"] = 'gare'; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_GET["idPlaceDepart"]){ $depart = $lieu->destination; $_SESSION["DepartLatitude"] = $lieu->latitude; $_SESSION["DepartLongitude"] = $lieu->longitude; $_SESSION["typeLieuDepart"] = 'lieu'; } } if($_SESSION["typeLieuDepart"] == 'aero'){ if($_SESSION["idPlaceDepart"] == 0){ //CDG if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceDepart"] == 1){ //BOURGET if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceDepart"] == 2){ //ORLY if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceDepart"] == 3){ //BEAUVAIS } }else if($_SESSION["typeLieuDepart"] == 'gare'){ if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["typeLieuDepart"] == 'lieu'){ } }else{ //ADRESSE == LIEU $_SESSION["idPlaceArriver"] = $_GET["idPlaceArriver"]; $_SESSION["DepartLatitude"] = $_GET["adresseLatitude"]; $_SESSION["DepartLongitude"] = $_GET["adresseLongitude"]; $depart = $_GET["Adresse"]; foreach($aeroports as $aeroport){ if($aeroport->id_aeroports == $_GET["idPlaceArriver"]){ $arriver = $aeroport->destination; $_SESSION["ArriverLatitude"] = $aeroport->latitude; $_SESSION["ArriverLongitude"] = $aeroport->longitude; $_SESSION["typeLieuArriver"] = 'aero'; } } foreach($gares as $gare){ if($gare->id_gares == $_GET["idPlaceArriver"]){ $arriver = $gare->destination; $_SESSION["ArriverLatitude"] = $gare->latitude; $_SESSION["ArriverLongitude"] = $gare->longitude; $_SESSION["typeLieuArriver"] = 'gare'; } } foreach($lieux as $lieu){ if($lieu->id_lieu == $_GET["idPlaceArriver"]){ $arriver = $lieu->destination; $_SESSION["ArriverLatitude"] = $lieu->latitude; $_SESSION["ArriverLongitude"] = $lieu->longitude; $_SESSION["typeLieuArriver"] = 'lieu'; } } if($_SESSION["typeLieuArriver"] == 'aero'){ if($_SESSION["idPlaceArriver"] == 0){ //CDG if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceArriver"] == 1){ //BOURGET if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceArriver"] == 2){ //ORLY if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["idPlaceArriver"] == 3){ //BEAUVAIS } }else if($_SESSION["typeLieuArriver"] == 'gare'){ if($codePostal == 75 || $codePostal == 92 || $codePostal == 93 || $codePostal == 94 || $codePostal == 95){ if($_GET["place"] < 3){ $_SESSION["prix_partage"] = 25; }else if($_GET["place"] > 2 && $_GET["place"] < 5){ $_SESSION["prix_partage"] = 20; }else if($_GET["place"] > 4){ $_SESSION["prix_partage"] = 15; } $_SESSION["prix_partage"] = $_SESSION["prix_partage"] * $_GET["place"]; } }else if($_SESSION["typeLieuArriver"] == 'lieu'){ } } $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["type"] = 'partagee'; $_SESSION["numeroVolTrain"] = $_GET["numeroVolTrain"]; $_SESSION["bagages"] = $_GET["bagages"]; } $_SESSION["depart"] = $depart; $_SESSION["arriver"] = $arriver; $_SESSION["remarque"] = $_GET["remarque"]; $obj = new stdClass(); $obj->ArriverLatitude = $_SESSION["ArriverLatitude"]; $obj->ArriverLongitude = $_SESSION["ArriverLongitude"]; $obj->DepartLatitude = $_SESSION["DepartLatitude"]; $obj->DepartLongitude = $_SESSION["DepartLongitude"]; $obj->place = $_GET["place"]; $obj->day = $_GET["day"]; $obj->month = $_GET["month"]; $obj->year = $_GET["year"]; $obj->heure = $_GET["heure"]; $obj->min = $_GET["min"]; $obj->trad = $trad; if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"]) && !isset($_SESSION["prixLuxe"]) && empty($_SESSION["prixLuxe"])&& !isset($_SESSION["prixStandard"]) && empty($_SESSION["prixStandard"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_prive/etape_1'); } $optn = ''; Render::renderer($app, "navette_partagee_etape2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_prive/etape_3', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_prive'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $voitures = $General->getCarsFiltre($langue_code,$_SESSION["bagages"],$_SESSION["place"]); $obj = new stdClass(); $obj->voitures = $voitures; $obj->numbre_car = count($voitures); $obj->trad = $trad; $optn = ''; if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"]) && !isset($_SESSION["prixLuxe"]) && empty($_SESSION["prixLuxe"])&& !isset($_SESSION["prixStandard"]) && empty($_SESSION["prixStandard"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_prive/etape_1'); } Render::renderer($app, "navette_prive_etape3.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/etape_3', function ($langue) use ($app){ if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_partage'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $voitures = $General->getCars($langue_code); global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->voitures = $voitures; $obj->trad = $trad; $optn = ''; if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"]) && !isset($_SESSION["prixLuxe"]) && empty($_SESSION["prixLuxe"])&& !isset($_SESSION["prixStandard"]) && empty($_SESSION["prixStandard"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_partagee/etape_1'); } Render::renderer($app, "navette_partagee_etape3.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_prive/etape_4', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_prive'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $_SESSION["car"] = $_GET["car"]; $voitures = $General->getCar($langue_code, $_GET["car"]); if($voitures->type == "luxe"){ $_SESSION["prix"] = $_SESSION["pvk_luxe"]; }else if($voitures->type == "prestige"){ $_SESSION["prix"] = $_SESSION["pvk_prestige"]; }else if($voitures->type == "berline"){ $_SESSION["prix"] = $_SESSION["pvk_berline"]; } function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } do { $params = array( 'origin' => $_SESSION["depart"], 'destination' => $_SESSION["arriver"], 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $_SESSION["distance"] = $directions->routes[0]->legs[0]->distance->text; $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); if(!isset($returnCheckIdIti->id_itineraire) && empty($returnCheckIdIti->id_itineraire)){ if(isset($_SESSION["idUser"])){ $user_id = $_SESSION["idUser"]; }else{ $user_id = NULL; } $bagage = NULL; $duree = NULL; $etatCourse = 0; $numeroVolTrain = NULL; $distance = floatval($_SESSION["distance"]); $returnItineraire = $General->insertItineraire($_SESSION["depart"], $_SESSION["arriver"], $itineraireDate, $_SESSION["prix"], $langue_code, $_SESSION["place"], 'privée', $user_id, $_SESSION["idTransaction"],$_SESSION["bagages"],$duree,$etatCourse,$_SESSION["car"],$numeroVolTrain,$distance,$_SESSION["remarque"]); $idTransactionActif = $_SESSION["idTransaction"]; }else{ $idTransactionActif = $returnCheckIdIti->id_transaction; } if(isset($_SESSION["idUser"])){ $user = $General->getUserById($_SESSION["idUser"]); } $obj = new stdClass(); $obj->voitures = $voitures; if(isset($_SESSION["idUser"])){ $obj->user = $user; } $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; $amount = number_format($_SESSION["prix"], 2, '', ' '); $parm="$parm amount=$amount"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $idTransaction = $_SESSION["idTransaction"]; $parm="$parm order_id=$idTransaction"; if(isset($_SESSION["idUser"])){ $customerId = $_SESSION["idUser"]; $parm="$parm customer_id=$customerId"; $userMail = $user->mail; $parm="$parm customer_email=$userMail"; $isLogPaiementAuth = true; }else{ $isLogPaiementAuth = false; } $parm="$parm order_id=$idTransactionActif"; $path_bin = "api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } if (( $code == "" ) && ( $error == "" ) ) { //erreur appel request }else if($code != 0){ //Erreur appel API de paiement }else{ //OK } $obj->departAdresse = $_SESSION["depart"]; $obj->arriverAdresse = $_SESSION["arriver"]; $obj->place = $_SESSION["place"]; $obj->day = $_SESSION["day"]; $obj->month = $_SESSION["month"]; $obj->year = $_SESSION["year"]; $obj->heure = $_SESSION["heure"]; $obj->min = $_SESSION["min"]; $obj->distance = $directions->routes[0]->legs[0]->distance->text; $obj->prix = $_SESSION["prix"]; $obj->idTransaction = $_SESSION["idTransaction"]; $obj->bagages = $_SESSION["bagages"]; $obj->trad = $trad; $obj->paiementMessage = $message; $obj->isLogPaiementAuth = $isLogPaiementAuth; $optn = ''; Render::renderer($app, "navette_prive_etape4.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/etape_4', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(!isset($_SESSION["type_reserve"]) || $_SESSION["type_reserve"] != 'navette_partage'){ $app->redirect('/'.PATH_PROJET.$langue.'/home'); } $navettes = file_get_contents('navette.json'); $navette = json_decode($navettes); $aeroports = $navette->destination[0]->aeroports; $gares = $navette->destination[1]->gares; function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } do { if($_SESSION["arriver"] == "Gare de l’Est"){ $arriverSession = $_SESSION["arriver"] . ' Paris'; }else{ $arriverSession = $_SESSION["arriver"]; } if($_SESSION["depart"] == "Gare de l’Est"){ $departSession = $_SESSION["depart"] . ' Paris'; }else{ $departSession = $_SESSION["depart"]; } $params = array( 'origin' => $departSession, 'destination' => $arriverSession, 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); } while (!isset($directions->routes[0]->legs[0]->distance->text)); $_SESSION["distance"] = $directions->routes[0]->legs[0]->distance->text; $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $returnCheckIdIti = $General->checkItineraireExist($_SESSION["idTransaction"]); if(!isset($returnCheckIdIti->id_itineraire) && empty($returnCheckIdIti->id_itineraire)){ if(isset($_SESSION["idUser"])){ $user_id = $_SESSION["idUser"]; }else{ $user_id = NULL; } $bagage = NULL; $duree = NULL; $etatCourse = 0; if(isset($_SESSION["prix_partage"]) && !empty($_SESSION["prix_partage"])){ $prix = $_SESSION["prix_partage"]; }else{ $prix = NULL; } $car = NULL; $distance = floatval($_SESSION["distance"]); $returnItineraire = $General->insertItineraire($_SESSION["depart"], $_SESSION["arriver"], $itineraireDate, $prix, $langue_code, $_SESSION["place"], 'partagee', $user_id, $_SESSION["idTransaction"],$_SESSION["bagages"],$duree,$etatCourse,$car,$_SESSION["numeroVolTrain"],$distance,$_SESSION["remarque"]); $idTransactionActif = $_SESSION["idTransaction"]; }else{ $idTransactionActif = $returnCheckIdIti->id_transaction; } if(isset($_SESSION["idUser"])){ $user = $General->getUserById($_SESSION["idUser"]); } $obj = new stdClass(); if(isset($_SESSION["idUser"])){ $obj->user = $user; } $message = null; $isLogPaiementAuth = false; if(isset($_SESSION["prix_partage"])){ $parm="merchant_id=080521781700016"; $parm="$parm merchant_country=fr"; $amount = number_format($_SESSION["prix_partage"], 2, '', ' '); $parm="$parm amount=$amount"; $parm="$parm currency_code=978"; $parm="$parm pathfile=/var/www/vhosts/skgames.fr/httpdocs/recette/dsp/api_bank/pathfile"; $idTransaction = $_SESSION["idTransaction"]; $parm="$parm order_id=$idTransaction"; if(isset($_SESSION["idUser"])){ $customerId = $_SESSION["idUser"]; $parm="$parm customer_id=$customerId"; $userMail = $user->mail; $parm="$parm customer_email=$userMail"; $isLogPaiementAuth = true; }else{ $isLogPaiementAuth = false; } $parm="$parm order_id=$idTransactionActif"; $path_bin = "api_bank/request"; $parm = escapeshellcmd($parm); $result=exec("$path_bin $parm"); $tableau = explode ("!", "$result"); if(PROD_PREPROD == "prod"){ $code = $tableau[0]; $message = $tableau[1]; $error = $tableau[2]; }else{ $code = $tableau[1]; $error = $tableau[2]; $message = $tableau[3]; } if (( $code == "" ) && ( $error == "" ) ) { //erreur appel request }else if($code != 0){ //Erreur appel API de paiement }else{ //OK } } $obj->departAdresse = $_SESSION["depart"]; $obj->arriverAdresse = $_SESSION["arriver"]; $obj->place = $_SESSION["place"]; $obj->day = $_SESSION["day"]; $obj->month = $_SESSION["month"]; $obj->year = $_SESSION["year"]; $obj->heure = $_SESSION["heure"]; $obj->min = $_SESSION["min"]; $obj->numeroVolTrain = $_SESSION["numeroVolTrain"]; $obj->bagages = $_SESSION["bagages"]; $obj->distance = $directions->routes[0]->legs[0]->distance->text; $obj->idTransaction = $_SESSION["idTransaction"]; $obj->paiementMessage = $message; $obj->isLogPaiementAuth = $isLogPaiementAuth; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_partagee_etape4.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/paiement/:idTransaction', function ($langue, $idTransaction) use ($app){ $General = new General(); $langue_code = $General->getLangueCode($langue); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $returnCheckIdIti = $General->checkItineraireExist($idTransaction); if($returnCheckIdIti->id_etat_course != 4){ $app->redirect('moncompte/facturation'); }else{ $datetime = new DateTime($returnCheckIdIti->dateTrajet); $obj = new stdClass(); $obj->obj = $returnCheckIdIti; $obj->langue = $langue; $obj->date = $datetime; $obj->trad = $trad; $optn = ''; Render::renderer($app, "navette_partagee_etape5.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); } }); $app->get('/:langue/reserver/navette_prive/etape_5/valide/:idTransaction', function ($langue, $idTransaction) use ($app){ if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_prive/etape_1'); } $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); if(isset($_SESSION["car"])){ $voitures = $General->getCar($langue_code, $_SESSION["car"]); } $itineraire = $General->getItineraire($idTransaction); $user = $General->getUserByIdTransaction($idTransaction); function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } $params = array( 'origin' => $itineraire->adresse_depart, 'destination' => $itineraire->adresse_arrivee, 'sensor' => 'true' ); $params_string = ''; foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); $dates = explode(" ", $itineraire->dateTrajet); $heures = explode(":", $dates[1]); $dates = explode("-", $dates[0]); $day = $dates[2]; $month = $dates[1]; $year = $dates[0]; $heure = $heures[0]; $min = $heures[1]; $to = $user->mail; $subject = 'Drive U Safe - Commande validée'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre commande.

Bonjour '.$user->prenom.' '.$user->nom.',
Votre commande a bien été validé.

  • N° facture: '.$itineraire->id_itineraire.'
  • Depart : '.$itineraire->adresse_depart.'
  • Arrivé : '.$itineraire->adresse_arrivee.'
  • Date : '.$day.' '.$month.' '.$year.'
  • Heure : '.$heure.'h'.$min.'
  • Passager : '.$itineraire->passagers.'
  • '; if(!empty($itineraire->prix)): $message.='
  • Prix : '.$itineraire->prix.'
  • '; endif; $message.='

A bientôt,
L\'equipe Drive U Safe

Si vous n\'avez pas fait cette demande sur le site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; //$message .= 'Pour valider votre inscription sur le site Drive Safe Paris veuillez cliquer sur ce lien : lien'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $obj = new stdClass(); if(isset($_SESSION["car"])){ $obj->voitures = $voitures; } $obj->idItineraire = $itineraire->id_itineraire; $obj->departAdresse = $itineraire->adresse_depart; $obj->arriverAdresse = $itineraire->adresse_arrivee; $obj->place = $itineraire->passagers; $obj->day = $dates[2]; $obj->month = $dates[1]; $obj->year = $dates[0]; $obj->heure = $heures[0]; $obj->min = $heures[1]; $obj->distance = $_SESSION["distance"]; $obj->prix = $itineraire->prix; $obj->idTransaction = $idTransaction; $obj->trad = $trad; $obj->user = $user; $optn = ''; Render::renderer($app, "commande_valide.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->post('/:langue/reserver/navette_prive/etape_5/valide/:idTransaction', function ($langue, $idTransaction) use ($app){ if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_prive/etape_1'); } $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $voitures = $General->getCar($langue_code, $_SESSION["car"]); $user = $General->getUserById($_SESSION["idUser"]); $itineraire = $General->getItineraire($idTransaction); $user = $General->getUserByIdTransaction($idTransaction); $params = array( 'origin' => $itineraire->adresse_depart, 'destination' => $itineraire->adresse_arrivee, 'sensor' => 'true' ); $params_string = ''; foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } $dates = explode(" ", $itineraire->dateTrajet); $heures = explode(":", $dates[1]); $dates = explode("-", $dates[0]); $_SESSION["temp"] = $user; $obj = new stdClass(); $obj->voitures = $voitures; $obj->user = $user; $obj->departAdresse = $itineraire->adresse_depart; $obj->arriverAdresse = $itineraire->adresse_arrivee; $obj->place = $itineraire->passagers; $obj->day = $dates[2]; $obj->month = $dates[1]; $obj->year = $dates[0]; $obj->heure = $heures[0]; $obj->min = $heures[1]; $obj->distance = $_SESSION["distance"]; $obj->prix = $itineraire->prix; $obj->idTransaction = $idTransaction; $obj->trad = $trad; $obj->user = $user; $optn = ''; Render::renderer($app, "commande_valide.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_partagee/etape_5/valide', function ($langue) use ($app){ if(!isset($_SESSION["idTransaction"]) || empty($_SESSION["idTransaction"])){ $app->redirect('/'.PATH_PROJET.$langue.'/reserver/navette_partagee/etape_1'); } $_SESSION["langue"] = $langue; $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $voitures = $General->getCar($langue_code, $_SESSION["car"]); $user = $General->getUserById($_SESSION["idUser"]); $params = array( 'origin' => $_SESSION["departAdresse"], 'destination' => $_SESSION["arriverAdresse"], 'sensor' => 'true' ); $params_string = ''; // Join parameters into URL string foreach($params as $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } // Request URL $url = "http://maps.googleapis.com/maps/api/directions/json?".ltrim($params_string, '&'); // Make our API request $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($curl); curl_close($curl); // Parse the JSON response $directions = json_decode($return); function parseInt($string) { if(preg_match('/(\d+)/', $string, $array)) { return $array[1]; } else { return 0; } } $obj = new stdClass(); $obj->voitures = $voitures; $obj->user = $user; $obj->departAdresse = $_SESSION["departAdresse"]; $obj->arriverAdresse = $_SESSION["arriverAdresse"]; $obj->place = $_SESSION["place"]; $obj->day = $_SESSION["day"]; $obj->month = $_SESSION["month"]; $obj->year = $_SESSION["year"]; $obj->heure = $_SESSION["heure"]; $obj->min = $_SESSION["min"]; $obj->distance = $_SESSION["distance"]; $obj->prix = $_SESSION["prix"]; $obj->idTransaction = $_SESSION["idTransaction"]; $obj->trad = $trad; $optn = ''; Render::renderer($app, "commande_valide.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); }); $app->get('/:langue/reserver/navette_prive/etape_5/cancel', function ($langue) use ($app){ if(empty($_SESSION["isLog"]) || !isset($_SESSION["isLog"])){ $app->redirect('/'.PATH_PROJET.'fr/home'); }else{ $app->redirect('moncompte/facturation'); } }); $app->get('/:langue/reserver/navette_prive/etape_5/notife', function ($langue) use ($app){ if(empty($_SESSION["isLog"]) || !isset($_SESSION["isLog"])){ $app->redirect('/'.PATH_PROJET.'fr/home'); }else{ $app->redirect('moncompte/facturation'); } }); $app->post('/:langue/reserver/navette_prive/etape_5/valide', function ($langue) use ($app){ $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); $fp2 = fopen('valide.txt', 'w'); $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $id_user = $_POST['custom']; fwrite($fp2, $item_name); fwrite($fp2, $item_number); fwrite($fp2, $payment_status); fwrite($fp2, $payment_amount); fwrite($fp2, $payment_currency); fwrite($fp2, $txn_id); fwrite($fp2, $receiver_email); fwrite($fp2, $payer_email); fwrite($fp2, $id_user); if (!$fp) { // ERREUR HTTP } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { // transaction valide } else if (strcmp ($res, "INVALID") == 0) { // Transaction invalide } } fclose ($fp); } // vérifier que payment_status a la valeur Completed if ( $payment_status == "Completed") { // vérifier que txn_id n'a pas été précédemment traité: Créez une fonction qui va interroger votre base de données fwrite($fp2, "receiver_email ===" . $receiver_email); // vérifier que receiver_email est votre adresse email PayPal principale if ( "m.rosine@subskill.com" == $receiver_email) { fwrite($fp2, "EMAIL GOOD"); // vérifier que payment_amount et payment_currency sont corrects // traiter le paiement } else { fwrite($fp2, "MAUVAISE ADRESSE"); // Mauvaise adresse email paypal } } else { fwrite($fp2, "ECHEC"); // Statut de paiement: Echec } fclose($fp2); }); $app->post('/:langue/reserver/navette_prive/etape_5/cancel', function ($langue) use ($app){ $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $id_user = $_POST['custom']; if (!$fp) { // ERREUR HTTP } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if (strcmp ($res, "VERIFIED") == 0) { } else if (strcmp ($res, "INVALID") == 0) { } } fclose ($fp); } }); $app->post('/:langue/reserver/navette_prive/etape_5/notife', function ($langue) use ($app){ $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30); $General = new General(); $id_transaction = $_POST["txn_id"]; $prix_ht = $_POST["mc_gross"]; $tva = $_POST["tax"]; $prix_ttc = $_POST["mc_gross"]; $prix_paye = $_POST["mc_gross"]; $payer_id = $_POST["payer_id"]; $business = $_POST["business"]; $payer_email = $_POST["payer_email"]; $receiver_id = $_POST["receiver_id"]; $verify_sign = $_POST["verify_sign"]; $ipn_track_id = $_POST["ipn_track_id"]; $idTransaction = $_POST["custom"]; $buyerFistName = $_POST["first_name"]; $buyerLastName = $_POST["last_name"]; $payer_status = $_POST["payer_status"]; $payment_type = $_POST["payment_type"]; $transaction_subject = $_POST["transaction_subject"]; $return = $General->insertPaiement($id_transaction, $prix_ht, $tva, $prix_ttc, $prix_paye, $payer_id, $business, $payer_email, $receiver_id, $verify_sign, $ipn_track_id, $idTransaction, $buyerFistName, $buyerLastName, $payer_status, $payment_type, $transaction_subject); $getItineraire = $General->checkItineraireExist($idTransaction); if(isset($getItineraire->id_user)){ $kilometre = $getItineraire->distance; $points = abs(floor($kilometre / KLM_POINT)); $General->addPointFidelisation($getItineraire->id_user,$points); } $General->payé($idTransaction); }); /*$app->get('/:langue/reserver/navette_partagee/etape_2', function ($langue) use ($app){ $_SESSION["langue"] = $langue; $General = new General(); $contentPage = $General->getPageContent(1, 2); $_SESSION["departLat"] = $_GET["departLat"]; $_SESSION["departLong"] = $_GET["departLong"]; $_SESSION["departAdresse"] = $_GET["departAdresse"]; $_SESSION["arriverLat"] = $_GET["arriverLat"]; $_SESSION["arriverLong"] = $_GET["arriverLong"]; $_SESSION["arriverAdresse"] = $_GET["arriverAdresse"]; $_SESSION["place"] = $_GET["place"]; $_SESSION["day"] = $_GET["day"]; $_SESSION["month"] = $_GET["month"]; $_SESSION["year"] = $_GET["year"]; $_SESSION["heure"] = $_GET["heure"]; $_SESSION["min"] = $_GET["min"]; $_SESSION["type"] = 'partagée'; $obj = new stdClass(); $obj->content = $contentPage->content; $obj->departLat = $_GET["departLat"]; $obj->departLong = $_GET["departLong"]; $obj->departAdresse = $_GET["departAdresse"]; $obj->arriverLat = $_GET["arriverLat"]; $obj->arriverLong = $_GET["arriverLong"]; $obj->arriverAdresse = $_GET["arriverAdresse"]; $obj->place = $_GET["place"]; $obj->day = $_GET["day"]; $obj->month = $_GET["month"]; $obj->year = $_GET["year"]; $obj->heure = $_GET["heure"]; $obj->min = $_GET["min"]; $optn = ''; Render::renderer($app, "navette_partagee_etape2.tpl.php", $obj, $optn); include(CONF_TEMPLATE_PATH . 'include/menu_footer.tpl.php'); include(CONF_TEMPLATE_PATH . 'include/footer.tpl.php'); });*/ //POST $app->post('/formPost', function () use ($app){ $json = array(); $General = new General(); $sexe = ''; if($_POST['sex'] == 'male'){ $sexe=1; }else{ $sexe=2; } $token = md5(uniqid(mt_rand(), true)); $isEntreprise = $_POST["isEntreprise"]; $tvaNumero = $_POST["tvaNumero"]; $nomEntreprise = $_POST["nomEntreprise"]; if((isset($_POST["isTemp"]) && $_POST["isTemp"] === true) || (isset($_POST["isTemp"]) && $_POST["isTemp"] == true)){ $General->updateUserTemp($_POST["idUser"],$_POST['nom'],$_POST['prenom'],$_POST['telMobile'],$_POST['mail'],$_POST['mdp'],$sexe,$token,$isEntreprise,$tvaNumero,$nomEntreprise); $to = $_POST['mail']; $subject = 'Confirmation inscription Drive U Safe'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre inscription.

Bonjour '.$_POST["nom"].' '.$_POST["prenom"].',
Pour valider votre inscription sur le site Drive U Safe veuillez cliquer sur ce lien : lien

A bientôt,
L\'equipe Drive U Safe

Si vous ne vous êtes pas inscrit au site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $json['result'] = true; }else{ $verifMail = $General->verifEmail($_POST['mail']); if(empty($verifMail)){ $insertUser = $General->insertUser($_POST['nom'],$_POST['prenom'],$_POST['telMobile'],$_POST['mail'],$_POST['mdp'],$sexe,$token,$isEntreprise,$tvaNumero,$nomEntreprise); if(isset($insertUser) && !empty($insertUser)){ $to = $_POST['mail']; $subject = 'Confirmation inscription Drive U Safe'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre inscription.

Bonjour '.$_POST["nom"].' '.$_POST["prenom"].',
Pour valider votre inscription sur le site Drive U Safe veuillez cliquer sur ce lien : lien

A bientôt,
L\'equipe Drive U Safe

Si vous ne vous êtes pas inscrit au site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; //$message .= 'Pour valider votre inscription sur le site Drive Safe Paris veuillez cliquer sur ce lien : lien'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $json['result'] = true; } }else{ $json['result'] = false; } } echo json_encode($json); }); $app->post('/mailCompteValide', function () use ($app){ if(isset($_POST["mail"])){ $General = new General(); $verifMail = $General->verifEmail($_POST["mail"]); if($verifMail){ $to = $_POST["mail"]; $subject = 'Confirmation inscription Drive U Safe'; /*$message = ' Template mailing Alsacreations '; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= ''; $message .= '
'; $message .= ''; $message .= '
'; $message .= 'L\'équipe DSP vous remercie pour votre inscription.'; $message .= '
'; $message .= 'Pour valider votre inscription sur le site Drive U Safe veuillez cliquer sur ce lien : lien'; $message .= '
'; $message .= '
'; $message .= 'Si vous ne vous êtes pas inscrit au site Drive U Safe merci d\'ignorer ce mail.'; $message .= '
'; $message .= '';*/ $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre inscription.

Pour valider votre inscription sur le site Drive U Safe veuillez cliquer sur ce lien : lien

A bientôt,
L\'equipe Drive U Safe

Si vous ne vous êtes pas inscrit au site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; //$message .= 'Pour valider votre inscription sur le site Drive Safe Paris veuillez cliquer sur ce lien : lien'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $json['result'] = true; } } echo json_encode($json); }); $app->post('/connexionPost', function () use ($app){ $General = new General(); $mail = $_POST["mail"]; $mdp = $_POST["mdp"]; if(isset($_POST["checked"])){ $_SESSION["checked"] = $_POST["checked"]; } $checkUser = $General->checkUser($mail, $mdp); $json = array(); if(!empty($checkUser)){ if($checkUser->valide == 1){ $_SESSION["isLog"] = true; $_SESSION["idUser"] = $checkUser->id_user; $_SESSION["prenom"] = $checkUser->prenom; $_SESSION["nom"] = $checkUser->nom; $json['user'] = $checkUser; $json['result'] = true; $json["valide"] = true; unset($_SESSION["isTemp"]); }else{ $_SESSION["mail_valide"] = $mail; $json["valide"] = false; $json['result'] = true; } }else{ $json['result'] = false; } if(isset($_SESSION["idTransaction"]) && isset($_SESSION["idUser"])){ $isUserLoged = $General->checkUserLoged($_SESSION["idTransaction"]); if(isset($isUserLoged->id_user)){ if($isUserLoged->id_user == NULL){ //USER ETAIT PAS LOG ON UPDATE $General->updateItineraireLogUser($_SESSION["idTransaction"],$_SESSION["idUser"]); } } } echo json_encode($json); }); $app->post('/editCompte', function () use ($app){ $General = new General(); $nom = $_POST["nom"]; $prenom = $_POST["prenom"]; $tel = $_POST["tel"]; $mdp = $_POST["mdp"]; $sexe = $_POST["sex"]; $fix = $_POST["fix"]; $json = array(); if($mdp == 'null'){ $updateUserNoPass = $General->updateUserNoPass($_SESSION["idUser"],$nom,$prenom,$tel,$sexe,$fix); }else{ $updateUser = $General->updateUser($_SESSION["idUser"],$nom,$prenom,$tel,md5($mdp),$sexe,$fix); } $json['result'] = true; echo json_encode($json); }); $app->post('/useFide', function () use ($app){ $General = new General(); $idTransaction = $_SESSION["idTransaction"]; $return = $General->getItineraire($idTransaction); $prix = $return->prix; if($return->is_reduction == 0){ $General->useFide($idTransaction); $General->UpdateUserUseFide($return->id_user); $prix = $prix/2; } $json['prix'] = $prix; echo json_encode($json); }); $app->post('/useNotFide', function () use ($app){ $General = new General(); $idTransaction = $_SESSION["idTransaction"]; $return = $General->getItineraire($idTransaction); $prix = $return->prix; if($return->is_reduction == 1){ $General->useNotFide($idTransaction); $General->UpdateUserNotUseFide($return->id_user); $prix = $prix*2; } $json['prix'] = $prix; echo json_encode($json); }); $app->post('/editFacturation', function () use ($app){ $General = new General(); $nom = $_POST["nom"]; $prenom = $_POST["prenom"]; $adresse = $_POST["adresse"]; $ville = $_POST["ville"]; $code = $_POST["code"]; $pays = $_POST["pays"]; $genre = $_POST["genre"]; $json = array(); $updateUserNoPass = $General->updateAdresseFacturation($_SESSION["idUser"],$nom,$prenom,$adresse,$ville,$code,$pays,$genre); $json['result'] = true; echo json_encode($json); }); $app->post('/contact', function () use ($app){ $nom = $_POST["nom"]; $prenom = $_POST["prenom"]; $fixe = $_POST["fixe"]; $mail = $_POST["mail"]; $object = $_POST["object"]; $text = $_POST["text"]; $json = array(); $to = MAIL; $subject = $object; $message = $text; $headers = 'From: '.$mail.'' . "\r\n" . 'Reply-To: '.$mail.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $json['result'] = true; echo json_encode($json); }); $app->post('/resetMdp', function ( ) use ($app){ $pass = $_POST["pass"]; $token = $_POST["token"]; $General = new General(); $return = $General->changePassword(md5($pass), $token); if($return){ $json['result'] = true; echo json_encode($json); } }); $app->post('/payerPlace', function () use ($app){ if(isset($_SESSION["isLog"]) && $_SESSION["isLog"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['isLog'] = true; $idTransaction = $_POST["idTransaction"]; $General = new General(); //CHECK SI LE USER ETAIT LOG LORS DE LINSERT $isUserLoged = $General->checkUserLoged($idTransaction); if($isUserLoged->id_user == NULL){ //USER ETAIT PAS LOG ON UPDATE $General->updateItineraireLogUser($idTransaction,$_SESSION["idUser"]); } $return = $General->payerSurPlace($idTransaction); if($return){ $json['result'] = true; } }else if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['isLog'] = true; $json['isTemp'] = true; $idTransaction = $_POST["idTransaction"]; $json['idTransaction'] = $idTransaction; $General = new General(); //CHECK SI LE USER ETAIT LOG LORS DE LINSERT $isUserLoged = $General->checkUserLoged($idTransaction); if($isUserLoged->id_user == NULL){ //USER ETAIT PAS LOG ON UPDATE $General->updateItineraireLogUser($idTransaction,$_SESSION["idUser"]); } $return = $General->payerSurPlace($idTransaction); if($return){ $json['result'] = true; } }else{ $json['result'] = true; $json['isLog'] = false; } echo json_encode($json); }); $app->post('/checkPrixSame', function () use ($app){ /*$prix = $_POST["prix"]; $General = new General(); $return = $General->checkPrixSame($prix); echo json_encode($json);*/ }); $app->post('/checkUser', function () use ($app){ if(isset($_SESSION["isLog"]) && $_SESSION["isLog"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['result'] = true; $json['isLog'] = true; }else if(isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['result'] = true; $json['isLog'] = true; }else{ $json['result'] = true; $json['isLog'] = false; } echo json_encode($json); }); $app->post('/tempCompte', function () use ($app){ $nom = $_POST["nom"]; $prenom = $_POST["prenom"]; $mail = $_POST["mail"]; $phone = $_POST["phone"]; $sex = $_POST["sex"]; $_SESSION["checked"] = $_POST["checked"]; $mdp = $_POST["mdp"]; $tel = null; if($sex == 'male'){ $sex = 1; }else{ $sex = 2; } $isEntreprise = 0; $tva = null; $token = md5(uniqid(mt_rand(), true)); $nomEntreprise = null; $General = new General(); if(!empty($mdp)){ $verifMail = $General->verifEmail($_POST['mail']); if(isset($verifMail->id_user)){ $json['existe'] = true; }else{ $json['existe'] = false; $return = $General->insertUser($nom,$prenom,$tel,$mail,$mdp,$sex,$token,$isEntreprise,$tva,$nomEntreprise); $General->updateItineraireLogUser($_SESSION["idTransaction"],$return); $_SESSION["isLog"] = false; $_SESSION["isTemp"] = true; $_SESSION["idUser"] = $return; $to = $_POST['mail']; $subject = 'Confirmation inscription Drive U Safe'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre inscription.

Bonjour '.$nom.' '.$prenom.',
Pour valider votre inscription sur le site Drive U Safe veuillez cliquer sur ce lien : lien

A bientôt,
L\'equipe Drive U Safe

Si vous ne vous êtes pas inscrit au site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } }else{ $json['existe'] = false; $return = $General->compteTemp($nom,$prenom,$mail,$phone); $General->updateItineraireLogUser($_SESSION["idTransaction"],$return); $_SESSION["isLog"] = false; $_SESSION["isTemp"] = true; $_SESSION["idUser"] = $return; } $json['result'] = true; echo json_encode($json); }); $app->post('/demandeExcursion', function () use ($app){ $General = new General(); $langue_code = $General->getLangueCode($_POST["lang"]); $langue_code = $langue_code->id_langue; $itineraireDate = $_SESSION["year"].'-'.$_SESSION["month"].'-'.$_SESSION["day"].' '.$_SESSION["heure"].':'.$_SESSION["min"].':00'; $numeroVolTrain = NULL; $distance = NULL; $returnItineraire = $General->insertItineraire($_SESSION["Adresse"] , $_SESSION["excursion_id"], $itineraireDate, 0, $langue_code, $_SESSION["place"], 'excursion', $_SESSION["idUser"], $_SESSION["idTransaction"],0,0,0,2,0,$numeroVolTrain,$distance); $json['result'] = true; echo json_encode($json); }); $app->post('/demandeDispoDuree', function () use ($app){ if(isset($_SESSION["isLog"]) && $_SESSION["isLog"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['isLog'] = true; $json['isTemp'] = false; $idTransaction = $_POST["idTransaction"]; $General = new General(); //CHECK SI LE USER ETAIT LOG LORS DE LINSERT $isUserLoged = $General->checkUserLoged($idTransaction); if($isUserLoged->id_user == NULL){ //USER ETAIT PAS LOG ON UPDATE $General->updateItineraireLogUser($idTransaction,$_SESSION["idUser"]); } $return = $General->demande($idTransaction); if($return){ $json['result'] = true; } }else if(isset($_SESSION["isLog"]) && $_SESSION["isLog"] == false && isset($_SESSION["isTemp"]) && $_SESSION["isTemp"] == true && isset($_SESSION["idUser"]) && !empty($_SESSION["idUser"])){ $json['isLog'] = true; $json['isTemp'] = true; $idTransaction = $_POST["idTransaction"]; $General = new General(); //CHECK SI LE USER ETAIT LOG LORS DE LINSERT $isUserLoged = $General->checkUserLoged($idTransaction); if($isUserLoged->id_user == NULL){ //USER ETAIT PAS LOG ON UPDATE $General->updateItineraireLogUser($idTransaction,$_SESSION["idUser"]); } $return = $General->demande($idTransaction); if($return){ $json['result'] = true; } }else { $json['result'] = true; $json['isLog'] = false; $json['isTemp'] = false; } $json["idTransaction"] = $_POST["idTransaction"]; echo json_encode($json); }); $app->post('/avis', function () use ($app){ $General = new General(); $nom = $_POST["nom"]; $avis = $_POST["avis"]; $text = $_POST["text"]; $note = $_POST["note"]; $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $General->addAvis($nom,$avis,$text,$note,$langue_code); $json['result'] = true; echo json_encode($json); }); $app->post('/mdpForget', function () use ($app){ $General = new General(); $mail = $_POST["mail"]; $lang = $_POST["lang"]; $user = $General->getUserByMail($mail); if(isset($user->id_user)){ $to = $mail; $subject = 'Drive U Safe - Mot de passe oublié'; $message = ' Template mailing Alsacreations

L\'équipe DUS vous remercie pour votre inscription.

Bonjour '.$user->prenom.' '.$user->nom.',
Afin de créer un nouveau mot de passe merci de cliquer sur ce lien : lien

A bientôt,
L\'equipe Drive U Safe

Si vous n\'avez pas fait cette demande sur le site Drive U Safe merci d\'ignorer ce mail.

Aller sur Drive U Safe
'; //$message .= 'Pour valider votre inscription sur le site Drive Safe Paris veuillez cliquer sur ce lien : lien'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: '.MAIL.'' . "\r\n" . 'Reply-To: '.MAIL.'' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $json = array(); $json['result'] = true; echo json_encode($json); } }); $app->post('/pdfExcursion', function () use ($app){ $General = new General(); $langue_code = $General->getLangueCode($_SESSION["langue"]); $langue_code = $langue_code->id_langue; $contentPage = $General->getExcursions($langue_code); /* ob_start(); class PDF extends FPDF { // En-tête function Header() { global $commandes; $this->SetFont('Arial','B',17); // Titre $this->Ln(10); $this->Cell(40,5,'Drive Safe Paris',0,1,'L'); $this->Ln(5); $this->SetFont('Arial','B',8); $this->Cell(40,4,utf8_decode('SAS Drive SAFE Paris'),0,1,'L'); $this->SetFont('Arial','',8); $this->Cell(40,4,utf8_decode('15, rue de l\'esturgeon'),0,1,'L'); $this->Cell(40,4,utf8_decode('67000 Strasbourg'),0,1,'L'); $this->Cell(40,4,utf8_decode('www.drivesafeparis.fr'),0,1,'L'); $this->Cell(40,4,utf8_decode('Email : contact@drivesafeparis.fr'),0,1,'L'); $this->Cell(40,4,utf8_decode('SIREN : XXXXXXXXX'),0,1,'L'); $this->Cell(40,4,utf8_decode('Code APE : XXXXX'),0,1,'L'); $this->Cell(40,4,utf8_decode('N°TVA intracommunautaire : FRXXXXXXX'),0,1,'L'); $this->Ln(5); $this->SetFont('Arial','B',8); $this->Cell(0,4,utf8_decode($commandes->prenom_user . ' ' .$commandes->nom_user),0,1,'R'); $this->Cell(0,4,utf8_decode($commandes->adresse . ' ' .$commandes->code_postal . ' ' . $commandes->ville),0,1,'R'); $this->Cell(0,4,utf8_decode($commandes->mail),0,1,'R'); // Saut de ligne $this->Image('logo_dsp.png',90,10,30); $this->Ln(15); $this->SetFont('Arial','B',13); // Titre $this->Ln(25); $this->Cell(25,5,'Drive Safe Paris - Liste des excursions',0,1,'L'); $this->Ln(5); } function Footer() { // Positionnement à 1,5 cm du bas $this->SetY(-15); // Police Arial italique 8 $this->SetFont('Arial','I',8); // Numéro de page $this->Cell(0,10,'DRIVE SAFE PARIS - Page '.$this->PageNo().'/{nb}',0,0,'C'); } function BasicTable($header, $data,$footer) { // En-tête foreach($header as $col){ if($col == 'Objet'){ $this->SetFillColor('105','105','105'); $this->Cell(105,7,utf8_decode($col),0,0,'C','true'); }else{ $this->SetFillColor('105','105','105'); $this->Cell(30,7,utf8_decode($col),0,0,'C','true'); } } $this->Ln(); // Données for($i = 0 ; $i < count($data); $i++){ for($j = 0 ; $j < count($data[$i]); $j++){ if($j == 0){ $this->Cell(105,6,utf8_decode($data[$i][$j]),0); }else{ $this->Cell(30,6,utf8_decode($data[$i][$j]),0,0,'C'); } } $this->Ln(); } for($g = 0 ; $g < count($footer); $g++){ $this->Cell(105,8); if($g == 1){ $this->Cell(60,8,utf8_decode($footer[$g]),0,0,'C'); $this->Cell(30,8,utf8_decode('XXX'),0,0,'C'); }else{ $this->Cell(60,8,utf8_decode($footer[$g]),0,0,'C','true'); $this->Cell(30,8,utf8_decode('XXX'),0,0,'C','true'); } $this->Ln(); } } } $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->Ln(10); //$pdf->Header($commandes); //$pdf->BasicTable($header,$excursions,$footer); //$pdf->SetFont('Arial','B',8); //$pdf->SetFillColor('105','105','105'); //$pdf->Cell(90,7,utf8_decode('Object'),0,1, 'C','true'); //$pdf->Cell(20,7,utf8_decode('Quantité'),0,1, 'C','true'); $pdf->SetFont('Times','',12); foreach($contentPage as $excursion) $pdf->Cell(0,10,$excursion->title,0,1); $pdf->Output('facture.pdf','D'); ob_end_flush();*/ }); $app->notFound(function () use ($app) { if(isset($_SESSION["langue"])){ $langue = $_SESSION["langue"]; }else{ $langue = 'fr'; } global $trad; $trad = file_get_contents('langues/'.$langue.'.json'); $trad = json_decode($trad); $obj = new stdClass(); $obj->trad = $trad; //TEMPLATE A INCLUDE STYLE SIDEBAR OU AUTRE $array = array(); foreach($obj as $o=>$prop){ $array[$o] = $prop; } $app->render('404.tpl.php', $array); }); $app->run();