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

250 lines
No EOL
9.1 KiB
PHP

<?php
ob_start();
if (file_exists("../data/config.xml")){header('Location: ../index.php');}
require_once ('../lib/aeos.lib.php');
$config = lecture_xml("config.xml");
if (!isset($_POST['lang'])) $langs="fr_FR"; else $langs=$_POST['lang'];
require_once('lang/'.$langs.'/index.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="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/aeos_logo_A_blanc.png" alt="Logo AEOS" /></h1>
<!--
<div id="Menu">
<ul>
<?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>
-->
<div class="form">
<h6><?php echo $lang['L_Install']; ?> - AEOS</h6>
<?php
!isset($_GET['etape'])?$etape=0:$etape=$_GET['etape'];
$PHPVersion = phpversion();
$PHPv = explode (".", $PHPVersion);
switch ($etape)
{
// Prérequis -------------------------------------------------------------------------------------------------------------------------
case 0:
?>
<form class="language" method="POST" action="index.php?etape=0">
<p>
<div class="select_basic">
<select name="lang" class="input_select" onchange="this.form.submit();">
<?php
$list = listing_dossier("lang/");
foreach ($list as $pages)
{
$lg = lecture_xml('lang/'.$pages.'/lang.xml'); ?>
<option value="<?php echo $pages; ?>" <?php if($pages==$langs){echo "selected";}?>>
<?php echo $lg['lang']['title']['#text'];?>
</option><?php
} ?>
</select>
</div>
</p>
</form>
<form method="POST" action="index.php?etape=1">
<h4><?php echo $lang['L_Inst_bienvenue']."<br />".$lang['L_Inst_instruction']; ?></h4>
<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
{ ?>
<button><?php echo $lang['L_Mot_suivant']; ?></button><?php
} ?>
<input type="hidden" name="lang" value="<?php echo $langs; ?>" />
</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>
<button><?php echo $lang['L_Mot_suivant']; ?></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('config.xml', array('configuration/nom_site'=>$_POST['titre'],
'configuration/description_site'=>$_POST['description'],
'configuration/lang'=>$langs));
}
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><button><?php echo $lang['L_Mot_suivant']; ?></button></p>
<input type="hidden" name="lang" value="<?php echo $langs; ?>" />
</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('config.xml', array(
'configuration/users/admin/password'=>password_hash($_POST['mdp_admin'],PASSWORD_DEFAULT),
'configuration/users/admin/email'=>$_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><button><?php echo $lang['L_Mot_suivant']; ?></button></p>
<input type="hidden" name="lang" value="<?php echo $langs; ?>" />
</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 $config['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("config.xml", "../data/config.xml"); ?>
<?php
break;
} ?>
</div>
<div id="Footer">
<img src="../themes/system/images/logo_a4_300.png" width="250" alt="Logo" />
<p>
AEOS v<?php echo $config['configuration']['version']['#text']; ?>
</p>
<hr />
<h5><?php echo $config['configuration']['branch']['#text']; ?>/version_<?php echo $config['configuration']['update']['#text']; ?>.zip</h5>
<p class="copyright"><?php echo $lang["login_msg_Layus"]; ?></p>
</div>
</div>
</div>
</body>
</html>
<?php ob_end_flush(); ?>