mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-04 08:29 am

[dw-free] Text message disclaimer footer gets printed out multiple times (or 0 times)

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

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

Fix duplicated footer and lack of return message.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/tools/textmessage.bml
--------------------------------------------------------------------------------
diff -r 7ae8f3bc4d66 -r fcfdee66865b htdocs/tools/textmessage.bml
--- a/htdocs/tools/textmessage.bml	Wed Mar 04 08:25:52 2009 +0000
+++ b/htdocs/tools/textmessage.bml	Wed Mar 04 08:29:25 2009 +0000
@@ -21,8 +21,7 @@ body<=
             $ret .= "<P><B>$info->{'name'}</B> ($ML{'.providers.from'} $info->{'fromlimit'}, $ML{'.providers.msg'} $info->{'msglimit'}, $ML{'.providers.total'} $info->{'totlimit'})<BR>$info->{'notes'}";
         }
         $ret .= "</UL>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     unless ($user) {
@@ -30,8 +29,7 @@ body<=
             "<?p ".BML::ml('.enter.user.text2', { sitenameshort => $LJ::SITENAMESHORT })." p?>".
             "<div style='margin-left: 40px'><form method='get' action='textmessage.bml'>$ML{'.enter.user.input'} <input type='text' size='15' maxlength='15' name='user' /> <input type='submit' value=\"$ML{'.enter.user.submit'}\" /></form></div>".
             "<p>".BML::ml('.setup.text', { aopts => "href='$LJ::SITEROOT/manage/profile/'" })."</p>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     my $u = LJ::load_user($user);
@@ -40,8 +38,7 @@ body<=
     if (!$u) {
         $ret .= "<?h1 $ML{'.error.unavailable.head'} h1?><?p ".
             BML::ml('.error.unavailable.notfound', { user => $user })." p?>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     if ($u->{'txtmsg_status'} eq "on") {
@@ -50,15 +47,13 @@ body<=
 
     unless (LJ::get_cap($u, "textmessaging")) {
         $ret .= "$ML{'.error.unavailable.head'} h1?><?p $ML{'.error.unavailable.notpermitted'} p?>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     unless ($tminfo) {
         $ret .= "<?h1 $ML{'.error.unavailable.head'} h1?><?p ".
             BML::ml('.error.unavailable.notsetup', { sitenameshort => $LJ::SITENAMESHORT }) . " p?>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     my $remote = LJ::get_remote();
@@ -70,16 +65,14 @@ body<=
         unless ($remote) {
             $ret .= "<?h1 $ML{'.error.notloggedin.head'} h1?><?p ".
                 BML::ml('.error.notloggedin.text', { aopts => "href='/login.bml?ret=1'", andbefriend => $andbefriend}) . " p?>";
-            add_footer();
-            return $ret;
+            return add_footer( $ret );
         }
 
         if ($tminfo->{'security'} eq "friends" && $u->{'userid'} != $remote->{'userid'}) {
             unless ( $u->trusts_or_has_member( $remote ) ) {
                 $ret .= "<?h1 $ML{'.error.unauthorized.head'} h1?><?p ".
                     BML::ml('.error.unauthorized.text', { user => $u->{'user'} }) ." p?>";
-                add_footer();
-                return $ret;
+                return add_footer( $ret );
             }
         }
     }
@@ -87,8 +80,7 @@ body<=
     if ($remote && $u->has_banned($remote)) {
         $ret .= "<?h1 $ML{'.error.banned.head'} h1?><?p ".
             BML::ml('.error.banned.text', { user => $u->ljuser_display })." p?>";
-        add_footer();
-        return $ret;
+        return add_footer( $ret );
     }
 
     ###### authorized.
@@ -111,9 +103,8 @@ body<=
         s/(\d{3,})/'x'x length $1/eg foreach @errors;
 
         return LJ::bad_input(@errors) if @errors;
-
         $ret .= "<?h1 $ML{'.success.head'} h1?><?p $ML{'.success.text'} p?>";
-        return add_footer();
+        return add_footer( $ret );
     }
 
     my $pinfo = LJ::TextMessage::provider_info($tminfo->{'provider'});
@@ -142,14 +133,17 @@ body<=
     $ret .= "<p><input type='submit' value=\"$ML{'.form.message.submit'}\" /></p>";
     $ret .= "</form></ul>";
 
-    add_footer();
-    return $ret;
+    return add_footer( $ret );
 
     sub add_footer
     {
+        my $ret = shift;
+
         my $howwork = $LJ::HELP_URL{'textmessaging_about'} ? 
             BML::ml('.footer.howwork.text', { aopts => "href='$LJ::HELP_URL{'textmessaging_about'}'" }) ."<br />" : "";
         $ret .= "<p><hr /><font size='-1'>$howwork".$ML{'.footer.disclaimer.text'}."</font></p>";
+
+        return $ret;
     }
 
 }
--------------------------------------------------------------------------------