From bae0a0129473c3d145031070d3aaa1be2867c534 Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 28 Nov 2022 11:06:36 +0100 Subject: [PATCH] modif public page --- htdocs/admin/security_other.php | 4 ++-- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/public/project/suggestconference.php | 4 ++++ htdocs/public/ticket/create_ticket.php | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 4bd869103fe..c732ce498e3 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -196,7 +196,7 @@ print ''; print ''.$langs->trans("MaxNumberOfPostOnPublicPagesByIP").''; print ''; print ''; -print ''; +print ' '.strtolower($langs->trans("Files")); print ''; print ''; @@ -204,7 +204,7 @@ print ''; print ''.$langs->trans("MaxNumberOfAttachementOnForms").''; print ''; print ''; -print ''; +print ' '.strtolower($langs->trans("Files")); print ''; print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 94de41fba0a..59fc7227bd3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2320,7 +2320,7 @@ UsePassword=Use a password UseOauth=Use a OAUTH token Images=Images MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form -MaxNumberOfPostOnPublicPagesByIP=Max number of posts on public pages with the same IP address +MaxNumberOfPostOnPublicPagesByIP=Max number of posts on public pages with the same IP address in a month CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is: ScriptIsEmpty=The script is empty ShowHideTheNRequests=Show/hide the %s SQL request(s) @@ -2343,4 +2343,4 @@ DesktopsAndSmartphones=Desktops et smartphones AllowOnlineSign=Allow online signing AllowExternalDownload=Allow external download (without login, using a shared link) DeadlineDayVATSubmission=Deadline day for vat submission on the next month -MaxNumberOfAttachementOnForm=Max number of joinded files in form +MaxNumberOfAttachementOnForms=Max number of joinded files in form diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index bcff02859a0..e0f135d3f56 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -56,6 +56,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; global $dolibarr_main_url_root; @@ -361,6 +362,8 @@ if (empty($reshook) && $action == 'add') { $conforbooth->lastname = $contact->lastname; $conforbooth->ip = getUserRemoteIP(); $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000); + $now = dol_now(); + $minmonthpost = dol_time_plus_duree($now, -1, "m"); // Calculate nb of post for IP $nb_post_ip = 0; @@ -368,6 +371,7 @@ if (empty($reshook) && $action == 'add') { $sql = "SELECT COUNT(ref) as nb_confs"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; $sql .= " WHERE ip = '".$db->escape($conforbooth->ip)."'"; + $sql .= " AND datec > '".$db->idate($minmonthpost)."'"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 43c2e7bbd78..242508b7a8c 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -60,6 +60,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -247,6 +248,8 @@ if (empty($reshook)) { $object->ip = getUserRemoteIP(); $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000); + $now = dol_now(); + $minmonthpost = dol_time_plus_duree($now, -1, "m"); // Calculate nb of post for IP $nb_post_ip = 0; @@ -254,6 +257,7 @@ if (empty($reshook)) { $sql = "SELECT COUNT(ref) as nb_tickets"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket"; $sql .= " WHERE ip = '".$db->escape($object->ip)."'"; + $sql .= " AND datec > '".$db->idate($minmonthpost)."'"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql);