3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2014 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 include_spip('inc/headers');
16 include_spip('inc/acces');
18 // Mise en place des fichiers de configuration si ce n'est fait
20 // http://doc.spip.org/@install_etape_fin_dist
21 function install_etape_fin_dist()
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
);
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
);
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);
49 // Verifier la securite des htaccess
50 // Si elle ne fonctionne pas, prevenir
51 $msg = install_verifier_htaccess();
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');
60 function install_verifier_htaccess()
62 if (verifier_htaccess(_DIR_TMP
, true)
63 AND verifier_htaccess(_DIR_CONNECT
, true))
66 $titre = _T('htaccess_inoperant');
68 $averti = _T('htaccess_a_simuler',
69 array('htaccess' => '<tt>' . _ACCESS_FILE_NAME
. '</tt>',
70 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>',
71 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>'));
73 return "<p class='resultat echec'>$titre</p><p>$averti</p>";