Committer: ahassanAnother one from the "this never should've worked" files: image input fields send "x" and "y" coordinates (eg, if you have input name="hello", you actually get "hello.x" and "hello.y" in the POST values). Some browsers also send along the value of the input tag itself, causing this to work as intended. But not all browsers do (and they shouldn't, that's not how image tags are supposed to work).
So this should address the "i clicked basic but got plus" or "i clicked paid and got plus" issues -- check for the submission of the coordinates, which all browsers submit, rather than the actual value. Kind of a hack solution, but a little cleaner than having three forms instead.
U trunk/cgi-bin/LJ/Hooks/CreatePage.pm
U trunk/cgi-bin/LJ/Widget/FeatureMatrix.pm
U trunk/htdocs/step2.bml
Modified: trunk/cgi-bin/LJ/Hooks/CreatePage.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/CreatePage.pm 2007-07-08 07:15:57 UTC (rev 5207)
+++ trunk/cgi-bin/LJ/Hooks/CreatePage.pm 2007-07-09 11:40:12 UTC (rev 5208)
@@ -126,13 +126,21 @@
my $redir = $ar->{redirect};
my $u = $ar->{u};
- my $atype = $post->{'ljcom_atype'};
+ my $atype;
- # Compatibility for upgrade
- if ($atype =~ /^\d{1,2}$/) {
- $atype = 'paid';
- $atype = 'free' if $atype == 0;
+ # submits are image input fields, which submits the coordinates of
+ # where the user clicked, rather than the value in the tag
+ if (defined $post->{'choose_paid.x'}) {
+ $atype = "paid";
+ } elsif (defined $post->{'choose_plus.x'}) {
+ $atype = "plus";
+ } elsif (defined $post->{'choose_free.x'}) {
+ $atype = "free";
+ } else {
+ # compatibility during upgrade
+ $atype = $post->{'ljcom_atype'};
}
+
$atype = 'free' unless $atype =~ /^(free|plus|paid)$/;
LJ::set_userprop($u, "create_accttype", $atype);
Modified: trunk/cgi-bin/LJ/Widget/FeatureMatrix.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/FeatureMatrix.pm 2007-07-08 07:15:57 UTC (rev 5207)
+++ trunk/cgi-bin/LJ/Widget/FeatureMatrix.pm 2007-07-09 11:40:12 UTC (rev 5208)
@@ -457,17 +457,17 @@
$matrixheader .= LJ::form_auth();
$matrixheader .= "Basic";
- $matrixheader .= "
\n"
+ $matrixheader .= "
\n"
unless $hide_upgrade;
$matrixheader .= "";
$matrixheader .= "Plus*";
- $matrixheader .= "
"
+ $matrixheader .= "
"
unless $hide_upgrade;
$matrixheader .= "";
$matrixheader .= "
Paid";
- $matrixheader .= "
"
+ $matrixheader .= "
"
unless $hide_upgrade;
$matrixheader .= "";
Modified: trunk/htdocs/step2.bml
===================================================================
--- trunk/htdocs/step2.bml 2007-07-08 07:15:57 UTC (rev 5207)
+++ trunk/htdocs/step2.bml 2007-07-09 11:40:12 UTC (rev 5208)
@@ -26,7 +26,7 @@
unless LJ::check_form_auth();
# plus is the default, so remove them if they want basic
- $u->remove_from_class('plus') if $u->in_class('plus') && $POST{ljcom_atype} eq 'free';
+ $u->remove_from_class('plus') if $u->in_class('plus') && defined $POST{"choose_free.x"};
# Set default style again in case they changed their account level from the default
LJ::run_hook('set_default_style', $u);