lang = $lang charset = $charset
user = $user; password = $password; dbhost = $dbhost; dbname = $dbname
usersystem = $usermysql; passwordsystem = $passwordmysql; dbhost = $dbhost; dbnamesystem = $dbnamedbhost
";
include("./$lang/install_rep_inc.php");
if ($dbnamedbhost) {
@$link=mysql_connect($dbhost,$usermysql,$passwordmysql) or die("Impossible de se connecter au serveur MySql en tant qu'admin $usermysql "); // Le @ ordonne a php de ne pas afficher de message d'erreur
@mysql_select_db($dbnamedbhost) or die("Impossible de se connecter à la base de données $dbnamedbhost");
echo "
$msg_okconnect_usermysql";
create_db_param ($dbhost,$usermysql,$passwordmysql,$dbnamedbhost,$charset);
} else {
@$link=mysql_connect($dbhost,$usermysql,$passwordmysql) or die("Impossible de se connecter au serveur MySql en tant qu'admin $usermysql "); // Le @ ordonne a php de ne pas afficher de message d'erreur
$ligne = "DROP DATABASE $dbname";
@mysql_query($ligne,$link);
$ligne = "CREATE DATABASE $dbname ";
$ligne.= "character set utf8 COLLATE utf8_unicode_ci";
if (!mysql_query($ligne,$link)) {
echo $msg_nodb;
exit(0);
}
echo $msg_okdb;
$sql_userbibli="GRANT SELECT ,INSERT ,UPDATE ,DELETE ,CREATE ,DROP ,INDEX ,ALTER ,CREATE TEMPORARY TABLES ,LOCK TABLES ON ".$dbname.".* to $user@localhost identified by '$password' ";
mysql_query($sql_userbibli,$link);
mysql_query("flush privileges ",$link);
mysql_close($link); // fermeture de la connexion en tant que root
@$link=mysql_connect($dbhost,$user,$password) or die("Impossible de se connecter au serveur MySql en tant que $user "); // Le @ ordonne a php de ne pas afficher de message d'erreur
@mysql_select_db($dbname) or die("Impossible de se connecter à la base de données $dbname");
mysql_query("set names utf8 ", $link);
echo $msg_okconnect_user;
create_db_param ($dbhost,$user,$password,$dbname,$charset);
}
//Suppression des fichiers temporaires gestion opac
del_fic_temp("../opac_css/temp/");
//Suppression des fichiers temporaires gestion
del_fic_temp("../temp/");
if(!$data_test_cms){
if (restore("bibli.sql")) print $msg_crea_01;
else print $msg_crea_02;
if (restore("$lang/minimum.sql")) print $msg_crea_03;
else print $msg_crea_04;
}
if($data_test_cms=="1") {
if (restore("bibliportail.sql")) print $msg_crea_33;
else print $msg_crea_34;
}else if ($data_test=="1") {
if (restore("$lang/feed_essential.sql")) print $msg_crea_05;
else print $msg_crea_06;
if (restore("$lang/data_test.sql")) print $msg_crea_07;
else print $msg_crea_08;
if (restore("$lang/agneaux.sql")) print $msg_crea_09;
else $msg_crea_10;
if (restore("$lang/indexint_100.sql")) print $msg_crea_11;
else print $msg_crea_12;
} else {
if ($essential) {
if (restore("$lang/feed_essential.sql")) print $msg_crea_13;
else print $msg_crea_14;
}
switch ($thesaurus) {
case 'unesco' :
if (restore("./unesco.sql"))
print $msg_crea_15;
else print $msg_crea_16;
break;
case 'agneaux' :
if (restore("$lang/agneaux.sql"))
print $msg_crea_17;
else print $msg_crea_18;
break;
case 'environnement' :
if (restore("$lang/environnement.sql"))
print $msg_crea_19;
else print $msg_crea_20;
break;
}
switch ($indexint) {
case 'chambery' :
if (restore("$lang/indexint_chambery.sql")) print $msg_crea_23;
else print $msg_crea_24;
break;
case 'dewey' :
if (restore("$lang/indexint_dewey.sql")) print $msg_crea_25;
else print $msg_crea_26;
break;
case 'marguerite' :
if (restore("$lang/indexint_100.sql")) print $msg_crea_27;
else $msg_crea_28;
$rqt = "update parametres set valeur_param='0' where type_param='opac' and sstype_param='show_100cases_browser' " ;
$result = mysql_query($rqt, $link);
$rqt = "update parametres set valeur_param='1' where type_param='opac' and sstype_param='show_marguerite_browser' " ;
$result = mysql_query($rqt, $link);
$rqt = "update parametres set valeur_param='0' where type_param='opac' and sstype_param='show_categ_browser' " ;
$result = mysql_query($rqt, $link);
break;
case 'aucun' :
print $msg_crea_29;
break;
}
}
//Mise à jour du mot de passe admin
@mysql_query("UPDATE users SET pwd=PASSWORD('admin'), user_digest = '".md5("admin".":".md5("http://SERVER/DIRECTORY/").":"."admin")."' WHERE username='admin'",$link);
@rename ("./install.php","./noinstall.php");
@rename ("./install_rep.php","./noinstall_rep.php");
echo $msg_crea_30;
echo $msg_crea_31;
$query = "select valeur_param from parametres where type_param='pmb' and sstype_param='bdd_version' ";
$req = mysql_query($query, $link);
$data = mysql_fetch_array($req) ;
$version_pmb_bdd = $data['valeur_param'];
if ($version_pmb_bdd!=$pmb_version_database_as_it_should_be) {
echo str_replace("!!pmb_version!!",$version_pmb_bdd,$msg_crea_control_version) ;
}
mysql_close($link);
} else {
print $msg_crea_32;
}
function del_fic_temp($dir){
if($dh = opendir($dir)){
while(($file = readdir($dh))!== false){
if(file_exists($dir.$file) && preg_match("/^XML.*?\.tmp$/i",$file)){
@unlink($dir.$file);
}
}
closedir($dh);
}
}
?>