diff options
Diffstat (limited to 'beta_old1/app/include/ju.inc.php')
-rw-r--r-- | beta_old1/app/include/ju.inc.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/beta_old1/app/include/ju.inc.php b/beta_old1/app/include/ju.inc.php index 49f0322..75fb4ee 100644 --- a/beta_old1/app/include/ju.inc.php +++ b/beta_old1/app/include/ju.inc.php @@ -3,6 +3,9 @@ function traiter_formulaire_popfichier() { require("include/ludo/config.inc.php"); $file = "fichier"; + if ( isset($CONFIG['UPLOAD']['relative_path']) ) { $basepath=$CONFIG['UPLOAD']['relative_path']; } else { $basepath='fichiers/';} + $basepath=$_SERVER['DOCUMENT_ROOT'].'/'.$basepath; + if(isset($_FILES[$file])) { if($_FILES[$file]["error"] == 0) @@ -12,12 +15,13 @@ function traiter_formulaire_popfichier() $ext = array_pop($ext); if(is_numeric(array_search(strtolower($ext), $CONFIG["UPLOAD"]["accepted_files"]))) { - if(!file_exists($_SERVER['DOCUMENT_ROOT']."/fichiers/"."r".$_GET["idR"]."_".$_FILES[$file]["name"])) + $filepath=$basepath."r".$_GET["idR"]."_".$_FILES[$file]["name"]; + if(!file_exists($filepath)) { - if(move_uploaded_file($_FILES[$file]["tmp_name"], $_SERVER['DOCUMENT_ROOT']."/fichiers/"."r".$_GET["idR"]."_".$_FILES[$file]["name"])) + if(move_uploaded_file($_FILES[$file]["tmp_name"], $filepath)) { - if(isset($debug)) echo "DEBUG :".$_SERVER['DOCUMENT_ROOT']."/fichiers/\n"; - $requete = "INSERT INTO Fichier(nomFic, idR) VALUES ('"."r".$_GET["idR"]."_".$_FILES[$file]["name"]."', '".$_GET["idR"]."')"; + if(isset($debug)) echo "DEBUG : basepath==$basepath\n"; + $requete = "INSERT INTO AWOR_Fichier(nomFic, idR) VALUES ('"."r".$_GET["idR"]."_".$_FILES[$file]["name"]."', '".$_GET["idR"]."')"; if(mysql_query($requete) == false) { if(isset($debug)) echo "DEBUG : ".mysql_error()."<br/>\n"; @@ -44,7 +48,7 @@ function traiter_formulaire_popfichier() { switch($_FILES[$file]["error"]) { - case 1 : return "Erreur : Le fichier a une taille trop importante."; break; + case 1 : case 2 : return "Erreur : Le fichier a une taille trop importante."; break; case 3 : return "Erreur : Le fichier n'a pas ete envoye en entier."; break; case 4 : return "Erreur : Aucun fichier recu."; break; @@ -61,7 +65,10 @@ function traiter_formulaire_popfichier() function generate_html_reunion_fichiers($idR) { - $requete = "SELECT * FROM Fichier WHERE idR = '".$idR."'"; + require("include/ludo/config.inc.php"); + if ( isset($CONFIG['UPLOAD']['relative_path']) ) { $basepath='/'.$CONFIG['UPLOAD']['relative_path']; } else { $basepath='/fichiers/';} + + $requete = "SELECT * FROM AWOR_Fichier WHERE idR = '".$idR."'"; $resultat = mysql_query($requete); if($resultat != false) { @@ -75,7 +82,7 @@ function generate_html_reunion_fichiers($idR) { while($fichier = mysql_fetch_array($resultat)) { - echo "<tr><td><a href=\"../fichiers/".$fichier["nomFic"]."\" target=\"_blank\" >".$fichier["nomFic"]."</a></td></tr>\n"; + echo '<tr><td><a href="' . $basepath . $fichier["nomFic"].'" target="_blank" >'.$fichier["nomFic"]."</a></td></tr>\n"; } } else @@ -129,8 +136,8 @@ function traiter_formulaire_valider_creneau() if(isset($debug)) echo $listeCreneau; //On recupere les creneaux ne faisant plus partie de la novuelle liste des creneaux - $requete = "SELECT * FROM Creneau WHERE idR='".$_REQUEST["idR"]."' AND idC NOT IN ".$listeCreneau; - echo $requete; + $requete = "SELECT * FROM AWOR_Creneau WHERE idR='".$_REQUEST["idR"]."' AND idC NOT IN ".$listeCreneau; + //echo "DEBUG : $requete"; if($resultat = mysql_query($requete)) { while($ligne = mysql_fetch_array($resultat)) @@ -143,7 +150,7 @@ function traiter_formulaire_valider_creneau() function traiter_formulaire_maj_profil() { - $requete = "UPDATE Personne SET courrielP = '".$_POST["courrielP"]."', loginP = '".$_POST["loginP"]."', nomP = '".$_POST["nomP"]."', prenomP = '".$_POST["prenomP"]."', methodeAuth = '".$_POST["methodeAuth"]."' WHERE idP = '".$_SESSION['session_idP']."'"; + $requete = "UPDATE AWOR_Personne SET courrielP = '".$_POST["courrielP"]."', loginP = '".$_POST["loginP"]."', nomP = '".$_POST["nomP"]."', prenomP = '".$_POST["prenomP"]."', methodeAuth = '".$_POST["methodeAuth"]."' WHERE idP = '".$_SESSION['session_idP']."'"; if(mysql_query($requete) == false) return "Une erreur MySQL est survenu : ".mysql_error(); $_SESSION['session_prenomP'] = $_POST["prenomP"]; $_SESSION['session_nomP'] = $_POST["nomP"]; @@ -157,14 +164,14 @@ function ajouterCreneau($idR, $heureD, $minD, $heureA, $minA, $jourA, $moisA, $a $duree = $dateA - $dateD; $dateD = date("Y-m-d G:i:s", $dateD); $duree = $duree / 60; - $requete = "INSERT INTO Creneau (dateHeure, duree, idR) VALUES ('".$dateD."', '".$duree."', '".$idR."')"; + $requete = "INSERT INTO AWOR_Creneau (dateHeure, duree, idR) VALUES ('".$dateD."', '".$duree."', '".$idR."')"; if(isset($debug)) echo $requete."<br/>"; if(mysql_query($requete)) { return mysql_insert_id(); } else { return false; } } function ajouterCreneau2($idR, $dateHeure, $duree) { - $requete = "INSERT INTO Creneau (dateHeure, duree, idR) VALUES ('".$dateHeure."', '".$duree."', '".$idR."')"; + $requete = "INSERT INTO AWOR_Creneau (dateHeure, duree, idR) VALUES ('".$dateHeure."', '".$duree."', '".$idR."')"; if(mysql_query($requete)) { return mysql_insert_id(); @@ -177,9 +184,9 @@ function ajouterCreneau2($idR, $dateHeure, $duree) function supprimerCreneau($idC) { - if(mysql_query("DELETE FROM Creneau WHERE idC='".$idC."'")) + if(mysql_query("DELETE FROM AWOR_Creneau WHERE idC='".$idC."'")) { - if(mysql_query("DELETE FROM Choisir WHERE idC='".$idC."'")) + if(mysql_query("DELETE FROM AWOR_Choisir WHERE idC='".$idC."'")) { return true; } @@ -201,7 +208,7 @@ function creneauExiste($idR, $heureD, $minD, $heureA, $minA, $jourA, $moisA, $an $duree = $dateA - $dateD; $dateD = date("Y-m-d G:i:s", $dateD); $duree = $duree / 60; - $requete = "SELECT * FROM Creneau WHERE idR='".$idR."' AND dateHeure='".$dateD."' AND duree=".$duree.""; + $requete = "SELECT * FROM AWOR_Creneau WHERE idR='".$idR."' AND dateHeure='".$dateD."' AND duree=".$duree.""; if($result = mysql_query($requete)) { if(mysql_num_rows($result) > 0) |