diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 83d2d5f8947..bacf1c0cebb 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -37,9 +38,6 @@ if (!$user->admin) accessforbidden(); // Allow/Disallow change to clear passwords once passwords are crypted $allow_disable_encryption=true; -$mesg = ''; - - /* * Actions */ @@ -135,7 +133,7 @@ if ($action == 'activate_encryptdbpassconf') } else { - $mesg='
'.$langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)).'
'; + setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings'); } } else if ($action == 'disable_encryptdbpassconf') @@ -150,7 +148,7 @@ else if ($action == 'disable_encryptdbpassconf') } else { - $mesg='
'.$langs->trans('InstrucToClearPass',$dolibarr_main_db_pass).'
'; + setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings'); } } @@ -179,8 +177,6 @@ llxHeader('',$langs->trans("Passwords")); print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); -dol_htmloutput_mesg($mesg); - print $langs->trans("GeneratedPasswordDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index b78a201b9d1..e32194d818f 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -82,27 +83,27 @@ else if (preg_match('/del_(.*)/',$action,$reg)) else if ($action == 'MAIN_SESSION_TIMEOUT') { if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else $mesg=$langs->trans("RecordModifiedSuccessfully"); + else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } else if ($action == 'MAIN_UPLOAD_DOC') { if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else $mesg=$langs->trans("RecordModifiedSuccessfully"); + else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } else if ($action == 'MAIN_UMASK') { if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else $mesg=$langs->trans("RecordModifiedSuccessfully"); + else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } else if ($action == 'MAIN_ANTIVIRUS_COMMAND') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else $mesg=$langs->trans("RecordModifiedSuccessfully"); + else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } else if ($action == 'MAIN_ANTIVIRUS_PARAM') { if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); - else $mesg=$langs->trans("RecordModifiedSuccessfully"); + else setEventMessage($langs->trans("RecordModifiedSuccessfully")); } // Delete file diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index a91b8aa2ebd..bdab2164888 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -1,6 +1,7 @@ * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -87,25 +88,25 @@ if ($action == 'send' && ! $_POST['cancel']) if (! empty($formsms->error)) { - $message='
'.$formsms->error.'
'; + setEventMessage($formsms->error,'errors'); $action='test'; $error++; } if (empty($body)) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")),'errors'); $action='test'; $error++; } if (empty($smsfrom) || ! str_replace('+','',$smsfrom)) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")),'errors'); $action='test'; $error++; } if (empty($sendto) || ! str_replace('+','',$sendto)) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")),'errors'); $action='test'; $error++; } @@ -122,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel']) if ($result) { - $message='
'.$langs->trans("SmsSuccessfulySent",$smsfrom,$sendto).'
'; + setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto)); } else { - $message='
'.$langs->trans("ResultKo").'
'.$smsfile->error.' '.$result.'
'; + setEventMessage($langs->trans("ResultKo"),'errors'); } $action=''; @@ -151,8 +152,6 @@ print_fiche_titre($langs->trans("SmsSetup"),'','setup'); print $langs->trans("SmsDesc")."
\n"; print "
\n"; -dol_htmloutput_mesg($message); - // List of sending methods $listofmethods=(is_array($conf->modules_parts['sms'])?$conf->modules_parts['sms']:array()); asort($listofmethods); diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 3d18daf22da..30966f8bfbf 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -70,11 +70,11 @@ if ($action == 'update' || $action == 'add') if (! $error) { - $mesg = '
'.$langs->trans("SetupSaved").'
'; + setEventMessage($langs->trans("SetupSaved")); } else { - $mesg = '
'.$langs->trans("Error").'
'; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -117,9 +117,6 @@ $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - -dol_htmloutput_mesg($mesg); - /* * Spip */ diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f7a45aff8d2..067da1dd91e 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -2,9 +2,9 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2008-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * * 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 @@ -85,12 +85,12 @@ if($action) if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -269,8 +269,6 @@ print "\n"; print "\n"; print ''; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 7a0e465577b..c9e07ae6f27 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -61,14 +61,14 @@ if ($action == 'updateMask') if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } if ($action == 'specimen') // For invoices @@ -106,13 +106,13 @@ if ($action == 'specimen') // For invoices } else { - $mesg=''.$module->error.''; + setEventMessage($module->error,'errors'); dol_syslog($module->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -172,14 +172,14 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } @@ -467,8 +467,6 @@ print '' print "\n"; print ''; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); ?> diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 6189e2337e2..07d7d731652 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011-2013 Philippe Grand * * This program is free software; you can redistribute it and/or modify @@ -61,14 +61,14 @@ if ($action == 'updateMask') if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } else if ($action == 'specimen') // For orders @@ -106,13 +106,13 @@ else if ($action == 'specimen') // For orders } else { - $mesg=''.$module->error.''; + setEventMessage($module->error,'errors'); dol_syslog($module->error, LOG_ERR); } } else { - $mesg=''.$langs->trans("ErrorModuleNotFound").''; + setEventMessage($langs->trans("ErrorModuleNotFound"),'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } @@ -172,14 +172,14 @@ else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT') if (! $res > 0) $error++; - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } @@ -462,8 +462,6 @@ print '' print "\n"; print ''; -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter(); ?> diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index f42f846e9d6..3dae4273319 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -31,7 +32,7 @@ if (!$user->admin) accessforbidden(); $langs->load("admin"); $langs->load("other"); -$error=0; $mesg=''; +$error=0; $action = GETPOST("action"); $syslogModules = array(); @@ -110,12 +111,12 @@ if ($action == 'set') if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - if (empty($mesg)) $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } } @@ -129,12 +130,12 @@ if ($action == 'setlevel') if (! $res > 0) $error++; if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); } } @@ -249,8 +250,6 @@ print ''; print ''; print "\n"; -dol_htmloutput_mesg($mesg); - llxFooter(); $db->close(); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index c5d19eb9109..92e047b4a08 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * 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 @@ -82,12 +82,12 @@ if ($action == 'settaxmode') if (! $error) { $db->commit(); - $mesg = "".$langs->trans("SetupSaved").""; + setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); - $mesg = "".$langs->trans("Error").""; + setEventMessage($langs->trans("Error"),'errors'); } @@ -208,8 +208,6 @@ else print ''; } -dol_htmloutput_mesg($mesg); - $db->close(); llxFooter();