[ 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/admin/ -> syslog.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: syslog.php,v 1.2 2005/10/30 13:34:51 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/syslog.php,v $
  20   */
  21  
  22  /**
  23          \file       htdocs/admin/syslog.php
  24          \ingroup    syslog
  25          \brief      Page de configuration du module syslog
  26          \version    $Revision: 1.2 $
  27  */
  28  
  29  require ("./pre.inc.php");
  30  
  31  if (!$user->admin)
  32      accessforbidden();
  33  
  34  $langs->load("admin");
  35  $langs->load("other");
  36  
  37  llxHeader();
  38  
  39  print_titre($langs->trans("SyslogSetup"));
  40  print '<br>';
  41  
  42  $def = array();
  43  
  44  /*
  45   * Actions 
  46   */
  47  $optionlogoutput=$_POST["optionlogoutput"];
  48  if ($optionlogoutput == "syslog") {
  49      if (defined($_POST["facility"])) {
  50          dolibarr_del_const($db,"SYSLOG_FILE");
  51          dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]);
  52      } else {
  53          print '<div class="error">'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'</div>';
  54      }
  55  }
  56  if ($optionlogoutput == "file") {
  57      $file=fopen($_POST["filename"],"a+");
  58      if ($file) {
  59          fclose($file);
  60          dolibarr_del_const($db,"SYSLOG_FACILITY");
  61          dolibarr_set_const($db,"SYSLOG_FILE",$_POST["filename"]);
  62      }
  63      else {
  64          print '<div class="error">'.$langs->trans("ErrorFailedToOpenFile",$_POST["filename"]).'</div>';
  65      }
  66  }
  67  
  68  
  69  $syslogfacility=$defaultsyslogfacility=dolibarr_get_const($db,"SYSLOG_FACILITY");
  70  $syslogfile=$defaultsyslogfile=dolibarr_get_const($db,"SYSLOG_FILE");
  71  if (! $defaultsyslogfacility) $defaultsyslogfacility='LOG_USER';
  72  if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log';
  73  
  74  /*
  75   *  Mode de sortie
  76   */
  77  print_titre($langs->trans("SyslogOutput"));
  78  
  79  print '<table class="noborder" width=\"100%\">';
  80  print '<form action="syslog.php" method="post">';
  81  print '<input type="hidden" name="action" value="set">';
  82  print '<tr class="liste_titre">';
  83  print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Parameter").'</td>';
  84  print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
  85  print "</tr>\n";
  86  $var=true;
  87  $var=!$var;
  88  print "<tr ".$bc[$var]."><td width=\"140\"><input type=\"radio\" name=\"optionlogoutput\" value=\"syslog\" ".($syslogfacility?" checked":"")."> ".$langs->trans("SyslogSyslog")."</td>";
  89  print '<td colspan="2">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" value="'.$defaultsyslogfacility.'"></td></tr>';
  90  $var=!$var;
  91  print "<tr ".$bc[$var]."><td width=\"140\"><input type=\"radio\" name=\"optionlogoutput\" value=\"file\"".($syslogfile?" checked":"")."> ".$langs->trans("SyslogSimpleFile")."</td>";
  92  print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'"></td></tr>';
  93  print "</form>";
  94  print "</table>";
  95  
  96  
  97  llxFooter('$Date: 2005/10/30 13:34:51 $ - $Revision: 1.2 $');
  98  ?>


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