mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-24 02:11:27 +01:00
New: Ajout posibilit de controler version Dolibarr a activation des modules
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -3,6 +3,7 @@ English Dolibarr changelog
|
|||||||
|
|
||||||
***** Changelog for 2.4 compared to 2.2 *****
|
***** Changelog for 2.4 compared to 2.2 *****
|
||||||
|
|
||||||
|
For users:
|
||||||
- Removed useless code:
|
- Removed useless code:
|
||||||
Replaced phplot and phplot5 librairies by artichow.
|
Replaced phplot and phplot5 librairies by artichow.
|
||||||
Removed cryptograph library replaced by artichow.
|
Removed cryptograph library replaced by artichow.
|
||||||
@@ -13,15 +14,18 @@ English Dolibarr changelog
|
|||||||
- Changes for compatibility with PHP6/Mysql6.
|
- Changes for compatibility with PHP6/Mysql6.
|
||||||
- Add an ical export link in webcalendar module.
|
- Add an ical export link in webcalendar module.
|
||||||
- Reduce memory usage.
|
- Reduce memory usage.
|
||||||
- Now triggers are enabled/disabled according to module they
|
- Now triggers are enabled/disabled according to module they refers to.
|
||||||
refers to.
|
|
||||||
- Fix infinite loop on popup calendar.
|
- Fix infinite loop on popup calendar.
|
||||||
- Change in tanslation to make Dolibarr easier to understand.
|
- Change in tanslation to make Dolibarr easier to understand.
|
||||||
- Add a warning when sending a mail from a user with no email defined.
|
- Add a warning when sending a mail from a user with no email defined.
|
||||||
- A lot of other minor changes (features, look, fixes)
|
- A lot of other minor changes (features, look, fixes)
|
||||||
|
- Added clicktodial module.
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- Update code skeletons examples.
|
- Update code skeletons examples.
|
||||||
- Add a tool to generate PHP classes mapped to a table.
|
- Add a tool to generate PHP classes completely mapped to a table.
|
||||||
|
- Added a check to enable external modules only if dolibarr version is high
|
||||||
|
enough.
|
||||||
|
|
||||||
|
|
||||||
***** Changelog for 2.2 compared to 2.1 *****
|
***** Changelog for 2.2 compared to 2.1 *****
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ class modMyModule extends DolibarrModules
|
|||||||
// Dependencies
|
// Dependencies
|
||||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
|
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
||||||
|
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array(); // List of parameters
|
$this->const = array(); // List of parameters
|
||||||
|
|||||||
@@ -17,18 +17,16 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/admin/modules.php
|
\file htdocs/admin/modules.php
|
||||||
\brief Page de configuration et activation des modules
|
\brief Page de configuration et activation des modules
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
|
|
||||||
$mode=isset($_GET["mode"])?$_GET["mode"]:0;
|
$mode=isset($_GET["mode"])?$_GET["mode"]:0;
|
||||||
$mesg=isset($_GET["mesg"])?urldecode($_GET["mesg"]):"";
|
$mesg=isset($_GET["mesg"])?urldecode($_GET["mesg"]):"";
|
||||||
@@ -66,44 +64,52 @@ if ($_GET["action"] == 'reset' && $user->admin)
|
|||||||
*/
|
*/
|
||||||
function Activate($value,$withdeps=1)
|
function Activate($value,$withdeps=1)
|
||||||
{
|
{
|
||||||
global $db, $modules, $langs;
|
global $db, $modules, $langs;
|
||||||
|
|
||||||
$modName = $value;
|
$modName = $value;
|
||||||
|
|
||||||
// Activation du module
|
// Activation du module
|
||||||
if ($modName)
|
if ($modName)
|
||||||
{
|
|
||||||
$file = $modName . ".class.php";
|
|
||||||
include_once(DOL_DOCUMENT_ROOT."/includes/modules/$file");
|
|
||||||
$objMod = new $modName($db);
|
|
||||||
|
|
||||||
// Test si version PHP ok
|
|
||||||
$verphp=versionphp();
|
|
||||||
$vermin=$objMod->phpmin;
|
|
||||||
if (is_array($vermin) && versioncompare($verphp,$vermin) < 0)
|
|
||||||
{
|
|
||||||
return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin));
|
|
||||||
}
|
|
||||||
|
|
||||||
$objMod->init();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($withdeps)
|
|
||||||
{
|
|
||||||
// Activation des modules dont le module d<>pend
|
|
||||||
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
|
||||||
{
|
|
||||||
Activate($objMod->depends[$i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Desactivation des modules qui entrent en conflit
|
|
||||||
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
|
||||||
{
|
{
|
||||||
UnActivate($objMod->conflictwith[$i],0);
|
$file = $modName . ".class.php";
|
||||||
|
include_once(DOL_DOCUMENT_ROOT."/includes/modules/".$file);
|
||||||
|
$objMod = new $modName($db);
|
||||||
|
|
||||||
|
// Test si version PHP ok
|
||||||
|
$verphp=versionphparray();
|
||||||
|
$vermin=$objMod->phpmin;
|
||||||
|
if (is_array($vermin) && versioncompare($verphp,$vermin) < 0)
|
||||||
|
{
|
||||||
|
return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test si version Dolibarr ok
|
||||||
|
$verdol=versiondolibarrarray();
|
||||||
|
$vermin=$objMod->need_dolibarr_version;
|
||||||
|
if (is_array($vermin) && versioncompare($verdol,$vermin) < 0)
|
||||||
|
{
|
||||||
|
return $langs->trans("ErrorModuleRequireDolibarrVersion",versiontostring($vermin));
|
||||||
|
}
|
||||||
|
|
||||||
|
$objMod->init();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if ($withdeps)
|
||||||
return 0;
|
{
|
||||||
|
// Activation des modules dont le module d<>pend
|
||||||
|
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
||||||
|
{
|
||||||
|
Activate($objMod->depends[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Desactivation des modules qui entrent en conflit
|
||||||
|
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
||||||
|
{
|
||||||
|
UnActivate($objMod->conflictwith[$i],0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
\brief Fichier de description et activation du module de Telephonie
|
\brief Fichier de description et activation du module de Telephonie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/modules/DolibarrModules.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,24 +16,22 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/install/check.php
|
\file htdocs/install/check.php
|
||||||
\ingroup install
|
\ingroup install
|
||||||
\brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilit<69> de le cr<63>er
|
\brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilit<69> de le cr<63>er
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
include_once("./inc.php");
|
||||||
|
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||||
|
|
||||||
$err = 0;
|
$err = 0;
|
||||||
$allowinstall = 0;
|
$allowinstall = 0;
|
||||||
$allowupgrade = 0;
|
$allowupgrade = 0;
|
||||||
$checksok = 1;
|
$checksok = 1;
|
||||||
|
|
||||||
include_once("./inc.php");
|
|
||||||
|
|
||||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langs->getDefaultLang());
|
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langs->getDefaultLang());
|
||||||
$langs->setDefaultLang($setuplang);
|
$langs->setDefaultLang($setuplang);
|
||||||
|
|
||||||
@@ -55,14 +53,14 @@ print '<b>'.$langs->trans("MiscellanousChecks")."</b>:<br>\n";
|
|||||||
|
|
||||||
|
|
||||||
// Check PHP version
|
// Check PHP version
|
||||||
if (versioncompare(versionphp(),array(4,1)) < 0)
|
if (versioncompare(versionphparray(),array(4,1)) < 0)
|
||||||
{
|
{
|
||||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'4.1');
|
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'4.1');
|
||||||
$checksok=0;
|
$checksok=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphp());
|
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray());
|
||||||
}
|
}
|
||||||
print ' (<a href="phpinfo.php" target="_info">'.$langs->trans("MoreInformation").'</a>)';
|
print ' (<a href="phpinfo.php" target="_info">'.$langs->trans("MoreInformation").'</a>)';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|||||||
@@ -15,19 +15,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/install/etape2.php
|
\file htdocs/install/etape2.php
|
||||||
\brief Cree les tables, cles primaires, cles etrangeres, index et fonctions en base puis charge les donnees de reference
|
\brief Cree les tables, cles primaires, cles etrangeres, index et fonctions en base puis charge les donnees de reference
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include("./inc.php");
|
include("./inc.php");
|
||||||
require_once($dolibarr_main_document_root . "/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
require_once($dolibarr_main_document_root."/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||||
require_once($dolibarr_main_document_root . "/conf/conf.class.php");
|
require_once($dolibarr_main_document_root."/conf/conf.class.php");
|
||||||
|
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||||
|
|
||||||
$etape = 2;
|
$etape = 2;
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
|
|||||||
@@ -18,18 +18,17 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/install/fileconf.php
|
\file htdocs/install/fileconf.php
|
||||||
\ingroup install
|
\ingroup install
|
||||||
\brief Demande les infos qui constituerons le contenu du fichier conf.php. Ce fichier sera remplie <20> l'<27>tape suivante
|
\brief Demande les infos qui constituerons le contenu du fichier conf.php. Ce fichier sera remplie <20> l'<27>tape suivante
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once("./inc.php");
|
include_once("./inc.php");
|
||||||
|
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||||
|
|
||||||
$err=0;
|
$err=0;
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ GUISetup=Display
|
|||||||
SetupArea=Setup area
|
SetupArea=Setup area
|
||||||
SecuritySetup=Security setup
|
SecuritySetup=Security setup
|
||||||
ErrorModuleRequirePHPVersion=Error, this module requires PHP version %s or higher
|
ErrorModuleRequirePHPVersion=Error, this module requires PHP version %s or higher
|
||||||
|
ErrorModuleRequireDolibarrVersion=Error, this module requires Dolibarr version %s or higher
|
||||||
ErrorDecimalLargerThanAreForbidden=Error, precision higher than <b>%s</b> are not supported.
|
ErrorDecimalLargerThanAreForbidden=Error, precision higher than <b>%s</b> are not supported.
|
||||||
DictionnarySetup=Dictionnary setup
|
DictionnarySetup=Dictionnary setup
|
||||||
DisableJavascript=Disable JavaScript and Ajax functions
|
DisableJavascript=Disable JavaScript and Ajax functions
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ GUISetup=Affichage
|
|||||||
SetupArea=Zone de configuration
|
SetupArea=Zone de configuration
|
||||||
SecuritySetup=Configuration de s<>curit<69>
|
SecuritySetup=Configuration de s<>curit<69>
|
||||||
ErrorModuleRequirePHPVersion=Erreur, ce module n<>cessite PHP version %s ou sup<75>rieure
|
ErrorModuleRequirePHPVersion=Erreur, ce module n<>cessite PHP version %s ou sup<75>rieure
|
||||||
|
ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou sup<75>rieure de Dolibarr
|
||||||
DictionnarySetup=Dictionnaires
|
DictionnarySetup=Dictionnaires
|
||||||
DisableJavascript=D<>sactiver les fonctions JavaScript et Ajax
|
DisableJavascript=D<>sactiver les fonctions JavaScript et Ajax
|
||||||
UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choisir un produit (plut<75>t que d'utiliser une liste d<>roulante)
|
UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choisir un produit (plut<75>t que d'utiliser une liste d<>roulante)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ GUISetup=Affichage
|
|||||||
SetupArea=Espace configuration
|
SetupArea=Espace configuration
|
||||||
SecuritySetup=Configuration de la s<>curit<69>
|
SecuritySetup=Configuration de la s<>curit<69>
|
||||||
ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou sup<75>rieure de PHP
|
ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou sup<75>rieure de PHP
|
||||||
|
ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou sup<75>rieure de Dolibarr
|
||||||
ErrorDecimalLargerThanAreForbidden=Erreur, les pr<70>cisions sup<75>rieures <20> <b>%s</b> ne sont pas support<72>es.
|
ErrorDecimalLargerThanAreForbidden=Erreur, les pr<70>cisions sup<75>rieures <20> <b>%s</b> ne sont pas support<72>es.
|
||||||
DictionnarySetup=Dictionnaires
|
DictionnarySetup=Dictionnaires
|
||||||
DisableJavascript=D<>sactiver les fonctions Javascript et Ajax
|
DisableJavascript=D<>sactiver les fonctions Javascript et Ajax
|
||||||
|
|||||||
@@ -1,4 +1,84 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/lib/admin.lib.php
|
||||||
|
\brief Library of admin functions
|
||||||
|
\version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Renvoi une version en chaine depuis une version en tableau
|
||||||
|
\param versionarray Tableau de version (vermajeur,vermineur,autre)
|
||||||
|
\return string Chaine version
|
||||||
|
*/
|
||||||
|
function versiontostring($versionarray)
|
||||||
|
{
|
||||||
|
$string='?';
|
||||||
|
if (isset($versionarray[0])) $string=$versionarray[0];
|
||||||
|
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
||||||
|
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Compare 2 versions
|
||||||
|
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||||
|
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||||
|
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||||
|
*/
|
||||||
|
function versioncompare($versionarray1,$versionarray2)
|
||||||
|
{
|
||||||
|
$ret=0;
|
||||||
|
$i=0;
|
||||||
|
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||||
|
{
|
||||||
|
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||||
|
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||||
|
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||||
|
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Return version PHP
|
||||||
|
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||||
|
*/
|
||||||
|
function versionphparray()
|
||||||
|
{
|
||||||
|
return split('\.',PHP_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Return version Dolibarr
|
||||||
|
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||||
|
*/
|
||||||
|
function versiondolibarrarray()
|
||||||
|
{
|
||||||
|
return split('\.',DOL_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Launch a sql file
|
* \brief Launch a sql file
|
||||||
|
|||||||
@@ -21,13 +21,12 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/functions.inc.php
|
\file htdocs/lib/functions.inc.php
|
||||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||||
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Pour compatibilit<69> lors de l'upgrade
|
// Pour compatibilit<69> lors de l'upgrade
|
||||||
@@ -39,51 +38,6 @@ if (! defined('DOL_DOCUMENT_ROOT'))
|
|||||||
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
|
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Renvoi une version en chaine depuis une version en tableau
|
|
||||||
\param versionarray Tableau de version (vermajeur,vermineur,autre)
|
|
||||||
\return string Chaine version
|
|
||||||
*/
|
|
||||||
function versiontostring($versionarray)
|
|
||||||
{
|
|
||||||
$string='?';
|
|
||||||
if (isset($versionarray[0])) $string=$versionarray[0];
|
|
||||||
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
|
||||||
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Compare 2 versions
|
|
||||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
|
||||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
|
||||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
|
||||||
*/
|
|
||||||
function versioncompare($versionarray1,$versionarray2)
|
|
||||||
{
|
|
||||||
$ret=0;
|
|
||||||
$i=0;
|
|
||||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
|
||||||
{
|
|
||||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
|
||||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
|
||||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
|
||||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\brief Renvoie version PHP
|
|
||||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
|
||||||
*/
|
|
||||||
function versionphp()
|
|
||||||
{
|
|
||||||
return split('\.',PHP_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Renvoi vrai si l'email est syntaxiquement valide
|
\brief Renvoi vrai si l'email est syntaxiquement valide
|
||||||
|
|||||||
Reference in New Issue
Block a user