diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 17c89268419..2510b168a13 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6151,7 +6151,10 @@ abstract class CommonObject $modele = $tmp[0]; $srctemplatepath = $tmp[1]; - var_dump($modelspath, $srctemplatepath);exit; + if (!preg_match('/^'.preg_quote(DOL_DATA_ROOT, '/').'\/(ecm|doctemplates)/', $srctemplatepath)) { + $this->error = 'BadDirForTemplateFile'; + return -1; + } } // Search template files diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5d6658482bb..6f55301f25e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -420,7 +420,7 @@ ExamplesWithCurrentSetup=Examples with current configuration ListOfDirectories=List of OpenDocument templates directories ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.

Put here full path of directories.
Add a carriage return between eah directory.
To add a directory of the GED module, add here DOL_DATA_ROOT/ecm/yourdirectoryname.

Files in those directories must end with .odt or .ods. NumberOfModelFilesFound=Number of ODT/ODS template files found -ExampleOfDirectoriesForModelGen=Examples of syntax:
c:\\myapp\\mydocumentdir\\mysubdir
/home/myapp/mydocumentdir/mysubdir
DOL_DATA_ROOT/ecm/ecmdir +ExampleOfDirectoriesForModelGen=Examples of syntax:
DOL_DATA_ROOT/doctemplates/mysubdir
DOL_DATA_ROOT/ecm/ecmdir FollowingSubstitutionKeysCanBeUsed=
To know how to create your odt document templates, before storing them in those directories, read wiki documentation: FullListOnOnlineDocumentation=https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template FirstnameNamePosition=Position of Name/Lastname