Ensuite il y a cette différence de nommage entre "validation" et "activation" entre le plugin télécharge et la discussion, mais supposons que je transcrive tout : activation devient validation dans le nom des fichiers...
Selon les posts, la proposition sur activation.class.php corrigé et qui fonctionne avec la V1.5 de Thélia est la suivante :
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
include_once(realpath(dirname(__FILE__))."/../../../classes/PluginsClassiques.class.php");
include_once(realpath(dirname(__FILE__))."/../../../classes/Client.class.php");
include_once(realpath(dirname(__FILE__))."/../../../fonctions/divers.php");
include_once(realpath(dirname(__FILE__))."/../../../classes/Message.class.php");
include_once(realpath(dirname(__FILE__))."/../../../classes/Messagedesc.class.php");
include_once(realpath(dirname(__FILE__))."/../../../classes/Variable.class.php");
include_once(realpath(dirname(__FILE__))."/../../../lib/phpMailer/class.phpmailer.php");
class Activation extends PluginsClassiques{
var $id;
var $ref;
var $raison;
var $entreprise;
var $siret;
var $nom;
var $prenom;
var $telfixe;
var $telport;
var $email;
var $motdepasse;
var $adresse1;
var $adresse2;
var $adresse3;
var $cpostal;
var $ville;
var $pays;
var $parrain;
var $type;
var $pourcentage;
var $token;
var $table="attente";
var $bddvars = array("id", "ref", "raison", "entreprise", "siret", "nom", "prenom", "telfixe", "telport", "email", "motdepasse", "adresse1", "adresse2", "adresse3", "cpostal", "ville", "pays", "parrain", "type", "pourcentage","token");
function Activation(){
$this->PluginsClassiques();
}
function init(){
$query=mysql_query("CREATE TABLE `attente` (
`id` int(11) NOT NULL auto_increment,
`ref` text NOT NULL,
`raison` smallint(6) NOT NULL default '0',
`entreprise` text NOT NULL,
`siret` text NOT NULL,
`nom` text NOT NULL,
`prenom` text NOT NULL,
`adresse1` varchar(40) NOT NULL default '',
`adresse2` varchar(40) NOT NULL default '',
`adresse3` varchar(40) NOT NULL default '',
`cpostal` varchar(10) NOT NULL default '',
`ville` varchar(30) NOT NULL default '',
`pays` mediumint(9) NOT NULL default '0',
`telfixe` text NOT NULL,
`telport` text NOT NULL,
`email` text NOT NULL,
`motdepasse` text NOT NULL,
`parrain` int(11) NOT NULL default '0',
`type` smallint(6) NOT NULL default '0',
`pourcentage` int(11) NOT NULL default '0',
`token` text NOT NULL,
PRIMARY KEY (`id`)
)");
$message = new Message();
if($message->charger("mailactivation")) return;
$message->nom = "mailactivation";
$lastid = $message->add();
$messagedesc = new Messagedesc();
$messagedesc->message = $lastid;
$messagedesc->lang = 1;
$messagedesc->titre = "Activation";
$messagedesc->chapo = "";
$messagedesc->description = "Bonjour __RAISON__ __NOM__,\n Pour activer votre compte veuillez cliquer sur le lien suivant __ADRESSE__ \nMerci";
$messagedesc->add();
}
function charger($id){
return $this->getVars("select * from $this->table where id=$id");
}
function charger_mail($email){
return $this->getVars("select * from $this->table where email=\"$email\"");
}
function action(){
global $action;
if($action == "activation"){
$this->charger($_REQUEST["id"]);
$client = $this->inverse();
if($_REQUEST["token"] == $this->token){
$client->add();
$tclient = new Client();
$tclient->charger_mail($client->email);
$this->delete();
$_SESSION["navig"]->client = $tclient;
$_SESSION["navig"]->connecte=1;
redirige(urlfond("confirmation"));//rediriection sur une page annonçant que le client a bien active son compte
}
}
}
function apresclient(){
$client = new Client();
$client->charger_mail($_SESSION["navig"]->client->email);
$this->correspondance($client);
$this->token = gencode(30);
$enr = $this->add();
$this->charger_mail($this->email);
$client->delete();
//Envoi du mail pour activation du client
$message = new Message();
$message->charger("mailactivation");
$messagedesc = new Messagedesc();
$messagedesc->charger($message->id);
$body = $messagedesc->description;
$urlsite = new Variable();
$urlsite->charger("urlsite");
$nomsite = new Variable();
$nomsite->charger("nomsite");
$emailcontact = new Variable();
$emailcontact->charger("emailcontact");
$adresse = $urlsite->valeur."/?fond=confirmation&action=activation&id=".$this->id."&token=".$this->token;
switch($this->raison){
case 1: $civi="Madame";
break;
case 2: $civi="Mademoiselle";
break;
case 3: $civi="Monsieur";
break;
default: $civi="";
break;
}
$body = str_replace("__ADRESSE__",$adresse,$body);
$body = str_replace("__RAISON__",$civi,$body);
$body = str_replace("__NOM__",$this->nom,$body);
$body = str_replace("__PRENOM__",$this->prenom,$body);
Mail::envoyer (
"$client->prenom $client->nom", $this->email,
$urlsite->valeur, $emailcontact->valeur,
"confirmation inscription",
nl2br($body), $body
);
$_SESSION['navig']->client = new Client();
$_SESSION['navig']->connecte = 0;
redirige(urlfond("nouveau"));//redirection sur une page annonçant qu'1 email vient d'etre envoye pour activation
}
function correspondance($client){
$this->ref = $client->ref;
$this->raison = $client->raison;
$this->entreprise = $client->entreprise;
$this->siret = $client->siret;
$this->nom = $client->nom;
$this->prenom = $client->prenom;
$this->adresse1 = $client->adresse1;
$this->adresse2 = $client->adresse2;
$this->adresse3 = $client->adresse3;
$this->cpostal = $client->cpostal;
$this->ville = $client->ville;
$this->pays = $client->pays;
$this->telfixe = $client->telfixe;
$this->telport = $client->telport;
$this->email = $client->email;
$this->motdepasse = $client->motdepasse;
$this->parrain=$client->parrain;
$this->type = $client->type;
$this->pourcentage = $client->pourcentage;
}
function inverse(){
$client = new Client();
$client->ref = $this->ref;
$client->raison = $this->raison;
$client->entreprise = $this->entreprise;
$client->siret = $this->siret;
$client->nom = $this->nom;
$client->prenom = $this->prenom;
$client->adresse1 = $this->adresse1;
$client->adresse2 = $this->adresse2;
$client->adresse3 = $this->adresse3;
$client->cpostal = $this->cpostal;
$client->ville = $this->ville;
$client->pays = $this->pays;
$client->telfixe = $this->telfixe;
$client->telport = $this->telport;
$client->email = $this->email;
$client->motdepasse = $this->motdepasse;
$client->parrain=$this->parrain;
$client->type = $this->type;
$client->pourcentage = $this->pourcentage;
return $client;
}
}
?>
Ce que j'ai aprés téléchargement dans le validcli.class.php est :
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) Octolys Development */
/* email : thelia@octolys.fr */
/* web : http://www.octolys.fr */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/*************************************************************************************/
?>
<?php
include_once(realpath(dirname(__FILE__)) . "/../../../classes/PluginsClassiques.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Client.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Message.class.php");
include_once(realpath(dirname(__FILE__)) . "/../../../classes/Messagedesc.class.php");
class Validcli extends PluginsClassiques{
function Validcli(){
$this->PluginsClassiques();
}
function init(){
$message = new Message();
if($message->charger("mailactive")) return;
$message->nom = "mailactive";
$lastid = $message->add();
$messagedesc = new Messagedesc();
$messagedesc->message = $lastid;
$messagedesc->lang = 1;
$messagedesc->titre = "Activation compte";
$messagedesc->chapo = "";
$messagedesc->description = "Après vérification, votre compte a été activé. Merci.";
$messagedesc->add();
}
function destroy(){
}
function apresclient($client){
$_SESSION['navig']->connecte = 0;
$_SESSION['navig']->client = new Client();
$client->email = $valid_chainesecu . $client->email;
$client->maj();
}
}
?>
Est ce que je remplace directement l'un par l'autre ?
Je vois pas apparaitre la fonction qui crée la table "attente" dans le module téléchargé....
La discussion a eu lieu en février 2012 est ce que depuis y a eu un chamboulement ?
A mon niveau, j'ai installé le plugin tel que téléchargé sans difficulté, les inscriptions ne se font pas automatiquement aprés saisie des champs mais :
- par défaut le statut du client qui s'inscrit est "activé" du coup s'il rentre à la main son mail et son mot de passe juste aprés avoir envoyé le formulaire il peut se connecter :-(
- il n'y a aucun mail envoyé quel que soit le cas et en particulier quand je change le statut d'un client... Une fois, j'ai eu le message d'erreur suivant :
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files (x86)\EasyPHP-5.3.9\www\essais2\client\plugins\validcli\validcli_admin.php on line 27
HELP...
En local avec Easyphp sous thélia 1.5 pas de plugin autres...
Last edited by Madrilene (02-04-2012 21:09:25)