Skip to content
Snippets Groups Projects
Commit 74f2a4d5 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Enable feature to check online signature

parent 0803084c
No related branches found
No related tags found
No related merge requests found
<?php <?php
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$langs->load("admin"); $langs->load("admin");
...@@ -77,32 +78,37 @@ $file_list = array('missing' => array(), 'updated' => array()); ...@@ -77,32 +78,37 @@ $file_list = array('missing' => array(), 'updated' => array());
$xmlshortfile = '/install/filelist-'.DOL_VERSION.'.xml'; $xmlshortfile = '/install/filelist-'.DOL_VERSION.'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile; $xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
$enableremotecheck = False;
// Test if remote test is ok
$enableremotecheck = True;
if (preg_match('/beta|alpha/i', DOL_VERSION)) $enableremotecheck=False;
print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("MakeIntegrityAnalysisFrom").':<br>'; print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
if (dol_is_file($xmlfile)) if (dol_is_file($xmlfile))
{ {
print '<input type="checkbox" name="local" checked> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>'; print '<input type="radio" name="target" value="local"'.((! GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"':'').'"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>';
} }
else else
{ {
print '<input type="checkbox" name="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span><br>'; print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span><br>';
} }
if ($enableremotecheck) if ($enableremotecheck)
{ {
print '<input type="checkbox" name="remote"> '.$langs->trans("RemoteSignature").' = '.$xmlremote.'<br>'; print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = '.$xmlremote.'<br>';
} }
else else
{ {
print '<input type="checkbox" name="remote" disabled> '.$langs->trans("RemoteSignature").' = '.$xmlremote.' <span class="warning">('.$langs->trans("FeatureNotYetAvailable").')</span><br>'; print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote.' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span><br>';
} }
print '<br><div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>'; print '<br><div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
print '<br>';
if (GETPOST('local')) if (GETPOST('target') == 'local')
{ {
if (dol_is_file($xmlfile)) if (dol_is_file($xmlfile))
{ {
...@@ -114,17 +120,20 @@ if (GETPOST('local')) ...@@ -114,17 +120,20 @@ if (GETPOST('local'))
$error++; $error++;
} }
} }
if (GETPOST('remote')) if (GETPOST('target') == 'remote')
{ {
// TODO $xmlarray = getURLContent($xmlremote);
//$xmlfile = ;
if (1 == 1) // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
{ {
//$xml = simplexml_load_file($xmlfile); $xmlfile = $xmlarray['content'];
$xml = simplexml_load_file($xmlfile);
} }
else else
{ {
print $langs->trans('XmlNotFound') . ': ' . $xmlfile; $errormsg=$langs->trans('XmlNotFound') . ': ' . $xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
setEventMessages($errormsg, null, 'errors');
$error++; $error++;
} }
} }
......
...@@ -181,6 +181,7 @@ EncodeBinariesInHexa=Encode binary data in hexadecimal ...@@ -181,6 +181,7 @@ EncodeBinariesInHexa=Encode binary data in hexadecimal
IgnoreDuplicateRecords=Ignore errors of duplicate records (INSERT IGNORE) IgnoreDuplicateRecords=Ignore errors of duplicate records (INSERT IGNORE)
AutoDetectLang=Autodetect (browser language) AutoDetectLang=Autodetect (browser language)
FeatureDisabledInDemo=Feature disabled in demo FeatureDisabledInDemo=Feature disabled in demo
FeatureAvailableOnlyOnStable=Feature only available on official stable versions
Rights=Permissions Rights=Permissions
BoxesDesc=Widgets are components showing some information that you can add to personalize some pages. You can choose between showing the widget or not by selecting target page and clicking 'Activate', or by clicking the dustbin to disable it. BoxesDesc=Widgets are components showing some information that you can add to personalize some pages. You can choose between showing the widget or not by selecting target page and clicking 'Activate', or by clicking the dustbin to disable it.
OnlyActiveElementsAreShown=Only elements from <a href="%s">enabled modules</a> are shown. OnlyActiveElementsAreShown=Only elements from <a href="%s">enabled modules</a> are shown.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment