diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index 68237fd4f6e..ea6a948f0e4 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2011 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 @@ -35,18 +36,22 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); -$langs->load("@externalsite"); +$langs->load("externalsite"); $def = array(); +$action = GETPOST("action"); + // Sauvegardes parametres -if ($_POST["action"] == 'update') +if ($action == 'update') { $i=0; $db->begin(); + + $exturl = GETPOST("EXTERNALSITE_URL"); - $i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($_POST["EXTERNALSITE_URL"]),'chaine',0,'',$conf->entity); + $i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity); //$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($_POST["EXTERNALSITE_LABEL"]),'chaine',0,'',$conf->entity); if ($i >= 1) @@ -57,7 +62,7 @@ if ($_POST["action"] == 'update') else { $db->rollback(); - $mesg=$db->lasterror(); + $mesg="
".$db->lasterror()."
"; } } @@ -110,7 +115,7 @@ print ""; print "\n"; -if ($mesg) print "
$mesg
"; +dol_htmloutput_mesg($mesg); $db->close(); diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 988926a39a9..ce26f3f3ab2 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -1,5 +1,6 @@ + * Copyright (C) 2011 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 @@ -33,6 +34,9 @@ if (!$user->admin) accessforbidden(); $def = array(); $lastftpentry=0; +$action = GETPOST("action"); +$entry = GETPOST("numero_entry"); + // Positionne la variable pour le nombre de rss externes $sql ="select MAX(name) as name from ".MAIN_DB_PREFIX."const"; $sql.=" WHERE name like 'FTP_SERVER_%'"; @@ -48,21 +52,21 @@ else dol_print_error($db); } -if ($_POST["action"] == 'add' || $_POST["modify"]) +if ($action == 'add' || GETPOST("modify")) { - $ftp_name = "FTP_NAME_" . $_POST["numero_entry"]; - $ftp_server = "FTP_SERVER_" . $_POST["numero_entry"]; + $ftp_name = "FTP_NAME_" . $entry;// $_POST["numero_entry"]; + $ftp_server = "FTP_SERVER_" . $entry; //$_POST["numero_entry"]; $error=0; $mesg=''; - if (empty($_POST[$ftp_name])) + if (! GETPOST("$ftp_name")) { $error=1; $mesg.='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'
'; } - if (empty($_POST[$ftp_server])) + if (! GETPOST("$ftp_server")) { $error=1; $mesg.='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Server")).'
'; @@ -70,17 +74,18 @@ if ($_POST["action"] == 'add' || $_POST["modify"]) if (! $error) { - $ftp_port = "FTP_PORT_" . $_POST["numero_entry"]; - $ftp_user = "FTP_USER_" . $_POST["numero_entry"]; - $ftp_password = "FTP_PASSWORD_" . $_POST["numero_entry"]; + + $ftp_port = "FTP_PORT_" . $entry; + $ftp_user = "FTP_USER_" . $entry; + $ftp_password = "FTP_PASSWORD_" . $entry; $db->begin(); - $result1=dolibarr_set_const($db, "FTP_PORT_" . $_POST["numero_entry"],$_POST[$ftp_port],'chaine',0,'',$conf->entity); - if ($result1) $result2=dolibarr_set_const($db, "FTP_SERVER_" . $_POST["numero_entry"],$_POST[$ftp_server],'chaine',0,'',$conf->entity); - if ($result2) $result3=dolibarr_set_const($db, "FTP_USER_" . $_POST["numero_entry"],$_POST[$ftp_user],'chaine',0,'',$conf->entity); - if ($result3) $result4=dolibarr_set_const($db, "FTP_PASSWORD_" . $_POST["numero_entry"],$_POST[$ftp_password],'chaine',0,'',$conf->entity); - if ($result4) $result5=dolibarr_set_const($db, "FTP_NAME_" . $_POST["numero_entry"],$_POST[$ftp_name],'chaine',0,'',$conf->entity); + $result1=dolibarr_set_const($db, "FTP_PORT_" . $entry,GETPOST($ftp_port),'chaine',0,'',$conf->entity); + if ($result1) $result2=dolibarr_set_const($db, "FTP_SERVER_" . $entry, GETPOST($ftp_server),'chaine',0,'',$conf->entity); + if ($result2) $result3=dolibarr_set_const($db, "FTP_USER_" . $entry,GETPOST($ftp_user),'chaine',0,'',$conf->entity); + if ($result3) $result4=dolibarr_set_const($db, "FTP_PASSWORD_" . $entry,GETPOST($ftp_password),'chaine',0,'',$conf->entity); + if ($result4) $result5=dolibarr_set_const($db, "FTP_NAME_" . $entry,GETPOST($ftp_name),'chaine',0,'',$conf->entity); if ($result1 && $result2 && $result3 && $result4 && $result5) { @@ -99,15 +104,15 @@ if ($_POST["action"] == 'add' || $_POST["modify"]) if ($_POST["delete"]) { - if(isset($_POST["numero_entry"])) + if($entry) { $db->begin(); - $result1=dolibarr_del_const($db,"ftp_port_" . $_POST["numero_entry"],$conf->entity); - if ($result1) $result2=dolibarr_del_const($db,"ftp_server_" . $_POST["numero_entry"],$conf->entity); - if ($result2) $result3=dolibarr_del_const($db,"ftp_user_" . $_POST["numero_entry"],$conf->entity); - if ($result3) $result4=dolibarr_del_const($db,"ftp_password_" . $_POST["numero_entry"],$conf->entity); - if ($result4) $result5=dolibarr_del_const($db,"ftp_name_" . $_POST["numero_entry"],$conf->entity); + $result1=dolibarr_del_const($db,"ftp_port_" . $entry,$conf->entity); + if ($result1) $result2=dolibarr_del_const($db,"ftp_server_" . $entry,$conf->entity); + if ($result2) $result3=dolibarr_del_const($db,"ftp_user_" . $entry,$conf->entity); + if ($result3) $result4=dolibarr_del_const($db,"ftp_password_" . $entry,$conf->entity); + if ($result4) $result5=dolibarr_del_const($db,"ftp_name_" . $entry,$conf->entity); if ($result1 && $result2 && $result3 && $result4 && $result5) { @@ -141,7 +146,6 @@ if (! function_exists('ftp_connect')) } else { - if ($mesg) print $mesg; // Formulaire ajout print '
'; @@ -282,6 +286,7 @@ else } +dol_htmloutput_mesg($mesg); $db->close(); diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 00539aae740..043643d0318 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2011 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 @@ -34,29 +35,41 @@ $langs->load("paybox"); if (!$user->admin) accessforbidden(); + +$action = GETPOST("action"); -if ($_POST["action"] == 'setvalue' && $user->admin) +if ($action == 'setvalue' && $user->admin) { + $db->begin; //$result=dolibarr_set_const($db, "PAYBOX_IBS_DEVISE",$_POST["PAYBOX_IBS_DEVISE"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V1",$_POST["PAYBOX_CGI_URL_V1"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V2",$_POST["PAYBOX_CGI_URL_V2"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_IBS_SITE",$_POST["PAYBOX_IBS_SITE"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_IBS_RANG",$_POST["PAYBOX_IBS_RANG"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",$_POST["PAYBOX_PBX_IDENTIFIANT"],'chaine',0,'',$conf->entity); - - $result=dolibarr_set_const($db, "PAYBOX_CREDITOR",$_POST["PAYBOX_CREDITOR"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_CSS_URL",$_POST["PAYBOX_CSS_URL"],'chaine',0,'',$conf->entity); - - $result=dolibarr_set_const($db, "PAYBOX_MESSAGE_OK",$_POST["PAYBOX_MESSAGE_OK"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",$_POST["PAYBOX_MESSAGE_KO"],'chaine',0,'',$conf->entity); - - if ($result >= 0) + $result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V1", GETPOST("PAYBOX_CGI_URL_V1"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_CGI_URL_V2",GETPOST("PAYBOX_CGI_URL_V2"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_IBS_SITE",GETPOST("PAYBOX_IBS_SITE"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_IBS_RANG",GETPOST("PAYBOX_IBS_RANG"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_PBX_IDENTIFIANT",GETPOST("PAYBOX_PBX_IDENTIFIANT"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_CREDITOR",GETPOST("PAYBOX_CREDITOR"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_CSS_URL",GETPOST("PAYBOX_CSS_URL"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_MESSAGE_OK",GETPOST("PAYBOX_MESSAGE_OK"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST("PAYBOX_MESSAGE_KO"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + + if (! $error) { + $db->commit(); $mesg='
'.$langs->trans("SetupSaved").'
'; } else { + $db->rollback(); dol_print_error($db); } } @@ -80,9 +93,6 @@ print_fiche_titre($langs->trans("PayBoxSetup"),$linkback,'setup'); print $langs->trans("PayBoxDesc")."
\n"; - -if ($mesg) print '
'.$mesg; - print '
'; print ''; print ''; @@ -209,6 +219,8 @@ if ($conf->adherent->enabled) print "
"; print info_admin($langs->trans("YouCanAddTagOnUrl")); +dol_htmloutput_mesg($mesg); + $db->close(); llxFooter(); diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 860cf5e3577..c403738969b 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2011 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 @@ -38,30 +39,44 @@ $langs->load("paybox"); if (!$user->admin) accessforbidden(); +$action = GETPOST("action"); -if ($_POST["action"] == 'setvalue' && $user->admin) +if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",$_POST["PAYPAL_API_SANDBOX"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_API_USER",$_POST["PAYPAL_API_USER"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",$_POST["PAYPAL_API_PASSWORD"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_API_SIGNATURE",$_POST["PAYPAL_API_SIGNATURE"],'chaine',0,'',$conf->entity); - - $result=dolibarr_set_const($db, "PAYPAL_CREDITOR",$_POST["PAYPAL_CREDITOR"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$_POST["PAYPAL_API_INTEGRAL_OR_PAYPALONLY"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",$_POST["PAYPAL_CSS_URL"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",$_POST["PAYPAL_SECURITY_TOKEN"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN_UNIQUE",$_POST["PAYPAL_SECURITY_TOKEN_UNIQUE"],'chaine',0,'',$conf->entity); - - $result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",$_POST["PAYPAL_ADD_PAYMENT_URL"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",$_POST["PAYPAL_MESSAGE_OK"],'chaine',0,'',$conf->entity); - $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",$_POST["PAYPAL_MESSAGE_KO"],'chaine',0,'',$conf->entity); - - if ($result >= 0) + $db->begin; + $result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",GETPOST("PAYPAL_API_SANDBOX"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_API_USER",GETPOST("PAYPAL_API_USER"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",GETPOST("PAYPAL_API_PASSWORD"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_API_SIGNATURE",GETPOST("PAYPAL_API_SIGNATURE"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_CREDITOR",GETPOST("PAYPAL_CREDITOR"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL_OR_PAYPALONLY",GETPOST("PAYPAL_API_INTEGRAL_OR_PAYPALONLY"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",GETPOST("PAYPAL_CSS_URL"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN",GETPOST("PAYPAL_SECURITY_TOKEN"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_SECURITY_TOKEN_UNIQUE",GETPOST("PAYPAL_SECURITY_TOKEN_UNIQUE"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL",GETPOST("PAYPAL_ADD_PAYMENT_URL"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_OK",GETPOST("PAYPAL_MESSAGE_OK"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST("PAYPAL_MESSAGE_KO"),'chaine',0,'',$conf->entity); + if (! $result > 0) $error++; + + if (! $error) { + $db->commit(); $mesg='
'.$langs->trans("SetupSaved").'
'; } else { + $db->rollback(); dol_print_error($db); } }