[ Index ]
 

Code source de Dotclear 1.2.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/install/ -> db-install.php (source)

   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  
  23  define('STEP',4);
  24  
  25  require dirname(__FILE__).'/prepend.php';
  26  
  27  $con = new connection($ses->f('db_user'),$ses->f('db_pass'),
  28          $ses->f('db_host'),$ses->f('db_name'));
  29  
  30  # On vérifie si les tables existent
  31  $strReq = 'SHOW TABLES LIKE \''.$ses->f('db_prefix').'%s\' ';
  32  
  33  $rs = $con->select(sprintf($strReq,'categorie'));
  34  $installed['categorie'] = !$rs->isEmpty();
  35  
  36  $rs = $con->select(sprintf($strReq,'comment'));
  37  $installed['comment'] = !$rs->isEmpty();
  38  
  39  $rs = $con->select(sprintf($strReq,'post'));
  40  $installed['post'] = !$rs->isEmpty();
  41  
  42  $rs = $con->select(sprintf($strReq,'user'));
  43  $installed['user'] = !$rs->isEmpty();
  44  
  45  $installed = $installed['categorie'] && $installed['comment'] && $installed['post'] && $installed['user'];
  46  
  47  if ($installed)
  48  {
  49      $ses->reg('step',20);
  50  }
  51  else
  52  {
  53      $sql_check = new checklist();
  54      
  55      $xsql = new xmlsql($con,implode('',file(dirname(__FILE__).'/db-create.xml')));
  56      $xsql->replace('{{PREFIX}}',$ses->f('db_prefix'));
  57      $xsql->execute($sql_check);
  58      
  59      $con->close();
  60      
  61      if ($sql_check->checkAll()) {
  62          $ses->reg('step',5);
  63      }
  64  }
  65  
  66  require dirname(__FILE__).'/__top.php';
  67  
  68  if ($installed)
  69  {
  70       echo
  71      '<p>'.__('DotClear seems to be present on your site. '.
  72      'You may want to upgrade.').'</p>'.
  73      '<p class="important">'.__('Don\'t forget to upload your old dotclear.ini '.
  74      'in conf/ directory before upgrade.').'</p>'.
  75      '<form action="upgrade.php" method="post">'.
  76      '<p><input type="submit" class="submit" value="'.__('Upgrade').' &#187;" /></p>'.
  77      '</form>';
  78      
  79  }
  80  else
  81  {
  82      
  83      
  84      echo '<h2>'.__('Tables creation').'</h2>';
  85      
  86      echo $sql_check->getHTML($img_chk_on,$img_chk_off,$img_chk_wrn);
  87      
  88      if (!$sql_check->checkAll())
  89      {
  90          echo '<p class="important">'.
  91          __('Unable to create all tables. Please check if the tables don\'t exist yet.').'</p>';
  92      }
  93      else
  94      {
  95          echo '<p><strong>'.__('Tables successfully created.').'</strong></p>';
  96          if ($sql_check->checkWarnings()) {
  97              echo
  98              '<p>'.__('DotClear will run properly even if warnings are issued.').'</p>';
  99          }
 100          
 101          echo
 102          '<form action="db-user.php" method="post">'.
 103          '<p><input type="submit" class="submit" value="'.__('Create user').' &#187;" /></p>'.
 104          '</form>';
 105      }
 106  }
 107  ?>
 108  
 109  <?php require dirname(__FILE__).'/__bottom.php'; ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7