<?
/* ----------------------------------------------------------------------------
I N S T A L L A T I O N
- Configuration -
PHPMyRing (4.1) dernière modification du fichier [11-07-2003]
---------------------------------------------------------------------------- */
session_start();
require('top.php');
?>
<div class="bienvenue">
<? echo _("Configuration du webring"); //configuration ?>
</div>
<div class="droite">
<?
if (!session_is_registered("idadm"))
{
/////////////////////////////////////
// Authentification //
/////////////////////////////////////
// Le formulaire si le contenu est vide
if ((!$pseudook) or (!$passok))
{
$erreur = _("Champs vides!"); //champs_vides
include('formauth.php');
echo "</div>";
include('bottom.php');
exit;
}
// Vérification de l'accès...
connecte();
$res=requete("SELECT idadm,nomadm FROM webring_adm WHERE loginadm='$pseudook' AND passadm='$passok'");
$machin=mysql_fetch_array($res);
$idadm=$machin['idadm'];
if (mysql_num_rows($res)==1)
{
// Identification ok
session_start();
$nomadm=$machin['nomadm'];
session_register('idadm','nomadm');
addinlog("../","Connexion de l'administrateur $nomadm","OK");
echo _("Authentification OK!");
echo "<br />";
echo "<a href=".$PHP_SELF.">"._("Cliquez ici pour continuer.")."</a>";
//authentification_ok_continue
}
else
{
// login incorrect!!!!
echo _("Login et/ou mot de passe incorrect.");//login_erreur
include('formauth.php');
echo "</div>";
include('bottom.php');
exit;
}
// Fin du if !session register
}
else
{
// Nous allons déterminer s'il s'agit d'une mise à jour ou d'une installation.
// Non, finalement, on va le faire à la volée...
// Bien réfléchit on va essayer de faire ça plus fun
echo _("Recherche d'une version antérieure"); //recherche_ancien
echo "<br />";
$link=connecte();
$res=requete("SHOW TABLES");
// On ne sait pas si les tables existent....
$webring=0;
$webring_adm=0;
$webring_conf=0;
$webring_com=0;
while ($tables=mysql_fetch_array($res))
{
if ($tables[0]=="webring")
{
echo _("La table <code>webring</code> a été trouvée!"); //table_webring
echo "<br />";
// On incrémente notre variable
$webring=1;
}
elseif ($tables[0]=="webring_com")
{
echo _("La table <code>webring_com</code> a été trouvée!"); //table_webring_com
echo "<br />";
// On incrémente notre variable
$webring_com=1;
}
elseif ($tables[0]=="webring_adm")
{
echo _("La table <code>webring_adm</code> a été trouvée!"); //table_webring_adm
echo "<br />";
// On incrémente notre variable
$webring_adm=1;
}
elseif ($tables[0]=="webring_conf")
{
echo _("La table <code>webring_conf</code> a été trouvée!"); //table_webring_conf
echo "<br />";
// On incrémente notre variable
$webring_conf=1;
}
}
// Maintenant, nous allons créer les tables manquantes
if ($webring_adm==0)
{
echo _("La table <code>webring_adm</code> n'a pas été trouvée. Il y a un problème. Veuillez me contacter de toute urgence à phpmyring_at_microniko.net!!!"); //creation_webring_adm
echo "<br />";
// Si cette table n'existe pas, c'est pas normal du tout!!!!
session_destroy;
require('bottom.php');
exit;
}
if ($webring==0)
{
echo _("La table <code>webring</code> n'existe pas, elle est créée");//creation_webring
echo "<br />";
requete("CREATE TABLE webring
(
idsite SMALLINT NOT NULL auto_increment unique,
site_nom VARCHAR(100) NOT NULL unique,
url VARCHAR(100) NOT NULL unique,
description VARCHAR(254) NOT NULL,
webmaster VARCHAR(50) NOT NULL,
email VARCHAR(50) NOT NULL unique,
pseudo VARCHAR(20) NOT NULL unique,
mdp VARCHAR(20) NOT NULL,
visites SMALLINT(4) DEFAULT '0',
date DATE NOT NULL DEFAULT '0000-00-00',
page VARCHAR(254),
accept TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (idsite)
)");
}
if ($webring_com==0)
{
echo _("La table <code>webring_com</code> n'existe pas, elle est créée"); //creation_webring_com
echo "<br />";
requete("CREATE TABLE webring_com
(
idcom TINYINT NOT NULL AUTO_INCREMENT,
idsite TINYINT NOT NULL,
auteur VARCHAR(15) NOT NULL,
texte CHAR(255) NOT NULL,
note SMALLINT(2) DEFAULT '0',
date DATE NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY(idcom)
)");
}
if ($webring_conf==0)
{
echo _("La table <code>webring_conf</code> n'existe pas, elle est créée"); //creation_webring_conf
echo "<br />";
requete("CREATE TABLE webring_conf (
idconf tinyint(4) NOT NULL auto_increment,
lang char(3) NOT NULL default '',
mailadm varchar(35) NOT NULL default 'all',
signature tinytext NOT NULL,
adresse_site varchar(100) NOT NULL default '',
dossierwr varchar(50) NOT NULL default '',
type varchar(50) NOT NULL default '',
nomwr varchar(35) NOT NULL default '',
jrnew smallint(2) default '7',
classement varchar(15) default NULL,
nbre smallint(2) NOT NULL default '0',
nbre_rech smallint(2) NOT NULL default '5',
ordre varchar(4) NOT NULL default '',
msg_acc mediumtext NOT NULL,
msg_desac mediumtext NOT NULL,
msg_supp_script mediumtext NOT NULL,
msg_insc mediumtext NOT NULL,
msg_refus mediumtext NOT NULL,
msg_supp_decision mediumtext NOT NULL,
rappel_ident mediumtext NOT NULL,
version varchar(6) default NULL,
PRIMARY KEY (idconf)
)");
}
// Maintenant, la configuration
// Nous allons rechercher s'il existe déjà une configuration
$res=requete("SELECT * FROM webring_conf WHERE idconf=1");
$idconf=mysql_fetch_array($res);
if ($idconf)
{
// Il existe une configuration antérieure
// On va la chercher
echo _("Une configuration antérieure a été trouvée, PHP My Ring va la récupérer, veuillez vérifier que tout est correct."); //recup_config
echo "<div class=\"message-info-actions\" style=\"width: 400px; height: 70px; margin: 0px;margin-top: 10px; padding-left: 50px;\">";
echo _("Attention, si vous mettez à jour une version antérieure à la 4.1.1, vous devez remplacer le symbole € par le signe dièse (#) dans les variables pour des questions de compatibilité."); //attention_euro
echo "</div>";
$conf=config();
// Variable pour la requète
$commande_sql="REPLACE";
echo "<br />";
}
else
{
echo _("Aucune configuration n'a été retrouvée. Veuillez compléter le fomulaire suivant."); //pas_recup_config
// Variable pour la requète
$commande_sql="INSERT";
}
mysql_close($link);
// Et maintenant, on affiche le formulaire
$action_formconf="fin.php";
include('formconfiguration.php');
/////////////////////////////////////
// Contenu de la page //
/////////////////////////////////////
// Fin du else dun contenu de la page
}
?>
</div>
<?
require('bottom.php');
?>