/** * checks banned IP * * @return boolean */ private function checkBannedIps(Pap_Signup_SignupFormContext $context) { $checkIt = Gpf_Settings::get(Pap_Settings::BANNEDIPS_SIGNUPS); if($checkIt != Gpf::YES) { return true; } $bannedIPAddresses = Gpf_Net_Ip::getBannedIPAddresses(Pap_Settings::BANNEDIPS_LIST_SIGNUPS); $checkAction = Gpf_Settings::get(Pap_Settings::BANNEDIPS_SIGNUPS_ACTION); if($bannedIPAddresses === false) { return true; } if($checkAction != self::ACTION_DECLINE && $checkAction != self::ACTION_DONTSAVE) { return true; } $userObject = new Pap_Common_User(); if (Gpf_Net_Ip::ipMatchRange($context->getIp(), $bannedIPAddresses)) { if($checkAction == self::ACTION_DONTSAVE) { $context->getForm()->setErrorMessage($this->_("Not saved by fraud protection - your IP address is banned")); $context->setAllowSave(false); return false; } else if ($checkAction == self::ACTION_DECLINE) { $context->getRow()->setStatus(Gpf_Db_User::DECLINED); } } return true; }
/** * checks for banned IP * * @param Pap_Contexts_Click $context * @return string */ private function checkBannedIP(Pap_Contexts_Click $context) { if(Gpf_Settings::get(Pap_Settings::BANNEDIPS_CLICKS) != Gpf::YES) { $context->debug('Check for banned IP address is not turned on'); return true; } $context->debug('Checking banned IP started'); $bannedIPAddresses = Gpf_Net_Ip::getBannedIPAddresses(Pap_Settings::BANNEDIPS_LIST_CLICKS); if($bannedIPAddresses === false) { $context->debug('List of banned IP addresses is invalid or empty, stop checking'); return true; } $checkAction = Gpf_Settings::get(Pap_Settings::BANNEDIPS_CLICKS_ACTION); if($checkAction != self::ACTION_DECLINE && $checkAction != self::ACTION_DONTSAVE) { $context->debug("Action after check is not correct: '$checkAction'"); return true; } $ip = $context->getVisit()->getIp(); if(Gpf_Net_Ip::ipMatchRange($ip, $bannedIPAddresses)) { if($checkAction == self::ACTION_DONTSAVE) { $context->debug(" STOPPING (setting setDoTrackerSave(false), IP: $ip is banned"); $context->setDoTrackerSave(false); $context->debug(' Checking banned IP endeded'); return false; } else { $context->debug(" DECLINING, IP: $ip is banned"); $this->declineClick($context); $context->debug(' Checking banned IP endeded'); return true; } } else { $context->debug(" IP: $ip is not banned"); } $context->debug(' Checking banned IP endeded'); return true; }
/** * checks for duplicate records from same IP * * @param Pap_Contexts_Action $context * @return string */ private function checkSalesFromBannedIP(Pap_Contexts_Action $context) { $checkIt = Gpf_Settings::get(Pap_Settings::BANNEDIPS_SALES); if($checkIt != Gpf::YES) { $context->debug(' Check for sales / leads with banned IP is not turned on'); return true; } $context->debug(' Checking banned IP address of sales / leads started'); $bannedIPAddresses = Gpf_Net_Ip::getBannedIPAddresses(Pap_Settings::BANNEDIPS_LIST_SALES); if($bannedIPAddresses === false) { $context->debug("List of banned IP addresses is invalid or empty, stop checking"); return true; } $checkAction = Gpf_Settings::get(Pap_Settings::BANNEDIPS_SALES_ACTION); if($checkAction != self::ACTION_DECLINE && $checkAction != self::ACTION_DONTSAVE) { $context->debug("Action after check is not correct: '$checkAction'"); return true; } $ip = $context->getIp(); if(Gpf_Net_Ip::ipMatchRange($ip, $bannedIPAddresses)) { if($checkAction == self::ACTION_DONTSAVE) { $context->debug(" STOPPING (setting setDoCommissionsSave(false), IP: $ip is banned"); $context->setDoCommissionsSave(false); $context->debug(' Checking banned IP of sales / leads endeded'); return false; } else { $context->debug(" DECLINING, IP is banned: $ip"); $message = Gpf_Settings::get(Pap_Settings::BANNEDIPS_SALES_MESSAGE); $this->declineAction($context, $message); $context->debug(' Checking banned IP of sales / leads endeded'); return true; } } else { $context->debug(" IP $ip is not banned"); } $context->debug(' Checking banned IP of sales / leads endeded'); return true; }