end-install.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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',7);
  23. require dirname(__FILE__).'/prepend.php';
  24. $end_check = new checkList();
  25. # Création du premier billet
  26. $con = new connection($ses->f('db_user'),$ses->f('db_pass'),
  27. $ses->f('db_host'),$ses->f('db_name'));
  28. $blog = new blog($con,$ses->f('db_prefix'),NULL);
  29. if ($blog->addPost($ses->f('user_id'),__('First post'),'first-post','',
  30. '<p>'.__('This is the first post. Please edit it.').'</p>','',1,
  31. 'html',true,true,true,$ses->f('lang'),false) == false)
  32. {
  33. $first_post = false;
  34. } else {
  35. $first_post = true;
  36. }
  37. $end_check->addItem('first',$first_post,
  38. __('Creation of first entry.'),
  39. __('Creation of first entry failed.')
  40. );
  41. # Création du fichier de configuration
  42. $configfile = dirname(__FILE__).'/../conf/config.php';
  43. $config = implode('',file($configfile.'.in'));
  44. $config = str_replace('%%DB_USER%%',$ses->f('db_user'),$config);
  45. $config = str_replace('%%DB_PASS%%',$ses->f('db_pass'),$config);
  46. $config = str_replace('%%DB_HOST%%',$ses->f('db_host'),$config);
  47. $config = str_replace('%%DB_BASE%%',$ses->f('db_name'),$config);
  48. $config = str_replace('%%DB_PREFIX%%',$ses->f('db_prefix'),$config);
  49. if (($fp = @fopen($configfile,'w')) !== false) {
  50. fwrite($fp,$config,strlen($config));
  51. fclose($fp);
  52. $wconf = true;
  53. files::secureFile($configfile);
  54. } else {
  55. $wconf = false;
  56. }
  57. $end_check->addItem('conf',$wconf,
  58. __('Creation of config file.'),
  59. __('Creation of config file failed.')
  60. );
  61. $user_id = $ses->f('user_id');
  62. $user_pwd = $ses->f('user_pwd');
  63. if ($end_check->checkAll()) {
  64. $ses->destroy();
  65. }
  66. require dirname(__FILE__).'/__top.php';
  67. echo '<h2>'.__('End of installation').'</h2>';
  68. echo $end_check->getHTML($img_chk_on,$img_chk_off,$img_chk_wrn);
  69. if (!$end_check->checkAll()) {
  70. echo
  71. '<p class="important">'.__('An error occured while finishing installation.').'</p>';
  72. } else {
  73. @unlink($configfile.'.in');
  74. echo
  75. '<h3>'.__('Congratulations!').'</h3>'.
  76. '<p>'.__('You successfully installed DotClear. Have fun.').'</p>';
  77. echo
  78. '<form action="../'.DC_ECRIRE.'/auth.php" method="post">'.
  79. '<p><input type="submit" class="submit" value="'.__('Manage your blog').' &#187;" />'.
  80. form::hidden('user_id',$user_id).
  81. form::hidden('user_pwd',$user_pwd).
  82. '</p>'.
  83. '</form>';
  84. }
  85. $con->close();
  86. ?>
  87. <?php require dirname(__FILE__).'/__bottom.php'; ?>