1 |
<?php
|
1 |
<?php
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
4 |
// | PHP version 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
8 |
// | This library is free software; you can redistribute it and/or |
|
8 |
// | This library is free software; you can redistribute it and/or |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
10 |
// | License as published by the Free Software Foundation; either |
|
10 |
// | License as published by the Free Software Foundation; either |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
12 |
// | |
|
12 |
// | |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
// | Lesser General Public License for more details. |
|
16 |
// | Lesser General Public License for more details. |
|
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: inscription.fonct.spip.php,v 1.2 2006-03-15 11:03:34 alexandre_tb Exp $
|
22 |
// CVS : $Id: inscription.fonct.spip.php,v 1.3 2007-04-06 08:35:46 neiluj Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Fonctions wikini
|
24 |
* Fonctions wikini
|
25 |
*
|
25 |
*
|
26 |
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
|
26 |
* Ce fichier propose 3 fonctions pour intervenir sur la table interwikini_users.
|
27 |
*
|
27 |
*
|
28 |
*@package inscription
|
28 |
*@package inscription
|
29 |
*@subpackage fonctions_wikini
|
29 |
*@subpackage fonctions_wikini
|
30 |
//Auteur original :
|
30 |
//Auteur original :
|
31 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
31 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
32 |
//Autres auteurs :
|
32 |
//Autres auteurs :
|
33 |
*@author Aucun
|
33 |
*@author Aucun
|
34 |
*@copyright Tela-Botanica 2000-2004
|
34 |
*@copyright Tela-Botanica 2000-2004
|
35 |
*@version $Revision: 1.2 $ $Date: 2006-03-15 11:03:34 $
|
35 |
*@version $Revision: 1.3 $ $Date: 2007-04-06 08:35:46 $
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
*/
|
37 |
*/
|
38 |
|
38 |
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// | ENTETE du PROGRAMME |
|
40 |
// | ENTETE du PROGRAMME |
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
42 |
|
42 |
|
43 |
// +------------------------------------------------------------------------------------------------------+
|
43 |
// +------------------------------------------------------------------------------------------------------+
|
44 |
// | LISTE de FONCTIONS |
|
44 |
// | LISTE de FONCTIONS |
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
46 |
|
46 |
|
47 |
function inscription_spip($id, &$valeur)
|
47 |
function inscription_spip($id, &$valeur)
|
48 |
{
|
48 |
{
|
49 |
|
49 |
|
50 |
// Requete pour inscrire dans SPIP
|
50 |
// Requete pour inscrire dans SPIP
|
51 |
if (isset ($valeur['nomwiki'])) {
|
51 |
if (isset ($valeur['nomwiki'])) {
|
52 |
$login = $valeur['nomwiki'] ;
|
52 |
$login = $valeur['nomwiki'] ;
|
53 |
} else {
|
53 |
} else {
|
54 |
$login = $valeur['email'] ;
|
54 |
$login = $valeur['email'] ;
|
55 |
}
|
55 |
}
|
56 |
$requete = "insert into spip_auteurs set id_auteur=$id, nom=\"".$valeur['prenom']." ".$valeur['nom'].
|
56 |
$requete = "insert into spip_auteurs set id_auteur=$id, nom=\"".$valeur['prenom']." ".$valeur['nom'].
|
57 |
"\",email=\"".$valeur['email']."\",login=\"".$login.
|
57 |
"\",email=\"".$valeur['email']."\",login=\"".$login.
|
58 |
"\", pass=\"".md5($valeur['mot_de_passe'])."\", statut=\"nouveau\", lang=\"".
|
58 |
"\", pass=\"".md5($valeur['password'])."\", statut=\"nouveau\", lang=\"".
|
59 |
strtolower($valeur['pays'])."\"" ;
|
59 |
strtolower($valeur['pays'])."\"" ;
|
60 |
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
|
60 |
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
|
61 |
}
|
61 |
}
|
62 |
|
62 |
|
63 |
function mod_inscription_spip($id, &$valeur)
|
63 |
function mod_inscription_spip($id, &$valeur)
|
64 |
{
|
64 |
{
|
65 |
if (isset ($valeur['nomwiki'])) {
|
65 |
if (isset ($valeur['nomwiki'])) {
|
66 |
$login = $valeur['nomwiki'] ;
|
66 |
$login = $valeur['nomwiki'] ;
|
67 |
} else {
|
67 |
} else {
|
68 |
$login = $valeur['email'] ;
|
68 |
$login = $valeur['email'] ;
|
69 |
}
|
69 |
}
|
70 |
//BIEN METTRE alea_actuel, htpass ET alea_futur À ""
|
70 |
//BIEN METTRE alea_actuel, htpass ET alea_futur À ""
|
71 |
$requete = "update spip_auteurs set nom=\"".$valeur['prenom']." ".$valeur['nom'].
|
71 |
$requete = "update spip_auteurs set nom=\"".$valeur['prenom']." ".$valeur['nom'].
|
72 |
"\",email=\"".$valeur['email']."\",login=\"".$login.
|
72 |
"\",email=\"".$valeur['email']."\",login=\"".$login.
|
73 |
"\", pass=\"".md5($valeur['mot_de_passe'])."\", htpass=\"\", alea_actuel=\"\", alea_futur=\"\", lang=\"fr\" where id_auteur=$id" ;
|
73 |
"\", pass=\"".md5($valeur['password'])."\", htpass=\"\", alea_actuel=\"\", alea_futur=\"\", lang=\"fr\" where id_auteur=$id" ;
|
74 |
//echo $requete;
|
74 |
//echo $requete;
|
75 |
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
|
75 |
@mysql_query($requete) or die ("$requete<br>Echec <br>".mysql_error()) ;
|
76 |
}
|
76 |
}
|
77 |
function desinscription_spip($id_utilisateur)
|
77 |
function desinscription_spip($id_utilisateur)
|
78 |
{
|
78 |
{
|
79 |
$requete = 'delete from spip_auteurs where id_auteur='.$id_utilisateur ;
|
79 |
$requete = 'delete from spip_auteurs where id_auteur='.$id_utilisateur ;
|
80 |
@mysql_query($requete) or die ("$requete<br>Echec de la requête de mise à la poubelle de l'utilisateur dans spip <br>".mysql_error()) ;
|
80 |
@mysql_query($requete) or die ("$requete<br>Echec de la requête de mise à la poubelle de l'utilisateur dans spip <br>".mysql_error()) ;
|
81 |
}
|
81 |
}
|
82 |
|
82 |
|
83 |
function spip_cookie() {
|
83 |
function spip_cookie() {
|
84 |
if ($userid != 0) {
|
84 |
if ($userid != 0) {
|
85 |
setcookie("spip_admin", "@$login", time()+3600*24*30, INS_CHEMIN_SPIP) ;
|
85 |
setcookie("spip_admin", "@$login", time()+3600*24*30, "/vecam/") ;
|
86 |
include ("ecrire/inc_version.php3");
|
86 |
include ("ecrire/inc_version.php3");
|
87 |
include_ecrire ("inc_meta.php3");
|
87 |
include_ecrire ("inc_meta.php3");
|
88 |
include_ecrire ("inc_session.php3");
|
88 |
include_ecrire ("inc_session.php3");
|
89 |
$query = "SELECT * FROM spip_auteurs WHERE id_auteur=$userid";
|
89 |
$query = "SELECT * FROM spip_auteurs WHERE id_auteur=$userid";
|
90 |
$result = mysql_query($query);
|
90 |
$result = mysql_query($query);
|
91 |
$GLOBALS['auteur_session'] = mysql_fetch_array($result) ;
|
91 |
$GLOBALS['auteur_session'] = mysql_fetch_array($result) ;
|
92 |
$GLOBALS['auteur_session']['statut'] = "1comite" ;
|
92 |
$GLOBALS['auteur_session']['statut'] = "1comite" ;
|
93 |
$GLOBALS['auteur_session']['lang'] = "en" ;
|
93 |
$GLOBALS['auteur_session']['lang'] = "en" ;
|
94 |
|
94 |
|
95 |
if (!$HTTP_COOKIE_VARS["spip_session"]) {
|
95 |
if (!$HTTP_COOKIE_VARS["spip_session"]) {
|
96 |
$id_session = $userid."_".(md5 (uniqid (rand ())));
|
96 |
$id_session = $userid."_".(md5 (uniqid (rand ())));
|
97 |
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
|
97 |
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
|
98 |
} else {
|
98 |
} else {
|
99 |
$id_session = preg_replace("/[0-9]+_/", $userid."_", $HTTP_COOKIE_VARS["spip_session"]) ;
|
99 |
$id_session = preg_replace("/[0-9]+_/", $userid."_", $HTTP_COOKIE_VARS["spip_session"]) ;
|
100 |
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
|
100 |
setcookie("spip_session", $id_session, time()+3600*24*30, "/vecam/") ;
|
101 |
}
|
101 |
}
|
102 |
ajouter_session($GLOBALS['auteur_session'], $id_session) ;
|
102 |
ajouter_session($GLOBALS['auteur_session'], $id_session) ;
|
103 |
}
|
103 |
}
|
104 |
}
|
104 |
}
|
105 |
|
105 |
|
106 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
106 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
107 |
*
|
107 |
*
|
108 |
* $Log: not supported by cvs2svn $
|
108 |
* $Log: not supported by cvs2svn $
|
109 |
* Revision 1.1 2005/09/22 14:02:49 ddelon
|
109 |
* Revision 1.1 2005/09/22 14:02:49 ddelon
|
110 |
* nettoyage annuaire et php5
|
110 |
* nettoyage annuaire et php5
|
111 |
*
|
111 |
*
|
112 |
* Revision 1.4 2005/09/22 13:30:49 florian
|
112 |
* Revision 1.4 2005/09/22 13:30:49 florian
|
113 |
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
|
113 |
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
|
114 |
*
|
114 |
*
|
115 |
* Revision 1.2 2005/03/21 16:57:30 florian
|
115 |
* Revision 1.2 2005/03/21 16:57:30 florian
|
116 |
* correction de bug, mise à jour interface
|
116 |
* correction de bug, mise à jour interface
|
117 |
*
|
117 |
*
|
118 |
* Revision 1.1 2004/12/15 13:32:25 alex
|
118 |
* Revision 1.1 2004/12/15 13:32:25 alex
|
119 |
* version initiale
|
119 |
* version initiale
|
120 |
*
|
120 |
*
|
121 |
* Revision 1.1 2004/07/06 15:42:17 alex
|
121 |
* Revision 1.1 2004/07/06 15:42:17 alex
|
122 |
* en cours
|
122 |
* en cours
|
123 |
*
|
123 |
*
|
124 |
* Revision 1.2 2004/06/25 14:25:27 alex
|
124 |
* Revision 1.2 2004/06/25 14:25:27 alex
|
125 |
* modification de la requete de suppresssion
|
125 |
* modification de la requete de suppresssion
|
126 |
*
|
126 |
*
|
127 |
* Revision 1.1 2004/06/18 09:20:48 alex
|
127 |
* Revision 1.1 2004/06/18 09:20:48 alex
|
128 |
* version initiale
|
128 |
* version initiale
|
129 |
*
|
129 |
*
|
130 |
*
|
130 |
*
|
131 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
131 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
132 |
*/
|
132 |
*/
|
133 |
|
133 |
|
134 |
|
134 |
|
135 |
|
135 |
|
136 |
|
136 |
|
137 |
?>
|
137 |
?>
|