From 679551b7b545a72d376d9e60a8f3da66e44a6855 Mon Sep 17 00:00:00 2001
From: Ludovic Pouzenc <ludovic@pouzenc.fr>
Date: Sat, 30 Jun 2018 10:06:47 +0200
Subject: Version alpha_old2 2007-02-04+10:57:50 - 2007-02-21+19:05:18

---
 appli_3_alpha_old/include/connect.inc.php          |   6 +-
 appli_3_alpha_old/include/connect_free.inc.php     |  14 +++
 appli_3_alpha_old/include/je.inc.php               | 107 ++++++++++++------
 appli_3_alpha_old/include/ju.inc.php               | 123 +++++++++++++--------
 appli_3_alpha_old/include/ludo/TODO_list.txt~      |  19 ----
 appli_3_alpha_old/include/ludo/fonctions.inc.php   |   3 +-
 appli_3_alpha_old/include/ludo/mail_textarea.php   |   5 +-
 .../include/ludo/session_verify.inc.php            |   3 +-
 8 files changed, 171 insertions(+), 109 deletions(-)
 create mode 100644 appli_3_alpha_old/include/connect_free.inc.php
 delete mode 100644 appli_3_alpha_old/include/ludo/TODO_list.txt~

(limited to 'appli_3_alpha_old/include')

diff --git a/appli_3_alpha_old/include/connect.inc.php b/appli_3_alpha_old/include/connect.inc.php
index be96c02..b985b10 100644
--- a/appli_3_alpha_old/include/connect.inc.php
+++ b/appli_3_alpha_old/include/connect.inc.php
@@ -3,12 +3,12 @@
  * Param�tres de connexion � la base MySQL
  */
  
-// $bd repr�sente le nom de la database � utiliser
+// $bd repr�sente le nom de la database � utiliser
 $bd = "awor";
-// mysql_connect(<nom_ou_ip_serveur_mysql>, <utilisateur_mysql>, <mot_de_passe_en_clair_mysql>);
+// mysql_connect(<nom_ou_ip_serveur_mysql>, <utilisateur_mysql>, <mot_de_passe_en_clair_mysql>);
 $link = @mysql_connect('localhost', 'lud_restricted', 'maille_ess_ku_elle');
 
 @mysql_select_db($bd , $link);
 
-// NB : La gestion d'erreur est inhib�e. Cet include ne g�n�rera jamais de code, m�me si la connexion n'a pas pu �tre �tablie
+// NB : La gestion d'erreur est inhib�e. Cet include ne g�n�rera jamais de code, m�me si la connexion n'a pas pu �tre �tablie
 ?>
\ No newline at end of file
diff --git a/appli_3_alpha_old/include/connect_free.inc.php b/appli_3_alpha_old/include/connect_free.inc.php
new file mode 100644
index 0000000..644b36b
--- /dev/null
+++ b/appli_3_alpha_old/include/connect_free.inc.php
@@ -0,0 +1,14 @@
+<?php 
+/*
+ * Param�tres de connexion � la base MySQL
+ */
+ 
+// $bd repr�sente le nom de la database � utiliser
+$bd = "awor";
+// mysql_connect(<nom_ou_ip_serveur_mysql>, <utilisateur_mysql>, <mot_de_passe_en_clair_mysql>);
+$link = @mysql_connect('localhost', 'awor', 'blagnac');
+
+@mysql_select_db($bd , $link);
+
+// NB : La gestion d'erreur est inhib�e. Cet include ne g�n�rera jamais de code, m�me si la connexion n'a pas pu �tre �tablie
+?>
\ No newline at end of file
diff --git a/appli_3_alpha_old/include/je.inc.php b/appli_3_alpha_old/include/je.inc.php
index cb80df0..b5a7672 100644
--- a/appli_3_alpha_old/include/je.inc.php
+++ b/appli_3_alpha_old/include/je.inc.php
@@ -1,7 +1,9 @@
 <?php
+require_once ('include/connect.inc.php');
+
 	function traiter_formulaire_valider_modif_personnes()
 	{
-		require_once ('include/connect.inc.php');
+
 		$result = mysql_query("SELECT P.idP,P.courrielP FROM Appartenir A, Personne P WHERE P.idP = A.idP AND A.idL=".$_GET['idL']);
 		if (mysql_num_rows($result)>=0)
 		{
@@ -16,65 +18,102 @@
 				$tabOldPers[$i] = $row[0];
 				$tabOldPersMail[$i] = $row[1];
 			}			
-			//Boucle permettant de suprimer les �lements identiques aux deux tableaux
+			//Boucle permettant de mettre a NULL les �lements identiques aux deux tableaux
 			$i = 0;
 			while ($i < count($tabOldPers))
 			{
 				$exist=false;
 				for ($j=0;$j<count($tabNewPers);$j++)
 				{
-					echo $tabOldPers[$i] . "==<b>" . $tabNewPers[$j] . "</b>OU " . $tabOldPersMail[$i] . "==<b>" . $tabNewPers[$j] . "</b>->" ;
-					echo "<i>" . (($tabOldPers[$i] == $tabNewPers[$j]) or ($tabOldPersMail[$i] == $tabNewPers[$j])) . "</i><br/>";
-					
 					if (($tabOldPers[$i] == $tabNewPers[$j]) or ($tabOldPersMail[$i] == $tabNewPers[$j]))  
 					{
 						$exist = true;
-						print_r($tabNewPers);
 						$tabNewPers[$j]=NULL;
-						echo "<br/>";
-						print_r($tabNewPers);
-						echo "<br/>";
 					}
 				}
 				if ($exist)
 				{
-				/*
-					$tabOldPers[$i] = $tabOldPers[(count($tabOldPers)-1)];unset($tabOldPers[(count($tabOldPers)-1)]);
-					$tabOldPersMail[$i] = $tabOldPersMail[(count($tabOldPersMail)-1)];unset($tabOldPersMail[(count($tabOldPersMail)-1)]);
-					}
-					else
-					{i++;}
-				*/
-				$tabOldPers[$i]=NULL;
-				$tabOldPersMail[$i]=NULL;
+					$tabOldPers[$i]=NULL;
+					$tabOldPersMail[$i]=NULL;
 				}
 				$i++;
 			}
-			//Tableau permet de savoir qui doit etre supprimer et ajouter
-			echo "--TabOldPers--<br/>";			
-			print_r ($tabOldPers);
-			//for ($i=0;$i<(int)$sizeTabOldPers;$i++) echo "<br/> - " . $tabOldPers[$i];
-			echo "<br/>--TabNewPers--<br/>";
-			print_r ($tabNewPers);
-			//for ($i=0;$i<(int)$sizeTabNewPers;$i++) echo " - " . $tabNewPers[$i] ."<br/>";
 		}
-		/*		
-		for ($i=0;$i<count($_GET['dataParticipants']); $i++)
+		
+		//Construction du tableau des participants a ajouter
+		$tabAdd = array();
+		foreach ($tabNewPers as $pers)
 		{
-			if (!stristr($_GET['dataParticipants'][$i],'@')===false)
+			//Si c'est une adresse Mail : Inscription + Ajout Sinon Ajour simplement
+			if (!stristr($pers,'@')===false)
 			{
-				echo "Nouvel inscrit : ".$_GET['dataParticipants'][$i];
+				$tabAdd[] = new_pers($pers);
 			}
+			else
+			{
+				if ($pers != NULL)	$tabAdd[] = $pers;
+			} 
+		}
+		//Enleve les redondances d'idP
+		$tabAdd=array_unique($tabAdd);
+		//Envoie a la fonction d'ajout de personne
+		list_add_pers($tabAdd,$_GET['idL']);
+		
+		//Construction du tableau des participants a ajouter
+		$tabRemove = array();
+		foreach ($tabOldPers as $pers)
+		{
+			if ($pers != NULL)	$tabRemove[] = $pers;
+		}
+		//Envoie a la fonction de suppression de personne
+		list_remove_pers($tabRemove,$_GET['idL']);
+		
+	}
+	
+	function list_add_pers ($tabPers,$idL)
+	{
+		foreach ($tabPers as $pers)
+		{
+			$result=mysql_query("INSERT INTO Appartenir (idP,idL) VALUES ($pers,$idL);");
+		}
+
+	}
+	
+	function list_remove_pers ($tabPers,$idL)
+	{
+		
+		foreach ($tabPers as $pers)
+		{
+			$result = mysql_query("DELETE FROM Appartenir WHERE idP=$pers AND idL=$idL;");
+		}
+		
+	}
+	
+	
+	//Fonction Inscription qui prends en parametre une adresse mail $persMail et qui retourne l'id de la perssonne (s'il elle existe) 
+	// ou Insert une personne et retourne son identifiant
+	function new_pers ($persMail)
+	{
+		$result = mysql_query("SELECT idP,courrielP FROM Personne WHERE courrielP = '$persMail'");
+		if (mysql_num_rows($result)>0)
+		{
+			$row = mysql_fetch_array($result);
+			return ($row['idP']);
+		}
+		else
+		{
+			$result = mysql_query("INSERT INTO Personne (courrielP,loginP) VALUES ('$persMail','$persMail')");
+			return (mysql_insert_id($result));
 		}
-		*/
+			
+		return (0);
 	}
 	
+	
+	
 	//Fonction qui affiche toutes les liste public ainsi que les liste priv�e poss�d�es par idP
 	function generate_html_array_list ($idP)
 	{
-		
-		// Connexion � la base et s�lection de la database
-		require_once ('include/connect.inc.php');
 		$result = mysql_query("SELECT idL,libelleL,estPrivee FROM Liste WHERE idP_Createur=$idP OR estPrivee='non' ORDER BY estPrivee");
 		echo "<table>\n<tr>\n<th>Type</th>\n<th>Libell&eacute;</th>\n</tr>\n";	
 		if (mysql_num_rows($result)>0)
@@ -86,7 +125,7 @@
 				echo "<tr>\n<td>";
 				if ($row['estPrivee'] == 'oui') echo 'Priv&eacute;e' ; else echo 'Public';
 				echo "</td>\n<td>";
-				echo "<a href=\"#\" onclick=\"loadid('poppersonne.php?idL=".$row['idL']."&amp;idP_orga=$idP','poppersonne',true);popon('poppersonne')\" \>";
+				echo "<a href=\"#\" onclick=\"loadid('poppersonne.php?idL=".$row['idL']."&amp;idP_orga=$idP','poppersonne',true);popon('poppersonne')\">";
 				echo $row['libelleL'];
 				echo "</a>\n";
 				echo "</td>\n</tr>\n";
diff --git a/appli_3_alpha_old/include/ju.inc.php b/appli_3_alpha_old/include/ju.inc.php
index 1a03ca9..7f52bea 100644
--- a/appli_3_alpha_old/include/ju.inc.php
+++ b/appli_3_alpha_old/include/ju.inc.php
@@ -1,53 +1,87 @@
 <?php
-	function traiter_formulaire_cequetuveux_aussi()
-	{
-		echo "coucou\n";
-	}
+function traiter_formulaire_cequetuveux_aussi()
+{
+	echo "coucou\n";
+}
 	
-	function generate_html_reunion_commentaires($idR)
+function generate_html_reunion_commentaires($idR)
+{
+	$requete = "SELECT * FROM Repondre WHERE idP != '".$_SESSION['idP']."' AND idR = '".$idR."'";
+	$resultat = mysql_query($requete);
+	if($resultat != false)
 	{
-?>
-	<table cellspacing="0" class="commentaires">
-		<thead>
-			<tr>
-				<th>Commentaires <a href="#">(Editer votre commentaire)</a></th>
-			</tr>
-		</thead>
-		<tr>
-			<td>Ludo : J'ai mont&eacute; le DC sur lequel sera bas&eacute; le SNI</td>
-		</tr>
-		<tr>
-			<td>J&eacute;r&eacute;mie : J'ai fais une premi&egrave;re ebauche du DC</td>
-		</tr>
-	</table>
-<?php
+		if(mysql_num_rows($resultat) > 0)
+		{
+			echo '<table cellspacing="0" class="commentaires">';
+			echo '<thead>';
+			echo '<tr>';
+			echo '<th>Commentaires <a href="#">(Editer votre commentaire)</a></th>';
+			echo '</tr>';
+			echo '</thead>';
+			while($commentaire = mysql_fetch_array($resultat));
+			{
+				if(isset($_SESSION["PrenomP"]))
+				{
+					$nom = $_SESSION["PrenomP"];
+				}
+				else
+				{
+					$nom = $commentaire["idP"];
+				}
+				echo "<tr><td>".$nom." : ".$commentaire["commentaireReponse"]."</td></tr>\n";
+			}
+			echo '</table>';
+		}
 	}
+}
 	
-	
-	function generate_html_reunion_fichiers($idR)
+function generate_html_reunion_fichiers($idR)
+{
+	$requete = "SELECT * FROM Repondre WHERE idP != '".$_SESSION['idP']."' AND idR = '".$idR."'";
+	$resultat = mysql_query($requete);
+	if($resultat != false)
 	{
-?>
-<table cellspacing="0" class="fichiers">
-	<thead>
-		<tr>
-			<th>Fichiers attach&eacute;s <a href="#popfichier" class="pop">(Ajouter un fichier)</a></th>
-		</tr>
-	</thead>
-	<tr>
-		<td><a href="compte-rendu.txt">compte-rendu.txt</a></td>
-	</tr>
-	<tr>
-		<td><a href="photos-ru.jpg">photos-ru.jpg</a></td>
-	</tr>
-</table>
-<?php
+		if(mysql_num_rows($resultat) > 0)
+		{
+			echo '<table cellspacing="0" class="commentaires">';
+			echo '<thead>';
+			echo '<tr>';
+			echo '<th>Commentaires <a href="#">(Editer votre commentaire)</a></th>';
+			echo '</tr>';
+			echo '</thead>';
+			while($commentaire = mysql_fetch_array($resultat))
+			{
+				if(isset($_SESSION["PrenomP"]))
+				{
+					$nom = $_SESSION["PrenomP"];
+				}
+				else
+				{
+					$nom = $commentaire["idP"];
+				}
+				echo "<tr><td>".$nom." : ".$commentaire["commentaireReponse"]."</td></tr>\n";
+			}
+			echo '</table>';
+		}
 	}
+	echo '<table cellspacing="0" class="fichiers">';
+	echo '<thead>';
+	echo '<tr>';
+	echo '<th>Fichiers attach&eacute;s <a href="#popfichier" class="pop">(Ajouter un fichier)</a></th>';
+	echo '</tr>';
+	echo '</thead>';
+	echo '<tr>';
+	echo '<td><a href="compte-rendu.txt">compte-rendu.txt</a></td>';
+	echo '</tr>';
+	echo '<tr>';
+	echo '<td><a href="photos-ru.jpg">photos-ru.jpg</a></td>';
+	echo '</tr>';
+	echo '</table>';
+}
 
-	
-	function generate_html_reunion_detail($idR)
-	{
-?>
-	<table cellspacing="0" class="detail_reunion">
+function generate_html_reunion_detail($idR)
+{
+	echo '<table cellspacing="0" class="detail_reunion">
 		<thead>
 			<tr>
 				<th>D&eacute;tails de la r&eacute;union </th>
@@ -74,7 +108,6 @@
 			<td><strong>Remarque :</strong></td>
 			<td>aucune</td>
 		</tr>
-	</table>
-<?php
-	}
+	</table>';
+}
 ?>
\ No newline at end of file
diff --git a/appli_3_alpha_old/include/ludo/TODO_list.txt~ b/appli_3_alpha_old/include/ludo/TODO_list.txt~
deleted file mode 100644
index 9d5b2f5..0000000
--- a/appli_3_alpha_old/include/ludo/TODO_list.txt~
+++ /dev/null
@@ -1,19 +0,0 @@
-mysql_free_result après les requetes et mysql_close ?
-
-
-Vérifier que les redirections vers authentification et le retour fasse bien suivre les paramètres
---> bookmarque details_reunion?idR=1
- 	 
-
-faire une fonction JS qui appelle une page php ou créer toute seule un cookie qui gère la préférence du css.
-
-Se préoccuper des accents et des encodages de pages !
-
-Faire un pied de page avec nos noms, et les logos valide XHTML, CSS...
-
-TODO : un script php qui purge la base
--> export SQL ancienne base ?
--> suppression des réunions plus vielles que...
--> suppression des Personnes n'ayant jamais changé leur profil et n'ayant plus de réunion les concernant
--> suppression de tout les créneaux non référencés
--> suppression de toutes les listes privées obsoletes
diff --git a/appli_3_alpha_old/include/ludo/fonctions.inc.php b/appli_3_alpha_old/include/ludo/fonctions.inc.php
index 2914d50..af1931d 100644
--- a/appli_3_alpha_old/include/ludo/fonctions.inc.php
+++ b/appli_3_alpha_old/include/ludo/fonctions.inc.php
@@ -287,8 +287,7 @@ function generate_html_array_personnes_crenaux($idR, $idP_Self)
 		}
 	}
 	echo "			</tbody>\n";
-	echo "			input name=\"idR\" value=\"$idR\" type=\"hidden\"\n";
-	echo "		</form>	</table>\n";
+	echo "		</form>\n	</table>\n";
 }
 
 ?>
\ No newline at end of file
diff --git a/appli_3_alpha_old/include/ludo/mail_textarea.php b/appli_3_alpha_old/include/ludo/mail_textarea.php
index c9a01eb..58292d6 100644
--- a/appli_3_alpha_old/include/ludo/mail_textarea.php
+++ b/appli_3_alpha_old/include/ludo/mail_textarea.php
@@ -1,9 +1,7 @@
 <?php
 require_once('session_verify.inc.php');
 include('config.inc.php');
-//~ require_once('/home/lud/shares/public_html/awor/appli_3_alpha/include/connect.inc.php');
-
-//include('include/connect.inc.php');
+require_once('/home/lud/shares/public_html/awor/appli_3_alpha/include/connect.inc.php');
 
 if ( isset($_GET['model']) ) { $model=$_GET['model']; } else { $model='empty'; }
 ?>
@@ -12,7 +10,6 @@ if ( isset($_GET['model']) ) { $model=$_GET['model']; } else { $model='empty'; }
 <?php
 	if ( $model != 'empty')
 	{
-		include('../connect.inc.php');
 		if ( ! isset($CONFIG['MAIL']['TEMPLATES'][$model]['tpl_file']) )
 		{
 			echo 'D�sol�, mod�le indisponible...';
diff --git a/appli_3_alpha_old/include/ludo/session_verify.inc.php b/appli_3_alpha_old/include/ludo/session_verify.inc.php
index 0a9cfbb..63a5db6 100644
--- a/appli_3_alpha_old/include/ludo/session_verify.inc.php
+++ b/appli_3_alpha_old/include/ludo/session_verify.inc.php
@@ -1,9 +1,8 @@
 <?php
-require('redir.inc.php');
-
 session_start();
 if ( ! isset($_SESSION['loginP']) )
 {
+	require('redir.inc.php');
 	$dest='auth_dialog.php?retour=' . $_SERVER['PHP_SELF'];
 	html_redir($dest);
 }
-- 
cgit v1.2.3