public function run() { if (!empty($_POST['dino']) && !empty($_POST['dino'])) { $this->reprendrePlanUp($_POST['dino']); } if (!empty($_POST['nouveauDino']) && !empty($_POST['race'])) { Donnees::getInstance()->insererNouveauDino($_POST['nouveauDino'], $_POST['race'], $_SESSION['id']); } if (!empty($_POST['aSupprimer'])) { Donnees::getInstance()->deleteDino($_POST['aSupprimer']); } if (!empty($_POST['numeroDino']) && !empty($_POST['element'])) { $_SESSION['element'] = $_POST['element']; $dino = Donnees::getInstance()->getDinoUser($_POST['numeroDino']); $table = Db::getInstance()->select_toutcompetences($_POST['element'], $dino->getRace()); $funcname = "get" . ucfirst($_POST['element']); $competences_Acquises = $dino->{$funcname}(); $valeur = false; if (!empty($_POST['competences'])) { $valeur = true; $funcname = "set" . ucfirst($_POST['element']); $dino->{$funcname}($_POST['competences']); } if ($valeur) { Donnees::getInstance()->misAJour($dino); $_POST['numeroDino'] = null; $_POST['element'] = null; $dino = null; } } $dinos = Donnees::getInstance()->getDinosUser($_SESSION['id']); $nombreInscrits = Donnees::getInstance()->nombreInscrits($_SESSION['id']); require_once CHEMIN_VUES . 'gestion.php'; }
public function run() { $dino = Donnees::getInstance()->getDinoUser($_GET['dino']); $invocation = Db::getInstance()->invocation($dino->getRace()); $parents = ""; $elements = array('eau', 'feu', 'foudre', 'air', 'bois'); $doubles = Db::getInstance()->competencesDoubles(); $codeCouleur = array(); foreach ($doubles as $test) { if ($test->aLaCompetenceDisponible($dino) == true) { $codeCouleur[] = "acquis"; } elseif ($test->peutAvoirLaCompetence($dino) == true) { $codeCouleur[] = "encours"; } else { $codeCouleur[] = "nonacquis"; } } if (!empty($_POST)) { if ($_POST['comment']) { $reply = null; $text = trim(htmlentities($_POST['comment'])); if (!empty($_POST['edit'])) { $id = $_POST['edit']; } else { $id = Donnees::getInstance()->getLastNumberComment(); } if ($_POST['reply']) { $reply = $_POST['reply']; } $comment = new Commentaire($id, $_GET['dino'], $_SESSION['id'], $text, null, $reply); if (!empty($_POST['edit'])) { Donnees::getInstance()->editComment($comment); } else { Donnees::getInstance()->publishComment($comment); } } else { $notification = "Pas de message !"; } } $commentaires = Donnees::getInstance()->select_commentaires($_GET['dino'], !empty($_GET['page']) ? $_GET['page'] : '0'); require_once CHEMIN_VUES . 'dino.php'; require_once CHEMIN_VUES . 'commentaires.php'; }
public function run() { if (empty($_SESSION['id']) && empty($_GET['error'])) { if (empty($_GET['code'])) { header('Location: ' . $this->authorizationURL()); die; } else { $code = $_GET['code']; try { $donnees = $this->request($code); $donnees = $this->getInfos($donnees["access_token"]); Donnees::getInstance()->UserInformations($donnees); $_SESSION['user'] = $donnees["name"]; $_SESSION['photo'] = str_replace('//', 'http://', $donnees["picture"]["url"]); $_SESSION['id'] = $donnees["id"]; require_once CHEMIN_VUES . 'connexion.php'; } catch (Exception $e) { } } } else { require_once CHEMIN_VUES . 'connexion.php'; } }
public function select_commentaires($id, $page) { $sql = "SELECT * FROM `comments` WHERE dino_id = " . $id . " ORDER BY date ASC LIMIT "; if ($page != 0) { $chiffre = $page * 10 + 1; $sql = $sql . $chiffre; } else { $sql = $sql . $page; } $sql = $sql . "," . ($page + 1) * 10; $query = $this->_db->prepare($sql); $query->execute(); $tableau = array(); $dejainclus = array(); if ($query->rowCount() == 0) { return $tableau; } else { while ($row = $query->fetch()) { $competence = new Commentaire($row->comment_id, $row->dino_id, $row->user_id, $row->comment, $row->date, $row->response_comment_id); if (!in_array($competence, $dejainclus)) { $reponses = Donnees::getInstance()->select_reply($row->comment_id); $dejainclus = array_merge($dejainclus, $reponses); $tableau[] = array($competence, $reponses); } } return $tableau; } }
?> </p> </div> <ul class="<?php echo $commentaire[0]->getCommentId(); ?> "> <li></li> <?php if (count($commentaire) > 1) { ?> <?php foreach ($commentaire[1] as $reply) { ?> <?php $info = Donnees::getInstance()->getUser($reply->getUserId()); $chiffre = $commentaire[0]->getCommentId() + 1; ?> <li> <img class="img-circle img-responsive" height="125" width="125" src="<?php echo $info[1]; ?> " alt="avatar"> <div class="comment-text"> <cite><?php echo $info[0]; ?> </cite> le <?php echo DateTime::createFromFormat('Y-m-d', $commentaire[0]->getDate())->format('d/m/Y'); ?> <button class="glyphicon glyphicon-new-window reply" type="button" id="<?php
public function run() { if (!empty($_GET['stop']) && $_GET['stop'] == true) { $_SESSION['dino'] = null; } $table = array('feu', 'bois', 'air', 'eau', 'foudre'); $table2 = array('winks', 'sirain', 'kabuki', 'wanwan', 'moueffe', 'castivore', 'feross', 'nuagoz', 'planaille', 'pteroz', 'toufufu', 'gorilloz', 'pigmou', 'rocky', 'quetzu', 'soufflet', 'mahamuti', 'hippoclamp', 'santaz', 'smog'); if (!empty($_POST['race']) && in_array($_POST['race'], $table2)) { $race = $_POST['race']; $_SESSION['race'] = $_POST['race']; } if (!empty($_SESSION['id']) && !empty($_SESSION['dinoUser'])) { $dino = Donnees::getInstance()->getDinoUser($_SESSION['dinoUser']); if ($dino != null && in_array($dino->getRace(), $table2)) { $race = $dino->getRace(); $_SESSION['race'] = $dino->getRace(); $_SESSION['dino'] = $dino->getId(); $_SESSION['dinoUser'] = null; } } if (!empty($_POST['element']) && in_array($_POST['element'], $table)) { $element = $_POST['element']; $_SESSION['element'] = $_POST['element']; } if (!empty($element) && !empty($race)) { $table = Db::getInstance()->select_toutcompetences($_SESSION['element'], $_SESSION['race']); if (!empty($_SESSION['dino'])) { $funcname = "get" . ucfirst($_SESSION['element']); $competences_Acquises = Donnees::getInstance()->getDinoUser($_SESSION['dino'])->{$funcname}(); } } else { $table = ""; } if (!empty($_POST['mieux'])) { if (!empty($_POST['competences'])) { sort($_POST['competences'], SORT_NUMERIC); $competences = Db::getInstance()->select_competences($_POST['competences'], $_SESSION['element']); $correct = $this->isValid($competences); if ($correct) { if (!empty($_SESSION['dino'])) { $dino = Donnees::getInstance()->getDinoUser($_SESSION['dino']); $funcname = "set" . ucfirst($_SESSION['element']); $dino->{$funcname}($_POST['competences']); Donnees::getInstance()->misAJour($dino); $_SESSION['dino'] = null; } $competencesdispo = Db::getInstance()->select_competencesdispo($_SESSION['race'], $_SESSION['element'], $_POST['competences']); $tableau = array(); foreach ($competencesdispo as $element) { $tableau[] = $element->num(); } $conseil = Db::getInstance()->conseil($tableau, $_SESSION['race'], $_SESSION['element']); if ($conseil != false) { $meilleurUp = Db::getInstance()->meilleurUp($_SESSION['element'], $conseil); } } else { $error = true; $table = Db::getInstance()->select_toutcompetences($_SESSION['element'], $_SESSION['race']); } } else { $competencesdispo = Db::getInstance()->select_competencesdispo($_SESSION['race'], $_SESSION['element'], NULL); $tableau = array(); foreach ($competencesdispo as $element) { $tableau[] = $element->num(); } $conseil = Db::getInstance()->conseil($tableau, $_SESSION['race'], $_SESSION['element']); if ($conseil != false) { $meilleurUp = Db::getInstance()->meilleurUp($_SESSION['element'], $conseil); } } $compteur = 1; $parents = ""; $elements = array('eau', 'feu', 'foudre', 'air', 'bois'); $invocation = Db::getInstance()->invocation($_SESSION['race']); } $footer = "<img src=\"" . PATH_ABSOLUTE . "/views/images/Etapes/etape"; if (!empty($competencesdispo)) { $footer = $footer . "4.png\""; } elseif (!empty($table)) { $footer = $footer . "3.png\""; } elseif (!empty($race)) { $footer = $footer . "2.png\""; } else { $footer = $footer . "1.png\""; } $footer = $footer . " alt=\"Etapes\" class=\"img-responsive\"/>"; require_once CHEMIN_VUES . 'helper.php'; }
function chargerClasse($classe) { if (file_exists('models/' . $classe . '.class.php')) { require 'models/' . $classe . '.class.php'; } } spl_autoload_register('chargerClasse'); // Tester si une variable GET 'action' est précisée dans l'URL index.php?action=... $action = !empty($_GET['action']) ? htmlentities($_GET['action']) : 'default'; if ($action != 'info') { require_once CHEMIN_VUES . 'header.php'; } // Quelle action est demandée ? switch ($action) { case 'dino': if (is_numeric($_GET['dino']) && !empty(Donnees::getInstance()->getDinoUser($_GET['dino']))) { require_once 'controllers/DinoController.php'; $controller = new DinoController(); } break; case 'helper': require_once 'controllers/HelperController.php'; $controller = new HelperController(); break; case 'demon': require_once 'controllers/CalculDemonController.php'; $controller = new CalculDemonController(); break; case 'info': try { if (!empty($_GET['element']) && !empty($_GET['competence']) && is_numeric($_GET['competence']) && Db::getInstance()->select_competence($_GET['element'], $_GET['competence']) != null) {