public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $loginCompte = $request->request->get("Mot_De_Passe_Oublie_Compte");
     $emailCompte = $request->request->get("Mot_De_Passe_Oublie_Email");
     $passwordNew = \FonctionsUtiles::GenerateString(8);
     $objLogsOublieMotDePasse = new \Site\Entity\LogsOublieMotDePasse();
     $objLogsOublieMotDePasse->setCompteEssaye($loginCompte);
     $objLogsOublieMotDePasse->setEmailEssaye($emailCompte);
     $objLogsOublieMotDePasse->setIp($this->ipAdresse);
     $objLogsOublieMotDePasse->setDateEssai(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByEmailAndLogin($emailCompte, $loginCompte);
     if ($objAccount !== null) {
         \Account\AccountHelper::getAccountRepository()->updateAccountPassword($objAccount->getId(), $passwordNew);
         $template = $this->objTwig->loadTemplate("PasswordForgottenEmail.html5.twig");
         $result = $template->render(["newMDP" => $passwordNew]);
         $subject = 'VamosMT2 - Nouveau mot de passe';
         \EmailHelper::sendEmail($emailCompte, $subject, $result);
         $objLogsOublieMotDePasse->setResultatDemande("1");
         echo "1";
     } else {
         $objLogsOublieMotDePasse->setResultatDemande("2");
         echo "2";
     }
     $em->persist($objLogsOublieMotDePasse);
     $em->flush();
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $passwordOld = $request->request->get("Ancien_Mot_De_Passe");
     $passwordNew = $request->request->get("Nouveau_Mot_De_Passe");
     $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLoginAndPassword($this->objAccount->getLogin(), $passwordOld);
     if ($objAccount !== null) {
         //Suppression des autres demandes
         \Site\SiteHelper::getControleChangementMotDePasseRepository()->deleteByAccountId($objAccount->getId());
         $Nombre_Unique = \FonctionsUtiles::GenerateString(8, "INT");
         $objControleChangementMotDePasse = new \Site\Entity\ControleChangementMotDePasse();
         $objControleChangementMotDePasse->setIdCompte($objAccount->getId());
         $objControleChangementMotDePasse->setCompte($objAccount->getLogin());
         $objControleChangementMotDePasse->setNouveauMotDePasse($passwordNew);
         $objControleChangementMotDePasse->setNumeroVerif($Nombre_Unique);
         $objControleChangementMotDePasse->setIp($this->ipAdresse);
         $em->persist($objControleChangementMotDePasse);
         $em->flush();
         $template = $this->objTwig->loadTemplate("PasswordChangeEmail.html5.twig");
         $result = $template->render(["account" => $objAccount->getLogin(), "key" => $Nombre_Unique]);
         $subject = 'VamosMT2 - Changement de mot de passe';
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
         echo '1';
     } else {
         echo '2';
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $compte = $request->request->get("compte");
     $typeTransaction = $request->request->get("transaction");
     $ammount = $request->request->get("nombre_monnaies");
     $devise = $request->request->get("devise");
     $objLogsAdminGererMonnaie = new \Site\Entity\LogsAdminGererMonnaie();
     $objLogsAdminGererMonnaie->setMontant($ammount);
     $objLogsAdminGererMonnaie->setDevise($devise);
     $objLogsAdminGererMonnaie->setOperation($typeTransaction);
     $objLogsAdminGererMonnaie->setIdGm($this->objAccount->getId());
     $objLogsAdminGererMonnaie->setDate(new \DateTime(date("Y-m-d H:i:s")));
     $objLogsAdminGererMonnaie->setIp($this->ipAdresse);
     if ($compte == "*") {
         \Account\AccountHelper::getAccountRepository()->updateMonnaiesByLogin("", $typeTransaction, $ammount, $devise);
         $objLogsAdminGererMonnaie->setIdCompte(0);
         $Tableau_Retour_Json = array('result' => true, 'reasons' => "");
     } else {
         $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLogin($compte);
         if ($objAccount !== null) {
             \Account\AccountHelper::getAccountRepository()->updateMonnaiesByLogin($compte, $typeTransaction, $ammount, $devise);
             $objLogsAdminGererMonnaie->setIdCompte($objAccount->getId());
             $Tableau_Retour_Json = array('result' => true, 'reasons' => "");
         } else {
             $Tableau_Retour_Json = array('result' => false, 'reasons' => "Ce compte n'existe pas.");
         }
     }
     $em->persist($objLogsAdminGererMonnaie);
     $em->flush();
     echo json_encode($Tableau_Retour_Json);
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $gmListMid = $request->request->get("GmListMid");
     $playerId = $request->request->get("playerId");
     $playerIp = $request->request->get("playerIp");
     $authority = $request->request->get("authority");
     $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($playerId);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objPlayer->getIdAccount());
     if ($gmListMid > 0) {
         $objGmListMid = \Common\CommonHelper::getGmlistRepository()->find($gmListMid);
     } else {
         $objGmListMid = new \Common\Entity\Gmlist();
         $objGmListMid->setMserverip("ALL");
     }
     $objGmListMid->setMaccount($objAccount->getLogin());
     $objGmListMid->setMname($objPlayer->getName());
     $objGmListMid->setMauthority($authority);
     $objGmListMid->setMcontactip($playerIp);
     $em->persist($objGmListMid);
     $em->flush();
     $result = array('result' => true, 'reasons' => "");
     echo json_encode($result);
 }
Ejemplo n.º 5
0
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idCompte = $request->request->get("idCompte");
     $idDiscussion = $request->request->get("idDiscussion");
     $message = $request->request->get("message");
     $objSupportMessage = new \Site\Entity\SupportMessages();
     $objSupportMessage->setIdCompte($idCompte);
     $objSupportMessage->setIdDiscussion($idDiscussion);
     $objSupportMessage->setMessage($message);
     $objSupportMessage->setDate(new \DateTime(date("Y-m-d H:i:s")));
     $objSupportMessage->setEtat(\SupportEtatMessageHelper::NON_LU);
     $objSupportMessage->setDatechangementEtat(new \DateTime(date("Y-m-d H:i:s")));
     $objSupportMessage->setIp($this->ipAdresse);
     try {
         $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
         $objSupportDiscussion->setDateDernierMessage(new \DateTime(date("Y-m-d H:i:s")));
         $em->persist($objSupportDiscussion);
         $em->persist($objSupportMessage);
         $em->flush();
         if ($idCompte == $objSupportDiscussion->getIdAdmin()) {
             $objAccountJoueur = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
             if ($objAccountJoueur !== null) {
                 $template = $this->objTwig->loadTemplate("MessagerieMessageAdd.html5.twig");
                 $result = $template->render(["compte" => $objAccountJoueur->getLogin(), "objet" => \SupportObjetsHelper::getLibelle($objSupportDiscussion->getIdObjet())]);
                 $subject = 'VamosMT2 - Réponse à votre ticket';
                 \EmailHelper::sendEmail($objAccountJoueur->getEmail(), $subject, $result);
             }
         }
         echo json_encode(["id" => $objSupportMessage->getId(), "date" => \DateTimeHelper::dateTimeToFormatedString($objSupportMessage->getDate(), "H:i"), "message" => nl2br($objSupportMessage->getMessage())]);
     } catch (Exception $ex) {
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idDiscussion = $request->request->get("idDiscussion");
     $idAdmin = $request->request->get("idAdmin");
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
     $objAdmins = \Site\SiteHelper::getAdminsRepository()->find($idAdmin);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objAdmins->getIdCompte());
     if ($objSupportDiscussion !== null and $objAccount !== null) {
         $objSupportMessage = new \Site\Entity\SupportMessages();
         $objSupportMessage->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objSupportMessage->setDatechangementEtat(new \DateTime(date("Y-m-d H:i:s")));
         $objSupportMessage->setEtat(\SupportEtatMessageHelper::LU);
         $objSupportMessage->setIdCompte(0);
         $objSupportMessage->setIdDiscussion($objSupportDiscussion->getId());
         $objSupportMessage->setIp($this->ipAdresse);
         $objSupportMessage->setMessage("" . $this->objAdmin->getName() . " à transféré le ticket à " . $objAdmins->getName() . ".");
         $objSupportDiscussion->setIdAdmin($objAccount->getId());
         $em->persist($objSupportMessage);
         $em->persist($objSupportDiscussion);
         $em->flush();
     }
     echo json_encode(["result" => 1]);
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idCompte = $this->objAccount->getId();
     $idPersonnage = $request->request->get("id_personnage");
     $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPersonnage);
     if ($objPlayer !== null) {
         //Suppression des autres demandes
         \Site\SiteHelper::getSuppressionPersonnageRepository()->deleteByPlayerId($idPersonnage);
         $objAccount = \Account\AccountHelper::getAccountRepository()->find($idCompte);
         if ($objAccount !== null) {
             $numeroVerif = \FonctionsUtiles::GenerateString(8, "INT");
             //Envoie de l'email de vérification
             $template = $this->objTwig->loadTemplate("PersonnageDeleteEmailVerify.html5.twig");
             $result = $template->render(["account" => $objAccount->getLogin(), "player" => $objPlayer->getName(), "key" => $numeroVerif]);
             $subject = 'VamosMt2 - Suppression du personnage ' . $objPlayer->getName() . '';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             //Insertion de la demande
             $objSuppressionPersonnage = new \Site\Entity\SuppressionPersonnage();
             $objSuppressionPersonnage->setIdCompte($idCompte);
             $objSuppressionPersonnage->setIdPersonnage($idPersonnage);
             $objSuppressionPersonnage->setEmail($objAccount->getEmail());
             $objSuppressionPersonnage->setNumeroVerif($numeroVerif);
             $objSuppressionPersonnage->setDate(new \DateTime(date("Y-m-d H:i:s")));
             $objSuppressionPersonnage->setIp($this->ipAdresse);
             $em->persist($objSuppressionPersonnage);
             $em->flush();
             $Tableau_Retour_Json = array('result' => true);
         } else {
             $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le compte n'existe pas.");
         }
         echo json_encode($Tableau_Retour_Json);
     }
 }
 public function run()
 {
     global $request;
     $login = $request->query->get("pseudo");
     $countAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLogin($login);
     if ($countAccount !== null) {
         echo "1";
     } else {
         echo "2";
     }
 }
Ejemplo n.º 9
0
 public function run()
 {
     $arrObjAccount = \Account\AccountHelper::getAccountRepository()->finByLoginForAjaxSelect($_GET["term"]);
     $arrResult[] = array('label' => "", 'ID' => "");
     if (count($arrObjAccount) > 0) {
         foreach ($arrObjAccount as $objAccount) {
             $arrResult[] = array('label' => $objAccount['login'], 'ID' => $objAccount['id']);
         }
     }
     echo json_encode($arrResult);
     exit;
 }
Ejemplo n.º 10
0
 public function run()
 {
     global $request;
     $idAccount = $request->query->get("idAccount");
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($idAccount);
     $this->arrayTemplate["arrBannissementMotifs"] = \BanRaisonHelper::getAll(false);
     $this->arrayTemplate["arrBannissementDuree"] = \BanDureeHelper::getAll(false);
     $this->arrayTemplate["rightBannissementEmail"] = $this->HaveTheRight(\DroitsHelper::BANNISSEMENT_IP);
     $this->arrayTemplate["rightBannissementIp"] = $this->HaveTheRight(\DroitsHelper::BANNISSEMENT_EMAIL);
     $this->arrayTemplate["objAccount"] = $objAccount;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Ejemplo n.º 11
0
 public function run()
 {
     global $request;
     $idSupportDiscussion = \Encryption::decrypt($request->request->get("idSupportDiscussion"));
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idSupportDiscussion);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
     $objAdmins = \Site\SiteHelper::getAdminsRepository()->findAdministrationUser($objSupportDiscussion->getIdAdmin());
     $arrObjSupportMessages = \Site\SiteHelper::getSupportMessagesRepository()->findMessages($this->objAccount->getId(), $idSupportDiscussion);
     $this->arrayTemplate["objSupportDiscussion"] = $objSupportDiscussion;
     $this->arrayTemplate["objAccount"] = $objAccount;
     $this->arrayTemplate["objAdmins"] = $objAdmins;
     $this->arrayTemplate["arrObjSupportMessages"] = $arrObjSupportMessages;
     $this->arrayTemplate["currentAccount"] = $this->objAccount;
     $this->arrayTemplate["currentAdmin"] = $this->objAdmin;
     $this->arrayTemplate["etatLu"] = \SupportEtatMessageHelper::LU;
     $this->arrayTemplate["isAdmin"] = $this->isAdmin;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Ejemplo n.º 12
0
 public function run()
 {
     global $request;
     $idDiscussion = \Encryption::decrypt($request->query->get("idDiscussion"));
     $arrObjAdmins = \Site\SiteHelper::getAdminsRepository()->findAll();
     $arrUsers = [];
     foreach ($arrObjAdmins as $objAdmins) {
         $arrDroits = $objAdmins->getDroits();
         if (in_array(\DroitsHelper::SUPPORT_TICKET, $arrDroits)) {
             $objAccount = \Account\AccountHelper::getAccountRepository()->find($objAdmins->getIdCompte());
             if ($objAccount !== null) {
                 $arrUsers[] = $objAdmins;
             }
         }
     }
     $this->arrayTemplate["idDiscussion"] = $idDiscussion;
     $this->arrayTemplate["arrObjAdmins"] = $arrUsers;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idAccount = $request->request->get("idAccount");
     if ($idAccount > 0) {
         $objAccount = \Account\AccountHelper::getAccountRepository()->find($idAccount);
         if ($objAccount !== null) {
             $objAccount->setStatus(\StatusHelper::ACTIF);
             $em->persist($objAccount);
             $objBannissementsActif = \Site\SiteHelper::getBannissementsActifsRepository()->findByIdAccount($objAccount->getId());
             if ($objBannissementsActif !== null) {
                 $objHistoriqueBannissement = new \Site\Entity\HistoriqueBanissements();
                 $oldReflection = new \ReflectionObject($objBannissementsActif);
                 $newReflection = new \ReflectionObject($objHistoriqueBannissement);
                 foreach ($oldReflection->getProperties() as $property) {
                     if ($newReflection->hasProperty($property->getName())) {
                         $newProperty = $newReflection->getProperty($property->getName());
                         $newProperty->setAccessible(true);
                         $newProperty->setValue($objHistoriqueBannissement, $property->getValue($objBannissementsActif));
                     }
                 }
                 $objHistoriqueBannissement->setDebannPar($this->objAccount->getId());
                 $em->persist($objHistoriqueBannissement);
                 $em->remove($objBannissementsActif);
             }
             $em->flush();
             $template = $this->objTwig->loadTemplate("Debannissement.html5.twig");
             $result = $template->render(["compte" => $objAccount->getLogin()]);
             $subject = 'VamosMt2 - Levé du bannissement de ' . $objAccount->getLogin() . '';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             $result = array('result' => true, 'reasons' => "");
         } else {
             $result = array('result' => false, 'reasons' => "Le compte sélectionné n'existe pas.");
         }
     } else {
         $result = array('result' => false, 'reasons' => "Problème de transmission d'identifiant.");
     }
     echo json_encode($result);
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idDiscussion = \Encryption::decrypt($request->request->get("idDiscussion"));
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
     if ($objSupportDiscussion !== null) {
         if ($objSupportDiscussion->getIdCompte() == $this->objAccount->getId() or $objSupportDiscussion->getIdAdmin() == $this->objAccount->getId()) {
             $objSupportDiscussion->setEstArchive(1);
             $em->persist($objSupportDiscussion);
             $em->flush();
             $template = $this->objTwig->loadTemplate("MessagerieDiscussionCloture.html5.twig");
             $result = $template->render(["compte" => $objAccount->getLogin(), "objet" => \SupportObjetsHelper::getLibelle($objSupportDiscussion->getIdObjet())]);
             $subject = 'VamosMT2 - Clôture de votre ticket';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             echo json_encode(["result" => true]);
         } else {
             echo json_encode(["result" => false, "message" => "Le ticket est introuvable."]);
         }
     }
 }
Ejemplo n.º 15
0
 public function run()
 {
     global $session;
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $login = $request->request->get("Utilisateur");
     $password = $request->request->get("Mot_De_Passe");
     $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLoginAndPassword($login, $password);
     if ($objAccount !== null) {
         $session->set("ID", $objAccount->getId());
         $session->set("Utilisateur", $objAccount->getLogin());
         $session->set("Email", $objAccount->getEmail());
         $session->set("Cash", $objAccount->getCash());
         $session->set("Mileage", $objAccount->getMileage());
         $objAdministrationUser = \Site\SiteHelper::getAdminsRepository()->findAdministrationUser($objAccount->getId());
         if ($objAdministrationUser !== null) {
             $session->set("estAdmin", true);
             $Tableau_Retour_Json = array('result' => "1", 'reasons' => "", 'isUnconfimed' => $objAccount->getStatus() == \StatusHelper::NON_CONFIRME, 'isBanned' => $objAccount->getStatus() == \StatusHelper::BANNI, 'withRefresh' => 1, 'data' => '<div style="position: relative;top: 45%;width: 431px; margin: 0 auto 0 auto;"><h2>Chargement de l\'administration...</h2></div>');
         } else {
             $Tableau_Retour_Json = array('result' => "1", 'reasons' => "", 'isUnconfimed' => $objAccount->getStatus() == \StatusHelper::NON_CONFIRME, 'isBanned' => $objAccount->getStatus() == \StatusHelper::BANNI, 'withRefresh' => 0, 'id' => \Encryption::encryptForUrl($objAccount->getId()), 'data' => '');
         }
     } else {
         $Tableau_Retour_Json = array('result' => "2", 'reasons' => "Vous avez indiqué de mauvaises informations.");
     }
     $objLogConnexion = new \Site\Entity\LogsConnexion();
     $objLogConnexion->setCompte($login);
     $objLogConnexion->setIp($this->ipAdresse);
     $objLogConnexion->setDate(new \DateTime(date("Y-m-d H:i:s")));
     if ($session->get("ID") !== null) {
         $objLogConnexion->setResultat(1);
         $objLogConnexion->setIdCompte($session->get("ID"));
     } else {
         $objLogConnexion->setResultat(0);
     }
     $em->persist($objLogConnexion);
     $em->flush();
     echo json_encode($Tableau_Retour_Json);
 }
Ejemplo n.º 16
0
 public function run()
 {
     global $request;
     $mode = $request->query->get("mode");
     $objAccount = null;
     if ($mode == "create") {
         $objAdmins = new \Site\Entity\Admins();
         $arrDroits = $objAdmins->getDroits();
     } else {
         if ($mode == "mod") {
             $id = $request->query->get("idAdmins");
             $objAdmins = \Site\SiteHelper::getAdminsRepository()->find($id);
             $arrDroits = $objAdmins->getDroits();
             $objAccount = \Account\AccountHelper::getAccountRepository()->find($objAdmins->getIdCompte());
         }
     }
     $this->arrayTemplate["objAdmins"] = $objAdmins;
     $this->arrayTemplate["arrDroits"] = $arrDroits;
     $this->arrayTemplate["objAccount"] = $objAccount;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Ejemplo n.º 17
0
 public function run()
 {
     global $request;
     $mode = $request->query->get("mode");
     $objPlayer = null;
     $objAccount = null;
     if ($mode == "create") {
         $objGmList = new \Common\Entity\Gmlist();
     } else {
         if ($mode == "mod") {
             $id = $request->query->get("idMembre");
             $objGmList = \Common\CommonHelper::getGmlistRepository()->find($id);
             $objPlayer = \Player\PlayerHelper::getPlayerRepository()->findByName($objGmList->getMname());
             $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLogin($objGmList->getMaccount());
         }
     }
     $this->arrayTemplate["arrAuthority"] = \AuthorityHelper::getAll();
     $this->arrayTemplate["objGmList"] = $objGmList;
     $this->arrayTemplate["objPlayer"] = $objPlayer;
     $this->arrayTemplate["objAccount"] = $objAccount;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Ejemplo n.º 18
0
 public function run()
 {
     global $request;
     global $config;
     global $session;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $paymentResult = false;
     // Script to create a signature
     define('API_BASE_URL', $config["item_shop"]["rechargement"]["hipay"]["apiBaseUrl"]);
     define('API_KEY', $config["item_shop"]["rechargement"]["hipay"]["apiKey"]);
     define('API_SECRET_KEY', $config["item_shop"]["rechargement"]["hipay"]["apiSecretKey"]);
     define('API_HASH_FUNCTION', 'sha1');
     date_default_timezone_set('UTC');
     // STEPS 1 and 2: Construction of query parameters
     $queryParameters = array('site_id' => $config["item_shop"]["rechargement"]["hipay"]["siteId"], 'product_id' => $config["item_shop"]["rechargement"]["hipay"]["productId"], 'api_key' => API_KEY, 'api_hash' => API_HASH_FUNCTION, 'api_ts' => time(), 'format' => "json");
     // STEP 3 : Sort parameters by ascending alphabetical order by name ofparameter
     ksort($queryParameters);
     /* STEP 4
      * Prepare a string to hash with the hash function "API_HASH_FUNCTION"
      */
     $stringToHash = '';
     foreach ($queryParameters as $parameter => $value) {
         $stringToHash .= $parameter . (is_array($value) ? implode('', $value) : $value);
     }
     $stringToHash .= API_SECRET_KEY;
     // STEP 5: Creation of signature
     $signature = hash(API_HASH_FUNCTION, $stringToHash);
     // STEP 6 : Generating URL
     $queryParameters['api_sig'] = $signature;
     $url = API_BASE_URL . '/onetime/pricing?' . http_build_query($queryParameters);
     \Debug::log(time());
     $data = file_get_contents($url);
     $dataDecode = json_decode($data);
     foreach ($dataDecode->response as $response) {
         if ($response->code == 0 and $response->message == "OK") {
             $paymentResult = true;
             $codeResult = "Réussi";
         }
     }
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($request->query->get("data"));
     if ($paymentResult) {
         $codeResult = "Réussi";
         if ($config["item_shop"]["rechargement"]["hipay"]["devise"] == \DeviseHelper::CASH) {
             $objAccount->setCash($objAccount->getCash() + $config["item_shop"]["rechargement"]["hipay"]["cash"]);
         } else {
             if ($config["item_shop"]["rechargement"]["hipay"]["devise"] == \DeviseHelper::MILEAGE) {
                 $objAccount->setMileage($objAccount->getMileage() + $config["item_shop"]["rechargement"]["hipay"]["cash"]);
             }
         }
         $em->persist($objAccount);
         $session->set("Cash", $objAccount->getCash());
         $session->set("Mileage", $objAccount->getMileage());
         $objLogsRechargement = new \Site\Entity\LogsRechargements();
         $objLogsRechargement->setIdCompte($objAccount->getId());
         $objLogsRechargement->setCompte($objAccount->getLogin());
         $objLogsRechargement->setEmailCompte($objAccount->getEmail());
         $objLogsRechargement->setCode($request->query->get("RECALL"));
         $objLogsRechargement->setNombreVamonaies($config["item_shop"]["rechargement"]["hipay"]["cash"]);
         $objLogsRechargement->setResultat($codeResult);
         $objLogsRechargement->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objLogsRechargement->setIp($this->ipAdresse);
         $em->persist($objLogsRechargement);
         $em->flush();
         $template = $this->objTwig->loadTemplate("emailItemShopRechargement.html5.twig");
         $result = $template->render(["compte" => $objAccount->getLogin(), "system" => "Hipay", "nombre" => $config["item_shop"]["rechargement"]["hipay"]["cash"], "devise" => $config["item_shop"]["rechargement"]["hipay"]["devise"], "identifiantRechargement" => $objLogsRechargement->getId()]);
         $subject = 'VamosMT2 - Rechargement de compte';
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
         if ($this->isConnected) {
             header('Location: ../../ItemShopRechargementTerm.php?result=1&id=' . $objLogsRechargement->getId() . '&isConnected=1');
             exit;
         } else {
             header('Location: ../../ItemShopRechargementTerm.php?result=1&id=' . $objLogsRechargement->getId() . '&isConnected=0');
             exit;
         }
     } else {
         $codeResult = "Mauvaise clès";
         $objLogsRechargement = new \Site\Entity\LogsRechargements();
         $objLogsRechargement->setIdCompte($objAccount->getId());
         $objLogsRechargement->setCompte($objAccount->getLogin());
         $objLogsRechargement->setEmailCompte($objAccount->getEmail());
         $objLogsRechargement->setCode($request->query->get("RECALL"));
         $objLogsRechargement->setResultat($codeResult);
         $objLogsRechargement->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objLogsRechargement->setIp($this->ipAdresse);
         $em->persist($objLogsRechargement);
         $em->flush();
         header('Location: ../../ItemShopRechargementTerm.php?result=0&Raison=ClesMauvaise&id=' . $objLogsRechargement->getId() . '');
         exit;
     }
 }
Ejemplo n.º 19
0
 public function run()
 {
     global $session;
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idMarchePersonnage = $request->request->get("idMarchePersonnage");
     $objMarchePersonnage = \Site\SiteHelper::getMarchePersonnagesRepository()->find($idMarchePersonnage);
     if ($objMarchePersonnage !== null) {
         $idVendeur = $objMarchePersonnage->getIdProprietaire();
         $idPlayer = $objMarchePersonnage->getIdPersonnage();
         $pidVendeur = $objMarchePersonnage->getPid();
         $objMarcheArticle = \Site\SiteHelper::getMarcheArticlesRepository()->findByIdentifiantArticle($idMarchePersonnage);
         if ($objMarcheArticle !== null) {
             $prixMarcheArticle = $objMarcheArticle->getPrix();
             $deviseMarcheArticle = $objMarcheArticle->getDevise();
             $asserDeMonnaies = false;
             if ($deviseMarcheArticle == 1) {
                 if ($this->objAccount->getCash() >= $prixMarcheArticle) {
                     $asserDeMonnaies = true;
                 }
             } else {
                 if ($deviseMarcheArticle == 2) {
                     if ($this->objAccount->getMileage() >= $prixMarcheArticle) {
                         $asserDeMonnaies = true;
                     }
                 }
             }
             if ($asserDeMonnaies) {
                 $objPlayerIndex = \Player\PlayerHelper::getPlayerIndexRepository()->find($this->objAccount->getId());
                 if ($objPlayerIndex !== null) {
                     $pidDisponible = false;
                     if ($objPlayerIndex->getPid1() == "0") {
                         $pidDisponible = "1";
                     } else {
                         if ($objPlayerIndex->getPid2() == "0") {
                             $pidDisponible = "2";
                         } else {
                             if ($objPlayerIndex->getPid3() == "0") {
                                 $pidDisponible = "3";
                             } else {
                                 if ($objPlayerIndex->getPid4() == "0") {
                                     $pidDisponible = "4";
                                 }
                             }
                         }
                     }
                     if ($pidDisponible != false) {
                         $objAccountProprietaire = \Account\AccountHelper::getAccountRepository()->find($idVendeur);
                         if ($objAccountProprietaire !== null) {
                             if ($deviseMarcheArticle == 1) {
                                 $objAccountProprietaire->setCash($objAccountProprietaire->getCash() + $prixMarcheArticle);
                                 $this->objAccount->setCash($this->objAccount->getCash() - $prixMarcheArticle);
                             } else {
                                 if ($deviseMarcheArticle == 2) {
                                     $objAccountProprietaire->setMileage($objAccountProprietaire->getMileage() + $prixMarcheArticle);
                                     $this->objAccount->setMileage($this->objAccount->getMileage() - $prixMarcheArticle);
                                 }
                             }
                             $em->persist($objAccountProprietaire);
                             $em->persist($this->objAccount);
                             $session->set("Cash", $this->objAccount->getCash());
                             $session->set("Mileage", $this->objAccount->getMileage());
                             $objLogsMarcheAchats = new \Site\Entity\LogsMarcheAchats();
                             $objLogsMarcheAchats->setIdVendeur($idVendeur);
                             $objLogsMarcheAchats->setIdAcheteur($this->objAccount->getId());
                             $objLogsMarcheAchats->setIdPersonnage($idPlayer);
                             $objLogsMarcheAchats->setPrix($prixMarcheArticle);
                             $objLogsMarcheAchats->setDate(\Carbon\Carbon::now());
                             $objLogsMarcheAchats->setDevise($deviseMarcheArticle);
                             $objLogsMarcheAchats->setIp($this->ipAdresse);
                             $em->persist($objLogsMarcheAchats);
                             //Ajout du personnage sur le compte acheteur
                             $funcAcheteur = "setPid" . $pidDisponible;
                             $objPlayerIndex->{$funcAcheteur}($idPlayer);
                             $em->persist($objPlayerIndex);
                             //Rajout du compte acheteur sur le personnage
                             $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPlayer);
                             $objPlayer->setIdAccount($this->objAccount->getId());
                             $objPlayer->setIp("");
                             $em->persist($objPlayer);
                             //Suppression du personnage fictif du compte vendeur
                             $objPlayerIndexVendeur = \Player\PlayerHelper::getPlayerIndexRepository()->find($idVendeur);
                             $funcVendeur = "setPid" . $pidVendeur;
                             $objPlayerIndexVendeur->{$funcVendeur}(0);
                             $em->persist($objPlayerIndexVendeur);
                             //Suppression de l'article de la vente
                             $em->remove($objMarcheArticle);
                             //Suppression du personnage de la vente
                             $em->remove($objMarchePersonnage);
                             $em->flush();
                             //Email vendeur
                             $template = $this->objTwig->loadTemplate("ajaxBuyPlayerVendeur.html5.twig");
                             $result = $template->render(["compte" => $objAccountProprietaire->getLogin(), "player" => $objPlayer->getName(), "prix" => $prixMarcheArticle, "devise" => $deviseMarcheArticle]);
                             $subject = 'VamosMT2 - Vente du joueur ' . $objPlayer->getName();
                             \EmailHelper::sendEmail($objAccountProprietaire->getEmail(), $subject, $result);
                             //Email acheteur
                             $templateAcheteur = $this->objTwig->loadTemplate("ajaxBuyPlayerAcheteur.html5.twig");
                             $resultAcheteur = $templateAcheteur->render(["compte" => $this->objAccount->getLogin(), "player" => $objPlayer->getName(), "prix" => $prixMarcheArticle, "devise" => $deviseMarcheArticle]);
                             $subjectAcheteur = 'VamosMT2 - Achat du joueur ' . $objPlayer->getName();
                             \EmailHelper::sendEmail($this->objAccount->getEmail(), $subjectAcheteur, $resultAcheteur);
                             $Tableau_Retour_Json = array('result' => true, 'cash' => $this->objAccount->getCash(), 'mileage' => $this->objAccount->getMileage(), 'idPlayer' => \Encryption::encryptForUrl($idPlayer));
                         } else {
                             $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le proprietaire n'existe pas.");
                         }
                     } else {
                         $Tableau_Retour_Json = array('result' => false, 'reasons' => "Vous n'avez pas d'emplacement pour mettre ce joueur.");
                     }
                 } else {
                     $Tableau_Retour_Json = array('result' => false, 'reasons' => "Votre compte n'existe pas.");
                 }
             } else {
                 $Tableau_Retour_Json = array('result' => false, 'reasons' => "Vous n'avez pas assez de monnaies.");
             }
         } else {
             $Tableau_Retour_Json = array('result' => false, 'reasons' => "L'article n'existe plus.");
         }
     } else {
         $Tableau_Retour_Json = array('result' => false, 'reasons' => "Ce personnage n'est plus en vente.");
     }
     echo json_encode($Tableau_Retour_Json);
 }
Ejemplo n.º 20
0
 public function run()
 {
     global $request;
     global $config;
     global $session;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $paymentResult = false;
     $ident = $idp = $ids = $idd = $codes = $code1 = $code2 = $code3 = $code4 = $code5 = $datas = '';
     $idp = 196161;
     $idd = 337955;
     $ident = $idp . ";" . $ids . ";" . $idd;
     if (isset($_POST['code1'])) {
         $code1 = $_POST['code1'];
     }
     if (isset($_POST['code2'])) {
         $code2 = ";" . $_POST['code2'];
     }
     if (isset($_POST['code3'])) {
         $code3 = ";" . $_POST['code3'];
     }
     if (isset($_POST['code4'])) {
         $code4 = ";" . $_POST['code4'];
     }
     if (isset($_POST['code5'])) {
         $code5 = ";" . $_POST['code5'];
     }
     $codes = $code1 . $code2 . $code3 . $code4 . $code5;
     if (isset($_POST['DATAS'])) {
         $datas = $_POST['DATAS'];
     }
     $ident = urlencode($ident);
     $codes = urlencode($codes);
     $datas = urlencode($datas);
     /* Envoi de la requête vers le serveur StarPass
        Dans la variable tab[0] on récupère la réponse du serveur
        Dans la variable tab[1] on récupère l'URL d'accès ou d'erreur suivant la réponse du serveur */
     $get_f = @file("http://script.starpass.fr/check_php.php?ident={$ident}&codes={$codes}&DATAS={$datas}");
     if (!$get_f) {
         exit("Votre serveur n'a pas accès au serveur de StarPass, merci de contacter votre hébergeur. ");
     }
     $tab = explode("|", $get_f[0]);
     if (!$tab[1]) {
         $url = "http://script.starpass.fr/error.php";
     } else {
         $url = $tab[1];
     }
     $pays = $tab[2];
     $palier = urldecode($tab[3]);
     $id_palier = urldecode($tab[4]);
     $type = urldecode($tab[5]);
     if (substr($tab[0], 0, 3) != "OUI") {
         $paymentResult = false;
     } else {
         $paymentResult = true;
     }
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($datas);
     if ($paymentResult) {
         $codeResult = "Réussi";
         if ($config["item_shop"]["rechargement"]["starpass"]["devise"] == \DeviseHelper::CASH) {
             $objAccount->setCash($objAccount->getCash() + $config["item_shop"]["rechargement"]["starpass"]["cash"]);
         } else {
             if ($config["item_shop"]["rechargement"]["starpass"]["devise"] == \DeviseHelper::MILEAGE) {
                 $objAccount->setMileage($objAccount->getMileage() + $config["item_shop"]["rechargement"]["starpass"]["cash"]);
             }
         }
         $em->persist($objAccount);
         $session->set("Cash", $objAccount->getCash());
         $session->set("Mileage", $objAccount->getMileage());
         $objLogsRechargement = new \Site\Entity\LogsRechargements();
         $objLogsRechargement->setIdCompte($objAccount->getId());
         $objLogsRechargement->setCompte($objAccount->getLogin());
         $objLogsRechargement->setEmailCompte($objAccount->getEmail());
         $objLogsRechargement->setCode($request->query->get("RECALL"));
         $objLogsRechargement->setNombreVamonaies($config["item_shop"]["rechargement"]["starpass"]["cash"]);
         $objLogsRechargement->setResultat($codeResult);
         $objLogsRechargement->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objLogsRechargement->setIp($this->ipAdresse);
         $em->persist($objLogsRechargement);
         $em->flush();
         $template = $this->objTwig->loadTemplate("emailItemShopRechargement.html5.twig");
         $result = $template->render(["compte" => $objAccount->getLogin(), "system" => "StarPass", "nombre" => $config["item_shop"]["rechargement"]["starpass"]["cash"], "devise" => $config["item_shop"]["rechargement"]["starpass"]["devise"], "identifiantRechargement" => $objLogsRechargement->getId()]);
         $subject = 'VamosMT2 - Rechargement de compte';
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
         if ($this->isConnected) {
             header('Location: ../../ItemShopRechargementTerm.php?result=1&id=' . $objLogsRechargement->getId() . '&isConnected=1');
             exit;
         } else {
             header('Location: ../../ItemShopRechargementTerm.php?result=1&id=' . $objLogsRechargement->getId() . '&isConnected=0');
             exit;
         }
     } else {
         $codeResult = "Mauvaise clès";
         $objLogsRechargement = new \Site\Entity\LogsRechargements();
         $objLogsRechargement->setIdCompte($objAccount->getId());
         $objLogsRechargement->setCompte($objAccount->getLogin());
         $objLogsRechargement->setEmailCompte($objAccount->getEmail());
         $objLogsRechargement->setCode($request->query->get("RECALL"));
         $objLogsRechargement->setResultat($codeResult);
         $objLogsRechargement->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objLogsRechargement->setIp($this->ipAdresse);
         $em->persist($objLogsRechargement);
         $em->flush();
         header('Location: ../../ItemShopRechargementTerm.php?result=0&Raison=ClesMauvaise&id=' . $objLogsRechargement->getId() . '');
         exit;
     }
 }
Ejemplo n.º 21
0
 public function run()
 {
     global $request;
     $cacheManager = \CacheHelper::getCacheManager();
     $intervalStat = \Encryption::decrypt($request->request->get("page"));
     if ($cacheManager->isExisting("arrStatistiques" . $intervalStat)) {
         $arrStatistiques = $cacheManager->get("arrStatistiques" . $intervalStat);
         echo $arrStatistiques;
     } else {
         $nombreCompte = \Account\AccountHelper::getAccountRepository()->statAccountCreate($intervalStat);
         if ($intervalStat < 4) {
             $nombrePlayer = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat);
             $nombrePlayerHomme = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [0, 2, 5, 7]);
             $nombrePlayerFemme = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [1, 3, 4, 6]);
             $nombrePlayerShinsoo = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, "", [1]);
             $nombrePlayerChunjo = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, "", [2]);
             $nombrePlayerJinno = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, "", [3]);
             $nombrePlayerGuerrier = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [0, 4]);
             $nombrePlayerSura = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [2, 6]);
             $nombrePlayerNinja = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [1, 5]);
             $nombrePlayerShaman = \Site\SiteHelper::getLogsCreationJoueursRepository()->statPlayerCreate($intervalStat, [3, 7]);
         } else {
             $nombrePlayer = \Player\PlayerHelper::getPlayerRepository()->statPlayer();
             $nombrePlayerHomme = \Player\PlayerHelper::getPlayerRepository()->statPlayer([0, 2, 5, 7]);
             $nombrePlayerFemme = \Player\PlayerHelper::getPlayerRepository()->statPlayer([1, 3, 4, 6]);
             $nombrePlayerShinsoo = \Player\PlayerHelper::getPlayerRepository()->statPlayer("", [1]);
             $nombrePlayerChunjo = \Player\PlayerHelper::getPlayerRepository()->statPlayer("", [2]);
             $nombrePlayerJinno = \Player\PlayerHelper::getPlayerRepository()->statPlayer("", [3]);
             $nombrePlayerGuerrier = \Player\PlayerHelper::getPlayerRepository()->statPlayer([0, 4]);
             $nombrePlayerSura = \Player\PlayerHelper::getPlayerRepository()->statPlayer([2, 6]);
             $nombrePlayerNinja = \Player\PlayerHelper::getPlayerRepository()->statPlayer([1, 5]);
             $nombrePlayerShaman = \Player\PlayerHelper::getPlayerRepository()->statPlayer([3, 7]);
         }
         $nombreConnexion = \Site\SiteHelper::getLogsConnexionRepository()->statConnexions($intervalStat, 1);
         $nombreConnexionUnique = \Site\SiteHelper::getLogsConnexionRepository()->statConnexions($intervalStat, 1, true);
         $nombreMailChangement = \Site\SiteHelper::getLogsChangementMailRepository()->statChangementMails($intervalStat);
         $nombreOublieMotDePasse = \Site\SiteHelper::getLogsOublieMotDePasseRepository()->statOublieMotDePasse($intervalStat, 1);
         $nombreChangementMotDePasse = \Site\SiteHelper::getLogsChangementPasswordRepository()->statChangementMotDePasse($intervalStat);
         $nombreChangementCodeEntrepot = \Site\SiteHelper::getLogsChangementCodeEntrepotRepository()->statChangementCodeEntrepot($intervalStat);
         $nombreDeblocageYang = \Site\SiteHelper::getLogsDeblocageYangsRepository()->statDeblocageYangs($intervalStat);
         $nombreVote = \Site\SiteHelper::getVotesLogsRepository()->statVotes($intervalStat);
         $nombreAchatMarche = \Site\SiteHelper::getLogsMarcheAchatsRepository()->statMarcheAchats($intervalStat);
         $nombreDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->statDiscussions($intervalStat, false);
         $nombreDiscussionArchive = \Site\SiteHelper::getSupportDiscussionsRepository()->statDiscussions($intervalStat, true);
         $nombreMessage = \Site\SiteHelper::getSupportMessagesRepository()->statMessages($intervalStat);
         $nombreProvenanceFR = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "FRA");
         $nombreProvenanceCH = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "CHE");
         $nombreProvenanceGB = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "GBR");
         $nombreProvenanceDE = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "DEU");
         $nombreProvenanceRO = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "ROM");
         $nombreProvenanceUS = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "USA");
         $nombreProvenanceIT = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "ITA");
         $nombreProvenanceES = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "ESP");
         $nombreProvenancePL = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "POL");
         $nombreProvenancePT = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "PRT");
         $nombreProvenanceTN = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "TUN");
         $nombreProvenanceDZ = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "DZA");
         $nombreProvenanceJP = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "JPN");
         $nombreProvenanceBE = \Account\AccountHelper::getAccountRepository()->statProvenance($intervalStat, "BEL");
         $Tableau_Json = array('comptes' => "" . $nombreCompte, 'joueurs' => "" . $nombrePlayer, 'hommes' => "" . $nombrePlayerHomme, 'femmes' => "" . $nombrePlayerFemme, 'shinsoo' => "" . $nombrePlayerShinsoo, 'chunjo' => "" . $nombrePlayerChunjo, 'jinno' => "" . $nombrePlayerJinno, 'guerriers' => "" . $nombrePlayerGuerrier, 'suras' => "" . $nombrePlayerSura, 'ninjas' => "" . $nombrePlayerNinja, 'shamans' => "" . $nombrePlayerShaman, 'connexion_site' => "" . $nombreConnexion, 'connexion_site_unique' => "" . $nombreConnexionUnique, 'changement_mail' => "" . $nombreMailChangement, 'recup_mdp' => "" . $nombreOublieMotDePasse, 'changement_mdp' => "" . $nombreChangementMotDePasse, 'changement_entrepot' => "" . $nombreChangementCodeEntrepot, 'deblocage_yangs' => "" . $nombreDeblocageYang, 'nombre_vote' => "" . $nombreVote, 'nombre_achats_perso' => "" . $nombreAchatMarche, 'tickets_ouvert' => "" . $nombreDiscussion, 'message_ecrits' => "" . $nombreMessage, 'discussion_archives' => "" . $nombreDiscussionArchive, 'pays_fr' => "" . $nombreProvenanceFR, 'pays_ch' => "" . $nombreProvenanceCH, 'pays_gb' => "" . $nombreProvenanceGB, 'pays_de' => "" . $nombreProvenanceDE, 'pays_ro' => "" . $nombreProvenanceRO, 'pays_us' => "" . $nombreProvenanceUS, 'pays_it' => "" . $nombreProvenanceIT, 'pays_es' => "" . $nombreProvenanceES, 'pays_pl' => "" . $nombreProvenancePL, 'pays_pt' => "" . $nombreProvenancePT, 'pays_tn' => "" . $nombreProvenanceTN, 'pays_dz' => "" . $nombreProvenanceDZ, 'pays_jp' => "" . $nombreProvenanceJP, 'pays_be' => "" . $nombreProvenanceBE);
         echo json_encode($Tableau_Json);
         $cacheManager->set("arrStatistiques" . $intervalStat, json_encode($Tableau_Json), 21600);
     }
 }
Ejemplo n.º 22
0
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idAccount = $request->request->get("accountId");
     $banRaison = $request->request->get("banRaison");
     $banDuree = $request->request->get("banDuree");
     $banCommentaire = $request->request->get("banCommentaire");
     $withBanEmail = $request->request->get("withBanEmail");
     $withBanIp = $request->request->get("withBanIp");
     $arrObjAccount = [];
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($idAccount);
     if ($objAccount !== null) {
         array_push($arrObjAccount, $objAccount);
     }
     if ($this->HaveTheRight(\DroitsHelper::BANNISSEMENT_EMAIL)) {
         if ($withBanEmail !== null && $withBanEmail == "true") {
             $arrBanEmail = \Account\AccountHelper::getAccountRepository()->findAccountByEmail($objAccount->getEmail());
             if (count($arrBanEmail) > 0) {
                 foreach ($arrBanEmail as $banEmail) {
                     array_push($arrObjAccount, $banEmail);
                 }
             }
         }
     }
     if ($this->HaveTheRight(\DroitsHelper::BANNISSEMENT_IP)) {
         if ($withBanIp !== null && $withBanIp == "true") {
             $arrBanIp = \Account\AccountHelper::getAccountRepository()->findByIpCreation($objAccount->getIpCreation());
             if (count($arrBanIp) > 0) {
                 foreach ($arrBanIp as $banIp) {
                     array_push($arrObjAccount, $banIp);
                 }
             }
         }
     }
     $arrObjAccount = array_unique($arrObjAccount, SORT_REGULAR);
     foreach ($arrObjAccount as $objAccount) {
         $libelleRaison = \BanRaisonHelper::getLibelle($banRaison);
         $estDefinitif = false;
         if ($banDuree == 0) {
             $estDefinitif = true;
         }
         $objAccount->setStatus(\StatusHelper::BANNI);
         $em->persist($objAccount);
         $dateDebutBanissement = \Carbon\Carbon::now();
         $dateFinBanissement = \Carbon\Carbon::now()->addDay($banDuree);
         $objBanissementActifs = new \Site\Entity\BannissementsActifs();
         $objBanissementActifs->setIdCompte($objAccount->getId());
         $objBanissementActifs->setRaisonBannissement($banRaison);
         $objBanissementActifs->setCommentaireBannissement($banCommentaire);
         $objBanissementActifs->setIdCompteGm($this->objAccount->getId());
         $objBanissementActifs->setIpGm($this->ipAdresse);
         $objBanissementActifs->setDuree($banDuree);
         $objBanissementActifs->setDateDebutBannissement($dateDebutBanissement);
         $objBanissementActifs->setDateFinBannissement($dateFinBanissement);
         $objBanissementActifs->setDefinitif($estDefinitif);
         $em->persist($objBanissementActifs);
         $em->flush();
         $template = $this->objTwig->loadTemplate("BanissementCompte.html5.twig");
         $resultTemplate = $template->render(["compte" => $objAccount->getLogin(), "definitif" => $estDefinitif, "raison" => $libelleRaison]);
         $subject = 'VamosMt2 - Bannissement de ' . $objAccount->getLogin() . '';
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $resultTemplate);
     }
     $result = array('result' => true, 'reasons' => "");
     echo json_encode($result);
 }