From a3216ee0c690fa9941aad02229849d55ccc37de2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Wed, 9 May 2012 02:39:30 +0200 Subject: [PATCH] Fix: Checkstyle --- htdocs/admin/mailing.php | 16 ++++++---------- htdocs/admin/mails.php | 2 +- htdocs/commande/class/commande.class.php | 12 ++++++------ htdocs/paypal/admin/paypal.php | 6 +++--- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index da844ed9934..a3f71eb1742 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org> + * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.org> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * * This program is free software; you can redistribute it and/or modify @@ -25,16 +25,16 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php"); $langs->load("admin"); $langs->load("mails"); -if (!$user->admin) - accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); - + /* * Actions @@ -63,15 +63,11 @@ if ($action == 'setvalue' && $user->admin) $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",0,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; } - + //Create temporary encryption key if nedded if (($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1) && (empty($checkread_key))) { - $chars = "abcdef(ghijklmnopqrstuvwxyz;!ABCDEFGH,IJKLMNOPQRSTUVWXYZ01_23456789"; - mt_srand(10000000*(double)microtime()); - for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < 30; $i++) { - $checkread_key .= $chars[mt_rand(0, $lc)]; - } + $checkread_key=getRandomPassword(true); } $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 0ae433f0e72..8be4899ebfe 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -223,7 +223,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_P $deliveryreceipt, $msgishtml, $errors_to - ); + ); $result=$mailfile->sendfile(); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 65306b7efb1..5b70f45a2c1 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -682,7 +682,7 @@ class Commande extends CommonObject $this->lines[$i]->remise_percent, $this->lines[$i]->info_bits, $this->lines[$i]->fk_remise_except, - 'HT', + 'HT', 0, $this->lines[$i]->date_start, $this->lines[$i]->date_end, @@ -2122,11 +2122,11 @@ class Commande extends CommonObject * @param int $skip_update_total Skip update of total * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) { global $conf; - dol_syslog("CustomerOrder::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type"); + dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type"); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'); if ($this->brouillon) @@ -2224,13 +2224,13 @@ class Commande extends CommonObject { $this->error=$this->db->error(); $this->db->rollback(); - dol_syslog("CustomerOrder::UpdateLine Error=".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR); return -1; } } else { - $this->error="CustomerOrder::Updateline Order status makes operation forbidden"; + $this->error=get_class($this)."::updateline Order status makes operation forbidden"; return -2; } } @@ -2268,7 +2268,7 @@ class Commande extends CommonObject { // Delete order details $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - dol_syslog("Commande::delete sql=".$sql); + dol_syslog(get_class($this)."::delete sql=".$sql); if (! $this->db->query($sql) ) { dol_syslog(get_class($this)."::delete error", LOG_ERR); diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 7d185c65c03..896cb6a5be1 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -68,7 +68,7 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; - + if (! $error) { $db->commit(); @@ -368,7 +368,7 @@ if ($conf->adherent->enabled) print "<br>"; print info_admin($langs->trans("YouCanAddTagOnUrl")); -$db->close(); - llxFooter(); + +$db->close(); ?> -- GitLab