Fixed issue #58.

This commit is contained in:
Rooty 2021-04-05 18:45:45 +02:00
parent ed8d0c8248
commit e8767e82b5

View File

@ -172,6 +172,489 @@ Class Home extends CoordinationObj
return "";
}
/**
* Function permettant d'afficher le formulaire de pré-inscription pour enregistrement dans la bd
* @access public
* @param tableau
* @return chaine chaine html
*/
function formLecture($tabPOST="", $errorInfo="")
{
global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE, $CONF_DATA_PATH;
$_SESSION['redirect']=$_SERVER['REQUEST_URI'];
/*Récupération des messages utilisateurs*/
addMessageFile("user.ini");
// addMessageFile("subscriptions.ini");
// addMessageFile("adminaccounting.ini");
/* gestion du lib en fonction de la langue courante */
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
// titlPageInscription + ComText
mxPageTitle("titlPageInscription");
$arrayCallCss = array();
$arrayCallCss[] = "data/css/bootstrap-datepicker/1.9.0/bootstrap-datepicker3.min.css";
mxCallCss($arrayCallCss);
$arrayCallJs = array();
$arrayCallJs[] = "data/javascript/bootstrap-datepicker/1.9.0/bootstrap-datepicker.min.js";
$arrayCallJs[] = "data/javascript/bootstrap-datepicker/1.9.0/locales/bootstrap-datepicker.fr.min.js";
mxCallJs($arrayCallJs);
$arrayRawJs[] = "\$(document).ready(function(){ $('.datepicker').datepicker(); });";
mxRawJs($arrayRawJs);
/* On inclus la template (voir package.template.php) */
WithBlocPath("Home", "formlecture");
if(isset($_GET['param']) && (is_numeric($_GET['param'])))
{
$myNoeud = $GLOBALS['SYSTEM_MANAGER']['NODE']->createInstance($_GET['param']);
$libmyNoeud = $myNoeud->getLibelle($currentCode);
$messageInscriptionNoeud = " : ".$libmyNoeud;
$GLOBALS['SYSTEM_TEMPLATE']->MxText("messageInscriptionNoeud", $messageInscriptionNoeud);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ComText", $libmyNoeud);
//On récupère le texte du noeud choisi par l'internaute
$sql="SELECT * FROM ".DATA_ACCES_TABLE_PREFIX.DATA_ACCES_OBJECT_PREFIX."textentrynode WHERE node_id=".$_GET['param'];
# Exécution de Requete
$result=$GLOBALS['SYSTEM_DATABASE_CONN']->sql_query($sql);
# Teste si il y a des enregistrements
if ($GLOBALS['SYSTEM_DATABASE_CONN']->sql_numrows()>0)
{
$list = $GLOBALS['SYSTEM_DATABASE_CONN']->sql_fetchrow();
$text = $list['textentrynode_resume'];
//On masque le texte d'intro affiché par défaut à partir de message
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("text_resume", $text);
}
# Destruction des éléments
$GLOBALS['SYSTEM_DATABASE_CONN']->sql_freeresult();
// var_dump($this->getObjectSon(eid()));
// $tabObject =$this->getObjectSon(eid());
// if (($this->recupCommunauty("ctype") == "asso") && (count($tabObject) >> 0) )
// {
// for ($i=0; $i<count($tabObject);$i++)
// {
// if ($tabObject[$i][0]->getClassName()=="CorporateInfos")
// {
// $urlArray["id"]=$tabObject[$i][1]->getId();
// $urlArray["classname"]=$tabObject[$i][0]->getClassName();
// // $urlArray["methodname"]=$tabObject[$i][0]->getMethodName();
// }
// }
// $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("blocSubscriptionsForms".".linkStatuts", formatUrl($urlArray["id"],$urlArray["classname"],"actionLectureInfo","","2"));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("blocSubscriptionsForms".".linkRegInt", formatUrl($urlArray["id"],$urlArray["classname"],"actionLectureInfo","","3"));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("blocSubscriptionsForms".".linkChartConf", formatUrl($urlArray["id"],$urlArray["classname"],"actionLectureInfo","","4"));
// }
}
# Récupération des étiquette du formulaire
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("WarnNotSubs", htmlspecialchars(getMessage("WarnNotSubs1")).$libmyNoeud.htmlspecialchars(getMessage("WarnNotSubs2")));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction", formatUrl($this->getId(),"Home","execLecture","",$_GET['param']));
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("urlReturn",formatUrl($this->getId(),"Home","actionLecture"));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("urlQaptcha", formatUrl($this->getId(),"Home","formLectureQaptcha"));
# Affichage des champs de formulaire pour l'inscription
if(!$tabPOST)
{
$titre = array(getMessage("mr"),getMessage("mrs"), getMessage("miss"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxSelect("user_title", "user_title", "", $titre, getMessage("user_title"), "", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipSelectTitle"), ENT_QUOTES)."\"");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_first_name", "text", "user_first_name", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipFirstName"), ENT_QUOTES)."\"", getMessage("user_first_name"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_last_name", "text", "user_last_name", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipLastName"), ENT_QUOTES)."\"", getMessage("user_last_name"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_login", "text", "user_login", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipLogin"), ENT_QUOTES)."\"", getMessage("user_login"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_mail", "email", "user_mail", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipCourriel"), ENT_QUOTES)."\"", getMessage("user_mail"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password", "password", "user_password", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipPassword"), ENT_QUOTES)."\"", getMessage("user_password"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password2", "password", "user_password2", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipPassword2"), ENT_QUOTES)."\"", getMessage("user_password"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_birthdate", "text", "user_birthdate", "jj/mm/aaaa", "class=\"form\" required=\"true\" data-provide=\"datepicker\" data-date-format=\"dd/mm/yyyy\" data-date-language=\"fr\" title=\"".htmlspecialchars(getMessage("tipBirthDate"), ENT_QUOTES)."\"", getMessage("user_birthdate"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_msn", "text", "user_msn", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipUserMsn"), ENT_QUOTES)."\"", getMessage("user_msn"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_jabber", "text", "user_jabber", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipUserJabber"), ENT_QUOTES)."\"", getMessage("user_jabber"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_facebook", "text", "user_facebook", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipUserFacebook"), ENT_QUOTES)."\"", getMessage("user_facebook"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_mastodon", "text", "user_mastodon", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipUserMastodon"), ENT_QUOTES)."\"", getMessage("user_mastodon"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_website", "text", "user_website", "", "class=\"form\" title=\"".htmlspecialchars(getMessage("tipUserWebsite"), ENT_QUOTES)."\"", getMessage("user_website"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_code", "text", "user_postal_code", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipPostalCode"), ENT_QUOTES)."\"", getMessage("user_postal_code"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_adress", "text", "user_postal_adress", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipPostalAddress"), ENT_QUOTES)."\"", getMessage("user_postal_address"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_addressmand", "text", "user_postal_addressmand", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipPostalAddress"), ENT_QUOTES)."\"", getMessage("user_postal_address"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_city", "text", "user_city", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipCity"), ENT_QUOTES)."\"", getMessage("user_city"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_state", "text", "user_state", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipState"), ENT_QUOTES)."\"", getMessage("user_state"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_country", "text", "user_country", "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipCountry"), ENT_QUOTES)."\"", getMessage("user_country"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_tel", "text", "user_tel", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipTel"), ENT_QUOTES)."\"", getMessage("user_tel"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_fax", "text", "user_fax", "", "class=\"form\" required=\"false\" title=\"".htmlspecialchars(getMessage("tipFax"), ENT_QUOTES)."\"", getMessage("user_fax"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("charteSite", "checkbox", "charteSite", 1, "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipIAccept"), ENT_QUOTES)."\"");
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionform", "checkbox", "subscriptionform", 1, "", "class=\"form\" required=\"true\" title=\"".htmlspecialchars(getMessage("tipAcceptSubscriptionForm"), ENT_QUOTES)."\"");
// for ($i=0; $i<count($allSubscriptionsForms);$i++)
// {
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".subscriptionsforms".".name", getMessage($allSubscriptionsForms[$i]["subscription_type"]));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".subscriptionsforms".".amount", $allSubscriptionsForms[$i]["subscription_amount"]);
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionsforms".".value", "radio", "subscriptiontype", $allSubscriptionsForms[$i]["subscription_type"], "", "");
// $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocSubscriptionsForms".".subscriptionsforms", "loop");
// }
// foreach( $arrPaymentMethods as $key => $value )
// {
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".paymentMethods".".name", getMessage("lblPayMtd_".$key));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".paymentMethods".".value", "radio", "paymentMethod", $key, "", "");
// $GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("blocSubscriptionsForms".".paymentMethods", "loop");
// }
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subsmladh", "checkbox", "subsmladh", 1, "", "title='".htmlspecialchars(getMessage("tipAcceptSubsMLAdh"), ENT_QUOTES)."'");
if( file_exists($GLOBALS["CONF_DATA_PATH"]."data/message/".$currentCode."/charte_inscription_".$_GET['param'].".inc") )
{
$file=new File($GLOBALS["CONF_DATA_PATH"]."data/message/".$currentCode."/charte_inscription_".$_GET['param'].".inc", "r");
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("charteSiteContent", $file->readAll());
} else
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("charteSiteContent", htmlspecialchars(getMessage("textNoCharte")));
}
else // On raffiche les données saisies par l'utilisateur
{
$titre = array(getMessage("mr"),getMessage("mrs"),getMessage("miss"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxSelect("user_title", "user_title",$_POST['user_title'], $titre, "", "");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_first_name", "text", "user_first_name", $_POST['user_first_name']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_last_name", "text", "user_last_name", $_POST['user_last_name']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_login", "text", "user_login", $_POST['user_login']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password", "password", "user_password", "");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_password2", "password", "user_password2", "");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_mail", "text", "user_mail", $_POST['user_mail']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_birthdate", "text", "user_birthdate", $_POST['user_birthdate']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_msn", "text", "user_msn", $_POST['user_msn']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_jabber", "text", "user_jabber", $_POST['user_jabber']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_facebook", "text", "user_facebook", $_POST['user_facebook']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_mastodon", "text", "user_mastodon", $_POST['user_mastodon']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_website", "text", "user_website", $_POST['user_website']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_code", "text", "user_postal_code", $_POST['user_postal_code']);
if( isset($_POST['user_postal_adress']) )
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_adress", "text", "user_postal_adress", $_POST['user_postal_adress']);
else
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_adress", "text", "user_postal_adress", $_POST['user_postal_addressmand']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_postal_adressmand", "text", "user_postal_adressmand", $_POST['user_postal_adressmand']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_city", "text", "user_city", $_POST['user_city']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_state", "text", "user_state", $_POST['user_state']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_country", "text", "user_country", $_POST['user_country']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_tel", "text", "user_tel", $_POST['user_tel']);
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_fax", "text", "user_fax", $_POST['user_fax']);
if( isset($_POST["charteSite"]) && $_POST["charteSite"] == 1 )
$GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("charteSite", "checkbox", "charteSite", 1, "checked=checked");
else
$GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("charteSite", "checkbox", "charteSite", 1, "");
// if( $_POST["subscriptionform"] == 1 )
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionform", "checkbox", "subscriptionform", 1, "cheched=checked");
// else
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionform", "checkbox", "subscriptionform", 1, "");
// for ($i=0; $i<count($allSubscriptionsForms);$i++)
// {
// // if( isset($allSubscriptionsForms[$i]["subscription_type"]) )
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".subscriptionsforms".".name", getMessage($allSubscriptionsForms[$i]["subscription_type"]));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".subscriptionsforms".".amount", $allSubscriptionsForms[$i]["subscription_amount"]);
// if( isset($allSubscriptionsForms[$i]["subscription_type"]) && $_POST["subscriptiontype"] == $allSubscriptionsForms[$i]["subscription_type"] )
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionsforms".".value", "radio", "subscriptiontype", $allSubscriptionsForms[$i]["subscription_type"], "checked=checked", "");
// else
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subscriptionsforms".".value", "radio", "subscriptiontype", $allSubscriptionsForms[$i]["subscription_type"], "", "");
// $GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocSubscriptionsForms".".subscriptionsforms", "loop");
// }
// foreach( $arrPaymentMethods as $key => $value )
// {
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("blocSubscriptionsForms".".paymentMethods".".name", getMessage("lblPayMtd_".$key));
// if( isset($_POST["paymentMethod"]) && $_POST["paymentMethod"] == $key )
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".paymentMethods".".value", "radio", "paymentMethod", $key, "checked=checked", "");
// else
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".paymentMethods".".value", "radio", "paymentMethod", $key, "", "");
// $GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("blocSubscriptionsForms".".paymentMethods", "loop");
// }
// $GLOBALS["SYSTEM_TEMPLATE"]->MxCheckerField("blocSubscriptionsForms".".subsmladh", "checkbox", "subsmladh", 1, "", "title='".htmlspecialchars(getMessage("tipAcceptSubsMLAdh"), ENT_QUOTES)."'");
$file=new File($GLOBALS["CONF_DATA_PATH"]."data/message/".$currentCode."/charte_inscription_".$_GET['param'].".inc", "r");
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("charteSiteContent", $file->readAll());
}
ExitBloc();
return "";
}
public function formLectureQaptcha()
{
$GLOBALS["SYSTEM_TEMPLATE"] = new ModeliXeGranilim($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/mygamecharacters/ajaxdata.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->SetMxFileParameter($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$GLOBALS['SYSTEM_TEMPLATE_CONF']);
$GLOBALS["SYSTEM_TEMPLATE"]->SetModeliXe(true);
$aResponse['error'] = false;
if(isset($_POST['action']) && isset($_POST['qaptcha_key']))
{
$_SESSION['qaptcha_key'] = false;
if(htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'qaptcha')
{
$_SESSION['qaptcha_key'] = $_POST['qaptcha_key'];
echo json_encode($aResponse);
}
else
{
$aResponse['error'] = true;
echo json_encode($aResponse);
}
}
else
{
$aResponse['error'] = true;
echo json_encode($aResponse);
}
}
public function execFormLecture()
{
/*Récupération des messages utilisateurs*/
addMessageFile("user.ini");
/* gestion du lib en fonction de la langue courante */
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
if($_GET["type"] == "user_first_name"){
if( strlen($_GET["user_first_name"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxFirstNameUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_first_name"])<3 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxFirstNameTooShort"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_first_name"])>64 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxFirstNameTooLong"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$bolean = checkDataChars($_GET["user_first_name"], "/[\/:*!,?§%µ¤£~«<>|°{}1234567890]/");
if( $bolean == false ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxFirstNameBadChars"));
$this->printMXJson($returnValue, $returnMessage);
} else {
$returnValue = 1;
$returnMessage = "Identifiant valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
}
if($_GET["type"] == "user_last_name"){
if( strlen($_GET["user_last_name"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLastNameUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_last_name"])<3 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLastNameTooShort"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_last_name"])>64 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLastNameTooLong"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$bolean = checkDataChars($_GET["user_last_name"], "/[\/:*!,?§%µ¤£~«<>|°{}1234567890]/");
if( $bolean == false ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLastNameBadChars"));
$this->printMXJson($returnValue, $returnMessage);
} else {
$returnValue = 1;
$returnMessage = "Identifiant valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
}
if($_GET["type"] == "login"){
/*Inclusion de la librairie UserManagerDb pour effectuer l'insertion et la vérif dans la table sys_user_temp*/
include_once($GLOBALS['CONF_LIB_PATH']."lib/system/system_data/user/ressource/usermanagerdb.php");
//Création de l'objet
$MyManager=new UserManagerDb();
//On fixe la table par la méthode getTable
$MyManager->setTable("sys_object_user_temp");
/*Inclusion de la librairie NodeGroupUserManagerDb pour effectuer l'insertion dans la table sys_node_group_user_temp*/
include_once($GLOBALS['CONF_LIB_PATH']."lib/system/system_data/nodegroupuser/ressource/nodegroupusermanagerdb.php");
//Création de l'objet
$MyNodeGroupUser=new NodeGroupUserManagerDb();
//On fixe la table par la méthode getTable
$MyNodeGroupUser->setTable("sys_object_node_group_user_temp");
if( strlen($_GET["login"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLoginUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["login"])<4 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLoginTooShort"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["login"])>48 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLoginTooLong"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$bolean = checkDataChars($_GET["login"], "/[\/:*!,?§%µ¤£~«<>|°{}]/");
if( $bolean == false || $MyManager->checkLoginExist($_GET["login"]) || $GLOBALS['SYSTEM_MANAGER']['USER']->checkLoginExist($_GET["login"]) ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxLoginBadChars"));
$this->printMXJson($returnValue, $returnMessage);
} else {
$returnValue = 1;
$returnMessage = "Identifiant valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
}
if($_GET["type"] == "user_passwords"){
if( strlen($_GET["user_password"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxUserPasswordUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_password2"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxUserPassword2Undefined"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( strlen($_GET["user_password"])<7 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxUserPasswordTooShort"));
$this->printMXJson($returnValue, $returnMessage);
}
elseif( $_GET["user_password"] != $_GET["user_password2"] ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxUserPasswordCheckFailed"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$returnValue = 1;
$returnMessage = "Mot de passe valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
if($_GET["type"] == "user_mail"){
if( strlen($_GET["user_mail"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxCourrielUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$result = checkMail($_GET["user_mail"]);
if( $result != "Valide"){
$returnValue = 0;
$returnMessage = $result;
$this->printMXJson($returnValue, $returnMessage);
} else {
$returnValue = 1;
$returnMessage = "Adresse courriel valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
}
if($_GET["type"] == "user_birthdate"){
if( strlen($_GET["user_birthdate"])==0 ){
$returnValue = 0;
$returnMessage = htmlspecialchars(getMessage("ajaxBirthDateUndefined"));
$this->printMXJson($returnValue, $returnMessage);
}
else {
$bolean = preg_match('/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})$/', $_GET["user_birthdate"]);
if( $bolean == false ){
$returnValue = 0;
$returnMessage = "Date invalide !";
$this->printMXJson($returnValue, $returnMessage);
} else {
$returnValue = 1;
$returnMessage = "Date valide !";
$this->printMXJson($returnValue, $returnMessage);
}
}
}
}
public function execQaptcha()
{
/*Récupération des messages utilisateurs*/
addMessageFile("user.ini");
/* gestion du lib en fonction de la langue courante */
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
// check if $_SESSION['qaptcha_key'] created with AJAX exists
if(isset($_SESSION['qaptcha_key']) && !empty($_SESSION['qaptcha_key']))
{
$myVar = $_SESSION['qaptcha_key'];
// check if the random input created exists and is empty
if(isset($_POST[''.$myVar.'']) && empty($_POST[''.$myVar.'']))
{
/* Headers XML */
header("Content-type: text/plain");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache");
/* Appel du modèle mxt spécifique à l'affichage des catégories/rubriques */
$GLOBALS["SYSTEM_TEMPLATE"] = new ModeliXeGranilim($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/home/qaptcha.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->SetMxFileParameter($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$GLOBALS['SYSTEM_TEMPLATE_CONF']);
$GLOBALS["SYSTEM_TEMPLATE"]->SetModeliXe(true);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("return", var_dump($_POST));
}
else
{
/* Headers XML */
header("Content-type: text/plain");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache");
/* Appel du modèle mxt spécifique à l'affichage des catégories/rubriques */
$GLOBALS["SYSTEM_TEMPLATE"] = new ModeliXeGranilim($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/home/qaptcha.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->SetMxFileParameter($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$GLOBALS['SYSTEM_TEMPLATE_CONF']);
$GLOBALS["SYSTEM_TEMPLATE"]->SetModeliXe(true);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("return", $_POST);
}
}
unset($_SESSION['qaptcha_key']);
}
/**
* Fonction de sortie Modelixe en Json
*/
function printMXJson($returnValue, $returnMessage)
{
/* Headers XML */
header("Content-type: text/plain");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Pragma: no-cache");
/* Appel du modèle mxt spécifique à l'affichage des catégories/rubriques */
$GLOBALS["SYSTEM_TEMPLATE"] = new ModeliXeGranilim($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/home/checkform.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->SetMxFileParameter($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR'].$GLOBALS['SYSTEM_TEMPLATE_CONF']);
$GLOBALS["SYSTEM_TEMPLATE"]->SetModeliXe(true);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("returnValue", $returnValue);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("returnMessage", $returnMessage);
}
/**
* Function affichant le texte de présentation détaillé pour le noeud d'entrée une fois authentifié
* @access public