<?php
/**
* This file is a part of the CIDRAM package.
* Homepage: https://cidram.github.io/
*
* CIDRAM COPYRIGHT 2016 and beyond by Caleb Mazalevskis (Maikuolan).
*
* License: GNU/GPLv2
* @see LICENSE.txt
*
* This file: Extended rules for Soft Layer CIDRs (last modified: 2019.05.17).
*/
/** Prevents execution from outside of CIDRAM. */
if (!defined('CIDRAM')) {
die('[CIDRAM] This should not be accessed directly.');
}
/** Prevents execution from outside of the CheckFactors closure. */
if (!isset($Factors[$FactorIndex])) {
die('[CIDRAM] This should not be accessed directly.');
}
/** Safety. */
if (!isset($CIDRAM['RunParamResCache'])) {
$CIDRAM['RunParamResCache'] = [];
}
/**
* Define object for these rules for later recall (all parameters inherited from CheckFactors).
*
* @param array $Factors All CIDR factors of the IP being checked.
* @param int $FactorIndex The index of the CIDR factor of the triggered rule.
* @param string $LN The line information generated by CheckFactors.
* @param string $Tag The triggered rule's section's name (if there's any).
*/
$CIDRAM['RunParamResCache']['rules_softlayer.php'] = function (array $Factors = [], int $FactorIndex = 0, string $LN = '', string $Tag = '') use (&$CIDRAM) {
/** Skip further processing if the "block_cloud" directive is false. */
if (!$CIDRAM['Config']['signatures']['block_cloud']) {
return;
}
/** ShowyouBot bypass. */
if (strpos($CIDRAM['BlockInfo']['UALC'], 'showyoubot') !== false) {
return;
}
/** Disqus bypass. */
if (strpos($CIDRAM['BlockInfo']['UALC'], 'disqus') !== false) {
return;
}
/** Feedspot bypass. */
if (strpos($CIDRAM['BlockInfo']['UA'], 'Feedspot http://www.feedspot.com') !== false) {
return;
}
/** Superfeedr bypass. */
if (strpos($CIDRAM['BlockInfo']['UA'], 'Superfeedr bot/2.0') !== false) {
return;
}
/** Feedbot bypass. */
if (strpos($CIDRAM['BlockInfo']['UA'], 'Feedbot') !== false) {
return;
}
$CIDRAM['BlockInfo']['ReasonMessage'] = $CIDRAM['L10N']->getString('ReasonMessage_Cloud');
if (!empty($CIDRAM['BlockInfo']['WhyReason'])) {
$CIDRAM['BlockInfo']['WhyReason'] .= ', ';
}
$CIDRAM['BlockInfo']['WhyReason'] .= $CIDRAM['L10N']->getString('Short_Cloud') . $LN;
if (!empty($CIDRAM['BlockInfo']['Signatures'])) {
$CIDRAM['BlockInfo']['Signatures'] .= ', ';
}
$CIDRAM['BlockInfo']['Signatures'] .= $Factors[$FactorIndex];
$CIDRAM['BlockInfo']['SignatureCount']++;
};
/** Execute object. */
$RunExitCode = $CIDRAM['RunParamResCache']['rules_softlayer.php']($Factors, $FactorIndex, $LN, $Tag);
|