db-user.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # This file is part of DotClear.
  4. # Copyright (c) 2004 Olivier Meunier and contributors. All rights
  5. # reserved.
  6. #
  7. # DotClear is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # DotClear is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with DotClear; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. #
  21. # ***** END LICENSE BLOCK *****
  22. define('STEP',5);
  23. require dirname(__FILE__).'/prepend.php';
  24. # Ajout du fichier de langue principal pour les erreurs et champs
  25. l10n::set(dirname(__FILE__).'/../l10n/'.$ses->f('lang').LANG_PREFIX.'/main');
  26. $p_name = '';
  27. $p_fname = '';
  28. $p_login = '';
  29. $p_pwd = '';
  30. $created = false;
  31. $err = '';
  32. if (!empty($_POST['create']))
  33. {
  34. $con = new connection($ses->f('db_user'),$ses->f('db_pass'),
  35. $ses->f('db_host'),$ses->f('db_name'));
  36. $blog = new blog($con,$ses->f('db_prefix'),NULL);
  37. $p_name = $_POST['p_name'];
  38. $p_fname = $_POST['p_fname'];
  39. $p_login = $_POST['p_login'];
  40. $p_pwd = $_POST['p_pwd'];
  41. if ($blog->addUser($p_login,9,$p_pwd,$p_name,$p_fname,'','',
  42. 'wiki',10,1,$ses->f('lang'),0) === false) {
  43. $err = $blog->error(1,0);
  44. } else {
  45. $created = true;
  46. $ses->reg('user_id',$p_login);
  47. $ses->reg('user_pwd',$p_pwd);
  48. $ses->reg('step',6);
  49. }
  50. $con->close();
  51. }
  52. require dirname(__FILE__).'/__top.php';
  53. echo '<h2>'.__('Creation of first user').'</h2>';
  54. if ($created)
  55. {
  56. $user_check = new checkList();
  57. $user_check->addItem('user',true,__('User successfully created'),'');
  58. echo $user_check->getHTML($img_chk_on,$img_chk_off,$img_chk_wrn);
  59. echo
  60. '<form action="ini-file.php" method="post">'.
  61. '<p><input type="submit" class="submit" value="'.__('Next step').' &#187;" /></p>'.
  62. '</form>';
  63. }
  64. else
  65. {
  66. echo
  67. '<p>'.__('You are about to create the first user of your blog. This user '.
  68. 'will be administrator.').'</p>';
  69. if ($err != '') {
  70. echo
  71. '<div><p class="important">'.__('Error(s)').' :</p>'.
  72. $err.'</div>';
  73. }
  74. echo
  75. '<form action="db-user.php" method="post">'.
  76. '<p class="field"><label class="float" for="p_name">'.__('Name').'* :</label> '.
  77. form::field('p_name',30,255,$p_name).'</p>'.
  78. '<p class="field"><label class="float" for="p_fname">'.__('Firstname').' :</label> '.
  79. form::field('p_fname',30,255,$p_fname).'</p>'.
  80. '<p class="field"><label class="float" for="p_login">'.__('Login').'* :</label> '.
  81. form::field('p_login',30,255,$p_login).'</p>'.
  82. '<p class="field"><label class="float" for="p_pwd">'.__('Password').'* :</label> '.
  83. form::field('p_pwd',30,255,$p_pwd).'</p>'.
  84. '<p class="field"><input type="submit" class="submit" value="'.__('Create user').' &#187;" />'.
  85. form::hidden('create','1').'</p>'.
  86. '</form>';
  87. }
  88. ?>
  89. <?php require dirname(__FILE__).'/__bottom.php'; ?>