noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 01/01: 0001438: Remplacement de HtmlInput par


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 01/01: 0001438: Remplacement de HtmlInput par HttpInput
Date: Mon, 12 Jun 2017 15:11:32 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit a5f02370cc1259abb6b4c6c7139e5d47ecd84787
Author: Dany De Bontridder <address@hidden>
Date:   Mon Jun 12 21:11:05 2017 +0200

    0001438: Remplacement de HtmlInput par HttpInput
---
 dev/SQL/index.php                                |  8 +++++---
 include/class/class_fiche_def.php                | 11 ++++++-----
 include/class/class_pre_op_advanced.php          |  6 +++---
 include/lib/class_http_input.php                 |  4 ++++
 include/lib/class_manage_table_sql.php           |  7 ++++---
 include/lib/class_sendmail.php                   |  6 ++++--
 include/payment_middle.inc.php                   |  3 ++-
 include/preod.inc.php                            |  3 ++-
 include/recover.php                              |  3 ++-
 include/template/anc_key_input.php               | 11 ++++++-----
 include/template/calendar-list.php               |  3 ++-
 include/template/module.php                      |  4 ++--
 include/template/profile_menu_display_module.php |  3 ++-
 13 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/dev/SQL/index.php b/dev/SQL/index.php
index e3c24d2..ded83e8 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", "");
 ?>
   <form method="get">
     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 21dd502..417b083 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 97b0bf2..17c25ec 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 14fe793..4d5c228 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 1964e15..f670f41 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 ad2d516..d6bce76 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 477c8f3..8ad81b7 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 37974e3..b72701a 100644
--- a/include/preod.inc.php
+++ b/include/preod.inc.php
@@ -60,7 +60,8 @@ echo '</form>';
 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 e3e413c..d197edb 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</p>';
     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 a4916db..b1f71cb 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'));
     ?>
     <div class="content">
         <div style="width:30%;display:inline-block;min-height: 75px">
@@ -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);
                 ?>
                 <table id="jrn_def_tb" class="result">
                     <?php for ($i=0; $i<count($jrn); $i++): ?>
diff --git a/include/template/calendar-list.php 
b/include/template/calendar-list.php
index 965853e..cf2e656 100644
--- a/include/template/calendar-list.php
+++ b/include/template/calendar-list.php
@@ -27,7 +27,8 @@
 ?>
 <div class="content" id="user_cal" style="width:100%">
 <?php 
-    $short=HtmlInput::default_value_get('from', 0);
+    $http=new HttpInput();
+    $short=$http->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 7754671..6a71d18 100644
--- a/include/template/module.php
+++ b/include/template/module.php
@@ -9,7 +9,7 @@
     <div class="name">
 
 <?php
-
+$http=new HtmlInput();
 if ( $cn->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 '<div id="calc">';
@@ -22,7 +22,7 @@ if ( $cn->get_value("select count(*) from profile join 
profile_user using (p_id)
 ?>
        <div id="direct">
        <form method="get">
-               <?php echo HtmlInput::default_value('ac', '', $_REQUEST)?>
+               <?php echo $http->request('ac',"string", '')?>
                <?php echo Dossier::hidden()?>
                <?php 
 
diff --git a/include/template/profile_menu_display_module.php 
b/include/template/profile_menu_display_module.php
index 099bbf8..8b44675 100644
--- a/include/template/profile_menu_display_module.php
+++ b/include/template/profile_menu_display_module.php
@@ -23,12 +23,13 @@
  * @brief display the module, used to setup the module and menu, included from
  * Profile_Menu
  */
+$http=new HttpInput();
 ?>
  <div id="module_setting" class="content">
        <table class="result">
            <tr>
                <?php
-                $dep=HtmlInput::default_value_post("dep", 0);
+                $dep=$http->post("dep","string", 0);
                foreach ($ap_module as $row):
                        $js="";
                    $style="";



reply via email to

[Prev in Thread] Current Thread [Next in Thread]