test to do

This commit is contained in:
hystepik
2022-11-28 14:57:51 +01:00
parent bae0a01294
commit 71090cbdd8
8 changed files with 30 additions and 7 deletions

View File

@@ -2315,7 +2315,7 @@ UseOauth=Utiliser un token OAUTH
Images=Images
Posts=publications
MaxNumberOfImagesInGetPost=Nombre maximum d'images autorisées dans un champ HTML soumis dans un formulaire
MaxNumberOfPostOnPublicPagesByIP=Nombre maximum de publications sur des pages publiques avec une adresse IP
MaxNumberOfPostOnPublicPagesByIP=Nombre maximum de publications par mois sur des pages publiques avec une adresse IP
CIDLookupURL=Le module apporte une URL qui peut être utilisée par un outil externe pour obtenir le nom d'un tiers ou d'un contact à partir de son numéro de téléphone. L'URL à utiliser est :
ScriptIsEmpty=Le script est manquant
ShowHideTheNRequests=Afficher/Cacher les %s requête(s) SQL.

View File

@@ -56,6 +56,7 @@ 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.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
global $dolibarr_main_url_root;
@@ -285,13 +286,15 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$confattendee->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;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(ref) as nb_attendee";
$sql .= " FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee";
$sql .= " WHERE ip = '".$db->escape($confattendee->ip)."'";
$sql .= " AND date_creation > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@@ -73,6 +73,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Init vars
$errmsg = '';
@@ -287,13 +288,15 @@ if (empty($reshook) && $action == 'add') {
$adh->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;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(ref) as nb_adh";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent";
$sql .= " WHERE ip = '".$db->escape($adh->ip)."'";
$sql .= " AND datec > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
require_once DOL_DOCUMENT_ROOT."/opensurvey/lib/opensurvey.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Init vars
@@ -99,13 +100,15 @@ if (GETPOST('ajoutcomment', 'alpha')) {
$user_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;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(id_comment) as nb_comments";
$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_comments";
$sql .= " WHERE ip = '".$db->escape($user_ip)."'";
//$sql .= " AND date_creation > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -153,13 +156,15 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // bo
$user_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;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(id_users) as nb_records";
$sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
$sql .= " WHERE ip = '".$db->escape($user_ip)."'";
//$sql .= " AND date_creation > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@@ -59,6 +59,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Init vars
$errmsg = '';
@@ -226,13 +227,15 @@ if (empty($reshook) && $action == 'add') {
$partnership->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;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(ref) as nb_partnerships";
$sql .= " FROM ".MAIN_DB_PREFIX."partnership";
$sql .= " WHERE ip = '".$db->escape($partnership->ip)."'";
$sql .= " AND date_creation > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@@ -57,6 +57,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Init vars
$errmsg = '';
@@ -298,12 +299,14 @@ if (empty($reshook) && $action == 'add') {
$proj->ip = getUserRemoteIP();
$nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 1000);
// Calculate nb of post for IP
$now = dol_now();
$minmonthpost = dol_time_plus_duree($now, -1, "m");
$nb_post_ip = 0;
if ($nb_post_max > 0) { // Calculate only if there is a limit to check
$sql = "SELECT COUNT(rowid) as nb_projets";
$sql .= " FROM ".MAIN_DB_PREFIX."projet";
$sql .= " WHERE ip = '".$db->escape($proj->ip)."'";
$sql .= " AND datec > '".$db->idate($minmonthpost)."'";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);

View File

@@ -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;
@@ -362,7 +363,10 @@ if (empty($reshook) && $action == 'add') {
$conforbooth->datec = dol_now();
$conforbooth->tms = dol_now();
$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;
@@ -370,6 +374,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);

View File

@@ -361,6 +361,7 @@ if (empty($reshook) && $action == 'add') {
$conforbooth->firstname = $contact->firstname;
$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");