mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-14 21:41:23 +01:00
Directory to store files follow same tree than tree of sections
This commit is contained in:
@@ -14,19 +14,17 @@
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/tools/purge.php
|
||||
\brief Page de purge des fichiers temporaires
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
|
||||
include_once(DOL_DOCUMENT_ROOT."/lib/databases/".$conf->db->type.".lib.php");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
@@ -49,7 +47,7 @@ if ($_POST["action"]=='purge')
|
||||
// Delete temporary files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dolibarr_dir_list($dolibarr_main_data_root,"directories",1,'temp');
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"directories",1,'temp');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +56,7 @@ if ($_POST["action"]=='purge')
|
||||
// Delete all files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dolibarr_dir_list($dolibarr_main_data_root,"all",0);
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,13 @@
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/clients.php
|
||||
\ingroup compta
|
||||
\brief Page accueil des clients
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\file htdoc/ecm/docmine.php
|
||||
\ingroup ecm
|
||||
@@ -23,7 +24,6 @@
|
||||
\version $Id$
|
||||
\author Laurent Destailleur
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php");
|
||||
@@ -39,16 +39,25 @@ $langs->load("other");
|
||||
// Load permissions
|
||||
$user->getrights('ecm');
|
||||
|
||||
// Get parameters
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
|
||||
// Permissions
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
// Get parameters
|
||||
$page=$_GET["page"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$section=$_REQUEST["section"];
|
||||
if (! $section)
|
||||
{
|
||||
@@ -56,18 +65,22 @@ if (! $section)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Load ecm object
|
||||
$ecmdir = new ECMDirectory($db);
|
||||
if (! empty($_REQUEST["section"]))
|
||||
if (empty($_REQUEST["section"]))
|
||||
{
|
||||
dolibarr_print_error('','Error, section parameter missing');
|
||||
exit;
|
||||
}
|
||||
$result=$ecmdir->fetch($_REQUEST["section"]);
|
||||
if (! $result > 0)
|
||||
{
|
||||
$result=$ecmdir->fetch($_REQUEST["section"]);
|
||||
if (! $result > 0)
|
||||
{
|
||||
dolibarr_print_error($db,$ecmdir->error);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$ecmdir->label;
|
||||
$relativepath=$ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
@@ -132,33 +145,7 @@ $form=new Form($db);
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
clearstatcache();
|
||||
$totalsize=0;
|
||||
$filearray=array();
|
||||
$errorlevel=error_reporting();
|
||||
error_reporting(0);
|
||||
$handle=opendir($upload_dir);
|
||||
error_reporting($errorlevel);
|
||||
if ($handle)
|
||||
{
|
||||
$i=0;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
||||
{
|
||||
$filearray[$i]->name=$file;
|
||||
$filearray[$i]->size=filesize($upload_dir."/".$file);
|
||||
$filearray[$i]->date=filemtime($upload_dir."/".$file);
|
||||
$totalsize+=$filearray[$i]->size;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>';
|
||||
}
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_ASC:SORT_DESC),1);
|
||||
|
||||
|
||||
$head = ecm_prepare_head($ecmdir);
|
||||
@@ -173,9 +160,10 @@ $result = 1;
|
||||
while ($tmpecmdir && $result > 0)
|
||||
{
|
||||
$tmpecmdir->ref=$tmpecmdir->label;
|
||||
$s=' -> '.$tmpecmdir->getNomUrl(1).$s;
|
||||
$s=$tmpecmdir->getNomUrl(1).$s;
|
||||
if ($tmpecmdir->fk_parent)
|
||||
{
|
||||
$s=' -> '.$s;
|
||||
$result=$tmpecmdir->fetch($tmpecmdir->fk_parent);
|
||||
}
|
||||
else
|
||||
@@ -183,7 +171,7 @@ while ($tmpecmdir && $result > 0)
|
||||
$tmpecmdir=0;
|
||||
}
|
||||
}
|
||||
print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a>';
|
||||
//print img_picto('','object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a>';
|
||||
print $s;
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Description").'</td><td>';
|
||||
@@ -197,11 +185,20 @@ print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||
print dolibarr_print_date($ecmdir->date_c,'dayhour');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ECMDirectoryForFiles").'</td><td>';
|
||||
//print $conf->ecm->dir_output;
|
||||
print '/ecm/'.$relativepath;
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ECMNbOfDocs").'</td><td>';
|
||||
print sizeof($filearray);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td>';
|
||||
print $totalsize;
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
print dol_print_size($totalsize);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@@ -227,6 +224,7 @@ $formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/docmine.php','',0,$section);
|
||||
// Affiche liste des documents existant
|
||||
print_titre($langs->trans("AttachedFiles"));
|
||||
|
||||
|
||||
/**
|
||||
* TODO Mettre cette section dans une zone AJAX
|
||||
*/
|
||||
@@ -234,28 +232,26 @@ $modulepart='ecm';
|
||||
$url=$_SERVER["PHP_SELF"];
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
$param='&socid='.$socid;
|
||||
$param='&section='.$section;
|
||||
print_liste_field_titre($langs->trans("Document"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
usort($filearray,"dol_compare_file");
|
||||
|
||||
$var=true;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
if (!is_dir($dir.$file->name) && substr($file->name, 0, 1) <> '.' && substr($file->name, 0, 3) <> 'CVS')
|
||||
if (!is_dir($dir.$file['name']) && substr($file['name'], 0, 1) <> '.' && substr($file['name'], 0, 3) <> 'CVS')
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td>";
|
||||
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&type=application/binary&file='.urlencode($prefix.$file->name).'">'.$file->name.'</a>';
|
||||
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&type=application/binary&file='.urlencode($prefix.$file['name']).'">'.$file['name'].'</a>';
|
||||
print "</td>\n";
|
||||
print '<td align="right">'.$file->size.' '.$langs->trans("bytes").'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($file->date,"dayhour").'</td>';
|
||||
print '<td align="right">'.dol_print_size($file['size']).'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($file['date'],"dayhour").'</td>';
|
||||
print '<td align="center">';
|
||||
echo '<a href="'.$url.'?section='.$_REQUEST["section"].'&action=delete_file&urlfile='.urlencode($file->name).'">'.img_delete().'</a>';
|
||||
echo '<a href="'.$url.'?section='.$_REQUEST["section"].'&action=delete_file&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
\remarks Initialy built by build_class_from_table on 2008-02-24 19:24
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
//require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class EcmDirectory
|
||||
\brief Class to manage ECM directories
|
||||
@@ -131,7 +125,7 @@ class EcmDirectory // extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Update database
|
||||
* \param user User that modify
|
||||
* \param notrigger 0=no, 1=yes (no update trigger)
|
||||
@@ -186,7 +180,7 @@ class EcmDirectory // extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Update database
|
||||
* \sign '+' or '-'
|
||||
* \return int <0 if KO, >0 if OK
|
||||
@@ -214,7 +208,7 @@ class EcmDirectory // extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Load object in memory from database
|
||||
* \param id id object
|
||||
* \return int <0 if KO, >0 if OK
|
||||
@@ -268,7 +262,7 @@ class EcmDirectory // extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* \brief Delete object in database
|
||||
* \param user User that delete
|
||||
* \return int <0 if KO, >0 if OK
|
||||
@@ -343,6 +337,43 @@ class EcmDirectory // extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Return relative path of a directory on disk
|
||||
\return string Relative physical path
|
||||
*/
|
||||
function getRelativePath()
|
||||
{
|
||||
$this->get_full_arbo();
|
||||
|
||||
$ret='';
|
||||
$idtosearch=$this->id;
|
||||
$i=0;
|
||||
do {
|
||||
// Get index cursor in this->cats for id_mere
|
||||
$cursorindex=-1;
|
||||
foreach ($this->cats as $key => $val)
|
||||
{
|
||||
if ($this->cats[$key]['id'] == $idtosearch)
|
||||
{
|
||||
$cursorindex=$key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//print "c=".$idtosearch."-".$cursorindex;
|
||||
|
||||
if ($cursorindex >= 0)
|
||||
{
|
||||
$ret=$this->cats[$cursorindex]['label'].'/'.$ret;
|
||||
|
||||
$idtosearch=$this->cats[$cursorindex]['id_mere'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
while ($cursorindex >= 0 && ! empty($idtosearch) && $i < 100); // i avoid infinite loop
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load this->motherof array
|
||||
* \return int <0 if KO, >0 if OK
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@@ -26,18 +17,18 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/ecm/htmlecm.form.class.php
|
||||
\brief Fichier de la classe des fonctions pr<70>d<EFBFBD>finie de composants html
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/ecm/htmlecm.form.class.php
|
||||
* \brief Fichier de la classe des fonctions pr<70>d<EFBFBD>finie de composants html
|
||||
* \version $Id$
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT."/ecm/ecmdirectory.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class FormEcm
|
||||
\brief Classe permettant la g<>n<EFBFBD>ration de composants html
|
||||
\remarks Only common components must be here.
|
||||
*/
|
||||
* \class FormEcm
|
||||
* \brief Classe permettant la g<>n<EFBFBD>ration de composants html
|
||||
* \remarks Only common components must be here.
|
||||
*/
|
||||
class FormEcm
|
||||
{
|
||||
var $db;
|
||||
@@ -52,8 +43,8 @@ class FormEcm
|
||||
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param DB handler d'acc<63>s base de donn<6E>e
|
||||
* \brief Constructeur
|
||||
* \param DB handler d'acc<63>s base de donn<6E>e
|
||||
*/
|
||||
function FormEcm($DB)
|
||||
{
|
||||
|
||||
@@ -125,6 +125,7 @@ class FormFile
|
||||
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0)
|
||||
{
|
||||
// filedir = conf->...dir_ouput."/".get_exdir(id)
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||
|
||||
global $langs,$bc,$conf;
|
||||
$var=true;
|
||||
@@ -289,7 +290,7 @@ class FormFile
|
||||
$png = '|\.png$';
|
||||
$filter = $filename.'.pdf';
|
||||
}
|
||||
$file_list=dolibarr_dir_list($filedir,'files',0,$filter,'\.meta$'.$png,'date',SORT_DESC);
|
||||
$file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.$png,'date',SORT_DESC);
|
||||
|
||||
// Affiche en-tete tableau si non deja affich<63>
|
||||
if (sizeof($file_list) && ! $headershown && !$iconPDF)
|
||||
|
||||
@@ -93,7 +93,11 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
||||
|
||||
// on d<>code le mot de passe de la base si besoin
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php");
|
||||
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||
if (! empty($dolibarr_main_db_encrypted_pass))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
|
||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
}
|
||||
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
$conf->db->host = $dolibarr_main_db_host;
|
||||
|
||||
@@ -77,8 +77,12 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
$error=0;
|
||||
|
||||
// on d<>code le mot de passe de la base si besoin
|
||||
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||
// decode database pass if needed
|
||||
if (! empty($dolibarr_main_db_encrypted_pass))
|
||||
{
|
||||
require_once($dolibarr_main_document_root."/lib/security.lib.php");
|
||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
}
|
||||
|
||||
// $conf is already instancied inside inc.php
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
|
||||
@@ -75,7 +75,11 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
|
||||
// on decode le mot de passe de la base si besoin
|
||||
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||
if (! empty($dolibarr_main_db_encrypted_pass))
|
||||
{
|
||||
require_once($dolibarr_main_document_root."/lib/security.lib.php");
|
||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
}
|
||||
|
||||
// $conf is already instancied inside inc.php
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
|
||||
@@ -20,8 +20,8 @@ ECMNewSection=New manual directory
|
||||
ECMNewDocument=New document
|
||||
ECMCreationDate=Creation date
|
||||
ECMCreationUser=Creator
|
||||
ECMArea=Electronic Content Management area
|
||||
ECMAreaDesc=The Electronic Content Management area allows you to save, share and search quickly documents in Dolibarr.
|
||||
ECMArea=ECM area
|
||||
ECMAreaDesc=The ECM (Electronic Content Management) area allows you to save, share and search quickly all kind of documents in Dolibarr.
|
||||
ECMAreaDesc2=* Automatic directories are filled automatically when adding documents from card of an element.<br>* Manual directories can be used to save documents not linked to a particular element.
|
||||
ECMSectionWasRemoved=Directory <b>%s</b> has been deleted.
|
||||
ECMDocumentsSection=Document of directory
|
||||
@@ -41,3 +41,4 @@ ECMNoDirecotyYet=No directory created
|
||||
ShowECMSection=Show directory
|
||||
DeleteSection=Remove directory
|
||||
ConfirmDeleteSection=Can you confirm you want to delete the directory <b>%s</b> ?
|
||||
ECMDirectoryForFiles=Relative directory for files
|
||||
@@ -20,9 +20,9 @@ ECMNewSection=Nouvelle rubrique manuelle
|
||||
ECMNewDocument=Nouveau document
|
||||
ECMCreationDate=Date cr<63>ation
|
||||
ECMCreationUser=Cr<43>ateur
|
||||
ECMArea=Espace Gestion de documents
|
||||
ECMAreaDesc=L'espace Gestion des documents vous permet de stocker et retrouver rapidement des documents dans Dolibarr.
|
||||
ECMAreaDesc2=* Les rubriques automatiques sont aliment<6E>es automatiquement lors de l'ajout d'un document depuis une fiche objet.<br>* Les rubriques manuelles peuvent etre utilis<69>es pour stocker des documents li<EFBFBD>s <20> aucun <20>l<EFBFBD>ment particulier.
|
||||
ECMArea=Espace GED
|
||||
ECMAreaDesc=L'espace GED (Gestion Electronique de Documents) vous permet de stocker dans Dolibarr et retrouver rapidement tout type de documents.
|
||||
ECMAreaDesc2=* Les rubriques automatiques sont aliment<6E>es automatiquement lors de l'ajout d'un document depuis une fiche objet (propal, facture, commande...).<br>* Les rubriques manuelles peuvent etre utilis<69>es pour stocker des documents divers, non li<6C>s <20> un objet particulier.
|
||||
ECMSectionWasRemoved=La rubrique <b>%s</b> a <20>t<EFBFBD> effac<61>e.
|
||||
ECMDocumentsSection=Document de la section
|
||||
ECMSearchByKeywords=Recherche par mots cl<63>s
|
||||
@@ -41,3 +41,4 @@ ECMNoDirecotyYet=Aucune rubrique cr
|
||||
ShowECMSection=Afficher rubrique
|
||||
DeleteSection=Suppression rubrique
|
||||
ConfirmDeleteSection=Confirmez-vous la suppression de la rubique <b>%s</b> ?
|
||||
ECMDirectoryForFiles=R<>pertoire relatif pour les fichiers
|
||||
@@ -23,6 +23,109 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\brief Scan a directory and return a list of files/directories
|
||||
\param $path Starting path from which to search
|
||||
\param $types Can be "directories", "files", or "all"
|
||||
\param $recursive Determines whether subdirectories are searched
|
||||
\param $filter Regex for filter
|
||||
\param $exludefilter Regex for exclude filter (example: '\.meta$')
|
||||
\param $sortcriteria Sort criteria ("name","date","size")
|
||||
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
\param $mode 0=Return array of key need, 1=Force all key to be loaded
|
||||
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
||||
*/
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
|
||||
{
|
||||
dolibarr_syslog("files.lib.php::dol_dir_list $path");
|
||||
|
||||
$loaddate=$mode?true:false;
|
||||
$loadsize=$mode?true:false;
|
||||
|
||||
// Clean parameters
|
||||
$path=eregi_replace('[\\/]+$','',$path);
|
||||
|
||||
if (! is_dir($path)) return array();
|
||||
|
||||
if ($dir = opendir($path))
|
||||
{
|
||||
$file_list = array();
|
||||
while (false !== ($file = readdir($dir)))
|
||||
{
|
||||
$qualified=1;
|
||||
|
||||
// Check if file is qualified
|
||||
if (eregi('^\.',$file)) $qualified=0;
|
||||
if ($excludefilter && eregi($excludefilter,$file)) $qualified=0;
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
// Check whether this is a file or directory and whether we're interested in that type
|
||||
if (is_dir($path."/".$file) && (($types=="directories") || ($types=="all")))
|
||||
{
|
||||
// Add entry into file_list array
|
||||
if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||
|
||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||
{
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize
|
||||
);
|
||||
}
|
||||
|
||||
// if we're in a directory and we want recursive behavior, call this function again
|
||||
if ($recursive)
|
||||
{
|
||||
$file_list = array_merge($file_list, dol_dir_list($path."/".$file."/", $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder));
|
||||
}
|
||||
}
|
||||
else if (! is_dir($path."/".$file) && (($types == "files") || ($types == "all")))
|
||||
{
|
||||
// Add file into file_list array
|
||||
if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||
{
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
// Obtain a list of columns
|
||||
$myarray=array();
|
||||
foreach ($file_list as $key => $row)
|
||||
{
|
||||
$myarray[$key] = $row[$sortcriteria];
|
||||
}
|
||||
// Sort the data
|
||||
array_multisort($myarray, $sortorder, $file_list);
|
||||
|
||||
return $file_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Compare 2 files
|
||||
*
|
||||
* @param unknown_type $a File 1
|
||||
* @param unknown_type $b File 2
|
||||
* @return int 1, 0, 1
|
||||
*/
|
||||
function dol_compare_file($a, $b)
|
||||
{
|
||||
global $sortorder;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\file htdocs/lib/functions.lib.php
|
||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
\version $Id$
|
||||
*/
|
||||
*/
|
||||
|
||||
// Pour compatibilit<69> lors de l'upgrade
|
||||
if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..');
|
||||
@@ -39,7 +39,7 @@ if (! defined('ADODB_DATE_VERSION')) include_once(DOL_DOCUMENT_ROOT."/includes/a
|
||||
\brief Renvoi vrai si l'email est syntaxiquement valide
|
||||
\param address adresse email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
\return boolean true si email valide, false sinon
|
||||
*/
|
||||
*/
|
||||
function ValidEmail($address)
|
||||
{
|
||||
if (ereg( ".*<(.+)>", $address, $regs)) {
|
||||
@@ -59,7 +59,7 @@ function ValidEmail($address)
|
||||
\brief Renvoi vrai si l'email a un nom de domaine qui r<>soud via dns
|
||||
\param mail adresse email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||
\return boolean true si email valide, false sinon
|
||||
*/
|
||||
*/
|
||||
function check_mail ($mail)
|
||||
{
|
||||
list($user, $domain) = split("@", $mail, 2);
|
||||
@@ -77,7 +77,7 @@ function check_mail ($mail)
|
||||
\brief Nettoie chaine de caractere iso des accents
|
||||
\param str Chaine a nettoyer
|
||||
\return string Chaine nettoyee
|
||||
*/
|
||||
*/
|
||||
function unaccent_isostring($str)
|
||||
{
|
||||
$translation = array(
|
||||
@@ -104,7 +104,7 @@ function unaccent_isostring($str)
|
||||
\remarks Fonction appelee par exemple pour definir un nom de fichier depuis un identifiant chaine libre
|
||||
\param str Chaine a nettoyer
|
||||
\return string Chaine nettoyee (A-Z_)
|
||||
*/
|
||||
*/
|
||||
function sanitize_string($str)
|
||||
{
|
||||
$forbidden_chars_to_underscore=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",",",";","=");
|
||||
@@ -127,7 +127,7 @@ function sanitize_string($str)
|
||||
Si SYSLOG_FILE_NO_ERROR d<>fini, on ne g<>re pas erreur ecriture log
|
||||
\remarks On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
|
||||
On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
*/
|
||||
*/
|
||||
function dolibarr_syslog($message, $level=LOG_INFO)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
@@ -222,7 +222,7 @@ function dolibarr_syslog($message, $level=LOG_INFO)
|
||||
\param active 0=onglet non actif, 1=onglet actif
|
||||
\param title Titre tabelau ("" par defaut)
|
||||
\param notab 0=Add tab header, 1=no tab header
|
||||
*/
|
||||
*/
|
||||
function dolibarr_fiche_head($links, $active='0', $title='', $notab=0)
|
||||
{
|
||||
print "\n".'<div class="tabs">'."\n";
|
||||
@@ -275,7 +275,7 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0)
|
||||
Si non defini on sauve tous parametres du tableau tab
|
||||
\param tab Tableau (cl<63>=>valeur) des param<61>tres a sauvegarder
|
||||
\return int <0 si ko, >0 si ok
|
||||
*/
|
||||
*/
|
||||
function dolibarr_set_user_page_param($db, &$user, $url='', $tab)
|
||||
{
|
||||
// Verification parametres
|
||||
@@ -340,7 +340,7 @@ function dolibarr_set_user_page_param($db, &$user, $url='', $tab)
|
||||
\brief Formattage des nombres
|
||||
\param ca valeur a formater
|
||||
\return int valeur format<61>e
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_ca($ca)
|
||||
{
|
||||
global $langs,$conf;
|
||||
@@ -372,7 +372,7 @@ function dolibarr_print_ca($ca)
|
||||
\param duration_value Valeur de la dur<75>e a ajouter
|
||||
\param duration_unit Unit<69> de la dur<75>e a ajouter (d, m, y)
|
||||
\return int Nouveau timestamp
|
||||
*/
|
||||
*/
|
||||
function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
{
|
||||
if ($duration_value == 0) return $time;
|
||||
@@ -394,7 +394,7 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
|
||||
"%d/%m/%Y %H:%M:%S",
|
||||
"day", "daytext", "dayhour", "dayhourldap", "dayhourtext"
|
||||
\return string Date format<61>e ou '' si time null
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_date($time,$format='')
|
||||
{
|
||||
global $conf;
|
||||
@@ -442,7 +442,7 @@ function dolibarr_print_date($time,$format='')
|
||||
DD/MM/YY ou DD/MM/YYYY
|
||||
DD/MM/YY HH:MM:SS ou DD/MM/YYYY HH:MM:SS
|
||||
\return date Date
|
||||
*/
|
||||
*/
|
||||
function dolibarr_stringtotime($string)
|
||||
{
|
||||
if (eregi('^([0-9]+)\/([0-9]+)\/([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$string,$reg))
|
||||
@@ -495,7 +495,7 @@ function dolibarr_stringtotime($string)
|
||||
'leap' => $leaf,
|
||||
'ndays' => $ndays
|
||||
\remarks PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
*/
|
||||
*/
|
||||
function dolibarr_getdate($timestamp,$fast=false)
|
||||
{
|
||||
$usealternatemethod=false;
|
||||
@@ -527,7 +527,7 @@ function dolibarr_getdate($timestamp,$fast=false)
|
||||
\param check No check on parameters (Can use day 32, etc...)
|
||||
\return timestamp Date en timestamp, '' if error
|
||||
\remarks PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||
*/
|
||||
*/
|
||||
function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
|
||||
{
|
||||
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
|
||||
@@ -575,7 +575,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
|
||||
\param timestamp Date. Exemple: Si timestamp=0 et gm=1, renvoi 01/01/1970 00:00:00
|
||||
\param gm 1 if timestamp was built with gmmktime, 0 if timestamp was build with mktime
|
||||
\return string Formated date
|
||||
*/
|
||||
*/
|
||||
function dolibarr_date($fmt, $timestamp, $gm=0)
|
||||
{
|
||||
$usealternatemethod=false;
|
||||
@@ -598,7 +598,7 @@ function dolibarr_date($fmt, $timestamp, $gm=0)
|
||||
/**
|
||||
\brief Affiche les informations d'un objet
|
||||
\param object objet a afficher
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_object_info($object)
|
||||
{
|
||||
global $langs;
|
||||
@@ -640,7 +640,7 @@ function dolibarr_print_object_info($object)
|
||||
\param phone Num<75>ro de telephone a formater
|
||||
\param country Pays selon lequel formatter
|
||||
\return string Num<75>ro de t<>l<EFBFBD>phone format<61>
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_phone($phone,$country="FR")
|
||||
{
|
||||
$phone=trim($phone);
|
||||
@@ -674,6 +674,20 @@ function dolibarr_print_phone($phone,$country="FR")
|
||||
return $phone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return string with formated size
|
||||
* \param size Size to print
|
||||
* \return string Link
|
||||
*/
|
||||
function dol_print_size($size)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
return $size.' '.$langs->trans("Bytes");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show click to dial link
|
||||
* \param phone Phone to call
|
||||
@@ -704,7 +718,7 @@ function dol_phone_link($phone,$option=0)
|
||||
\param trunc Where to trunc: right, left, middle
|
||||
\return string Truncated string
|
||||
\remarks USE_SHORT_TITLE=0 can disable all truncings
|
||||
*/
|
||||
*/
|
||||
function dolibarr_trunc($string,$size=40,$trunc='right')
|
||||
{
|
||||
if ($size==0) return $string;
|
||||
@@ -750,7 +764,7 @@ function dolibarr_trunc($string,$size=40,$trunc='right')
|
||||
\param side 0=Compl<70>tion a droite, 1=Compl<70>tion a gauche
|
||||
\param char Chaine de compl<70>tion
|
||||
\return string Chaine compl<70>t<EFBFBD>e
|
||||
*/
|
||||
*/
|
||||
function dolibarr_pad($string,$size,$side,$char=' ')
|
||||
{
|
||||
$taille=sizeof($string);
|
||||
@@ -769,7 +783,7 @@ function dolibarr_pad($string,$size,$side,$char=' ')
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param object Objet pour lequel il faut afficher le logo (exemple: user, group, action, bill, contract, propal, product, ...)
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_object($alt, $object)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -783,7 +797,7 @@ function img_object($alt, $object)
|
||||
\param options Attribut suppl<70>mentaire a la balise img
|
||||
\param pictoisfullpath If 1, image path is a full path
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
|
||||
{
|
||||
global $conf;
|
||||
@@ -797,7 +811,7 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param numaction Determine image action
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_action($alt = "default", $numaction)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -816,7 +830,7 @@ function img_action($alt = "default", $numaction)
|
||||
\brief Affiche logo fichier
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_file($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -828,7 +842,7 @@ function img_file($alt = "default")
|
||||
\brief Affiche logo refresh
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_refresh($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -840,7 +854,7 @@ function img_refresh($alt = "default")
|
||||
\brief Affiche logo dossier
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_folder($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -852,7 +866,7 @@ function img_folder($alt = "default")
|
||||
\brief Affiche logo nouveau fichier
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_file_new($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -865,7 +879,7 @@ function img_file_new($alt = "default")
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_pdf($alt = "default",$size=3)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -877,7 +891,7 @@ function img_pdf($alt = "default",$size=3)
|
||||
\brief Affiche logo vcard
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_vcard($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -889,7 +903,7 @@ function img_vcard($alt = "default")
|
||||
\brief Affiche logo +
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_edit_add($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -900,7 +914,7 @@ function img_edit_add($alt = "default")
|
||||
\brief Affiche logo -
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_edit_remove($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -913,7 +927,7 @@ function img_edit_remove($alt = "default")
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param float Si il faut y mettre le style "float: right"
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_edit($alt = "default", $float=0, $other='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -929,7 +943,7 @@ function img_edit($alt = "default", $float=0, $other='')
|
||||
\brief Affiche logo effacer
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_delete($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -941,7 +955,7 @@ function img_delete($alt = "default")
|
||||
\brief Affiche logo d<>sactiver
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_disable($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -953,7 +967,7 @@ function img_disable($alt = "default")
|
||||
/**
|
||||
\brief Affiche logo help avec curseur "?"
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_help($usehelpcursor=1,$usealttitle=1)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -968,7 +982,7 @@ function img_help($usehelpcursor=1,$usealttitle=1)
|
||||
/**
|
||||
\brief Affiche picto calendrier "?"
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_cal()
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -979,7 +993,7 @@ function img_cal()
|
||||
\brief Affiche logo info
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_info($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -991,7 +1005,7 @@ function img_info($alt = "default")
|
||||
\brief Affiche logo calculatrice
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_calc($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1004,7 +1018,7 @@ function img_calc($alt = "default")
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param float Si il faut afficher le style "float: right"
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_warning($alt = "default",$float=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1020,7 +1034,7 @@ function img_warning($alt = "default",$float=0)
|
||||
\brief Affiche logo warning
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_error($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1032,7 +1046,7 @@ function img_error($alt = "default")
|
||||
\brief Affiche logo alerte
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_alerte($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1045,7 +1059,7 @@ function img_alerte($alt = "default")
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param option Choose of logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_phone($alt = "default",$option=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1061,7 +1075,7 @@ function img_phone($alt = "default",$option=0)
|
||||
\brief Affiche logo suivant
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_next($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1075,7 +1089,7 @@ function img_next($alt = "default")
|
||||
\brief Affiche logo pr<70>c<EFBFBD>dent
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_previous($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1088,7 +1102,7 @@ function img_previous($alt = "default")
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_down($alt = "default", $selected=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1102,7 +1116,7 @@ function img_down($alt = "default", $selected=0)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_up($alt = "default", $selected=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1116,7 +1130,7 @@ function img_up($alt = "default", $selected=0)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_left($alt = "default", $selected=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1130,7 +1144,7 @@ function img_left($alt = "default", $selected=0)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param selected Affiche version "selected" du logo
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_right($alt = "default", $selected=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1143,7 +1157,7 @@ function img_right($alt = "default", $selected=0)
|
||||
\brief Affiche logo tick
|
||||
\param alt Texte sur le alt de l'image
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_tick($alt = "default")
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1155,7 +1169,7 @@ function img_tick($alt = "default")
|
||||
\brief Affiche le logo tick si allow
|
||||
\param allow Authorise ou non
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
*/
|
||||
function img_allow($allow)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1176,7 +1190,7 @@ function img_allow($allow)
|
||||
\brief Return if a filename is file name of a supported image format
|
||||
\param file Filename
|
||||
\return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported
|
||||
*/
|
||||
*/
|
||||
function image_format_supported($file)
|
||||
{
|
||||
// Case filename is not a format image
|
||||
@@ -1207,7 +1221,7 @@ function image_format_supported($file)
|
||||
\param text Text info
|
||||
\param infoonimgalt Info is shown on alt of star picto
|
||||
\return string String with info text
|
||||
*/
|
||||
*/
|
||||
function info_admin($texte,$infoonimgalt=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1234,7 +1248,7 @@ function info_admin($texte,$infoonimgalt=0)
|
||||
\param feature Feature to check (in most cases, it's module name)
|
||||
\param objectid Object ID if we want to check permission on on object (optionnal)
|
||||
\param dbtable Table name where object is stored. Not used if objectid is null (optionnel)
|
||||
*/
|
||||
*/
|
||||
function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='')
|
||||
{
|
||||
global $db;
|
||||
@@ -1367,7 +1381,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='')
|
||||
\param message Force error message
|
||||
\param printheader Affiche avant le header
|
||||
\remarks L'appel a cette fonction termine le code.
|
||||
*/
|
||||
*/
|
||||
function accessforbidden($message='',$printheader=1)
|
||||
{
|
||||
global $user, $langs;
|
||||
@@ -1405,7 +1419,7 @@ function accessforbidden($message='',$printheader=1)
|
||||
renvoyer leur erreur par l'interm<72>diaire de leur propri<72>t<EFBFBD> "error".
|
||||
\param db Handler de base utilis<69>
|
||||
\param error Chaine erreur ou tableau de chaines erreur compl<70>mentaires a afficher
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_error($db='',$error='')
|
||||
{
|
||||
global $conf,$langs,$argv;
|
||||
@@ -1491,7 +1505,7 @@ function dolibarr_print_error($db='',$error='')
|
||||
\param src_file fichier source
|
||||
\param dest_file fichier de destination
|
||||
\return int true=Deplacement OK, false=Pas de deplacement ou KO
|
||||
*/
|
||||
*/
|
||||
function dol_move_uploaded_file($src_file, $dest_file)
|
||||
{
|
||||
global $conf;
|
||||
@@ -1547,7 +1561,7 @@ function dol_move_uploaded_file($src_file, $dest_file)
|
||||
\param td options de l'attribut td ("" par defaut)
|
||||
\param sortfield nom du champ sur lequel est effectu<74> le tri du tableau
|
||||
\param sortorder ordre du tri
|
||||
*/
|
||||
*/
|
||||
function print_liste_field_titre($name, $file, $field, $begin="", $options="", $td="", $sortfield="", $sortorder="")
|
||||
{
|
||||
global $conf;
|
||||
@@ -1601,7 +1615,7 @@ function print_liste_field_titre($name, $file, $field, $begin="", $options="", $
|
||||
/**
|
||||
\brief Affichage d'un titre
|
||||
\param titre Le titre a afficher
|
||||
*/
|
||||
*/
|
||||
function print_titre($titre)
|
||||
{
|
||||
print '<div class="titre">'.$titre.'</div>';
|
||||
@@ -1613,7 +1627,7 @@ function print_titre($titre)
|
||||
\param mesg Message supl<70>mentaire a afficher a droite
|
||||
\param picto Picto pour ligne de titre
|
||||
\param pictoisfullpath 1=Picto is a full absolute url of image
|
||||
*/
|
||||
*/
|
||||
function print_fiche_titre($titre, $mesg='', $picto='', $pictoisfullpath=0)
|
||||
{
|
||||
print "\n";
|
||||
@@ -1633,7 +1647,7 @@ function print_fiche_titre($titre, $mesg='', $picto='', $pictoisfullpath=0)
|
||||
\brief Effacement d'un fichier
|
||||
\param file Fichier a effacer ou masque de fichier a effacer
|
||||
\param boolean true if file deleted, false if error
|
||||
*/
|
||||
*/
|
||||
function dol_delete_file($file)
|
||||
{
|
||||
$ok=true;
|
||||
@@ -1649,7 +1663,7 @@ function dol_delete_file($file)
|
||||
/**
|
||||
\brief Effacement d'un r<>pertoire
|
||||
\param file R<>pertoire a effacer
|
||||
*/
|
||||
*/
|
||||
function dol_delete_dir($dir)
|
||||
{
|
||||
return rmdir($dir);
|
||||
@@ -1660,7 +1674,7 @@ function dol_delete_dir($dir)
|
||||
\param file R<>pertoire a effacer
|
||||
\param count Compteur pour comptage nb elements supprim<69>s
|
||||
\return int Nombre de fichier+rep<65>rtoires supprim<69>s
|
||||
*/
|
||||
*/
|
||||
function dol_delete_dir_recursive($dir,$count=0)
|
||||
{
|
||||
if ($handle = opendir("$dir"))
|
||||
@@ -1695,7 +1709,7 @@ function dol_delete_dir_recursive($dir,$count=0)
|
||||
\brief Scan les fichiers avec un anti-virus
|
||||
\param file Fichier a scanner
|
||||
\return malware Nom du virus si infect<63> sinon retourne "null"
|
||||
*/
|
||||
*/
|
||||
function dol_avscan_file($file)
|
||||
{
|
||||
$malware = '';
|
||||
@@ -1727,7 +1741,7 @@ function dol_avscan_file($file)
|
||||
\param center chaine du centre ('' par defaut)
|
||||
\param num number of records found by select with limit+1
|
||||
\param totalnboflines Total number of records/lines for all pages (if known)
|
||||
*/
|
||||
*/
|
||||
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
@@ -1819,7 +1833,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
\param options Autres parametres d'url a propager dans les liens ("" par defaut)
|
||||
\param nextpage Faut-il une page suivante
|
||||
\param betweenarraows HTML Content to show between arrows
|
||||
*/
|
||||
*/
|
||||
function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrows='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
@@ -1836,13 +1850,13 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui retourne un taux de tva format<61> pour visualisation
|
||||
* \remarks Fonction utilis<69>e dans les pdf et les pages html
|
||||
* \param rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
|
||||
* \param foundpercent Add a percent % sign in output
|
||||
* \param info_bits Miscellanous information on vat
|
||||
* \return string Chaine avec montant format<61> (19,6 ou 19,6% ou 8.5% *)
|
||||
*/
|
||||
* \brief Fonction qui retourne un taux de tva format<61> pour visualisation
|
||||
* \remarks Fonction utilis<69>e dans les pdf et les pages html
|
||||
* \param rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
|
||||
* \param foundpercent Add a percent % sign in output
|
||||
* \param info_bits Miscellanous information on vat
|
||||
* \return string Chaine avec montant format<61> (19,6 ou 19,6% ou 8.5% *)
|
||||
*/
|
||||
function vatrate($rate,$foundpercent=false,$info_bits=0)
|
||||
{
|
||||
// Test for compatibility
|
||||
@@ -1864,16 +1878,16 @@ function vatrate($rate,$foundpercent=false,$info_bits=0)
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui retourne un montant mon<6F>taire format<61> pour visualisation
|
||||
* \remarks Fonction utilis<69>e dans les pdf et les pages html
|
||||
* \param amount Montant a formater
|
||||
* \param html Formatage html ou pas (0 par defaut)
|
||||
* \param outlangs Objet langs pour formatage text
|
||||
* \param trunc 1=Tronque affichage si trop de d<>cimales,0=Force le non troncage
|
||||
* \param nbdecimal Nbre decimals minimum.
|
||||
* \return string Chaine avec montant format<61>
|
||||
* \seealso price2num Fonction inverse de price
|
||||
*/
|
||||
* \brief Fonction qui retourne un montant mon<6F>taire format<61> pour visualisation
|
||||
* \remarks Fonction utilis<69>e dans les pdf et les pages html
|
||||
* \param amount Montant a formater
|
||||
* \param html Formatage html ou pas (0 par defaut)
|
||||
* \param outlangs Objet langs pour formatage text
|
||||
* \param trunc 1=Tronque affichage si trop de d<>cimales,0=Force le non troncage
|
||||
* \param nbdecimal Nbre decimals minimum.
|
||||
* \return string Chaine avec montant format<61>
|
||||
* \seealso price2num Fonction inverse de price
|
||||
*/
|
||||
function price($amount, $html=0, $outlangs='', $trunc=1, $nbdecimal=2)
|
||||
{
|
||||
global $langs,$conf;
|
||||
@@ -1935,7 +1949,7 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $nbdecimal=2)
|
||||
''=No rounding
|
||||
\return string Montant au format num<75>rique PHP et SQL (Exemple: '99.99999')
|
||||
\seealso price Fonction inverse de price2num
|
||||
*/
|
||||
*/
|
||||
function price2num($amount,$rounding='')
|
||||
{
|
||||
global $conf;
|
||||
@@ -1958,8 +1972,8 @@ function price2num($amount,$rounding='')
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return vat rate of a product in a particular selling country
|
||||
*/
|
||||
* \brief Return vat rate of a product in a particular selling country
|
||||
*/
|
||||
function get_product_vat_for_country($idprod, $countrycode)
|
||||
{
|
||||
global $db;
|
||||
@@ -2057,7 +2071,7 @@ function get_default_npr($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
\param yesno Variable pour test si oui ou non
|
||||
\param case 1=Yes/No, 0=yes/no
|
||||
\param color 0=texte only, 1=Text is format with a color font style
|
||||
*/
|
||||
*/
|
||||
function yn($yesno, $case=1, $color=0)
|
||||
{
|
||||
global $langs;
|
||||
@@ -2082,7 +2096,7 @@ function yn($yesno, $case=1, $color=0)
|
||||
\param db handler d'acc<63>s base
|
||||
\param code Code r<>gion
|
||||
\param pays_id Id du pays
|
||||
*/
|
||||
*/
|
||||
function departement_rowid($db,$code, $pays_id)
|
||||
{
|
||||
$sql = "SELECT c.rowid FROM ".MAIN_DB_PREFIX."c_departements as c,".MAIN_DB_PREFIX."c_regions as r";
|
||||
@@ -2130,7 +2144,7 @@ function get_exdir($num,$level=3)
|
||||
\brief Cr<43>ation de r<>pertoire recursive
|
||||
\param $dir R<>pertoire a cr<63>er
|
||||
\return int < 0 si erreur, >= 0 si succ<63>s
|
||||
*/
|
||||
*/
|
||||
function create_exdir($dir)
|
||||
{
|
||||
dolibarr_syslog("functions.lib.php::create_exdir: dir=$dir",LOG_INFO);
|
||||
@@ -2180,103 +2194,13 @@ function create_exdir($dir)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Scan a directory and return a list of files/directories
|
||||
\param $path Starting path from which to search
|
||||
\param $types Can be "directories", "files", or "all"
|
||||
\param $recursive Determines whether subdirectories are searched
|
||||
\param $filter Regex for filter
|
||||
\param $exludefilter Regex for exclude filter
|
||||
\param $sortcriteria Sort criteria ("name","date","size")
|
||||
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
||||
*/
|
||||
function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC)
|
||||
{
|
||||
dolibarr_syslog("functions.lib.php::dolibarr_dir_list $path");
|
||||
|
||||
$loaddate=false;
|
||||
$loadsize=false;
|
||||
|
||||
if (! is_dir($path)) return array();
|
||||
|
||||
if ($dir = opendir($path))
|
||||
{
|
||||
$file_list = array();
|
||||
while (false !== ($file = readdir($dir)))
|
||||
{
|
||||
$qualified=1;
|
||||
|
||||
// Check if file is qualified
|
||||
if (eregi('^\.',$file)) $qualified=0;
|
||||
if ($excludefilter && eregi($excludefilter,$file)) $qualified=0;
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
// Check whether this is a file or directory and whether we're interested in that type
|
||||
if ((is_dir($path."/".$file)) && (($types=="directories") || ($types=="all")))
|
||||
{
|
||||
// Add entry into file_list array
|
||||
if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||
|
||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||
{
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize
|
||||
);
|
||||
}
|
||||
|
||||
// if we're in a directory and we want recursive behavior, call this function again
|
||||
if ($recursive)
|
||||
{
|
||||
$file_list = array_merge($file_list, dolibarr_dir_list($path."/".$file."/", $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder));
|
||||
}
|
||||
}
|
||||
else if (($types == "files") || ($types == "all"))
|
||||
{
|
||||
// Add file into file_list array
|
||||
if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||
{
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
// Obtain a list of columns
|
||||
$myarray=array();
|
||||
foreach ($file_list as $key => $row)
|
||||
{
|
||||
$myarray[$key] = $row[$sortcriteria];
|
||||
}
|
||||
// Sort the data
|
||||
array_multisort($myarray, $sortorder, $file_list);
|
||||
|
||||
return $file_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne le num<75>ro de la semaine par rapport a une date
|
||||
\param time Date au format 'timestamp'
|
||||
\return int Num<75>ro de semaine
|
||||
*/
|
||||
*/
|
||||
function numero_semaine($time)
|
||||
{
|
||||
$stime = strftime( '%Y-%m-%d',$time);
|
||||
@@ -2351,10 +2275,12 @@ function numero_semaine($time)
|
||||
|
||||
return sprintf("%02d",$numeroSemaine);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Retourne le picto champ obligatoire
|
||||
\return string Chaine avec picto obligatoire
|
||||
*/
|
||||
*/
|
||||
function picto_required()
|
||||
{
|
||||
return '<b>*</b>';
|
||||
@@ -2365,7 +2291,7 @@ function picto_required()
|
||||
\param from_unit int Unite originale en puissance de 10
|
||||
\param to_unit int Nouvelle unite en puissance de 10
|
||||
\return float Masse convertie
|
||||
*/
|
||||
*/
|
||||
function weight_convert($weight,&$from_unit,$to_unit)
|
||||
{
|
||||
/* Pour convertire 320 gr en Kg appeler
|
||||
@@ -2398,7 +2324,7 @@ function weight_convert($weight,&$from_unit,$to_unit)
|
||||
\param measuring_style Le style de mesure : weight, volume,...
|
||||
\return string Unite
|
||||
\todo gerer les autres unit<69>s de mesure comme la livre, le gallon, le litre, ...
|
||||
*/
|
||||
*/
|
||||
function measuring_units_string($unit,$measuring_style='')
|
||||
{
|
||||
/* Note Rodo aux dev :)
|
||||
@@ -2432,7 +2358,7 @@ function measuring_units_string($unit,$measuring_style='')
|
||||
\param url Url
|
||||
\param http 1: keep http, 0: remove also http
|
||||
\return string CleanUrl
|
||||
*/
|
||||
*/
|
||||
function clean_url($url,$http=1)
|
||||
{
|
||||
if (eregi('^(https?:[\\\/]+)?([0-9A-Z\-\.]+\.[A-Z]{2,4})(:[0-9]+)?',$url,$regs))
|
||||
@@ -2460,12 +2386,14 @@ function clean_url($url,$http=1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Clean a string from all html tags
|
||||
\param StringHtml String to clean
|
||||
\param removelinefeed Replace also all lines feeds by a space
|
||||
\return string String cleaned
|
||||
*/
|
||||
*/
|
||||
function clean_html($StringHtml,$removelinefeed=1)
|
||||
{
|
||||
$pattern = "<[^>]+>";
|
||||
@@ -2490,7 +2418,7 @@ function clean_html($StringHtml,$removelinefeed=1)
|
||||
\param pad Add 0
|
||||
\param upper Convert to tupper
|
||||
\return string x
|
||||
*/
|
||||
*/
|
||||
function binhex($bin, $pad=false, $upper=false){
|
||||
$last = strlen($bin)-1;
|
||||
for($i=0; $i<=$last; $i++){ $x += $bin[$last-$i] * pow(2,$i); }
|
||||
@@ -2504,7 +2432,7 @@ function binhex($bin, $pad=false, $upper=false){
|
||||
\brief Convertir de l'h<>xad<61>cimal en binaire
|
||||
\param string hexa
|
||||
\return string bin
|
||||
*/
|
||||
*/
|
||||
function hexbin($hexa){
|
||||
$bin='';
|
||||
for($i=0;$i<strlen($hexa);$i++)
|
||||
@@ -2516,11 +2444,11 @@ function hexbin($hexa){
|
||||
|
||||
|
||||
/**
|
||||
* \brief Replace CRLF in string with a HTML BR tag.
|
||||
* \param string2encode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||
* \return string String encoded
|
||||
*/
|
||||
* \brief Replace CRLF in string with a HTML BR tag.
|
||||
* \param string2encode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||
* \return string String encoded
|
||||
*/
|
||||
function dol_nl2br($stringtoencode,$nl2brmode=0)
|
||||
{
|
||||
if (! $nl2brmode) return nl2br($stringtoencode);
|
||||
@@ -2533,15 +2461,15 @@ function dol_nl2br($stringtoencode,$nl2brmode=0)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function is called to encode a string into a HTML string
|
||||
* \param stringtoencode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
|
||||
* \remarks For PDF usage, you can show text by 2 ways:
|
||||
* - writeHTMLCell -> param must be encoded into HTML.
|
||||
* - MultiCell -> param must not be encoded into HTML.
|
||||
* Because writeHTMLCell convert also \n into <br>, if function
|
||||
* is used to build PDF, nl2brmode must be 1.
|
||||
*/
|
||||
* \brief This function is called to encode a string into a HTML string
|
||||
* \param stringtoencode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
|
||||
* \remarks For PDF usage, you can show text by 2 ways:
|
||||
* - writeHTMLCell -> param must be encoded into HTML.
|
||||
* - MultiCell -> param must not be encoded into HTML.
|
||||
* Because writeHTMLCell convert also \n into <br>, if function
|
||||
* is used to build PDF, nl2brmode must be 1.
|
||||
*/
|
||||
function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0)
|
||||
{
|
||||
if (dol_textishtml($stringtoencode)) return $stringtoencode;
|
||||
@@ -2554,9 +2482,9 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0)
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief This function is called to decode a HTML string
|
||||
* \param stringtodecode String to decode
|
||||
*/
|
||||
* \brief This function is called to decode a HTML string
|
||||
* \param stringtodecode String to decode
|
||||
*/
|
||||
function dol_htmlentitiesbr_decode($stringtodecode)
|
||||
{
|
||||
$ret=html_entity_decode($stringtodecode);
|
||||
@@ -2571,7 +2499,7 @@ function dol_htmlentitiesbr_decode($stringtodecode)
|
||||
\brief Decode le code html
|
||||
\param string StringHtml
|
||||
\return string DecodeString
|
||||
*/
|
||||
*/
|
||||
function dol_entity_decode($StringHtml)
|
||||
{
|
||||
$DecodeString = html_entity_decode($StringHtml);
|
||||
@@ -2584,7 +2512,7 @@ function dol_entity_decode($StringHtml)
|
||||
\remarks Example, if string contains euro symbol that has ascii code 128.
|
||||
\param s String to check
|
||||
\return int 0 if bad iso, 1 if good iso
|
||||
*/
|
||||
*/
|
||||
function dol_string_is_good_iso($s)
|
||||
{
|
||||
$len=strlen($s);
|
||||
@@ -2599,39 +2527,6 @@ function dol_string_is_good_iso($s)
|
||||
return $ok;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Encode une chaine de caract<63>re
|
||||
\param chain chaine de caract<63>res a encoder
|
||||
\return string_coded chaine de caract<63>res encod<6F>e
|
||||
*/
|
||||
function dolibarr_encode($chain)
|
||||
{
|
||||
for($i=0;$i<strlen($chain);$i++)
|
||||
{
|
||||
$output_tab[$i] = chr(ord(substr($chain,$i,1))+17);
|
||||
}
|
||||
|
||||
$string_coded = base64_encode(implode ("",$output_tab));
|
||||
return $string_coded;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Decode une chaine de caract<63>re
|
||||
\param chain chaine de caract<63>res a decoder
|
||||
\return string_coded chaine de caract<63>res decod<6F>e
|
||||
*/
|
||||
function dolibarr_decode($chain)
|
||||
{
|
||||
$chain = base64_decode($chain);
|
||||
|
||||
for($i=0;$i<strlen($chain);$i++)
|
||||
{
|
||||
$output_tab[$i] = chr(ord(substr($chain,$i,1))-17);
|
||||
}
|
||||
|
||||
$string_decoded = implode ("",$output_tab);
|
||||
return $string_decoded;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction retournant le nombre de jour fieries samedis et dimanches entre 2 dates entrees en timestamp
|
||||
@@ -2639,7 +2534,7 @@ function dolibarr_decode($chain)
|
||||
\param timestampStart Timestamp de debut
|
||||
\param timestampEnd Timestamp de fin
|
||||
\return nbFerie Nombre de jours feries
|
||||
*/
|
||||
*/
|
||||
function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
|
||||
{
|
||||
$nbFerie = 0;
|
||||
@@ -2737,7 +2632,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
|
||||
\param timestampEnd Timestamp de fin
|
||||
\param lastday On prend en compte le dernier jour, 0: non, 1:oui
|
||||
\return nbjours Nombre de jours
|
||||
*/
|
||||
*/
|
||||
function num_between_day($timestampStart, $timestampEnd, $lastday=0)
|
||||
{
|
||||
if ($timestampStart < $timestampEnd)
|
||||
@@ -2762,7 +2657,7 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
|
||||
\param inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max)
|
||||
\param lastday On prend en compte le dernier jour, 0: non, 1:oui
|
||||
\return nbjours Nombre de jours ou d'heures
|
||||
*/
|
||||
*/
|
||||
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
|
||||
{
|
||||
global $langs;
|
||||
@@ -2786,7 +2681,7 @@ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
|
||||
\brief Fonction retournant le nombre de lignes dans un texte format<61>
|
||||
\param texte Texte
|
||||
\return nblines Nombre de lignes
|
||||
*/
|
||||
*/
|
||||
function num_lines($texte)
|
||||
{
|
||||
$repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
||||
@@ -2798,9 +2693,9 @@ function num_lines($texte)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction simple identique a microtime de PHP 5 mais compatible PHP 4
|
||||
* \return float Time en millisecondes avec decimal pour microsecondes
|
||||
*/
|
||||
* \brief Fonction simple identique a microtime de PHP 5 mais compatible PHP 4
|
||||
* \return float Time en millisecondes avec decimal pour microsecondes
|
||||
*/
|
||||
function dol_microtime_float()
|
||||
{
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
@@ -2900,7 +2795,7 @@ function make_alpha_from_numbers($number)
|
||||
\brief Retourne un tableau des mois ou le mois s<>lectionn<6E>
|
||||
\param selected Mois <20> s<>lectionner ou -1
|
||||
\return string or array Month string or array if selected < 0
|
||||
*/
|
||||
*/
|
||||
function monthArrayOrSelected($selected=0)
|
||||
{
|
||||
global $langs;
|
||||
@@ -2942,7 +2837,7 @@ function monthArrayOrSelected($selected=0)
|
||||
\brief Returns formated reduction
|
||||
\param reduction Reduction percentage
|
||||
\return string Formated reduction
|
||||
*/
|
||||
*/
|
||||
function dolibarr_print_reduction($reduction=0)
|
||||
{
|
||||
global $langs;
|
||||
@@ -2967,7 +2862,7 @@ function dolibarr_print_reduction($reduction=0)
|
||||
\brief Returns formated reduction
|
||||
\param reduction Reduction percentage
|
||||
\return int Return number of error messages shown
|
||||
*/
|
||||
*/
|
||||
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
|
||||
{
|
||||
global $langs;
|
||||
@@ -3009,11 +2904,11 @@ function stopwithmem()
|
||||
|
||||
|
||||
/**
|
||||
* \brief Advanced sort array by second index function, which produces
|
||||
* ascending (default) or descending output and uses optionally
|
||||
* natural case insensitive sorting (which can be optionally case
|
||||
* sensitive as well).
|
||||
*/
|
||||
* \brief Advanced sort array by second index function, which produces
|
||||
* ascending (default) or descending output and uses optionally
|
||||
* natural case insensitive sorting (which can be optionally case
|
||||
* sensitive as well).
|
||||
*/
|
||||
function dol_sort_array($array, $index, $order='asc', $natsort, $case_sensitive)
|
||||
{
|
||||
// Clean parameters
|
||||
|
||||
@@ -53,8 +53,8 @@ function makesalt($type=CRYPT_SALT_LENGTH)
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Encode\decode le mot de passe de la base de donn<6E>es dans le fichier de conf
|
||||
\param level niveau d'encodage : 0 non encod<EFBFBD>, 1 encod<EFBFBD>
|
||||
\brief Encode\decode database password in config file
|
||||
\param level Encode level : 0 no enconding, 1 encoding
|
||||
*/
|
||||
function encodedecode_dbpassconf($level=0)
|
||||
{
|
||||
@@ -70,14 +70,14 @@ function encodedecode_dbpassconf($level=0)
|
||||
{
|
||||
$passwd = strstr($buffer,"$dolibarr_main_db_encrypted_pass=");
|
||||
$passwd = substr(substr($passwd,2),0,-3);
|
||||
$passwd = dolibarr_decode($passwd);
|
||||
$passwd = dol_decode($passwd);
|
||||
$config .= "\$dolibarr_main_db_pass=\"$passwd\";\n";
|
||||
}
|
||||
else if (strstr($buffer,"\$dolibarr_main_db_pass") && $level == 1)
|
||||
{
|
||||
$passwd = strstr($buffer,"$dolibarr_main_db_pass=");
|
||||
$passwd = substr(substr($passwd,2),0,-3);
|
||||
$passwd = dolibarr_encode($passwd);
|
||||
$passwd = dol_encode($passwd);
|
||||
$config .= "\$dolibarr_main_db_encrypted_pass=\"$passwd\";\n";
|
||||
}
|
||||
else
|
||||
@@ -104,5 +104,38 @@ function encodedecode_dbpassconf($level=0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Encode une chaine de caract<63>re
|
||||
\param chain chaine de caract<63>res a encoder
|
||||
\return string_coded chaine de caract<63>res encod<6F>e
|
||||
*/
|
||||
function dol_encode($chain)
|
||||
{
|
||||
for($i=0;$i<strlen($chain);$i++)
|
||||
{
|
||||
$output_tab[$i] = chr(ord(substr($chain,$i,1))+17);
|
||||
}
|
||||
|
||||
$string_coded = base64_encode(implode ("",$output_tab));
|
||||
return $string_coded;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Decode une chaine de caract<63>re
|
||||
\param chain chaine de caract<63>res a decoder
|
||||
\return string_coded chaine de caract<63>res decod<6F>e
|
||||
*/
|
||||
function dol_decode($chain)
|
||||
{
|
||||
$chain = base64_decode($chain);
|
||||
|
||||
for($i=0;$i<strlen($chain);$i++)
|
||||
{
|
||||
$output_tab[$i] = chr(ord(substr($chain,$i,1))-17);
|
||||
}
|
||||
|
||||
$string_decoded = implode ("",$output_tab);
|
||||
return $string_decoded;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -110,7 +110,11 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
|
||||
|
||||
// on d<>code le mot de passe de la base si besoin
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"); // Need 970ko memory (1.1 in 2.2)
|
||||
if (! empty($dolibarr_main_db_encrypted_pass)) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||
if (! empty($dolibarr_main_db_encrypted_pass))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php");
|
||||
$dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
|
||||
}
|
||||
//print memory_get_usage();
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/conf/conf.class.php");
|
||||
|
||||
Reference in New Issue
Block a user