Пример #1
0
 public function test($object, Validation_Errors $errors, $array_access = false)
 {
     Core::load('CMS.Protect');
     $value = trim($this->value_of_attribute($object, $this->attribute, $array_access));
     $code = $this->value_of_attribute($object, CMS_Fields_Types_Protect::field_code($this->attribute), $array_access);
     $key = CMS_Protect::key($code);
     if ($value == '' || $value != $key) {
         $errors->reject_value($this->attribute, $this->message);
     }
     return false;
 }
Пример #2
0
 protected function not_found($uri, $env, $r)
 {
     if ($m = Core_Regexps::match_with_results('{^([^?]+)\\?}', $uri)) {
         $uri = $m[1];
     }
     if ($m = Core_Regexps::match_with_results('{^/digital-protect/(.*)}', $uri)) {
         Core::load('CMS.Protect');
         CMS_Protect::draw($m[1]);
         die;
     }
     if ($m = Core_Regexps::match_with_results('{^/check-digital-protect/([^/]+)/(.*)}', $uri)) {
         Core::load('CMS.Protect');
         CMS_Protect::check($m[1], $m[2]);
         die;
     }
     return $r;
 }