Removed PHP warnings with E_ALL level

This commit is contained in:
Laurent Destailleur
2009-01-21 14:09:42 +00:00
parent 7683f0f85e
commit 0befb92a12
14 changed files with 188 additions and 192 deletions

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -37,19 +37,22 @@ $langs->load("other");
/* /*
* Actions * Actions
*/ */
if ($_POST["action"] == 'setlevel') if (! empty($_POST["action"]) && $_POST["action"] == 'setlevel')
{ {
dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]); dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]);
dolibarr_syslog("admin/syslog: level ".$_POST["level"]); dolibarr_syslog("admin/syslog: level ".$_POST["level"]);
} }
if ($_POST["action"] == 'set') if (! empty($_POST["action"]) && $_POST["action"] == 'set')
{ {
$optionlogoutput=$_POST["optionlogoutput"]; $optionlogoutput=$_POST["optionlogoutput"];
if ($optionlogoutput == "syslog") if ($optionlogoutput == "syslog")
{ {
if (defined($_POST["facility"])) if (defined($_POST["facility"]))
{ {
// Only LOG_USER supported on Windows
if (! empty($_SERVER["WINDIR"])) $_POST["facility"]='LOG_USER';
dolibarr_del_const($db,"SYSLOG_FILE"); dolibarr_del_const($db,"SYSLOG_FILE");
dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]); dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]);
dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]); dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]);
@@ -110,11 +113,13 @@ print '<td align="right"><input type="submit" class="button" value="'.$langs->tr
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><input type=\"radio\" name=\"optionlogoutput\" value=\"syslog\" ".($syslogfacility?" checked":"")."> ".$langs->trans("SyslogSyslog")."</td>"; print "<tr ".$bc[$var]."><td width=\"140\"><input ".$bc[$var]." type=\"radio\" name=\"optionlogoutput\" value=\"syslog\" ".($syslogfacility?" checked":"")."> ".$langs->trans("SyslogSyslog")."</td>";
print '<td colspan="2">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" value="'.$defaultsyslogfacility.'"></td></tr>'; print '<td colspan="2">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" value="'.$defaultsyslogfacility.'">';
print ' '.img_info('Only LOG_USER supported on Windows');
print '</td></tr>';
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><input type=\"radio\" name=\"optionlogoutput\" value=\"file\"".($syslogfile?" checked":"")."> ".$langs->trans("SyslogSimpleFile")."</td>"; print "<tr ".$bc[$var]."><td width=\"140\"><input ".$bc[$var]." type=\"radio\" name=\"optionlogoutput\" value=\"file\"".($syslogfile?" checked":"")."> ".$langs->trans("SyslogSimpleFile")."</td>";
print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'"></td></tr>'; print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'"></td></tr>';
print "</table>\n"; print "</table>\n";

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -43,28 +43,27 @@ class Events // extends CommonObject
var $errors=array(); //!< To return several error codes (or messages) var $errors=array(); //!< To return several error codes (or messages)
var $element='events'; //!< Id that identify managed objects var $element='events'; //!< Id that identify managed objects
var $table_element='events'; //!< Name of table without prefix where object is stored var $table_element='events'; //!< Name of table without prefix where object is stored
var $id; var $id;
var $tms; var $tms;
var $type; var $type;
var $dateevent; var $dateevent;
var $description; var $description;
/** /**
* \brief Constructor * \brief Constructor
* \param DB Database handler * \param DB Database handler
*/ */
function Events($DB) function Events($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
/** /**
* \brief Create in database * \brief Create in database
* \param user User that create * \param user User that create
@@ -73,18 +72,17 @@ class Events // extends CommonObject
function create($user) function create($user)
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters // Clean parameters
$this->id=trim($this->id); $this->id=trim($this->id);
$this->fk_action=trim($this->fk_action);
$this->description=trim($this->description); $this->description=trim($this->description);
// Check parameters // Check parameters
if (! $this->description) { $this->error='ErrorBadValueForParameter'; return -1; } if (! $this->description) { $this->error='ErrorBadValueForParameter'; return -1; }
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."events(";
$sql.= "type,"; $sql.= "type,";
$sql.= "ip,"; $sql.= "ip,";
$sql.= "dateevent,"; $sql.= "dateevent,";
@@ -92,7 +90,7 @@ class Events // extends CommonObject
$sql.= "description"; $sql.= "description";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= " '".$this->type."',"; $sql.= " '".$this->type."',";
$sql.= " '".$_SERVER['REMOTE_ADDR']."',"; $sql.= " '".$_SERVER['REMOTE_ADDR']."',";
$sql.= " ".$this->db->idate($this->dateevent).","; $sql.= " ".$this->db->idate($this->dateevent).",";
@@ -106,7 +104,7 @@ class Events // extends CommonObject
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events");
return $this->id; return $this->id;
} }
else else
@@ -126,25 +124,25 @@ class Events // extends CommonObject
function update($user=0, $notrigger=0) function update($user=0, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
// Clean parameters // Clean parameters
$this->id=trim($this->id); $this->id=trim($this->id);
$this->type=trim($this->type); $this->type=trim($this->type);
$this->description=trim($this->description); $this->description=trim($this->description);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."events SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."events SET";
$sql.= " type='".$this->type."',"; $sql.= " type='".$this->type."',";
$sql.= " dateevent=".$this->db->idate($this->dateevent).","; $sql.= " dateevent=".$this->db->idate($this->dateevent).",";
$sql.= " description='".addslashes($this->description)."'"; $sql.= " description='".addslashes($this->description)."'";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dolibarr_syslog("Events::update sql=".$sql, LOG_DEBUG); dolibarr_syslog("Events::update sql=".$sql, LOG_DEBUG);
@@ -158,8 +156,8 @@ class Events // extends CommonObject
return 1; return 1;
} }
/* /*
* \brief Load object in memory from database * \brief Load object in memory from database
* \param id id object * \param id id object
@@ -171,16 +169,16 @@ class Events // extends CommonObject
global $langs; global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " ".$this->db->pdate('t.tms').","; $sql.= " ".$this->db->pdate('t.tms').",";
$sql.= " t.type,"; $sql.= " t.type,";
$sql.= " ".$this->db->pdate('t.dateevent').","; $sql.= " ".$this->db->pdate('t.dateevent').",";
$sql.= " t.description"; $sql.= " t.description";
$sql.= " FROM ".MAIN_DB_PREFIX."events as t"; $sql.= " FROM ".MAIN_DB_PREFIX."events as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
dolibarr_syslog("Events::fetch sql=".$sql, LOG_DEBUG); dolibarr_syslog("Events::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@@ -188,18 +186,18 @@ class Events // extends CommonObject
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->tms = $obj->tms; $this->tms = $obj->tms;
$this->type = $obj->type; $this->type = $obj->type;
$this->dateevent = $obj->dateevent; $this->dateevent = $obj->dateevent;
$this->description = $obj->description; $this->description = $obj->description;
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
} }
else else
@@ -209,8 +207,8 @@ class Events // extends CommonObject
return -1; return -1;
} }
} }
/* /*
* \brief Delete object in database * \brief Delete object in database
* \param user User that delete * \param user User that delete
@@ -219,10 +217,10 @@ class Events // extends CommonObject
function delete($user) function delete($user)
{ {
global $conf, $langs; global $conf, $langs;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."events";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
dolibarr_syslog("Events::delete sql=".$sql); dolibarr_syslog("Events::delete sql=".$sql);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
@@ -231,11 +229,11 @@ class Events // extends CommonObject
dolibarr_syslog("Events::delete ".$this->error, LOG_ERR); dolibarr_syslog("Events::delete ".$this->error, LOG_ERR);
return -1; return -1;
} }
return 1; return 1;
} }
/** /**
* \brief Initialise object with example values * \brief Initialise object with example values
* \remarks id must be 0 if object instance is a specimen. * \remarks id must be 0 if object instance is a specimen.
@@ -243,7 +241,7 @@ class Events // extends CommonObject
function initAsSpecimen() function initAsSpecimen()
{ {
$this->id=0; $this->id=0;
$this->tms=time(); $this->tms=time();
$this->type=''; $this->type='';
$this->dateevent=time(); $this->dateevent=time();

View File

@@ -14,7 +14,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/** /**
@@ -41,10 +41,10 @@ class FormAdmin
function FormAdmin($DB) function FormAdmin($DB)
{ {
$this->db = $DB; $this->db = $DB;
return 1; return 1;
} }
/** /**
* \brief Retourne la liste d<>roulante des langues disponibles * \brief Retourne la liste d<>roulante des langues disponibles
@@ -57,7 +57,7 @@ class FormAdmin
global $langs; global $langs;
$langs_available=$langs->get_available_languages(); $langs_available=$langs->get_available_languages();
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
if ($showauto) if ($showauto)
{ {
@@ -88,17 +88,17 @@ class FormAdmin
} }
/** /**
* \brief Retourne la liste d<EFBFBD>roulante des menus disponibles (eldy_backoffice, ...) * \brief Retourne la liste deroulante des menus disponibles (eldy_backoffice, ...)
* \param selected Menu pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>e * \param selected Menu pre-selectionnee
* \param htmlname Nom de la zone select * \param htmlname Nom de la zone select
* \param dirmenu Rep<EFBFBD>rtoire <EFBFBD> scanner * \param dirmenu Repertoire a scanner
*/ */
function select_menu($selected='',$htmlname,$dirmenu) function select_menu($selected='',$htmlname,$dirmenu)
{ {
global $langs,$conf; global $langs,$conf;
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilit<69> if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilit<69>
$menuarray=array(); $menuarray=array();
$handle=opendir($dirmenu); $handle=opendir($dirmenu);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
@@ -113,7 +113,7 @@ class FormAdmin
else if (eregi('^rodolphe',$file)) $prefix='2'; // Other else if (eregi('^rodolphe',$file)) $prefix='2'; // Other
else if (eregi('^empty',$file)) $prefix='2'; // Other else if (eregi('^empty',$file)) $prefix='2'; // Other
else $prefix='1'; // Experimental else $prefix='1'; // Experimental
if ($file == $selected) if ($file == $selected)
{ {
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="true">'.$filelib.'</option>'; $menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="true">'.$filelib.'</option>';
@@ -125,7 +125,7 @@ class FormAdmin
} }
} }
ksort($menuarray); ksort($menuarray);
// Affichage liste deroulante des menus // Affichage liste deroulante des menus
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
$oldprefix=''; $oldprefix='';
@@ -133,7 +133,7 @@ class FormAdmin
{ {
$tab=split('_',$key); $tab=split('_',$key);
$newprefix=$tab[0]; $newprefix=$tab[0];
if ($conf->browser->firefox && $newprefix != $oldprefix) if (! empty($conf->browser->firefox) && $newprefix != $oldprefix) // Add separators
{ {
// Affiche titre // Affiche titre
print '<option value="-1" disabled="disabled">'; print '<option value="-1" disabled="disabled">';
@@ -143,7 +143,7 @@ class FormAdmin
print '</option>'; print '</option>';
$oldprefix=$newprefix; $oldprefix=$newprefix;
} }
print $val."\n"; print $val."\n"; // Show menu entry
} }
print '</select>'; print '</select>';
} }
@@ -157,7 +157,7 @@ class FormAdmin
function select_menu_families($selected='',$htmlname,$dirmenu) function select_menu_families($selected='',$htmlname,$dirmenu)
{ {
global $langs,$conf; global $langs,$conf;
$menuarray=array(); $menuarray=array();
$handle=opendir($dirmenu); $handle=opendir($dirmenu);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
@@ -196,7 +196,7 @@ class FormAdmin
print '</select>'; print '</select>';
} }
/** /**
* \brief Retourne la liste d<>roulante des menus disponibles (eldy) * \brief Retourne la liste d<>roulante des menus disponibles (eldy)
* \param selected Menu pr<70>-s<>lectionn<6E>e * \param selected Menu pr<70>-s<>lectionn<6E>e
@@ -205,10 +205,10 @@ class FormAdmin
function select_timezone($selected='',$htmlname) function select_timezone($selected='',$htmlname)
{ {
global $langs,$conf; global $langs,$conf;
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
print '<option value="-1">&nbsp;</option>'; print '<option value="-1">&nbsp;</option>';
$arraytz=array( $arraytz=array(
"Pacific/Midway"=>"GMT-11:00", "Pacific/Midway"=>"GMT-11:00",
"Pacific/Fakaofo"=>"GMT-10:00", "Pacific/Fakaofo"=>"GMT-10:00",
@@ -244,7 +244,7 @@ class FormAdmin
} }
print '</select>'; print '</select>';
} }
/** /**
* \brief Return colors list selector * \brief Return colors list selector
* \param selected Color pre-selected * \param selected Color pre-selected
@@ -253,12 +253,12 @@ class FormAdmin
function select_colors($selected='', $htmlname, $arrayofcolors='', $showcolorbox=1) function select_colors($selected='', $htmlname, $arrayofcolors='', $showcolorbox=1)
{ {
global $langs,$conf; global $langs,$conf;
if (! is_array($arrayofcolors)) $arrayofcolors=array('29527A','5229A3','A32929','7A367A','B1365F','0D7813'); if (! is_array($arrayofcolors)) $arrayofcolors=array('29527A','5229A3','A32929','7A367A','B1365F','0D7813');
//$selected=''; //$selected='';
if ($showcolorbox) print '<table class="nobordernopadding"><tr valign="middle" class="nobordernopadding"><td class="nobordernopadding">'; if ($showcolorbox) print '<table class="nobordernopadding"><tr valign="middle" class="nobordernopadding"><td class="nobordernopadding">';
print '<select class="flat" name="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'">';
print '<option value="-1">&nbsp;</option>'; print '<option value="-1">&nbsp;</option>';
foreach ($arrayofcolors as $val) foreach ($arrayofcolors as $val)

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ class MenuLeft {
else else
{ {
// On va le chercher en session si non d<>fini par le lien // On va le chercher en session si non d<>fini par le lien
$mainmenu=$_SESSION["mainmenu"]; $mainmenu=isset($_SESSION["mainmenu"])?$_SESSION["mainmenu"]:'';
} }
if (isset($_GET["leftmenu"])) if (isset($_GET["leftmenu"]))
@@ -789,7 +789,7 @@ class MenuLeft {
if ($mainmenu == 'tools') if ($mainmenu == 'tools')
{ {
if ($conf->mailing->enabled) if (! empty($conf->mailing->enabled))
{ {
$langs->load("mails"); $langs->load("mails");
@@ -798,7 +798,7 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); $newmenu->add_submenu(DOL_URL_ROOT."/comm/mailing/liste.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire);
} }
if ($conf->bookmark->enabled) if (! empty($conf->bookmark->enabled))
{ {
$langs->load("other"); $langs->load("other");
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php?leftmenu=bookmarks", $langs->trans("Bookmarks"), 0, $user->rights->bookmark->lire); $newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php?leftmenu=bookmarks", $langs->trans("Bookmarks"), 0, $user->rights->bookmark->lire);
@@ -806,7 +806,7 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"), 1, $user->rights->bookmark->lire); $newmenu->add_submenu(DOL_URL_ROOT."/bookmarks/liste.php", $langs->trans("List"), 1, $user->rights->bookmark->lire);
} }
if ($conf->export->enabled) if (! empty($conf->export->enabled))
{ {
$langs->load("exports"); $langs->load("exports");
$newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0, $user->rights->export->lire); $newmenu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0, $user->rights->export->lire);
@@ -814,14 +814,14 @@ class MenuLeft {
//$newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); //$newmenu->add_submenu(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire);
} }
if ($conf->global->MAIN_MODULE_IMPORT) if (! empty($conf->global->MAIN_MODULE_IMPORT))
{ {
$langs->load("exports"); $langs->load("exports");
$newmenu->add_submenu(DOL_URL_ROOT."/admin/import/index.php?leftmenu=import",$langs->trans("FormatedImport"),0, $user->rights->import->lire); $newmenu->add_submenu(DOL_URL_ROOT."/admin/import/index.php?leftmenu=import",$langs->trans("FormatedImport"),0, $user->rights->import->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/admin/import/import.php?leftmenu=import",$langs->trans("NewImport"),1, $user->rights->import->creer); $newmenu->add_submenu(DOL_URL_ROOT."/admin/import/import.php?leftmenu=import",$langs->trans("NewImport"),1, $user->rights->import->creer);
} }
if ($conf->global->MAIN_MODULE_DOMAIN) if (! empty($conf->global->MAIN_MODULE_DOMAIN))
{ {
$langs->load("domains"); $langs->load("domains");
$newmenu->add_submenu(DOL_URL_ROOT."/domain/index.php?leftmenu=export",$langs->trans("DomainNames"),0, $user->rights->domain->read); $newmenu->add_submenu(DOL_URL_ROOT."/domain/index.php?leftmenu=export",$langs->trans("DomainNames"),0, $user->rights->domain->read);

View File

@@ -700,7 +700,7 @@ if ($conf->use_javascript_ajax)
} }
// Juste pour <20>viter bug IE qui r<>organise mal div pr<70>c<EFBFBD>dents si celui-ci absent // Juste pour <20>viter bug IE qui r<>organise mal div pr<70>c<EFBFBD>dents si celui-ci absent
if (! $conf->browser->firefox) if (empty($conf->browser->firefox))
{ {
print '<div class="tabsAction">&nbsp;</div>'; print '<div class="tabsAction">&nbsp;</div>';
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,7 @@ class Interfaces
{ {
var $dir; // Directory with all trigger files var $dir; // Directory with all trigger files
var $errors=array(); // Array for errors var $errors=array(); // Array for errors
/** /**
* \brief Constructeur. * \brief Constructeur.
* \param DB handler d'acc<63>s base * \param DB handler d'acc<63>s base
@@ -44,7 +44,7 @@ class Interfaces
$this->db = $DB ; $this->db = $DB ;
$this->dir = DOL_DOCUMENT_ROOT . "/includes/triggers"; $this->dir = DOL_DOCUMENT_ROOT . "/includes/triggers";
} }
/** /**
* \brief Fonction appel<65>e lors du d<>clenchement d'un <20>v<EFBFBD>nement Dolibarr. * \brief Fonction appel<65>e lors du d<>clenchement d'un <20>v<EFBFBD>nement Dolibarr.
* Cette fonction d<>clenche tous les triggers trouv<75>s actifs. * Cette fonction d<>clenche tous les triggers trouv<75>s actifs.
@@ -60,13 +60,13 @@ class Interfaces
$handle=opendir($this->dir); $handle=opendir($this->dir);
$modules = array(); $modules = array();
$nbfile = $nbtotal = $nbok = $nbko = 0; $nbfile = $nbtotal = $nbok = $nbko = 0;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($this->dir."/".$file) && eregi('^interface_([^_]+)_(.+)\.class\.php$',$file,$reg)) if (is_readable($this->dir."/".$file) && eregi('^interface_([^_]+)_(.+)\.class\.php$',$file,$reg))
{ {
$nbfile++; $nbfile++;
$modName = "Interface".ucfirst($reg[2]); $modName = "Interface".ucfirst($reg[2]);
//print "file=$file"; print "modName=$modName"; exit; //print "file=$file"; print "modName=$modName"; exit;
if (in_array($modName,$modules)) if (in_array($modName,$modules))
@@ -89,7 +89,7 @@ class Interfaces
$constparam='MAIN_MODULE_'.strtoupper($module); $constparam='MAIN_MODULE_'.strtoupper($module);
if (empty($conf->global->$constparam)) $qualified=false; if (empty($conf->global->$constparam)) $qualified=false;
} }
if (! $qualified) if (! $qualified)
{ {
dolibarr_syslog("Interfaces::run_triggers Triggers for file '".$file."' need module to be enabled",LOG_INFO); dolibarr_syslog("Interfaces::run_triggers Triggers for file '".$file."' need module to be enabled",LOG_INFO);
@@ -99,6 +99,7 @@ class Interfaces
dolibarr_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO); dolibarr_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
include_once($this->dir."/".$file); include_once($this->dir."/".$file);
$objMod = new $modName($this->db); $objMod = new $modName($this->db);
$i=0;
if ($objMod) if ($objMod)
{ {
$modules[$i] = $modName; $modules[$i] = $modName;
@@ -136,6 +137,6 @@ class Interfaces
//dolibarr_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG); //dolibarr_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG);
return $nbok; return $nbok;
} }
} }
} }
?> ?>

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@ function versiondolibarrarray()
function run_sql($sqlfile,$silent=1) function run_sql($sqlfile,$silent=1)
{ {
global $db, $conf, $langs, $user; global $db, $conf, $langs, $user;
dolibarr_syslog("Admin.lib::run_sql run sql file ".$sqlfile, LOG_DEBUG); dolibarr_syslog("Admin.lib::run_sql run sql file ".$sqlfile, LOG_DEBUG);
$ok=0; $ok=0;
@@ -106,7 +106,7 @@ function run_sql($sqlfile,$silent=1)
while (!feof ($fp)) while (!feof ($fp))
{ {
$buf = fgets($fp, 4096); $buf = fgets($fp, 4096);
// Cas special de lignes autorisees pour certaines versions uniquement // Cas special de lignes autorisees pour certaines versions uniquement
if (eregi('^-- V([0-9\.]+)',$buf,$reg)) if (eregi('^-- V([0-9\.]+)',$buf,$reg))
{ {
@@ -121,7 +121,7 @@ function run_sql($sqlfile,$silent=1)
//print "Ligne $i qualifi?e par version: ".$buf.'<br>'; //print "Ligne $i qualifi?e par version: ".$buf.'<br>';
} }
} }
// Ajout ligne si non commentaire // Ajout ligne si non commentaire
if (! eregi('^--',$buf)) $buffer .= $buf; if (! eregi('^--',$buf)) $buffer .= $buf;
@@ -135,7 +135,7 @@ function run_sql($sqlfile,$silent=1)
$buffer=''; $buffer='';
} }
} }
if ($buffer) $arraysql[$i]=trim($buffer); if ($buffer) $arraysql[$i]=trim($buffer);
fclose($fp); fclose($fp);
} }
@@ -147,7 +147,7 @@ function run_sql($sqlfile,$silent=1)
if ($sql) if ($sql)
{ {
$newsql=$sql; $newsql=$sql;
// Replace __+MAX_table__ with max of table // Replace __+MAX_table__ with max of table
while (eregi('__\+MAX_([A-Za-z_]+)__',$newsql,$reg)) while (eregi('__\+MAX_([A-Za-z_]+)__',$newsql,$reg))
{ {
@@ -175,7 +175,7 @@ function run_sql($sqlfile,$silent=1)
$to='+'.$listofmaxrowid[$table]; $to='+'.$listofmaxrowid[$table];
$newsql=str_replace($from,$to,$newsql); $newsql=str_replace($from,$to,$newsql);
dolibarr_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); dolibarr_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
$arraysql[$i]=$newsql; $arraysql[$i]=$newsql;
} }
} }
@@ -189,17 +189,17 @@ function run_sql($sqlfile,$silent=1)
if ($sql) if ($sql)
{ {
$newsql=$sql; $newsql=$sql;
// Ajout trace sur requete (eventuellement ? commenter si beaucoup de requetes) // Ajout trace sur requete (eventuellement ? commenter si beaucoup de requetes)
if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'</td></tr>\n"; if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'</td></tr>\n";
dolibarr_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); dolibarr_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
if (eregi('insert into ([^ ]+)',$newsql,$reg)) if (eregi('insert into ([^ ]+)',$newsql,$reg))
{ {
// It's an insert // It's an insert
$cursorinsert++; $cursorinsert++;
} }
// Replace __x__ with rowid of insert nb x // Replace __x__ with rowid of insert nb x
while (eregi('__([0-9]+)__',$newsql,$reg)) while (eregi('__([0-9]+)__',$newsql,$reg))
{ {
@@ -217,12 +217,12 @@ function run_sql($sqlfile,$silent=1)
$newsql=str_replace($from,$to,$newsql); $newsql=str_replace($from,$to,$newsql);
dolibarr_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG); dolibarr_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
} }
$result=$db->query($newsql); $result=$db->query($newsql);
if ($result) if ($result)
{ {
if (eregi('insert into ([^ ]+)',$newsql,$reg)) if (eregi('insert into ([^ ]+)',$newsql,$reg))
{ {
// It's an insert // It's an insert
$table=eregi_replace('[^a-zA-Z_]+','',$reg[1]); $table=eregi_replace('[^a-zA-Z_]+','',$reg[1]);
$insertedrowid=$db->last_insert_id($table); $insertedrowid=$db->last_insert_id($table);
@@ -234,7 +234,7 @@ function run_sql($sqlfile,$silent=1)
else else
{ {
$errno=$db->errno(); $errno=$db->errno();
$okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS', $okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS',
'DB_ERROR_COLUMN_ALREADY_EXISTS', 'DB_ERROR_COLUMN_ALREADY_EXISTS',
'DB_ERROR_KEY_NAME_ALREADY_EXISTS', 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
@@ -291,7 +291,7 @@ function run_sql($sqlfile,$silent=1)
function dolibarr_del_const($db, $name) function dolibarr_del_const($db, $name)
{ {
global $conf; global $conf;
$sql = "DELETE FROM llx_const"; $sql = "DELETE FROM llx_const";
$sql.=" WHERE name='".addslashes($name)."' or rowid='".addslashes($name)."'"; $sql.=" WHERE name='".addslashes($name)."' or rowid='".addslashes($name)."'";
@@ -328,7 +328,7 @@ function dolibarr_get_const($db, $name)
if ($resql) if ($resql)
{ {
$obj=$db->fetch_object($resql); $obj=$db->fetch_object($resql);
$value=$obj->value; if ($obj) $value=$obj->value;
} }
return $value; return $value;
} }
@@ -356,7 +356,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
} }
$db->begin(); $db->begin();
//dolibarr_syslog("dolibarr_set_const name=$name, value=$value"); //dolibarr_syslog("dolibarr_set_const name=$name, value=$value");
$sql = "DELETE FROM llx_const WHERE name = '".addslashes($name)."';"; $sql = "DELETE FROM llx_const WHERE name = '".addslashes($name)."';";
dolibarr_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); dolibarr_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG);
@@ -417,7 +417,7 @@ function security_prepare_head()
$head[$h][1] = $langs->trans("Audit"); $head[$h][1] = $langs->trans("Audit");
$head[$h][2] = 'audit'; $head[$h][2] = 'audit';
$h++; $h++;
return $head; return $head;
} }

View File

@@ -246,22 +246,16 @@ function dol_syslog($message, $level=LOG_INFO)
{ {
if (function_exists('openlog')) // This function does not exists on some ISP (Ex: Free in France) if (function_exists('openlog')) // This function does not exists on some ISP (Ex: Free in France)
{ {
$facility = LOG_USER;
//define_syslog_variables(); already defined in master.inc.php //define_syslog_variables(); already defined in master.inc.php
if (defined("MAIN_SYSLOG_FACILITY") && MAIN_SYSLOG_FACILITY) if (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY)
{
$facility = constant("MAIN_SYSLOG_FACILITY");
}
elseif (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY)
{ {
// Exemple: SYSLOG_FACILITY vaut LOG_USER qui vaut 8. On a besoin de 8 dans $facility. // Exemple: SYSLOG_FACILITY vaut LOG_USER qui vaut 8. On a besoin de 8 dans $facility.
$facility = constant("SYSLOG_FACILITY"); $facility = constant("SYSLOG_FACILITY");
} }
else
{ openlog("dolibarr", LOG_PID | LOG_PERROR, (int) $facility); // (int) is required to avoid error parameter 3 expected to be long
$facility = LOG_USER;
}
unset ($facility);
openlog("dolibarr", LOG_PID | LOG_PERROR, $facility);
if (! $level) if (! $level)
{ {

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
else unset($_SESSION["urlfrom"]); else unset($_SESSION["urlfrom"]);
// Ce DTD est KO car inhibe document.body.scrollTop // Ce DTD est KO car inhibe document.body.scrollTop
//print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; //print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
// Ce DTD est OK // Ce DTD est OK
@@ -149,8 +149,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n"; print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
// Security graphical code // Security graphical code
$disabled=! $conf->global->MAIN_SECURITY_ENABLECAPTCHA; if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
if (function_exists("imagecreatefrompng") && ! $disabled)
{ {
//print "Info session: ".session_name().session_id();print_r($_SESSION); //print "Info session: ".session_name().session_id();print_r($_SESSION);
print '<tr><td align="left" valign="middle" nowrap="nowrap"> &nbsp; <b>'.$langs->trans("SecurityCode").'</b></td>'; print '<tr><td align="left" valign="middle" nowrap="nowrap"> &nbsp; <b>'.$langs->trans("SecurityCode").'</b></td>';
@@ -170,27 +169,27 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<input type="submit" class="button" value="&nbsp; '.$langs->trans("Connection").' &nbsp;" tabindex="4" />'; print '<input type="submit" class="button" value="&nbsp; '.$langs->trans("Connection").' &nbsp;" tabindex="4" />';
print '</td></tr>'; print '</td></tr>';
if (! $conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
{ {
print '<tr><td colspan="3" align="center"><a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">('.$langs->trans("PasswordForgotten").')</a></td></tr>'; print '<tr><td colspan="3" align="center"><a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">('.$langs->trans("PasswordForgotten").')</a></td></tr>';
} }
print '</table>'; print '</table>';
// Hidden fields // Hidden fields
print '<input type="hidden" name="loginfunction" value="loginfunction" />'; print '<input type="hidden" name="loginfunction" value="loginfunction" />';
print '</form>'; print '</form>';
// Message // Message
if ($_SESSION["dol_loginmesg"]) if (! empty($_SESSION["dol_loginmesg"]))
{ {
print '<center><table width="60%"><tr><td align="center" class="small"><div class="error">'; print '<center><table width="60%"><tr><td align="center" class="small"><div class="error">';
print $_SESSION["dol_loginmesg"]; print $_SESSION["dol_loginmesg"];
$_SESSION["dol_loginmesg"]=""; $_SESSION["dol_loginmesg"]="";
print '</div></td></tr></table></center>'; print '</div></td></tr></table></center>';
} }
if ($conf->global->MAIN_HOME) if (! empty($conf->global->MAIN_HOME))
{ {
print '<center><table cellpadding="0" cellspacing="0" border="0" align="center" width="750"><tr><td align="center">'; print '<center><table cellpadding="0" cellspacing="0" border="0" align="center" width="750"><tr><td align="center">';
$i=0; $i=0;
@@ -204,8 +203,8 @@ function dol_loginfunction($langs,$conf,$mysoc)
} }
print "\n"; print "\n";
print '<!-- urlfrom in session = '.$_SESSION["urlfrom"].' -->'; print '<!-- urlfrom in session = '.(isset($_SESSION["urlfrom"])?$_SESSION["urlfrom"]:'').' -->';
// Fin entete html // Fin entete html
print "\n</body>\n</html>"; print "\n</body>\n</html>";
} }
@@ -242,7 +241,7 @@ function makesalt($type=CRYPT_SALT_LENGTH)
/** /**
* \brief Encode\decode database password in config file * \brief Encode\decode database password in config file
* \param level Encode level : 0 no enconding, 1 encoding * \param level Encode level : 0 no enconding, 1 encoding
* \return int <0 if KO, >0 if OK * \return int <0 if KO, >0 if OK
*/ */
function encodedecode_dbpassconf($level=0) function encodedecode_dbpassconf($level=0)
{ {
@@ -254,7 +253,7 @@ function encodedecode_dbpassconf($level=0)
while(!feof($fp)) while(!feof($fp))
{ {
$buffer = fgets($fp,4096); $buffer = fgets($fp,4096);
if (strstr($buffer,"\$dolibarr_main_db_encrypted_pass") && $level == 0) if (strstr($buffer,"\$dolibarr_main_db_encrypted_pass") && $level == 0)
{ {
$passwd = strstr($buffer,"$dolibarr_main_db_encrypted_pass="); $passwd = strstr($buffer,"$dolibarr_main_db_encrypted_pass=");
@@ -275,7 +274,7 @@ function encodedecode_dbpassconf($level=0)
} }
} }
fclose($fp); fclose($fp);
$file=DOL_DOCUMENT_ROOT.'/conf/conf.php'; $file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
if ($fp = @fopen($file,'w')) if ($fp = @fopen($file,'w'))
{ {
@@ -283,7 +282,7 @@ function encodedecode_dbpassconf($level=0)
fclose($fp); fclose($fp);
// It's config file, so we set permission for creator only // It's config file, so we set permission for creator only
// @chmod($file, octdec('0600')); // @chmod($file, octdec('0600'));
return 1; return 1;
} }
else else

View File

@@ -156,7 +156,7 @@ $sessionname="DOLSESSID_".$dolibarr_main_db_name;
if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT); if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) ini_set('session.gc_maxlifetime',$conf->global->MAIN_SESSION_TIMEOUT);
session_name($sessionname); session_name($sessionname);
session_start(); session_start();
dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".$_SESSION["dol_login"].", ".ini_get("session.gc_maxlifetime")); dolibarr_syslog("Start session name=".$sessionname." Session id()=".session_id().", _SESSION['dol_login']=".(isset($_SESSION["dol_login"])?$_SESSION["dol_login"]:'').", ".ini_get("session.gc_maxlifetime"));
// Disable modules (this must be after session_start) // Disable modules (this must be after session_start)
if (! empty($_REQUEST["disablemodules"])) $_SESSION["disablemodules"]=$_REQUEST["disablemodules"]; if (! empty($_REQUEST["disablemodules"])) $_SESSION["disablemodules"]=$_REQUEST["disablemodules"];
@@ -206,7 +206,7 @@ if (! isset($_SESSION["dol_login"]))
// On est pas deja authentifie, on demande le login/mot de passe // On est pas deja authentifie, on demande le login/mot de passe
// Verification du code securite graphique // Verification du code securite graphique
if ($test && isset($_POST["username"]) && $conf->global->MAIN_SECURITY_ENABLECAPTCHA) if ($test && isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
require_once DOL_DOCUMENT_ROOT.'/../external-libs/Artichow/Artichow.cfg.php'; require_once DOL_DOCUMENT_ROOT.'/../external-libs/Artichow/Artichow.cfg.php';
require_once ARTICHOW."/AntiSpam.class.php"; require_once ARTICHOW."/AntiSpam.class.php";
@@ -380,9 +380,10 @@ else
// Est-ce une nouvelle session // Est-ce une nouvelle session
if (! isset($_SESSION["dol_login"])) if (! isset($_SESSION["dol_login"]))
{ {
$error=0;
// Nouvelle session pour ce login // Nouvelle session pour ce login
$_SESSION["dol_login"]=$user->login; $_SESSION["dol_login"]=$user->login;
$_SESSION["dol_password"]=$user->pass_crypted;
$_SESSION["dol_authmode"]=$conf->authmode; $_SESSION["dol_authmode"]=$conf->authmode;
dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id()); dolibarr_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"].' Session id='.session_id());
@@ -410,7 +411,7 @@ if (! isset($_SESSION["dol_login"]))
} }
// Module webcalendar // Module webcalendar
if ($conf->webcal->enabled && $user->webcal_login != "") if (! empty($conf->webcal->enabled) && $user->webcal_login != "")
{ {
$domain=''; $domain='';
// Extract domain from url (Useless because only cookie on same domain are authorized by browser // Extract domain from url (Useless because only cookie on same domain are authorized by browser
@@ -431,7 +432,7 @@ if (! isset($_SESSION["dol_login"]))
} }
// Module Phenix // Module Phenix
if ($conf->phenix->enabled && $user->phenix_login != "" && $conf->phenix->cookie) if (! empty($conf->phenix->enabled) && $user->phenix_login != "" && $conf->phenix->cookie)
{ {
// Creation du cookie permettant la connexion automatique, valide jusqu'a la fermeture du browser // Creation du cookie permettant la connexion automatique, valide jusqu'a la fermeture du browser
if (!isset($HTTP_COOKIE_VARS[$conf->phenix->cookie])) if (!isset($HTTP_COOKIE_VARS[$conf->phenix->cookie]))
@@ -1014,7 +1015,7 @@ function llxFooter($foot='',$limitIEbug=1)
} }
// Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent // Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent
if ($limitIEbug && ! $conf->browser->firefox) print "\n".'<div class="tabsAction">&nbsp;</div>'."\n"; if ($limitIEbug && empty($conf->browser->firefox)) print "\n".'<div class="tabsAction">&nbsp;</div>'."\n";
// If there is some logs in buffer to show // If there is some logs in buffer to show
if (sizeof($conf->logbuffer)) if (sizeof($conf->logbuffer))

View File

@@ -160,7 +160,7 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
// Detection browser // Detection browser
if (isset($_SERVER["HTTP_USER_AGENT"])) if (isset($_SERVER["HTTP_USER_AGENT"]))
{ {
if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('firefox',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1;
if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1; if (eregi('iceweasel',$_SERVER["HTTP_USER_AGENT"])) $conf->browser->firefox=1;
} }

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@ require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php'); require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
$staticproduct=new Product($db); $staticproduct=new Product($db);
@@ -86,21 +86,21 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
if ($conf->produit->enabled) if ($conf->produit->enabled)
{ {
$statProducts = "<tr $bc[0]>"; $statProducts = "<tr $bc[0]>";
$statProducts.= '<td><a href="liste.php?type=0&amp;envente=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>'; $statProducts.= '<td><a href="liste.php?type=0&amp;envente=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
$statProducts.= "</tr>"; $statProducts.= "</tr>";
$statProducts.= "<tr $bc[1]>"; $statProducts.= "<tr $bc[1]>";
$statProducts.= '<td><a href="liste.php?type=0&amp;envente=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>'; $statProducts.= '<td><a href="liste.php?type=0&amp;envente=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
$statProducts.= "</tr>"; $statProducts.= "</tr>";
} }
if ($conf->service->enabled) if ($conf->service->enabled)
{ {
$statServices = "<tr $bc[0]>"; $statServices = "<tr $bc[0]>";
$statServices.= '<td><a href="liste.php?type=1&amp;envente=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>'; $statServices.= '<td><a href="liste.php?type=1&amp;envente=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
$statServices.= "</tr>"; $statServices.= "</tr>";
$statServices.= "<tr $bc[1]>"; $statServices.= "<tr $bc[1]>";
$statServices.= '<td><a href="liste.php?type=1&amp;envente=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>'; $statServices.= '<td><a href="liste.php?type=1&amp;envente=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
$statServices.= "</tr>"; $statServices.= "</tr>";
} }
if (isset($_GET["type"]) && $_GET["type"] == 0) if (isset($_GET["type"]) && $_GET["type"] == 0)
{ {
@@ -130,8 +130,8 @@ $sql.= " ".$db->pdate("tms")." as datem";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($conf->categorie->enabled && !$user->rights->categorie->voir) if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
} }
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct";
$sql.= " WHERE sp.fk_product_subproduct IS NULL"; $sql.= " WHERE sp.fk_product_subproduct IS NULL";
@@ -143,39 +143,39 @@ $result = $db->query($sql) ;
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0;
if ($num > 0)
{
$transRecordedType = $langs->trans("LastModifiedProductsAndServices",$max);
if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts",$max);
if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices",$max);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="4">'.$transRecordedType.'</td></tr>'; $i = 0;
$var=True;
while ($i < $num) if ($num > 0)
{ {
$transRecordedType = $langs->trans("LastModifiedProductsAndServices",$max);
if (isset($_GET["type"]) && $_GET["type"] == 0) $transRecordedType = $langs->trans("LastRecordedProducts",$max);
if (isset($_GET["type"]) && $_GET["type"] == 1) $transRecordedType = $langs->trans("LastRecordedServices",$max);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="4">'.$transRecordedType.'</td></tr>';
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
//Multilangs //Multilangs
if ($conf->global->MAIN_MULTILANGS) if ($conf->global->MAIN_MULTILANGS)
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
$resultd = $db->query($sql); $resultd = $db->query($sql);
if ($resultd) if ($resultd)
{ {
$objtp = $db->fetch_object($resultd); $objtp = $db->fetch_object($resultd);
if ($objtp->label != '') $objp->label = $objtp->label; if ($objtp && $objtp->label != '') $objp->label = $objtp->label;
} }
} }
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
@@ -193,16 +193,16 @@ if ($result)
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
}
$db->free();
print "</table>";
} }
$db->free();
print "</table>";
}
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
print '</td></tr></table>'; print '</td></tr></table>';

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Auguria SARL <info@auguria.org> * Copyright (C) 2007 Auguria SARL <info@auguria.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -16,17 +16,14 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/product/pre.inc.php * \file htdocs/product/pre.inc.php
\ingroup product,service * \ingroup product,service
\brief Fichier gestionnaire du menu gauche des produits et services * \brief Fichier gestionnaire du menu gauche des produits et services
\version $Revision$ * \version $Id$
\todo Rodo - Gere les menus depuis les canvas */
*/
require("../main.inc.php"); require("../main.inc.php");
$langs->load("products"); $langs->load("products");
@@ -44,7 +41,7 @@ function llxHeader($head = "", $urlp = "", $title="")
{ {
$menu->add(DOL_URL_ROOT."/product/index.php?type=0", $langs->trans("Products")); $menu->add(DOL_URL_ROOT."/product/index.php?type=0", $langs->trans("Products"));
$menu->add_submenu(DOL_URL_ROOT."/product/liste.php?type=0", $langs->trans("List")); $menu->add_submenu(DOL_URL_ROOT."/product/liste.php?type=0", $langs->trans("List"));
if ($user->societe_id == 0 && $user->rights->produit->creer) if ($user->societe_id == 0 && $user->rights->produit->creer)
{ {
$menu->add_submenu(DOL_URL_ROOT."/product/fiche.php?action=create&amp;type=0", $langs->trans("NewProduct")); $menu->add_submenu(DOL_URL_ROOT."/product/fiche.php?action=create&amp;type=0", $langs->trans("NewProduct"));
@@ -53,7 +50,7 @@ function llxHeader($head = "", $urlp = "", $title="")
// Produit specifique // Produit specifique
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/"; $dir = DOL_DOCUMENT_ROOT . "/product/canvas/";
if(is_dir($dir) && $conf->global->PRODUCT_CANVAS_ABILITY) if(is_dir($dir) && ! empty($conf->global->PRODUCT_CANVAS_ABILITY))
{ {
if ($handle = opendir($dir)) if ($handle = opendir($dir))
{ {
@@ -62,10 +59,10 @@ function llxHeader($head = "", $urlp = "", $title="")
if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.') if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.')
{ {
$parts = explode('.',$file); $parts = explode('.',$file);
$classname = 'Product'.ucfirst($parts[1]); $classname = 'Product'.ucfirst($parts[1]);
require_once($dir.$file); require_once($dir.$file);
$module = new $classname(); $module = new $classname();
if ($module->active === '1' && $module->menu_add === 1) if ($module->active === '1' && $module->menu_add === 1)
{ {
$module->PersonnalizeMenu($menu); $module->PersonnalizeMenu($menu);

View File

@@ -63,17 +63,18 @@ class User extends CommonObject
var $admin; var $admin;
var $login; var $login;
//! Mot de passe en clair en memoire //! Clear password in memory
var $pass; var $pass;
//! Mot de passe en clair en base (renseigne si DATABASE_PWD_ENCRYPTED=0) //! Clear password in database (defined if DATABASE_PWD_ENCRYPTED=0)
var $pass_indatabase; var $pass_indatabase;
//! Mot de passe crypte en base (toujours renseigne) //! Encrypted password in database (always defined)
var $pass_indatabase_crypted; var $pass_indatabase_crypted;
var $datec; var $datec;
var $datem; var $datem;
var $societe_id; var $societe_id;
var $fk_member; var $fk_member;
var $webcal_login; var $webcal_login;
var $phenix_login; var $phenix_login;
var $phenix_pass; var $phenix_pass;