Subversion Repositories eFlore/Applications.cel

Rev

Rev 1720 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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