29require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
30require_once DOL_DOCUMENT_ROOT .
'/core/lib/functions.lib.php';
51 if ($nb_post_max > 0) {
52 $sql =
"SELECT COUNT(".(!empty(
$object->table_rowid) ?
$object->table_rowid :
'rowid').
") as nb_posts";
53 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element;
54 $sql .=
" WHERE ip = '".$db->escape(
$object->ip).
"'";
55 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
56 $resql = $db->query($sql);
58 $num = $db->num_rows($resql);
62 $obj = $db->fetch_object($resql);
63 $nb_post_ip = $obj->nb_posts;
66 array_push(
$object->errors, $db->lasterror());
70 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
71 array_push(
$object->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_now($mode='auto')
Return date for now.
getUserRemoteIP()
Return the IP of remote user.
checkNbPostsForASpeceificIp($object, $nb_post_max)
Check if the object exceeded the number of posts for a specific ip in the same week.