[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 01/03: 0001438: Remplacement de HtmlInput par
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 01/03: 0001438: Remplacement de HtmlInput par HttpInput |
Date: |
Sun, 11 Jun 2017 07:37:20 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 074bcac3c3bf96dc97f91be25efc00d018736c05
Author: Dany De Bontridder <address@hidden>
Date: Mon Jun 5 19:56:43 2017 +0200
0001438: Remplacement de HtmlInput par HttpInput
---
html/ajax_misc.php | 1 +
include/ajax/ajax_add_concerned_card.php | 22 ++++++--
include/ajax/ajax_add_menu.php | 18 +++++--
include/ajax/ajax_admin.php | 89 ++++++++++++++++++++------------
include/ajax/ajax_anc_key_choice.php | 20 +++++--
include/ajax/ajax_anc_key_compute.php | 25 +++++----
include/ajax/ajax_anc_search.php | 7 ++-
include/ajax/ajax_calendar_zoom.php | 7 ++-
include/ajax/ajax_display_submenu.php | 22 ++++----
include/ajax/ajax_gestion.php | 23 +++++----
include/ajax/ajax_get_profile.php | 7 ++-
include/ajax/ajax_ledger.php | 27 ++++++----
include/ajax/ajax_remove_submenu.php | 15 +++++-
include/class/class_anc_key.php | 8 +++
include/lib/class_http_input.php | 24 ++++++++-
15 files changed, 216 insertions(+), 99 deletions(-)
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index bca9379..fafb003 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -44,6 +44,7 @@ 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';
+
mb_internal_encoding("UTF-8");
$var = array('gDossier', 'op');
diff --git a/include/ajax/ajax_add_concerned_card.php
b/include/ajax/ajax_add_concerned_card.php
index 2c0dd07..da0baf6 100644
--- a/include/ajax/ajax_add_concerned_card.php
+++ b/include/ajax/ajax_add_concerned_card.php
@@ -20,15 +20,27 @@
// Copyright 2014 Author Dany De Bontridder address@hidden
// require_once '.php';
+
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
-ob_start();
-$ag_id=HtmlInput::default_value_get("ag_id", "0");
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
+ob_start();
+try
+{
+ $ag_id=$http->get("ag_id");
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
+}
-if ($ag_id == 0 ) throw new Exception('ag_id is null');
+require_once NOALYSS_INCLUDE.'/class/class_acc_ledger.php';
-require_once('class/class_acc_ledger.php');
$r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
$r.='<form id="search_card1_frm" method="GET"
onsubmit="action_add_concerned_card(this);return false;">';
@@ -42,7 +54,7 @@ $r.='</span>';
$r.=dossier::hidden().HtmlInput::hidden('op', 'add_concerned_card');
$r.=HtmlInput::request_to_hidden(array('ag_id'));
$r.='</form>';
-$query=HtmlInput::default_value_get("query", "");
+$query=$http->get("query", "string","");
$sql_array['query']=$query;
$sql_array['typecard']='all';
diff --git a/include/ajax/ajax_add_menu.php b/include/ajax/ajax_add_menu.php
index b39c602..8e6202b 100644
--- a/include/ajax/ajax_add_menu.php
+++ b/include/ajax/ajax_add_menu.php
@@ -40,14 +40,22 @@ if (!defined('ALLOWED'))
if ($g_user->check_module('CFGPRO')==0)
die();
-$type=HtmlInput::default_value_get('type', 'XX');
-$p_level=HtmlInput::default_value_get('p_level', 0);
-$dep=HtmlInput::default_value_get('dep', 0);
-if ($type=='XX')
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
+try
+{
+ $type=$http->get('type');
+ $p_level=$http->get('p_level', "string",0);
+ $dep=$http->get('dep', "string",0);
+}
+catch (Exception $exc)
{
- throw new Exception('invalid call');
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
return;
}
+
// if type == menu the
if ($type=='me')
{
diff --git a/include/ajax/ajax_admin.php b/include/ajax/ajax_admin.php
index 8226cb0..30172ea 100644
--- a/include/ajax/ajax_admin.php
+++ b/include/ajax/ajax_admin.php
@@ -32,22 +32,19 @@ if ($g_user->Admin()==0)
die();
}
set_language();
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
// From admin, grant the access to a folder to an
// user
if ($op=='folder_add') // operation
{
$cn=new Database();
- $user_id=HtmlInput::default_value_get("p_user", 0); // get variable
- $dossier_id=HtmlInput::default_value_get("p_dossier", 0); // get variable
- if ($user_id==0||$dossier_id==0||isNumber($user_id)==0||$dossier_id==0)
- {
-
- $content=_('Erreur paramètre');
- $status="NOK";
- }
- else
+ try
{
+ $user_id=$http->get("p_user", "number"); // get variable
+ $dossier_id=$http->get("p_dossier", "number"); // get variable
$user=new User($cn, $user_id);
$user->set_folder_access($dossier_id, true);
$dossier=new Dossier($dossier_id);
@@ -58,6 +55,15 @@ if ($op=='folder_add') // operation
"</td>";
$status='OK';
}
+ catch (Exception $exc)
+ {
+ error_log($exc->getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ return;
+ }
+
+
//----------------------------------------------------------------
// Answer in XML
header('Content-type: text/xml; charset=UTF-8');
@@ -75,22 +81,23 @@ if ($op=='folder_add') // operation
// user
if ($op=='folder_remove') // operation
{
-
- $cn=new Database();
- $user_id=HtmlInput::default_value_get("p_user", 0); // get variable
- $dossier_id=HtmlInput::default_value_get("p_dossier", 0); // get variable
- if ($user_id==0||$dossier_id==0||isNumber($user_id)==0||$dossier_id==0)
- {
- $content=_('Erreur paramètre');
- $status="NOK";
- }
- else
+ try
{
+ $cn=new Database();
+ $user_id=$http->get("p_user", "number"); // get variable
+ $dossier_id=$http->get("p_dossier", "number"); // get variable
$user=new User($cn, $user_id);
$user->set_folder_access($dossier_id, false);
$content="";
$status='OK';
}
+ catch (Exception $exc)
+ {
+ error_log($exc->getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ }
+
//----------------------------------------------------------------
// Answer in XML
header('Content-type: text/xml; charset=UTF-8');
@@ -114,16 +121,10 @@ if ($op=='folder_display') // operation
{
$cn=new Database();
- $user_id=HtmlInput::default_value_get("p_user", 0); // get variable
- $p_filter=HtmlInput::default_value_get('p_filter', '');
-
- if ($user_id==0||isNumber($user_id)==0)
- {
- $content=_('Erreur paramètre');
- $status="NOK";
- }
- else
+ try
{
+ $user_id=$http->get("p_user", "number"); // get variable
+ $p_filter=$http->get('p_filter', "string",'');
ob_start();
$user=new User($cn, $user_id);
$a_dossier=Dossier::show_dossier('X', $user->id, $p_filter,
MAX_FOLDER_TO_SHOW);
@@ -151,7 +152,19 @@ if ($op=='folder_display') // operation
require NOALYSS_TEMPLATE.'/folder_display.php';
$content=ob_get_clean();
$status='OK';
+
+
+ }
+ catch (Exception $exc)
+ {
+ error_log($exc->getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
}
+
+
+
+
//----------------------------------------------------------------
// Answer in XML
header('Content-type: text/xml; charset=UTF-8');
@@ -170,13 +183,19 @@ if ($op=='folder_display') // operation
// the p_dossier parameter is mandatory
if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify',
'folder_drop')))
{
- $dossier=HtmlInput::default_value_get('p_dossier', 0);
- $content=_('Erreur paramètre');
- $status="NOK";
- // check if we receive a valid parameter
- if ($dossier==0||isNumber($dossier)==0)
+ try
+ {
+ $dossier=$http->get('p_dossier', "number");
+ $content=_('Erreur paramètre');
+ $status="NOK";
+
+ }
+ catch (Exception $exc)
{
- //----------------------------------------------------------------
+ error_log($exc->getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ //----------------------------------------------------------------
// Answer in XML
header('Content-type: text/xml; charset=UTF-8');
$dom=new DOMDocument('1.0', 'UTF-8');
@@ -189,7 +208,9 @@ if (in_array($op, array('modele_drop', 'modele_modify',
'folder_modify', 'folder
$dom->appendChild($root);
echo $dom->saveXML();
exit();
+
}
+
// Modify the description or the name of folder
if ($op=='folder_modify')
{
diff --git a/include/ajax/ajax_anc_key_choice.php
b/include/ajax/ajax_anc_key_choice.php
index bf6cde7..6e33137 100644
--- a/include/ajax/ajax_anc_key_choice.php
+++ b/include/ajax/ajax_anc_key_choice.php
@@ -26,11 +26,23 @@
*/
// Copyright (2014) Author Dany De Bontridder address@hidden
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-$amount=HtmlInput::default_value_get("amount", 0);
-$table_id=HtmlInput::default_value_get("t", "");
-$ledger=HtmlInput::default_value_get('led',0);
-if ($table_id == "" || isNumber($amount) == 0 || isNumber($ledger) == 0) die
('Invalid Parameter');
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
+try
+{
+ $amount=$http->get("amount", "number");
+ $table_id=$http->get("t");
+ $ledger=$http->get('led',"number");
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
require_once 'class/class_anc_key.php';
diff --git a/include/ajax/ajax_anc_key_compute.php
b/include/ajax/ajax_anc_key_compute.php
index a5b46e2..1d2c096 100644
--- a/include/ajax/ajax_anc_key_compute.php
+++ b/include/ajax/ajax_anc_key_compute.php
@@ -29,22 +29,25 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/class_anc_key.php';
-ob_start();
-/////
-$key=HtmlInput::default_value_get('key',0);
-$amount=HtmlInput::default_value_get('amount',0);
-$target=HtmlInput::default_value_get('t','');
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
-if ( isNumber($key)== 0
- || isNumber($amount) ==0
- || $target==''
- )
+try
{
- die ('Invalid parameter');
+ $key=$http->get('key',"number");
+ $amount=$http->get('amount',"number");
+ $target=$http->get('t');
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
}
$compute_key=new Anc_Key($key);
-$row=str_replace('t', "", $target);
+$pos=strrpos($target,"t");
+$row=substr($target,$pos+1);
$compute_key->fill_table($target,$amount);
echo <<<EOF
diff --git a/include/ajax/ajax_anc_search.php b/include/ajax/ajax_anc_search.php
index db7321e..a836a40 100644
--- a/include/ajax/ajax_anc_search.php
+++ b/include/ajax/ajax_anc_search.php
@@ -37,6 +37,11 @@ require_once NOALYSS_INCLUDE.'/class/class_dossier.php';
require_once NOALYSS_INCLUDE.'/class/class_anc_account.php';
require_once NOALYSS_INCLUDE.'/class/class_anc_plan.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
+$texte=new IText('plabel');
+$texte->value=$http->get('plabel',"string","");
echo HtmlInput::title_box(_("Recherche activité"), $ctl);
@@ -44,8 +49,6 @@ echo HtmlInput::title_box(_("Recherche activité"), $ctl);
echo '<FORM id="anc_search_form" METHOD="GET"
onsubmit="search_anc_form(this);return false">';
echo '<span>'._('Recherche').':';
-$texte=new IText('plabel');
-$texte->value=HtmlInput::default_value('plabel',"", $_GET);
echo $texte->input();
echo '</span>';
echo dossier::hidden();
diff --git a/include/ajax/ajax_calendar_zoom.php
b/include/ajax/ajax_calendar_zoom.php
index a95198b..eab6fda 100644
--- a/include/ajax/ajax_calendar_zoom.php
+++ b/include/ajax/ajax_calendar_zoom.php
@@ -19,11 +19,14 @@
// Copyright Author Dany De Bontridder address@hidden
if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/class_calendar.php';
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
ob_start();
if ( $notitle== 0 ) echo HtmlInput::title_box(_("Calendrier"),
"calendar_zoom_div");
$cal=new Calendar();
-$in=HtmlInput::default_value_get('in',"");
-$notitle=HtmlInput::default_value_get('notitle',"0");
+$in=$http->get('in',"string","");
+$notitle=$http->get('notitle',"string","0");
if ( $in == "") {
$in=$cal->get_preference();
}
diff --git a/include/ajax/ajax_display_submenu.php
b/include/ajax/ajax_display_submenu.php
index f005149..e1dc526 100644
--- a/include/ajax/ajax_display_submenu.php
+++ b/include/ajax/ajax_display_submenu.php
@@ -30,18 +30,20 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas
permis');
// Security
if ( $g_user->check_module('CFGPRO') == 0 ) die();
-// Check parameter
-$module=HtmlInput::default_value_get("dep", "");
-$p_level=HtmlInput::default_value_get("p_level", 0);
-$p_id=HtmlInput::default_value_get('p_profile',-1);
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
-if ($module == ""
- || $p_id == -1
- || isNumber($p_id) == 0
- || isNumber($p_level) == 0
- )
+ob_start();
+try
{
- echo _('Paramètre invalide');
+ $module=$http->get("dep");
+ $p_level=$http->get("p_level", "number",0);
+ $p_id=$http->get('p_profile',"number");
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
return;
}
diff --git a/include/ajax/ajax_gestion.php b/include/ajax/ajax_gestion.php
index 56ae41f..c954fb6 100644
--- a/include/ajax/ajax_gestion.php
+++ b/include/ajax/ajax_gestion.php
@@ -25,6 +25,10 @@
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
+
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
if ($op=='action_show')
{
/**
@@ -51,19 +55,16 @@ if ($op=='action_save')
/**
* save info from the get
*/
- $date_event=HtmlInput::default_value_get("date_event", -1);
- $dest=HtmlInput::default_value_get("dest", "");
- $event_group=HtmlInput::default_value_get("event_group", 0);
- $event_priority=HtmlInput::default_value_get("event_priority", 0);
- $title=HtmlInput::default_value_get("title_event", NULL);
- $summary=HtmlInput::default_value_get("summary", "");
- $type_event=HtmlInput::default_value_get('type_event', -1);
- $hour_event=HtmlInput::default_value_get('hour_event', null);
- /*
- * Check if data are valid
- */
try
{
+ $date_event=$http->get("date_event","string","");
+ $dest=$http->get("dest","string", "");
+ $event_group=$http->get("event_group", "string",0);
+ $event_priority=$http->get("event_priority", "string",0);
+ $title=$http->get("title_event","string", NULL);
+ $summary=$http->get("summary","string", "");
+ $type_event=$http->get('type_event', "string",-1);
+ $hour_event=$http->get('hour_event', "string",null);
if ($date_event==-1||isDate($date_event)==0)
throw new Exception(_('Date invalide'));
if (trim($dest)=="")
diff --git a/include/ajax/ajax_get_profile.php
b/include/ajax/ajax_get_profile.php
index 952852b..66b4990 100644
--- a/include/ajax/ajax_get_profile.php
+++ b/include/ajax/ajax_get_profile.php
@@ -34,11 +34,14 @@ if ( $g_user->check_module('CFGPRO') == 0 ) die();
require_once NOALYSS_INCLUDE.'/database/class_profile_sql.php';
require_once NOALYSS_INCLUDE.'/class/class_profile_menu.php';
require_once NOALYSS_INCLUDE.'/lib/class_html_input.php';
-$p_id=HtmlInput::default_value_request('p_id', -1);
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
+$p_id=$http->request('p_id',"string", -1);
$profile=new Profile_sql($cn,$p_id);
$gDossier=Dossier::id();
$add_impression=HtmlInput::button("add", _("Ajout
Menu"),"onclick=\"add_menu({dossier:$gDossier,p_id:$p_id,type:'pr'})\"");
-$call_tab=HtmlInput::default_value_post('tab', 'profile_gen_div');
+$call_tab=$http->post('tab', "string",'profile_gen_div');
$a_tab=array('profile_gen_div'=>'tabs','profile_menu_div'=>'tabs','profile_print_div'=>'tabs','profile_gestion_div'=>'tabs','profile_repo_div'=>'tabs');
$a_tab[$call_tab]='tabs_selected';
?>
diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php
index dba4bba..ed8a183 100644
--- a/include/ajax/ajax_ledger.php
+++ b/include/ajax/ajax_ledger.php
@@ -40,6 +40,9 @@ require_once NOALYSS_INCLUDE.'/class/class_anc_operation.php';
require_once NOALYSS_INCLUDE.'/lib/class_idate.php';
require_once NOALYSS_INCLUDE.'/class/class_own.php';
require_once NOALYSS_INCLUDE.'/lib/class_iconcerned.php';
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
+
/**
* Check if we receive the needed data (jr_id...)
*/
@@ -51,11 +54,20 @@ if ( ! isset ($_REQUEST['act'])|| ! isset
($_REQUEST['jr_id'])
global $g_user,$cn,$g_parameter;
mb_internal_encoding("UTF-8");
+try
+{
+ $action=$http->request('act');
+ $jr_id=$http->request('jr_id');
+ $div=$http->request('div'); /* the div source and target
for javascript */
+ $gDossier=dossier::id();
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
-$action=$_REQUEST['act'];
-$jr_id=$_REQUEST['jr_id'];
-$div=$_REQUEST['div']; /* the div source and target for javascript */
-$gDossier=dossier::id();
/**
*if $_SESSION['g_user'] is not set : echo a warning
*/
@@ -87,7 +99,7 @@ EOF;
// check if the user can access the ledger where the operation is (view) and
// if he can modify it
$op=new Acc_Operation($cn);
-$op->jr_id=$_REQUEST['jr_id'];
+$op->jr_id=$jr_id;
$ledger=$op->get_ledger();
if ($ledger=="")
{
@@ -146,10 +158,7 @@ case 'rmop':
{
$cn->start();
$oLedger=new Acc_Ledger($cn,$ledger);
- $oLedger->jr_id=HtmlInput::default_value_request('jr_id',0);
- if ( $oLedger->jr_id == 0 ||
- isNumber($oLedger->jr_id) == 0)
- throw new Exception (_('Donnée invalide'));
+ $oLedger->jr_id=$jr_id=$http->request('jr_id',"number");
$oLedger->delete();
$cn->commit();
echo _("Opération Effacée");
diff --git a/include/ajax/ajax_remove_submenu.php
b/include/ajax/ajax_remove_submenu.php
index b9d79a1..c5946f0 100644
--- a/include/ajax/ajax_remove_submenu.php
+++ b/include/ajax/ajax_remove_submenu.php
@@ -21,12 +21,23 @@
// require_once '.php';
if ( ! defined ('ALLOWED') ) die(_('Non autorisé'));
+require_once NOALYSS_INCLUDE.'/lib/class_http_input.php';
+$http=new HttpInput();
// Security
if ($g_user->check_module('CFGPRO')==0)
die();
-$p_profile_menu_id=HtmlInput::default_value_get('p_profile_menu_id', 0);
-if ( $p_profile_menu_id == 0 ||isNumber($p_profile_menu_id)==0) throw new
Exception(_('Donnée invalide'));
+try
+{
+
+ $p_profile_menu_id=$http->get('p_profile_menu_id', "number");
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
// Delete menu + children
$cn->exec_sql('delete from profile_menu where pm_id = $1 or
pm_id_dep=$1',array($p_profile_menu_id));
diff --git a/include/class/class_anc_key.php b/include/class/class_anc_key.php
index e2da257..1ef4047 100644
--- a/include/class/class_anc_key.php
+++ b/include/class/class_anc_key.php
@@ -327,6 +327,14 @@ class Anc_Key
$array['val']=$val;
$anc_operation=new Anc_Operation($cn);
+ // find the div thanks the target which looks like "det4t0"
+ // det4 is the div id and t0 is the row
+ if (strpos($p_target, "et")){
+ // cut off t[0-9]
+ $pos=strrpos($p_target,"t");
+ $anc_operation->in_div=substr($p_target,0,$pos);
+
+ }
echo $anc_operation->display_form_plan($array, 1, 1, $number,
$p_amount,'',false);
}
diff --git a/include/lib/class_http_input.php b/include/lib/class_http_input.php
index dd97922..14fe793 100644
--- a/include/lib/class_http_input.php
+++ b/include/lib/class_http_input.php
@@ -37,12 +37,20 @@ class HttpInput
{
// no check on string
if ( $p_type=="string") return;
+ // Check if number
if ( $p_type=="number"
&& isNumber($this->array[$p_name]) == 0
)
- throw new Exception(_("Valeur invalide")."[ $p_name ] =
{$this->array[$p_name]}"
+ throw new Exception(_("Type invalide")."[ $p_name ] =
{$this->array[$p_name]}"
,EXC_PARAM_TYPE);
- if ( $p_type=="date") return;
+ // Check if date dd.mm.yyyy
+ if ( $p_type=="date") {
+ if (isDate($this->array[$p_name])=!$this->array[$p_name]) {
+ throw new Exception(_("Type invalide")."[ $p_name ] =
{$this->array[$p_name]}"
+ ,EXC_PARAM_TYPE);
+
+ }
+ }
}
catch (Exception $ex)
{
@@ -142,6 +150,18 @@ class HttpInput
}
}
+ /**
+ * Extract variable name from an exception message. If an exception is
thrown
+ * then thanks this function it is possible to know what variable triggers
+ * the exception
+ * @param type $p_string
+ * @return string like "[variable]"
+ */
+ function extract_variable($p_string) {
+ if ( preg_match("/\[.*\]/",$p_string,$found) == 1 ) {
+ return $found[0];
+ }
+ }
}
?>