Fix can use a non template ODT file as template to read it - reported by

tremor hunter
This commit is contained in:
Laurent Destailleur 2026-08-12 22:55:31 +02:00
parent 736b11913d
commit 0620be0601
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b> or <b>.ods</b>.
NumberOfModelFilesFound=Number of ODT/ODS template files found
ExampleOfDirectoriesForModelGen=Examples of syntax:<br>c:\\myapp\\mydocumentdir\\mysubdir<br>/home/myapp/mydocumentdir/mysubdir<br>DOL_DATA_ROOT/ecm/ecmdir
ExampleOfDirectoriesForModelGen=Examples of syntax:<br>DOL_DATA_ROOT/doctemplates/mysubdir<br>DOL_DATA_ROOT/ecm/ecmdir
FollowingSubstitutionKeysCanBeUsed=<br>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