[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / install / etape_fin.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 include_spip('inc/headers');
16 include_spip('inc/acces');
17
18 // Mise en place des fichiers de configuration si ce n'est fait
19
20 // http://doc.spip.org/@install_etape_fin_dist
21 function install_etape_fin_dist()
22 {
23 ecrire_acces();
24
25 $f = str_replace( _FILE_TMP_SUFFIX, '.php', _FILE_CHMOD_TMP);
26 if (file_exists(_FILE_CHMOD_TMP)) {
27 if (!@rename(_FILE_CHMOD_TMP, $f)) {
28 if (@copy(_FILE_CHMOD_TMP, $f))
29 spip_unlink(_FILE_CHMOD_TMP);
30 }
31 }
32
33 $f = str_replace( _FILE_TMP_SUFFIX, '.php', _FILE_CONNECT_TMP);
34 if (file_exists(_FILE_CONNECT_TMP)) {
35 spip_log("renomme $f");
36 if (!@rename(_FILE_CONNECT_TMP, $f)) {
37 if (@copy(_FILE_CONNECT_TMP, $f))
38 @spip_unlink(_FILE_CONNECT_TMP);
39 }
40 }
41
42 // creer le repertoire cache, qui sert partout !
43 // deja fait en etape 4 en principe, on garde au cas ou
44 if(!@file_exists(_DIR_CACHE)) {
45 $rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE);
46 $rep = sous_repertoire(_DIR_TMP, $rep, true,true);
47 }
48
49 // Verifier la securite des htaccess
50 // Si elle ne fonctionne pas, prevenir
51 $msg = install_verifier_htaccess();
52 if ($msg) {
53 $cible = _T('public:accueil_site');
54 $cible = generer_form_ecrire('accueil', '','', $cible);
55 echo minipres('AUTO', $msg . $cible);
56 // ok, deboucher dans l'espace prive
57 } else redirige_url_ecrire('accueil');
58 }
59
60 function install_verifier_htaccess()
61 {
62 if (verifier_htaccess(_DIR_TMP, true)
63 AND verifier_htaccess(_DIR_CONNECT, true))
64 return '';
65
66 $titre = _T('htaccess_inoperant');
67
68 $averti = _T('htaccess_a_simuler',
69 array('htaccess' => '<tt>' . _ACCESS_FILE_NAME . '</tt>',
70 'constantes' => '<tt>_DIR_TMP &amp; _DIR_CONNECT</tt>',
71 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>'));
72
73 return "<p class='resultat echec'>$titre</p><p>$averti</p>";
74 }
75 ?>