Changeset 256
- Timestamp:
- 10/05/06 02:06:26 (2 years ago)
- Files:
-
- captcha/trunk/plugins/captcha/captcha.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
captcha/trunk/plugins/captcha/captcha.pl
r254 r256 63 63 64 64 # load config 65 my $cfg = config('blog:' . $blog->id);65 my $cfg = $plugin->get_config_hash('blog:' . $blog->id); 66 66 67 67 # check if captcha-test disabled … … 90 90 my $plugin = shift; 91 91 92 my $ conf= '';92 my $res = ''; 93 93 my @blogs = MT::Blog->load; 94 94 for my $blog (@blogs) { 95 my $c onfig = $plugin->get_config_hash('blog:' . $blog->id);96 next unless $c onfig->{captcha_enable};97 $ conf.= $blog->id . ',' .98 $c onfig->{captcha_ttl} . ',' .99 $c onfig->{captcha_secret} . ',' .100 $c onfig->{captcha_length} . ',' .101 $c onfig->{captcha_images_url} . ',' .102 $c onfig->{captcha_images_path} . "\n";95 my $cfg = $plugin->get_config_hash('blog:' . $blog->id); 96 next unless $cfg->{captcha_enable}; 97 $res .= $blog->id . ',' . 98 $cfg->{captcha_ttl} . ',' . 99 $cfg->{captcha_secret} . ',' . 100 $cfg->{captcha_length} . ',' . 101 $cfg->{captcha_images_url} . ',' . 102 $cfg->{captcha_images_path} . "\n"; 103 103 } 104 104 … … 107 107 open FH, ">$cfg_file" or die "Can't open File: $cfg_file\n"; 108 108 flock FH, 2; 109 print FH $ conf;109 print FH $res; 110 110 close(FH); 111 111 } … … 125 125 } 126 126 127 use MT::Request;128 sub config {129 return {} unless $plugin;130 my $scope = shift || 'system';131 my $r = MT::Request->instance;132 my $cfg = $r->cache('captcha_config_' . $scope);133 if (!$cfg) {134 $cfg = $plugin->get_config_hash($scope);135 $r->cache('captcha_config_' . $scope, $cfg);136 }137 $cfg;138 }139 140 127 1;
