public static function purgeOldSpam(&$okt) { $defaultDateLastPurge = time(); $defaultModerationTTL = '7'; $init = false; // settings $okt->blog->settings->setNameSpace('antispam'); $dateLastPurge = $okt->blog->settings->antispam_date_last_purge; if ($dateLastPurge === null) { $init = true; $okt->blog->settings->put('antispam_date_last_purge', $defaultDateLastPurge, 'integer', 'Antispam Date Last Purge (unix timestamp)', true, false); $dateLastPurge = $defaultDateLastPurge; } $moderationTTL = $okt->blog->settings->antispam_moderation_ttl; if ($moderationTTL === null) { $okt->blog->settings->put('antispam_moderation_ttl', $defaultModerationTTL, 'integer', 'Antispam Moderation TTL (days)', true, false); $moderationTTL = $defaultModerationTTL; } if ($moderationTTL < 0) { // disabled return; } // we call the purge every day if (time() - $dateLastPurge > 86400) { // update dateLastPurge if (!$init) { $okt->blog->settings->put('antispam_date_last_purge', time(), null, null, true, false); } $date = date('Y-m-d H:i:s', time() - $moderationTTL * 86400); oktAntispam::delAllSpam($okt, $date); } }
if (!isset($filters[$_GET['f']])) { throw new Exception(__('m_antispam_Filter_does_not_exists')); } if (!$filters[$_GET['f']]->hasGUI()) { throw new Exception(__('m_antispam_Filter_no_user_interface')); } $filter = $filters[$_GET['f']]; $filter_gui = $filter->gui($filter->guiURL()); $okt->page->addTitleTag(sprintf(__('m_antispam_%s_configuration'), $filter->name)); $okt->page->addAriane($filter->name, $filter->guiURL()); # button set $okt->page->setButtonset('antispam_filter', array('id' => 'antispam-filter-buttonset', 'type' => '', 'buttons' => array(array('permission' => true, 'title' => __('m_antispam_Return_to_filters'), 'url' => 'module.php?m=antispam', 'ui-icon' => 'arrowreturnthick-1-w')))); } # Remove all spam if (!empty($_POST['delete_all'])) { oktAntispam::delAllSpam($okt); http::redirect($p_url . '&del=1'); } # Update filters if (isset($_POST['filters_upd'])) { $filters_opt = array(); $i = 0; foreach ($filters as $fid => $f) { $filters_opt[$fid] = array(false, $i); $i++; } # Enable active filters if (isset($_POST['filters_active']) && is_array($_POST['filters_active'])) { foreach ($_POST['filters_active'] as $v) { $filters_opt[$v][0] = true; }
/** * Ajout d'une signature * * @param array $data * * @return integer ID de la signature nouvellement ajoutée */ public function addSig($data) { $data['is_spam'] = null; if ($this->okt->modules->moduleExists('antispam')) { $data['is_spam'] = oktAntispam::isSpam('guestbook', $data['nom'], $data['email'], $data['url'], $data['ip'], $data['message']); } if (!is_array($data['is_spam'])) { $data['is_spam'] = array('spam_status' => null, 'spam_filter' => null); } $query = 'INSERT INTO ' . $this->t_guestbook . ' ( ' . 'language, message, nom, email, url, note, ip, date_sign, visible, spam_status, spam_filter ' . ') VALUES ( ' . (is_null($data['language']) ? 'NULL' : '\'' . $this->db->escapeStr($data['language']) . '\'') . ', ' . '\'' . $this->db->escapeStr($data['message']) . '\', ' . (is_null($data['nom']) ? 'NULL' : '\'' . $this->db->escapeStr($data['nom']) . '\'') . ', ' . (is_null($data['email']) ? 'NULL' : '\'' . $this->db->escapeStr($data['email']) . '\'') . ', ' . (is_null($data['url']) ? 'NULL' : '\'' . $this->db->escapeStr($data['url']) . '\'') . ', ' . (is_null($data['note']) ? 'NULL' : (int) $data['note']) . ', ' . (is_null($data['ip']) ? 'NULL' : '\'' . $this->db->escapeStr($data['ip']) . '\'') . ', ' . (empty($data['date']) ? 'NOW()' : '\'' . $this->db->escapeStr(mysql::formatDateTime($data['date'])) . '\'') . ', ' . (int) $data['visible'] . ', ' . (is_null($data['is_spam']['spam_status']) ? 'NULL' : '\'' . $this->db->escapeStr($data['is_spam']['spam_status']) . '\'') . ', ' . (is_null($data['is_spam']['spam_filter']) ? 'NULL' : '\'' . $this->db->escapeStr($data['is_spam']['spam_filter']) . '\'') . ' ' . '); '; if (!$this->db->execute($query)) { return false; } return $this->db->getLastID(); }
</a></li> <?php } else { ?> <li><a href="module.php?m=guestbook&action=index&do=nospam&id=<?php echo $signature->id; echo $url_params; ?> " class="icon flag_green"><?php _e('m_guestbook_Stand_out_as_acceptable'); ?> </a> <?php if ($okt->modules->moduleExists('antispam')) { echo oktAntispam::statusMessage($signature); } ?> </li> <?php } ?> <?php } ?> </ul> </div><!-- .signature-actions --> </div> </div><!-- .signature-box -->