diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3 index 311a2be6b90ee4ea0e11150ef8411be20cd2c8ee..488ca57706f862c7e4e2b92be00654dbf871092f 100644 --- a/ecrire/inc_version.php3 +++ b/ecrire/inc_version.php3 @@ -552,20 +552,33 @@ if (!$PATH_TRANSLATED) { } # obsoletes: utiliser les constantes ci-dessus. -# Conserver pour compatibité vieilles contrib uniquement +# Conserver pour compatibilite vieilles contrib uniquement $flag_ecrire = !@file_exists(_DIR_RESTREINT_ABS . 'inc_version.php3'); $dir_ecrire = (ereg("/ecrire/", $GLOBALS['REQUEST_URI'])) ? '' : 'ecrire/'; // API d'appel a la base de donnees function spip_query($query) { - if (!_FILE_CONNECT) {$GLOBALS['db_ok'] = false; return;} - include_local(_FILE_CONNECT); - if (!$GLOBALS['db_ok']) return; + + // Essaie de se connecter + if (_FILE_CONNECT) + include_local(_FILE_CONNECT); + else + // installation ? + if (_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP) + include_local(_FILE_CONNECT_INS . _FILE_TMP . _EXTENSION_PHP); + + // Erreur de connexion + if (!$GLOBALS['db_ok']) + return; + + // Vieux format de fichier connexion if ($GLOBALS['spip_connect_version'] < 0.1) { if (!_DIR_RESTREINT) {$GLOBALS['db_ok'] = false; return;} @Header("Location: upgrade.php3?reinstall=oui"); exit; } + + // Faire la requete return spip_query_db($query); } diff --git a/inc-public.php3 b/inc-public.php3 index 6d47354a1119b144da916205a6ec3fb2c6a5ff3a..9d1d794e8e8b4b37d6601629a34d8abdee196df0 100644 --- a/inc-public.php3 +++ b/inc-public.php3 @@ -6,6 +6,7 @@ if (function_exists('inclure_page_lang')) inclure_page_lang($fond, $delais, $contexte_inclus); else { + define ("_INC_PUBLIC", 1); include ("ecrire/inc_version.php3"); include_local('inc-public-global.php3');