[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/install/ -> check.php (source)

   1  <?php
   2  /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 
   3   * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2005 Marc Barilley / Océbo <marc@ocebo.com>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: check.php,v 1.9 2005/11/03 18:00:17 marc_ocebo Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/install/check.php,v $
  22   */
  23  
  24  /**
  25          \file       htdocs/install/check.php
  26          \ingroup    install
  27          \brief      Test si le fichier conf est modifiable et si il n'existe pas, test la possibilité de le créer
  28          \version    $Revision: 1.9 $
  29  */
  30  
  31  $err = 0;
  32  $allowinstall = 0;
  33  $allowupgrade = 0;
  34  
  35  include_once ("./inc.php");
  36  
  37  $setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langs->getDefaultLang());
  38  $langs->setDefaultLang($setuplang);
  39  
  40  $langs->load("install");
  41  
  42  
  43  pHeader($langs->trans("DolibarrWelcome"),"");   // Etape suivante = license
  44  
  45  print $langs->trans("InstallEasy")."<br>";
  46  
  47  // Si fichier présent et lisible et renseigné
  48  clearstatcache();
  49  if (is_readable($conffile) && filesize($conffile) > 8)
  50  {
  51      $confexists=1;
  52      include_once($conffile);
  53      
  54      // Deja installé, on peut upgrader
  55      // \todo Test if database ok
  56      $allowupgrade=1;
  57  }
  58  else
  59  {
  60      // Si non on le crée        
  61      $confexists=0;
  62      $fp = @fopen($conffile, "w");
  63      if($fp)
  64      {
  65          @fwrite($fp, '<?php');
  66          @fputs($fp,"\n");
  67          @fputs($fp,"?>");
  68          fclose($fp);
  69      }
  70      
  71      // First install, on ne peut pas upgrader
  72      $allowupgrade=0;
  73  }
  74  
  75  // Si fichier absent et n'a pu etre créé
  76  if (!file_exists($conffile))
  77  {
  78      print "<br /><br />";
  79      print $langs->trans("ConfFileDoesNotExists",'conf.php');
  80      print "<br />";
  81      print $langs->trans("YouMustCreateWithPermission",'htdocs/conf/conf.php');
  82      print "<br /><br />";
  83      
  84      print $langs->trans("CorrectProblemAndReloadPage");
  85      $err++;
  86  }
  87  else
  88  {
  89      print "<br />\n";
  90      // Si fichier présent mais ne peut etre modifié
  91      if (!is_writable($conffile))
  92      {
  93          if ($confexists)
  94          {
  95              print $langs->trans("ConfFileExists",'conf.php');
  96          }
  97          else
  98          {
  99              print $langs->trans("ConfFileCouldBeCreated",'conf.php');
 100          }
 101          print "<br />";
 102          print $langs->trans("ConfFileIsNotWritable",'htdocs/conf/conf.php');
 103          print "<br />";
 104      
 105          $allowinstall=0;
 106      }
 107      // Si fichier présent et peut etre modifié
 108      else
 109      {
 110          if ($confexists)
 111          {
 112              print $langs->trans("ConfFileExists",'conf.php');
 113          }
 114          else
 115          {
 116              print $langs->trans("ConfFileCouldBeCreated",'conf.php');
 117          }
 118          print "<br />";
 119          print $langs->trans("ConfFileIsWritable",'conf.php');
 120          print "<br />";
 121      
 122          $allowinstall=1;
 123      }
 124      print "<br />\n";
 125      print "<br />\n";
 126  
 127      // Si pas d'erreur, on affiche le bouton pour passer à l'étape suivante
 128  
 129      
 130      print $langs->trans("ChooseYourSetupMode");
 131  
 132      print '<table width="100%" cellspacing="1" cellpadding="4" border="1">';
 133      
 134      print '<tr><td nowrap="nowrap"><b>'.$langs->trans("FreshInstall").'</b></td><td>';
 135      print $langs->trans("FreshInstallDesc").'</td>';
 136      print '<td align="center">';
 137      if ($allowinstall)
 138      {
 139          print '<a href="licence.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
 140      }
 141      else
 142      {
 143          print $langs->trans("InstallNotAllowed");   
 144      }
 145      print '</td>';
 146      print '</tr>';
 147  
 148      print '<tr><td nowrap="nowrap"><b>'.$langs->trans("Upgrade").'</b></td><td>';
 149      print $langs->trans("UpgradeDesc").'</td>';
 150      print '<td align="center">';
 151      if ($allowupgrade)
 152      {
 153          print '<a href="upgrade.php?action=upgrade&amp;selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
 154      }
 155      else
 156      {
 157          print $langs->trans("NotAvailable");   
 158      }
 159      print '</td>';
 160      print '</tr>';
 161      
 162      print '</table>';
 163      print "\n";
 164  
 165  }
 166  
 167  print '</div>';
 168  print '</div>';
 169  print '</form>';
 170  
 171  
 172  print '</body>';
 173  print '</html>';
 174  
 175  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics