示例#1
0
 function version_update($cur_version)
 {
     $seed = sk2_rand_str(10);
     $this->set_option_value('secret_seed', $seed);
     $this->log_msg(__("Resetting secret seed to: ", 'sk2') . $seed, 5);
     return true;
 }
示例#2
0
 function treat_this(&$cmt_object)
 {
     if ($cmt_object->can_unlock()) {
         foreach ($cmt_object->unlock_keys as $key => $this_key) {
             if ($this_key['class'] == get_class($this)) {
                 unset($cmt_object->unlock_keys[$key]);
             }
         }
     }
     if (!$cmt_object->is_comment() || $cmt_object->is_post_proc()) {
         return;
     }
     if ($cmt_object->karma >= 0 || $cmt_object->karma < $this->get_option_value("threshold")) {
         return;
     }
     $expiration = max(500, 3600 * $this->get_option_value("expiration"));
     $cmt_object->add_unlock_key(sk2_rand_str(ceil(4 * $this->get_option_value("weight")), true), get_class($this), time() + $expiration);
     $this->log_msg(sprintf(__("Set Captcha unlock key, will expire in %d seconds.", 'sk2'), $expiration), 3);
 }