AEOS/install/index.php
2026-08-26 17:23:29 +02:00

237 lines
No EOL
9.5 KiB
PHP
Executable file

<?php
ob_start();
if (file_exists("../data/config.xml")){header('Location: ../index.php');}
require_once ('../lib/aeos.lib.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>AEOS | Installation</title>
<link rel="stylesheet" type="text/css" media="screen" href="../themes/system/styles.css" />
<link rel="stylesheet" type="text/css" media="screen" href="install.css" />
<link rel="icon" type="image/png" href="../themes/defaut/images/favicon_aeos.ico" />
</head>
<body>
<div id="Layout"></div>
<div id="Administration">
<h1><img src="../themes/system/images/logo_black.png" alt="Logo AEOS" /></h1>
<h6>
<img src="../themes/system/images/icones/logout.png" alt="Logout" class="icon" />
Installation - AEOS
</h6>
<div id="Menu">
<ul>
<?php
if (!isset($_POST['lang'])) $langs="fr"; else $langs=$_POST['lang'];
require_once('lang/'.$langs.'/index.php');
$menuArray=array($lang['L_Inst_Etape'], $lang['L_Inst_Etape1'], $lang['L_Inst_Etape2'], $lang['L_Inst_Etape3'], $lang['L_Inst_Etape4']);
$l=0;
foreach ($menuArray as $menu)
{
if (@$_GET['etape']==$l){ ?><li class="Actif"><?php }
else { ?><li><?php }
echo $menu."</li>";
$l++;
}
?>
</ul>
</div>
<?php
!isset($_GET['etape'])?$etape=0:$etape=$_GET['etape'];
$PHPVersion = phpversion();
$PHPv = explode (".", $PHPVersion);
$install_conf = lecture_xml("base.xml");
switch ($etape)
{
// Prérequis -------------------------------------------------------------------------------------------------------------------------
case 0:
?>
<form method="POST" action="index.php?etape=0">
<p>
<select name="lang" class="input_select" onchange="this.form.submit();">
<option value="basic">-</option>
<?php
$list = listing_dossier("lang/");
foreach ($list as $pages)
{
$lg = lecture_xml('lang/'.$pages.'/lang.xml'); ?>
<option value="<?php echo $pages; ?>" <?php if($pages==@$_POST['lang']){echo "selected";}?>>
<?php echo $lg['lang']['title']['#text'];?>
</option><?php
} ?>
</select>
</p>
</form>
<form method="POST" action="index.php?etape=1">
<h3>AEOS v<?php echo $install_conf['configuration']['version']['#text'];?></h3>
<h4><?php echo $lang['L_Inst_bienvenue']; ?></h4>
<h5><?php echo $lang['L_Inst_instruction']; ?></h5>
<p><?php echo $lang['L_Inst_prerequis']; ?></p>
<table class="Full">
<tr>
<td><?php echo $lang['L_Inst_versionphp']; ?><?php echo $PHPVersion; ?></td>
<td>
<?php
if ($PHPv[0]>=5) {echo "<span class='valide'>OK</span><br />";}
else
{
$erreur=$lang['L_Inst_Msg_versionphp'];
echo "<span class='erreur'>".$lang['L_Inst_Msg_erreur']."</span><br />";
}
?>
</td>
</tr>
<tr>
<td><?php echo $lang['L_Inst_repdata']; ?> </td>
<td>
<?php
$chmod_data = substr(sprintf('%o', fileperms('../data')), -4);
if ($chmod_data<"0700")
{
$erreur=$lang['L_Inst_Msg_repdata'].$chmod_data;
echo "<span class='erreur'>".$lang['L_Inst_Msg_erreur']."</span>";
}
else echo "<span class='valide'>OK</span>";
?></td>
</tr>
</table>
<p>
<?php
if (isset($erreur))
{
echo "<span class='erreur'>".$erreur."</span>"; ?>
<input type="submit" value="<?php echo $lang['L_Mot_suivant']; ?>" class="input_button" disabled="disabled" /><?php
}
else
{ ?>
<input type="submit" value="<?php echo $lang['L_Mot_suivant']; ?>" class="input_button" /><?php
} ?>
<input type="hidden" name="lang" value="<?php if(!@isset($_POST['lang'])){echo "fr";}else{echo $_POST['lang'];} ?>" />
</p>
</form>
<?php
break;
// Etape 1 -------------------------------------------------------------------------------------------------------------------------
case 1:
?>
<form method="POST" action="index.php?etape=2">
<h3><?php echo $lang['L_Inst_confgen']; ?></h3>
<p><?php echo $lang['L_Inst_sitenom']; ?></p>
<p><input class="input_text" type="text" name="titre" /></p>
<p><?php echo $lang['L_Inst_descnom']; ?></p>
<p><input class="input_text" name="description" /></p>
<p>
<input type="button" value="<?php echo $lang['L_Mot_precedent']; ?>" onclick="javascript:history.back();" class="input_button" />
<input type="submit" value="<?php echo $lang['L_Mot_suivant']; ?>" class="input_button" />
<input type="hidden" name="lang" value="<?php if(!@isset($_POST['lang'])){echo "fr";}else{echo $_POST['lang'];} ?>" />
</p>
</form>
<?php
break;
// Etape 2 -------------------------------------------------------------------------------------------------------------------------
case 2:
?>
<form method="POST" action="index.php?etape=3">
<h3><?php echo $lang['L_Inst_confadmin']; ?></h3>
<p><?php echo $lang['L_Mot_identifiant']; ?></p>
<p><input type="text" class="input_text" name="login_admin" /></p>
<p><?php echo $lang['L_Mot_motdepasse']; ?></p>
<p><input type="password" class="input_text" name="mdp_admin" /></p>
<p><?php echo $lang['L_Mot_confmotdepasse']; ?></p>
<p><input type="password" class="input_text" name="mdp_confirme_admin" /></p>
<p><?php echo $lang['L_Mot_mail']; ?></p>
<p><input type="text" class="input_text" name="email_admin" /></p>
<?php
if(!isset($_GET['erreur']))
{
ecriture_xml('base.xml', 'nom_site', $_POST['titre']);
ecriture_xml('base.xml', 'description_site', $_POST['description']);
ecriture_xml('base.xml', 'lang', $_POST['lang']);
}
if (@$_GET['erreur']==1) echo "<span class='erreur'>".$lang['L_Inst_Msg_motdepasse']."</span><br />";
elseif (@$_GET['erreur']==2) echo "<span class='erreur'>".$lang['L_Inst_Msg_mauvaisemail']."</span><br />";
?>
<p><input type="button" value="<?php echo $lang['L_Mot_precedent']; ?>" onclick="javascript:history.back();" class="input_button" /></p>
<p><input type="submit" value="<?php echo $lang['L_Mot_suivant']; ?>" class="input_button" /></p>
<input type="hidden" name="lang" value="<?php if(!@isset($_POST['lang'])){echo "fr";}else{echo $_POST['lang'];} ?>" />
</form>
<?php
break;
// Etape 3 -------------------------------------------------------------------------------------------------------------------------
case 3:
?>
<form method="POST" action="index.php?etape=4">
<h3><?php echo $lang['L_Inst_licence']; ?></h3>
<?php
if (@$_GET['erreur']==1) echo "<span class='erreur'>".$lang['L_Inst_Msg_condition']."</span>";
elseif (isset($_POST['mdp_admin']) && md5($_POST['mdp_admin']) != md5($_POST['mdp_confirme_admin']))
{
@header('Location:index.php?etape=2&erreur=1');
}
elseif (checkMail($_POST['email_admin'])==FALSE)
{
@header('Location:index.php?etape=2&erreur=2');
}
else
{
if(!isset($_GET['erreur']))
{
ecriture_xml('base.xml', 'login_admin', $_POST['login_admin']);
ecriture_xml('base.xml', 'mdp_admin', md5($_POST['mdp_admin']));
ecriture_xml('base.xml', 'email_admin', $_POST['email_admin']);
}
}
$licence = @file_get_contents('http://www.gnu.org/licenses/gpl.txt'); ?>
<p><textarea class="input_text"><?php echo $licence; ?></textarea></p>
<p>
<input type="checkbox" name="conditions" />
<?php echo $lang['L_Inst_accepte']; ?>
</p>
<p><input type="button" value="<?php echo $lang['L_Mot_precedent']; ?>" onclick="javascript:history.back();" class="input_button" /></p>
<p><input type="submit" value="<?php echo $lang['L_Mot_suivant']; ?>" class="input_button" /></p>
<p><input type="hidden" name="lang" value="<?php if(!@isset($_POST['lang'])){echo "fr";}else{echo $_POST['lang'];} ?>" /></p>
</form>
<?php
break;
// Etape 4 -------------------------------------------------------------------------------------------------------------------------
case 4:
if (!isset($_POST['conditions']) || (@$_POST['conditions']!="on"))
{
@header('Location: index.php?etape=3&erreur=1');
} ?>
<form method="POST" action="../index.php">
<h3><?php echo $lang['L_Mot_finalisation']; ?></h3>
<p>AEOS v<?php echo $install_conf['configuration']['version']['#text'];?></p>
<h4><?php echo $lang['L_Inst_succes']; ?></h4>
<p><?php echo $lang['L_Inst_effacerinstall']; ?></p>
<h5><?php echo $lang['L_Inst_admineffacer']; ?></h5>
<p><?php echo $lang['L_Mot_remerciements']; ?>:</p>
<p>NNS Production, PHP.NET</p>
<p>
<input type="submit" value="<?php echo $lang['L_Inst_accessite']; ?>" class="input_button" />
<input type="hidden" name="lang" value="<?php if(!@isset($_POST['lang'])){echo "fr";}else{echo $_POST['lang'];} ?>" />
</p>
</form>
<?php copy("base.xml", "../data/config.xml"); ?>
<?php
break;
} ?>
</div>
</div>
</body>
</html>
<?php ob_end_flush(); ?>