Exemplo n.º 1
0
 /**
  * @param string	$caption	Caption of the form element, default value is defined in captcha/language/
  * @param string	$name		Name for the input box
  * @param boolean	$skipmember	Skip CAPTCHA check for members
  * @param int		$numchar	Number of characters in image mode, and input box size for text mode
  * @param int		$minfontsize	Minimum font-size of characters in image mode
  * @param int		$maxfontsize	Maximum font-size of characters in image mode
  * @param int		$backgroundtype	Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files
  * @param int		$backgroundnum	Number of background images in image mode
  *
  */
 function XoopsFormCaptcha($caption = '', $name = 'xoopscaptcha', $skipmember = null, $numchar = null, $minfontsize = null, $maxfontsize = null, $backgroundtype = null, $backgroundnum = null)
 {
     if (!class_exists("XoopsCaptcaha")) {
         require_once SMARTOBJECT_ROOT_PATH . "/include/captcha/captcha.php";
     }
     $this->_captchaHandler =& XoopsCaptcha::instance();
     $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum);
     if (!$this->_captchaHandler->active) {
         $this->setHidden();
     } else {
         $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption();
         $this->setCaption($caption);
     }
 }
Exemplo n.º 2
0
             $_SESSION['xoopsUserGroups'] = $user->getGroups();
             if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {
                 setcookie($xoopsConfig['session_name'], session_id(), time() + 60 * $xoopsConfig['session_expire'], '/', '', 0);
             }
             $user_theme = $user->getVar('theme');
             if (in_array($user_theme, $xoopsConfig['theme_set_allowed'])) {
                 $_SESSION['xoopsUserTheme'] = $user_theme;
             }
         }
         $xoopsUser =& $user;
         $xoopsUserIsAdmin = $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
     }
 }
 if (!is_object($xoopsUser)) {
     xoops_load("captcha");
     $xoopsCaptcha = XoopsCaptcha::instance();
     if (!$xoopsCaptcha->verify()) {
         $captcha_invalid = true;
         $error_message[] = $xoopsCaptcha->getMessage();
     }
 }
 $isadmin = newbb_isAdmin($forum_obj);
 $time_valid = true;
 if (!$isadmin && !empty($xoopsModuleConfig['post_timelimit'])) {
     $last_post = newbb_getsession('LP');
     if (time() - $last_post < $xoopsModuleConfig['post_timelimit']) {
         $time_valid = false;
     }
 }
 if ($captcha_invalid || !$token_valid || !$time_valid) {
     $_POST['contents_preview'] = 1;