25,6 → 25,7 |
} |
|
$requete = 'DESCRIBE '.$bdd.'.'.$nom_table; |
|
$resultat = $this->requeteUn($requete); |
|
return $resultat; |
32,6 → 33,19 |
|
public function verifierPresenceChamps($bdd, $nom_table, $champs_a_verifier) { |
|
$tableau_champs_table = $this->obtenirListeNomsChampsAnnuaireParBddNomTable($bdd, $nom_table); |
|
foreach($champs_a_verifier as $champ) { |
if(!in_array($champ, $tableau_champs_table)) { |
return false; |
} |
} |
|
return $resultat; |
} |
|
public function obtenirListeNomsChampsAnnuaireParBddNomTable($bdd, $nom_table) { |
|
if(!$bdd || !$nom_table) { |
return false; |
} |
50,13 → 64,22 |
$tableau_champs_table[] = $champ_table['Field']; |
} |
|
foreach($champs_a_verifier as $champ) { |
if(!in_array($champ, $tableau_champs_table)) { |
return false; |
return $tableau_champs_table; |
} |
|
public function obtenirListeNomsChampsAnnuaireParIdAnnuaire($id_annuaire) { |
|
|
$requete_selection_bdd_table = 'SELECT aa_bdd, aa_table FROM annu_annuaire '. |
' WHERE aa_id_annuaire = '.$this->proteger($id_annuaire); |
|
$resultat_selection_bdd_table = $this->requeteUn($requete_selection_bdd_table); |
|
if(!$resultat_selection_bdd_table) { |
return array(); |
} |
|
return $resultat; |
return $this->obtenirListeNomsChampsAnnuaireParBddNomTable($resultat_selection_bdd_table['aa_bdd'], $resultat_selection_bdd_table['aa_table']); |
} |
|
public function ajouterAnnuaire($informations) { |
93,6 → 116,30 |
return $id_annuaire; |
} |
|
public function creerTableAnnuaire($informations_table, $informations_champs) { |
|
$nom_bdd = $this->proteger($informations_table['nom_bdd']); |
$nom_table = $this->proteger($informations_table['nom_table']); |
|
$champ_id = $this->proteger($informations_champs['champ_id']); |
$champ_nom = $this->proteger($informations_champs['champ_id']); |
$champ_mail = $this->proteger($informations_champs['champ_id']); |
$champ_mot_de_passe = $this->proteger($informations_champs['champ_id']); |
|
$requete_creation_table = 'CREATE TABLE '.$bdd.'.'.$nom_table.' '. |
'('.$champ_id.' INT NOT NULL AUTO_INCREMENT PRIMARY KEY,'. |
$champ_nom.' TEXT NOT NULL,'. |
$champ_mail.' TEXT NOT NULL)'. |
$champ_mot_de_passe.' TEXT NOT NULL)'; |
//'ENGINE = MyISAM' ; |
|
echo $requete_creation_table; |
exit; |
|
return $this->requete($requete_creation_table); |
|
} |
|
/** |
* Charge la liste complète des champs d'un annuaire |
* @param int $identifiant l'identifiant de l'annuaire demandé |