mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
ef42231dc3
|
|
@ -48,6 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/availabilities.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/public.lib.php';
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('bookcal')) {
|
||||
|
|
@ -191,6 +192,7 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti
|
|||
$calendar = $object;
|
||||
$contact = new Contact($db);
|
||||
$actioncomm = new ActionComm($db);
|
||||
$nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
|
||||
|
||||
if (!is_object($user)) {
|
||||
$user = new User($db);
|
||||
|
|
@ -229,10 +231,17 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti
|
|||
$contact->lastname = GETPOST("lastname");
|
||||
$contact->firstname = GETPOST("firstname");
|
||||
$contact->email = GETPOST("email");
|
||||
$result = $contact->create($user);
|
||||
if ($result < 0) {
|
||||
$contact->ip = getUserRemoteIP();
|
||||
|
||||
if (checkNbPostsForASpeceificIp($contact, $nb_post_max) <= 0) {
|
||||
$error++;
|
||||
$errmsg .= $contact->error." ".implode(',', $contact->errors);
|
||||
$errmsg .= implode('<br>', $contact->errors);
|
||||
} else {
|
||||
$result = $contact->create($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errmsg .= $contact->error." ".implode(',', $contact->errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -262,11 +271,16 @@ if ($action == 'add' ) { // Test on permission not required here (anonymous acti
|
|||
'transparency' =>0,
|
||||
]
|
||||
];
|
||||
|
||||
$result = $actioncomm->create($user);
|
||||
if ($result < 0) {
|
||||
$actioncomm->ip = getUserRemoteIP();
|
||||
if (checkNbPostsForASpeceificIp($actioncomm, $nb_post_max) <= 0) {
|
||||
$error++;
|
||||
$errmsg .= $actioncomm->error." ".implode(',', $actioncomm->errors);
|
||||
$errmsg .= implode('<br>', $actioncomm->errors);
|
||||
} else {
|
||||
$result = $actioncomm->create($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errmsg .= $actioncomm->error." ".implode(',', $actioncomm->errors);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user