Changeset 1480 for trunk/mixiComment
- Timestamp:
- 03/02/09 08:35:18 (9 months ago)
- Location:
- trunk/mixiComment/plugins/mixiComment
- Files:
-
- 6 added
- 4 modified
-
lib/mixiComment/App.pm (modified) (1 diff)
-
lib/mixiComment/Auth/mixi.pm (modified) (3 diffs)
-
lib/mixiComment/L10N/de.pm (added)
-
lib/mixiComment/L10N/es.pm (added)
-
lib/mixiComment/L10N/fr.pm (added)
-
lib/mixiComment/L10N/ja.pm (modified) (1 diff)
-
lib/mixiComment/L10N/nl.pm (added)
-
mixiComment.pl (modified) (2 diffs)
-
php (added)
-
php/init.mixiComment.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mixiComment/plugins/mixiComment/lib/mixiComment/App.pm
r971 r1480 52 52 } 53 53 54 sub openid_commenter_condition { 55 eval "require Digest::SHA1;"; 56 return 0 if $@; 57 eval "require Crypt::SSLeay;"; 58 return 0 if $@; 59 return 1; 60 } 61 62 sub commenter_auth_params { 63 my ($key, $blog_id, $entry_id, $static) = @_; 64 65 my %param; 66 my $plugin = MT->component('mixicomment'); 67 $plugin->load_config(\%param, "blog:$blog_id"); 68 my $url; 69 if ( my $mixi_id = $param{mixi_id} ) { 70 $url = "https://id.mixi.jp/$mixi_id/friends"; 71 } 72 else { 73 $url = "http://mixi.jp/"; 74 } 75 my $params = { 76 blog_id => $blog_id, 77 static => $static, 78 url => $url, 79 }; 80 $params->{entry_id} = $entry_id if defined $entry_id; 81 return $params; 82 } 83 54 84 1; 55 85 __END__ -
trunk/mixiComment/plugins/mixiComment/lib/mixiComment/Auth/mixi.pm
r1066 r1480 15 15 my $return_to = $path . '?__mode=mixicomment_verify_blog_owner' 16 16 . '&blog_id=' . $blog->id; 17 return ( trust_root => $path, return_to => $return_to );17 return ( trust_root => $path, return_to => $return_to, delayed_return => 1 ); 18 18 } 19 19 else { 20 return $class->SUPER::check_url_params(@_); 20 my %params = $class->SUPER::check_url_params(@_); 21 $params{delayed_return} = 1; 22 return %params; 21 23 } 22 24 } … … 33 35 } 34 36 35 # TODO: remove these once core code supports SREG - BugID:71011 36 sub NS_OPENID_SREG { "http://openid.net/extensions/sreg/1.1" } 37 sub set_extension_args { 38 my $class = shift; 39 my ( $claimed_identity ) = @_; 37 40 38 sub login { 39 my $class = shift; 40 my ($app) = @_; 41 my $q = $app->{query}; 42 return $app->errtrans("Invalid request.") 43 unless $q->param('blog_id'); 44 my $blog = MT::Blog->load(scalar $q->param('blog_id')); 45 my %param = $app->param_hash; 46 my $csr = MT::Auth::OpenID::_get_csr(\%param, $blog) or return; 47 my $identity = $q->param('openid_url'); 48 if (!$identity && 49 (my $u = $q->param('openid_userid')) && $class->can('url_for_userid')) { 50 $identity = $class->url_for_userid($u); 51 } 52 my $claimed_identity = $csr->claimed_identity($identity); 53 if (!$claimed_identity) { 54 my ($err_code, $err_msg) = ($csr->errcode, $csr->errtext); 55 if ($err_code eq 'no_head_tag' || $err_code eq 'no_identity_server' || $err_code eq 'url_gone') { 56 $err_msg = $app->translate('The address entered does not appear to be an OpenID'); 57 } 58 elsif ($err_code eq 'empty_url' || $err_code eq 'bogus_url') { 59 $err_msg = $app->translate('The text entered does not appear to be a web address'); 60 } 61 elsif ($err_code eq 'url_fetch_error') { 62 $err_msg =~ s{ \A Error \s fetching \s URL: \s }{}xms; 63 $err_msg = $app->translate('Unable to connect to [_1]: [_2]', $identity, $err_msg); 64 } 65 return $app->error($app->translate("Could not verify the OpenID provided: [_1]", $err_msg)); 66 } 67 68 my %params = $class->check_url_params( $app, $blog ); 69 70 $claimed_identity->set_extension_args(NS_OPENID_SREG(), { 41 $claimed_identity->set_extension_args(MT::Auth::OpenID::NS_OPENID_SREG(), { 71 42 optional => join(",", qw/email nickname fullname/) 72 43 }); 73 74 my $check_url = $claimed_identity->check_url(75 ( %params, delayed_return => 1 )76 );77 78 return $app->redirect($check_url);79 44 } 80 45 … … 84 49 85 50 # Try SREG extension first 86 my $fields = $vident->extension_fields( NS_OPENID_SREG);51 my $fields = $vident->extension_fields(MT::Auth::OpenID::NS_OPENID_SREG()); 87 52 my $nick = $fields->{nickname} if exists $fields->{nickname}; 88 53 $nick ||= $fields->{fullname} if exists $fields->{fullname}; -
trunk/mixiComment/plugins/mixiComment/lib/mixiComment/L10N/ja.pm
r971 r1480 6 6 7 7 %Lexicon = ( 8 'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'mixiã®ã¢ã«ãŠã³ãã䜿ã£ãŠMovable Type 4ã«ã³ã¡ã³ãããããšãã§ããããã«ããŸãã', 9 'mixi reported that you failed to login. Try again.' => 'ãã°ã€ã³ã«å€±æããŸããã', 10 'A mixi ID has already been registered in this blog. If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account. If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'ãã§ã«mixiã®IDãç»é²ããŠãããŸããããã°ã«é¢é£ä»ããmixiã®IDãå€ãããå Žåã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠmixiã«ãã°ã€ã³</a>ããŠãã ããããã€ãã¯ã ãã§ãªããã¹ãŠã®mixiãŠãŒã¶ãŒããã®ã³ã¡ã³ããåãä»ããããšãã¯ãåæåãã¿ã³ãã¯ãªãã¯ããŠèšå®ãæ¶å»ããŠãã ããã', 11 'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'ãã€ãã¯ããã®ã¿ã³ã¡ã³ããåãä»ããèšå®ã«ããã«ã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠãŸãmixiã«ãã°ã€ã³</a>ããŠãã ããã', 12 'Click the button to sign in using your mixi ID' => 'ãã¿ã³ãã¯ãªãã¯ããŠmixiã«ãã°ã€ã³ããŠãã ããã', 13 'Sign in using your mixi ID' => 'mixiã®IDã§ãã°ã€ã³ãã', 8 9 ## plugins/mixiComment/mixiComment.pl 10 'Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.' => 'mixiã®ã¢ã«ãŠã³ãã䜿ã£ãŠMovable Type 4ã«ã³ã¡ã³ãããããšãã§ããããã«ããŸãã', 11 'Sign in using your mixi ID' => 'mixiã®IDã§ãã°ã€ã³ãã', 12 'Click the button to sign in using your mixi ID' => 'ãã¿ã³ãã¯ãªãã¯ããŠmixiã«ãã°ã€ã³ããŠãã ããã', 13 'mixi' => 'ãã¯ã·ã£', 14 15 ## plugins/mixiComment/lib/mixiComment/App.pm 16 'mixi reported that you failed to login. Try again.' => 'ãã°ã€ã³ã«å€±æããŸããã', 17 18 ## plugins/mixiComment/tmpl/config.tmpl 19 'A mixi ID has already been registered in this blog. If you want to change the mixi ID for the blog, <a href="[_1]">click here</a> to sign in using your mixi account. If you want all of the mixi users to comment to your blog (not only your my mixi users), click the reset button to remove the setting.' => 'ãã§ã«mixiã®IDãç»é²ããŠãããŸããããã°ã«é¢é£ä»ããmixiã®IDãå€ãããå Žåã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠmixiã«ãã°ã€ã³</a>ããŠãã ããããã€ãã¯ã ãã§ãªããã¹ãŠã®mixiãŠãŒã¶ãŒããã®ã³ã¡ã³ããåãä»ããããšãã¯ãåæåãã¿ã³ãã¯ãªãã¯ããŠèšå®ãæ¶å»ããŠãã ããã', 20 'If you want to restrict comments only from your my mixi users, <a href="[_1]">click here</a> to sign in using your mixi account.' => 'ãã€ãã¯ããã®ã¿ã³ã¡ã³ããåãä»ããèšå®ã«ããã«ã¯ã<a href="[_1]">ãããã¯ãªãã¯ããŠãŸãmixiã«ãã°ã€ã³</a>ããŠãã ããã', 21 14 22 ); 15 23 -
trunk/mixiComment/plugins/mixiComment/mixiComment.pl
r971 r1480 13 13 author_url => 'http://www.movabletype.jp/', 14 14 description => '<MT_TRANS phrase="Allows commenters to sign in to Movable Type 4 using their own mixi username and password via OpenID.">', 15 version => '1. 0',15 version => '1.1', 16 16 settings => new MT::PluginSettings([ 17 17 ['mixi_id', { Scope => 'blog' }], … … 69 69 </__trans_section> 70 70 EOT 71 login_form_params => sub { 72 my ($key, $blog_id, $entry_id, $static) = @_; 73 74 my %param; 75 $plugin->load_config(\%param, "blog:$blog_id"); 76 my $url; 77 if ( my $mixi_id = $param{mixi_id} ) { 78 $url = "https://id.mixi.jp/$mixi_id/friends"; 79 } 80 else { 81 $url = "http://mixi.jp/"; 82 } 83 my $params = { 84 blog_id => $blog_id, 85 static => $static, 86 url => $url, 87 }; 88 $params->{entry_id} = $entry_id if defined $entry_id; 89 return $params; 90 }, 71 condition => '$mixicomment::mixiComment::App::openid_commenter_condition', 72 login_form_params => '$mixicomment::mixiComment::App::commenter_auth_params', 91 73 logo => 'plugins/mixiComment/images/signin_mixi.png', 92 74 logo_small => 'plugins/mixiComment/images/signin_mixi_small.gif'
