$env->erreur("la base de données a été installée mais impossible d'ajouter l'administrateur");
return;
}
- if(!$env->set_webmaster_user($admin["login"], md5($admin["password"]))){
- $env->erreur("la base de données a été installée mais impossible d'enregistrer le webmaster");
- return;
- }
}
if(!$env->messages()){
if(!$content = @file_get_contents($template_file)){
class mw_upgrade_index extends mw_controller{
- function validate(){
- $env = $this->env();
- $env->load_webmaster_session();
- return true;
- }
-
function index(){
$env = $this->env();
$data = $env->data();
$env->redirect($env->url("upgrade"), "", 0);
return;
}
- if(!($webmaster_user = $env->get_webmaster_user())){
- $env->erreur("impossible de lire le user webmaster");
- return;
- }
- if(
- ($user["login"] != $webmaster_user["login"])
- || ($user["password"] != $webmaster_user["password"])
- ){
- $env->erreur("identification incorrecte");
- return;
- }
if(($res = $env->do_data_upgrade()) !== true){
$env->erreur("Erreur durant l'upgrade: ".$res);
return;
class mw_upgrade_user extends mw_controller{
- function validate(){
- $env = $this->env();
- $env->load_webmaster_session();
- return true;
- }
-
function login(){
$env = $this->env();
if($_POST){
$data = $env->data();
$message = "Identifiants incorrects";
- if($user = $env->webmaster_login(trim($_POST['login']), trim($_POST['pass']))){
+ if($user = $data->login(trim($_POST['login']), trim($_POST['pass']))){
$message = "Vous êtes maintenant identifié en tant que ".$user['login'];
}
$env->redirect(
<script type="text/javascript"> mw_site_url = "<?php echo $this->path("web") ?>"; </script>
<script type="text/javascript" src="<?php echo $this->out_url("js/md5.js"); ?>"></script>
+ <script type="text/javascript" src="<?php echo $this->out_url("js/login.js"); ?>"></script>
<?php foreach($this->js_files() as $js_file) : ?>
<script type="text/javascript" src="<?php echo $js_file; ?>"></script>
<?php endforeach; ?>
method="post">
<fieldset>
<legend>Identification</legend>
- <p>
- Identifiez-vous avec l'utilisateur que vous avez créé pendant l'installation du site.
- </p>
<input type="hidden" name="pass" value="" />
<ul>
<li>
+++ /dev/null
-<?php
-
- class mw_env_webmaster extends mw_env{
-
- function load_webmaster_session(){
- $data = $this->data();
- if(!($webmaster_user = $this->get_webmaster_user())) return array();
- return $data->load_session($webmaster_user);
- }
-
- function get_webmaster_user(){
- if(!file_exists($this->get_webmaster_user_file())) return array();
- if(!($content = @file_get_contents($this->get_webmaster_user_file()))) return false;
- $v_content = explode(":", $content);
- if(count($v_content) != 2) return false;
- return array(
- "login" => trim($v_content[0]),
- "password" => trim($v_content[1])
- );
- }
-
- function set_webmaster_user($login, $password){
- return @file_put_contents($this->get_webmaster_user_file(), $login.":".$password);
- }
-
- function get_webmaster_user_file(){
- return $this->path("content")."data/.webmaster";
- }
-
- function webmaster_login($login, $password){
- $data = $this->data();
- if(!($webmaster_user = $this->get_webmaster_user())){
- return false;
- }
- return $data->login($login, $password, $webmaster_user);
- }
-
- }
}
function upgrade(){
+ $env = $this->env();
+ $data = $env->data();
+ $data->load_session();
if($this->run_mod("upgrade", false)){
$this->display();
}