Lang_Appli = Factory::Build('Langue'); if (is_numeric($v) and ($v > 0)) { $this->Id = intval($v); } } function Init() { if ($Nfo = parent::Init()) { $this->SetNom($Nfo['nom_contact']); $this->SetPrenom($Nfo['prenom_contact']); $this->SetEmail($Nfo['email_contact']); $this->SetLogin($Nfo['login_contact']); $this->SetPassword($Nfo['password_contact']); $this->SetUrl($Nfo['url_contact']); $this->Lang_Appli = Factory::Build('Langue', intval($Nfo['id_langue_appli'])); return true; } else { return false; } } function Parse($Encoding = 'HTML', $Ext = '') { $a = array( 'ID_CONTACT'.$Ext => Encode($this->GetId(), $Encoding), 'NOM_CONTACT'.$Ext => Encode($this->GetNom(), $Encoding), 'PRENOM_CONTACT'.$Ext => Encode($this->GetPrenom(), $Encoding), 'EMAIL_CONTACT'.$Ext => Encode($this->GetEmail(), $Encoding), 'LOGIN_CONTACT'.$Ext => Encode($this->GetLogin(), $Encoding), 'PASSWORD_CONTACT'.$Ext => Encode($this->GetPassword(), $Encoding), 'URL_CONTACT'.$Ext => Encode($this->GetUrl(), $Encoding), 'AUTH_CONTACT'.$Ext => Encode($this->GetAuthStr(), $Encoding), ); return $a; } function SetId($v) { $this->Id = intval($v); } function GetId() { return $this->Id; } function SetNom($v) { $this->Nom = strval(stripslashes($v)); } function GetNom() { if (!$this->IsInit) $this->Init(); return $this->Nom; } function SetPrenom($v) { $this->Prenom = strval(stripslashes($v)); } function GetPrenom() { if (!$this->IsInit) $this->Init(); return $this->Prenom; } function SetEmail($v) { $this->Email = strval(stripslashes($v)); } function GetEmail() { if (!$this->IsInit) $this->Init(); return $this->Email; } function SetLogin($v) { $this->Login = strval(stripslashes($v)); } function GetLogin() { if (!$this->IsInit) $this->Init(); return $this->Login; } function SetPassword($v) { $this->Password = strval(stripslashes($v)); } function GetPassword() { if (!$this->IsInit) $this->Init(); return $this->Password; } function SetUrl($v) { $this->Url = strval(stripslashes($v)); } function GetUrl() { if (!$this->IsInit) $this->Init(); return $this->Url; } function GetFullEmail() { if (!$this->IsInit) $this->Init(); return $this->GetPrenom().' '.$this->GetNom().'<'.$this->GetEmail().'>'; } function GetAuthStr() { if (!$this->IsInit) $this->Init(); return md5($this->GetLogin().$this->GetPassword()); } function GetLang_Appli() { if (!$this->IsInit) $this->Init(); return $this->Lang_Appli; } function SetLang_Appli($v) { $this->Lang_Appli = $v; } function InitByHash() { $h = @func_get_arg(0)?func_get_arg(0):@$_SESSION['Auth']; if (strlen($h) > 0) { if ($r = $this->Search(array('MD5(CONCAT(login_contact, password_contact)) = \''.$h.'\''))) { $c = current($r); return $c; } else { return false; } } else { return false; } } function Update() { $P = @func_get_arg(0)?func_get_arg(0):$_POST; if ($this->Id > 0) $this->Init(); if (isset($P['NomContact'])) $this->SetNom(trim($P['NomContact'])); if (isset($P['PrenomContact'])) $this->SetPrenom(trim($P['PrenomContact'])); if (isset($P['EmailContact'])) $this->SetEmail(trim($P['EmailContact'])); if (isset($P['LoginContact'])) $this->SetLogin(trim($P['LoginContact'])); if (isset($P['PasswordContact'])) $this->SetPassword(trim($P['PasswordContact'])); if (isset($P['UrlContact'])) $this->SetUrl(trim($P['UrlContact'])); } function Save() { $A = array( 'nom_contact' => addslashes(strval($this->GetNom())), 'prenom_contact' => addslashes(strval($this->GetPrenom())), 'email_contact' => addslashes(strval($this->GetEmail())), 'login_contact' => addslashes(strval($this->GetLogin())), 'password_contact' => addslashes(strval($this->GetPassword())), 'url_contact' => addslashes(strval($this->GetUrl())), 'id_langue_appli' => $this->Lang_Appli->GetId(), ); if ($this->GetId() > 0) $this->UpdateInTbl($A); else $this->SetId($this->InsertInTbl($A)); } } ?>