Subversion Repositories eFlore/Applications.cel

Rev

Rev 1761 | Rev 1767 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1761 Rev 1765
Line 49... Line 49...
49
		{
49
		{
50
			foreach($ids_observations_liste as $observation)
50
			foreach($ids_observations_liste as $observation)
51
			{
51
			{
52
				$requete_creation_lien = 'INSERT INTO cel_obs_images (id_image, id_observation, date_liaison) '.
52
				$requete_creation_lien = 'INSERT INTO cel_obs_images (id_image, id_observation, date_liaison) '.
53
					   	 'VALUES '. 
53
					   	 'VALUES '. 
54
						 '('.$this->proteger($image).','.$this->proteger($observation).', NOW()) '.
54
						 '('.Cel::db()->proteger($image).','.Cel::db()->proteger($observation).', NOW()) '.
55
						 'ON DUPLICATE KEY UPDATE id_image = id_image' ;
55
						 'ON DUPLICATE KEY UPDATE id_image = id_image' ;
Line 56... Line 56...
56
				
56
				
Line 57... Line 57...
57
				$resultat_creation_lien = $this->executer($requete_creation_lien);
57
				$resultat_creation_lien = Cel::db()->executer($requete_creation_lien);
58
				
58
				
59
				if ($resultat_creation_lien) {
59
				if ($resultat_creation_lien) {
60
					$retour = "OK";
60
					$retour = "OK";
Line 94... Line 94...
94
				$requete_selection_liaison = 'SELECT id_image, hauteur , largeur '.
94
				$requete_selection_liaison = 'SELECT id_image, hauteur , largeur '.
95
						 'FROM cel_images '.
95
						 'FROM cel_images '.
96
						 'WHERE id_image IN ( '.
96
						 'WHERE id_image IN ( '.
97
						 	'SELECT id_image '.
97
						 	'SELECT id_image '.
98
							'FROM cel_obs_images '.						 	
98
							'FROM cel_obs_images '.						 	
99
							'WHERE id_observation = '.$this->proteger($value).' '.
99
							'WHERE id_observation = '.Cel::db()->proteger($value).' '.
100
						 ')';
100
						 ')';
101
			}
101
			}
102
			else
102
			else
103
			{
103
			{
104
				$column = 'id_observation' ;
104
				$column = 'id_observation' ;
105
				$requete_selection_liaison = 'SELECT * from cel_obs WHERE id_observation IN (SELECT '.$column.' FROM cel_obs_images WHERE '.$field.' = '.$this->proteger($value).') ' ;
105
				$requete_selection_liaison = 'SELECT * from cel_obs WHERE id_observation IN (SELECT '.$column.' FROM cel_obs_images WHERE '.$field.' = '.Cel::db()->proteger($value).') ' ;
106
			}
106
			}
Line 107... Line 107...
107
 
107
 
Line 108... Line 108...
108
		}
108
		}
Line 109... Line 109...
109
 
109
 
110
		$resultat_selection_liaison = $this->requeter($requete_selection_liaison);
110
		$resultat_selection_liaison = Cel::db()->requeter($requete_selection_liaison);
111
		
111
		
112
		$liaisons = array();
112
		$liaisons = array();
Line 139... Line 139...
139
	{
139
	{
140
	 	// Controle detournement utilisateur
140
	 	// Controle detournement utilisateur
141
		$this->controleUtilisateur($uid[0]);
141
		$this->controleUtilisateur($uid[0]);
Line 142... Line 142...
142
 
142
 
143
		$id_img = $uid[1] ;
143
		$id_img = $uid[1] ;
Line 144... Line 144...
144
		$id_obs = $this->proteger($uid[2]) ;
144
		$id_obs = Cel::db()->proteger($uid[2]) ;
Line 145... Line 145...
145
 
145
 
146
		$id = $uid[0] ;
146
		$id = $uid[0] ;
147
 
147
 
148
		if (isset($id)) {
148
		if (isset($id)) {
149
	           	$requete_suppression_lien = "DELETE FROM cel_obs_images ".
149
	           	$requete_suppression_lien = "DELETE FROM cel_obs_images ".
Line 150... Line 150...
150
											"WHERE id_image IN (".$id_img.") ".
150
											"WHERE id_image IN (".$id_img.") ".
Line 151... Line 151...
151
											"AND id_observation IN (".$id_obs.") " ;
151
											"AND id_observation IN (".$id_obs.") " ;
152
		}
152
		}
153
 
153
 
154
		$resultat_suppression_lien = $this->executer($requete_suppression_lien);
154
		$resultat_suppression_lien = Cel::db()->executer($requete_suppression_lien);