diff --git a/html/access.php b/html/access.php index 6bc73d3b7..a24713b49 100644 --- a/html/access.php +++ b/html/access.php @@ -40,10 +40,10 @@ if ($user->AccessJrn($cn,dossier::id()) == false ){ } if ( DBVERSION!=dossier::get_version($cn)) { - echo "Votre base de données n'est pas à jour, "; + echo '
Nombre de lignes affichées est limité
'; // if request search if ( isset($_GET['search']) || isset($_GET['filter']) ) { - $Res=ExecSql($cn,"select pcm_val,pcm_lib from tmp_pcmn $condition order by pcm_val::text ". + $Res=ExecSql($cn,"select pcm_val,html_quote(pcm_lib) from tmp_pcmn $condition order by pcm_val::text ". " limit 70"); $MaxLine=pg_NumRows($Res); diff --git a/include/ac_common.php b/include/ac_common.php index f591a6ca9..eb4900f37 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -27,6 +27,11 @@ include_once("debug.php"); include_once("constant.php"); require_once('preference.php'); require_once ("postgres.php"); +/*!\brief to protect again bad characters which can lead to a cross scripting attack + the string to be diplayed must be protected +*/ +function h($p_string) { return htmlspecialchars($p_string);} + /*! * \brief log error into the /tmp/phpcompta_error.log it doesn't work on windows * diff --git a/include/anc_group.inc.php b/include/anc_group.inc.php index 6b6d49b72..f6b740d7e 100644 --- a/include/anc_group.inc.php +++ b/include/anc_group.inc.php @@ -57,9 +57,9 @@ echo '| Code | Plan | Description | ||||
|---|---|---|---|---|---|---|
| '.$m->ga_id.' | '; - echo ''.$m->pa_name.' | '; - echo ''.$m->ga_description.' | '; + echo ''.h($m->ga_id).' | '; + echo ''.h($m->pa_name).' | '; + echo ''.h($m->ga_description).' | '; echo 'Effacer '.' | '; echo '". ''. - $obj->name. + h($obj->name). ''; " | "; $ret.="".$obj->amount." | "; - $ret.="".$obj->description." | "; + $ret.="".h($obj->description)." | "; $ret.="".$obj->ga_id." | "; - $ret.="".$new->name." | "; + $ret.="".h($new->name)." | "; $ret.=""; } @@ -275,7 +275,7 @@ if ( empty($list) ) echo '
| '. ''. - $line['name']. + h($line['name']). ' | '; echo ''. ''. diff --git a/include/bud_card.inc.php b/include/bud_card.inc.php index 113b3ca42..5ecb470da 100644 --- a/include/bud_card.inc.php +++ b/include/bud_card.inc.php @@ -29,7 +29,7 @@ require_once ('class_widget.php'); echo ' |
| montant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| montant | $e".$client->strAttribut(ATTR_DEF_QUICKCODE)." | "; - $r.="".$client->strAttribut(ATTR_DEF_NAME)." | "; - $r.="".$client->strAttribut(ATTR_DEF_ADRESS). + $r.=" | ".h($client->strAttribut(ATTR_DEF_NAME))." | "; + $r.="".h($client->strAttribut(ATTR_DEF_ADRESS). " ".$client->strAttribut(ATTR_DEF_CP). - " ".$client->strAttribut(ATTR_DEF_PAYS). + " ".$client->strAttribut(ATTR_DEF_PAYS)). " | "; diff --git a/include/class_document_modele.php b/include/class_document_modele.php index 3aca40d2d..ed914ea01 100644 --- a/include/class_document_modele.php +++ b/include/class_document_modele.php @@ -60,7 +60,7 @@ class Document_modele { foreach ( $all as $row) { $r.="|||||||||||||||||||||||||||||||||||||||||||||||||||||
| "; - $r.=$row['md_name']; + $r.=h($row['md_name']); $r.=" | "; $r.=""; $r.=$row['dt_value']; diff --git a/include/class_fiche.php b/include/class_fiche.php index 4af19d82a..f7892e652 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -927,7 +927,7 @@ class fiche { echo " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ".$op['jr_internal']." | ". "".$op['j_date']." | ". - "".$op['description']." | ". + "".h($op['description'])." | ". ""." | ". ""." | ". "|||||||||||||||||||||||||||||||||||||||||||||||||||||
| ".$op['jr_internal']." | ". "".$op['j_date']." | ". - "".$op['description']." | ". + "".h($op['description'])." | ". "".$op['deb_montant']." | ". "".$op['cred_montant']." | ". "$e".$supplier->strAttribut(ATTR_DEF_QUICKCODE)." | "; - $r.="".$supplier->strAttribut(ATTR_DEF_NAME)." | "; - $r.="".$supplier->strAttribut(ATTR_DEF_ADRESS). + $r.=" | ".h($supplier->strAttribut(ATTR_DEF_NAME))." | "; + $r.="".h($supplier->strAttribut(ATTR_DEF_ADRESS). " ".$supplier->strAttribut(ATTR_DEF_CP). - " ".$supplier->strAttribut(ATTR_DEF_PAYS). + " ".$supplier->strAttribut(ATTR_DEF_PAYS)). " | "; diff --git a/include/constant.php b/include/constant.php index 077b0a9e6..2b5d9901c 100644 --- a/include/constant.php +++ b/include/constant.php @@ -25,7 +25,7 @@ */ require_once ('config.inc.php'); -define ("DBVERSION",53); +define ("DBVERSION",54); define ("MAX_COMPTE",4); define ('MAX_BUD_DETAIL',20); diff --git a/include/dossier.inc.php b/include/dossier.inc.php index d7b4e8822..1bcd7a763 100644 --- a/include/dossier.inc.php +++ b/include/dossier.inc.php @@ -170,8 +170,8 @@ if ( $sa == 'list' ) { $cl='class="even"'; echo "||||||||||||||||||||||||||||||||||||||||||||||||
| ". - $Dossier['dos_id']." ".$Dossier['dos_name']." | ". - "".$Dossier['dos_description']." + $Dossier['dos_id']." ".h($Dossier['dos_name'])." | ". + "".h($Dossier['dos_description'])." | ";
echo widget::button_href('Effacer','?action=dossier_mgt&sa=del&d='.$Dossier['dos_id']);
@@ -211,7 +211,7 @@ if ( $sa == 'list' ) {
$template='";
}// if count = 0
@@ -311,7 +311,7 @@ if ( $sa == 'remove' ) {
$sql="delete from ac_dossier where dos_id=$1";
ExecSqlParam($cn,$sql,array($_REQUEST['d']));
print ''; - print "Voilà le dossier $name est effacé"; + print "Voilà le dossier ".h($name)." est effacé"; echo widget::button_href('Retour','?action=dossier_mgt'); } ?> diff --git a/include/impress_fiche.inc.php b/include/impress_fiche.inc.php index 12f43ee38..752012944 100644 --- a/include/impress_fiche.inc.php +++ b/include/impress_fiche.inc.php @@ -110,7 +110,7 @@ if ( isset ($_REQUEST['fd_id'])) { foreach ($e as $detail) { echo " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ".$dattribut->av_text." | "; + echo "".h($dattribut->av_text)." | "; // if amount requested //--- if ( $dattribut->ad_id == ATTR_DEF_ACCOUNT && diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php index 0ef84e431..35ac183a1 100644 --- a/include/impress_jrn.inc.php +++ b/include/impress_jrn.inc.php @@ -56,7 +56,7 @@ require_once("class_acc_ledger.php"); $submit=new widget(); $hid=new widget("hidden"); echo '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ".$line['num']." | ";
echo "".$line['date']." | ";
- echo "".$line['comment']." | ";
+ echo "".h($line['comment'])." | ";
echo "".$line['jr_internal']." | ";
// echo "".$line['pj']." | ";
// If the ledger is financial :
diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php
index 903cc7bfa..bb88ea945 100644
--- a/include/impress_poste.inc.php
+++ b/include/impress_poste.inc.php
@@ -145,12 +145,12 @@ if ( isset( $_REQUEST['bt_html'] ) ) {
if ( empty($Poste->row)) exit();
$Poste->load();
echo '
| ||||||||||||||||||||||||||||||||||||||||||||||||||