diff --git a/dev/SQL/index.php b/dev/SQL/index.php index e3c24d2b9..ded83e800 100644 --- a/dev/SQL/index.php +++ b/dev/SQL/index.php @@ -11,11 +11,13 @@ const ACCOUNT_DB=2; require NOALYSS_INCLUDE."/lib/class_database.php"; require NOALYSS_INCLUDE."/lib/class_iselect.php"; +require NOALYSS_INCLUDE."/lib/class_http_input.php"; require './table_sql.class.php'; // Show a db connection -$gDossier=HtmlInput::default_value_request('gDossier',-1); + +$gDossier=$http->request('gDossier',"string",-1); $select = new ISelect('gDossier'); $select->row=20; $acc=new Database(); @@ -57,7 +59,7 @@ $table_sql = "select schemaname ||','||tablename,tablename||','||schemaname from $select_table = new ISelect('table'); $select_table->row=20; $select_table->value=$cn->make_array($table_sql); -$select_table->selected = HtmlInput::default_value_request("table", ""); +$select_table->selected = $http->request("table","string", ""); ?>
Choisissez une table @@ -70,7 +72,7 @@ $select_table->selected = HtmlInput::default_value_request("table", ""); /////////////////////////////////////////////////////////////////////////////// // if a table is select , generate file ////////////////////////////////////////////////////////////////////////////// -$table=HtmlInput::default_value_request("table", ""); +$table=$http->request("table","string", ""); if ( $table != "") { $table_sql=new Table_SQL($cn,$table); $table_sql->create_class(); diff --git a/include/class/class_fiche_def.php b/include/class/class_fiche_def.php index 21dd502f8..417b083d5 100644 --- a/include/class/class_fiche_def.php +++ b/include/class/class_fiche_def.php @@ -200,11 +200,12 @@ $order /** * Check needed info */ - $p_nom_mod = HtmlInput::default_value('nom_mod', "", $array); - $p_fd_description = HtmlInput::default_value('fd_description', "", $array); - $p_class_base= HtmlInput::default_value('class_base', "", $array); - $p_fiche_def= HtmlInput::default_value('FICHE_REF', "", $array); - $p_create= HtmlInput::default_value('create', "off", $array); + $http=new HttpInput(); + $p_nom_mod = $http->extract($array,'nom_mod',"string",""); + $p_fd_description = $http->extract($array,'fd_description',"string", ""); + $p_class_base=$http->extract($array,'class_base',"string", ""); + $p_fiche_def= $http->extract($array,'FICHE_REF',"string", ""); + $p_create= $http->extract($array,'create',"string", "off"); // If there is no description then add a empty one if ( ! isset ($p_fd_description)) { diff --git a/include/class/class_pre_op_advanced.php b/include/class/class_pre_op_advanced.php index 97b0bf292..17c25eca8 100644 --- a/include/class/class_pre_op_advanced.php +++ b/include/class/class_pre_op_advanced.php @@ -38,12 +38,12 @@ class Pre_Op_Advanced extends Pre_operation_detail function get_post() { parent::get_post(); - + $http=new HttpInput(); for ($i=0;$i<$this->operation->nb_item;$i++) { - $poste=HtmlInput::default_value_post("poste".$i, null); - $qcode=HtmlInput::default_value_post("qc_".$i, null); + $poste=$http->post("poste".$i,"string", null); + $qcode=$http->post("qc_".$i,"string", null); if ( $poste == null && $qcode == null ) continue; diff --git a/include/lib/class_http_input.php b/include/lib/class_http_input.php index 14fe7936d..4d5c228d3 100644 --- a/include/lib/class_http_input.php +++ b/include/lib/class_http_input.php @@ -51,6 +51,10 @@ class HttpInput } } + if( $p_type=="array" && !is_array($this->array[$p_name]) ) { + throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}" + ,EXC_PARAM_TYPE); + } } catch (Exception $ex) { diff --git a/include/lib/class_manage_table_sql.php b/include/lib/class_manage_table_sql.php index 1964e158c..f670f4129 100644 --- a/include/lib/class_manage_table_sql.php +++ b/include/lib/class_manage_table_sql.php @@ -36,9 +36,10 @@ $objet->set_callback("ajax.php"); // Build the json object for JS - $plugin_code=HtmlInput::default_value_request("plugin_code",""); - $ac=HtmlInput::default_value_request("ac",""); - $sa=HtmlInput::default_value_request("sa",""); + $http=new HttpInput(); + $plugin_code=$http->request("plugin_code"); + $ac=$http->request("ac"); + $sa=$http->request("sa"); $aJson=array("gDossier"=>Dossier::id(), "ac"=>$ac, "plugin_code"=>$plugin_code, diff --git a/include/lib/class_sendmail.php b/include/lib/class_sendmail.php index ad2d5168a..d6bce768e 100644 --- a/include/lib/class_sendmail.php +++ b/include/lib/class_sendmail.php @@ -163,7 +163,8 @@ class Sendmail // Increment email amount $repo =new Database(); $date=date('Ymd'); - $dossier=HtmlInput::default_value_request("gDossier", -1); + $http=new HttpInput(); + $dossier=$http->request("gDossier","string", -1); $this->increment_mail($repo,$dossier,$date); } /** @@ -175,7 +176,8 @@ class Sendmail * if send from a dossier , then check limit of this dossier * otherwise send true */ - $dossier=HtmlInput::default_value_request("gDossier", -1); + $http=new HttpInput(); + $dossier=$http->request("gDossier","string", -1); if ($dossier == -1 ) return true; /** diff --git a/include/payment_middle.inc.php b/include/payment_middle.inc.php index 477c8f37c..8ad81b7f5 100644 --- a/include/payment_middle.inc.php +++ b/include/payment_middle.inc.php @@ -63,7 +63,8 @@ if ( $sb=='change') // if ( $sb=='save') { - $delete=HtmlInput::default_value_post("delete_ck", 0); + $http=new HttpInput(); + $delete=$http->post("delete_ck","string", 0); if ( $delete == 0 ) { $row=new Acc_Payment($cn,$_POST ['id']); diff --git a/include/preod.inc.php b/include/preod.inc.php index 37974e353..b72701a5b 100644 --- a/include/preod.inc.php +++ b/include/preod.inc.php @@ -60,7 +60,8 @@ echo '
'; if ( $request_sa == 'del') { $op=new Pre_operation($cn); - $op->od_id=HtmlInput::default_value_request('od_id',-1); + $http=new HttpInput(); + $op->od_id=$http->request('od_id',"string",-1); if (isNumber($op->od_id)==1 && $op->od_id != -1 ) { $op->delete(); diff --git a/include/recover.php b/include/recover.php index e3e413cbc..d197edb91 100644 --- a/include/recover.php +++ b/include/recover.php @@ -136,7 +136,8 @@ EOF; L\'email a été envoyé avec un lien et le nouveau mot de passe, vérifiez vos spams

'; endif; elseif ($action=="req") : - $request_id=HtmlInput::default_value_request("req", ""); + $http=new HttpInput(); + $request_id=$http->request("req","string", ""); if (strlen(trim($request_id))==SIZE_REQUEST) : require_once NOALYSS_INCLUDE.'/lib/class_database.php'; $cn=new Database(0); diff --git a/include/template/anc_key_input.php b/include/template/anc_key_input.php index a4916dbf4..b1f71cb08 100644 --- a/include/template/anc_key_input.php +++ b/include/template/anc_key_input.php @@ -27,8 +27,9 @@ echo HtmlInput::request_to_hidden(array('gDossier', 'ac')); echo HtmlInput::hidden('op','consult'); echo HtmlInput::hidden('key', $this->key->getp('id')); - $name=HtmlInput::default_value_post("name_key",$this->key->getp('name')); - $description_text=HtmlInput::default_value_post("description_key",$this->key->getp('description')); + $http=new HttpInput(); + $name=$http->post("name_key","string",$this->key->getp('name')); + $description_text=$http->post("description_key","string",$this->key->getp('description')); ?>
@@ -107,9 +108,9 @@ } if (isset($_POST['po_id'])) { - $a_po_id=HtmlInput::default_value_post('po_id', array()); + $a_po_id=$http->post('po_id', "array",array()); $selected=$a_po_id[$j][$i]; - $a_percent=HtmlInput::default_value_post('percent', array()); + $a_percent=$http->post('percent',"array", array()); $percent=$a_percent[$j]; } $select->selected=$selected; @@ -170,7 +171,7 @@ where kd_id=$1 or kd_id is null order by jrn_def_name ', array($this->key->getp('id'))); } - $post_jrn=HtmlInput::default_value_post("jrn",-1); + $post_jrn=$http->post("jrn","string",-1); ?> diff --git a/include/template/calendar-list.php b/include/template/calendar-list.php index 965853e02..cf2e656b3 100644 --- a/include/template/calendar-list.php +++ b/include/template/calendar-list.php @@ -27,7 +27,8 @@ ?>
get('from',"string", 0); $js=sprintf("calendar_zoom({gDossier:%d,invalue:'%s',outvalue:'%s',distype:'%s','notitle':%d})", dossier::id(),'per_div','calendar_zoom_div','cal',$notitle); echo HtmlInput::anchor(_('Calendrier'),''," onclick=\"{$js}\"") ; diff --git a/include/template/module.php b/include/template/module.php index 775467196..6a71d1859 100644 --- a/include/template/module.php +++ b/include/template/module.php @@ -9,7 +9,7 @@
get_value("select count(*) from profile join profile_user using (p_id) where user_name=$1 and with_calc=true",array($_SESSION['g_user'])) ==1): echo '
'; @@ -22,7 +22,7 @@ if ( $cn->get_value("select count(*) from profile join profile_user using (p_id) ?>
- + request('ac',"string", '')?>
post("dep","string", 0); foreach ($ap_module as $row): $js=""; $style="";