Example #1
0
 public function getFieldValue(kScope $scope)
 {
     kApiCache::addExtraField(kApiCache::ECF_COUNTRY, kApiCache::COND_MATCH, $this->getStringValues($scope));
     $ip = $scope->getIp();
     $ipGeo = kGeoCoderManager::getGeoCoder($this->getGeoCoderType());
     return $ipGeo->getCountry($ip);
 }
 protected function getFieldValue(kScope $scope = null)
 {
     kApiCache::addExtraField(kApiCache::ECF_USER_AGENT);
     if (!$scope) {
         $scope = new kScope();
     }
     return $scope->getUserAgent();
 }
 public function getFieldValue(kScope $scope)
 {
     kApiCache::addExtraField(kApiCache::ECF_COORDINATES, kApiCache::COND_GEO_DISTANCE, $this->getStringValues($scope));
     $ip = $scope->getIp();
     $ipGeo = kGeoCoderManager::getGeoCoder($this->getGeoCoderType());
     return array($ipGeo->getCoordinates($ip));
     // wrap in an array since otherwise the coordinates will be perceived as a list of two values
 }
 protected function getFieldValue(kScope $scope = null)
 {
     kApiCache::addExtraField(kApiCache::ECF_IP);
     if (!$scope) {
         $scope = new kScope();
     }
     return $scope->getIp();
 }
Example #5
0
 public function getFieldValue(kScope $scope)
 {
     if ($this->getHttpHeader() || $this->getAcceptInternalIps()) {
         kApiCache::addExtraField(array("type" => kApiCache::ECF_IP, kApiCache::ECFD_IP_HTTP_HEADER => $this->getHttpHeader(), kApiCache::ECFD_IP_ACCEPT_INTERNAL_IPS => $this->getAcceptInternalIps()), kApiCache::COND_IP_RANGE, $this->getStringValues($scope));
         return infraRequestUtils::getIpFromHttpHeader($this->getHttpHeader(), $this->getAcceptInternalIps(), true);
     }
     kApiCache::addExtraField(kApiCache::ECF_IP, kApiCache::COND_IP_RANGE, $this->getStringValues($scope));
     return $scope->getIp();
 }
Example #6
0
 protected function getFieldValue(kScope $scope = null)
 {
     kApiCache::addExtraField(kApiCache::ECF_COUNTRY);
     if (!$scope) {
         $scope = new kScope();
     }
     $ip = $scope->getIp();
     $ipGeo = kGeoCoderManager::getGeoCoder($this->getGeoCoderType());
     $country = $ipGeo->getCountry($ip);
     return trim(strtolower($country), " \n\r\t");
 }
 protected function getFieldValue(kScope $scope = null)
 {
     kApiCache::addExtraField(kApiCache::ECF_COORDINATES);
     if (!$scope) {
         $scope = new kScope();
     }
     $ip = $scope->getIp();
     $ipGeo = kGeoCoderManager::getGeoCoder($this->getGeoCoderType());
     $coordinates = $ipGeo->getCoordinates($ip);
     return implode(",", $coordinates);
 }
Example #8
0
 protected function internalFulfilled(kScope $scope)
 {
     $referrer = $scope->getReferrer();
     if ($this->getNot() === true && !$this->globalWhitelistDomainsAppended && strpos($referrer, "kwidget") === false && kConf::hasParam("global_whitelisted_domains")) {
         $ks = $scope->getKs();
         if (!$ks || !in_array($ks->partner_id, kConf::get('global_whitelisted_domains_exclude'))) {
             $this->globalWhitelistDomainsAppended = true;
             $globalWhitelistedDomains = kConf::get("global_whitelisted_domains");
             if (!is_array($globalWhitelistedDomains)) {
                 $globalWhitelistedDomains = explode(',', $globalWhitelistedDomains);
             }
             foreach ($globalWhitelistedDomains as $globalWhitelistedDomain) {
                 $this->values[] = new kStringValue($globalWhitelistedDomain);
             }
         }
     }
     kApiCache::addExtraField(kApiCache::ECF_REFERRER, kApiCache::COND_SITE_MATCH, $this->getStringValues($scope));
     return parent::internalFulfilled($scope);
 }
 public function getFieldValue(accessControl $accessControl)
 {
     $scope = $accessControl->getScope();
     kApiCache::addExtraField(kApiCache::ECF_USER_AGENT, kApiCache::COND_REGEX, $this->getStringValues($scope));
     return $scope->getUserAgent();
 }
 public function getFieldValue(accessControl $accessControl)
 {
     $scope = $accessControl->getScope();
     kApiCache::addExtraField(kApiCache::ECF_IP, kApiCache::COND_IP_RANGE, $this->getStringValues($scope));
     return $scope->getIp();
 }
Example #11
0
 public function getFieldValue(kScope $scope)
 {
     kApiCache::addExtraField(kApiCache::ECF_IP, kApiCache::COND_IP_RANGE, $this->getStringValues($scope));
     return $scope->getIp();
 }
Example #12
0
 public function getFieldValue(kScope $scope)
 {
     kApiCache::addExtraField(kApiCache::ECF_USER_AGENT, kApiCache::COND_REGEX, $this->getStringValues($scope));
     return $scope->getUserAgent();
 }