[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 11/11: Task #1610 - Problème dans le menu «i
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 11/11: Task #1610 - Problème dans le menu «installation» #0001610: Problème dans le menu «installation» |
Date: |
Tue, 17 Jul 2018 04:04:30 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9029b48a7890b599952a4acb728b05628712ca61
Author: Dany De Bontridder <address@hidden>
Date: Tue Jul 17 10:01:22 2018 +0200
Task #1610 - Problème dans le menu «installation»
#0001610: Problème dans le menu «installation»
---
include/class/package_repository.class.php | 24 ++++++++++++++++++++++--
include/upgrade-core.php | 12 ++++++++++++
include/upgrade-plugin.php | 12 ++++++++++++
include/upgrade-template.php | 12 ++++++++++++
4 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/include/class/package_repository.class.php
b/include/class/package_repository.class.php
index d78af3a..cfb3026 100644
--- a/include/class/package_repository.class.php
+++ b/include/class/package_repository.class.php
@@ -42,9 +42,17 @@ class Package_Repository
*/
function __construct()
{
- $content=file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/web.xml");
+ // Check we can resolve the name
+ $host=parse_url(NOALYSS_PACKAGE_REPOSITORY,PHP_URL_HOST);
+
+ if (gethostbyname($host) != $host)
+ {
+ $content=file_get_contents(NOALYSS_PACKAGE_REPOSITORY."/web.xml");
+ $this->content=simplexml_load_string($content);
+ } else {
+ $this->content=NULL;
+ }
- $this->content=simplexml_load_string($content);
}
public function getContent()
@@ -72,6 +80,9 @@ class Package_Repository
function display_noalyss_info()
{
global $g_user;
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
switch ($g_user->lang)
{
case 'fr_FR.utf8':
@@ -94,6 +105,9 @@ class Package_Repository
*/
function find_plugin($p_code)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
$a_plugin=$this->content->xpath('//plugins/plugin');
$nb_plugin=count($a_plugin);
for ($i=0; $i<$nb_plugin; $i++)
@@ -114,6 +128,9 @@ class Package_Repository
*/
function find_template($p_code)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
$a_template=$this->content->xpath('//database_template/dbtemplate');
$nb_template=count($a_template);
for ($i=0; $i<$nb_template; $i++)
@@ -128,6 +145,9 @@ class Package_Repository
function make_object($p_type, $p_id)
{
+ if ( $this->content == NULL ) {
+ throw new Exception(_("Problème réseau"),10);
+ }
switch ($p_type)
{
case "core":
diff --git a/include/upgrade-core.php b/include/upgrade-core.php
index db2997c..8ccd967 100644
--- a/include/upgrade-core.php
+++ b/include/upgrade-core.php
@@ -32,6 +32,18 @@ printf (_(" La version de votre installation est %s
"),$version_noalyss);
$core=new Package_Repository();
$xml=$core->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo '<h2 class="error">';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '</h2>';
+ return;
+
+}
printf(h1(_("Version %s du %s")),$xml->core->version,$xml->core->date);
echo '<p>';
echo $xml->core->description;
diff --git a/include/upgrade-plugin.php b/include/upgrade-plugin.php
index 554df6e..d557e7c 100644
--- a/include/upgrade-plugin.php
+++ b/include/upgrade-plugin.php
@@ -35,6 +35,18 @@ require_once NOALYSS_INCLUDE.'/class/extension.class.php';
*/
$package_repository=new Package_Repository();
$xml=$package_repository->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo '<h2 class="error">';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '</h2>';
+ return;
+
+}
$a_plugin=$xml->xpath('//plugins/plugin');
$nb_plugin=count($a_plugin);
diff --git a/include/upgrade-template.php b/include/upgrade-template.php
index 9373205..3176d32 100644
--- a/include/upgrade-template.php
+++ b/include/upgrade-template.php
@@ -30,6 +30,18 @@ require_once NOALYSS_INCLUDE.'/class/extension.class.php';
$package_repository=new Package_Repository();
$xml=$package_repository->getContent();
+/*
+ * If xml is null , it means it was not possible to get the file , could be
+ * a network problem or a misconfiguration
+ */
+if ( $xml == NULL) {
+ echo '<h2 class="error">';
+ printf (_("Désolé , impossible de se connecter au serveur %s"),
+ NOALYSS_PACKAGE_REPOSITORY);
+ echo '</h2>';
+ return;
+
+}
$a_template=$xml->xpath('//database_template/dbtemplate');
- [Noalyss-commit] [noalyss] branch master updated (ecc3b53 -> 9029b48), Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 10/11: #0001594: CA - liste opérations affiche toutes les opérations Filtre : uniquement opérations diverses, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 01/11: Update documentation, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 09/11: Create lib for Tabs, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 04/11: Fix todo_list : if list empty , gets an error in php 7.2, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 03/11: Merge branch 'master' of ssh://ns3git/srv/git/noalyss, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 11/11: Task #1610 - Problème dans le menu «installation» #0001610: Problème dans le menu «installation»,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 05/11: http_input : strip_tags on array thrown an error, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 07/11: Documentation, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 06/11: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 08/11: Documentation, Dany De Bontridder, 2018/07/17
- [Noalyss-commit] [noalyss] 02/11: Merge branch 'master' of ssh://ns3git/srv/git/noalyss, Dany De Bontridder, 2018/07/17