Commit | Line | Data |
---|---|---|
c495c100 P |
1 | <?php |
2 | ||
3 | /***************************************************************************\ | |
4 | * SPIP, Systeme de publication pour l'internet * | |
5 | * * | |
6 | * Copyright (c) 2001-2007 * | |
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * | |
8 | * * | |
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * | |
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * | |
11 | \***************************************************************************/ | |
12 | ||
13 | if (!defined("_ECRIRE_INC_VERSION")) return; | |
14 | ||
15 | // changer de langue espace prive (ou login) | |
16 | ||
17 | // http://doc.spip.org/@action_converser_dist | |
18 | function action_converser_dist() | |
19 | { | |
20 | ||
21 | $securiser_action = charger_fonction('securiser_action', 'inc'); | |
22 | $securiser_action(); | |
23 | ||
24 | if (_FILE_CONNECT AND $lang = _request('var_lang_ecrire')) { | |
25 | spip_query("UPDATE spip_auteurs SET lang = " . _q($lang) . " WHERE id_auteur = " . $GLOBALS['auteur_session']['id_auteur']); | |
26 | $GLOBALS['auteur_session']['lang'] = $lang; | |
27 | $session = charger_fonction('session', 'inc'); | |
28 | if ($spip_session = $session($GLOBALS['auteur_session'])) { | |
29 | preg_match(',^[^/]*//[^/]*(.*)/$,', | |
30 | url_de_base(), | |
31 | $r); | |
32 | include_spip('inc/cookie'); | |
33 | spip_setcookie('spip_session', $spip_session, time() + 3600 * 24 * 14, $r[1]); | |
34 | } | |
35 | } | |
36 | action_converser_post(); | |
37 | } | |
38 | ||
39 | // http://doc.spip.org/@action_converser_post | |
40 | function action_converser_post() | |
41 | { | |
42 | if ($lang = _request('var_lang_ecrire')) { | |
43 | include_spip('inc/lang'); | |
44 | include_spip('inc/cookie'); | |
45 | spip_setcookie('spip_lang_ecrire', $lang, time() + 365 * 24 * 3600); | |
46 | spip_setcookie('spip_lang', $lang, time() + 365 * 24 * 3600); | |
47 | } | |
48 | $redirect = rawurldecode(_request('url')); | |
49 | ||
50 | if (!$redirect) $redirect = _DIR_RESTREINT_ABS; | |
51 | $redirect = parametre_url($redirect,'lang',$lang,'&'); | |
52 | redirige_par_entete($redirect, true); | |
53 | } | |
54 | ||
55 | ?> |