Task #1610 - Problème dans le menu «installation»

#0001610: Problème dans le menu «installation»
This commit is contained in:
Dany De Bontridder 2018-07-17 10:01:22 +02:00
parent c22e77ca06
commit 9029b48a78
4 changed files with 58 additions and 2 deletions

View file

@ -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":

View file

@ -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;

View file

@ -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);

View file

@ -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');