diff --git a/index.php b/index.php index 00de434..b6b065c 100644 --- a/index.php +++ b/index.php @@ -1,97 +1,109 @@ 'server', 'sqlite3' => 'sqlite', 'sqlite2' => 'sqlite2'); - if($type !== 'mysql') { - if (defined('_ROOT_CWD')){ - include_spip("inc/filtres_mini"); - $dir_base = _ROOT_CWD._DIR_ETC . 'bases/'; + if ($type !== 'mysql') { + if (defined('_ROOT_CWD')) { + include_spip('inc/filtres_mini'); + $dir_base = _ROOT_CWD . _DIR_ETC . 'bases/'; $dir_base = resolve_path($dir_base); - } - else + } else { $dir_base = $GLOBALS['adminer_racine'] . _NOM_PERMANENTS_INACCESSIBLES . 'bases/'; - - + } + $db = $dir_base . $db . '.sqlite'; } - if(!isset($drivers[$type])) die ('Type de base de données '.$type.' non reconnu'); - if ($port) $host.=':'.$port; + if (!isset($drivers[$type])) { + die('Type de base de données ' . $type . ' non reconnu'); + } + if ($port) { + $host .= ':' . $port; + } $_POST['auth'] = array( - "driver" => $drivers[$type], - "server"=> $host, - "username"=> $login, - "password"=>$pass, - "db"=>$db + 'driver' => $drivers[$type], + 'server' => $host, + 'username' => $login, + 'password' => $pass, + 'db' => $db ); } lire_fichier(_FILE_CONNECT, $connect); $connect = str_replace('spip_connect_db(', 'adminer_connect_db(', $connect); - eval('?'.'>'.$connect); + eval('?' . '>' . $connect); } -chdir (_DIR_PLUGIN_ADMINER); -session_name("adminer_sid"); - -if (defined('_ADMINER_VERROUILLER_DB')) $_GET['db'] = $GLOBALS['connexions'][0]["db"]; - -function adminer_object() { - // required to run any plugin - include_once "./plugins/plugin.php"; - - // autoloader - foreach (glob("plugins/*.php") as $filename) { - include_once "./$filename"; - } - - $plugins = array( - // specify enabled plugins here - new AdminerLoginSqlite(), - new AdminerAllowedDatabases(array($GLOBALS['connexions'][0]["db"])), - ); - - return new AdminerPlugin($plugins); +chdir(_DIR_PLUGIN_ADMINER); +session_name('adminer_sid'); + +if (defined('_ADMINER_VERROUILLER_DB')) { + $_GET['db'] = $GLOBALS['connexions'][0]['db']; } +function adminer_object() +{ + // required to run any plugin + include_once './plugins/plugin.php'; + + // autoloader + foreach (glob('plugins/*.php') as $filename) { + include_once "./$filename"; + } + + $plugins = array( + // specify enabled plugins here + new AdminerLoginSqlite(), + new AdminerAllowedDatabases(array($GLOBALS['connexions'][0]['db'])), + ); + + return new AdminerPlugin($plugins); +} require_once 'adminer.php';