From 57457dae95a6996adf7902da6ae42caedbda3d16 Mon Sep 17 00:00:00 2001 From: mollef Date: Fri, 1 Dec 2017 22:55:42 +0100 Subject: [PATCH 01/64] change on wsusoffline script - new version 0.91 --- sources/debian/changelog | 6 ++++++ sources/scripts/wsusoffline-download.sh | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index 389c50d..38f0553 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,3 +1,9 @@ +se3-wpkg (0.91~) unstable; urgency=low + + * Modification du fonctionnement de wsusoffline-download.sh si l'application n'est pas active dans l'interface + + -- Franck Molle Fri, 01 Dec 2017 22:50:20 +0200 + se3-wpkg (0.90) unstable; urgency=low * Correctif sur le code php pourri diff --git a/sources/scripts/wsusoffline-download.sh b/sources/scripts/wsusoffline-download.sh index 38661ca..0cae41f 100755 --- a/sources/scripts/wsusoffline-download.sh +++ b/sources/scripts/wsusoffline-download.sh @@ -133,14 +133,16 @@ WSUSACTIF="$(grep wsusoffline /var/se3/unattended/install/wpkg/profiles.xml)" WSUSPRESENNT="$(grep wsusoffline /var/se3/unattended/install/wpkg/packages.xml)" if [ -z "$WSUSACTIF" ] && [ -n "$WSUSPRESENNT" ]; then - echo "Wsus présent masi pas actif, sortie du script" -# exit 0 + echo "Wsus présent mais pas actif, sortie du script" + exit 0 fi } TESTFREESPACE +PRESENCEXML + ########### Suppression de l'ancien fichier temoin "version.txt" ########### [ -e /var/se3/unattended/install/wsusoffline/version.txt ] && rm -f /var/se3/unattended/install/wsusoffline/version.txt [ -e /var/se3/unattended/install/wsusoffline/Version.txt ] && rm -f /var/se3/unattended/install/wsusoffline/Version.txt -- GitLab From e2e2a48af58f42351e6df345a903b95ed0c2b86d Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 27 Dec 2017 13:38:56 +0100 Subject: [PATCH 02/64] =?UTF-8?q?Erreur=20de=20code=20sur=20g=C3=A9n=C3=A9?= =?UTF-8?q?ration=20des=20xml=20svn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/wawadeb/se3_wpkglist2.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/wawadeb/se3_wpkglist2.php b/sources/wawadeb/se3_wpkglist2.php index a35f3ba..69a1ad8 100644 --- a/sources/wawadeb/se3_wpkglist2.php +++ b/sources/wawadeb/se3_wpkglist2.php @@ -59,6 +59,7 @@ foreach ($list_branch as $branche) $filedate = RecupDateModifDistant( "$svnurl/$branche/$xmlfile.xml" ); $md5sum=md5_file("$svnurl/$branche/$xmlfile.xml"); $xml = simplexml_load_file("$svnurl/$branche/$xmlfile.xml"); + $xml_id=str_replace("'"," ",$xml->package[0]['id']); $xml_name=str_replace("'"," ",$xml->package[0]['name']); $xml_category=str_replace("'"," ",$xml->package[0]['category2']); $xml_revision=str_replace("'"," ",$xml->package[0]['revision']); @@ -74,7 +75,7 @@ foreach ($list_branch as $branche) */ - $id="$xmlfile"; // pour les tests + $id="$xml_id"; // pour les tests $tab .= " "; $tab .= "\n"; } -- GitLab From a19c35b81d9d6f4ebe210ceee24b899fd9481f99 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 3 Jan 2018 23:56:11 +0100 Subject: [PATCH 03/64] Nouvelle interface wpkg app --- sources/crontab/se3-wpkg | 6 + sources/www/XP | 1 + sources/www/app_liste.php | 267 ++++++++++++++++++ sources/www/app_maintenance.php | 112 ++++++++ sources/www/app_maintenance_parc.php | 215 +++++++++++++++ sources/www/app_maintenance_poste.php | 216 +++++++++++++++ sources/www/app_parcs.php | 375 +++++++++++++++++++++++++ sources/www/app_top.php | 228 ++++++++++++++++ sources/www/wpkg_lib.php | 376 ++++++++++++++++++++++++++ sources/www/wpkg_lib_admin.php | 104 +++++++ sources/www/wpkg_rapport.php | 18 +- 11 files changed, 1913 insertions(+), 5 deletions(-) create mode 100644 sources/www/XP create mode 100644 sources/www/app_liste.php create mode 100644 sources/www/app_maintenance.php create mode 100644 sources/www/app_maintenance_parc.php create mode 100644 sources/www/app_maintenance_poste.php create mode 100644 sources/www/app_parcs.php create mode 100644 sources/www/app_top.php create mode 100644 sources/www/wpkg_lib.php create mode 100644 sources/www/wpkg_lib_admin.php diff --git a/sources/crontab/se3-wpkg b/sources/crontab/se3-wpkg index b53ab7e..12e6ea9 100644 --- a/sources/crontab/se3-wpkg +++ b/sources/crontab/se3-wpkg @@ -2,3 +2,9 @@ # A partir de 20h45 UTC+2, afin de correspondre avec l'heure de mise en ligne # des maj Micosoft a 18h UTC 45 20 * * * root /usr/share/se3/scripts/wsusoffline-download.sh >/dev/null 2>&1 + +# telechargement automatique de la liste des paquets disponibles sur le svn a 22h00 chaque soir +00 22 * * * root /var/www/se3/wpkg/bin/wpkgsvn-download.sh >/dev/null 2>&1 + +# mise a jour automatique du fichier rapport toutes les 5 minutes +*/5 * * * * root /var/www/se3/wpkg/bin/rapports.sh >/dev/null 2>&1 diff --git a/sources/www/XP b/sources/www/XP new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/sources/www/XP @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/sources/www/app_liste.php b/sources/www/app_liste.php new file mode 100644 index 0000000..ea91f0d --- /dev/null +++ b/sources/www/app_liste.php @@ -0,0 +1,267 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + + echo "

Liste des applications du serveur

"; + + $liste_appli=get_list_wpkg_app($xml_packages, $xml_time); + $liste_appli_postes=get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts, $xml_packages); + $liste_appli_status=get_list_wpkg_rapports_statut_app($xml_rapports); + $liste_hosts=get_list_wpkg_hosts($xml_hosts); + $svn_info=get_list_wpkg_svn_info($xml_forum); + + foreach ($liste_appli_postes as $key=>$value) + { + $liste_appli[$key]["nb_postes"]=count($value)+0; + } + + foreach ($liste_appli as $key => $row) + { + if (is_array($liste_appli_postes[$key])) + $tmp_liste_appli_poste=array_keys($liste_appli_postes[$key]); + else + $tmp_liste_appli_poste=array(); + $liste_status_tmp=get_list_wpkg_app_status($liste_hosts,$tmp_liste_appli_poste,$liste_appli_status[$key],$row['revision']); + $liste_appli[$key]["NotOk"]=count($liste_status_tmp["NotOk"]); + $liste_appli[$key]["Ok"]=count($liste_status_tmp["Ok"]); + $liste_appli[$key]["MaJ"]=count($liste_status_tmp["MaJ"]); + + $name[$key] = strtolower($row['name']); + $category[$key] = strtolower($row['category']); + $compatibilite[$key] = $row['compatibilite']+0; + $revision[$key] = $row['revision']; + $nb_postes[$key] = $row['nb_postes']; + $date[$key] = $row['date']; + $NotOk[$key] = $liste_appli[$key]['NotOk']; + $MaJ[$key] = $liste_appli[$key]['MaJ']; + } + + + switch ($tri) + { + case 0: + array_multisort($name, SORT_ASC, $liste_appli); + break; + case 1: + array_multisort($category, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + case 2: + array_multisort($compatibilite, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 3: + array_multisort($name, SORT_DESC, $liste_appli); + break; + case 4: + array_multisort($category, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 5: + array_multisort($compatibilite, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + case 6: + array_multisort($date, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 7: + array_multisort($date, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + case 8: + array_multisort($nb_postes, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 9: + array_multisort($nb_postes, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + case 10: + array_multisort($NotOk, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 11: + array_multisort($NotOk, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + case 12: + array_multisort($MaJ, SORT_DESC, $name, SORT_ASC, $liste_appli); + break; + case 13: + array_multisort($MaJ, SORT_ASC, $name, SORT_ASC, $liste_appli); + break; + default: + array_multisort($name, SORT_ASC, $branche, SORT_ASC, $liste_appli); + break; + } + + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach ($liste_appli as $application) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if (isset($svn_info[$application["id"]])) + { + $rev=array(); + if (isset ($svn_info[$application["id"]]["stable"])) + { + $rev["stable"]=$svn_info[$application["id"]]["stable"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["test"])) + { + $rev["test"]=$svn_info[$application["id"]]["test"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["XP"]) and get_wpkg_branche_XP()==1) + { + $rev["XP"]=$svn_info[$application["id"]]["XP"]["revision"]; + } + if (in_array($application["revision"],$rev)) + { + echo ""; + } + else + { + echo ""; + } + + echo ""; + + } + echo "
Nom de l'applicationVersionCompatibilitéCatégorieNombre de postesPostes en erreurPostes pas à jourDate d'ajoutVersion SVN
".$application["name"]."".$application["revision"].""; + + switch ($application["compatibilite"]) + { + case 1: + echo ""; + break; + case 2: + echo ""; + break; + case 3: + echo ""; + break; + case 4: + echo ""; + break; + case 5: + echo ""; + break; + case 6: + echo ""; + break; + case 7: + echo ""; + break; + case 0: + echo ""; + break; + default: + echo ""; + break; + + } + echo "".$application["category"]."".($application["nb_postes"]+0)."0) + echo " bgcolor='".$warning_bg."' style='color: ".$warning_txt."'"; + echo ">".$application["NotOk"]."0) + echo " bgcolor='".$error_bg."' style='color: ".$error_txt."'"; + echo ">".$application["MaJ"]."".$application["date2"].""; + } + else + { + echo ""; + } + $i=0; + foreach ($rev as $key=>$value) + { + if ($i>0) + echo "
"; + echo $value." (".$key.")"; + $i++; + } + echo "
-
"; +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/app_maintenance.php b/sources/www/app_maintenance.php new file mode 100644 index 0000000..100e955 --- /dev/null +++ b/sources/www/app_maintenance.php @@ -0,0 +1,112 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + $liste_rapports_status_poste = get_list_wpkg_rapports_statut_poste_app($xml_rapports); + $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); + $liste_parcs=array_keys($liste_postes_parc); + asort($liste_parcs); + + if (!count($liste_postes_parc[$get_parc])) + { + $get_parc="_TousLesPostes"; + } + + echo "
\n"; + $page_id=2; + include ("app_top.php"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + echo "Suppression de l'application"; + echo "
"; + echo "Choix du déploiement sur les postes"; + echo "
"; + echo "Choix du déploiement sur les parcs"; + echo "
\n"; + +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/app_maintenance_parc.php b/sources/www/app_maintenance_parc.php new file mode 100644 index 0000000..e867e42 --- /dev/null +++ b/sources/www/app_maintenance_parc.php @@ -0,0 +1,215 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + $liste_parcs=get_list_wpkg_parcs($xml_profiles); + asort($liste_parcs); + + if (isset($_POST["action"])) + $post_action=$purifier->purify($_POST["action"]); + else + $post_action=""; + + $result_xml=""; + if ($post_action=="Annuler les modificaitons") + { + header("Location: app_maintenance.php?tri2=".$tri2."&Appli=".$get_Appli."&parc=".$get_parc."&tous=".$get_tous."&ok=".$get_ok."&warning=".$get_warning."&error=".$get_error); + exit; + } + elseif ($post_action=="Valider les modificaitons") + { + if (isset($_POST["parc"])) + $post_parc=$_POST["parc"]; + else + $post_parc=array(); + + include ("wpkg_lib_admin.php"); + $tmp_result_xml=set_app_parcs($post_parc,$get_Appli,$liste_parcs,$url_profiles); + $result_xml="
Modification effectuée. Application déployée sur ".$tmp_result_xml["in"]." parc"; + if ($tmp_result_xml["in"]>1) + $result_xml.="s"; + $result_xml.=".

"; + } + + echo "\n"; + + echo "
\n"; + $page_id=2; + include ("app_top.php"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + echo "Déploiement demandé pour ce parc"; + echo ""; + echo "Déploiement demandé par une dépendance"; + echo ""; + echo "Déploiement non demandé pour ce parc"; + echo "

\n"; + + echo $result_xml; + + echo "
"; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $liste_parc_app=get_list_wpkg_parc_app($xml_profiles); + $liste_dependance=get_list_wpkg_depend_app($xml_packages); + $liste_required_by=array(); + if (is_array($liste_dependance)) + { + foreach ($liste_dependance as $key=>$value) + { + if (in_array($get_Appli, $value)) + { + if ($liste_parc_app[$key]) + { + foreach ($liste_parc_app[$key] as $parc_required) + $liste_required_by[$parc_required]=$parc_required; + } + } + } + } + + $i=0; + echo ""; + foreach($liste_parcs as $parc) + { + if ($i==5) + { + $i=0; + echo "\n"; + echo ""; + } + echo ""; + $i++; + } + if ($i!=5) + echo ""; + echo "\n"; + echo "
"; + echo ""; + echo ""; + echo " Tous/Aucun"; + echo ""; + echo ""; + echo "
"; + echo ""; + echo ""; + echo ""; + echo "
"; + echo ""; + echo " ".$parc."
"; + echo "
\n"; + echo "
"; + +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/app_maintenance_poste.php b/sources/www/app_maintenance_poste.php new file mode 100644 index 0000000..4811d0f --- /dev/null +++ b/sources/www/app_maintenance_poste.php @@ -0,0 +1,216 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + $liste_parcs=get_list_wpkg_parcs($xml_profiles); + asort($liste_parcs); + + if (isset($_POST["action"])) + $post_action=$purifier->purify($_POST["action"]); + else + $post_action=""; + + $result_xml=""; + if ($post_action=="Annuler les modificaitons") + { + header("Location: app_maintenance.php?tri2=".$tri2."&Appli=".$get_Appli."&parc=".$get_parc."&tous=".$get_tous."&ok=".$get_ok."&warning=".$get_warning."&error=".$get_error); + exit; + } + elseif ($post_action=="Valider les modificaitons") + { + if (isset($_POST["host"])) + $post_host=$_POST["host"]; + else + $post_host=array(); + + include ("wpkg_lib_admin.php"); + $tmp_result_xml=set_app_postes($post_host,$get_Appli,$liste_parcs,$url_profiles); + $result_xml="
Modification effectuée. Application déployée sur ".$tmp_result_xml["in"]." poste"; + if ($tmp_result_xml["in"]>1) + $result_xml.="s"; + $result_xml.=".

"; + } + + echo "\n"; + + echo "
\n"; + $page_id=2; + include ("app_top.php"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + echo "Déploiement demandé pour ce poste"; + echo ""; + echo "Déploiement demandé pour un parc du poste"; + echo ""; + echo "Déploiement demandé par une dépendance"; + echo ""; + echo "Déploiement non demandé pour ce poste"; + echo "

\n"; + + echo $result_xml; + + echo "
"; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + $list_app_hosts_all=get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts,$xml_packages); + $list_app_hosts=get_list_wpkg_poste_app($xml_profiles, $xml_hosts); + + $liste_parc_app=get_list_wpkg_parc_app($xml_profiles); + $i=0; + echo ""; + $tmp_list_appli_postes=$list_app_hosts_all[$get_Appli]; + + foreach($liste_hosts as $host) + { + if ($i==5) + { + $i=0; + echo "\n"; + echo ""; + } + if (!$tmp_list_appli_postes) + $test1=0; + elseif (!in_array($host,array_keys($tmp_list_appli_postes))) + $test1=0; + elseif (isset($tmp_list_appli_postes[$host]["poste"])) + $test1=1; + elseif (is_array($tmp_list_appli_postes[$host]["parc"])) + $test1=2; + elseif (is_array($tmp_list_appli_postes[$host]["depend"])) + $test1=3; + else + $test1=0; + echo ""; + $i++; + } + if ($i!=5) + echo ""; + echo "\n"; + echo "
"; + echo ""; + echo ""; + echo " Tous/Aucun"; + echo ""; + echo ""; + echo "
"; + echo ""; + echo ""; + echo ""; + echo "
"; + echo ""; + echo " ".$host."
"; + echo "
\n"; + echo "
"; + +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/app_parcs.php b/sources/www/app_parcs.php new file mode 100644 index 0000000..89c7d21 --- /dev/null +++ b/sources/www/app_parcs.php @@ -0,0 +1,375 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + $liste_rapports_status_poste = get_list_wpkg_rapports_statut_poste_app($xml_rapports); + $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); + $liste_parcs=array_keys($liste_postes_parc); + asort($liste_parcs); + + if (!count($liste_postes_parc[$get_parc])) + { + $get_parc="_TousLesPostes"; + } + + echo "
\n"; + $page_id=1; + include ("app_top.php"); + + + $list_poste=array(); + $parc_poste_status=array("Ok"=>0, "NotOk"=>0, "MaJ"=>0, "Total"=>0); + $i=0; + + foreach ($liste_postes_parc[$get_parc] as $poste_parc) + { + $info_poste=$liste_rapports_status_poste[$poste_parc]["info"]; + $info_app=$liste_rapports_status_poste[$poste_parc][$get_Appli]; + + if (in_array($poste_parc,$liste_status_tmp["NotOk"])) + { + $list_poste[$i]["wpkg"]=$get_warning; + $list_poste[$i]["wpkg_status"]=3; + $list_poste[$i]["bg"]=$warning_bg; + $list_poste[$i]["txt"]=$warning_txt; + $list_poste[$i]["lnk"]=$warning_lnk; + $parc_poste_status["NotOk"]++; + $parc_poste_status["Total"]++; + } + elseif (in_array($poste_parc,$liste_status_tmp["MaJ"])) + { + $list_poste[$i]["wpkg"]=$get_error; + $list_poste[$i]["wpkg_status"]=2; + $list_poste[$i]["bg"]=$error_bg; + $list_poste[$i]["txt"]=$error_txt; + $list_poste[$i]["lnk"]=$error_lnk; + $parc_poste_status["MaJ"]++; + $parc_poste_status["Total"]++; + } + else + { + $list_poste[$i]["wpkg"]=$get_ok; + $list_poste[$i]["wpkg_status"]=1; + $list_poste[$i]["bg"]=$ok_bg; + $list_poste[$i]["txt"]=$ok_txt; + $list_poste[$i]["lnk"]=$ok_lnk; + $parc_poste_status["Ok"]++; + $parc_poste_status["Total"]++; + } + + if ($info_app!="") + { + if ($info_app["status"]=="Installed") + { + $list_poste[$i]["status"]="Installé"; + } + else + { + $list_poste[$i]["status"]="Non Installé"; + if ($list_poste[$i]["wpkg_status"]==1) + { + $list_poste[$i]["bg"]=$unknown_bg; + $list_poste[$i]["txt"]=$unknown_txt; + $list_poste[$i]["lnk"]=$unknown_lnk; + $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); + } + } + $list_poste[$i]["revision"]=$info_app["revision"]; + } + else + { + if ($list_poste[$i]["wpkg_status"]==1) + { + $list_poste[$i]["bg"]=$unknown_bg; + $list_poste[$i]["txt"]=$unknown_txt; + $list_poste[$i]["lnk"]=$unknown_lnk; + } + $list_poste[$i]["status"]="Inconnu"; + $list_poste[$i]["revision"]="-"; + } + $list_poste[$i]["poste"]=$poste_parc; + switch ($info_poste["typewin"]) + { + case 'Windows XP': + $list_poste[$i]["typewin"]="winxp.png"; + break; + case 'Windows 7': + $list_poste[$i]["typewin"]="win7.png"; + break; + case 'Windows 10': + $list_poste[$i]["typewin"]="win10.png"; + break; + default: + $list_poste[$i]["typewin"]="vide.png"; + break; + } + $list_poste[$i]["logfile"]=$info_poste["logfile"]; + $list_poste[$i]["date"]=$info_poste["date"]; + $list_poste[$i]["time"]=$info_poste["time"]; + $list_poste[$i]["datetime"]=$info_poste["datetime"]; + $list_poste[$i]["ip"]=$info_poste["ip"]; + $list_poste[$i]["mac"]=$info_poste["mac"]; + + $tri_poste[$i]=$list_poste[$i]["poste"]; + $tri_status[$i]=$list_poste[$i]["status"]; + $tri_revision[$i]=$list_poste[$i]["revision"]; + $tri_date[$i]=$list_poste[$i]["datetime"]; + $tri_ip[$i]=ip2long($list_poste[$i]["ip"]); + $tri_mac[$i]=$list_poste[$i]["mac"]; + + $i++; + } + + if ($list_poste) + { + switch ($tri2) + { + case 0: + array_multisort($tri_poste, SORT_ASC, $list_poste); + break; + case 1: + array_multisort($tri_poste, SORT_DESC, $list_poste); + break; + case 2: + array_multisort($tri_status, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 3: + array_multisort($tri_status, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 4: + array_multisort($tri_revision, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 5: + array_multisort($tri_revision, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 6: + array_multisort($tri_date, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 7: + array_multisort($tri_date, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 8: + array_multisort($tri_ip, SORT_ASC, $list_poste); + break; + case 9: + array_multisort($tri_ip, SORT_DESC, $list_poste); + break; + case 10: + array_multisort($tri_mac, SORT_ASC, $list_poste); + break; + case 11: + array_multisort($tri_mac, SORT_DESC, $list_poste); + break; + default: + array_multisort($tri_poste, SORT_ASC, $list_poste); + break; + } + } + + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ParcNombre de postesPostes à jourPostes en erreurPostes pas à jour
"; + echo $get_parc."
"; + echo ""; + echo "
"; + echo $parc_poste_status["Total"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["Ok"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["NotOk"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["MaJ"]."
"; + echo ""; + echo "
\n"; + echo "
\n"; + echo "
\n"; + + + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + foreach ($list_poste as $lp) + { + if ($lp["wpkg"]==1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + } + } + echo "
Nom du posteOSStatutVersionDate du dernier rapportAdresse ipAdresse mac
".$lp["poste"].""; + echo ''; + echo "".$lp["status"]."".$lp["revision"]."".$lp["date"]." à ".$lp["time"]."".$lp["ip"]."".$lp["mac"]."
\n"; + +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/app_top.php b/sources/www/app_top.php new file mode 100644 index 0000000..cf78ab5 --- /dev/null +++ b/sources/www/app_top.php @@ -0,0 +1,228 @@ +$value) + { + $liste_appli[$key]["nb_postes"]=count($value)+0; + } + + $application=$liste_appli[$get_Appli]; + echo "

Application : ".$application["name"]."

\n"; + + echo ""; + +// tableau 0 + echo "\n"; + echo ""; + echo ""; + if ($page_id==1) + { + echo ""; + } + else + { + echo ""; + } + if ($page_id==2) + { + echo ""; + } + else + { + echo ""; + } + echo "\n"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
Liste des ApplicationsEtat du déploiementEtat du déploiementGestionMaintenance
"; + echo ""; + echo "
\n"; + echo "
\n"; + + +// tableau 1 + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if (isset($svn_info[$application["id"]])) + { + $rev=array(); + if (isset ($svn_info[$application["id"]]["stable"])) + { + $rev["stable"]=$svn_info[$application["id"]]["stable"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["test"])) + { + $rev["test"]=$svn_info[$application["id"]]["test"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["XP"]) and get_wpkg_branche_XP()==1) + { + $rev["XP"]=$svn_info[$application["id"]]["XP"]["revision"]; + } + if (in_array($application["revision"],$rev)) + { + echo ""; + } + else + { + echo ""; + } + echo "\n"; + echo "
Fichier xmlVersionCompatibilitéCatégoriePrioritéRebootDate d'ajoutVersion SVN
xml".$application["revision"].""; + + switch ($application["compatibilite"]) + { + case 1: + echo ""; + break; + case 2: + echo ""; + break; + case 3: + echo ""; + break; + case 4: + echo ""; + break; + case 5: + echo ""; + break; + case 6: + echo ""; + break; + case 7: + echo ""; + break; + case 0: + echo ""; + break; + default: + echo ""; + break; + + } + echo "".$application["category"]."".$application["priority"].""; + if ($application["reboot"]=="false") + echo "Non"; + else + echo "Oui"; + echo "".$application["date2"].""; + } + else + { + echo ""; + } + $i=0; + foreach ($rev as $key=>$value) + { + if ($i>0) + echo "
"; + echo $value." (".$key.")"; + $i++; + } + echo "
-
\n"; + echo "
\n"; + + // tableau 2 + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
Dépend deRequis parNombre de postesPostes en erreurPostes pas à jour
"; + if (isset($application["depends"])) + { + $i=0; + foreach ($application["depends"] as $dependance) + { + if ($i>0) + echo "
"; + echo ""; + echo $liste_appli[$dependance]["name"]; + echo ""; + $i++; + } + } + echo "
"; + if (isset($application["required_by"])) + { + $i=0; + foreach ($application["required_by"] as $requis) + { + if ($i>0) + echo "
"; + echo ""; + echo $liste_appli[$requis]["name"]; + echo ""; + $i++; + } + } + echo "
".($application["nb_postes"]+0)."0) + echo " bgcolor='".$warning_bg."' style='color:".$warning_txt."'"; + echo ">".$application["NotOk"]."0) + echo " bgcolor='".$error_bg."' style='color:".$error_txt."'"; + echo ">".$application["MaJ"]."
\n"; + echo "
\n"; +?> \ No newline at end of file diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php new file mode 100644 index 0000000..6e70877 --- /dev/null +++ b/sources/www/wpkg_lib.php @@ -0,0 +1,376 @@ +host as $host1) + { + $list_host[(string) $host1["profile-id"]] = (string) $host1["name"]; + } + return $list_host; + } + + function get_list_wpkg_parcs($xml_profiles) + { + $list_parcs=array(); + foreach ($xml_profiles->profile as $profile1) + { + $parc=1; + foreach ($profile1->depends as $profile2) + { + if ((string) $profile2["profile-id"]=="_TousLesPostes") + $parc=0; + } + if ($parc==1) + $list_parcs[] = (string) $profile1["id"]; + } + return $list_parcs; + } + + function get_list_wpkg_time($xml_time) + { + $liste_time=array(); + foreach ($xml_time->package as $time_package) + { + foreach ($time_package->op as $time_op) + { + sscanf($time_op["date"],"%4u-%2u-%2uT%2u:%2u:%2uZ",$annee,$mois,$jour,$heure,$minute,$seconde); + $newTstamp = mktime($heure,$minute,$seconde,$mois,$jour,$annee)+3600; + $liste_time[(string) $time_package["id"]] = array ("date"=>(string) $time_op["date"], + "date2"=>date("d/m/Y à H:i:s", $newTstamp)); + } + } + return $liste_time; + } + + function get_list_wpkg_app($xml_packages, $xml_time) + { + $list_appli=array(); + $liste_time = get_list_wpkg_time($xml_time); + foreach ($xml_packages->package as $app) + { + if ($app["category2"]!="") + $app["category"]=(string) $app["category2"]; + else + $app["category"]=$app["category"]."*"; + $list_appli[(string) $app["id"]]["id"] = (string) $app["id"]; + $list_appli[(string) $app["id"]]["category"] = str_replace("'"," ",(string) $app["category"]); + $list_appli[(string) $app["id"]]["name"] = str_replace("'"," ",(string) $app["name"]); + $list_appli[(string) $app["id"]]["compatibilite"] = (string) $app["compatibilite"]; + $list_appli[(string) $app["id"]]["revision"] = (string) $app["revision"]; + $list_appli[(string) $app["id"]]["reboot"] = (string) $app["reboot"]; + $list_appli[(string) $app["id"]]["priority"] = (string) $app["priority"]; + $list_appli[(string) $app["id"]]["date"] = $liste_time[(string) $app["id"]]["date"]; + $list_appli[(string) $app["id"]]["date2"] = $liste_time[(string) $app["id"]]["date2"]; + foreach ($app->depends as $app_dep) + { + $list_appli[(string) $app["id"]]["depends"][]=(string) $app_dep["package-id"]; + $list_appli[(string) $app_dep["package-id"]]["required_by"][]=(string) $app["id"]; + } + } + return $list_appli; + } + + function get_list_wpkg_parc_app($xml_profiles) + { + $list_profiles=array(); + $list_parcs=get_list_wpkg_parcs($xml_profiles); + foreach ($xml_profiles->profile as $profile1) + { + foreach ($profile1->package as $profile2) + { + if (in_array((string) $profile1["id"],$list_parcs)) + $list_profiles[(string) $profile2["package-id"]][] = (string) $profile1["id"]; + } + } + return $list_profiles; + } + + + function get_list_wpkg_poste_parc($xml_profiles) + { + $list_profiles=array(); + foreach ($xml_profiles->profile as $profile1) + { + foreach ($profile1->depends as $profile2) + { + $list_profiles[(string) $profile2["profile-id"]][] = (string) $profile1["id"]; + } + } + return $list_profiles; + } + + function get_list_wpkg_poste_app($xml_profiles, $xml_hosts) + { + $list_profiles=array(); + $list_hosts=get_list_wpkg_hosts($xml_hosts); + foreach ($xml_profiles->profile as $profile1) + { + foreach ($profile1->package as $profile2) + { + if (array_key_exists((string) $profile1["id"],$list_hosts)) + $list_profiles[(string) $profile2["package-id"]][(string) $profile1["id"]] = (string) $profile1["id"]; + } + } + return $list_profiles; + } + + function get_list_wpkg_depend_app($xml_packages) + { + $list_profiles=array(); + foreach ($xml_packages->package as $package) + { + foreach ($package->depends as $package2) + { + $list_profiles[(string) $package["id"]][] = (string) $package2["package-id"]; + } + } + return $list_profiles; + } + + function get_list_wpkg_poste_app_all($xml_profiles,$xml_hosts,$xml_packages) + { + $list_parc=get_list_wpkg_parcs($xml_profiles); + $poste_parc=get_list_wpkg_poste_parc($xml_profiles); + $list_host=get_list_wpkg_hosts($xml_hosts); + $list_depend=get_list_wpkg_depend_app($xml_packages); + $list_profiles=array(); + foreach ($xml_profiles->profile as $profile1) + { + foreach ($profile1->package as $profile2) + { + if (array_key_exists((string) $profile1["id"],$poste_parc)) + { + foreach ($poste_parc[(string) $profile1["id"]] as $poste) + { + $list_profiles[(string) $profile2["package-id"]][$poste]["parc"][(string) $profile1["id"]] = (string) $profile1["id"]; + if (isset($list_depend[(string) $profile2["package-id"]])) + { + foreach ($list_depend[(string) $profile2["package-id"]] as $depend) + { + $list_profiles[$depend][$poste]["depend"][(string) $profile2["package-id"]] = (string) $profile2["package-id"]; + } + } + } + } + elseif (!in_array((string) $profile1["id"], $list_parc)) + { + $list_profiles[(string) $profile2["package-id"]][(string) $profile1["id"]]["poste"] = (string) $profile1["id"]; + if (isset($list_depend[(string) $profile2["package-id"]])) + { + foreach ($list_depend[(string) $profile2["package-id"]] as $depend) + { + $list_profiles[$depend][(string) $profile1["id"]]["depend"][(string) $profile2["package-id"]] = (string) $profile2["package-id"]; + } + } + } + } + } + return $list_profiles; + } + + function get_list_wpkg_rapports_statut_poste_app($xml_rapports) + { + $liste_statuts=array(); + foreach ($xml_rapports->rapport as $rapport) + { + $liste_statuts[(string) $rapport["id"]]["info"] = array("datetime"=>(string) $rapport["datetime"], + "date"=>(string) $rapport["date"], + "time"=>(string) $rapport["time"], + "mac"=>(string) $rapport["mac"], + "ip"=>(string) $rapport["ip"], + "typewin"=>(string) $rapport["typewin"], + "logfile"=>(string) $rapport["logfile"]); + foreach ($rapport->package as $rapport2) + { + $liste_statuts[(string) $rapport["id"]][(string) $rapport2["id"]]=array("revision"=>(string) $rapport2["revision"], + "reboot"=>(string) $rapport2["reboot"], + "status"=>(string) $rapport2["status"]); + } + } + return $liste_statuts; + } + + function get_list_wpkg_rapports_statut_app($xml_rapports) + { + $liste_statuts=array(); + foreach ($xml_rapports->rapport as $rapport) + { + foreach ($rapport->package as $rapport2) + { + $liste_statuts[(string) $rapport2["id"]][(string) $rapport["id"]]=array("revision"=>(string) $rapport2["revision"], + "reboot"=>(string) $rapport2["reboot"], + "status"=>(string) $rapport2["status"]); + } + } + return $liste_statuts; + } + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + function get_list_wpkg_svn_info($xml_forum) + { + $liste_svn=array(); + foreach ($xml_forum->package as $package) + { + sscanf($package["date"],"%4u-%2u-%2uT%2u:%2u:%2uZ",$annee,$mois,$jour,$heure,$minute,$seconde); + $newTstamp = mktime($heure,$minute,$seconde,$mois,$jour,$annee)+3600; + $liste_svn[(string) $package["id"]][(string) $package["forum"]] = array("id"=>(string) $package["id"], + "forum"=>(string) $package["forum"], + "xml"=>(string) $package["xml"], + "url"=>(string) $package["url"], + "md5sum"=>(string) $package["md5sum"], + "date"=>(string) $package["date"], + "date2"=>date("d/m/Y à H:i:s", $newTstamp), + "svn_link"=>(string) $package["svn_link"], + "category"=>(string) $package["category"], + "name"=>(string) $package["name"], + "compatibilite"=>(string) $package["compatibilite"], + "revision"=>(string) $package["revision"]); + } + return $liste_svn; + } + + function get_wpkg_branche_XP() + { + $XP = fopen("/var/www/se3/wpkg/XP", "r"); + $XP_actif=fgets($XP); + fclose($XP); + return $XP_actif; + } + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + function get_list_wpkg_app_status($liste_hosts,$liste_appli_postes,$liste_appli_status,$revision) + { + $liste_status["NotOk"]=array(); + $liste_status["Ok"]=array(); + $liste_status["MaJ"]=array(); + foreach ($liste_hosts as $host_id => $host_name) + { + if (is_array($liste_appli_postes)) + { + if (in_array($host_id, $liste_appli_postes)) + { + if ($liste_appli_status[$host_id]["status"]=="Installed") + { + if ($liste_appli_status[$host_id]["revision"]==$revision) + { + $liste_status["Ok"][]=$host_id; + } + else + { + $liste_status["MaJ"][]=$host_id; + } + } + else + { + $liste_status["NotOk"][]=$host_id; + } + } + elseif ($liste_appli_status[$host_id]["status"]=="Not Installed") + { + $liste_status["Ok"][]=$host_id; + } + else + { + $liste_status["NotOk"][]=$host_id; + } + } + elseif ($liste_appli_status[$host_id]["status"]=="Not Installed") + { + $liste_status["Ok"][]=$host_id; + } + else + { + $liste_status["NotOk"][]=$host_id; + } + } + return $liste_status; + } +?> \ No newline at end of file diff --git a/sources/www/wpkg_lib_admin.php b/sources/www/wpkg_lib_admin.php new file mode 100644 index 0000000..cba8e2c --- /dev/null +++ b/sources/www/wpkg_lib_admin.php @@ -0,0 +1,104 @@ +formatOutput = true; + $xml->preserveWhiteSpace = false; + $xml->load($url_profiles); + $element = $xml->documentElement; + $profiles = $xml->documentElement->getElementsByTagName('profile'); + + $result=array("out"=>0,"in"=>0); + + foreach ($profiles as $profile) + { + $packages=$profile->getElementsByTagName('package'); + if (in_array($profile->getAttribute('id'), $liste_parcs)) + { + foreach ($packages as $package) + { + if ($package->getAttribute('package-id')==$get_Appli) + $profile->removeChild($package); + } + + if (in_array($profile->getAttribute('id'), $post_parc)) + { + $new_package = new DOMElement('package'); + $new_package2 = $profile->appendChild($new_package); + $new_package2->setAttribute("package-id", $get_Appli); + $result["in"]++; + } + else + $result["out"]++; + } + } + + $xml->save("/var/se3/unattended/install/wpkg/profiles_test.xml"); + + return $result; +} + +function set_app_postes($post_host,$get_Appli,$liste_parcs,$url_profiles) +{ + $xml = new DOMDocument; + $xml->formatOutput = true; + $xml->preserveWhiteSpace = false; + $xml->load($url_profiles); + $element = $xml->documentElement; + $profiles = $xml->documentElement->getElementsByTagName('profile'); + + $result=array("out"=>0,"in"=>0); + + foreach ($profiles as $profile) + { + $packages=$profile->getElementsByTagName('package'); + if (!in_array($profile->getAttribute('id'), $liste_parcs)) + { + foreach ($packages as $package) + { + if ($package->getAttribute('package-id')==$get_Appli) + $profile->removeChild($package); + } + + if (in_array($profile->getAttribute('id'), $post_host)) + { + $new_package = new DOMElement('package'); + $new_package2 = $profile->appendChild($new_package); + $new_package2->setAttribute("package-id", $get_Appli); + $result["in"]++; + } + else + $result["out"]++; + } + } + + $xml->save("/var/se3/unattended/install/wpkg/profiles_test.xml"); + + return $result; +} + +?> \ No newline at end of file diff --git a/sources/www/wpkg_rapport.php b/sources/www/wpkg_rapport.php index 3904963..3844f5b 100644 --- a/sources/www/wpkg_rapport.php +++ b/sources/www/wpkg_rapport.php @@ -1,5 +1,3 @@ - - asXML($rapport_repertoire.$rapport_md5); +$xml_md5_dom = new DOMDocument; +$xml_md5_dom->formatOutput = true; +$xml_md5_dom->preserveWhiteSpace = false; +$xml_md5_dom->load($rapport_repertoire.$rapport_md5); +$xml_md5_dom->save($rapport_repertoire.$rapport_md5); + $xml = simplexml_load_file("/var/se3/unattended/install/wpkg/rapports/rapports.xml"); if (isset($info) and @$info!="") { @@ -127,6 +131,10 @@ if (isset($info) and @$info!="") } } $xml->asXML("/var/se3/unattended/install/wpkg/rapports/rapports.xml"); -?> - - + +$xml_dom = new DOMDocument; +$xml_dom->formatOutput = true; +$xml_dom->preserveWhiteSpace = false; +$xml_dom->load("/var/se3/unattended/install/wpkg/rapports/rapports.xml"); +$xml_dom->save("/var/se3/unattended/install/wpkg/rapports/rapports.xml"); +?> \ No newline at end of file -- GitLab From ed7bcf4bcda860779116339a7848451ae9a50419 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 4 Jan 2018 00:52:21 +0100 Subject: [PATCH 04/64] cron liste xml du svn --- sources/crontab/se3-wpkg | 2 +- sources/www/wpkg_svn.php | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 sources/www/wpkg_svn.php diff --git a/sources/crontab/se3-wpkg b/sources/crontab/se3-wpkg index 12e6ea9..d811aa2 100644 --- a/sources/crontab/se3-wpkg +++ b/sources/crontab/se3-wpkg @@ -4,7 +4,7 @@ 45 20 * * * root /usr/share/se3/scripts/wsusoffline-download.sh >/dev/null 2>&1 # telechargement automatique de la liste des paquets disponibles sur le svn a 22h00 chaque soir -00 22 * * * root /var/www/se3/wpkg/bin/wpkgsvn-download.sh >/dev/null 2>&1 +00 22 * * * root /usr/bin/php /var/www/se3/wpkg/wpkg_svn.php >/dev/null 2>&1 # mise a jour automatique du fichier rapport toutes les 5 minutes */5 * * * * root /var/www/se3/wpkg/bin/rapports.sh >/dev/null 2>&1 diff --git a/sources/www/wpkg_svn.php b/sources/www/wpkg_svn.php new file mode 100644 index 0000000..5799688 --- /dev/null +++ b/sources/www/wpkg_svn.php @@ -0,0 +1,48 @@ +formatOutput = true; + $xml->preserveWhiteSpace = false; + $xml->load($url_stable); + $element = $xml->documentElement; + $packages = $xml->documentElement->getElementsByTagName('package'); + + foreach ($packages as $package) + { + $package->setAttribute("forum", "stable"); + } + + $xml2 = new DOMDocument; + $xml2->formatOutput = true; + $xml2->preserveWhiteSpace = false; + $xml2->load($url_testing); + $packages2 = $xml2->documentElement->getElementsByTagName('package'); + + foreach ($packages2 as $package2) + { + $package2->setAttribute("forum", "test"); + } + foreach ($xml2->documentElement->childNodes as $node2) + $xml->documentElement->appendChild($xml->importNode($node2, TRUE)); + + + $xml3 = new DOMDocument; + $xml3->formatOutput = true; + $xml3->preserveWhiteSpace = false; + $xml3->load($url_XP); + $packages3 = $xml3->documentElement->getElementsByTagName('package'); + + foreach ($packages3 as $package3) + { + $package3->setAttribute("forum", "XP"); + } + foreach ($xml3->documentElement->childNodes as $node3) + $xml->documentElement->appendChild($xml->importNode($node3, TRUE)); + + $xml->save($url_forum); +?> \ No newline at end of file -- GitLab From e8ed0737f5bbede94e0bed36bdabb446f683fcdd Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 4 Jan 2018 01:11:27 +0100 Subject: [PATCH 05/64] changement user --- sources/crontab/se3-wpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/crontab/se3-wpkg b/sources/crontab/se3-wpkg index d811aa2..d98de1b 100644 --- a/sources/crontab/se3-wpkg +++ b/sources/crontab/se3-wpkg @@ -4,7 +4,7 @@ 45 20 * * * root /usr/share/se3/scripts/wsusoffline-download.sh >/dev/null 2>&1 # telechargement automatique de la liste des paquets disponibles sur le svn a 22h00 chaque soir -00 22 * * * root /usr/bin/php /var/www/se3/wpkg/wpkg_svn.php >/dev/null 2>&1 +00 22 * * * www-se3 /usr/bin/php /var/www/se3/wpkg/wpkg_svn.php >/dev/null 2>&1 # mise a jour automatique du fichier rapport toutes les 5 minutes */5 * * * * root /var/www/se3/wpkg/bin/rapports.sh >/dev/null 2>&1 -- GitLab From 84a52aab04ed2bbfbefdae5a57351ae53b6fc073 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 4 Jan 2018 01:24:49 +0100 Subject: [PATCH 06/64] changement owner rapport.xml --- sources/www/bin/rapports.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/www/bin/rapports.sh b/sources/www/bin/rapports.sh index 493e6d6..25f75ad 100644 --- a/sources/www/bin/rapports.sh +++ b/sources/www/bin/rapports.sh @@ -54,6 +54,9 @@ fi /usr/bin/php /var/www/se3/wpkg/wpkg_rapport.php +chown www-se3:www-data $RAPPORTXML +chown www-se3:www-data $RAPPORTMD5XML + rm -f $fich_lock cd - > /dev/null -- GitLab From 35072f42508c90a0903c5a1ab61ff78d89c81378 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Mon, 8 Jan 2018 01:46:36 +0100 Subject: [PATCH 07/64] nouvelle interface wpkg app ajout des fonctions de modifications/suppressions --- sources/www/app_maintenance_parc.php | 13 +- sources/www/app_maintenance_poste.php | 11 +- sources/www/app_maintenance_supp.php | 288 ++++++++++++++++++++++++++ sources/www/wpkg_lib.php | 102 ++++++--- sources/www/wpkg_lib_admin.php | 105 +++++++++- sources/www/wpkg_lib_load_xml.php | 23 ++ 6 files changed, 498 insertions(+), 44 deletions(-) create mode 100644 sources/www/app_maintenance_supp.php create mode 100644 sources/www/wpkg_lib_load_xml.php diff --git a/sources/www/app_maintenance_parc.php b/sources/www/app_maintenance_parc.php index e867e42..a08b5ab 100644 --- a/sources/www/app_maintenance_parc.php +++ b/sources/www/app_maintenance_parc.php @@ -77,12 +77,12 @@ $post_action=""; $result_xml=""; - if ($post_action=="Annuler les modificaitons") + if ($post_action=="Annuler les modifications") { header("Location: app_maintenance.php?tri2=".$tri2."&Appli=".$get_Appli."&parc=".$get_parc."&tous=".$get_tous."&ok=".$get_ok."&warning=".$get_warning."&error=".$get_error); exit; } - elseif ($post_action=="Valider les modificaitons") + elseif ($post_action=="Valider les modifications") { if (isset($_POST["parc"])) $post_parc=$_POST["parc"]; @@ -95,6 +95,7 @@ if ($tmp_result_xml["in"]>1) $result_xml.="s"; $result_xml.=".
"; + include("wpkg_lib_load_xml.php"); } echo "\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + echo "\n"; + + echo "
\n"; + $page_id=2; + include ("app_top.php"); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
\n"; + + + $list_appli_required_by=get_list_wpkg_required_by_app($xml_packages); + $stop=0; + + if (isset($_POST["action"])) + $post_action=$purifier->purify($_POST["action"]); + else + $post_action=""; + + if ($post_action=='Valider la suppression') + { + echo "\n"; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + else + { + if (isset($_POST["file"])) + $post_file=$_POST["file"]; + else + $post_file=array(); + if ($post_file) + { + foreach ($post_file as $pf) + { + echo "Suppression du fichier ".$url_wpkg."/".$pf."
\n"; + unlink($url_wpkg."/".$pf); + } + } + $return = remove_app($get_Appli,$url_packages); + if ($return==0) + { + echo "Erreur lors de la suppression de l'application.
\n"; + } + else + { + update_timeStamps($url_time,$get_Appli,"del","","",$login); + clean_timeStamps($url_time); + echo "Suppression de l'application effectuée.
\n"; + } + echo ""; + echo "\n"; + } + echo ""; + echo ""; + echo "\n"; + echo "
Suppression de l'application
\n"; + $stop=0; + + // test de securite + if (count($list_appli_required_by[$get_Appli])>0) + { + echo "Erreur : Pour supprimer l'application, il faut supprimer toutes les applications dont elle dépend ("; + $i=0; + foreach ($list_appli_required_by[$get_Appli] as $larb) + { + if ($i>0) + echo ", "; + echo $liste_appli[$larb]["name"]; + $i++; + } + echo ")"; + echo "
\n"; + $stop=1; + } + + $nb_poste_app=count($liste_appli_postes[$get_Appli]); + if ($nb_poste_app>0) + { + echo "Erreur : Pour supprimer l'application, il faut qu'elle ne soit associée à aucun poste (".$nb_poste_app." postes associées)"; + echo "
\n"; + $stop=1; + } + + if (in_array($get_Appli,$list_protected_app)) + { + echo "Erreur : L'application est protégée. Vous ne pouvez pas la supprimer."; + echo "
\n"; + } + + if ($stop==1) + { + echo "
"; + echo "Suppression annulée.
"; + echo "
"; + echo "Retour"; + echo "
\n"; + } + else + { + echo "
\n"; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + else + { + echo ""; + echo "\n"; + echo ""; + echo ""; + echo "\n"; + } + + echo ""; + echo ""; + echo "\n"; + echo "
Suppression de l'application
"; + + if (count($list_appli_required_by[$get_Appli])>0) + { + echo "Erreur : Pour supprimer l'application, il faut supprimer toutes les applications dont elle dépend ("; + $i=0; + foreach ($list_appli_required_by[$get_Appli] as $larb) + { + if ($i>0) + echo ", "; + echo $liste_appli[$larb]["name"]; + $i++; + } + echo ")"; + echo "
\n"; + $stop=1; + } + + $nb_poste_app=count($liste_appli_postes[$get_Appli]); + if ($nb_poste_app>0) + { + echo "Erreur : Pour supprimer l'application, il faut qu'elle ne soit associée à aucun poste (".$nb_poste_app." postes associées)"; + echo "
\n"; + $stop=1; + } + + if (in_array($get_Appli,$list_protected_app)) + { + echo "Erreur : L'application est protégée. Vous ne pouvez pas la supprimer."; + echo "
\n"; + } + + if ($stop==0) + { + $list_files=get_list_wpkg_file_app($xml_packages, $get_Appli); + + echo "Avant de supprimer l'application, vérifiez qu'elle n'est plus installée sur les postes."; + echo "
"; + if (count($list_files)>0) + { + echo "Les fichiers qui ont été téléchargés, lors de son installation, peuvent également être supprimés du serveur. "; + echo "Pour cela sélectionnez ceux que vous voulez effacer.
"; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach ($list_files as $lf) + { + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
Tous les fichiers / Aucun fichier
".$lf."
\n"; + echo "
\n"; + } + else + { + echo "Aucun fichier n'a été téléchargé, lors de l'installation de l'application.
\n"; + } + echo "
"; + echo "
"; + echo "Suppression annulée.
"; + echo "
"; + echo "Retour"; + echo "
"; + echo "
\n"; + } + + include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index 6e70877..f553858 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -14,35 +14,38 @@ // définition des style couleurs par defaut -$warning_bg = "#FF0000"; -$warning_txt = "#FFFFFF"; -$warning_lnk = "#FFFF00"; -$error_bg = "#FFFF00"; -$error_txt = "#000000"; -$error_lnk = "#415594"; -$ok_bg = "#00FF00"; -$ok_txt = "#000000"; -$ok_lnk = "#415594"; -$unknown_bg = "#FFFFFF"; -$unknown_txt = "#000000"; -$unknown_lnk = "#415594"; -$regular_lnk = "#0080ff"; -$wintype_txt = "#FFF8DC"; + $warning_bg = "#FF0000"; + $warning_txt = "#FFFFFF"; + $warning_lnk = "#FFFF00"; + $error_bg = "#FFFF00"; + $error_txt = "#000000"; + $error_lnk = "#415594"; + $ok_bg = "#00FF00"; + $ok_txt = "#000000"; + $ok_lnk = "#415594"; + $unknown_bg = "#FFFFFF"; + $unknown_txt = "#000000"; + $unknown_lnk = "#415594"; + $regular_lnk = "#0080ff"; + $wintype_txt = "#FFF8DC"; -$dep_entite_bg = "#0000FF"; -$dep_entite_txt = "#FFFFFF"; -$dep_entite_lnk = "#FF0000"; -$dep_parc_bg = "#0080FF"; -$dep_parc_txt = "#000000"; -$dep_parc_lnk = "#FF0000"; -$dep_depend_bg = "#00FFFF"; -$dep_depend_txt = "#000000"; -$dep_depend_lnk = "#FF0000"; -$dep_no_bg = "#FFFFFF"; -$dep_no_txt = "#000000"; -$dep_no_lnk = "#FF0000"; + $dep_entite_bg = "#0000FF"; + $dep_entite_txt = "#FFFFFF"; + $dep_entite_lnk = "#FF0000"; + $dep_parc_bg = "#0080FF"; + $dep_parc_txt = "#000000"; + $dep_parc_lnk = "#FF0000"; + $dep_depend_bg = "#00FFFF"; + $dep_depend_txt = "#000000"; + $dep_depend_lnk = "#FF0000"; + $dep_no_bg = "#FFFFFF"; + $dep_no_txt = "#000000"; + $dep_no_lnk = "#FF0000"; +// localisation wpkg + + $url_wpkg = "/var/se3/unattended/install"; // localisation des xml de wpkg @@ -53,12 +56,13 @@ $dep_no_lnk = "#FF0000"; $url_hosts = "/var/se3/unattended/install/wpkg/hosts.xml"; $url_forum = "/var/www/se3/wpkg/forum.xml"; - $xml_packages = simplexml_load_file($url_packages); - $xml_profiles = simplexml_load_file($url_profiles); - $xml_rapports = simplexml_load_file($url_rapports); - $xml_time = simplexml_load_file($url_time); - $xml_hosts = simplexml_load_file($url_hosts); - $xml_forum = simplexml_load_file($url_forum); +// Chargement des xml avec simpleXML + + include("wpkg_lib_load_xml.php"); + +// Liste des applications protegees + + $list_protected_app=array("wsusoffline", "ocs-client"); // listes des fonctions /* @@ -71,9 +75,11 @@ $dep_no_lnk = "#FF0000"; get_list_wpkg_poste_parc($xml_profiles) : liste des postes par parc get_list_wpkg_poste_app($xml_profiles, $xml_hosts) : liste des postes demandes pour une appli get_list_wpkg_depend_app($xml_packages) : liste des dependances d une appli - get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts,$xml_packages) : liste complete des postes pour une appli + get_list_wpkg_required_by_app($xml_packages) : liste des applis dependant d une appli + get_list_wpkg_poste_app_all($xml_profiles,$xml_hosts,$xml_packages) : liste complete des postes pour une appli get_list_wpkg_rapports_statut_poste_app($xml_rapports) : status des app installees sur un poste get_list_wpkg_rapports_statut_app($xml_rapports) : status d une app installee + get_list_wpkg_file_app($xml_packages, $appli) : liste des fichiers d'une application donnee --- @@ -213,6 +219,19 @@ $dep_no_lnk = "#FF0000"; return $list_profiles; } + function get_list_wpkg_required_by_app($xml_packages) + { + $list_profiles=array(); + foreach ($xml_packages->package as $package) + { + foreach ($package->depends as $package2) + { + $list_profiles[(string) $package2["package-id"]][] = (string) $package["id"]; + } + } + return $list_profiles; + } + function get_list_wpkg_poste_app_all($xml_profiles,$xml_hosts,$xml_packages) { $list_parc=get_list_wpkg_parcs($xml_profiles); @@ -291,6 +310,23 @@ $dep_no_lnk = "#FF0000"; return $liste_statuts; } + + function get_list_wpkg_file_app($xml_packages, $appli) + { + $liste_fichier=array(); + foreach ($xml_packages->package as $package) + { + if ((string) $package["id"]==$appli) + { + foreach ($package->download as $download) + { + $liste_fichier[]=(string) $download["saveto"]; + } + } + } + return $liste_fichier; + } + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// function get_list_wpkg_svn_info($xml_forum) diff --git a/sources/www/wpkg_lib_admin.php b/sources/www/wpkg_lib_admin.php index cba8e2c..a5461c8 100644 --- a/sources/www/wpkg_lib_admin.php +++ b/sources/www/wpkg_lib_admin.php @@ -19,6 +19,9 @@ set_app_parcs($post_parc,$get_Appli,$liste_parcs,$url_profiles) set_app_postes($post_host,$get_Appli,$liste_parcs,$url_profiles) + remove_app($get_Appli,$url_packages) + clean_timeStamps($url_time) + update_timeStamps($url_time,$get_Appli,$operation,$xml,$md5sum,$login) */ @@ -57,7 +60,7 @@ function set_app_parcs($post_parc,$get_Appli,$liste_parcs,$url_profiles) } } - $xml->save("/var/se3/unattended/install/wpkg/profiles_test.xml"); + $xml->save($url_profiles); return $result; } @@ -96,9 +99,107 @@ function set_app_postes($post_host,$get_Appli,$liste_parcs,$url_profiles) } } - $xml->save("/var/se3/unattended/install/wpkg/profiles_test.xml"); + $xml->save($url_profiles); return $result; } +function remove_app($get_Appli,$url_packages) +{ + $xml = new DOMDocument; + $xml->formatOutput = true; + $xml->preserveWhiteSpace = false; + $xml->load($url_packages); + $element = $xml->documentElement; + $packages = $xml->documentElement->getElementsByTagName('package'); + $length = $packages->length; + + $xml2 = new DOMDocument; + $xml2->formatOutput = true; + $xml2->preserveWhiteSpace = false; + $root=$xml2->createElement("packages"); + $xml2->appendChild($root); + $comment=$xml2->createComment(" Fichier genere par SambaEdu. Ne pas modifier. Il contient ".($length-1)." applications. "); + $root->appendChild($comment); + $packages2 = $xml2->documentElement->getElementsByTagName('package'); + + $result=0; + + foreach ($packages as $package) + { + if ($package->getAttribute('id')==$get_Appli) + { + $return=1; + } + else + { + $node=$xml2->importNode($package, true); + $xml2->documentElement->appendChild($node); + } + } + + $xml2->save($url_packages); + + return $return; +} + +function clean_timeStamps($url_time) +{ + $xml_time = new DOMDocument; + $xml_time->formatOutput = true; + $xml_time->preserveWhiteSpace = false; + $xml_time->load($url_time); + $element_time = $xml_time->documentElement; + $packages_time = $xml_time->documentElement->getElementsByTagName('package'); + + $result=array(); + + foreach ($packages_time as $package_time) + { + $ops_time = $package_time->getElementsByTagName('op'); + $length = $ops_time->length; $i=$length; + for ($i=$length-4; $i>=0; $i--) + { + $package_time->removeChild($ops_time->item($i)); + } + } + $xml_time->save($url_time); + + return 1; +} + +function update_timeStamps($url_time,$get_Appli,$operation,$xml,$md5sum,$login) +{ + $xml_time = new DOMDocument; + $xml_time->formatOutput = true; + $xml_time->preserveWhiteSpace = false; + $xml_time->load($url_time); + $element_time = $xml_time->documentElement; + $packages_time = $xml_time->documentElement->getElementsByTagName('package'); + + $date=date(DATE_ATOM); + + foreach ($packages_time as $package_time) + { + if ($package_time->getAttribute('id')==$get_Appli) + { + $new_operation = new DOMElement('op'); + $new_operation2 = $package_time->appendChild($new_operation); + $new_operation2->setAttribute("op", $operation); + $new_operation2->setAttribute("date", $date); + if ($operation=="add") + { + $new_operation2->setAttribute("xml", $xml); + $new_operation2->setAttribute("md5sum", $md5sum); + } + $new_operation2->setAttribute("user", $login); + } + } + + + $xml_time->save($url_time); + + return 1; +} + ?> \ No newline at end of file diff --git a/sources/www/wpkg_lib_load_xml.php b/sources/www/wpkg_lib_load_xml.php new file mode 100644 index 0000000..8cba774 --- /dev/null +++ b/sources/www/wpkg_lib_load_xml.php @@ -0,0 +1,23 @@ + \ No newline at end of file -- GitLab From 14f3f35d9db16245fbdd04b93d604bb987de2fe7 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Mon, 8 Jan 2018 01:57:31 +0100 Subject: [PATCH 08/64] Nouvelle version 2.00 alpha1 --- sources/debian/changelog | 9 +++++++++ sources/menu.d_temp/98wpkg.inc | 2 ++ 2 files changed, 11 insertions(+) diff --git a/sources/debian/changelog b/sources/debian/changelog index 38f0553..79008be 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,3 +1,12 @@ +se3-wpkg (2.00~a0) unstable; urgency=low + + * creation d'une interface wpkg pour les applications + * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes + * ajout d'un cron pour la generation de forum.xml toutes les nuits + * ajout d'une fonction de nettoyage de timeStamps.xml + + -- Laurent Joly Mon, 08 Jan 2018 01:50:20 +0200 + se3-wpkg (0.91~) unstable; urgency=low * Modification du fonctionnement de wsusoffline-download.sh si l'application n'est pas active dans l'interface diff --git a/sources/menu.d_temp/98wpkg.inc b/sources/menu.d_temp/98wpkg.inc index 3b2493d..b18449e 100644 --- a/sources/menu.d_temp/98wpkg.inc +++ b/sources/menu.d_temp/98wpkg.inc @@ -31,6 +31,7 @@ if(mysql_num_rows($resultat)==0){ gettext("Détail d'une application"), "wpkg/admin.html?PageEnCours=AffichePackage","computers_is_admin|parc_can_manage|parc_can_view",3, gettext("Détail d'un poste"), "wpkg/admin.html?PageEnCours=AfficheHost","computers_is_admin|parc_can_manage|parc_can_view",3, gettext("Détail des applis d'un parc"), "wpkg/listappli2.php","computers_is_admin|parc_can_manage|parc_can_view",3, + gettext("Gestion des applications"), "wpkg/app_liste.php","computers_is_admin|parc_can_manage|parc_can_view",3, gettext("Paramétrage de Wsus Offline"), "wpkg/wsusoffline.php","computers_is_admin|parc_can_manage|parc_can_view",3 )); } else { @@ -42,6 +43,7 @@ if(mysql_num_rows($resultat)==0){ gettext("Détail d'une application"), "wpkg/admin.html?PageEnCours=AffichePackage","",3, gettext("Détail d'un poste"), "wpkg/admin.html?PageEnCours=AfficheHost","",3, gettext("Détail des applis d'un parc"), "wpkg/listappli2.php","",3, + gettext("Gestion des applications"), "wpkg/app_liste.php","",3, gettext("Paramétrage de Wsus Offline"), "wpkg/wsusoffline.php","",3 )); } -- GitLab From bf88b3b5bf3dc8e1a84510428b7422de3a3862ae Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Mon, 8 Jan 2018 02:17:52 +0100 Subject: [PATCH 09/64] ajout d'un lien retour --- sources/debian/changelog | 2 +- sources/www/app_maintenance_parc.php | 5 +++++ sources/www/app_maintenance_poste.php | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index 79008be..bdde295 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,4 +1,4 @@ -se3-wpkg (2.00~a0) unstable; urgency=low +se3-wpkg (2.00~a1) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes diff --git a/sources/www/app_maintenance_parc.php b/sources/www/app_maintenance_parc.php index a08b5ab..48f8a83 100644 --- a/sources/www/app_maintenance_parc.php +++ b/sources/www/app_maintenance_parc.php @@ -136,6 +136,11 @@ echo "Déploiement non demandé pour ce parc"; echo "\n"; echo "\n"; + echo "\n"; + echo ""; + echo "Retour"; + echo "\n"; + echo "\n"; echo "
\n"; echo $result_xml; diff --git a/sources/www/app_maintenance_poste.php b/sources/www/app_maintenance_poste.php index 0a71080..49247d0 100644 --- a/sources/www/app_maintenance_poste.php +++ b/sources/www/app_maintenance_poste.php @@ -139,6 +139,11 @@ echo "Déploiement non demandé pour ce poste"; echo "\n"; echo "\n"; + echo "\n"; + echo ""; + echo "Retour"; + echo "\n"; + echo "\n"; echo "
\n"; echo $result_xml; -- GitLab From 21ab9600775ce4c0c1aefd8764acdf6b838681f0 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Fri, 12 Jan 2018 10:40:11 +0100 Subject: [PATCH 10/64] =?UTF-8?q?Correctif=20mauvaise=20d=C3=A9tection=20s?= =?UTF-8?q?tatut=20inconnu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/www/wpkg_lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index f553858..3850c03 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -389,22 +389,22 @@ $liste_status["NotOk"][]=$host_id; } } - elseif ($liste_appli_status[$host_id]["status"]=="Not Installed") + elseif ($liste_appli_status[$host_id]["status"]=="Installed") { - $liste_status["Ok"][]=$host_id; + $liste_status["NotOk"][]=$host_id; } else { - $liste_status["NotOk"][]=$host_id; + $liste_status["Ok"][]=$host_id; } } - elseif ($liste_appli_status[$host_id]["status"]=="Not Installed") + elseif ($liste_appli_status[$host_id]["status"]=="Installed") { - $liste_status["Ok"][]=$host_id; + $liste_status["NotOk"][]=$host_id; } else { - $liste_status["NotOk"][]=$host_id; + $liste_status["Ok"][]=$host_id; } } return $liste_status; -- GitLab From 624b013f94a3aa4ec931806b933cf120f4239807 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Fri, 12 Jan 2018 11:38:48 +0100 Subject: [PATCH 11/64] =?UTF-8?q?correctif=20affichage=20app=20d=C3=A9ploy?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/www/app_parcs.php | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/www/app_parcs.php b/sources/www/app_parcs.php index 89c7d21..0562a24 100644 --- a/sources/www/app_parcs.php +++ b/sources/www/app_parcs.php @@ -149,6 +149,7 @@ $list_poste[$i]["bg"]=$unknown_bg; $list_poste[$i]["txt"]=$unknown_txt; $list_poste[$i]["lnk"]=$unknown_lnk; + $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); } $list_poste[$i]["status"]="Inconnu"; $list_poste[$i]["revision"]="-"; -- GitLab From 48513958fd12caddca5db8f130c04ff6a5bcf06f Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Tue, 23 Jan 2018 19:33:56 +0100 Subject: [PATCH 12/64] Correctif + ajout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correctif erreur titre page gestion Correctif fonction (variable superflux) début ajout parc --- sources/www/app_liste.php | 2 +- sources/www/app_maintenance_poste.php | 2 +- sources/www/app_top.php | 4 +- sources/www/parc_statuts.php | 377 ++++++++++++++++++++++++++ sources/www/parc_top.php | 228 ++++++++++++++++ sources/www/wpkg_lib.php | 106 +++++++- 6 files changed, 710 insertions(+), 9 deletions(-) create mode 100644 sources/www/parc_statuts.php create mode 100644 sources/www/parc_top.php diff --git a/sources/www/app_liste.php b/sources/www/app_liste.php index ea91f0d..b5b89ea 100644 --- a/sources/www/app_liste.php +++ b/sources/www/app_liste.php @@ -42,7 +42,7 @@ echo "

Liste des applications du serveur

"; $liste_appli=get_list_wpkg_app($xml_packages, $xml_time); - $liste_appli_postes=get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts, $xml_packages); + $liste_appli_postes=get_list_wpkg_poste_app_all($xml_profiles, $xml_packages); $liste_appli_status=get_list_wpkg_rapports_statut_app($xml_rapports); $liste_hosts=get_list_wpkg_hosts($xml_hosts); $svn_info=get_list_wpkg_svn_info($xml_forum); diff --git a/sources/www/app_maintenance_poste.php b/sources/www/app_maintenance_poste.php index 49247d0..bbddfbc 100644 --- a/sources/www/app_maintenance_poste.php +++ b/sources/www/app_maintenance_poste.php @@ -162,7 +162,7 @@ echo ""; echo "\n"; - $list_app_hosts_all=get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts, $xml_packages); + $list_app_hosts_all=get_list_wpkg_poste_app_all($xml_profiles, $xml_packages); $list_app_hosts=get_list_wpkg_poste_app($xml_profiles, $xml_hosts); $liste_parc_app=get_list_wpkg_parc_app($xml_profiles); diff --git a/sources/www/app_top.php b/sources/www/app_top.php index cf78ab5..b376209 100644 --- a/sources/www/app_top.php +++ b/sources/www/app_top.php @@ -2,7 +2,7 @@ // recuperation des donnees $liste_appli=get_list_wpkg_app($xml_packages, $xml_time); - $liste_appli_postes=get_list_wpkg_poste_app_all($xml_profiles, $xml_hosts, $xml_packages); + $liste_appli_postes=get_list_wpkg_poste_app_all($xml_profiles, $xml_packages); $liste_appli_status=get_list_wpkg_rapports_statut_app($xml_rapports); $liste_hosts=get_list_wpkg_hosts($xml_hosts); asort($liste_hosts); @@ -53,7 +53,7 @@ } else { - echo "Maintenance"; + echo "Gestion"; } echo "\n"; echo ""; diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php new file mode 100644 index 0000000..4286cf5 --- /dev/null +++ b/sources/www/parc_statuts.php @@ -0,0 +1,377 @@ +\n\n\n"; + exit; + } + + if (is_admin("computers_is_admin",$login)!="Y") + die (gettext("Vous n'avez pas les droits suffisants pour accéder à cette fonction").""); + + // HTMLpurifier + include("../se3/includes/library/HTMLPurifier.auto.php"); + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + + if (isset($_GET["tri"])) + $tri=$purifier->purify($_GET["tri"])+0; + else + $tri=0; + if (isset($_GET["tri2"])) + $tri2=$purifier->purify($_GET["tri2"])+0; + else + $tri2=0; + if (isset($_GET['Appli'])) + $get_Appli=$purifier->purify($_GET['Appli']); + else + $get_Appli=""; + if (isset($_GET['parc'])) + $get_parc=$purifier->purify($_GET['parc']); + else + $get_parc=""; + if (isset($_GET["warning"])) + $get_warning=$purifier->purify($_GET["warning"])+0; + else + $get_warning=1; + if (isset($_GET["error"])) + $get_error=$purifier->purify($_GET["error"])+0; + else + $get_error=1; + if (isset($_GET["ok"])) + $get_ok=$purifier->purify($_GET["ok"])+0; + else + $get_ok=0; + if (isset($_GET["tous"])) + $get_tous=$purifier->purify($_GET["tous"])+0; + else + $get_tous=0; + + $liste_rapports_status_poste = get_list_wpkg_rapports_statut_poste_app($xml_rapports); + $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); + $liste_parcs=array_keys($liste_postes_parc); + asort($liste_parcs); + + if (!count($liste_postes_parc[$get_parc])) + { + $get_parc="_TousLesPostes"; + } + + echo "
\n"; + $page_id=1; + include ("parc_top.php"); + + print_r(get_list_wpkg_postes_status($id_parc,$xml_packages,$xml_rapports,$xml_profiles)); + + $list_poste=array(); + $parc_poste_status=array("Ok"=>0, "NotOk"=>0, "MaJ"=>0, "Total"=>0); + $i=0; + + foreach ($liste_postes_parc[$get_parc] as $poste_parc) + { + $info_poste=$liste_rapports_status_poste[$poste_parc]["info"]; + $info_app=$liste_rapports_status_poste[$poste_parc][$get_Appli]; + + if (in_array($poste_parc,$liste_status_tmp["NotOk"])) + { + $list_poste[$i]["wpkg"]=$get_warning; + $list_poste[$i]["wpkg_status"]=3; + $list_poste[$i]["bg"]=$warning_bg; + $list_poste[$i]["txt"]=$warning_txt; + $list_poste[$i]["lnk"]=$warning_lnk; + $parc_poste_status["NotOk"]++; + $parc_poste_status["Total"]++; + } + elseif (in_array($poste_parc,$liste_status_tmp["MaJ"])) + { + $list_poste[$i]["wpkg"]=$get_error; + $list_poste[$i]["wpkg_status"]=2; + $list_poste[$i]["bg"]=$error_bg; + $list_poste[$i]["txt"]=$error_txt; + $list_poste[$i]["lnk"]=$error_lnk; + $parc_poste_status["MaJ"]++; + $parc_poste_status["Total"]++; + } + else + { + $list_poste[$i]["wpkg"]=$get_ok; + $list_poste[$i]["wpkg_status"]=1; + $list_poste[$i]["bg"]=$ok_bg; + $list_poste[$i]["txt"]=$ok_txt; + $list_poste[$i]["lnk"]=$ok_lnk; + $parc_poste_status["Ok"]++; + $parc_poste_status["Total"]++; + } + + if ($info_app!="") + { + if ($info_app["status"]=="Installed") + { + $list_poste[$i]["status"]="Installé"; + } + else + { + $list_poste[$i]["status"]="Non Installé"; + if ($list_poste[$i]["wpkg_status"]==1) + { + $list_poste[$i]["bg"]=$unknown_bg; + $list_poste[$i]["txt"]=$unknown_txt; + $list_poste[$i]["lnk"]=$unknown_lnk; + $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); + } + } + $list_poste[$i]["revision"]=$info_app["revision"]; + } + else + { + if ($list_poste[$i]["wpkg_status"]==1) + { + $list_poste[$i]["bg"]=$unknown_bg; + $list_poste[$i]["txt"]=$unknown_txt; + $list_poste[$i]["lnk"]=$unknown_lnk; + $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); + } + $list_poste[$i]["status"]="Inconnu"; + $list_poste[$i]["revision"]="-"; + } + $list_poste[$i]["poste"]=$poste_parc; + switch ($info_poste["typewin"]) + { + case 'Windows XP': + $list_poste[$i]["typewin"]="winxp.png"; + break; + case 'Windows 7': + $list_poste[$i]["typewin"]="win7.png"; + break; + case 'Windows 10': + $list_poste[$i]["typewin"]="win10.png"; + break; + default: + $list_poste[$i]["typewin"]="vide.png"; + break; + } + $list_poste[$i]["logfile"]=$info_poste["logfile"]; + $list_poste[$i]["date"]=$info_poste["date"]; + $list_poste[$i]["time"]=$info_poste["time"]; + $list_poste[$i]["datetime"]=$info_poste["datetime"]; + $list_poste[$i]["ip"]=$info_poste["ip"]; + $list_poste[$i]["mac"]=$info_poste["mac"]; + + $tri_poste[$i]=$list_poste[$i]["poste"]; + $tri_status[$i]=$list_poste[$i]["status"]; + $tri_revision[$i]=$list_poste[$i]["revision"]; + $tri_date[$i]=$list_poste[$i]["datetime"]; + $tri_ip[$i]=ip2long($list_poste[$i]["ip"]); + $tri_mac[$i]=$list_poste[$i]["mac"]; + + $i++; + } + + if ($list_poste) + { + switch ($tri2) + { + case 0: + array_multisort($tri_poste, SORT_ASC, $list_poste); + break; + case 1: + array_multisort($tri_poste, SORT_DESC, $list_poste); + break; + case 2: + array_multisort($tri_status, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 3: + array_multisort($tri_status, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 4: + array_multisort($tri_revision, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 5: + array_multisort($tri_revision, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 6: + array_multisort($tri_date, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + break; + case 7: + array_multisort($tri_date, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + break; + case 8: + array_multisort($tri_ip, SORT_ASC, $list_poste); + break; + case 9: + array_multisort($tri_ip, SORT_DESC, $list_poste); + break; + case 10: + array_multisort($tri_mac, SORT_ASC, $list_poste); + break; + case 11: + array_multisort($tri_mac, SORT_DESC, $list_poste); + break; + default: + array_multisort($tri_poste, SORT_ASC, $list_poste); + break; + } + } + + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
ParcNombre de postesPostes à jourPostes en erreurPostes pas à jour
"; + echo $get_parc."
"; + echo ""; + echo "
"; + echo $parc_poste_status["Total"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["Ok"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["NotOk"]."
"; + echo ""; + echo "
"; + echo $parc_poste_status["MaJ"]."
"; + echo ""; + echo "
\n"; + echo "
\n"; + echo "
\n"; + + + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + + foreach ($list_poste as $lp) + { + if ($lp["wpkg"]==1) + { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + } + } + echo "
Nom du posteOSStatutVersionDate du dernier rapportAdresse ipAdresse mac
".$lp["poste"].""; + echo ''; + echo "".$lp["status"]."".$lp["revision"]."".$lp["date"]." à ".$lp["time"]."".$lp["ip"]."".$lp["mac"]."
\n"; + +include ("pdp.inc.php"); +?> \ No newline at end of file diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php new file mode 100644 index 0000000..b376209 --- /dev/null +++ b/sources/www/parc_top.php @@ -0,0 +1,228 @@ +$value) + { + $liste_appli[$key]["nb_postes"]=count($value)+0; + } + + $application=$liste_appli[$get_Appli]; + echo "

Application : ".$application["name"]."

\n"; + + echo ""; + +// tableau 0 + echo "\n"; + echo ""; + echo ""; + if ($page_id==1) + { + echo ""; + } + else + { + echo ""; + } + if ($page_id==2) + { + echo ""; + } + else + { + echo ""; + } + echo "\n"; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
Liste des ApplicationsEtat du déploiementEtat du déploiementGestionGestion
"; + echo ""; + echo "
\n"; + echo "
\n"; + + +// tableau 1 + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + if (isset($svn_info[$application["id"]])) + { + $rev=array(); + if (isset ($svn_info[$application["id"]]["stable"])) + { + $rev["stable"]=$svn_info[$application["id"]]["stable"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["test"])) + { + $rev["test"]=$svn_info[$application["id"]]["test"]["revision"]; + } + if (isset ($svn_info[$application["id"]]["XP"]) and get_wpkg_branche_XP()==1) + { + $rev["XP"]=$svn_info[$application["id"]]["XP"]["revision"]; + } + if (in_array($application["revision"],$rev)) + { + echo ""; + } + else + { + echo ""; + } + echo "\n"; + echo "
Fichier xmlVersionCompatibilitéCatégoriePrioritéRebootDate d'ajoutVersion SVN
xml".$application["revision"].""; + + switch ($application["compatibilite"]) + { + case 1: + echo ""; + break; + case 2: + echo ""; + break; + case 3: + echo ""; + break; + case 4: + echo ""; + break; + case 5: + echo ""; + break; + case 6: + echo ""; + break; + case 7: + echo ""; + break; + case 0: + echo ""; + break; + default: + echo ""; + break; + + } + echo "".$application["category"]."".$application["priority"].""; + if ($application["reboot"]=="false") + echo "Non"; + else + echo "Oui"; + echo "".$application["date2"].""; + } + else + { + echo ""; + } + $i=0; + foreach ($rev as $key=>$value) + { + if ($i>0) + echo "
"; + echo $value." (".$key.")"; + $i++; + } + echo "
-
\n"; + echo "
\n"; + + // tableau 2 + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "
Dépend deRequis parNombre de postesPostes en erreurPostes pas à jour
"; + if (isset($application["depends"])) + { + $i=0; + foreach ($application["depends"] as $dependance) + { + if ($i>0) + echo "
"; + echo ""; + echo $liste_appli[$dependance]["name"]; + echo ""; + $i++; + } + } + echo "
"; + if (isset($application["required_by"])) + { + $i=0; + foreach ($application["required_by"] as $requis) + { + if ($i>0) + echo "
"; + echo ""; + echo $liste_appli[$requis]["name"]; + echo ""; + $i++; + } + } + echo "
".($application["nb_postes"]+0)."0) + echo " bgcolor='".$warning_bg."' style='color:".$warning_txt."'"; + echo ">".$application["NotOk"]."0) + echo " bgcolor='".$error_bg."' style='color:".$error_txt."'"; + echo ">".$application["MaJ"]."
\n"; + echo "
\n"; +?> \ No newline at end of file diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index 3850c03..a1be9f1 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -76,10 +76,11 @@ get_list_wpkg_poste_app($xml_profiles, $xml_hosts) : liste des postes demandes pour une appli get_list_wpkg_depend_app($xml_packages) : liste des dependances d une appli get_list_wpkg_required_by_app($xml_packages) : liste des applis dependant d une appli - get_list_wpkg_poste_app_all($xml_profiles,$xml_hosts,$xml_packages) : liste complete des postes pour une appli + get_list_wpkg_poste_app_all($xml_profiles,$xml_packages) : liste complete des postes pour une appli get_list_wpkg_rapports_statut_poste_app($xml_rapports) : status des app installees sur un poste get_list_wpkg_rapports_statut_app($xml_rapports) : status d une app installee get_list_wpkg_file_app($xml_packages, $appli) : liste des fichiers d'une application donnee + get_list_wpkg_postes_status($liste_hosts,$xml_packages,$xml_rapports,$xml_profiles,$xml_hosts) : Liste de l'état des postes --- @@ -232,11 +233,10 @@ return $list_profiles; } - function get_list_wpkg_poste_app_all($xml_profiles,$xml_hosts,$xml_packages) + function get_list_wpkg_poste_app_all($xml_profiles,$xml_packages) { $list_parc=get_list_wpkg_parcs($xml_profiles); $poste_parc=get_list_wpkg_poste_parc($xml_profiles); - $list_host=get_list_wpkg_hosts($xml_hosts); $list_depend=get_list_wpkg_depend_app($xml_packages); $list_profiles=array(); foreach ($xml_profiles->profile as $profile1) @@ -321,11 +321,107 @@ foreach ($package->download as $download) { $liste_fichier[]=(string) $download["saveto"]; - } + }1 } } return $liste_fichier; } + + function get_list_wpkg_postes_status($id_parc,$xml_packages,$xml_rapports,$xml_profiles) + { + + $list_parc=get_list_wpkg_parcs($xml_profiles); // liste des parcs + $poste_parc=get_list_wpkg_poste_parc($xml_profiles); // liste des postes par parc + $list_depend=get_list_wpkg_depend_app($xml_packages); // Liste des dépendances + $list_profiles=array(); // liste des statuts des apps pour chaque poste + $list_app_info=array(); // liste des infos pour chaque app + $liste_statuts=array(); // liste des statuts des postes du parc + + if (!array_key_exists($id_parc,$poste_parc)) + return "-1"; + if (count($poste_parc[$id_parc])==0) + return "0"; + + foreach ($xml_profiles->profile as $profile1) + { + foreach ($profile1->package as $profile2) + { + if (array_key_exists((string) $profile1["id"],$poste_parc)) + { + foreach ($poste_parc[(string) $profile1["id"]] as $poste) + { + $list_profiles[$poste]["app"][(string) $profile2["package-id"]]["deployed"]=1; + if (isset($list_depend[(string) $profile2["package-id"]])) + { + foreach ($list_depend[(string) $profile2["package-id"]] as $depend) + { + $list_profiles[$poste]["app"][$depend]["deployed"]=1; + } + } + } + } + elseif (!in_array((string) $profile1["id"], $list_parc)) + { + $list_profiles[(string) $profile1["id"]]["app"][(string) $profile2["package-id"]]["deployed"]=1; + if (isset($list_depend[(string) $profile2["package-id"]])) + { + foreach ($list_depend[(string) $profile2["package-id"]] as $depend) + { + $list_profiles[(string) $profile1["id"]]["app"][$depend]["deployed"]=1; + } + } + } + } + } + foreach ($xml_packages->package as $app) + { + $list_app_info[(string) $app["id"]]["id"] = (string) $app["id"]; + $list_app_info[(string) $app["id"]]["revision"] = (string) $app["revision"]; + } + + foreach ($xml_rapports->rapport as $rapport) + { + if (in_array((string) $rapport["id"],$poste_parc['$id_parc'])) + { + $list_profiles[(string) $rapport["id"]]["info"] = array("datetime"=>(string) $rapport["datetime"], + "date"=>(string) $rapport["date"], + "time"=>(string) $rapport["time"], + "mac"=>(string) $rapport["mac"], + "ip"=>(string) $rapport["ip"], + "typewin"=>(string) $rapport["typewin"], + "logfile"=>(string) $rapport["logfile"]); + foreach ($rapport->package as $rapport2) + { + $list_profiles[(string) $rapport["id"]]["app"][(string) $rapport2["id"]]["installed"]=$rapport2["status"]; + $list_profiles[(string) $rapport["id"]]["app"][(string) $rapport2["id"]]["revision"]=$rapport2["revision"]; + } + } + } + + foreach ($list_profiles as $poste_nom=>$info_poste) + { + $liste_statuts[$poste_nom]["info"]=$info_poste["info"]; + $liste_statuts[$poste_nom]["status"] = array("ok"=>0 + ,"maj"=>0 + ,"notok+"=>0 + ,"notok-"=>0); + foreach ($info_poste["app"] as $app_nom=>$info_app_poste) + { + if ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Installed") + { + if ($info_app_poste["revision"]==$list_app_info[$app_nom]["revision"]) + $liste_statuts[$poste_nom]["status"]["ok"]++; + else + $liste_statuts[$poste_nom]["status"]["maj"]++; + } + elseif ($info_app_poste["deployed"]==0 and $info_app_poste["installed"]=="Installed") + $liste_statuts[$poste_nom]["status"]["notok+"]++; + elseif ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Not Installed") + $liste_statuts[$poste_nom]["status"]["notok-"]++; + } + } + return $liste_statuts; + } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -359,7 +455,7 @@ fclose($XP); return $XP_actif; } - + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// function get_list_wpkg_app_status($liste_hosts,$liste_appli_postes,$liste_appli_status,$revision) -- GitLab From 831259b17f87ca5dca94ebe3d2dc1e5117ff0572 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Tue, 23 Jan 2018 19:36:54 +0100 Subject: [PATCH 13/64] changelog --- sources/debian/changelog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index bdde295..a724ceb 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,11 +1,12 @@ -se3-wpkg (2.00~a1) unstable; urgency=low +se3-wpkg (2.00~a3) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes * ajout d'un cron pour la generation de forum.xml toutes les nuits * ajout d'une fonction de nettoyage de timeStamps.xml + * creation d'une interface wpkg pour les parcs - -- Laurent Joly Mon, 08 Jan 2018 01:50:20 +0200 + -- Laurent Joly Mon, 23 Jan 2018 19:30:20 +0200 se3-wpkg (0.91~) unstable; urgency=low -- GitLab From 9da4da75947de3a85264d899b0d1bae8828823c1 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Tue, 23 Jan 2018 19:45:42 +0100 Subject: [PATCH 14/64] correctif correctif faute de typo --- sources/www/wpkg_lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index a1be9f1..d06efb5 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -321,7 +321,7 @@ foreach ($package->download as $download) { $liste_fichier[]=(string) $download["saveto"]; - }1 + } } } return $liste_fichier; @@ -381,7 +381,7 @@ foreach ($xml_rapports->rapport as $rapport) { - if (in_array((string) $rapport["id"],$poste_parc['$id_parc'])) + if (in_array((string) $rapport["id"],$poste_parc[$id_parc])) { $list_profiles[(string) $rapport["id"]]["info"] = array("datetime"=>(string) $rapport["datetime"], "date"=>(string) $rapport["date"], -- GitLab From 1459e689b8f9700feed96b95e9a010753fee0799 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 10:08:18 +0100 Subject: [PATCH 15/64] gestion parc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modification fonction pour optimisation capsule d'entête modifié --- sources/www/parc_top.php | 213 ++++++--------------------------------- sources/www/wpkg_lib.php | 29 ++++-- 2 files changed, 52 insertions(+), 190 deletions(-) diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index b376209..e6a4646 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -1,51 +1,29 @@ $value) - { - $liste_appli[$key]["nb_postes"]=count($value)+0; - } - - $application=$liste_appli[$get_Appli]; - echo "

Application : ".$application["name"]."

\n"; + $liste_parcs=array_keys($liste_postes_parc); + asort($liste_parcs); + if (!array_key_exists($get_parc,$liste_parcs)) + header("Location: parc_status.php"); + $liste_poste_infos=get_list_wpkg_postes_status($get_parc,$xml_packages,$xml_rapports,$xml_profiles); + ksort($liste_poste_infos["postes"]); + + echo "

Gestion des parcs

\n"; echo ""; // tableau 0 echo "\n"; echo ""; - echo ""; if ($page_id==1) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } if ($page_id==2) { @@ -53,175 +31,48 @@ } else { - echo ""; + echo ""; } echo "\n"; echo ""; - echo ""; - echo ""; - echo "\n"; - echo "
Liste des ApplicationsEtat du déploiementEtat de parcsEtat du déploiementEtat des parcsGestionGestion
"; - echo ""; - echo "
\n"; - echo "
\n"; - - -// tableau 1 - echo "\n"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - if (isset($svn_info[$application["id"]])) - { - $rev=array(); - if (isset ($svn_info[$application["id"]]["stable"])) - { - $rev["stable"]=$svn_info[$application["id"]]["stable"]["revision"]; - } - if (isset ($svn_info[$application["id"]]["test"])) - { - $rev["test"]=$svn_info[$application["id"]]["test"]["revision"]; - } - if (isset ($svn_info[$application["id"]]["XP"]) and get_wpkg_branche_XP()==1) - { - $rev["XP"]=$svn_info[$application["id"]]["XP"]["revision"]; - } - if (in_array($application["revision"],$rev)) - { - echo ""; - } - else + echo ""; + echo ""; } + echo ""; + echo "\n"; + echo ""; echo "\n"; echo "
Fichier xmlVersionCompatibilitéCatégoriePrioritéRebootDate d'ajoutVersion SVN
xml".$application["revision"].""; - - switch ($application["compatibilite"]) - { - case 1: - echo ""; - break; - case 2: - echo ""; - break; - case 3: - echo ""; - break; - case 4: - echo ""; - break; - case 5: - echo ""; - break; - case 6: - echo ""; - break; - case 7: - echo ""; - break; - case 0: - echo ""; - break; - default: - echo ""; - break; - - } - echo "".$application["category"]."".$application["priority"].""; - if ($application["reboot"]=="false") - echo "Non"; - else - echo "Oui"; - echo "".$application["date2"].""; - } - else - { - echo ""; - } - $i=0; - foreach ($rev as $key=>$value) - { - if ($i>0) - echo "
"; - echo $value." (".$key.")"; - $i++; - } - echo "
"; + echo "-
\n"; echo "
\n"; - // tableau 2 + // tableau 1 echo "\n"; echo ""; - echo ""; - echo ""; echo ""; + echo ""; echo ""; echo ""; echo "\n"; echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; + echo ">".$liste_poste_infos["parc"]["notok"].""; echo ""; + echo ">".$liste_poste_infos["parc"]["maj"].""; echo "\n"; echo "
Dépend deRequis parNombre de postesPostes à jourPostes en erreurPostes pas à jour
"; - if (isset($application["depends"])) - { - $i=0; - foreach ($application["depends"] as $dependance) - { - if ($i>0) - echo "
"; - echo ""; - echo $liste_appli[$dependance]["name"]; - echo ""; - $i++; - } - } - echo "
"; - if (isset($application["required_by"])) - { - $i=0; - foreach ($application["required_by"] as $requis) - { - if ($i>0) - echo "
"; - echo ""; - echo $liste_appli[$requis]["name"]; - echo ""; - $i++; - } - } - echo "
".($application["nb_postes"]+0)."".($liste_poste_infos["parc"]["nb_postes"]+0)."0) + echo " bgcolor='".$ok_bg."' style='color:".$ok_txt."'"; + echo ">".$liste_poste_infos["parc"]["ok"]."0) + //if ($liste_poste_infos["parc"]["notok"]>0) echo " bgcolor='".$warning_bg."' style='color:".$warning_txt."'"; - echo ">".$application["NotOk"]."0) + //if ($liste_poste_infos["parc"]["maj"]>0) echo " bgcolor='".$error_bg."' style='color:".$error_txt."'"; - echo ">".$application["MaJ"]."
\n"; echo "
\n"; diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index d06efb5..46c4638 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -398,27 +398,38 @@ } } + $liste_statuts["parc"]=array("ok"=>0 + ,"maj"=>0 + ,"notok+"=>0 + ,"notok-"=>0 + ,"nb_postes"=>0); foreach ($list_profiles as $poste_nom=>$info_poste) { - $liste_statuts[$poste_nom]["info"]=$info_poste["info"]; - $liste_statuts[$poste_nom]["status"] = array("ok"=>0 - ,"maj"=>0 - ,"notok+"=>0 - ,"notok-"=>0); + $liste_statuts["postes"][$poste_nom]["info"]=$info_poste["info"]; + $liste_statuts["postes"][$poste_nom]["status"]=array("ok"=>0 + ,"maj"=>0 + ,"notok"=>0); + $liste_statuts["parc"]["nb_postes"]++; foreach ($info_poste["app"] as $app_nom=>$info_app_poste) { if ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Installed") { if ($info_app_poste["revision"]==$list_app_info[$app_nom]["revision"]) - $liste_statuts[$poste_nom]["status"]["ok"]++; + $liste_statuts["postes"][$poste_nom]["status"]["ok"]++; else - $liste_statuts[$poste_nom]["status"]["maj"]++; + $liste_statuts["postes"][$poste_nom]["status"]["maj"]++; } elseif ($info_app_poste["deployed"]==0 and $info_app_poste["installed"]=="Installed") - $liste_statuts[$poste_nom]["status"]["notok+"]++; + $liste_statuts["postes"][$poste_nom]["status"]["notok+"]++; elseif ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Not Installed") - $liste_statuts[$poste_nom]["status"]["notok-"]++; + $liste_statuts["postes"][$poste_nom]["status"]["notok-"]++; } + if ($liste_statuts["postes"][$poste_nom]["status"]["notok-"]+$liste_statuts["postes"][$poste_nom]["status"]["notok+"]>0) + $liste_statuts["parc"]["notok"]++; + elseif ($liste_statuts["postes"][$poste_nom]["status"]["maj"]>0) + $liste_statuts["parc"]["maj"]++; + else + $liste_statuts["parc"]["ok"]++; } return $liste_statuts; } -- GitLab From 80cd46601bb38beac6ae36170d1224f57713f63f Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 12:43:01 +0100 Subject: [PATCH 16/64] interface parc creation page statuts parc --- sources/www/parc_statuts.php | 120 +++++------------------------------ sources/www/parc_top.php | 5 +- sources/www/wpkg_lib.php | 23 ++++++- 3 files changed, 39 insertions(+), 109 deletions(-) diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index 4286cf5..0dfe581 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -82,110 +82,22 @@ $page_id=1; include ("parc_top.php"); - print_r(get_list_wpkg_postes_status($id_parc,$xml_packages,$xml_rapports,$xml_profiles)); + $list_poste=liste_poste_infos["postes"]; + $tri_poste=array(); + $tri_status=array(); + $tri_date=array(); + $tri_ip=array(); + $tri_mac=array(); + $tri_nb_app=array(); - $list_poste=array(); - $parc_poste_status=array("Ok"=>0, "NotOk"=>0, "MaJ"=>0, "Total"=>0); - $i=0; - - foreach ($liste_postes_parc[$get_parc] as $poste_parc) + foreach ($list_poste as $key=>$row) { - $info_poste=$liste_rapports_status_poste[$poste_parc]["info"]; - $info_app=$liste_rapports_status_poste[$poste_parc][$get_Appli]; - - if (in_array($poste_parc,$liste_status_tmp["NotOk"])) - { - $list_poste[$i]["wpkg"]=$get_warning; - $list_poste[$i]["wpkg_status"]=3; - $list_poste[$i]["bg"]=$warning_bg; - $list_poste[$i]["txt"]=$warning_txt; - $list_poste[$i]["lnk"]=$warning_lnk; - $parc_poste_status["NotOk"]++; - $parc_poste_status["Total"]++; - } - elseif (in_array($poste_parc,$liste_status_tmp["MaJ"])) - { - $list_poste[$i]["wpkg"]=$get_error; - $list_poste[$i]["wpkg_status"]=2; - $list_poste[$i]["bg"]=$error_bg; - $list_poste[$i]["txt"]=$error_txt; - $list_poste[$i]["lnk"]=$error_lnk; - $parc_poste_status["MaJ"]++; - $parc_poste_status["Total"]++; - } - else - { - $list_poste[$i]["wpkg"]=$get_ok; - $list_poste[$i]["wpkg_status"]=1; - $list_poste[$i]["bg"]=$ok_bg; - $list_poste[$i]["txt"]=$ok_txt; - $list_poste[$i]["lnk"]=$ok_lnk; - $parc_poste_status["Ok"]++; - $parc_poste_status["Total"]++; - } - - if ($info_app!="") - { - if ($info_app["status"]=="Installed") - { - $list_poste[$i]["status"]="Installé"; - } - else - { - $list_poste[$i]["status"]="Non Installé"; - if ($list_poste[$i]["wpkg_status"]==1) - { - $list_poste[$i]["bg"]=$unknown_bg; - $list_poste[$i]["txt"]=$unknown_txt; - $list_poste[$i]["lnk"]=$unknown_lnk; - $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); - } - } - $list_poste[$i]["revision"]=$info_app["revision"]; - } - else - { - if ($list_poste[$i]["wpkg_status"]==1) - { - $list_poste[$i]["bg"]=$unknown_bg; - $list_poste[$i]["txt"]=$unknown_txt; - $list_poste[$i]["lnk"]=$unknown_lnk; - $list_poste[$i]["wpkg"]=min($get_tous,$get_ok); - } - $list_poste[$i]["status"]="Inconnu"; - $list_poste[$i]["revision"]="-"; - } - $list_poste[$i]["poste"]=$poste_parc; - switch ($info_poste["typewin"]) - { - case 'Windows XP': - $list_poste[$i]["typewin"]="winxp.png"; - break; - case 'Windows 7': - $list_poste[$i]["typewin"]="win7.png"; - break; - case 'Windows 10': - $list_poste[$i]["typewin"]="win10.png"; - break; - default: - $list_poste[$i]["typewin"]="vide.png"; - break; - } - $list_poste[$i]["logfile"]=$info_poste["logfile"]; - $list_poste[$i]["date"]=$info_poste["date"]; - $list_poste[$i]["time"]=$info_poste["time"]; - $list_poste[$i]["datetime"]=$info_poste["datetime"]; - $list_poste[$i]["ip"]=$info_poste["ip"]; - $list_poste[$i]["mac"]=$info_poste["mac"]; - - $tri_poste[$i]=$list_poste[$i]["poste"]; - $tri_status[$i]=$list_poste[$i]["status"]; - $tri_revision[$i]=$list_poste[$i]["revision"]; - $tri_date[$i]=$list_poste[$i]["datetime"]; - $tri_ip[$i]=ip2long($list_poste[$i]["ip"]); - $tri_mac[$i]=$list_poste[$i]["mac"]; - - $i++; + $tri_poste[]=$key; + $tri_status[]=$row["info"]["status"]; + $tri_date[]=$row["info"]["datetime"]; + $tri_ip[]=ip2long($row["info"]["ip"]); + $tri_mac[]=$tri_mac=$row["info"]["mac"]; + $tri_nb_app[]=$row["info"]["nb_app"]; } if ($list_poste) @@ -205,10 +117,10 @@ array_multisort($tri_status, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); break; case 4: - array_multisort($tri_revision, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); + array_multisort($tri_nb_app, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); break; case 5: - array_multisort($tri_revision, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); + array_multisort($tri_nb_app, SORT_ASC, $tri_poste, SORT_ASC, $list_poste); break; case 6: array_multisort($tri_date, SORT_DESC, $tri_poste, SORT_ASC, $list_poste); diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index e6a4646..99d74ee 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -5,10 +5,9 @@ asort($liste_hosts); $liste_parcs=array_keys($liste_postes_parc); asort($liste_parcs); - if (!array_key_exists($get_parc,$liste_parcs)) - header("Location: parc_status.php"); + if (!in_array($get_parc,$liste_parcs)) + header("Location: parc_statuts.php"); $liste_poste_infos=get_list_wpkg_postes_status($get_parc,$xml_packages,$xml_rapports,$xml_profiles); - ksort($liste_poste_infos["postes"]); echo "

Gestion des parcs

\n"; diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index 46c4638..d98bdc4 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -400,8 +400,7 @@ $liste_statuts["parc"]=array("ok"=>0 ,"maj"=>0 - ,"notok+"=>0 - ,"notok-"=>0 + ,"notok"=>0 ,"nb_postes"=>0); foreach ($list_profiles as $poste_nom=>$info_poste) { @@ -409,27 +408,47 @@ $liste_statuts["postes"][$poste_nom]["status"]=array("ok"=>0 ,"maj"=>0 ,"notok"=>0); + $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]=0; + $liste_statuts["postes"][$poste_nom]["info"]["status"]=0; $liste_statuts["parc"]["nb_postes"]++; foreach ($info_poste["app"] as $app_nom=>$info_app_poste) { if ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Installed") { if ($info_app_poste["revision"]==$list_app_info[$app_nom]["revision"]) + { $liste_statuts["postes"][$poste_nom]["status"]["ok"]++; + $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + } else + { $liste_statuts["postes"][$poste_nom]["status"]["maj"]++; + $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + } } elseif ($info_app_poste["deployed"]==0 and $info_app_poste["installed"]=="Installed") $liste_statuts["postes"][$poste_nom]["status"]["notok+"]++; elseif ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Not Installed") + { $liste_statuts["postes"][$poste_nom]["status"]["notok-"]++; + $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + } } if ($liste_statuts["postes"][$poste_nom]["status"]["notok-"]+$liste_statuts["postes"][$poste_nom]["status"]["notok+"]>0) + { $liste_statuts["parc"]["notok"]++; + $liste_statuts["postes"][$poste_nom]["info"]["status"]=2; + } elseif ($liste_statuts["postes"][$poste_nom]["status"]["maj"]>0) + { $liste_statuts["parc"]["maj"]++; + $liste_statuts["postes"][$poste_nom]["info"]["status"]=1; + } else + { $liste_statuts["parc"]["ok"]++; + $liste_statuts["postes"][$poste_nom]["info"]["status"]=0; + } } return $liste_statuts; } -- GitLab From 7f1e16949a5312e83f271c745208c8f3d3161035 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 13:00:48 +0100 Subject: [PATCH 17/64] page status parc erreur typo affichage tableau --- sources/www/parc_statuts.php | 46 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index 0dfe581..cbd6108 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -82,7 +82,7 @@ $page_id=1; include ("parc_top.php"); - $list_poste=liste_poste_infos["postes"]; + $list_poste=$liste_poste_infos["postes"]; $tri_poste=array(); $tri_status=array(); $tri_date=array(); @@ -96,7 +96,7 @@ $tri_status[]=$row["info"]["status"]; $tri_date[]=$row["info"]["datetime"]; $tri_ip[]=ip2long($row["info"]["ip"]); - $tri_mac[]=$tri_mac=$row["info"]["mac"]; + $tri_mac[]=$row["info"]["mac"]; $tri_nb_app[]=$row["info"]["nb_app"]; } @@ -266,22 +266,42 @@ echo "' style='color:".$regular_lnk."'>Adresse mac"; echo "\n"; - foreach ($list_poste as $lp) + foreach ($list_poste as $nom_poste=>$lp) { - if ($lp["wpkg"]==1) + switch ($lp["info"]["status"]) { - echo ""; - echo "".$lp["poste"].""; + case 0: + $bg=ok_bg; + $lnk=ok_lnk; + $txt=ok_txt; + break; + case 1: + $bg=error_bg; + $lnk=error_lnk; + $txt=error_txt; + break; + case 2: + $bg=warning_bg; + $lnk=warning_lnk; + $txt=warning_txt; + break; + } + + echo ""; + echo "".$nom_poste.""; echo ""; - echo ''; + echo ''; echo ""; - echo "".$lp["status"].""; - echo "".$lp["revision"].""; - echo "".$lp["date"]." à ".$lp["time"].""; - echo "".$lp["ip"].""; - echo "".$lp["mac"].""; + echo "".$lp["info"]["status"].""; + echo "".$lp["info"]["nb_app"].""; + echo "".$lp["info"]["date"]." à ".$lp["info"]["time"].""; + echo "".$lp["info"]["ip"].""; + echo "".$lp["info"]["mac"].""; + echo "".$lp["status"]["ok"].""; + echo "".$lp["status"]["maj"].""; + echo "".$lp["status"]["notok-"].""; + echo "".$lp["status"]["notok+"].""; echo "\n"; - } } echo "\n"; -- GitLab From 387ec179b86b21e3d657f7f4e1e5524169515088 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 13:09:21 +0100 Subject: [PATCH 18/64] page status parc erreur de typo --- sources/www/parc_statuts.php | 36 ++++++++++++++++++++++++++---------- sources/www/wpkg_lib.php | 3 ++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index cbd6108..b8a02f4 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -271,26 +271,42 @@ switch ($lp["info"]["status"]) { case 0: - $bg=ok_bg; - $lnk=ok_lnk; - $txt=ok_txt; + $bg=$ok_bg; + $lnk=$ok_lnk; + $txt=$ok_txt; break; case 1: - $bg=error_bg; - $lnk=error_lnk; - $txt=error_txt; + $bg=$error_bg; + $lnk=$error_lnk; + $txt=$error_txt; break; case 2: - $bg=warning_bg; - $lnk=warning_lnk; - $txt=warning_txt; + $bg=$warning_bg; + $lnk=$warning_lnk; + $txt=$warning_txt; break; } echo ""; echo "".$nom_poste.""; echo ""; - echo ''; + echo ''; echo ""; echo "".$lp["info"]["status"].""; echo "".$lp["info"]["nb_app"].""; diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index d98bdc4..59d9359 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -407,7 +407,8 @@ $liste_statuts["postes"][$poste_nom]["info"]=$info_poste["info"]; $liste_statuts["postes"][$poste_nom]["status"]=array("ok"=>0 ,"maj"=>0 - ,"notok"=>0); + ,"notok+"=>0 + ,"notok-"=>0); $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]=0; $liste_statuts["postes"][$poste_nom]["info"]["status"]=0; $liste_statuts["parc"]["nb_postes"]++; -- GitLab From be7124b4e4cc77fd3410d11fe8dd749ce411be5d Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 13:53:10 +0100 Subject: [PATCH 19/64] page status parc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Page opérationnelle. --- sources/www/parc_statuts.php | 146 +++++++++-------------------------- sources/www/parc_top.php | 40 +++++++++- 2 files changed, 75 insertions(+), 111 deletions(-) diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index b8a02f4..90a125f 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -68,16 +68,6 @@ else $get_tous=0; - $liste_rapports_status_poste = get_list_wpkg_rapports_statut_poste_app($xml_rapports); - $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); - $liste_parcs=array_keys($liste_postes_parc); - asort($liste_parcs); - - if (!count($liste_postes_parc[$get_parc])) - { - $get_parc="_TousLesPostes"; - } - echo "
\n"; $page_id=1; include ("parc_top.php"); @@ -144,121 +134,37 @@ array_multisort($tri_poste, SORT_ASC, $list_poste); break; } - } - - echo "\n"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - echo ""; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
ParcNombre de postesPostes à jourPostes en erreurPostes pas à jour
"; - echo $get_parc."
"; - echo ""; - echo "
"; - echo $parc_poste_status["Total"]."
"; - echo ""; - echo "
"; - echo $parc_poste_status["Ok"]."
"; - echo ""; - echo "
"; - echo $parc_poste_status["NotOk"]."
"; - echo ""; - echo "
"; - echo $parc_poste_status["MaJ"]."
"; - echo ""; - echo "
\n"; - echo "
\n"; - echo "
\n"; - + } echo "\n"; echo ""; - echo ""; - echo ""; - echo ""; + echo ""; - echo ""; - echo ""; + echo ""; - echo ""; - echo ""; echo "\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + foreach ($list_poste as $nom_poste=>$lp) { switch ($lp["info"]["status"]) @@ -291,7 +209,7 @@ echo ""; echo ""; - echo ""; + echo ""; echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; echo "\n"; } echo "
Nom du posteOSOSStatutVersionApplicationsDate du dernier rapportAdresse ipAdresse mac
NombreA jourPas à jourEn erreur
".$nom_poste.""; echo ''; echo "".$lp["info"]["status"].""; + switch ($lp["info"]["status"]) + { + case 0: + echo "A jour"; + break; + case 1: + echo "Pas à jour"; + break; + case 2: + echo "En erreur"; + break; + } + echo "".$lp["info"]["nb_app"]."".$lp["status"]["ok"]."".$lp["status"]["maj"]."(-".$lp["status"]["notok-"]."/+".$lp["status"]["notok+"].")".$lp["info"]["date"]." à ".$lp["info"]["time"]."".$lp["info"]["ip"]."".$lp["info"]["mac"]."".$lp["status"]["ok"]."".$lp["status"]["maj"]."".$lp["status"]["notok-"]."".$lp["status"]["notok+"]."
\n"; diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index 99d74ee..5044c5a 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -3,6 +3,7 @@ // recuperation des donnees $liste_hosts=get_list_wpkg_hosts($xml_hosts); asort($liste_hosts); + $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); $liste_parcs=array_keys($liste_postes_parc); asort($liste_parcs); if (!in_array($get_parc,$liste_parcs)) @@ -63,15 +64,48 @@ echo "0) echo " bgcolor='".$ok_bg."' style='color:".$ok_txt."'"; - echo ">".$liste_poste_infos["parc"]["ok"].""; + echo ">".$liste_poste_infos["parc"]["ok"]."
"; + echo ""; + echo ""; echo "0) echo " bgcolor='".$warning_bg."' style='color:".$warning_txt."'"; - echo ">".$liste_poste_infos["parc"]["notok"].""; + echo ">".$liste_poste_infos["parc"]["notok"]."
"; + echo ""; + echo ""; echo "0) echo " bgcolor='".$error_bg."' style='color:".$error_txt."'"; - echo ">".$liste_poste_infos["parc"]["maj"].""; + echo ">".$liste_poste_infos["parc"]["maj"]."
"; + echo ""; + echo ""; echo "\n"; echo "\n"; echo "
\n"; -- GitLab From b66ec722dae09edb2c6e014a94bdff30121ba258 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 13:53:29 +0100 Subject: [PATCH 20/64] version 2.00 alpha 4 --- sources/debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index a724ceb..7127196 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,4 +1,4 @@ -se3-wpkg (2.00~a3) unstable; urgency=low +se3-wpkg (2.00~a4) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes -- GitLab From 22b12021ee38b468be4dd3d53056cc72b9b66465 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Wed, 24 Jan 2018 23:49:03 +0100 Subject: [PATCH 21/64] page status parc correction d'un bug sur le mauvais listing des postes d'un parc Suppression d'une colonne modification de la liste des parcs disponibles --- sources/www/parc_statuts.php | 6 ++---- sources/www/parc_top.php | 3 +-- sources/www/wpkg_lib.php | 10 ++++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index 90a125f..2d55a6d 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -50,7 +50,7 @@ if (isset($_GET['parc'])) $get_parc=$purifier->purify($_GET['parc']); else - $get_parc=""; + $get_parc="_TousLesPostes"; if (isset($_GET["warning"])) $get_warning=$purifier->purify($_GET["warning"])+0; else @@ -151,7 +151,7 @@ else echo "2"; echo "' style='color:".$regular_lnk."'>Statut"; - echo "Applications"; + echo "Applications"; echo "Nombre"; - echo "A jour"; echo "Pas à jour"; echo "En erreur"; echo "\n"; @@ -241,7 +240,6 @@ } echo ""; echo "".$lp["info"]["nb_app"].""; - echo "".$lp["status"]["ok"].""; echo "".$lp["status"]["maj"].""; echo "(-".$lp["status"]["notok-"]."/+".$lp["status"]["notok+"].")"; echo "".$lp["info"]["date"]." à ".$lp["info"]["time"].""; diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index 5044c5a..037b4a9 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -3,8 +3,7 @@ // recuperation des donnees $liste_hosts=get_list_wpkg_hosts($xml_hosts); asort($liste_hosts); - $liste_postes_parc=get_list_wpkg_poste_parc($xml_profiles); - $liste_parcs=array_keys($liste_postes_parc); + $liste_parcs=get_list_wpkg_parcs($xml_profiles); asort($liste_parcs); if (!in_array($get_parc,$liste_parcs)) header("Location: parc_statuts.php"); diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index 59d9359..a69b1cc 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -333,6 +333,7 @@ $list_parc=get_list_wpkg_parcs($xml_profiles); // liste des parcs $poste_parc=get_list_wpkg_poste_parc($xml_profiles); // liste des postes par parc $list_depend=get_list_wpkg_depend_app($xml_packages); // Liste des dépendances + $list_profiles_tmp=array(); // liste des statuts des apps pour chaque poste $list_profiles=array(); // liste des statuts des apps pour chaque poste $list_app_info=array(); // liste des infos pour chaque app $liste_statuts=array(); // liste des statuts des postes du parc @@ -350,24 +351,24 @@ { foreach ($poste_parc[(string) $profile1["id"]] as $poste) { - $list_profiles[$poste]["app"][(string) $profile2["package-id"]]["deployed"]=1; + $list_profiles_tmp[$poste]["app"][(string) $profile2["package-id"]]["deployed"]=1; if (isset($list_depend[(string) $profile2["package-id"]])) { foreach ($list_depend[(string) $profile2["package-id"]] as $depend) { - $list_profiles[$poste]["app"][$depend]["deployed"]=1; + $list_profiles_tmp[$poste]["app"][$depend]["deployed"]=1; } } } } elseif (!in_array((string) $profile1["id"], $list_parc)) { - $list_profiles[(string) $profile1["id"]]["app"][(string) $profile2["package-id"]]["deployed"]=1; + $list_profiles_tmp[(string) $profile1["id"]]["app"][(string) $profile2["package-id"]]["deployed"]=1; if (isset($list_depend[(string) $profile2["package-id"]])) { foreach ($list_depend[(string) $profile2["package-id"]] as $depend) { - $list_profiles[(string) $profile1["id"]]["app"][$depend]["deployed"]=1; + $list_profiles_tmp[(string) $profile1["id"]]["app"][$depend]["deployed"]=1; } } } @@ -390,6 +391,7 @@ "ip"=>(string) $rapport["ip"], "typewin"=>(string) $rapport["typewin"], "logfile"=>(string) $rapport["logfile"]); + $list_profiles[(string) $rapport["id"]]["app"]=$list_profiles_tmp[(string) $rapport["id"]]["app"]; foreach ($rapport->package as $rapport2) { $list_profiles[(string) $rapport["id"]]["app"][(string) $rapport2["id"]]["installed"]=$rapport2["status"]; -- GitLab From 1769e66ac325bf896752c5a742b7053347b8e659 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 25 Jan 2018 07:04:19 +0100 Subject: [PATCH 22/64] version 2.00 alpha 5 --- sources/debian/changelog | 2 +- sources/www/wpkg_lib.php | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index 7127196..adc0d97 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,4 +1,4 @@ -se3-wpkg (2.00~a4) unstable; urgency=low +se3-wpkg (2.00~a5) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes diff --git a/sources/www/wpkg_lib.php b/sources/www/wpkg_lib.php index a69b1cc..c52c633 100644 --- a/sources/www/wpkg_lib.php +++ b/sources/www/wpkg_lib.php @@ -390,8 +390,9 @@ "mac"=>(string) $rapport["mac"], "ip"=>(string) $rapport["ip"], "typewin"=>(string) $rapport["typewin"], - "logfile"=>(string) $rapport["logfile"]); - $list_profiles[(string) $rapport["id"]]["app"]=$list_profiles_tmp[(string) $rapport["id"]]["app"]; + "logfile"=>(string) $rapport["logfile"], + "nb_app"=>count($list_profiles_tmp[(string) $rapport["id"]]["app"])); + $list_profiles[(string) $rapport["id"]]["app"]=$list_profiles_tmp[(string) $rapport["id"]]["app"]; foreach ($rapport->package as $rapport2) { $list_profiles[(string) $rapport["id"]]["app"][(string) $rapport2["id"]]["installed"]=$rapport2["status"]; @@ -411,7 +412,7 @@ ,"maj"=>0 ,"notok+"=>0 ,"notok-"=>0); - $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]=0; + //$liste_statuts["postes"][$poste_nom]["info"]["nb_app"]=0; $liste_statuts["postes"][$poste_nom]["info"]["status"]=0; $liste_statuts["parc"]["nb_postes"]++; foreach ($info_poste["app"] as $app_nom=>$info_app_poste) @@ -421,12 +422,12 @@ if ($info_app_poste["revision"]==$list_app_info[$app_nom]["revision"]) { $liste_statuts["postes"][$poste_nom]["status"]["ok"]++; - $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + //$liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; } else { $liste_statuts["postes"][$poste_nom]["status"]["maj"]++; - $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + //$liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; } } elseif ($info_app_poste["deployed"]==0 and $info_app_poste["installed"]=="Installed") @@ -434,7 +435,7 @@ elseif ($info_app_poste["deployed"]==1 and $info_app_poste["installed"]=="Not Installed") { $liste_statuts["postes"][$poste_nom]["status"]["notok-"]++; - $liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; + //$liste_statuts["postes"][$poste_nom]["info"]["nb_app"]++; } } if ($liste_statuts["postes"][$poste_nom]["status"]["notok-"]+$liste_statuts["postes"][$poste_nom]["status"]["notok+"]>0) -- GitLab From c71f3d02e72412626084e5856cf39b4e863b1346 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 25 Jan 2018 11:19:47 +0100 Subject: [PATCH 23/64] page status parc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Activation de la sélection des postes en erreur, à jour ou pas à jour Nettoyage de la page --- sources/debian/changelog | 4 ++-- sources/www/parc_statuts.php | 35 +++++++++++++++++++++++------------ sources/www/parc_top.php | 4 ++-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index adc0d97..85c3d75 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,4 +1,4 @@ -se3-wpkg (2.00~a5) unstable; urgency=low +se3-wpkg (2.00~a6) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes @@ -6,7 +6,7 @@ se3-wpkg (2.00~a5) unstable; urgency=low * ajout d'une fonction de nettoyage de timeStamps.xml * creation d'une interface wpkg pour les parcs - -- Laurent Joly Mon, 23 Jan 2018 19:30:20 +0200 + -- Laurent Joly Thu, 25 Jan 2018 11:30:20 +0200 se3-wpkg (0.91~) unstable; urgency=low diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index 2d55a6d..c4f3c9b 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -62,11 +62,7 @@ if (isset($_GET["ok"])) $get_ok=$purifier->purify($_GET["ok"])+0; else - $get_ok=0; - if (isset($_GET["tous"])) - $get_tous=$purifier->purify($_GET["tous"])+0; - else - $get_tous=0; + $get_ok=1; echo "
\n"; $page_id=1; @@ -138,33 +134,33 @@ echo "\n"; echo ""; - echo ""; echo ""; - echo ""; echo ""; - echo ""; - echo ""; - echo ""; echo ""; echo ""; echo "\n"; + } } echo "
Nom du posteOSStatutApplicationsDate du dernier rapportAdresse ip"; - echo ""; echo "".$nom_poste.""; @@ -246,6 +256,7 @@ echo "".$lp["info"]["ip"]."".$lp["info"]["mac"]."
\n"; diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index 037b4a9..420ea2d 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -22,7 +22,7 @@ } else { - echo "Etat des parcs"; + echo "Etat des parcs"; } if ($page_id==2) { @@ -30,7 +30,7 @@ } else { - echo "Gestion"; + echo "Gestion"; } echo "\n"; echo ""; -- GitLab From 412d92652df14825965760b58d4ef1fbb0d67272 Mon Sep 17 00:00:00 2001 From: lolo4992 Date: Thu, 25 Jan 2018 11:51:47 +0100 Subject: [PATCH 24/64] version 2.00 alpha 7 correction warning --- sources/debian/changelog | 2 +- sources/www/parc_statuts.php | 5 ++++- sources/www/parc_top.php | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sources/debian/changelog b/sources/debian/changelog index 85c3d75..8520bad 100644 --- a/sources/debian/changelog +++ b/sources/debian/changelog @@ -1,4 +1,4 @@ -se3-wpkg (2.00~a6) unstable; urgency=low +se3-wpkg (2.00~a7) unstable; urgency=low * creation d'une interface wpkg pour les applications * ajout d'un cron pour la generation du rapports.xml toutes les 5 minutes diff --git a/sources/www/parc_statuts.php b/sources/www/parc_statuts.php index c4f3c9b..4af66d1 100644 --- a/sources/www/parc_statuts.php +++ b/sources/www/parc_statuts.php @@ -68,7 +68,10 @@ $page_id=1; include ("parc_top.php"); - $list_poste=$liste_poste_infos["postes"]; + if (is_array(@$liste_poste_infos["postes"])) + $list_poste=$liste_poste_infos["postes"]; + else + $list_poste=array(); $tri_poste=array(); $tri_status=array(); $tri_date=array(); diff --git a/sources/www/parc_top.php b/sources/www/parc_top.php index 420ea2d..a73a5ed 100644 --- a/sources/www/parc_top.php +++ b/sources/www/parc_top.php @@ -59,11 +59,11 @@ echo "Postes pas à jour"; echo "\n"; echo ""; - echo "".($liste_poste_infos["parc"]["nb_postes"]+0).""; + echo "".(@$liste_poste_infos["parc"]["nb_postes"]+0).""; echo "0) echo " bgcolor='".$ok_bg."' style='color:".$ok_txt."'"; - echo ">".$liste_poste_infos["parc"]["ok"]."
"; + echo ">".@$liste_poste_infos["parc"]["ok"]."
"; echo ""; echo "