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=pmb_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
@pmb_mysql_select_db($dbnamedbhost, $link) 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=pmb_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";
@pmb_mysql_query($ligne,$link);
$ligne = "CREATE DATABASE $dbname ";
$ligne.= "character set utf8 COLLATE utf8_unicode_ci";
if (!pmb_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' ";
pmb_mysql_query($sql_userbibli,$link);
pmb_mysql_query("flush privileges ",$link);
pmb_mysql_close($link); // fermeture de la connexion en tant que root
@$link=pmb_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
@pmb_mysql_select_db($dbname, $link) or die("Impossible de se connecter à la base de données $dbname");
pmb_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 && !$data_test_zen){
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_zen=="1") {
if (restore("biblizen.sql")) print $msg_crea_35;
else print $msg_crea_36;
}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;
}
if(!isset($indexint)){
$indexint="aucun";
}
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 = pmb_mysql_query($rqt, $link);
$rqt = "update parametres set valeur_param='1' where type_param='opac' and sstype_param='show_marguerite_browser' " ;
$result = pmb_mysql_query($rqt, $link);
$rqt = "update parametres set valeur_param='0' where type_param='opac' and sstype_param='show_categ_browser' " ;
$result = pmb_mysql_query($rqt, $link);
break;
case 'aucun' :
print $msg_crea_29;
break;
}
}
//Mise à jour du mot de passe admin
@pmb_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 = pmb_mysql_query($query, $link);
$data = pmb_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) ;
}
pmb_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);
}
}
?>