80 $this->configPath = $xoops_var_path .
'/configs/';
82 $this->name = $this->
config[
'name'];
93 if (!isset($instance)) {
95 $instance =
new $class();
108 if (
$name ==
'config' ) {
109 $filename =
'captcha.config';
111 $filename =
'captcha.config.' .
$name;
130 $basic_config = array();
131 $plugin_config = array();
132 $filename = ($filename ==
'config') ?
'config.php' :
'config.' . $filename .
'.php';
140 $config = array_merge($basic_config, $plugin_config);
153 $path_file = $this->configPath . $filename .
'.php';
155 return eval(@
$file->read());
168 $path_file = $this->configPath . $filename .
'.php';
170 return $file->write(
'return ' . var_export(
$config,
true) .
';');
182 if (isset($this->active)) {
185 if (!empty($this->
config[
'disabled'])) {
186 $this->active =
false;
189 if (!empty($this->
config[
'skipmember']) &&
$xoops->isUser()) {
190 $this->active =
false;
193 if (!isset($this->handler)) {
196 $this->active = isset($this->handler);
210 $class =
'XoopsCaptcha' . ucfirst(
$name);
211 if (!empty($this->handler) && get_class($this->handler) == $class) {
214 $this->handler = null;
223 if (!class_exists($class)) {
224 $class =
'XoopsCaptchaText';
225 require_once $this->path_basic .
'/text.php';
231 $this->handler->loadConfig($name);
245 foreach (
$configs as $key => $val) {
261 if (isset($this->
$name)) {
282 $sessionName = empty(
$name) ? $this->name :
$name;
283 $skipMember = ($skipMember === null) ?
$_SESSION[
"{$sessionName}_skipmember"] : $skipMember;
284 $maxAttempts =
$_SESSION[
"{$sessionName}_maxattempts"];
285 $attempt =
$_SESSION[
"{$sessionName}_attempt"];
292 if (
$xoops->isUser() && !empty($skipMember)) {
296 if (!empty($maxAttempts) && $attempt > $maxAttempts) {
300 $is_valid = $this->handler->verify($sessionName);
312 $_SESSION[
"{$sessionName}_attempt"] = null;
335 return implode(
'<br />', $this->message);
348 $this->handler->destroyGarbage();
352 $_SESSION[$this->name .
'_' . $k] = null;
365 $sessionName = $this->
config[
'name'];
366 $_SESSION[$sessionName .
'_name'] = $sessionName;
371 if (!$this->active || empty($this->
config[
'name'])) {
375 $maxAttempts = $this->
config[
'maxattempts'];
376 $attempt = isset(
$_SESSION[$sessionName .
'_attempt']) ?
$_SESSION[$sessionName .
'_attempt'] : 0;
377 $_SESSION[$sessionName .
'_attempt'] = $attempt;
380 if (!empty($maxAttempts) && $attempt > $maxAttempts) {
396 if (!$this->active || empty($this->
config[
'name'])) {
399 return $this->handler->renderValidationJS();
426 $form = $this->handler->render();
$_SESSION['RF']["verify"]
static getHandler($name= 'file', $path=false, $create=false, $mode=null)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
readConfig($filename= 'config')
writeConfig($filename= 'config', $config)
destroyGarbage($clearSession=false)
if(DIRECTORY_SEPARATOR!="/") $xoops_root_path
verify($skipMember=null, $name=null)
loadBasicConfig($filename= 'config')
loadConfig($name= 'config')
const E_INVALID_CONFIRMATION_CODE