diff --git a/README.md b/README.md index cbd618e..9d77340 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Candidature #MAVOIX v1.9.1 +# Candidature #MAVOIX v1.9.2 Soumission et publication des inscriptions au tirage au sort [#MAVOIX](https://mavoix.info). @@ -9,6 +9,10 @@ Version de test : https://candidature.maudry.fr ## Notes de version +### 1.9.2 + +- Hotfix script de récupération de fichiers manquants effacés (grâce à la sauvegarde) + ### 1.9.1 - Hotfix faille de sécurité qui permettait la récupération des justificatifs des candidats diff --git a/pages/admin/candidature/hotfix-1-9-2.php b/pages/admin/candidature/hotfix-1-9-2.php new file mode 100644 index 0000000..b6a1d4d --- /dev/null +++ b/pages/admin/candidature/hotfix-1-9-2.php @@ -0,0 +1,93 @@ + IMPOSSIBLE DE TROUVER $sField : ".$sPath.""; + $nCountFiles++; + if( $_GET["action"]=="tentative-recup" || $_GET["action"]=="recup" ){ + $sSql="SELECT $sField FROM `candidature-backup` WHERE id='".$nId."'"; + $stmt=DbLink::getInstance()->prepare($sSql); + $stmt->execute(array()); + $data=$stmt->fetchAll(); + if(count($data)){ + $sFile=$data[0][$sField]; + if(file_exists($sFile)){ + $sOut.="
--- Fichier récupérable $sField : ".$sFile."
"; + if($_GET["action"]=="recup"){ + $candidature=new Candidature(array("id"=>$nId)); + $candidature->hydrateFromBDD(array("*")); + switch($sField){ + case "path_pic": $candidature->setPath_pic($sFile); break; + case "path_certificate": $candidature->setPath_certificate($sFile); break; + case "path_idcard": $candidature->setPath_idcard($sFile); break; + case "path_idcard_verso": $candidature->setPath_idcard_verso($sFile); break; + case "path_criminal_record": $candidature->setPath_criminal_record($sFile); break; + } + $candidature->save(); + $sOut.="
------- Fichier récupéré $sField : ".$sFile."
"; + + } + }else{ + $sOut.="
--- Fichier irrécupérable $sField
"; + if($_GET["action"]=="recup"){ + $candidature=new Candidature(array("id"=>$nId)); + $candidature->hydrateFromBDD(array("*")); + switch($sField){ + case "path_pic": $candidature->setPath_pic(""); break; + case "path_certificate": $candidature->setPath_certificate(""); break; + case "path_idcard": $candidature->setPath_idcard(""); break; + case "path_idcard_verso": $candidature->setPath_idcard_verso(""); break; + case "path_criminal_record": $candidature->setPath_criminal_record(""); break; + } + $candidature->save(); + } + + } + }else{ + $sOut.="
IMPOSSIBLE DE RECUPERER LA BACKUP $sField : ".$sPath."
"; + } + + + + + } + + + } + return $sOut; +} + +if( ConfigService::get("enable-script-hotfix-1-9-2") ) { + + //liste les candidatures en base + $oListeCandidature = new CandidatureListe(); + $oListeCandidature->applyRules4ListAdmin(); + $aCandidatures = $oListeCandidature->getPage(); + // parcrous les candidatures + foreach ($aCandidatures as $aCandidature) { + $sOut=""; + $sOut.= testPath($aCandidature["path_pic"],"path_pic",$aCandidature["id"]); + $sOut.= testPath($aCandidature["path_certificate"],"path_certificate",$aCandidature["id"]); + $sOut.= testPath($aCandidature["path_idcard"],"path_idcard",$aCandidature["id"]); + $sOut.= testPath($aCandidature["path_idcard_verso"],"path_idcard_verso",$aCandidature["id"]); + $sOut.= testPath($aCandidature["path_criminal_record"],"path_criminal_record",$aCandidature["id"]); + if($sOut!=""){ + $nCountCandidats++; + $aDataScript["out"] .="
CANDIDATURE :".$aCandidature["id"].$sOut; + } + } + $aDataScript["out"] .= "

"; + $aDataScript["out"] .= "
candidatures : $nCountCandidats
"; + $aDataScript["out"] .= "
fichiers : $nCountFiles
"; + +}else{ + $aDataScript["out"] .= "
EXECUTION BLOQUE (cf. fichier de config)
"; +} \ No newline at end of file diff --git a/pages/visitor/candidature/save.php b/pages/visitor/candidature/save.php index d34024b..fd8e138 100644 --- a/pages/visitor/candidature/save.php +++ b/pages/visitor/candidature/save.php @@ -461,7 +461,7 @@ $aResponse["message"]["type"] = "success"; //if edit clean old file if($bEdit){ - vars::removeDirectory(dirname($OldCandidature->getPath_pic())); + // vars::removeDirectory(dirname($OldCandidature->getPath_pic())); $aResponse["message"]["text"] = "Modification enregistrée !"; }else{ $aResponse["message"]["text"] = "Candidature envoyée correctement !"; diff --git a/templates/admin/candidature/hotfix-1-9-2.html.twig b/templates/admin/candidature/hotfix-1-9-2.html.twig new file mode 100644 index 0000000..96ba898 --- /dev/null +++ b/templates/admin/candidature/hotfix-1-9-2.html.twig @@ -0,0 +1,7 @@ +{% extends "admin/base.html.twig" %} + + +{% block body %} + HOTFIX + {{ out|raw }} +{% endblock %} \ No newline at end of file diff --git a/web/config.sample.php b/web/config.sample.php index fb305dc..57f5233 100644 --- a/web/config.sample.php +++ b/web/config.sample.php @@ -41,4 +41,5 @@ $_CONFIG["mime-type-limit"] = array('image/jpeg'=>'jpg','image/png'=>'png'); $_CONFIG["enable-captcha"] = true; //enable or disable captcha $_CONFIG["enable-captcha-editlink"] = true; //enable or disable captcha for ask edit link form -$_CONFIG["enable-script-hotfix-1-9-1"] = false; //activer pour permettre l'execution du script de rattrapage du hotfix \ No newline at end of file +$_CONFIG["enable-script-hotfix-1-9-1"] = false; //activer pour permettre l'execution du script de rattrapage du hotfix +$_CONFIG["enable-script-hotfix-1-9-2"] = false; //activer pour permettre l'execution du script de rattrapage du hotfix \ No newline at end of file diff --git a/web/index.php b/web/index.php index 86940bb..6fe019e 100644 --- a/web/index.php +++ b/web/index.php @@ -10,7 +10,7 @@ require_once 'maintenance.php'; } if($bMaintenance){ - echo "

Under maintenance, please try later ...

"; + echo "

Site Web en maintenance, merci de réessayer plus tard.

Informations : candidature@mavoix.info

"; }else{ //composer loader require_once '../vendor/autoload.php';