forked from Wavyzz/dolibarr
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)
|
||||
{
|
||||
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,17 +17,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\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
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -2180,97 +2194,7 @@ 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
|
||||
@@ -2351,6 +2275,8 @@ function numero_semaine($time)
|
||||
|
||||
return sprintf("%02d",$numeroSemaine);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Retourne le picto champ obligatoire
|
||||
\return string Chaine avec picto obligatoire
|
||||
@@ -2460,6 +2386,8 @@ function clean_url($url,$http=1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Clean a string from all html tags
|
||||
\param StringHtml String to clean
|
||||
@@ -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
|
||||
|
||||
@@ -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