Fix: Solve phpcodesniffer errors and warning

This commit is contained in:
Laurent Destailleur 2011-09-14 21:50:18 +00:00
parent 3a7285ae12
commit 3cdc7abf40
19 changed files with 90 additions and 94 deletions

View File

@ -40,21 +40,21 @@ class AccountancyAccount
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
* \param id id compte (0 par defaut)
* Constructor
*
* @param $DoliDB $DB Database handler
*/
function AccountancyAccount($DB, $id=0)
function AccountancyAccount($DB)
{
$this->db = $DB;
$this->id = $id ;
}
/**
* \brief Ins<EFBFBD>re le compte en base
* \param user Utilisateur qui effectue l'insertion
* \return int <0 si ko, Id ligne ajout<EFBFBD>e si ok
* Insert account into database
*
* @param User $user User making add
* @return int <0 if KO, Id line added if OK
*/
function create($user)
{

View File

@ -108,9 +108,7 @@ if ($action == 'set')
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
$resql=$db->query($sql);
}
if ($action == 'del')

View File

@ -208,9 +208,11 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
$body=make_substitutions($body,$substitutionarrayfortest);
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
$mailfile = new CMailFile($subject, $sendto, $email_from, $body,
$filepath, $mimetype, $filename,
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml, $errors_to);
$mailfile = new CMailFile(
$subject, $sendto, $email_from, $body,
$filepath, $mimetype, $filename,
$sendtocc, $sendtoccc, $deliveryreceipt, $msgishtml, $errors_to
);
$result=$mailfile->sendfile();
@ -270,10 +272,10 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
{
$html=new Form($db);
if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\')
@ -282,12 +284,12 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
jQuery("#MAIN_MAIL_EMAIL_TLS").attr(\'disabled\', \'disabled\');
';
if ($linuxlike)
{
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").attr(\'disabled\', \'disabled\');';
print ' jQuery("#MAIN_MAIL_SMTP_PORT").attr(\'disabled\', \'disabled\');';
}
print '
if ($linuxlike)
{
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").attr(\'disabled\', \'disabled\');';
print ' jQuery("#MAIN_MAIL_SMTP_PORT").attr(\'disabled\', \'disabled\');';
}
print '
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\')
{
@ -303,8 +305,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
initfields();
});
})';
print '</script>'."\n";
}
print '</script>'."\n";
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -357,8 +359,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
else
{
$smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_SERVER",$smtpserver);
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_SERVER",$smtpserver);
print '</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
@ -590,15 +592,15 @@ else
print '</table>';
if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
$sendmailoption=ini_get('mail.force_extra_parameters');
//print 'x'.$sendmailoption;
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print '<br>'.info_admin($langs->trans("SendmailOptionNotComplete"));
}
}
if ($linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
$sendmailoption=ini_get('mail.force_extra_parameters');
//print 'x'.$sendmailoption;
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print '<br>'.info_admin($langs->trans("SendmailOptionNotComplete"));
}
}
// Boutons actions
@ -711,8 +713,8 @@ else
$formmail->withfrom=1;
$formmail->witherrorsto=1;
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
$formmail->withtopicreadonly=0;
$formmail->withfile=2;

View File

@ -310,22 +310,16 @@ if ($mode != 4)
if ($objMod->special == $mode)
{
$atleastoneforfamily++;
$var=!$var;
print '<tr height="18" '.$bc[$var].">\n";
//print ' <td valign="top" nowrap="nowrap">';
if ($family!=$oldfamily)
{
$familytext=empty($familylib[$family])?$family:$familylib[$family];
//print $familytext;
$oldfamily=$family;
}
else
{
//print '&nbsp;';
}
//print "</td>\n";
$var=!$var;
print '<tr height="18" '.$bc[$var].">\n";
// Picto
print ' <td valign="top" width="14" align="center">';

View File

@ -53,14 +53,13 @@ $offset = $limit * $page ;
print_barre_liste("Liste des langues oscommerce", $page, "osc-languages.php");
$sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."languages as l";
$sql .= $db->plimit( $limit ,$offset);
$sql.= $db->plimit($limit, $offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\">";
print "<tr class=\"liste_titre\">";
print "<td>id</td>";
print "<td>Name</td>";
print "<TD>Code</TD>";
print "<td>Code</td>";
print "</TR>\n";
$resql=$db->query($sql);

View File

@ -162,9 +162,9 @@ if ($result)
// Check if permission is inside module definition
// TODO If not, we remove it
foreach($objMod->rights as $key => $val)
/*foreach($objMod->rights as $key => $val)
{
}
}*/
// Break found, it's a new module to catch
if ($old <> $obj->module)

View File

@ -107,10 +107,7 @@ if ($action == 'set')
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
$resql=$db->query($sql);
}
if ($action == 'del')

View File

@ -184,10 +184,7 @@ if ($action == 'set')
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
$sql.= ")";
if ($db->query($sql))
{
}
$resql=$db->query($sql);
}
if ($action == 'del')
{

View File

@ -161,7 +161,7 @@ if ($action == 'edit')
{
$html=new Form($db);
if (! sizeof($listofmethods)) print '<div class="error">'.$langs->trans("NoSmsEngine").'</div>';
if (! count($listofmethods)) print '<div class="error">'.$langs->trans("NoSmsEngine").'</div>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -205,7 +205,7 @@ if ($action == 'edit')
print '</table>';
print '<br><center>';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"'.(!sizeof($listofmethods)?' disabled="disbaled"':'').'>';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'"'.(!count($listofmethods)?' disabled="disbaled"':'').'>';
print ' &nbsp; &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</center>';

View File

@ -134,11 +134,8 @@ if ($action== 'del')
$type='company';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
if ($db->query($sql))
{
}
else dol_print_error($db);
$resql=$db->query($sql);
if (! $resql) dol_print_error($db);
}
// Define default generator

View File

@ -138,7 +138,7 @@ if ($action == 'update')
}
}
# Suppression attribut
// Suppression attribut
if ($action == 'delete')
{
if(isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_GET["attrname"]))

View File

@ -61,7 +61,6 @@ else if ($conf->db->type == 'pgsql')
}
else if ($conf->db->type == 'mssql')
{
//TODO: recuperer les infos du serveur
//$sqls[0] = "";
//$base=3;
}

View File

@ -111,7 +111,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$key.'</td>';
print '<td>'.sizeof($val).'</td>';
print '<td>'.count($val).'</td>';
print '<td align="right">'.dol_getshmopaddress($key).'</td>';
print '</tr>'."\n";
}
@ -180,13 +180,12 @@ $var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
# Parent company
// Parent company
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
$var=!$var;
#print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("CompanyHour")."</td><td>".dol_print_date(dol_now('tzuser'),'dayhour')."</td></tr>\n";
print '<tr '.$bc[$var].'><td width="300">=> '.$langs->trans("CompanyHour").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
# Client
// Client
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($_SESSION['dol_tz']!=''?($_SESSION['dol_tz']>=0?'+':'').$_SESSION['dol_tz']:'').' ('.($_SESSION['dol_tz']>=0?'+':'').($_SESSION['dol_tz']*60*60).')</td></tr>'."\n";
//$var=!$var;
@ -195,7 +194,6 @@ $var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("DaylingSavingTime").'</td><td>'.($_SESSION['dol_dst']>=0?yn(1):yn(0)).' ('.($_SESSION['dol_dst']>=0?'+':'').($_SESSION['dol_dst']*60*60).')</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">=> '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
#print "<tr ".$bc[$var]."><td width=\"300\">=> ".$langs->trans("ClientHour")."</td><td>".$langs->trans("FeatureNotYetAvailable")."</td></tr>\n";
$var=!$var;
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0

View File

@ -83,7 +83,13 @@ function compare($x, $y)
return 1;
}
/**
* Compare revisions
*
* @param array $x Parts of version 1
* @param array $y Parts of version 2
* @return int 1 if 1<2, 0 if 1=2, -1 if 1>2
*/
function revcompare($x, $y)
{
global $sortby, $langs;
@ -96,7 +102,12 @@ function revcompare($x, $y)
return -1;
}
/**
* Output table
*
* @param array $list Array of records
* @return void
*/
function create_script_table($list)
{
global $sortby,$bc,$langs;
@ -127,15 +138,15 @@ function create_script_table($list)
<table class="noborder">
<tr>
<th><a
href="<?php print $_SERVER['PHP_SELF']?>?sort=file&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Filename"); ?></a>&nbsp;<? if($sortby == "file") print ($order == "asc" ? "&darr;" : "&uarr;")?></th>
href="<?php print $_SERVER['PHP_SELF']?>?sort=file&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Filename"); ?></a>&nbsp;<?php if($sortby == "file") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th>
<th><a
href="<?php print $_SERVER['PHP_SELF']?>?sort=mtime&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Date"); ?></a>&nbsp;<? if($sortby == "mtime") print ($order == "asc" ? "&darr;" : "&uarr;")?></th>
href="<?php print $_SERVER['PHP_SELF']?>?sort=mtime&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Date"); ?></a>&nbsp;<?php if($sortby == "mtime") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th>
<th><a
href="<?php print $_SERVER['PHP_SELF']?>?sort=size&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Size"); ?></a>&nbsp;<? if($sortby == "size") print ($order == "asc" ? "&darr;" : "&uarr;")?></th>
href="<?php print $_SERVER['PHP_SELF']?>?sort=size&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Size"); ?></a>&nbsp;<?php if($sortby == "size") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th>
<th><a
href="<?php print $_SERVER['PHP_SELF']?>?sort=reloads&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Reloads"); ?></a>&nbsp;<? if($sortby == "reloads") print ($order == "asc" ? "&darr;" : "&uarr;")?></th>
href="<?php print $_SERVER['PHP_SELF']?>?sort=reloads&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Reloads"); ?></a>&nbsp;<?php if($sortby == "reloads") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th>
<th><a
href="<?php print $_SERVER['PHP_SELF']?>?sort=hits&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Hits"); ?></a>&nbsp;<? if($sortby == "hits") print ($order == "asc" ? "&darr;" : "&uarr;")?></th>
href="<?php print $_SERVER['PHP_SELF']?>?sort=hits&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Hits"); ?></a>&nbsp;<?php if($sortby == "hits") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th>
</tr>
<?php
switch ($sortby) {
@ -166,8 +177,12 @@ function create_script_table($list)
<?php
}
/**
* Output table
*
* @param array $list Array of records
* @return void
*/
function create_key_table($list)
{
global $bc,$langs;

View File

@ -257,11 +257,11 @@ if ($what == 'postgresql')
//if ($compression == 'bz')
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
/*if (! empty($dolibarr_main_db_pass))
{
//$paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass);
//$paramclear.=" -W".$dolibarr_main_db_pass;
}
$paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass);
$paramclear.=" -W".$dolibarr_main_db_pass;
}*/
$paramcrypted.=" -w ".$dolibarr_main_db_name;
$paramclear.=" -w ".$dolibarr_main_db_name;

View File

@ -167,7 +167,7 @@ if ($savehandler == 'files')
$i++;
}
if (sizeof($listofsessions) == 0)
if (count($listofsessions) == 0)
{
print '<tr><td colspan="6">'.$langs->trans("NoSessionFound",$savepath,$openbasedir).'</td></tr>';
}
@ -197,7 +197,7 @@ else
if ($savehandler == 'files')
{
if (sizeof($listofsessions))
if (count($listofsessions))
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("PurgeSessions").'</a>';
}

View File

@ -71,7 +71,7 @@ if ($_REQUEST["action"]=='purge' && ! preg_match('/^confirm/i',$_REQUEST["choice
}
$count=0;
if (sizeof($filesarray))
if (count($filesarray))
{
foreach($filesarray as $key => $value)

View File

@ -111,7 +111,7 @@ print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
print $langs->trans("RemoveLock",$dolibarrroot.'install.lock').'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
$fullurl='<a href="'.DOL_URL_ROOT.'/install/'.'" target="_blank">'.DOL_URL_ROOT.'/install/'.'</a>';
$fullurl='<a href="'.DOL_URL_ROOT.'/install/" target="_blank">'.DOL_URL_ROOT.'/install/</a>';
print $langs->trans("CallUpdatePage",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",5).'</b>: ';
print $langs->trans("RestoreLock",$dolibarrroot.'install.lock').'<br>';

View File

@ -97,7 +97,7 @@ if ($conf->propal->enabled && $conf->commande->enabled) $workflowcodes['WORKFLOW
//if ($conf->contrat->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_CONTRACT_AUTOCREATE_INVOICE']='WORKFLOW_CONTRACT_AUTOCREATE_INVOICE';
if ($conf->commande->enabled && $conf->facture->enabled) $workflowcodes['WORKFLOW_ORDER_AUTOCREATE_INVOICE']='WORKFLOW_ORDER_AUTOCREATE_INVOICE';
if (sizeof($workflowcodes) > 0)
if (count($workflowcodes) > 0)
{
foreach($workflowcodes as $code)
{