body<= qr/./); my $remote = LJ::get_remote(); return "" unless $remote; my $u = LJ::load_user($remote->{'user'}); return "This feature is currently disabled." if $LJ::DISABLED{mass_privacy}; unless ($u->get_cap('mass_privacy')) { return ""; } my $mode = $POST{'mode'} || $GET{'mode'} || "init"; my $more_public = 0; # flag indiciating if security is becoming more public # Check fields my @errors = (); if (LJ::did_post()) { return LJ::bad_input($ML{'error.invalidform'}) unless LJ::check_form_auth(); # Timeframe push @errors, 'No timeframe selected' unless ($POST{'time'}); # date range if ($POST{'time'} eq 'range' && $mode eq 'change') { if ( !($POST{'s_year'} =~ /\d+/) || !($POST{'s_mon'} =~ /\d+/) || !($POST{'s_day'} =~ /\d+/) ) { push @errors, 'Start date is not a valid date'; } if ( !($POST{'e_year'} =~ /\d+/) || !($POST{'e_mon'} =~ /\d+/) || !($POST{'e_day'} =~ /\d+/) ) { push @errors, 'End date is not a valid date'; } # Round down the day of month to the last day of the month if ( $POST{'s_day'} > LJ::days_in_month($POST{'s_mon'}, $POST{'s_year'}) ) { $POST{'s_day'} = LJ::days_in_month($POST{'s_mon'}, $POST{'s_year'}); } if ( $POST{'e_day'} > LJ::days_in_month($POST{'e_mon'}, $POST{'e_year'}) ) { $POST{'e_day'} = LJ::days_in_month($POST{'e_mon'}, $POST{'e_year'}); } } # security must change if ($POST{'s_security'} eq $POST{'e_security'}) { push @errors, 'Privacy levels are the same'; } # display initial page if errors $mode = 'init' if @errors; # check if security is becoming more public $more_public = 1 if ($POST{'s_security'} eq 'private'); $more_public = 1 if ($POST{'s_security'} eq 'friends' && $POST{'e_security'} eq 'public'); if (($mode eq 'amsure') && $more_public && !LJ::auth_okay($u, $POST{password}, undef, undef, undef)) { push @errors, 'Password Incorrect'; $mode = 'change' if @errors; } } # map security form values to 0) DB value 1) From string 2) To string my %security = ( 'public' => ['public', BML::ml('label.security.public2'), BML::ml('label.security.public2')], 'friends' => ['usemask', BML::ml('label.security.friends'), BML::ml('label.security.friends')], 'private' => ['private', BML::ml('label.security.private2'), BML::ml('label.security.private2')]); # Initial view of page if ($mode eq "init") { my $ret = ''; $ret .= LJ::bad_input(@errors) if @errors; $ret .= ""; $ret .= " "href='" . $u->journal_base() . "/calendar/'" }) . " p?>\n";; $ret .= "
"; return $ret; # User has chosen parameters for making change } elsif ($mode eq "change") { my ($posts, $s_unixtime, $e_unixtime); my $form_root = $more_public ? $LJ::SSLROOT : "."; my $body = "