3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2019 *
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')) {
17 include_spip('inc/headers');
18 include_spip('inc/acces');
20 // Mise en place des fichiers de configuration si ce n'est fait
22 // http://code.spip.net/@install_etape_fin_dist
23 function install_etape_fin_dist() {
26 $f = str_replace(_FILE_TMP_SUFFIX
, '.php', _FILE_CHMOD_TMP
);
27 if (file_exists(_FILE_CHMOD_TMP
)) {
28 if (!@rename
(_FILE_CHMOD_TMP
, $f)) {
29 if (@copy
(_FILE_CHMOD_TMP
, $f)) {
30 spip_unlink(_FILE_CHMOD_TMP
);
35 $f = str_replace(_FILE_TMP_SUFFIX
, '.php', _FILE_CONNECT_TMP
);
36 if (file_exists(_FILE_CONNECT_TMP
)) {
37 spip_log("renomme $f");
38 if (!@rename
(_FILE_CONNECT_TMP
, $f)) {
39 if (@copy
(_FILE_CONNECT_TMP
, $f)) {
40 @spip_unlink
(_FILE_CONNECT_TMP
);
45 // creer le repertoire cache, qui sert partout !
46 // deja fait en etape 4 en principe, on garde au cas ou
47 if (!@file_exists
(_DIR_CACHE
)) {
48 $rep = preg_replace(',' . _DIR_TMP
. ',', '', _DIR_CACHE
);
49 $rep = sous_repertoire(_DIR_TMP
, $rep, true, true);
52 // Verifier la securite des htaccess
53 // Si elle ne fonctionne pas, prevenir
54 $msg = install_verifier_htaccess();
56 $cible = _T('public:accueil_site');
57 $cible = generer_form_ecrire('accueil', '', '', $cible);
58 echo minipres('AUTO', $msg . $cible);
59 // ok, deboucher dans l'espace prive
61 redirige_url_ecrire('accueil');
65 function install_verifier_htaccess() {
66 if (verifier_htaccess(_DIR_TMP
, true)
67 and verifier_htaccess(_DIR_CONNECT
, true)
72 $titre = _T('htaccess_inoperant');
77 'htaccess' => '<tt>' . _ACCESS_FILE_NAME
. '</tt>',
78 'constantes' => '<tt>_DIR_TMP & _DIR_CONNECT</tt>',
79 'document_root' => '<tt>' . $_SERVER['DOCUMENT_ROOT'] . '</tt>'
83 return "<div class='error'><h3>$titre</h3><p>$averti</p></div>";