Fix: Solve phpcodesniffer errors and warning

This commit is contained in:
Laurent Destailleur 2011-09-14 21:50:17 +00:00
parent c4358dc7c9
commit c8a10010ae
2 changed files with 33 additions and 32 deletions

View File

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

View File

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