diff --git a/html/ajax_misc.php b/html/ajax_misc.php index fafb003cf..cd2ba9da9 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -44,6 +44,8 @@ require_once NOALYSS_INCLUDE.'/lib/class_iradio.php'; require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/class/class_user.php'; +require_once NOALYSS_INCLUDE.'/lib/class_http_input.php'; +$http=new HttpInput(); mb_internal_encoding("UTF-8"); @@ -240,9 +242,9 @@ EOF; /* others report */ $cal = new Calendar(); $cal->set_periode($per); - $notitle=HtmlInput::default_value_get("notitle", 0); + $notitle=$http->get("notitle", "string",0); $html = ""; - $html = $cal->display($_GET['t'],$notitle); + $html = $cal->display($http->get('t'),$notitle); $html = escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); echo <<save_email($p_email); } -$style_user=HtmlInput::default_value_post("style_user",$_SESSION['g_theme']); +$style_user=$http->post("style_user","string",$_SESSION['g_theme']); html_page_start($style_user); if ( DEBUG ) { diff --git a/html/install.php b/html/install.php index 073de1c91..db9a07d11 100644 --- a/html/install.php +++ b/html/install.php @@ -213,16 +213,17 @@ function create_htaccess_deprecated() } // Retrieve informations from the very screen // -$db_user=HtmlInput::default_value_request("cuser", ""); -$db_password=HtmlInput::default_value_request("cpasswd", ""); -$db_host=HtmlInput::default_value_request("chost", ""); -$db_port=HtmlInput::default_value_request("cport", ""); -$multi=HtmlInput::default_value_request("multi", "N"); -$locale=HtmlInput::default_value_request("clocale", "1"); -$ctmp=HtmlInput::default_value_request("ctmp", "/tmp"); -$cpath=HtmlInput::default_value_request("cpath", "/usr/bin"); -$db_name=HtmlInput::default_value_request("cdbname", ""); -$cadmin=HtmlInput::default_value_request("cadmin", "admin"); +$http=new HttpInput(); +$db_user=$http->request("cuser","string", ""); +$db_password=$http->request("cpasswd","string", ""); +$db_host=$http->request("chost","string", ""); +$db_port=$http->request("cport","string", ""); +$multi=$http->request("multi","string", "N"); +$locale=$http->request("clocale","string", "1"); +$ctmp=$http->request("ctmp","string", "/tmp"); +$cpath=$http->request("cpath","string", "/usr/bin"); +$db_name=$http->request("cdbname", "string",""); +$cadmin=$http->request("cadmin","string", "admin"); $cadmin=strtolower($cadmin); //------------------------------------------------------------------------- // warn only if we can not write in include diff --git a/include/ajax/ajax_pcmn_update.php b/include/ajax/ajax_pcmn_update.php index ba4faf833..fb527364c 100644 --- a/include/ajax/ajax_pcmn_update.php +++ b/include/ajax/ajax_pcmn_update.php @@ -1,4 +1,5 @@ check_module('CFGPCMN') == 0 ) +if ($g_user->check_module('CFGPCMN')==0) { - $html=h2(_('Action interdite'),' class="notice"'); - $html = escape_xml($response); + $html=h2(_('Action interdite'), ' class="notice"'); + $html=escape_xml($html); header('Content-type: text/xml; charset=UTF-8'); -echo << pcmn_update @@ -41,50 +42,50 @@ echo <<size="60"; -$type=new ISelect('p_typeu'); -$type->value=Acc_Account::$type; -if ( $pcmn_val != "") -{ - $action='update'; - /* - * Not empty, show the default value - */ - $account = new Acc_Account($cn); - $account->set_parameter('value',$pcmn_val); - $account->load(); - - $val->value=$account->get_parameter('value'); - $parent->value=$account->get_parameter('parent'); - $lib->value=$account->get_parameter('libelle'); - $type->selected=$account->get_parameter('type'); - -} + $pcmn_val=$http->get('value', "string"); -require NOALYSS_TEMPLATE.'/pcmn_update.php'; -$response = ob_get_clean(); -$html = escape_xml($response); -if ( headers_sent() ) { - echo $response; - echo $html; -} else { - header('Content-type: text/xml; charset=UTF-8'); - echo <<size="60"; + $type=new ISelect('p_typeu'); + $type->value=Acc_Account::$type; + + if ($pcmn_val!="") + { + $action='update'; + /* + * Not empty, show the default value + */ + $account=new Acc_Account($cn); + $account->set_parameter('value', $pcmn_val); + $account->load(); + + $val->value=$account->get_parameter('value'); + $parent->value=$account->get_parameter('parent'); + $lib->value=$account->get_parameter('libelle'); + $type->selected=$account->get_parameter('type'); + } + + require NOALYSS_TEMPLATE.'/pcmn_update.php'; + $response=ob_get_clean(); + $html=escape_xml($response); + if (headers_sent()) + { + echo $response; + echo $html; + } + else + { + header('Content-type: text/xml; charset=UTF-8'); + echo << @@ -92,4 +93,19 @@ if ( headers_sent() ) { ok EOF; - } \ No newline at end of file + } +} +catch (Exception $exc) +{ + $html=$exc->getMessage(); + $html=escape_xml($html); + header('Content-type: text/xml; charset=UTF-8'); + echo << + + +$html +NOTALLOWED + +EOF; +} diff --git a/include/class/class_acc_ledger.php b/include/class/class_acc_ledger.php index c14023303..6c84ee1ee 100644 --- a/include/class/class_acc_ledger.php +++ b/include/class/class_acc_ledger.php @@ -43,6 +43,8 @@ require_once NOALYSS_INCLUDE.'/class/class_lettering.php'; require_once NOALYSS_INCLUDE.'/lib/class_sort_table.php'; require_once NOALYSS_INCLUDE.'/database/class_jrn_def_sql.php'; require_once NOALYSS_INCLUDE.'/class/class_acc_payment.php'; +require_once NOALYSS_INCLUDE.'/lib/class_http_input.php'; + /** \file * @brief Class for jrn, class acc_ledger for manipulating the ledger */ @@ -3664,13 +3666,14 @@ class Acc_Ledger extends jrn_def_sql */ function input_new() { - $retry=HtmlInput::default_value_post("sa", ""); + $http=new HttpInput(); + $retry=$http->post("sa","string", ""); // if ( $retry == "add") { - $default_type=HtmlInput::default_value_post("p_jrn_type", -1); - $previous_jrn_def_pj_pref=HtmlInput::default_value_post("jrn_def_pj_pref",""); - $previous_p_description=HtmlInput::default_value_post("p_description",""); - $previous_p_jrn_name=HtmlInput::default_value_post('p_jrn_name',''); - $previous_p_jrn_type = HtmlInput::default_value_post("p_jrn_type",""); + $default_type=$http->post("p_jrn_type","string", -1); + $previous_jrn_def_pj_pref=$http->post("jrn_def_pj_pref","string",""); + $previous_p_description=$http->post("p_description","string",""); + $previous_p_jrn_name=$http->post('p_jrn_name',"string",''); + $previous_p_jrn_type = $http->post("p_jrn_type","string",""); // } global $g_user; $f_add_button=new ISmallButton('add_card'); @@ -3996,7 +3999,8 @@ class Acc_Ledger extends jrn_def_sql ); echo HtmlInput::hidden("correct","copy"); // e_march - $nb=HtmlInput::default_value_post("nb_item",0); + $http=new HttpInput(); + $nb=$http->post("nb_item","number",0); for ( $i=0;$i<$nb;$i++) { echo HtmlInput::post_to_hidden( diff --git a/include/class/class_acc_payment.php b/include/class/class_acc_payment.php index 3700fd973..801c234c1 100644 --- a/include/class/class_acc_payment.php +++ b/include/class/class_acc_payment.php @@ -29,6 +29,8 @@ require_once NOALYSS_INCLUDE.'/class/class_acc_ledger.php'; require_once NOALYSS_INCLUDE.'/class/class_fiche.php'; require_once NOALYSS_INCLUDE.'/class/class_fiche_def.php'; require_once NOALYSS_INCLUDE.'/constant.php'; +require_once NOALYSS_INCLUDE.'/lib/class_http_input.php'; + /*!\brief Handle the table mod_payment *\note the private data member are accessed via - mp_id ==> id ( Primary key ) @@ -302,6 +304,7 @@ class Acc_Payment $r.='
    '; $r.='
  1. '._('Paiement encodé plus tard'); + $http=new HttpInput(); if ( empty($array ) == false ) { foreach ($array as $row) @@ -321,7 +324,7 @@ class Acc_Payment $a->set_attribute('ipopup','ipopcard'); $a->set_attribute('label',$a->name.'_label'); if ( $p_select == $row->mp_id ) { - $a->value=HtmlInput::default_value_request("e_mp_qcode_".$p_select, ""); + $a->value=$http->request("e_mp_qcode_".$p_select, "string",""); } $s=new ISpan(); $s->name=$a->name.'_label'; diff --git a/include/class/class_anc_acc_link.php b/include/class/class_anc_acc_link.php index 4adbcc80f..7e490b16b 100644 --- a/include/class/class_anc_acc_link.php +++ b/include/class/class_anc_acc_link.php @@ -37,7 +37,8 @@ class Anc_Acc_Link extends Anc_Print function get_request() { parent::get_request(); - $this->card_poste=HtmlInput::default_value('card_poste',1,$_GET); + $http=new HttpInput(); + $this->card_poste=$http->get('card_poste',"string",1); } function set_sql_filter() { diff --git a/include/class/class_anc_key.php b/include/class/class_anc_key.php index 1ef404751..11cd37143 100644 --- a/include/class/class_anc_key.php +++ b/include/class/class_anc_key.php @@ -213,7 +213,8 @@ class Anc_Key $cn->start(); // for each row $a_row=$p_array['row']; - $a_ledger=HtmlInput::default_value("jrn",array(),$p_array); + $http=new HttpInput(); + $a_ledger=$http->extract($p_array,"jrn","string",array()); $a_percent=$p_array['percent']; $a_po_id=$p_array['po_id']; $a_plan=$p_array['pa']; diff --git a/include/class/class_anc_operation.php b/include/class/class_anc_operation.php index 119a2bd34..7d9dd627f 100644 --- a/include/class/class_anc_operation.php +++ b/include/class/class_anc_operation.php @@ -632,7 +632,8 @@ class Anc_Operation * Add a button for distribution key * */ - $ledger=HtmlInput::default_value_post("p_jrn", 0); + $http=new HttpInput(); + $ledger=$http->post("p_jrn", "string",0); if ($ledger==0) { $ledger=$this->db->get_value('select j_jrn_def from jrnx where j_id=$1',array($this->j_id)); } diff --git a/include/class/class_document.php b/include/class/class_document.php index 07ace7bb5..55c025e28 100644 --- a/include/class/class_document.php +++ b/include/class/class_document.php @@ -1178,7 +1178,8 @@ class Document $ret=$this->db->get_value('select r_phone from public.stock_repository where r_id=$1',array($p_array['repo'])); return $ret; case 'TITLE': - $title=HtmlInput::default_value_request("ag_title", ""); + $http=new HttpInput(); + $title=$http->request("ag_title","string", ""); return $title; case 'COMM_PAYMENT': if ( isset($p_array["e_comm_paiement"])) { diff --git a/include/class/class_pre_op_advanced.php b/include/class/class_pre_op_advanced.php index a728e39bc..97b0bf292 100644 --- a/include/class/class_pre_op_advanced.php +++ b/include/class/class_pre_op_advanced.php @@ -39,7 +39,6 @@ class Pre_Op_Advanced extends Pre_operation_detail { parent::get_post(); - extract($_POST, EXTR_SKIP); for ($i=0;$i<$this->operation->nb_item;$i++) { diff --git a/include/class/class_pre_operation.php b/include/class/class_pre_operation.php index fd926971d..f3e7ad750 100644 --- a/include/class/class_pre_operation.php +++ b/include/class/class_pre_operation.php @@ -87,8 +87,8 @@ class Pre_operation } function delete () { - $sql="delete from op_predef where od_id=".$this->od_id; - $this->db->exec_sql($sql); + $sql="delete from op_predef where od_id=$1"; + $this->db->exec_sql($sql,array($this->od_id)); } /*!\brief save the predef check first is the name is unique * \return true op.success otherwise false