XOOPS  2.6.0
xoopscaptchamethod.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
32 abstract class XoopsCaptchaMethod
33 {
37  public $handler;
38 
42  public $config;
43 
47  public $code;
48 
54  public function __construct($handler = null)
55  {
56  $this->handler = $handler;
57  }
58 
64  public function isActive()
65  {
66  return true;
67  }
68 
76  public function loadConfig($name = '')
77  {
78  if (!is_object($this->handler))
79  $this->config = array();
80  else
81  $this->config = empty($name)
82  ? $this->handler->config
83  : array_merge($this->handler->config, $this->handler->loadConfig($name));
84  }
85 
91  public function getCode()
92  {
93  return strval($this->code);
94  }
95 
101  public function render()
102  {
103  return '';
104  }
105 
109  public function renderValidationJS()
110  {
111  return '';
112  }
113 
121  public function verify($sessionName = null)
122  {
123  $is_valid = false;
124  if (!empty($_SESSION["{$sessionName}_code"])) {
125  $func = !empty($this->config['casesensitive']) ? 'strcmp' : 'strcasecmp';
126  $is_valid = !$func(trim(@$_POST[$sessionName]), $_SESSION["{$sessionName}_code"]);
127  }
128  return $is_valid;
129  }
130 
134  public function destroyGarbage()
135  {
136  return true;
137  }
138 
139 }
$_SESSION['RF']["verify"]
Definition: dialog.php:4
verify($sessionName=null)
__construct($handler=null)