Fix: Add protection against bad parameter of labels in member module
This commit is contained in:
parent
6a806ecf35
commit
f3d463e672
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
*
|
*
|
||||||
@ -282,10 +282,10 @@ function form_constantes($tableau)
|
|||||||
// List of possible labels. Values must exists in
|
// List of possible labels. Values must exists in
|
||||||
// file htdocs/adherents/PDF_Card.class.php
|
// file htdocs/adherents/PDF_Card.class.php
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
|
||||||
$pdfcard=new PDF_card('5160',1,1,'mm');
|
$pdfcardstatic=new PDF_card('5160',1,1,'mm');
|
||||||
$arrayoflabels=array_keys($pdfcard->_Avery_Labels);
|
$arrayoflabels=array_keys($pdfcardstatic->_Avery_Labels);
|
||||||
|
|
||||||
$form->select_array('constvalue',$arrayoflabels,$obj->value);
|
$form->select_array('constvalue',$arrayoflabels,$obj->value,1,0,1);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2409,7 +2409,7 @@ class Form
|
|||||||
* \param id Preselected key
|
* \param id Preselected key
|
||||||
* \param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon
|
* \param show_empty 1 si il faut ajouter une valeur vide dans la liste, 0 sinon
|
||||||
* \param key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
* \param key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||||
* \param value_as_key 1 pour utiliser la valeur comme clé
|
* \param value_as_key 1 to use value as key
|
||||||
* \param optionType Type de l'option: 1 pour des fonctions javascript
|
* \param optionType Type de l'option: 1 pour des fonctions javascript
|
||||||
* \param option Valeur de l'option en fonction du type choisi
|
* \param option Valeur de l'option en fonction du type choisi
|
||||||
* \param translate Traduire la valeur
|
* \param translate Traduire la valeur
|
||||||
|
|||||||
@ -179,18 +179,6 @@ class PDF_card extends FPDF {
|
|||||||
'width'=>99.1,
|
'width'=>99.1,
|
||||||
'height'=>38.1,
|
'height'=>38.1,
|
||||||
'font-size'=>10),
|
'font-size'=>10),
|
||||||
'FREELUG'=>array('name'=>'FREELUG',
|
|
||||||
'paper-size'=>'A4',
|
|
||||||
'metric'=>'mm',
|
|
||||||
'marginLeft'=>0,
|
|
||||||
'marginTop'=>0,
|
|
||||||
'NX'=>2,
|
|
||||||
'NY'=>8,
|
|
||||||
'SpaceX'=>0,
|
|
||||||
'SpaceY'=>0,
|
|
||||||
'width'=>105,
|
|
||||||
'height'=>38,
|
|
||||||
'font-size'=>10),
|
|
||||||
'CARD'=>array('name'=>'CARD',
|
'CARD'=>array('name'=>'CARD',
|
||||||
'paper-size'=>'A4',
|
'paper-size'=>'A4',
|
||||||
'metric'=>'mm',
|
'metric'=>'mm',
|
||||||
@ -225,9 +213,13 @@ class PDF_card extends FPDF {
|
|||||||
// Si c'est un format personnel alors on maj les valeurs
|
// Si c'est un format personnel alors on maj les valeurs
|
||||||
$Tformat = $format;
|
$Tformat = $format;
|
||||||
} else {
|
} else {
|
||||||
// Si c'est un format avery on stocke le nom de ce format selon la norme Avery.
|
// If it's an Avery format, we get array that describe it from key and we store it in Tformat.
|
||||||
// Permettra d'aller récupérer les valeurs dans le tableau _Avery_Labels
|
|
||||||
$Tformat = $this->_Avery_Labels[$format];
|
$Tformat = $this->_Avery_Labels[$format];
|
||||||
|
if (empty($Tformat))
|
||||||
|
{
|
||||||
|
dol_print_error('','Format value "'.$format.'" is not supported.');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::FPDF('P', $unit, $Tformat['paper-size']);
|
parent::FPDF('P', $unit, $Tformat['paper-size']);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user