[SPIP] ~maj v2.1.25-->2.1.26
[velocampus/web/www.git] / www / ecrire / exec / convert_utf8.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
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 // En cas d'erreur, une page admin normale avec bouton de retour
16
17 // http://doc.spip.org/@convert_utf8_non
18 function convert_utf8_non($action, $message) {
19
20 echo minipres($action, ('<p>'.$message. "</p>\n<p style='text-align: right'><a href='" . generer_url_ecrire("config_lang"). "'> &gt;&gt; "._T('icone_retour')."</a></p>"));
21 }
22
23 // http://doc.spip.org/@exec_convert_utf8_dist
24 function exec_convert_utf8_dist() {
25 include_spip('inc/minipres');
26 include_spip('inc/charsets');
27
28 // Definir le titre de la page (et le nom du fichier admin)
29 $action = _T('utf8_convertir_votre_site');
30
31 // si meta deja la, c'est une reprise apres timeout.
32 if ($GLOBALS['meta']['convert_utf8'] AND $GLOBALS['meta']['admin']) {
33 $admin = charger_fonction('admin', 'inc');
34 echo $admin('convert_utf8', $action, '', true);
35 } else {
36 $charset_orig = $GLOBALS['meta']['charset'];
37 // tester si le charset d'origine est connu de spip
38 if (!load_charset($charset_orig))
39 convert_utf8_non($action,
40 _T('utf8_convert_erreur_orig', array('charset' => "<b>".$charset_orig."</b>")));
41
42 // ne pas convertir si deja utf8
43 // ou si l'interface du serveur ne comprend rien
44 else if (($charset_orig == 'utf-8'))
45 convert_utf8_non($action,
46 _T('utf8_convert_erreur_deja',
47 array('charset' => $charset_orig)));
48 else if(!sql_get_charset('utf-8'))
49 convert_utf8_non($action,
50 _L('Votre version du serveur SQL ne gere pas les charset'));
51 else {
52 $commentaire = _T('utf8_convert_avertissement',
53 array('orig' => $charset_orig,'charset' => 'utf-8'));
54 $commentaire .= "<small>"
55 . http_img_pack('warning.gif', _T('info_avertissement'), "style='width: 48px; height: 48px; float: right;margin: 10px;'");
56 $commentaire .= _T('utf8_convert_backup', array('charset' => 'utf-8'))
57 ."</small>";
58 $commentaire .= '<br />'._T('utf8_convert_timeout');
59 $commentaire .= "<hr />\n";
60
61 $admin = charger_fonction('admin', 'inc');
62 echo $admin('convert_utf8', $action, $commentaire);
63 }
64 }
65 }
66 ?>