Go to the documentation of this file.
8 require_once(
'../inc/header.inc.php' );
9 require_once( CH_DIRECTORY_PATH_INC .
'design.inc.php' );
10 require_once( CH_DIRECTORY_PATH_INC .
'admin_design.inc.php' );
11 require_once( CH_DIRECTORY_PATH_INC .
'admin.inc.php' );
22 'form_attrs' => array(
23 'id' =>
'sys-adm-dnsbl-add',
24 'name' =>
'sys-adm-dnsbl-add',
25 'action' => CH_WSB_URL_ADMIN .
'antispam.php?action=dnsbl_add&mode='.$sDefaultMode,
31 'table' =>
'sys_dnsbl_rules',
33 'submit_name' =>
'dnsbl_add',
42 'caption' =>
_t(
'_sys_adm_fld_dnsbl_chain'),
48 'error' =>
_t (
'_sys_adm_form_err_required_field'),
55 'zonedomain' => array(
57 'name' =>
'zonedomain',
58 'caption' =>
_t(
'_sys_adm_fld_dnsbl_zonedomain'),
62 'error' =>
_t (
'_sys_adm_form_err_required_field'),
71 'name' =>
'postvresp',
72 'caption' =>
_t(
'_sys_adm_fld_dnsbl_postvresp'),
76 'error' =>
_t (
'_sys_adm_form_err_required_field'),
86 'caption' =>
_t(
'_sys_adm_fld_dnsbl_url'),
95 'caption' =>
_t(
'_sys_adm_fld_dnsbl_recheck_url'),
104 'caption' =>
_t(
'_sys_adm_fld_dnsbl_comment'),
113 'caption' =>
_t(
'_sys_adm_fld_dnsbl_active'),
114 'values' => array (1 =>
_t(
'_Yes'), 0 =>
_t(
'_No')),
123 'name' =>
'dnsbl_add',
124 'value' =>
_t(
'_Submit'),
130 parent::__construct ($aCustomForm);
138 $aCustomForm = array(
140 'form_attrs' => array(
141 'id' =>
'sys-adm-dnsbl-recheck',
142 'name' =>
'sys-adm-dnsbl-recheck',
143 'onsubmit' =>
"return bs_sys_adm_dbsbl_recheck($('#$sId').val());",
151 'attrs' => array(
'id' =>
$sId),
159 'name' =>
'dnsbl_recheck',
160 'value' =>
_t(
'_Submit'),
166 parent::__construct ($aCustomForm);
175 if (isset(
$_GET[
'popup'])) {
177 switch (
$_GET[
'popup']) {
180 $sPopupTitle =
_t(
'_sys_adm_title_dnsbl_log');
185 $sPopupTitle =
_t(
'_sys_adm_title_dnsbluri_log');
190 $sPopupTitle =
_t(
'_sys_adm_title_akismet_log');
194 case 'stopforumspam_log':
195 $sPopupTitle =
_t(
'_sys_adm_title_stopforumspam_log');
199 case 'botdetection_log':
200 $sPopupTitle =
_t(
'_sys_adm_title_botdetection_log');
204 case 'dnsbl_recheck':
205 $sPopupTitle =
_t(
'_sys_adm_title_dnsbl_recheck');
207 $sPopupContent =
PageCodeRecheckPopup ($aChains,
_t(
'_sys_adm_fld_dnsbl_recheck'),
'sys-adm-dnsbl-test',
'dnsbl-recheck-ip');
210 case 'dnsbluri_recheck':
211 $sPopupTitle =
_t(
'_sys_adm_title_dnsbluri_recheck');
213 $sPopupContent =
PageCodeRecheckPopup ($aChains,
_t(
'_sys_adm_fld_dnsbluri_recheck'),
'sys-adm-dnsbl-test',
'dnsbl-recheck-uri');
217 $sPopupTitle =
_t(
'_sys_adm_btn_dnsbl_help');
218 $sPopupContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_dnsbl_help.html', array(
'text' =>
_t(
'_sys_adm_btn_dnsbl_help_text')));
220 case 'dnsbluri_help':
221 $sPopupTitle =
_t(
'_sys_adm_btn_dnsbl_help');
222 $sPopupContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_dnsbl_help.html', array(
'text' =>
_t(
'_sys_adm_btn_dnsbluri_help_text')));
225 $sPopupTitle =
_t(
'_sys_adm_btn_dnsbl_add');
227 $sPopupContent =
$oForm->getCode();
230 $sPopupTitle =
_t(
'_sys_adm_btn_dnsbl_add');
232 $sPopupContent =
$oForm->getCode();
236 $sPopupContent =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'design_box_content.html', array(
237 'content' => $sPopupContent
240 header(
"Content-type: text/html; charset=utf-8");
241 echo
$GLOBALS[
'oFunctions']->popupBox(
'adm_antispam_popup', $sPopupTitle, $sPopupContent);
248 case (isset(
$_GET[
'action']) &&
$_GET[
'action'] ==
'log' && isset(
$_GET[
'type'])):
249 header(
"Content-type: text/html; charset=utf-8");
253 case (isset($_POST[
'action']) && isset($_POST[
'id']) && isset($_POST[
'test'])):
256 $aChain =
$GLOBALS[
'MySQL']->getAll(
"SELECT `zonedomain`, `postvresp` FROM `sys_dnsbl_rules` WHERE `id` = ? AND `active` = 1", [$_POST[
'id']]);
260 if ($_POST[
'action'] ==
'dnsbl-recheck-ip') {
261 $iRet =
$o->dnsbl_lookup_ip($aChain, $_POST[
'test']);
262 } elseif ($_POST[
'action'] ==
'dnsbl-recheck-uri') {
263 $sUrl = preg_replace(
'/^\w+:\/\//',
'', $_POST[
'test']);
265 $oChWsbDNSURIBlacklists =
ch_instance(
'ChWsbDNSURIBlacklists');
266 $aUrls = $oChWsbDNSURIBlacklists->validateUrls(array(
$sUrl));
268 $iRet =
$o->dnsbl_lookup_uri($aUrls[0], $aChain);
285 case (isset($_POST[
'adm-dnsbl-activate'])):
286 foreach($_POST[
'rules']
as $iRuleId)
287 db_res(
"UPDATE `sys_dnsbl_rules` SET `active` = 1 WHERE `id` = " . (
int)$iRuleId);
291 case (isset($_POST[
'adm-dnsbl-deactivate'])):
292 foreach($_POST[
'rules']
as $iRuleId)
293 db_res(
"UPDATE `sys_dnsbl_rules` SET `active` = 0 WHERE `id` = " . (
int)$iRuleId);
297 case (isset($_POST[
'adm-dnsbl-delete'])):
298 foreach($_POST[
'rules']
as $iRuleId)
299 db_res(
"DELETE FROM `sys_dnsbl_rules` WHERE `id` = " . (
int)$iRuleId);
303 case (isset(
$_GET[
'action']) &&
'dnsbl_add' ==
$_GET[
'action'] && $_POST[
'dnsbl_add']):
306 if (
$oForm->isSubmittedAndValid () &&
$oForm->insert (array(
'added' =>
time())))
316 'option' =>
'sys_dnsbl_enable',
317 'title' =>
_t(
'_sys_adm_page_cpt_dnsbl'),
318 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=dnsbl',
319 'func' =>
'PageCodeDNSBL',
322 'dnsbluri' => array (
323 'option' =>
'sys_uridnsbl_enable',
324 'title' =>
_t(
'_sys_adm_page_cpt_uridnsbl'),
325 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=dnsbluri',
326 'func' =>
'PageCodeDNSBL',
330 'option' =>
'sys_akismet_enable',
331 'title' =>
_t(
'_sys_adm_page_cpt_akismet'),
332 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=akismet',
333 'func' =>
'PageCodeAkismet',
334 'func_params' => array(
'akismet'),
336 'stopforumspam' => array (
337 'option' =>
'sys_stopforumspam_enable',
338 'title' =>
_t(
'_sys_adm_page_cpt_stopforumspam'),
339 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=stopforumspam',
340 'func' =>
'PageCodeStopForumSpam',
341 'func_params' => array(
'stopforumspam'),
343 'botdetection' => array (
344 'option' =>
'sys_antispam_bot_check',
345 'title' =>
_t(
'_sys_adm_page_cpt_botdetection'),
346 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=botdetection',
347 'func' =>
'PageCodeBotDetection',
348 'func_params' => array(
'botdetection'),
350 'settings' => array (
352 'title' =>
_t(
'_Settings'),
353 'url' => CH_WSB_URL_ADMIN .
'antispam.php?mode=settings',
354 'func' =>
'PageCodeSettings',
355 'func_params' => array(),
370 'title' => $r[
'title'],
371 'active' => $k ==
$sMode ? 1 : 0
381 'css_name' => array(
'forms_adv.css',
'antispam.css'),
391 'adm-dnsbl-delete' =>
_t(
'_sys_adm_btn_dnsbl_delete'),
392 'adm-dnsbl-activate' =>
_t(
'_sys_adm_btn_dnsbl_activate'),
393 'adm-dnsbl-deactivate' =>
_t(
'_sys_adm_btn_dnsbl_deactivate'),
396 $sPlaceholders = implode(
',', array_fill(0, count($aChains),
'?'));
397 $aRules =
$GLOBALS[
'MySQL']->getAll(
"SELECT * FROM `sys_dnsbl_rules` WHERE `chain` IN($sPlaceholders) ORDER BY `chain`, `added` ", $aChains);
398 foreach ($aRules
as $k => $r) {
403 $sTopControls =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_manage_dnsbl_top_controls.html', array(
404 'status' => $bMode ?
_t(
'_sys_adm_enabled') :
_t(
'_sys_adm_disabled'),
405 'status_class' =>
'sys-adm-' . ($bMode ?
'enabled' :
'disabled'),
409 if (is_array($aRules) && !
empty($aRules)) {
410 $s =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_manage_dnsbl.html', array(
411 'top_controls' => $sTopControls,
412 'ch_repeat:items' => $aRules,
413 'controls' => $sControls,
414 'global_message' =>
$GLOBALS[
'sGlMsg'],
418 $s =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_manage_dnsbl.html', array(
419 'top_controls' => $sTopControls,
420 'ch_repeat:items' => array(),
422 'global_message' =>
MsgBox(
_t(
'_Empty')),
434 $sKeyStatusClass =
'';
435 $sKeyStatus =
_t(
'_sys_adm_akismet_key_empty');
436 if (
getParam(
'sys_akismet_api_key')) {
439 if ($oChWsbAkismet->oAkismet->isKeyValid()) {
440 $sKeyStatusClass =
'sys-adm-enabled';
441 $sKeyStatus =
_t(
'_sys_adm_akismet_key_valid');
443 $sKeyStatusClass =
'sys-adm-disabled';
444 $sKeyStatus =
_t(
'_sys_adm_akismet_key_invalid');
449 $sTopControls =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_akismet_top_controls.html', array(
450 'status' => $bMode ?
_t(
'_sys_adm_enabled') :
_t(
'_sys_adm_disabled'),
451 'status_class' =>
'sys-adm-' . ($bMode ?
'enabled' :
'disabled')
454 $s =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_akismet.html', array(
455 'top_controls' => $sTopControls,
456 'key_status' => $sKeyStatus,
457 'key_status_class' => $sKeyStatusClass,
467 $sKeyStatusClass =
'';
468 $sKeyStatus =
_t(
'_sys_adm_stopforumspam_key_empty');
469 if (
getParam(
'sys_stopforumspam_api_key')) {
470 $sKeyStatusClass =
'sys-adm-enabled';
471 $sKeyStatus =
_t(
'_sys_adm_stopforumspam_key_specified');
475 $sTopControls =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_stopforumspam_top_controls.html', array(
476 'status' => $bMode ?
_t(
'_sys_adm_enabled') :
_t(
'_sys_adm_disabled'),
477 'status_class' =>
'sys-adm-' . ($bMode ?
'enabled' :
'disabled')
480 $s =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_akismet.html', array(
481 'top_controls' => $sTopControls,
482 'key_status' => $sKeyStatus,
483 'key_status_class' => $sKeyStatusClass,
494 $sTopControls =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_botdetection_top_controls.html', array(
495 'status' => $bMode ?
_t(
'_sys_adm_enabled') :
_t(
'_sys_adm_disabled'),
496 'status_class' =>
'sys-adm-' . ($bMode ?
'enabled' :
'disabled')
500 $iY = (int)date(
'Y');
501 $iM = (int)date(
'm');
502 $iD = (int)date(
'd');
503 $iN = (int)date(
'N');
504 if($iN == 7) $iN = 0;
506 $iTimeD = strtotime($sT .
'midnight');
507 $iTimeW = strtotime($sT .
'- ' . $iN .
' day midnight');
508 $iTimeM = strtotime($iY .
'-' . $iM .
'-1 midnight');
510 $iToday =
$GLOBALS[
'MySQL']->getOne(
"SELECT COUNT(`ip`) FROM `sys_antispam_block_log` WHERE `type` = 'botdetection' AND `added` > '$iTimeD'");
511 $iWeek =
$GLOBALS[
'MySQL']->getOne(
"SELECT COUNT(`ip`) FROM `sys_antispam_block_log` WHERE `type` = 'botdetection' AND `added` > '$iTimeW'");
512 $iMonth =
$GLOBALS[
'MySQL']->getOne(
"SELECT COUNT(`ip`) FROM `sys_antispam_block_log` WHERE `type` = 'botdetection' AND `added` > '$iTimeM'");
515 $s =
$GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_botdetection.html', array(
516 'top_controls' => $sTopControls,
517 'key_status' => $sKeyStatus,
518 'key_status_class' => $sKeyStatusClass,
519 'ch_if:botdetection' => array(
520 'condition' => $bMode,
522 'blocked_today' => $iToday,
523 'blocked_week' => $iWeek,
524 'blocked_month' => $iMonth,
534 $sPlaceholders = implode(
',', array_fill(0, count($aChains),
'?'));
535 $aRules =
$GLOBALS[
'MySQL']->getAll(
"SELECT * FROM `sys_dnsbl_rules` WHERE `chain` IN($sPlaceholders) AND `active` = 1 ORDER BY `chain`, `added` ", $aChains);
537 return $GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_dnsbl_recheck.html', array(
539 'txt_not_listed' =>
ch_js_string(
_t(
'_sys_adm_dnsbl_not_listed')),
541 'form' =>
$oForm->getCode(),
543 'admin_url' => CH_WSB_URL_ADMIN,
544 'ch_repeat:items' => $aRules,
554 case 'stopforumspam':
565 $aLog =
$GLOBALS[
'MySQL']->getAll(
"SELECT SQL_CALC_FOUND_ROWS * FROM `sys_antispam_block_log` WHERE `type` = ? ORDER BY `added` DESC LIMIT $iStart, $iPerPage", [
$sMode]);
566 $iCount =
$GLOBALS[
'MySQL']->getOne(
"SELECT FOUND_ROWS()");
567 foreach ($aLog
as $k => $r) {
568 $aLog[$k][
'ip'] = long2ip ($r[
'ip']);
569 $aLog[$k][
'member_url'] = $r[
'member_id'] ?
getProfileLink($r[
'member_id']) :
'javascript:void(0);';
570 $aLog[$k][
'member_nickname'] = $r[
'member_id'] ?
getNickName($r[
'member_id']) :
_t(
'_Guest');
577 $sUrlStart = CH_WSB_URL_ADMIN .
'antispam.php?action=log&type='.$sMode;
579 'page_url' =>
'javascript:void(0);',
583 'on_change_page' =>
"getHtmlData('sys-adm-antispam-log', '{$sUrlStart}&page={page}');",
586 $sPaginate = $oPaginate->getSimplePaginate(
false, -1, -1,
false);
589 if (is_array($aLog) && !
empty($aLog)) {
590 return $GLOBALS[
'oAdmTemplate']->parseHtmlByName(
'antispam_log.html', array(
591 'ch_repeat:items' => $aLog,
592 'paginate' => $sPaginate,
607 if (isset($_POST[
'save']) && isset($_POST[
'cat']))
const CH_WSB_DNSBL_CHAIN_WHITELIST
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
const CH_WSB_DNSBL_POSITIVE
MsgBox($sText, $iTimer=0)
ch_js_string($mixedInput, $iQuoteType=CH_ESCAPE_STR_AUTO)
defineTimeInterval($iTime, $bAutoDateConvert=true, $bShort=false)
PageCodeBotDetection($sMode)
$_page_cont[$iNameIndex]['page_main_code']
ch_import($sClassName, $aModule=array())
if(isset($_GET['popup'])) switch(true) $aPages
ch_html_attribute($mixedInput)
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
getParam($sParamName, $bUseCache=true)
const CH_WSB_DNSBL_CHAIN_SPAMMERS
const CH_WSB_DNSBL_NEGATIVE
ch_instance($sClassName, $aParams=array(), $aModule=array())
PageCodeAdmin($oTemplate=null)
_t($key, $arg0="", $arg1="", $arg2="")
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
member_auth($member=0, $error_handle=true, $bAjx=false)
getProfileLink( $iID, $sLinkAdd='')
PageCodeRecheckPopup($aChains, $sFieldTitle, $sId, $sAction)
const CH_WSB_DNSBL_CHAIN_URIDNS
db_res($query, $bindings=[])
PageCodeStopForumSpam($sMode)
static showAdminActionsPanel($sWrapperId, $aButtons, $sCheckboxName='entry', $bSelectAll=true, $bSelectAllChecked=false, $sCustomHtml='')
const CH_WSB_DNSBL_FAILURE
Attr AllowedRel this is empty
PageCodeDNSBL($aChains, $sMode)