2
0
forked from Wavyzz/dolibarr

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
/* 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>
*
* This program is free software; you can redistribute it and/or modify
@@ -37,19 +37,22 @@ $langs->load("other");
/*
* Actions
*/
if ($_POST["action"] == 'setlevel')
if (! empty($_POST["action"]) && $_POST["action"] == 'setlevel')
{
dolibarr_set_const($db,"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"];
if ($optionlogoutput == "syslog")
{
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_set_const($db,"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";
$var=true;
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><input 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 "<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.'">';
print ' '.img_info('Only LOG_USER supported on Windows');
print '</td></tr>';
$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 "</table>\n";

View File

@@ -1,5 +1,5 @@
<?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
* it under the terms of the GNU General Public License as published by
@@ -53,7 +53,6 @@ class Events // extends CommonObject
/**
* \brief Constructor
* \param DB Database handler
@@ -76,7 +75,6 @@ class Events // extends CommonObject
// Clean parameters
$this->id=trim($this->id);
$this->fk_action=trim($this->fk_action);
$this->description=trim($this->description);
// Check parameters

View File

@@ -88,10 +88,10 @@ class FormAdmin
}
/**
* \brief Retourne la liste d<EFBFBD>roulante des menus disponibles (eldy_backoffice, ...)
* \param selected Menu pr<EFBFBD>-s<EFBFBD>lectionn<EFBFBD>e
* \brief Retourne la liste deroulante des menus disponibles (eldy_backoffice, ...)
* \param selected Menu pre-selectionnee
* \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)
{
@@ -133,7 +133,7 @@ class FormAdmin
{
$tab=split('_',$key);
$newprefix=$tab[0];
if ($conf->browser->firefox && $newprefix != $oldprefix)
if (! empty($conf->browser->firefox) && $newprefix != $oldprefix) // Add separators
{
// Affiche titre
print '<option value="-1" disabled="disabled">';
@@ -143,7 +143,7 @@ class FormAdmin
print '</option>';
$oldprefix=$newprefix;
}
print $val."\n";
print $val."\n"; // Show menu entry
}
print '</select>';
}

View File

@@ -1,5 +1,5 @@
<?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
* it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ class MenuLeft {
else
{
// 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"]))
@@ -789,7 +789,7 @@ class MenuLeft {
if ($mainmenu == 'tools')
{
if ($conf->mailing->enabled)
if (! empty($conf->mailing->enabled))
{
$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);
}
if ($conf->bookmark->enabled)
if (! empty($conf->bookmark->enabled))
{
$langs->load("other");
$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);
}
if ($conf->export->enabled)
if (! empty($conf->export->enabled))
{
$langs->load("exports");
$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);
}
if ($conf->global->MAIN_MODULE_IMPORT)
if (! empty($conf->global->MAIN_MODULE_IMPORT))
{
$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/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");
$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
if (! $conf->browser->firefox)
if (empty($conf->browser->firefox))
{
print '<div class="tabsAction">&nbsp;</div>';
}

View File

@@ -1,5 +1,5 @@
<?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>
*
* This program is free software; you can redistribute it and/or modify
@@ -99,6 +99,7 @@ class Interfaces
dolibarr_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
include_once($this->dir."/".$file);
$objMod = new $modName($this->db);
$i=0;
if ($objMod)
{
$modules[$i] = $modName;

View File

@@ -1,5 +1,5 @@
<?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>
*
* This program is free software; you can redistribute it and/or modify
@@ -328,7 +328,7 @@ function dolibarr_get_const($db, $name)
if ($resql)
{
$obj=$db->fetch_object($resql);
$value=$obj->value;
if ($obj) $value=$obj->value;
}
return $value;
}

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)
{
$facility = LOG_USER;
//define_syslog_variables(); already defined in master.inc.php
if (defined("MAIN_SYSLOG_FACILITY") && MAIN_SYSLOG_FACILITY)
{
$facility = constant("MAIN_SYSLOG_FACILITY");
}
elseif (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY)
if (defined("SYSLOG_FACILITY") && SYSLOG_FACILITY)
{
// Exemple: SYSLOG_FACILITY vaut LOG_USER qui vaut 8. On a besoin de 8 dans $facility.
$facility = constant("SYSLOG_FACILITY");
}
else
{
$facility = LOG_USER;
}
unset ($facility);
openlog("dolibarr", LOG_PID | LOG_PERROR, $facility);
openlog("dolibarr", LOG_PID | LOG_PERROR, (int) $facility); // (int) is required to avoid error parameter 3 expected to be long
if (! $level)
{

View File

@@ -1,5 +1,5 @@
<?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
* it under the terms of the GNU General Public License as published by
@@ -149,8 +149,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<tr><td colspan="3">&nbsp;</td></tr>'."\n";
// Security graphical code
$disabled=! $conf->global->MAIN_SECURITY_ENABLECAPTCHA;
if (function_exists("imagecreatefrompng") && ! $disabled)
if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{
//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>';
@@ -170,7 +169,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '<input type="submit" class="button" value="&nbsp; '.$langs->trans("Connection").' &nbsp;" tabindex="4" />';
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>';
}
@@ -183,14 +182,14 @@ function dol_loginfunction($langs,$conf,$mysoc)
print '</form>';
// 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 $_SESSION["dol_loginmesg"];
$_SESSION["dol_loginmesg"]="";
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">';
$i=0;
@@ -204,7 +203,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
}
print "\n";
print '<!-- urlfrom in session = '.$_SESSION["urlfrom"].' -->';
print '<!-- urlfrom in session = '.(isset($_SESSION["urlfrom"])?$_SESSION["urlfrom"]:'').' -->';
// Fin entete html
print "\n</body>\n</html>";

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);
session_name($sessionname);
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)
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
// 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 ARTICHOW."/AntiSpam.class.php";
@@ -380,9 +380,10 @@ else
// Est-ce une nouvelle session
if (! isset($_SESSION["dol_login"]))
{
$error=0;
// Nouvelle session pour ce login
$_SESSION["dol_login"]=$user->login;
$_SESSION["dol_password"]=$user->pass_crypted;
$_SESSION["dol_authmode"]=$conf->authmode;
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
if ($conf->webcal->enabled && $user->webcal_login != "")
if (! empty($conf->webcal->enabled) && $user->webcal_login != "")
{
$domain='';
// 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
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
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
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 (sizeof($conf->logbuffer))

View File

@@ -1,6 +1,6 @@
<?php
/* 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>
*
* 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');
if (!$user->rights->produit->lire)
accessforbidden();
accessforbidden();
$staticproduct=new Product($db);
@@ -172,7 +172,7 @@ if ($result)
if ($resultd)
{
$objtp = $db->fetch_object($resultd);
if ($objtp->label != '') $objp->label = $objtp->label;
if ($objtp && $objtp->label != '') $objp->label = $objtp->label;
}
}

View File

@@ -1,6 +1,6 @@
<?php
/* 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>
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\file htdocs/product/pre.inc.php
\ingroup product,service
\brief Fichier gestionnaire du menu gauche des produits et services
\version $Revision$
\todo Rodo - Gere les menus depuis les canvas
*/
* \file htdocs/product/pre.inc.php
* \ingroup product,service
* \brief Fichier gestionnaire du menu gauche des produits et services
* \version $Id$
*/
require("../main.inc.php");
$langs->load("products");
@@ -53,7 +50,7 @@ function llxHeader($head = "", $urlp = "", $title="")
// Produit specifique
$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))
{

View File

@@ -63,17 +63,18 @@ class User extends CommonObject
var $admin;
var $login;
//! Mot de passe en clair en memoire
//! Clear password in memory
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;
//! Mot de passe crypte en base (toujours renseigne)
//! Encrypted password in database (always defined)
var $pass_indatabase_crypted;
var $datec;
var $datem;
var $societe_id;
var $fk_member;
var $webcal_login;
var $phenix_login;
var $phenix_pass;