/** * Update AntiSpam Settings * * @access public * @param bool $filter * @param string $default_captcha * @param string $default_captcha_driver * @param bool $obfuscator * @return bool True on success and Jaws error on failure */ function UpdateAntiSpamSettings($filter, $default_captcha, $default_captcha_driver, $obfuscator, $blocked_domains) { $this->gadget->registry->update('filter', $filter); $this->gadget->registry->update('default_captcha_status', $default_captcha); $this->gadget->registry->update('default_captcha_driver', $default_captcha_driver); $this->gadget->registry->update('obfuscator', $obfuscator); $this->gadget->registry->update('blocked_domains', "\n" . trim($blocked_domains)); // install captcha driver $objCaptcha = Jaws_Captcha::getInstance($default_captcha_driver); $objCaptcha->install(); $GLOBALS['app']->Session->PushLastResponse(_t('POLICY_RESPONSE_ANTISPAM_UPDATED'), RESPONSE_NOTICE); return true; }
/** * Update Advanced Policies * * @access public * @param string $password_complexity * @param int $password_bad_count * @param int $password_lockedout_time * @param int $password_max_age * @param int $password_min_length * @param string $login_captcha * @param string $login_captcha_driver * @param string $xss_parsing_level * @param int $session_idle_timeout * @param int $session_remember_timeout * @return bool True on success and Jaws error on failure */ function UpdateAdvancedPolicies($password_complexity, $password_bad_count, $password_lockedout_time, $password_max_age, $password_min_length, $login_captcha, $login_captcha_driver, $xss_parsing_level, $session_idle_timeout, $session_remember_timeout) { $this->gadget->registry->update('password_complexity', $password_complexity == 'yes' ? 'yes' : 'no'); $this->gadget->registry->update('password_bad_count', (int) $password_bad_count); $this->gadget->registry->update('password_lockedout_time', (int) $password_lockedout_time); $this->gadget->registry->update('password_max_age', (int) $password_max_age); $this->gadget->registry->update('password_min_length', (int) $password_min_length); $this->gadget->registry->update('login_captcha_status', $login_captcha); $this->gadget->registry->update('login_captcha_driver', $login_captcha_driver); $this->gadget->registry->update('xss_parsing_level', $xss_parsing_level == 'paranoid' ? 'paranoid' : 'normal'); $this->gadget->registry->update('session_idle_timeout', (int) $session_idle_timeout); $this->gadget->registry->update('session_remember_timeout', (int) $session_remember_timeout); // install captcha driver $objCaptcha = Jaws_Captcha::getInstance($login_captcha_driver); $objCaptcha->install(); $GLOBALS['app']->Session->PushLastResponse(_t('POLICY_RESPONSE_ADVANCED_POLICIES_UPDATED'), RESPONSE_NOTICE); return true; }
/** * Tricky way to get the captcha image... * @access public * @return PNG image */ function Captcha() { $get = jaws()->request->fetch(array('field', 'key'), 'get'); $dCaptcha = $this->gadget->registry->fetch($get['field'] . '_captcha_driver'); $objCaptcha = Jaws_Captcha::getInstance($dCaptcha); return $objCaptcha->image($get['key']); }