[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/options/form/field_types/captcha_gd1/ -> captcha_gd1.php (source)

   1  <?php
   2  if (!extension_loaded('gd')) return;
   3  
   4  class MP_Form_field_type_captcha_gd1 extends MP_form_field_type_
   5  {
   6      var $file    = __FILE__;
   7  
   8      var $id    = 'captcha_gd1';
   9  
  10      var $category = 'composite';
  11      var $order    = 90;
  12  
  13  	function submitted($field)
  14      {
  15          $value    = trim($_POST[$this->prefix][$field->form_id][$field->id]);
  16  
  17          $required     = true;
  18          $empty = empty($value);
  19  
  20          if ($empty)
  21          {
  22              $field->submitted['on_error'] = 1;
  23              return $field;
  24          }
  25          else
  26          {
  27              @session_start();
  28              include($_SESSION['cryptogra']['settings']);
  29              $code = ($difuplow) ? $value : strtoupper($value);
  30  
  31              switch (strtolower($cryptsecure)) 
  32              {    case 'md5' : $code = md5($code);  break;
  33                  case 'sha1': $code = sha1($code); break;
  34              }
  35              if ((!$_SESSION['cryptogra']['code']) || ($_SESSION['cryptogra']['code'] != $code))
  36              {
  37                  $field->submitted['on_error'] = 1;
  38                  return $field;
  39              }
  40          }
  41  
  42          $field->submitted['value'] = 1;
  43          $field->submitted['text']  = __('ok', MP_TXTDOM);
  44  
  45          return $field;
  46      }
  47  
  48  	function attributes_filter($no_reset)
  49      {
  50          if (!$no_reset) return;
  51          
  52          $this->attributes_filter_css();
  53      }
  54  
  55  	function build_tag()
  56      {
  57          $id_input     = $this->get_id($this->field);
  58          $tag_input     = parent::build_tag();
  59  
  60          $id_img     = $id_input . '_img';
  61          $tag_img     = "<img id='$id_img' src='" . esc_url(MP_Action_url . '?id=' . $this->field->id . '&action=1ahctpac') . "' alt='' />";
  62  
  63          $this->field->type = $this->id;
  64  
  65          $form_format =  '{{img}}<br />{{input}}';
  66  
  67          $form_format = $this->get_formats($form_format);
  68  
  69          $search[] = '{{img}}';        $replace[] = '%1$s';
  70          $search[] = '{{id_img}}';     $replace[] = '%2$s';
  71          $search[] = '{{input}}';     $replace[] = '%3$s';
  72          $search[] = '{{id_input}}';    $replace[] = '%4$s';
  73  
  74          $html = str_replace($search, $replace,  $form_format);
  75  
  76          return sprintf($html, $tag_img, $id_img, $tag_input, $id_input);
  77      }
  78  }
  79  new MP_Form_field_type_captcha_gd1(__('Captcha 1', MP_TXTDOM));


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1