Skip to content

Commit

Permalink
Ajout d'un noeud facultatif description_detaillee dans plugin.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
marc17 committed Feb 6, 2019
1 parent 52a5d0a commit 0ed1cde
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions mod_plugins/index.php
Expand Up @@ -89,6 +89,9 @@ function aff_debug($tab){
$testXML = new traiterXml($xml);

if ($testXML->getReponse() === true){
// ajout RGDP
if ($testXML->getErreur() == 'description_detaillee') $_msg = '<p class="red">Attention : Le noeud description_detaillee est manquant ou vide dans le fichier plugin.xml (voir <a target="_blank" href="http://www.sylogix.org/projects/gepi/wiki/Plugin">Coder un plugin pour GEPI</a>).</p>';
// fin ajout RGPD
// traitement ante_installation
$fonction_ante="ante_installation_".$nom_plugin;
if (function_exists($fonction_ante))
Expand Down Expand Up @@ -221,6 +224,11 @@ function aff_debug($tab){
case "2":
$_msg = "<p class=\"red\">Le fichier plugin.xml ne respecte pas la struture demand&eacute;e ! voyez <a href=\"http://www.sylogix.org/wiki/gepi/plugin\">la documentation collaborative (wiki)</a></p>";
break;
// ajout RGPD
case "4":
$_msg="<p class=\"red\">".stripslashes($_msg)."</p>";
break;
// fin ajout RGPD
case "10":
$_msg="<p class=\"red\">".stripslashes($_msg)."</p>";
break;
Expand Down
15 changes: 11 additions & 4 deletions mod_plugins/traiterXml.class.php
Expand Up @@ -100,15 +100,18 @@ private function scanDirPlugin(){
* @return boolean
*/
private function verifNiveau1(){
// On vérifie tous les noeuds
// On vérifie tous les noeuds obligatoires
$nbre = count($this->_noeuds);
for($a = 0 ; $a < $nbre ; $a++){
$noeud = $this->_noeuds[$a];

if (!isset($this->_xml->$noeud) OR $this->_xml->$noeud == ''){
$this->retourneErreur(1, htmlspecialchars('<'.$noeud.'>'));
return false;
}
// ajout RGPD
// on vérifie la préseance facultative du noeud description_detaillee
if (!isset($this->_xml->description_detaillee) || $this->_xml->description_detaillee=='') $this->retourneErreur(4, '');
// fin ajout RGPD
}
return true;
}
Expand Down Expand Up @@ -150,15 +153,19 @@ private function verifXmlFichiers(){
private function retourneErreur($_e, $_m){
switch ($_e) {
case 1:
$message = 'Il manque le noeud ' . $_m . ' dans le fichier plugin.xml';
$message = 'Le noeud ' . $_m . ' est manquant ou vide dans le fichier plugin.xml';
break;
case 2:
$message = 'Le fichier ' . $_m . ' est déclaré dans plugin.xml mais est manquant dans le plugin.';
break;
case 3:
$message = 'Le fichier ' . $_m . ' est présent dans le plugin mais n\'a pas ses droits dans plugin.xml.';
break;

// ajout RGPD
case 4:
$message = 'description_detaillee';
break;
// fin ajout RGPD
default:
$message = "pas de message d'erreur";
break;
Expand Down

0 comments on commit 0ed1cde

Please sign in to comment.