fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-01-27 03:15 am

[dw-free] undefined string warning in LJ/Widget/Login.pm

[commit: http://hg.dwscoalition.org/dw-free/rev/a7530eb7c7e3]

http://bugs.dwscoalition.org/show_bug.cgi?id=4203

Shush warnings (right patch this time)

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Widget/Login.pm
--------------------------------------------------------------------------------
diff -r c8ac0e294999 -r a7530eb7c7e3 cgi-bin/LJ/Widget/Login.pm
--- a/cgi-bin/LJ/Widget/Login.pm	Fri Jan 27 10:33:26 2012 +0800
+++ b/cgi-bin/LJ/Widget/Login.pm	Fri Jan 27 11:17:11 2012 +0800
@@ -29,7 +29,7 @@
 
     my $nojs = $opts{nojs};
     my $user = $opts{user};
-    my $mode = $opts{mode};
+    my $mode = $opts{mode} || '';
 
     my $getextra = $nojs ? '?nojs=1' : '';
 
@@ -38,13 +38,15 @@
     my $r = eval { BML::get_request() };
     my $isloginpage = 0;
     $isloginpage = 1 if ($r->uri eq '/login.bml');
+    my $has_get_ret;
+    $has_get_ret = 1 if $opts{get_ret} && $opts{get_ret} == 1;
 
-    if (!$isloginpage && $opts{get_ret} == 1) {
+    if ( ! $isloginpage && $has_get_ret ) {
         $getextra .= $getextra eq '' ? '?ret=1' : '&ret=1';
     }
 
     my $root = $LJ::IS_SSL ? $LJ::SSLROOT : $LJ::SITEROOT;
-    my $form_class = LJ::Hooks::run_hook("login_form_class_name_$opts{mode}");
+    my $form_class = LJ::Hooks::run_hook("login_form_class_name_$mode");
     $form_class = "lj_login_form pkg" unless $form_class;
     $ret .= "<form action='$root/login$getextra' method='post' class='$form_class'>\n";
     $ret .= LJ::form_auth();
@@ -55,7 +57,7 @@
 
     my $referer = BML::get_client_header('Referer');
     my $eh_ref;
-    if ($isloginpage && $opts{get_ret} == 1 && $referer) {
+    if ( $isloginpage && $has_get_ret && $referer ) {
         $eh_ref = LJ::ehtml($referer);
         $ret .= "<input type='hidden' name='ref' value='$eh_ref' />\n";
     }
@@ -69,7 +71,7 @@
         $ret .= LJ::html_hidden('returnto', LJ::ehtml($opts{returnto}));
     }
 
-    my $hook_rv = LJ::Hooks::run_hook("login_form_$opts{mode}", create_link => $opts{create_link});
+    my $hook_rv = LJ::Hooks::run_hook("login_form_$mode", create_link => $opts{create_link});
     if ($hook_rv) {
         $ret .= $hook_rv;
     } else {
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org